Help us shape the future of Go! Take the 2026 Go Developer Survey

rockiscope

command module
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 13 Imported by: 0

README ยถ

โšพ Rockiscope

test coverage Go Report Card Release

A Bluesky bot that posts daily horoscopes and win/loss predictions for the Colorado Rockies โ€” a team that has given its fans almost nothing but pain since 2018, yet here we are, building software for them.

Born on July 5, 1991, the Rockies are a Cancer. Every game day, Rockiscope scrapes the daily Cancer horoscope, pulls live stats from the MLB API, runs everything through a prediction engine where the stars get the final say, and posts the result to Bluesky โ€” one hour before first pitch.

On off-days, it posts the horoscope with a season stats summary because even when they're not playing, you're still thinking about them. ๐Ÿ”ฎ

๐Ÿง  The Prediction Engine

Real stats provide the foundation, but the horoscope tips the scales. The engine weighs multiple factors and learns from its mistakes over time:

Factor Starting Weight What it uses
Team win rate 30% Season record from MLB standings
Pitcher matchup 30% ERA + WHIP: our starter vs theirs
Head-to-head 15% Season series record vs today's opponent
Home/away split 10% How we play at home vs on the road
Streak momentum 5% Current W/L streak
๐Ÿ”ฎ Horoscope 10% The stars speak via SHA-256 hash of the daily reading
๐ŸŽฏ Dynamic Weights

The prediction engine learns from its mistakes. After each game:

  1. Records the prediction + actual result to prediction_history.json
  2. Calculates which factors "pointed" the right direction over the last 10 games
  3. Adjusts factor weights ยฑ3% toward better-performing factors
  4. Clamps weights to prevent any single factor from dominating (>45%) or disappearing (<2%)

Weights start at the values above but shift over time based on what's actually predicting correctly. On first run, the bot starts fresh โ€” weights adjust as the season progresses. After 10+ games, the model begins dynamically optimizing.

๐Ÿ”„ Follow-up Posts

After each game, Rockiscope posts a follow-up reply with the result:

  • Correct prediction:
๐ŸงŠ Cold, predictable, cosmically certified disappointment.

๐Ÿ Rockies L
๐Ÿ“Š Colorado Rockies 3-11 Los Angeles Dodgers

๐ŸŽฏ 41/63 correct predictions this season
  • Wrong:
๐Ÿ“‰ Prediction busted. Vibes immaculate.

๐Ÿ Rockies W
๐Ÿ“Š Colorado Rockies 6-5 Los Angeles Dodgers

๐ŸŽฏ 41/64 correct predictions this season

๐Ÿ“บ Live Game Threads

Once the prediction is posted, the bot watches the game and replies in the same thread as it happens. Each game thread has three parts: the pregame prediction, a live update for every notable play, and the final result.

What counts as notable: scoring plays, home runs, and any play that swings win probability by 10+ points or comes in a high-leverage spot (leverage index โ‰ฅ 2).

For each one, Rockiscope:

  1. Waits for the highlight. MLB usually publishes the clip 1โ€“3 minutes after the play. The bot matches it by playId and uploads it as inline video. If the daily video quota is used up or the upload fails, it falls back to a link card. If no clip shows up within 10 minutes, it posts without one.
  2. Reads the birth charts. It compares the batter's sign against the pitcher's. Elements form a food chain: water douses fire, fire consumes air, air erodes earth, earth absorbs water. Modality breaks ties. Then it reacts, loudly, based on what happened (a homer, a strikeout, a double play) and the personality of whichever sign came out ahead or got burned.
  3. Corrects science. MLB's real win probability is the baseline. When the stars favored the player who came through, they amplify the swing. When the play defied the stars, they call it a fluke and claw some of it back. Leverage decides how loudly they weigh in. The correction starts from the pregame prediction and fades a little with each play, so the stars never stray more than 12 points from science.
๐Ÿ’ฅ Top 2 ยท TB 2, CLE 0
Jonathan Aranda's RBI single

โ™Š Aranda's air erodes โ™‰ Messick's earth.
AS FORETOLD. Aranda with the hit. Pure Gemini behavior: two personalities and BOTH can hit.
๐Ÿ˜ฌ Big moment ยท 86 mph off the bat
๐Ÿ”ฎ Rays' win chances: science 73% (โ–ฒ9) ยท the stars 78% (โ–ฒ8)

