AGENTS.md
1960 bytes
Muse Guessr
A TUI music guessing game in Go. It scans a music directory, plays short
segments from a random position in each song via aplay, and scores the
player's title/album/artist guesses with fuzzy matching. Game rules and
controls are documented in README.md.
Project structure
Single main package, one file per concern:
main.go— CLI flags (-dir,-blacklist,-rounds), catalog build, TUI startup.catalog.go— recursive music-file walk, blacklist filtering, tag reading (viagithub.com/dhowden/tag), and an on-disk tag cache keyed by file mtime so rescans are fast. Cache lives inos.UserCacheDir()/museguessr/.audio.go—pickStartchooses a random 30s (searchWindow) window in the file; ffmpeg decodes it to mono 44.1kHz s16le andfindStartreturns the first 10ms window whose RMS meets the window's average RMS (fallback: the window start); the segment is written as a temp WAV and played withaplay. Requires ffmpeg, ffprobe, and aplay on PATH.matching.go—fuzzyMatch: normalized similarity (title 4 pts, album 4 pts, artist 2 pts) with a parenthesized-suffix retryui.go— bubbletea TUI: model, game states (playing/guess/result), keyboard handling, scoring, and thestartAudiotea.Cmd that runs playback in a goroutine.blacklist— local blacklist file (one directory per line).
Conventions
- Do NOT add new CLI flags, config options, or user-facing knobs unless
explicitly asked. Hardcode reasonable constants (e.g.
searchWindow) instead. - Do NOT write any tests unless explicitly asked to.
- Keep the single-package layout; don't split into subpackages.
- External dependencies are ffmpeg, ffprobe, and aplay — shell out to them rather than adding Go audio libraries.
- Check with
golangci-lint ./...after changes.
Important instructions
- Never search for music files yourself. Just use the default catalog already in the code