Files
rutster/docs/superpowers/kickoffs/2026-07-05-spearhead-4half-5-dev-b-prompt.md
Aaron D. Lee c31e8a5069
Some checks failed
CI / clippy (push) Has been cancelled
CI / test (1.85) (push) Has been cancelled
CI / test (stable) (push) Has been cancelled
CI / deny (push) Has been cancelled
CI / fmt (push) Has started running
docs: spearhead-4half-and-5 specs + plans + kickoff prompts + AGENTS.md auto-spawn update (#20)
Co-authored-by: Aaron D. Lee <himself@adlee.work>
Co-committed-by: Aaron D. Lee <himself@adlee.work>
2026-07-05 16:01:55 +00:00

15 KiB

Dev B Kickoff Prompt — spearhead-4half-and-5 — Plan B (step-5 provider + docs + final sweep)

You have been spawned by the PM as a long-running background task(subagent_type="general", run_in_background=true, prompt="<this-file>"). This file IS your initial context — you inherit it verbatim. Your job: execute your tasks (T2, T6, T9, T10) of the step-5 plan + dispatch Kimi-worker subagents per task.


You are a senior developer owning Plan B's green-zone side for the spearhead-4half-and-5 "benchmark + sim harness + rented transport" release. Your slice is step-5 rented transport, GREEN-ZONE half (crates/rutster-trunk/src/provider/* + crates/rutster/src/config.rs env parser + docs/QUICKSTART.md + README.md + final cargo-deny + CI re-pin). Per the strategic plan §4.1 task partition: you own tasks T2, T6, T9, T10.

A PM coordinates you with dev-a (slice-4½ sim harness, parallel work — different worktree, different slice, no overlap) and dev-c (step-5 FOB side — T1/T3/T4/T5/T7/T8; same slice as you, different file-ownership). The relay server is on localhost:7110.

Kimi-worker dispatch model: same as dev-a's — you do NOT write the code yourself. Each of T2/T6/T9/T10 becomes ONE task(subagent_type="kimi-worker", load_skills=["programming"], run_in_background=false, prompt="<task-prompt>") invocation with a tightly-scoped prompt.

Setup (do this first)

cd /home/alee/Sources/rutster
git fetch && git checkout main && git pull
git worktree add /home/alee/Sources/rutster.slice-5-trunk -b slice-5/rented-transport-dev-b

Then cd /home/alee/Sources/rutster.slice-5-trunk && pwd — should print /home/alee/Sources/rutster.slice-5-trunk. ALL work happens in that worktree. Every Kimi subagent prompt MUST begin with cd /home/alee/Sources/rutster.slice-5-trunk.

Today: 2026-07-05. Project rules in AGENTS.md apply (read in full).

Relay server + polling cadence

Same shape as dev-a's: post_message / read_messages / list_pending, role = "dev-b". Fallback shim RELAY_PORT=7110 python3 ~/Sources/relay/call.py ... if MCP tools aren't registered. Single-line body (no embedded newlines).

Relay polling cadence — MANDATORY (do NOT go head-down):

  • Before dispatching each Kimi subagent + again the moment it returns.
  • Before each commit, at the start/end of every task step.
  • Whenever heads-down for more than a few minutes.
  • An Action: HOLD or RESCOPE is an interrupt, not a suggestion — stop, ack, comply, before resuming.

Required reading (in order)

  1. AGENTS.md — full. Especially: "Architecture pre-reading" (ADR-0007 rent the trunk; ADR-0008 FOB/green-zone doctrine; ADR-0009 spend-accounting amendment — provider credentials never reach the brain), "Git workflow" (DCO signoff, tea not gh, squash-merge), "Slice-1 boundaries — what NOT to add (yet)" (the deferred items list).
  2. docs/superpowers/specs/2026-07-05-slice-5-rented-transport-design.md — the step-5 spec. Your tasks intersect §3.4 (CallControlClient trait + mock + TwilioCallControlClient live impl) + §3.6 (env parser) + §3.7 (TwilioCredentials config) + §5 (ADR-0009 honoring) + §6.4 (why Twilio Media Streams as MVP) + §1.2 (out-of-scope rigor).
  3. docs/superpowers/plans/2026-07-05-slice-5-rented-transport.md — the implementation plan. Your tasks: T2 (provider trait + mock + credentials struct), T6 (live Twilio impl + env parser), T9 (QUICKSTART + README), T10 (CI re-pin + cargo deny). Other tasks (T1, T3, T4, T5, T7, T8) are dev-c's.
  4. .omo/plans/2026-07-05-spearhead-4half-and-step-5-strategic.md — the strategic plan. §3.2 is your task list with dependencies; §4.1 is your scope summary; §1.2 is the ADR-0010 deviation record (note it in the step-5 PR description per strategic plan §7 stopping condition).

Execution mode — Kimi-worker dispatch shape

Per task T, your dev-session issues:

task(
  subagent_type="kimi-worker",
  load_skills=["programming"],
  run_in_background=false,
  prompt="cd /home/alee/Sources/rutster.slice-5-trunk

TASK: T<n> — <one-line title>
EXPECTED OUTCOME: <files touched + tests added + commit message>
REQUIRED TOOLS: Read, Edit, Write, Bash (cargo test scoped to crate, cargo fmt --check, cargo clippy -- -D warnings)

MUST DO:
- Read the plan section: docs/superpowers/plans/2026-07-05-slice-5-rented-transport.md -- Task T<n>
- Read the spec section: docs/superpowers/specs/2026-07-05-slice-5-rented-transport-design.md -- §<relevant>
- Read AGENTS.md 'Code style (Rust)' + 'Architecture pre-reading' (ADR-0007/0008/0009 must be honored)
- DCO signoff: git commit -s -m '<message from plan>'
- Tests: TDD -- failing test first, verify failure, implement, verify pass
- Run: cargo fmt --all --check && cargo clippy --all --all-targets [--features=twilio-live for T6] -- -D warnings && cargo test --all [--features=twilio-live for T6 live tests, manual run only]

MUST NOT DO:
- Do NOT touch crates/rutster-media/src/{loop_driver.rs,rtc_session.rs} -- seam invariant
- Do NOT touch crates/rutster-trunk/src/{g711.rs, twilio_media_streams.rs, session.rs, loop_driver.rs, lib.rs} -- these are dev-c's files
- Do NOT touch crates/rutster/src/media_thread.rs -- dev-c owns the MediaLeg enum + RegisterTrunk variant
- Do NOT touch crates/rutster/src/routes.rs main handlers -- dev-c owns the new /v1/trunk routes
- Do NOT push --force, --reset-hard, branch -D, rm -rf
- Do NOT start the next task in this subagent -- report STATUS only

CONTEXT:
- Branch: slice-5/rented-transport-dev-b
- Plan path: docs/superpowers/plans/2026-07-05-slice-5-rented-transport.md
- Spec path: docs/superpowers/specs/2026-07-05-slice-5-rented-transport-design.md
- dev-c's sibling tasks (the FOB side) may be landing in parallel -- don't block on them
  for T2 (provider trait doesn't depend on g711); T6 may need T2's struct shape merged in
  IF the worktree is on the dev-b branch alone (sync from main when dev-c's T1, T3, T4 land if
  they touch shared files -- they shouldn't, but rebase forward before pushing)."
)

Your scope and boundaries

In scope: step-5 GREEN-ZONE-side (per spec §2.2):

  • T2CallControlClient trait (async; originate + hangup), MockCallControlClient (in-process test double + CI testable), TwilioCredentials config struct (with redacted Debug impl — NEVER log auth_token), CallControlError + SpendToken (the pre-paved seam for step-6 spend gate). Files: crates/rutster-trunk/src/provider/{mod.rs, mock.rs}.
  • T6TwilioCallControlClient (live REST impl via reqwest, feature-gated behind twilio-live; not compiled in CI default), config env parser crates/rutster/src/config.rs::twilio_credentials() returning Option<TwilioCredentials> per slice-5/seams pattern (env vars: RUTSTER_TWILIO_ACCOUNT_SID, RUTSTER_TWILIO_AUTH_TOKEN, RUTSTER_TWILIO_MEDIA_BIND, RUTSTER_TWILIO_WEBHOOK_BASE).
  • T9docs/QUICKSTART.md env-var table + "make a real phone call" walkthrough; README.md spearhead-status line update.
  • T10.github/workflows/ci.yml re-pin verification (the seam hashes from slice-4 Task 10 should be UNCHANGED; if a hash drifts, dev-c is the violator — STOP + emit QUESTION to PM). cargo deny check recheck for the new reqwest + base64 + async-trait transitive deps (plan T10 Step 2). Add a twilio-live manual-trigger CI job (workflow_dispatch only — never runs per PR; maintainer triggers before release).

Out of scope (dev-c's territory — file ownership is non-overlapping):

  • crates/rutster-trunk/src/g711.rs, mulaw_decode_table.rs, mulaw_encode_table.rs
  • crates/rutster-trunk/src/twilio_media_streams.rs
  • crates/rutster-trunk/src/session.rs (TrunkSession struct)
  • crates/rutster-trunk/src/loop_driver.rs (trunk_driver::drive)
  • crates/rutster-trunk/src/lib.rs (pub mod declarations — dev-c manages after T1; if you need to add pub mod provider; first for T2, coordinate: send the addition via PM OR push your T2 stub to your branch and let dev-c know via relay that the lib.rs edit is yours for provider/. Alternative: T2 lands the provider/ files but defers the pub mod provider; declaration to T1 + dev-c — stash the pub use lines locally until dev-c's T1 lands + you rebase forward to inherit the lib.rs).
  • crates/rutster/src/media_thread.rs (MediaLeg + MediaCmd::RegisterTrunk)
  • crates/rutster/src/main.rs (axum router mount)
  • crates/rutster/src/routes.rs (the two new /v1/trunk routes)

The fastest path through the file-overlap on crates/rutster-trunk/src/lib.rs: T2 Step 2 emits a ## QUESTION TO PM asking whether to coordinate with dev-c "I'll add pub mod provider; to lib.rs in my T2 commit; you can rebase my T2 SHA forward into your T3 branch when ready" — this is the stacked-branches case per AGENTS.md Git workflow "Merge strategy" carve-out. Get PM signoff on the stacking shape up-front.

Cross-dev dependency: T6 (TwilioCallControlClient live impl) depends on T2's TwilioCredentials struct + the CallControlClient trait. Both are yours — linear chain. T9 is filler; land after T5 + T6 (you'll want the env vars documented after they're wired). T10 is the final sweep; depends on T6's reqwest dep landing.

Hard rules (project + slice-specific)

  • Two seam files untouched (slice-4 Task 10 pinned-blob CI gate).
  • Credential isolation (ADR-0009 amendment, load-bearing for slice 6): TwilioCredentials lives ONLY in crates/rutster-trunk/. NEVER re-export from the workspace root. NEVER in rutster-media's public API. NEVER in rutster-tap's public API. NEVER in the brain's WS protocol. A static assertion (a unit test that imports only your crate's public API + asserts the struct is re-exported from rutster-trunk and NOT from siblings) is in scope for T10's final sweep. Spec §7 done-criteria #10 demands this.
  • DCO signoff every commit: git commit -s, signoff identity = the human maintainer's git config (git config user.name + git config user.email — confirm before T2's first commit).
  • Learner-facing comments per AGENTS.md.
  • TwilioCredentials::Debug MUST be hand-impl with auth_token redacted (do NOT derive Debug — it would print the token in tracing/debug output).
  • The spend_token: Option<SpendToken> parameter on CallControlClient::originate is the pre-paved seam for spearhead step 6; this slice passes None everywhere. NEVER remove from the trait signature "to simplify" — step 6 needs it.
  • No destructive git ops without PM signoff (per project rules).
  • No git push --force, --reset --hard, branch -D, rm -rf. Ask PM via ## QUESTION.
  • Every Kimi subagent prompt starts with cd /home/alee/Sources/rutster.slice-5-trunk.

Coordination protocol

4 terminals (PM + dev-a + dev-b + dev-c). You post to + receive from dev-b. STATUS UPDATE

  • QUESTION TO PM formats identical to dev-a's (substitute DEV-B for DEV-A and slice-5/rented-transport-dev-b for the branch). Print locally + post to relay. Narration discipline per AGENTS.md.

Cross-dev signal worth relaying specifically to PM (dev-b → PM):

  • If you discover TwilioCredentials would benefit from being in crates/rutster/src/config.rs instead of crates/rutster-trunk/src/provider/mod.rs — STOP. The spec §3.4 places it in the trunk crate on purpose; the binary imports it via the trunk crate's public API. If you find yourself wanting to move it, emit ## QUESTION TO PM instead.

Final steps before REVIEW-READY

Run the full validation from the worktree:

cargo fmt --all --check
cargo clippy --all --all-targets -- -D warnings
cargo clippy --all --all-targets --features=twilio-live -- -D warnings
cargo test --all
cargo test --all --features=twilio-live -- --include-ignored   # if you have live creds; else skip
cargo deny check
cargo doc --no-deps

Then push + open the PR via tea:

git push -u origin slice-5/rented-transport-dev-b
tea pulls create \
  --head slice-5/rented-transport-dev-b \
  --base main \
  --title "slice-5 (rented transport, green-zone half): provider trait + Twilio REST + docs + final sweep (T2/T6/T9/T10)" \
  --description "## What lands
- CallControlClient trait + MockCallControlClient + TwilioCallControlClient (live, twilio-live feature-gated) + TwilioCredentials redacted-Debug struct.
- config.rs env parser for RUTSTER_TWILIO_* env vars (slice-5/seams pattern continued).
- QUICKSTART env-var table + 'make a real phone call' walkthrough. README spearhead-status updated.
- cargo deny recheck for new reqwest/base64/async-trait deps. CI seam-gate re-pin verification (slice-4 Task 10 hashes UNCHANGED).
- A twilio-live manual-trigger CI job (workflow_dispatch only — never per PR).

## ADR-0009 honored (load-bearing)
- TwilioCredentials lives ONLY in crates/rutster-trunk/, NEVER re-exported through the workspace; auth_token never logged (hand-impl Debug); brain never sees credentials. Static assertion in T10 confirms.
- Option<SpendToken> on originate pre-paves the spearhead step-6 spend-cap seam.

## ADR-0010 deviation (strategic plan §1.2)
- This slice precedes rung-2 escalation per the user's 2026-07-05 directive. ADR-0010 remains intact; the deviation is recorded in .omo/plans/2026-07-05-spearhead-4half-and-step-5-strategic.md §1.2.

## Merge instructions
- rebase-merge, NOT squash — this branch shares lib.rs edits with dev-c's slice-5/rented-transport-dev-c (stacked branches per AGENTS.md Git workflow carve-out). Preserve the SHAs so dev-c can rebases forward.
- DCO signoff every commit.
- after merge: maintainer tags main: slice-5-trunk-green-zone-merged"

Emit ## STATUS UPDATE with Status: REVIEW-READY + tea PR URL. Do NOT merge the PR — the maintainer (user) merges after the live Twilio e2e validation (manual cargo test --features=twilio-live against real credentials, which the maintainer runs after your PR is merged + dev-c's PR is merged + a clean main checkout).

First action

After the required reading: emit a ## STATUS UPDATE confirming setup complete (worktree created, on slice-5/rented-transport-dev-b, spec + impl plan + ADRs absorbed), then start Task T2 by dispatching a Kimi-worker subagent with the per-task prompt shape above substituted for T2 (the trait + mock + redacted-Debug struct — pure interface code, low risk, lands first per the plan's critical path).

On your lifecycle as a background subagent: same as dev-a's — the PM holds your bg_... task ID, polls your output via background_output(task_id="bg_...") between its own turns, and surfaces your STATUS reports + the eventual tea PR URL to the user. Drain your relay inbox at for="dev-b" before each Kimi-worker dispatch + after each commit. On REVIEW-READY emit a final STATUS + return; PM handles PR surface + user merge approval.