๐Ÿ“Ž Attached: the highlight clip

The final result post replies to the last update and attaches a chart of science vs. the stars across the whole game. This works for Rockies regular-season games and the adopted postseason team.

Reboot-proof. Each thread is saved to live_threads.json after every change: the last post, the stars' running correction, and the plays still waiting on clips. A supervisor checks every 2 minutes that each game in progress has a watcher, and restarts one after a crash or power cut. Plays that ended more than 15 minutes before the bot came back are skipped, so a reboot never floods the thread with old news. Live updates have their own budget of 15 per game, so they never count against the daily post cap.

๐Ÿ—“๏ธ The Other Six Months

The Rockies' season ends in September. Rockiscope's doesn't. The bot reads MLB's season calendar and changes modes on its own:

Phase What it posts
โšพ Regular season Everything above. Unchanged.
๐Ÿผ Postseason A report card thread for the season (accuracy, which signals worked, what the model learned, best call, worst miss). Then the bot adopts a playoff team, picking the roster whose players' birth charts are most compatible with a Cancer. It predicts the adopted team's games and replies with results. When they're eliminated, it re-adopts. When someone wins the World Series, it takes credit if it can.
๐Ÿ”ฅ Hot stove Only posts when something happens. Rockies trades, signings, waiver claims, DFAs and releases are checked at 10 AM and 5 PM, each with the player's zodiac sign and Rockies compatibility. Minor-league deals are ignored, and busy days roll up into a digest. Every Sunday there's an Opening Day countdown.
๐ŸŒต Spring training Predictions for spring games. It doesn't count. Neither does this. These picks are stored separately and never touch the real season's weights. The countdown goes daily for the final week.

Season rollover. When spring training starts, the finished season's predictions, final weights and a stats summary are archived to archive/<season>/. The live history then resets with default weights and the bot announces the fresh start. If the bot was offline all spring, the rollover happens on Opening Day instead.

๐Ÿ›Ÿ Built to survive a Raspberry Pi
  • Crash-safe state. Every file is written atomically with a .bak fallback, so a power cut mid-write can't corrupt the season.
  • No double posts. Every seasonal post has an idempotency key that's saved the moment it posts. A reboot mid-day, or mid-thread, picks up exactly where it left off.
  • No late predictions. If the Pi was down through a pregame window, that game is skipped. Predicting after first pitch would be cheating.
  • Graceful degradation. Failed API calls retry with backoff, then the bot tries again in 15 minutes. If MLB's calendar is unreachable it falls back to a cached copy, then to a month-based guess. If a horoscope or stat is missing, the post goes out without it.
  • Polite. MLB requests are spaced out, the bot posts nothing between 10 PM and 8 AM except game results, and a daily post cap catches runaway bugs.
  • Clock-aware. The bot waits for NTP before acting, since a Pi has no hardware clock, and timezone data is embedded in the binary.

๐Ÿ“Š Dashboard

rockiscope run also serves an analytics dashboard on port 8086 (ROCKISCOPE_PORT to change it).

  • Every season, every phase. Pick a season, then switch between โšพ Regular Season, ๐Ÿผ Postseason, ๐ŸŒต Spring Training and ๐Ÿ”ฅ Hot Stove. Each prediction phase gets the same set:
    • Cosmic highlights: biggest upset, worst whiff, called shots, streaks.
    • A game-by-game season calendar.
    • The Bot vs. the Pessimist: would "always pick L" have beaten us? (In 2026 it did, by 5.) Postseason and spring race a coin flip instead.
    • Stars vs. Science: who was right when the horoscope disagreed with the stats.
    • Confidence Is Decorative: accuracy by the confidence phrase the posts used.
    • Record by opponent, and an expandable game log. Click a game to see where it was played, both starting pitchers, the call in the post's own words, what each factor said, and links to the Bluesky post and MLB Gameday.
  • Regular season adds Trust in the Stars, the weights rebuilt game by game by replaying the engine's updates, plus the factor-weights pie.
  • Postseason adds the Adoption Agency (who we adopted, when they let us down) and the playoff birth-chart audit.
  • Hot Stove shows every roster move posted, with signs and Rockies compatibility.
  • Finished seasons get their report card. ๐Ÿ“š All-time compares seasons side by side.
  • A phase banner shows what the bot is doing right now: the adopted team, the Opening Day countdown, or spring picks.

