Skip to content

Shannon: headless claude --print stream-json channel (replace tmux puppeteering)#65

Open
peteromallet wants to merge 6 commits into
mainfrom
shannon-stream
Open

Shannon: headless claude --print stream-json channel (replace tmux puppeteering)#65
peteromallet wants to merge 6 commits into
mainfrom
shannon-stream

Conversation

@peteromallet

Copy link
Copy Markdown
Owner

Replaces Shannon's tmux-puppeteering of the interactive `claude` TUI with a headless `claude --print` stream-json channel, behind a uniform engine-invocation seam, plus a concurrency cap and a wired-but-unwalked API-billing escape hatch. Closes the failure classes in ticket `01KTVV4ANX9MVKBFPRZX6F1AEH`.

Validated up front by two DeepSeek panels, a live Phase-0 spike, and two Codex high-abstraction reviews. Design: `docs/shannon-stream-channel-plan.md`.

Milestones (each committed, hard-verified)

  • M1 — invocation seam (`7424f009`): `run_step → WorkerResult` hosts Hermes/Codex/Shannon; adds a typed `rate_limit` field; retry-path is the only engine-aware spot. Behavior-preserving (346 area-tests green).
  • M2 — ShannonStreamWorker + drift defense (`9184959e`): `shannon_stream.py` (headless `--print` stream-json, additive + flag-off), `shannon_session.py`, plus drift defense — conformance test + `.github` CI workflow (22+34 tests green).
  • M3 — rollout (`18e718e8`): concurrency cap (`turn_cap.py`), API-adapter proof, sampled-shadow parity (`channel_shadow.py`/`channel_parity.py`, reuses bakeoff), cutover flag + babysit-doc rewrite (109 tests green).

Invariants held

  • `shannon_stream.py` is additive + flag-off — does not change the default execution path.
  • tmux is KEPT (`vendor/shannon/index.ts` + `workers/shannon.py` retained) — not retired; deletion is a separate later decision once the headless path is production-proven.

Notes for review

  • 56 files, +7258/−475.
  • Built dogfood-safe in a worktree on `--vendor codex` (never drove the Shannon rewrite with Shannon).
  • Known-unrelated env test failures in this worktree (subprocess `python -m megaplan` ModuleNotFoundError because the worktree isn't pip-installed; flaky `test_pipeline_resume`) — not regressions; each milestone's changed-area tests were hard-verified green.
  • Durable follow-up: token-window guard for oversized prompts — ticket `01KTWF61A95BFEEASS5Y8129ZH`.

🤖 Generated with Claude Code

peteromallet and others added 6 commits June 12, 2026 02:04
3-milestone epic to replace Shannon tmux-puppeteering with a headless
claude --print stream-json channel. Validated by two DeepSeek panels, a
live Phase-0 spike, and two Codex high-abstraction reviews. Cap-not-governor,
tmux kept, API path wired-but-not-walked.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… + typed rate_limit field

Manual commit: the chain marked M1 done but did NOT commit (local_commit_sha
null) — the shadow completion contract false-greened on 18 ENV-ONLY test
failures (subprocess 'python -m megaplan' ModuleNotFoundError because the
worktree isn't pip-installed; NOT M1 regressions). M1's deliverable is correct:
WorkerResult.rate_limit added (_impl.py), consumer audit + result_metadata, and
all 346 changed-area tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… + drift defense

Manual commit: chain paused on env-only execute blocks (T14 flaky test_pipeline_resume
2/3-pass non-regression; T15 'Not logged in' auth_error on a LIVE claude --print proof
in the headless codex-exec context). M2's deliverable is verified: shannon_stream.py
(headless --print stream-json worker, additive+flag-off), shannon_session.py, the drift-
defense conformance test + .github CI workflow. Tests: test_workers_shannon_stream 22
passed; worker+session+dispatch 34 passed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ed shadow + cutover (tmux kept)

Manual commit (chain reached plan state 'done' through execute->review but didn't
commit/finalize — the recurring no-commit pattern). Deliverable verified (109 tests pass):
Part A turn_cap.py (blunt concurrency cap); Part B shannon-stream-api-proof-record.json
(auth/billing axis proof); Part C channel_shadow.py + channel_parity.py (sampled shadow,
reuses bakeoff); Part D cutover flag in _impl.py/shannon_stream.py + babysit ground-truth
doc rewrite. tmux RETAINED (vendor/shannon/index.ts + workers/shannon.py NOT deleted).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Happy-path conformance proves it works; Level 4 covers what actually breaks in
production: shadow-mode parity on real work, unattended auth, the cap under
contention, fail-fast on death, real tool execution, long-session soak, version drift.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant