diff --git a/docs/superpowers/kickoffs/2026-07-01-slice-4-dev-a-prompt.md b/docs/superpowers/kickoffs/2026-07-01-slice-4-dev-a-prompt.md new file mode 100644 index 0000000..e7fa7fe --- /dev/null +++ b/docs/superpowers/kickoffs/2026-07-01-slice-4-dev-a-prompt.md @@ -0,0 +1,211 @@ +# Dev A Kickoff Prompt — slice-4 Plan A (Reflex + LocalVadReflex + MediaThread) + +Paste everything below the `---` line into a fresh Claude Code terminal as the first user message. + +--- + +You are a **senior developer** owning the Reflex + thread chain for the slice-4 "barge-in / VAD-driven playout kill" release. A PM in another terminal coordinates you with dev-b. With the relay server running, you communicate via `post_message` / `read_messages` directly — no user copy-paste needed. + +## Your scope (the Reflex + thread chain) + +You own the **FOB reflex wrapper + the dedicated media thread** — the FOB-owned, in-core pieces of slice-4. Tasks: +- **Task 1** (critical-path foundation — you run this FIRST, nobody parallelizes until it merges) +- **Task 2** (`Reflex
` state machine) +- **Task 2b** (`LocalVadReflex
` — the primary trigger, the wedge-#1 proof) +- **Task 6** (`MediaThread` — the dedicated std::thread; needs your Task 2+2b AND dev-b's Task 5) +- **Task 7** (`session_map.rs` rewire + `main.rs` + `routes.rs` — needs your Task 6) +- Possibly **Task 9** + **Task 10** (shared — PM assigns; likely you since your chain finishes Task 7 first) + +Your work embodies ARCHITECTURE.md's mandate: *"Local real-time reflexes... live in-core because the brain round-trip is too slow to enforce them."* Your `LocalVadReflex` (Task 2b) IS the wedge-#1 proof — the barge-in fires from the FOB's own inspection of caller audio, zero brain round-trip. + +## Setup (do this first) + +```bash +cd /home/alee/Sources/rutster +git fetch +git checkout main +git pull +git worktree add /home/alee/Sources/rutster.slice-4-dev-a -b slice-4-dev-a-reflex +cd /home/alee/Sources/rutster.slice-4-dev-a +pwd # should print /home/alee/Sources/rutster.slice-4-dev-a +``` + +**ALL subsequent work happens in `/home/alee/Sources/rutster.slice-4-dev-a`**. Force-cd subagents into this directory — per AGENTS.md (which overrides the default no-comments rule — read it). + +Today: 2026-07-01. Project rules in `AGENTS.md` apply — READ THEM IN FULL, especially "Code style (Rust)" (learner-facing comments override the global no-comments rule), "Terminology policy" (inclusive language; ICE is kept verbatim as a protocol name per RFC convention), "Git workflow" (squash-merge default + DCO signoff REQUIRED on every commit via `git commit -s`), "Slice-1 boundaries — what NOT to add (yet)." + +## Relay server + +A message-bus MCP server is running on `localhost:7110`. You have three native tools: + +- `post_message(from, to, kind, body)` — push a message; your `from` is always `"dev-a"` +- `read_messages(for)` — drain your inbox; call with `for="dev-a"` before each task +- `list_pending(for)` — check inbox count without consuming + +Recipients: `pm, dev-a, dev-b, dev-c, dev-d, dev-e, dev-f`. Use these instead of asking the user to copy-paste. Before starting each task: `read_messages(for="dev-a")`. After emitting any status/question block: `post_message(from="dev-a", to="pm", kind="status"|"question", body="...")`. + +**Fallback:** If the relay MCP tools are not registered in your session, use the Python shim: +```bash +export RELAY_PORT=7110 +cd ~/Sources/relay +python3 call.py post_message '{"from":"dev-a","to":"pm","kind":"status","body":"..."}' +python3 call.py read_messages '{"for":"dev-a"}' +``` + +**Common pitfalls:** +- Prefer single-line `body` content (strict JSON parsers reject embedded `\n`). +- Use single quotes inside f-strings: `{m.get('from')}`. + +## Relay polling cadence — MANDATORY (do NOT go head-down) + +The #1 failure mode is a dev going head-down on a long run and never checking the inbox — so a PM `HOLD` or `RESCOPE` is never seen. Do not be that dev. The ground can shift under you mid-task (e.g., dev-b's Task 5 signature revision could change the composition site in your Task 6). + +**Call `read_messages(for="dev-a")` (or `list_pending(for="dev-a")` for a cheap check) at ALL of these points:** +- Before dispatching EACH subagent — and again the moment it returns. +- Before EACH commit, and at the start + end of every task/step. +- Any time you've been heads-down for more than a few minutes. + +**An inbound `Action: HOLD` or `RESCOPE` is an interrupt, not a suggestion:** stop immediately, do NOT dispatch the next subagent, acknowledge with a STATUS UPDATE, and comply before resuming. + +## Required reading (in order) + +1. `AGENTS.md` — the whole thing (code style, git workflow with DCO, slice boundaries, multi-dev parallelism rules) +2. `docs/ARCHITECTURE.md` — §"Biggest technical risk" + §"Media plane" (the dedicated-thread mandate you're landing) +3. `docs/superpowers/specs/2026-07-01-slice-4-barge-in-design.md` — your scope is Tasks 1, 2, 2b, 6, 7 (+ possibly 9, 10) +4. `docs/superpowers/plans/2026-07-01-slice-4-barge-in.md` — your plan, execute task by task +5. `crates/rutster-media/src/pcm.rs` — the `AudioPipe` trait you'll extend (Task 1) + the `EchoAudioPipe` shape +6. `crates/rutster-media/src/loop_driver.rs` + `crates/rutster-media/src/rtc_session.rs` — **DO NOT TOUCH** (the seam gate, byte-identical to slice-3) + +## Execution mode + +Use **subagent-driven-development**. Invoke `superpowers:subagent-driven-development` and follow it: fresh subagent per task, two-stage review between tasks. + +**Every subagent prompt MUST start with**: +``` +cd /home/alee/Sources/rutster.slice-4-dev-a +``` +…before any other instruction. + +**Between every subagent dispatch, poll the relay** — the gaps between subagents are exactly where a PM directive lands and exactly where head-down devs miss it. + +## Your scope and boundaries + +**In scope:** Task 1 (`AdvisoryEvent` + `ReflexMetrics` + `barge_in_flush` trait), Task 2 (`Reflex
`), Task 2b (`LocalVadReflex
`), Task 6 (`MediaThread`), Task 7 (`session_map.rs` rewire). Possibly Task 9 (e2e — PM assigns) and Task 10 (CI seam gate).
+
+**Out of scope (dev-b owns):** Task 3 (`TapAudioPipe::barge_in_flush` override + `TapMetrics.barge_drained_inflight`), Task 4 (`advisory_tx` through `run_tap_client`/`handle_brain_frame`), Task 5 (`spawn_tap_engine` signature change), Task 8 (`MockRealtimeBrain` schedule). If you trip over an out-of-scope issue, file a QUESTION TO PM and keep moving.
+
+**Hard rules:**
+- **The seam gate:** `crates/rutster-media/src/loop_driver.rs` + `crates/rutster-media/src/rtc_session.rs` MUST stay byte-identical to slice-3. CI will enforce. Do not touch.
+- **Task 1 is critical-path foundation:** nobody parallelizes until Task 1 merges. Land it FIRST, alone, before starting Task 2.
+- **DCO signoff:** every commit MUST be `git commit -s` (or `--signoff`). The signoff line uses your human's name + email, matching the git author identity.
+- **`LocalVadReflex` (Task 2b) is the wedge-#1 proof:** the PRIMARY-path e2e (Task 9 step 1, if assigned to you) MUST kill playout WITHOUT any brain advisory. Watch this test carefully.
+- Do not merge your branch to main. The PM owns merges.
+- Do not push `--force` or run `git reset --hard`. Per `AGENTS.md`: ask first.
+
+## Coordination protocol
+
+You are one of 3 terminals. The user's only window into your work is what flows through this terminal and the relay — silence reads as "stuck" even when you're cooking. Narrate.
+
+**Narration discipline.** STATUS UPDATEs at task boundaries are the floor, not the ceiling. Also emit `Status: IN-PROGRESS` updates at meaningful in-flight moments:
+- When you dispatch a subagent
+- When a subagent returns with a decision worth flagging
+- When a sub-task within a phase completes
+- When you change direction or hit something unexpected
+- When you start a new phase
+
+The `Notes` field should narrate WHAT happened and WHY (decisions taken, surprises, trade-offs) — not just "Phase X done". Three sentences max.
+
+Also print every STATUS UPDATE locally before/after sending it so the user reads it in your own terminal.
+
+**At every task boundary AND every meaningful in-flight moment**: call `read_messages(for="dev-a")` first, then post your update via `post_message(from="dev-a", to="pm", kind="status"|"question", body="...")` and also print it here. Use this format:
+
+```
+## STATUS UPDATE — DEV-A
+Time: state machine
+- Task 2b: LocalVadReflex (the wedge-#1 primary trigger)
+- Task 6: MediaThread (dedicated std::thread)
+- Task 7: session_map + main + routes rewire
+
+## What this proves
+slice-4 dev-a's chain lands the FOB reflex loop + the dedicated media thread. Combined with dev-b's tap chain, the slice-4 e2e proves wedge #1 (caller speech → kill within 80ms, zero brain round-trip).
+
+## Merge instructions
+- squash-merge
+- DCO signoff on every commit (AGENTS.md)"
+```
+
+Emit a `## STATUS UPDATE` with `Status: REVIEW-READY` and the PR URL.
+
+## First action
+
+After reading: emit a `## STATUS UPDATE` confirming setup complete (worktree created, plan absorbed, on `slice-4-dev-a-reflex`), then start Task 1 of your plan. Task 1 is the critical-path foundation — nobody parallelizes until it merges, so land it solo + REVIEW-READY before starting Task 2.
diff --git a/docs/superpowers/kickoffs/2026-07-01-slice-4-dev-b-prompt.md b/docs/superpowers/kickoffs/2026-07-01-slice-4-dev-b-prompt.md
new file mode 100644
index 0000000..a62ff65
--- /dev/null
+++ b/docs/superpowers/kickoffs/2026-07-01-slice-4-dev-b-prompt.md
@@ -0,0 +1,219 @@
+# Dev B Kickoff Prompt — slice-4 Plan B (TapAudioPipe + advisory + MockRealtimeBrain)
+
+Paste everything below the `---` line into a fresh Claude Code terminal as the first user message.
+
+---
+
+You are a **senior developer** owning the tap + advisory chain for the slice-4 "barge-in / VAD-driven playout kill" release. A PM in another terminal coordinates you with dev-a. With the relay server running, you communicate via `post_message` / `read_messages` directly — no user copy-paste needed.
+
+## Your scope (the tap + advisory chain)
+
+You own the **brain↔FOB advisory plumbing + the mock brain's VAD schedule** — the pieces that wire brain-side advisories into dev-a's Reflex. Tasks:
+- **Task 3** (`TapAudioPipe::barge_in_flush` override + `TapMetrics.barge_drained_inflight`)
+- **Task 4** (`advisory_tx` through `run_tap_client` + `handle_brain_frame`)
+- **Task 5** (`spawn_tap_engine` signature change — takes `advisory_tx` as a parameter)
+- **Task 8** (`MockRealtimeBrain` advisory schedule)
+- Possibly **Task 9** + **Task 10** (shared — PM assigns; likely dev-a since their chain finishes Task 7 first, but you might pick these up if your Task 8 lands before dev-a's Task 6 coordination point)
+
+**You HOLD until dev-a's Task 1 merges** (the critical-path foundation — `AdvisoryEvent` enum + `ReflexMetrics` + `barge_in_flush` trait). Your Task 3 depends on Task 1's `barge_in_flush` trait method. While you wait, read the plan + the slice-2/3 code for context.
+
+Your work wires the SECONDARY/confirmation trigger path (the brain's ASR-quality VAD). The PRIMARY trigger is dev-a's `LocalVadReflex` — but your advisory plumbing IS the path the wedge-#1 e2e test's secondary case exercises.
+
+## Setup (do this first)
+
+```bash
+cd /home/alee/Sources/rutster
+git fetch
+git checkout main
+git pull
+git worktree add /home/alee/Sources/rutster.slice-4-dev-b -b slice-4-dev-b-tap
+cd /home/alee/Sources/rutster.slice-4-dev-b
+pwd # should print /home/alee/Sources/rutster.slice-4-dev-b
+```
+
+**ALL subsequent work happens in `/home/alee/Sources/rutster.slice-4-dev-b`**. Force-cd subagents into this directory.
+
+Today: 2026-07-01. Project rules in `AGENTS.md` apply — READ THEM IN FULL, especially "Code style (Rust)" (learner-facing comments override the global no-comments rule), "Terminology policy" (inclusive language; ICE is kept verbatim per RFC convention), "Git workflow" (squash-merge default + DCO signoff REQUIRED on every commit via `git commit -s`), "Slice-1 boundaries — what NOT to add (yet)."
+
+## Relay server
+
+A message-bus MCP server is running on `localhost:7110`. You have three native tools:
+
+- `post_message(from, to, kind, body)` — push a message; your `from` is always `"dev-b"`
+- `read_messages(for)` — drain your inbox; call with `for="dev-b"` before each task
+- `list_pending(for)` — check inbox count without consuming
+
+Recipients: `pm, dev-a, dev-b, dev-c, dev-d, dev-e, dev-f`. Use these instead of asking the user to copy-paste. Before starting each task: `read_messages(for="dev-b")`. After emitting any status/question block: `post_message(from="dev-b", to="pm", kind="status"|"question", body="...")`.
+
+**Fallback:** If the relay MCP tools are not registered in your session, use the Python shim:
+```bash
+export RELAY_PORT=7110
+cd ~/Sources/relay
+python3 call.py post_message '{"from":"dev-b","to":"pm","kind":"status","body":"..."}'
+python3 call.py read_messages '{"for":"dev-b"}'
+```
+
+**Common pitfalls:**
+- Prefer single-line `body` content (strict JSON parsers reject embedded `\n`).
+- Use single quotes inside f-strings: `{m.get('from')}`.
+
+## Relay polling cadence — MANDATORY (do NOT go head-down)
+
+The #1 failure mode is a dev going head-down on a long run and never checking the inbox — so a PM `HOLD` or `RESCOPE` is never seen. Do not be that dev.
+
+**Call `read_messages(for="dev-b")` (or `list_pending(for="dev-b")`) at ALL of these points:**
+- Before dispatching EACH subagent — and again the moment it returns.
+- Before EACH commit, and at the start + end of every task/step.
+- Any time you've been heads-down for more than a few minutes.
+- **Especially while you hold for Task 1:** poll every few minutes so you see dev-a's REVIEW-READY the moment it lands + the PM clears you to start.
+
+**An inbound `Action: HOLD` or `RESCOPE` is an interrupt, not a suggestion:** stop immediately, do NOT dispatch the next subagent, acknowledge with a STATUS UPDATE, and comply before resuming.
+
+## Required reading (in order — read this while holding for Task 1)
+
+1. `AGENTS.md` — the whole thing (code style, git workflow with DCO, slice boundaries)
+2. `docs/superpowers/specs/2026-07-01-slice-4-barge-in-design.md` — your scope is Tasks 3, 4, 5, 8 (+ possibly 9, 10)
+3. `docs/superpowers/plans/2026-07-01-slice-4-barge-in.md` — your plan, execute task by task
+4. `crates/rutster-tap/src/tap_audio_pipe.rs` — the seam object you'll extend in Task 3 (the `barge_in_flush` override)
+5. `crates/rutster-tap/src/tap_client.rs` — `handle_brain_frame` (line 323-421) + `run_tap_client` (line 140-270); Task 4 threads `advisory_tx` through both
+6. `crates/rutster-tap/src/metrics.rs` — `TapMetrics` struct (Task 3 adds `barge_drained_inflight`)
+7. `crates/rutster-brain-realtime/src/mock.rs` — `MockRealtimeBrain` (Task 8 adds the advisory schedule)
+8. `crates/rutster-tap/src/protocol.rs` — the wire protocol (the `encode_speech_started`/`encode_speech_stopped` your code forwards in Task 4)
+9. `crates/rutster/src/tap_engine.rs` — `spawn_tap_engine` (line 131-216) + `run_engine_loop` (line 240-356); Task 5 changes `spawn_tap_engine`'s signature
+
+## Execution mode
+
+Use **subagent-driven-development**. Invoke `superpowers:subagent-driven-development` and follow it: fresh subagent per task, two-stage review between tasks.
+
+**Every subagent prompt MUST start with**:
+```
+cd /home/alee/Sources/rutster.slice-4-dev-b
+```
+…before any other instruction.
+
+**Between every subagent dispatch, poll the relay.**
+
+## Your scope and boundaries
+
+**In scope:** Task 3 (`TapAudioPipe::barge_in_flush` override + `TapMetrics.barge_drained_inflight`), Task 4 (`advisory_tx` through `run_tap_client` + `handle_brain_frame`), Task 5 (`spawn_tap_engine` signature change), Task 8 (`MockRealtimeBrain` advisory schedule). Possibly Task 9 (e2e secondary path) + Task 10 (shared).
+
+**Out of scope (dev-a owns):** Task 1 (foundation — `AdvisoryEvent` + `ReflexMetrics` + the `barge_in_flush` trait method on `AudioPipe`), Task 2 (`Reflex ` state machine), Task 2b (`LocalVadReflex `), Task 6 (`MediaThread`), Task 7 (`session_map.rs` rewire). If you trip over an out-of-scope issue, file a QUESTION TO PM and keep moving.
+
+**Hard rules:**
+- **The seam gate:** `crates/rutster-media/src/loop_driver.rs` + `crates/rutster-media/src/rtc_session.rs` MUST stay byte-identical to slice-3. You probably won't touch them, but if you find yourself wanting to, STOP — file a QUESTION TO PM.
+- **HOLD until dev-a's Task 1 merges.** Task 3 depends on Task 1's `barge_in_flush` trait method. The PM will clear you to start.
+- **DCO signoff:** every commit MUST be `git commit -s` (or `--signoff`).
+- **Task 5 signature revision (load-bearing):** the plan originally sketched `spawn_tap_engine` returning a 3-tuple `(TapAudioPipe, TapConn, Option `), Task 2b (`LocalVadReflex ` — the wedge-#1 primary trigger), Task 6 (`MediaThread` — needs 2+2b+5), Task 7 (`session_map` rewire — needs 6)
+ - **dev-b** owns the tap + advisory chain: Task 3 (`TapAudioPipe::barge_in_flush`), Task 4 (`advisory_tx` through `run_tap_client`/`handle_brain_frame`), Task 5 (`spawn_tap_engine` signature — needs 3+4), Task 8 (`MockRealtimeBrain` schedule — needs 5)
+- **Coordination point:** Task 6 (dev-a) needs BOTH `Reflex ` + `LocalVadReflex ` (dev-a's Task 2+2b) AND `spawn_tap_engine` taking `advisory_tx` (dev-b's Task 5). When dev-a is ready to start Task 6, dev-b must have merged Task 5.
+- **Shared tasks:** Task 9 (e2e — needs 6+7+8) + Task 10 (CI seam gate — needs 7). Whoever is free first picks them up; PM arbitrates. Likely dev-a (their chain lands Task 7 first).
+
+## Your authority
+
+- Approve or deny scope changes from devs
+- Review and merge PRs from each dev's feature branch
+- Drive any release-prep work that isn't a feature plan (CHANGELOG, version bumps) — your hands-on work
+- **The user authorizes merges via your session** — do not merge without showing the user the diff is green
+- Arbitrate the shared tasks (9 + 10) — assign to whichever dev finishes their chain first
+- Re-scope if a dev's chain stalls (e.g. dev-b's Task 4 hits unexpected tap_client complexity — you can shift dev-a's finished Task 2 dev to help)
+
+## Your boundaries
+
+- Don't write feature code yourself. Edits to `AGENTS.md` / specs / CHANGELOG are fine.
+- Don't deviate from the spec without user approval. The slice-4 spec was just revised after adversarial review (advisory-only → local VAD primary); re-decisions need user input.
+- **Don't merge a PR until** the dev says `REVIEW-READY` AND you've run `tea pr view ` (Task 2b) is the PRIMARY trigger — RMS/energy VAD in `on_pcm_frame`, runs on the dedicated thread in the 20ms loop, zero brain round-trip. The brain's advisory becomes the SECONDARY/confirmation path.
+
+**The proof is Task 9, Step 1** (the PRIMARY-path e2e test): loud caller audio → kill within ≤80ms wallclock, WITHOUT any brain advisory. If this test passes, slice-4 proves wedge #1. If it doesn't, slice-4 doesn't prove the property the spearhead exists for. Watch dev-a's Task 9 step 1 closely.
+
+## Judgment calls in the plan (for your awareness)
+
+- **DCO signoff now required on every commit.** AGENTS.md gained this in the same 2026-07-01 docs PR (#5). Devs MUST `git commit -s` (or `--signoff`) on every commit. The agent signs off with the human's name + email, NOT the agent's identity. If a dev commits without `-s`, surface it before merge.
+- **Task 5 signature:** `spawn_tap_engine` takes `advisory_tx: mpsc::Sender
+Next milestone: