8.3 KiB
name, description
| name | description |
|---|---|
| lyrebird_review | Run a Lyrebird-specific code review on the current branch. Checks for RT thread safety violations, bus memory rules, Generator/Synthesizer protocol correctness, scheduling model compliance, and test coverage. Invokes lyrebird_review_agent. |
Lyrebird Review
Run a strict Lyrebird-specific review of all changes in the current branch compared to main.
This review goes beyond general code quality — it enforces the hard constraints of the Lyrebird architecture:
- No allocation, deallocation, or locking on the RT audio thread
- No dynamic resizing of bus memory after engine start
- Correct Generator and Synthesizer protocol conformance
- RT-safe scheduling and parameter update patterns
- Test coverage for all new Generators and engine behaviour
Step 0: Worktree-staleness guard
The review agents grep the filesystem at the current working directory. If that
directory is a git worktree checked out to a branch that hasn't picked up
recent merges to main, the agents will fail to find types / methods / files
that were added on main after this worktree was created — and will
hallucinate "missing API" findings against types that actually exist in the
codebase.
Before generating the diff, run:
behind=$(git rev-list --count HEAD..main 2>/dev/null || echo "?")
if [ "$behind" = "?" ]; then
echo "ERROR: cannot compare HEAD..main — is this a git repo with a 'main' branch?"
exit 1
fi
if [ "$behind" -gt 0 ]; then
echo "BLOCKED: worktree HEAD is $behind commit(s) behind main."
echo " The review agents will grep this directory and miss anything"
echo " added on main after this worktree's HEAD."
echo " Fix: 'git merge main' (or rebase) in this worktree, then re-run."
exit 1
fi
If behind > 0, stop and report the error with the exact git merge main
instruction. Do not proceed to the diff or the review agents — their findings
will be unreliable.
Step 1: Generate the diff
git diff --no-color main... > branch.diff
If the command fails (e.g. no main branch), report the error and stop.
Step 2: Run the tests
Always use --no-parallel. The default parallel runner aborts SIGABRT
(_ContiguousArrayStorage retain count 2) at xctest teardown on multi-engine
test combos — a known flake tracked in
memory/project_parallel_test_crash.md. --no-parallel is the canonical
full-suite command (3979/3980 pass; one unrelated pre-existing flake on
RTThreadIdentity / LyrebirdBuffer retain-race). Do not strip the flag to
"go faster" — re-runs from flake hits cost far more energy than the serial
pass.
swift test --no-parallel 2>&1
If tests fail, report the failures immediately and stop — do not proceed to review.
Step 2b: Report doc impact
Doc rot is overwhelmingly caused by a public-API change, and a review that reads only the
diff structurally cannot find it — the stale references live in files the diff never touches.
That is exactly how engine.add gained throws while 11 examples kept calling it without
try, and how LyrebirdFloat was deleted with 75 references outliving it.
bash scripts/check-doc-impact.sh main...HEAD
This never fails — it reports candidates it cannot adjudicate. Capture its output and
paste it into Agent A's prompt below, under a heading ## Doc impact (from check-doc-impact.sh). If it prints OK: the diff changes no public declarations, say so in
the prompt instead and move on.
References inside fences that check-doc-snippets.sh already typechecks are suppressed by
design, so everything it lists is something no automation is checking.
Step 3: Run reviews in parallel
Launch both agents in a single message (two Agent tool calls):
Agent A — Lyrebird architecture review (lyrebird_review_agent)
@workspace
# Do not use the current file as context. Consider the whole workspace and branch.diff.
You are a strict senior audio systems engineer reviewing a Swift audio synthesis framework called Lyrebird. Review all changes in branch.diff. Also read the full content of any changed files — review both changed and unchanged portions.
Apply the Lyrebird-specific review rules defined in your agent instructions.
## Doc impact (from check-doc-impact.sh)
<paste the Step 2b output here>
For every entry above, verify the doc was updated or is genuinely unaffected, and report the
ones that were not. The tool cannot make that judgement — that is why it is your job. Note
that it matches a member name across types, so qualify by the owning type it shows. Anything
listed under "Changed public API with NO doc reference anywhere" is a finding unless the API
is genuinely internal-facing.
Generate a summary titled "Lyrebird Review Results for branch '<name>'" where <name> is the current git branch name.
Agent B — Caveman line-level sweep (general-purpose agent)
You are doing a fast, terse code review of Swift changes in the Lyrebird audio framework.
Run: git diff --no-color main...
Review every changed line. One line of output per finding. Format exactly:
L<line>: <severity> <problem>. <fix>.
Severity levels: bug, risk, nit, q
- bug = definite defect, wrong output, crash risk
- risk = potential issue under specific conditions
- nit = style, naming, minor clarity
- q = question / needs clarification
Skip praise. Skip obvious. Skip anything already correct.
If all changes look good, output exactly: LGTM
Step 4: Present results
Present findings in two sections:
Section 1 — Lyrebird Review Results Output the full review from Agent A without modification.
Section 2 — Caveman Line Sweep Output the full findings from Agent B. If Agent B returned "LGTM", say so in one line.
Step 5: Update memory file (only if review passes with no blocking issues)
If the review agent reports no blocking findings, append a phase entry to the phase history log (NOT MEMORY.md — MEMORY.md is the index and stays small):
/Users/josh/.claude/projects/-Users-josh-Documents-src-Lyrebird/memory/phase_history.md
Append at the end of the file. Phase entries follow this format:
- Phase <N> complete on main — <test count> tests, <one or two short sentences on the key architectural decision, new type introduced, or rationale>
Example:
- Phase 6 complete on main — 192 tests, ParameterTable reference type eliminates RT dict-copy; ControlParameter/ConstantParameter pre-allocate output buffers
If the entry's "what changed" is meaningfully long (review-fix history, multi-component refactor, etc.), still keep it as one bullet. Long entries are acceptable in phase_history.md; the constraint is just that everything stays in one - bullet so future filtering / table-of-contents tooling can grep for ^- Phase.
Do not touch MEMORY.md from this skill. MEMORY.md's ## Phase History section is a pointer to phase_history.md; do not add per-phase entries there.
If you also want to update the "Project State" summary at the top of MEMORY.md (e.g. bumping "Post Phase N" or noting a major architectural change), do that as a separate explicit edit — not part of the routine phase-completion append.
Do not update either memory file if the review found blocking issues — the phase is not complete until they are resolved and the review is re-run clean.
Step 6: Move phase docs (only if review passes with no blocking issues)
After a clean pass, move the completed phase section from docs/00-working-order.md into docs/01-completed-working-order.md and update the summary table in docs/00-working-order.md. This keeps the active planning doc small.
What to move:
- Find the
## Phase N — <Title>section indocs/00-working-order.md(the full description block, from the##heading down to but not including the next##heading or---divider) - Append it at the bottom of
docs/01-completed-working-order.md(after a---separator) - Remove it from
docs/00-working-order.md - Add the phase to the summary table in
docs/00-working-order.mdwith format| N | Title | <test count> | - Update the intro line in
docs/00-working-order.mdto include the new phase number (e.g. "Completed phases (1–34, 36)")
Do not move docs if: the phase section was already moved (i.e. it no longer appears in docs/00-working-order.md). In that case, skip silently.