It's read-only: the dashboard reads the same crash-safe files the bot writes, including archive/. The JSON is available at /api/status, /api/seasons and /api/season/{year}.

๐Ÿ“ก CLI

rockiscope <command>

  run          Start the daemon (default)
  post         Force a post now, skip the schedule
  preview      Print what would be posted, don't touch Bluesky or any files
  phase        Show the current mode (regular season, postseason, offseason, spring)
  test-auth    Verify Bluesky credentials
  test-mlb     Hit the MLB API and show today's game
  test-horo    Scrape today's horoscope
  version      Print version

๐Ÿš€ Install

One command on a Raspberry Pi (or any Linux box):

curl -sSL https://raw.githubusercontent.com/tlugger/rockiscope/main/install.sh | sudo bash

This will:

  • ๐Ÿ“ฆ Download the latest release binary (or clone + build from source if no release exists)
  • ๐Ÿ“„ Create a .env file with placeholder Bluesky credentials
  • โš™๏ธ Install and enable a systemd service

After the install, edit your credentials and start the service:

sudo nano /home/pi/rockiscope/.env    # add your Bluesky app password
sudo systemctl start rockiscope

Create an app password at bsky.app/settings/app-passwords.

To update, re-run the same install command. It:

  1. backs up your data (prediction_history.json, season_state.json, archive/) to backups/
  2. downloads and checksum-verifies the new binary before touching the running bot
  3. swaps it in, keeping the old one as rockiscope.prev
  4. restarts and health-checks the service, rolling back automatically if the new version won't stay up
Managing the service
sudo systemctl status rockiscope      # check status
sudo systemctl restart rockiscope     # restart
tail -f /home/pi/rockiscope/rockiscope.log  # logs

๐Ÿ“Š Data Sources

  • MLB Stats API โ€” free, no auth, real-time game data + stats, live win probability and highlight clips
  • Horoscope.com โ€” daily Cancer horoscope
  • Bluesky AT Protocol โ€” posting via XRPC API

โœจ Sample Posts

Each post includes the game info and prediction as text, with the full horoscope rendered as an attached image card โ€” crescent moon, constellation, and all. The bot quotes one line of the day's horoscope back at you and reacts to it. The extras (horoscope roast, ERA and streak reactions, the closing line) drop out first when a post runs long; the facts and the prediction always fit.

Game Day (1 hour before first pitch):

โšพ Rockies @ San Francisco Giants
๐Ÿ• 7:40 PM MDT at Oracle Park
๐Ÿช– Chase Dollander (2.88 ERA, 6-4). Trustworthy. For now.
๐Ÿ“Š 35-48 | W4. Hot. Don't touch it.
๐Ÿ“œ Horoscope: "almost total burnout." Forwarding to the lineup.

๐Ÿ”ฎ A cosmic coin flip, leaning toward a Rockies victory (53%)
Saturn abstained.

๐Ÿ“Ž Attached: horoscope image card

Off Day (10 AM MST):

โšพ No Rockies game today. The cosmos have granted a reprieve.
๐Ÿ“Š 22-41 (.349) | Run Diff: -88 | L4. That's not a typo.

๐Ÿ“œ Horoscope: "you won't feel like talking or socializing with anyone." Saving it for the homestand.

๐Ÿ“Ž Attached: horoscope image card


Built with mass amounts of misplaced loyalty and a mass amount of Coors Banquet. ๐Ÿ”๏ธ

Documentation ยถ

The Go Gopher

There is no documentation for this package.

Directories ยถ

Path Synopsis
internal
astro
Package astro is the bot's entire scientific department: zodiac signs from birth dates, and how well each sign gets along with the Rockies (a Cancer, born July 5, 1991).
Package astro is the bot's entire scientific department: zodiac signs from birth dates, and how well each sign gets along with the Rockies (a Cancer, born July 5, 1991).
fsutil
Package fsutil holds crash-safe file helpers.
Package fsutil holds crash-safe file helpers.
live
Package live follows a game in progress.
Package live follows a game in progress.
mlb
seasonstate
Package seasonstate defines season_state.json: everything the postseason, offseason and spring modes persist.
Package seasonstate defines season_state.json: everything the postseason, offseason and spring modes persist.
web

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL