1.0.0 release
This commit is contained in:
@@ -0,0 +1,159 @@
|
||||
---
|
||||
name: lyrebird_review
|
||||
description: 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:
|
||||
|
||||
```bash
|
||||
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
|
||||
|
||||
```bash
|
||||
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.
|
||||
|
||||
```bash
|
||||
swift test --no-parallel 2>&1
|
||||
```
|
||||
|
||||
If tests fail, report the failures immediately and stop — do not proceed to review.
|
||||
|
||||
## 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.
|
||||
|
||||
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-LyrebirdII/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 in `docs/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.md` with format `| N | Title | <test count> |`
|
||||
- Update the intro line in `docs/00-working-order.md` to 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.
|
||||
@@ -0,0 +1,124 @@
|
||||
---
|
||||
name: lyrebird_review_cycle
|
||||
description: Full codebase review cycle for Lyrebird — architecture/consistency, Swift code quality, and documentation accuracy. Sweeps all of Sources/, not just a diff. Use periodically and before major merges.
|
||||
---
|
||||
|
||||
# Lyrebird Review Cycle
|
||||
|
||||
Run a comprehensive whole-codebase review across three dimensions, then report findings and fix any stale docs.
|
||||
|
||||
## Phase 1: Gather Context
|
||||
|
||||
1. Run `git branch --show-current` to note the branch name
|
||||
2. Run `swift test --no-parallel 2>&1` to confirm the test suite is green (the default parallel runner hits a known xctest-teardown SIGABRT on multi-engine combos — see `memory/project_parallel_test_crash.md`; `--no-parallel` is the canonical full-suite command)
|
||||
|
||||
If tests fail, report the failures immediately and **stop** — do not proceed to reviews.
|
||||
|
||||
## Phase 2: Parallel Reviews
|
||||
|
||||
Launch **all three agents in a single message** (three Agent tool calls):
|
||||
|
||||
### Agent A — Lyrebird Architecture & Consistency (`lyrebird_architect_agent`)
|
||||
|
||||
```
|
||||
Perform a comprehensive architecture and code-reuse audit of the Lyrebird project at /Users/josh/Documents/LyrebirdII.
|
||||
|
||||
Goals:
|
||||
1. Identify duplicate or near-duplicate patterns across generators and modules that should be consolidated into shared helpers or base classes
|
||||
2. Check naming consistency — do public API names align with SuperCollider conventions where intended? Are there inconsistencies between similar generators?
|
||||
3. Check interface consistency — parameter naming conventions (mul/add, freq/cutoff, q/resonance), init parameter order, return types
|
||||
4. Identify generators or modules that deviate from the _Base / GeneratorBase pattern without good reason
|
||||
5. Find public API surface that looks accidental (types or methods that are public but should be internal/private)
|
||||
6. Check that GeneratorEnum conformance is present for all paired (Audio+Control) generators
|
||||
7. Look for architectural risks — things that could become hard to maintain as the project grows
|
||||
8. Check the doc map in CLAUDE.md — are all modules covered?
|
||||
|
||||
Start by reading CLAUDE.md and docs/00-working-order.md for current state, then explore Sources/ for the actual code.
|
||||
|
||||
Produce a concise findings report: grouped by category, each finding with file path, line number, and specific recommendation. Analysis only — do not modify any files.
|
||||
```
|
||||
|
||||
### Agent B — Swift Code Quality (`general-purpose` agent)
|
||||
|
||||
```
|
||||
Perform a Swift code quality review of the Lyrebird audio synthesis framework at /Users/josh/Documents/LyrebirdII/Sources/.
|
||||
|
||||
This is a macOS 15+, Swift 6, swift-tools-version 6.0 project. Read CLAUDE.md first for hard constraints and style rules.
|
||||
|
||||
Review for:
|
||||
1. Force unwraps (`!` on optionals, `try!`) — project bans these
|
||||
2. Magic numbers — non-trivial literals without named constants (exempt: 0, 1, -1, 2 in obvious arithmetic)
|
||||
3. Access control — anything unexpectedly public, missing private/internal
|
||||
4. Swift 6 concurrency correctness — Sendable, actor isolation, nonisolated, @unchecked Sendable usage without invariant comments
|
||||
5. Long functions (>60 lines) that do too many things
|
||||
6. Error handling gaps — missing throws/try patterns at system boundaries
|
||||
7. Missed Swift idioms — nested if instead of guard, missing defer, compactMap opportunities
|
||||
8. Naming deviations — types not UpperCamelCase, methods/vars not lowerCamelCase
|
||||
9. Dead code — unreachable branches, unused variables, commented-out blocks
|
||||
|
||||
Focus on Sources/Lyrebird/ and Sources/LyrebirdUI/. Skip test files and legacy/ directory.
|
||||
|
||||
For each finding: file path (relative to project root), approximate line number, severity (bug/risk/nit), problem, concrete fix.
|
||||
|
||||
Do NOT report RT thread safety or Lyrebird-protocol-specific issues — those are handled by the architecture agent.
|
||||
|
||||
Be thorough but skip trivial/obvious style nits. Report genuinely actionable findings only.
|
||||
```
|
||||
|
||||
### Agent C — RT Audio Correctness (`lyrebird_review_agent`)
|
||||
|
||||
```
|
||||
@workspace
|
||||
|
||||
Perform a full RT-safety and protocol-correctness sweep of the Lyrebird project at /Users/josh/Documents/LyrebirdII/Sources/Lyrebird/.
|
||||
|
||||
Read CLAUDE.md first for all hard constraints.
|
||||
|
||||
Apply the Lyrebird-specific review rules from your agent instructions across the entire Sources/Lyrebird/ directory:
|
||||
- RT thread safety: no allocation, deallocation, or locking in _computeSamples or the render callback
|
||||
- Bus memory rules: no dynamic resizing after engine start
|
||||
- Generator/Synthesizer protocol correctness: _Base pattern, GeneratorBase, _setupSubBlockBuffer, calculatedSamples overrides
|
||||
- Shared helper usage: applyIfNeeded, fillRampedResult, xorshift64NextRaw — never inline
|
||||
- Scheduling model compliance: no ARC on RT thread, correct SPSCQueue usage
|
||||
- Test coverage: new generator types have corresponding tests
|
||||
|
||||
Do NOT summarize what code does — only report problems with file paths, line numbers, and concrete fixes.
|
||||
```
|
||||
|
||||
## Phase 3: Documentation Check and Update
|
||||
|
||||
After all three reviews complete, verify and fix project documentation:
|
||||
|
||||
1. Check `CLAUDE.md` doc map — do all active modules have a row?
|
||||
2. Check `docs/00-working-order.md` — does it correctly reflect which phases are complete?
|
||||
3. For any stale doc found: **edit it directly** using the Edit tool. Do not just report the gap.
|
||||
4. Keep edits focused — match the existing writing style. Do not rewrite docs that are accurate.
|
||||
|
||||
## Phase 4: Synthesis Report
|
||||
|
||||
Present a single unified report:
|
||||
|
||||
### Blocking (must fix before merging)
|
||||
- RT safety violations, protocol correctness failures, bus rule violations, test coverage gaps
|
||||
- Source: Agent C (lyrebird_review_agent)
|
||||
- Include: file path, line number, concrete fix
|
||||
|
||||
### Architecture & Consistency
|
||||
- Duplicate patterns, API inconsistencies, missing conformances, public API surface issues
|
||||
- Source: Agent A (lyrebird_architect_agent)
|
||||
- Include: file path and specific recommendation
|
||||
|
||||
### Swift Code Quality
|
||||
- Magic numbers, access control, concurrency, long functions, error handling gaps, naming
|
||||
- Source: Agent B (Swift quality agent)
|
||||
- Include: file path, line number, severity, suggested fix
|
||||
|
||||
### Documentation Updated
|
||||
- List each doc file edited and summarize what changed
|
||||
- If no docs needed updating: "All documentation is current"
|
||||
|
||||
### Verdict
|
||||
- One line: "No issues found", "Needs N fixes", or "Significant rework needed"
|
||||
- Prioritised next steps
|
||||
|
||||
If no issues are found in a category, say so explicitly.
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
name: pr_review
|
||||
description: Run a strict pre-PR code review on the current branch. Generates a diff against main, then invokes pr_review_agent to identify bugs, security issues, and code smells with concrete fix proposals.
|
||||
---
|
||||
|
||||
# PR Review
|
||||
|
||||
Run a strict pre-PR review of all changes in the current branch compared to `main`.
|
||||
|
||||
## Step 1: Generate the diff
|
||||
|
||||
Run the following command to capture all branch changes into a diff file:
|
||||
|
||||
```bash
|
||||
git diff --no-color main... > branch.diff
|
||||
```
|
||||
|
||||
If the command fails (e.g. no `main` branch), report the error and stop.
|
||||
|
||||
## Step 2: Invoke the review agent
|
||||
|
||||
Use the Agent tool to launch the `pr_review_agent` with the following prompt:
|
||||
|
||||
```
|
||||
@workspace
|
||||
|
||||
# Do not use the current file as context. Consider the whole workspace and branch.diff.
|
||||
|
||||
You are a strict senior engineer. Review all changes in the current git branch compared to the git main, as shown in branch.diff. Also review the unchanged portions of the files which have changes in them. Call out bugs and security issues. Mention code smells only if >80% certain they are unintentional and are cause for concern. Include file paths in your comments and propose concrete fixes. Do not summarize the changes in general, just focus on identifying potential problems. Keep the output minimal.
|
||||
|
||||
Also generate a summary titled "Pre-PR Review Results for branch '<name>'" where <name> is replaced with the name of the current git branch. This summary must be concise and consist of brief bullet points highlighting any critical findings that should be fixed before the code is accepted. Or, if issues are only minor or may be intentional, provide a statement that the branch is acceptable.
|
||||
```
|
||||
|
||||
## Step 3: Present results
|
||||
|
||||
Output the full review from the agent directly to the user without modification.
|
||||
Reference in New Issue
Block a user