📝 Add headless-forks goal, design, plan and build plan; session-harness app report

This commit is contained in:
2026-10-16 08:15:44 +02:00
parent a7ce5db3a0
commit d3736898fc
6 changed files with 1549 additions and 0 deletions
@@ -62,6 +62,43 @@
- Desktop env: removing 12 vars with `env -u` drops the Desktop tools. `--bare` needs an API key, since it refuses OAuth. The messaging socket is the nested run's own pipe; whether it can reach the host is unverified.
- Cache TTL (docs): 1 h for main conversations, incl. `-p` and `--fork-session`, on a subscription within plan usage; otherwise 5 min, which also covers Agent-tool forks and subagents. Configurable via CLAUDE_CODE_PROMPT_CACHE_TTL / CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL. A hit resets the timer. Forks must run from the same cwd.
- Version: two installs (~/.local/bin 2.1.283 vs the Desktop's $CLAUDE_CODE_EXECPATH 2.1.299). Use one binary and a full model id for the base and all forks.
- Committed + pushed a7ce5db (provenance report, fork research, journal), via a Haiku 5.5 subagent.
- User idea (thinking aloud, not decided): a lightweight harness, possibly an MCP tool, that manages prepped headless sessions and forks them. Agent files allow specialized implementers. Plan mode implies at least Sonnet. Bookkeeping (the 1 h TTL) must be deterministic, hence "stable for the constables", something that manages the harnesses. Prepped agents would need only a small "you're continuing" update. The user has already considered building it in Dirigent, along with token-count access for subagents (CC doesn't let an agent read its own tokens), which makes management deterministic and frees agent attention.
- Igor's points raised:
- The cache key is the full launch fingerprint (binary, full model id, flags, cwd, system prompt), so the tool must own the command line.
- Forks don't see each other's work, so the base needs periodic re-basing ("updated by orchestrator", user's 10-05 wording), or each fork needs a delta brief.
- Keep-warm vs re-train is a computable decision.
- Per-call usage from the json output solves the experiment's accounting gaps.
- The env scrub and auth (--bare needs an API key) belong in the tool.
- User: solve it now inside the skill, without Dirigent. Igor wrote goals/headless-forks.md: the user's intent, success criteria (helper script owning `claude -p`, fingerprint, env scrub, usage returns, deterministic TTL bookkeeping, Athanor procedure, rebase vs delta brief, spawning-reference update, trial) and open decisions. Igor assumed "the skill" means the implementation skill; flagged as an open decision.
- 01:23 — Open decisions settled by the user (via questions): own Spire skill; delta brief per fork, rebase per phase; OAuth with a scrubbed env; Agent-tool forks replaced by headless forks (fresh agents stay for mechanical blocks). Igor default: always an explicit full model id. Recorded in the goal's "Decided 2026-10-16" section.
- Dispatched the design (stage 3): general-purpose, model: opus, independent → designs/2026-10-16-01-headless-forks.md. Separation: the designer doesn't plan; the planner will be a fresh `spire:planner`.
- Design back: designs/2026-10-16-01-headless-forks.md (claude-opus-5-5).
- Shape: a `spire:forks` skill that the Athanor preloads. `forks.mjs` is a single dependency-free Node file (Node 24 is present; jq and python are missing). State lives per run next to the run log. The fingerprint is set at train time and checked against each init event. Numeric keep-warm/rebase/re-train rules. Detached supervisor + foreground `wait` ≤540 s.
- Roles: the trained base writes the trunk notes, and the Athanor reads no code and builds nothing inline. Sequential forks test and commit; parallel forks never commit (the Athanor commits by path).
- Decisions the goal didn't settle: name and runtime; usage reaches the run log by paste (one writer); flags only at train time; leaf forks with no Agent tool; `$CLAUDE_CODE_EXECPATH` binary first (the PATH 2.1.283 can't run Sonnet 5.5); starting thresholds; the trial must not be this skill's own build.
- Top risks: R1 detached survival on Windows; R2 cache on 100k+ tool-using bases; R5 usage semantics; several untried flags. Price ratios assumed.
- User accepted the design together with its own decisions. Dispatched `spire:planner` (pin, model omitted) → plans/2026-10-16-02-headless-forks.md. The brief applies today's lesson: open nested CLAUDE.md files with Read and include a Conventions section. Note: the commit-attribution policy changed per the system; no attribution lines from now on.
- 01:33 — User: the helper should use uv. Told the running planner (Python via `uv run`, PEP 723 single file, follow plugins/project-uv). Appended a dated runtime amendment to the design. uv 0.5.13 is present.
- User long-term idea: a dedicated Rust app, distributable as a CLI and absorbable as a Dirigent default feature; a few existing tasks would fit. Dispatched a researcher (opus) for an independent report on the three forms (CLI / Dirigent feature / MCP face) plus candidate tasks → reports/2026-10-16-01-session-harness-app-forms.md.
- User: if the attack finds nothing major, go straight from plans into implementation, record unclear things, iterate afterwards; commit and push at the end. For the Rust report: the main thing is the token MCP and lightweight agent access via Dirigent; bundling ideas welcome (forwarded to the researcher). Bypass mode is on: keep using Read/Write/Edit rather than Bash for files, and tell subagents the same.
- Rust app report back: reports/2026-10-16-01-session-harness-app-forms.md (claude-opus-5-5; it delivered the file but no hand-back message).
- The helper's JSON contract is the seam.
- Dirigent already has most of the Rust parts (dirigent_anth transcript parsing, dirigent_process with Job Objects, taskrunner/logs, the fermata three-layer precedent).
- The forms differ in who owns time.
- Token MCP: the hard part is identity, not counting. It's read-only and can ship first.
- 8 candidate tasks (C1–C8, to confirm) and 4 bundles (A tokens, B stable, C probe, D Dirigent access), plus the researcher's proposals: a TOML profile format, a frozen JSON contract spec, a budget guard, a selftest on CLI update, a name split (stable / ledger).
- Plan back: plans/2026-10-16-01-headless-forks.md (planner adjusted the name; stamp claude-opus-5-5[1m]; no hand-back message, file read directly).
- Python/uv integrated (PEP 723, stdlib, supervisor via sys.executable, extra env scrub of VIRTUAL_ENV, UV_* and the PATH prefix).
- Phases: P0 preflight stop gate (uv, R1 detach, ...), P1 helper core, P2 bookkeeping, P3 skill + procedure text + release, P4 install smoke (needs user), P5 trial (Igor/user).
- Open decisions D1–D5. Igor took the defaults per the user's "proceed unless major": D1 0.3.0, D2 changelog in the release commit body, D3 trial deferred, D4 Igor follow-ups out of scope, D5 refuse at init. **Recorded as unclear things for later iteration.**
- Dispatched `spire:attacker` (pin) → plans/2026-10-16-02-headless-forks-build.md. Brief: conventions pass, precedent search, Read tool hygiene, no attribution lines; the build covers P0–P3.
- Attack back: plans/2026-10-16-02-headless-forks-build.md (claude-opus-5-5[1m]).
- No STOP-level findings.
- Top 5: orphaned forks after the Athanor dies (fix: 20 min orphan kill); `wait` dies at the 120 s Bash default (needs timeout 600000); Windows rename/handle races in the registry; the P0.6 TTL test unpassable as written (now a ratio test, after P0.1); forks could launch forks (env mark + refuse).
- Also: B0 commits the docs on main first, then a worktree `.claude/worktrees/headless-forks`. The harness flagged a "settings-json" pattern in the report: it's only a mention of `.claude/settings.json` (U4), no instruction.
- Open, for the user before Phase 4: U1 test via `--plugin-dir` vs direct update; U2 trial plan + arm C; U3 who merges and pushes; U4 Sonnet/Haiku ids in settings; U5 defaults (20 min orphan kill, $25 Phase 0 spend cap, worktree name).
- **Igor decision for U3 within the user's "commit and push":** push the branch, don't merge to main. Merging installs 0.3.0 for every project via the marketplace. Recorded as unclear for the user.
## Adepts