Files
Hermes Agent 810f127d01 Harden for agent users: spec validation, key-sig accidentals, N64 chord qualities
- make_tune: validate_spec() reports every spec problem in one run
  (missing keys, unknown style, bad qualities, bpm<=0, out-of-range
  loop/fills, melody longer than chart, unsafe name) — no raw KeyErrors
- make_tune: key_sig_for handles accidentals in minor and major keys,
  any case (Bb minor, F# minor, bb major); real spellings kept (C# major)
- make_tune: n64 pad uses QUALITIES table (dim/aug/sus now correct)
- make_tune: WARNING on stderr for fields a style can't use (counter
  for non-DOS, fills_at for n64) instead of silent drops
- make_tune: name sanitised ([A-Za-z0-9][A-Za-z0-9._-]*), no traversal
- make_tune: render errors actionable (timidity presence check, stderr
  surfaced, sys.executable instead of bare python3)
- songkit: parse_score lints the FINAL bar too (was unchecked); this
  caught a real 5-beat bar in 01_service_station_2am COUNTER_A (fixed)
- build_all.sh: dependency + soundfont checks, removes stale midi/wav
  outputs with no current source, fails if nothing was produced
- smoke_test: runs every spec, checks loop marker tick positions,
  feeds malformed bars to the linter, covers validation + key sigs
- AGENTS.md: documents 0-based bars and exclusive end_bar, validation
  behaviour; SKILL.md added so the repo loads as an agent skill
2026-10-17 15:59:46 +00:00

32 lines
1.4 KiB
Markdown

---
name: midi-playlist-repo
description: Compose retro game MIDI in /root/midi-playlist via JSON specs. Use when writing, fixing, or rendering chiptune/DOS/N64-style tunes.
version: 1.0.0
---
# midi-playlist: retro MIDI from JSON specs
Repo: `/root/midi-playlist` (stdlib-only Python; `lib/midikit.py`, `lib/songkit.py`).
## The workflow
1. Copy `tunes/specs/04_tea_break_at_the_terminal.json`, change `name`,
`style`, `bpm`, `key`, `chords`, `melody`, `loop`.
2. `python3 tools/make_tune.py tunes/specs/<name>.json --render`
3. Never declare success without a passing run: the command re-parses the
MIDI, renders WAV via timidity, and checks clipping / dead air / duration.
4. Whole-repo check: `python3 tests/smoke_test.py` then `./tools/build_all.sh`.
## Conventions an agent must not guess
- Bars are **0-based**; `loop.end_bar` is **EXCLUSIVE**.
- `melody_start_bar + number of '|' bars <= len(chords)`.
- If the melody uses `|`, every bar (including the last) must total 4/4 —
the linter names the offending bar.
- Styles: `dos_adventure` (OPL-ish, supports `counter` + `fills_at`),
`n64_ambient` (pads/flute, no drums), `chiptune_racing` (stabs, no `counter`).
- Validation reports every spec problem at once; style-incompatible fields
warn on stderr instead of being dropped silently.
Full details, score grammar and rendering options: `AGENTS.md` in the repo.