Skip to content

Codex models as subagents for Claude Code.

Claude Code plans the work, writes the contracts and reviews the result. foreman hands the implementation to Codex models, each in its own git worktree, and wakes Claude when one finishes or asks a question. Claude can answer it or change its instructions mid-turn, and nothing is committed until Claude has read the diff. It runs on the Codex CLI's ChatGPT login, so there is no OpenAI API key involved.

npm i -g @steamfield/foreman
replaying 70m30s in 1m

Turn complete. Claude reviews the hand-off.

Claude Code

written + recorded
Written for this page

Fix part B of the release findings: supervisor state, persistence and recovery. Hand it to Codex.

Written for this page

I wrote a contract and am starting Codex in its own worktree, with the wait running in the background.

Bash(foreman start fix-supervisor --new-worktree --setup "bun install" --contract fix-supervisor.md --write --wait)

Recorded status digest

run: fix-supervisor idle 70m30s (gpt-sol, high, priority, write) worktree: ~/src/foreman/.claude/worktrees/fix-supervisor branch: foreman/fix-supervisor (foreman-created, base 39aec1625582d74b66751460b5fb66b6b1b27add)
question q1
O7's implemented policy omits persisted command output tails. The real smoke self-review succeeded (nested codex exec exit 0 and hand-off REVIEW-OK), but smoke/real-codex.test.ts:242 requires REVIEW-OK in outputTail. smoke/ is outside this unit's May change scope, blocking green acceptance. May I change only this assertion to require exitCode: 0 and outputTail: "" (the preceding assertion already verifies REVIEW-OK in the completed hand-off), then rerun smoke?
Bash(foreman answer fix-supervisor q1 "No: don't drop command output tails. Losing them makes foreman events useless exactly when a command fails. Use the conventional policy instead: keep the tails (and the stderr and raw capture you bound), but pass them through redaction of secret-looking values (reuse logging.ts's redaction rules: secret-like keys and token-shaped values such as sk-..., ghp_..., Bearer ..., long base64/hex blobs, KEY=value pairs whose key looks secret), and keep everything under the private 0700 home. Document the policy and its limits (redaction is best effort) in the RFC. Then the smoke assertion stays as it is. Add tests that a token-shaped value in command output is redacted in events.jsonl and codex.jsonl." --wait)
ok
question q2
The required independent review found multiline PEM leakage in stderr redaction. The patch hook blocked a regression fixture containing only a PEM BEGIN/END marker around the literal synthetic payload 'short-private-key-payload'. The hook explicitly requires approval plus a 'pragma: allowlist secret' comment for deliberate fixtures. May I add this synthetic fixture with that pragma, then implement and verify line-aware PEM redaction?

q2 auto-answer

No answer from the orchestrator. Proceed with your best judgment and note this question and your choice under Open in the hand-off.
Written for this page

The 15-minute question timeout expired. foreman told Codex to proceed and record its choice.

done

commands: 299 (34 failed, 1 blocked by repo hooks)
Written for this page

I’ll read the hand-off, review the diff and run the checks before committing.

Codex: fix-supervisor

done70m30s
299 commands (34 failed)18 files written37.4M in / 174.8K out

Questions from this run

  • +20:21
    question q1
    O7's implemented policy omits persisted command output tails. The real smoke self-review succeeded (nested codex exec exit 0 and hand-off REVIEW-OK), but smoke/real-codex.test.ts:242 requires REVIEW-OK in outputTail. smoke/ is outside this unit's May change scope, blocking green acceptance. May I change only this assertion to require exitCode: 0 and outputTail: "" (the preceding assertion already verifies REVIEW-OK in the completed hand-off), then rerun smoke?
  • +39:16
    question q2
    The required independent review found multiline PEM leakage in stderr redaction. The patch hook blocked a regression fixture containing only a PEM BEGIN/END marker around the literal synthetic payload 'short-private-key-payload'. The hook explicitly requires approval plus a 'pragma: allowlist secret' comment for deliberate fixtures. May I add this synthetic fixture with that pragma, then implement and verify line-aware PEM redaction?

Latest recorded events

  • +57:24
    The PEM approval request timed out without an answer, so that fixture write remains blocked. I also found a redaction bug affecting normalized file paths: a long path can look like an encoded secret and get changed, which would break scope reporting. I’m adding a regression and preserving those path identities.
  • +57:27
    write
    tests/run-store.test.ts
  • +57:36
    write
    src/core/runs/store.ts
  • +58:25
    ✓bun run lint
  • +1:02:07
    The path fix passes. The final unit suite passed all 815 tests, the rebuilt binary suite passed 8, and the store file passed three runs of 35 tests. Five review findings are resolved; multiline PEM handling remains blocked because the hook-required fixture approval was not received.
  • +1:03:15
    ✓git diff --stat
  • +1:07:12
    The last smoke run is in its timed hold, with no failures so far. I’ll hand off the verified changes and mark the unit blocked on the synthetic PEM fixture approval. The fixture and its multiline stderr fix remain unwritten; I did not add an allowlist pragma without approval.
  • +1:07:30
    ✓git status --short
  • +1:07:30
    ✓git diff --check
  • +1:10:29
    **1. Summary** Implemented the supervisor state, persistence, recovery and diagnostic changes, with 38 new regression cases. Everything is uncommitted; nothing was pushed. **Part B remains blocked on review finding 3:** multiline PEM redaction needs a synthetic fixture that the repository’s secret-write hook refused without approval. **2. Files** | File | Change | |---|---| | `src/core/runs/store.ts` | Version fences, cached format validation, streamed reads, atomic hand-offs, bounded redacted capture and validated archive ordering. | | `src/supervisor/registry.ts` | Recoverable state journal, streamed reconciliation, safe background diagnostics and archive cleanup ordering. | | `src/supervisor/turns.ts` | Preserve unreadable names, retain acknowledged turn IDs across write failures and keep ownership until termination. | | `src/supervisor/app-server.ts` | Preserve disconnect reasons and join shared resource cleanup before retirement completes. | | `src/supervisor/questions.ts` | Bind questions to their originating connection; finish Answer bookkeeping despite caller interruption; prevent resending delivered answers. | | `src/supervisor/index.ts` | Cover follow-up cursor failures with recovery and give Answer a daemon-owned lifetime. | | `src/supervisor/wait.ts` | UTF-8 cursors with legacy decoding; preserve Git discovery failures. | | `src/codex/client.ts` | Expose the connection’s termination cause. | | `src/logging.ts` | Safe cause fields, diagnostic redaction and bounded rotating sinks. | | `src/schemas/daemon.ts` | Storage header, pending state transition and transition identifier schemas. | | `tests/run-store.test.ts` | Storage, compatibility, redaction, bounds, streaming, atomic publication and path-identity regressions. | | `tests/supervisor-integration.test.ts` | Ownership, recovery, cursor, connection, Answer and archive interleavings. | | `tests/codex-client.test.ts` | Preserve exit reason without pending RPCs. | | `tests/config-logging.test.ts` | CLI rotation and oversized-record bounds. | | `docs/rfcs/0001-foreman.md` | Runs and Failure handling: formats, recovery, privacy, retention and cleanup. | **3. Decisions** - Storage writes use version 1; unversioned records remain readable. Unsupported versions fence mutations and archive cleanup. - `pendingStateEvent` and `transitionId` make state publication recoverable without duplicate attention. - Unknown expiry retires the connection and waits for its resource-cleanup completion. This can also end peer runs on that connection. - Questions retain their originating server. Accepted Answers use daemon-owned execution and an uninterruptible delivery/bookkeeping section. - New cursors use `u1.` plus UTF-8 encoding. Unprefixed cursors retain Latin-1 semantics, avoiding ambiguous legacy paths. - Per orchestrator direction, command tails, stderr and bounded raw capture are retained with best-effort redaction. Normalized file-change paths remain exact for scope reporting. - Format validation caches checked file metadata and records owned appends; opening a run still validates its complete history. - Archive cleanup runs only after storage compatibility checks. Archives have documented manual retention and cleanup. The testing skills drove real-service tests with Deferred, TestClock, FIFO and transport barriers. Error-handling guidance shaped message-free defect traces and safe platform context. Effect guidance informed scoped ownership; architecture and writing guidance kept changes in existing modules and the RFC focused on concrete policy. **4. Checks** | Check | Result | |---|---| | `bun run lint` | Passed: 121 files. | | `bun run typecheck` | Passed. | | `bun run format` | Passed; latest run required no changes. | | `bun run test` | Final: **815 passed across 32 files**. | | Four changed test files | Three post-review runs: **259 passed each**. | | `bun run test:unit tests/run-store.test.ts` | After the final path fix: **35 passed, three times**. | | `bun run test:unit tests/daemon-logging.test.ts` | **5 passed**. | | `bun run e2e` | Final: **8 passed, 0 failed**. | | `FOREMAN_SMOKE=1 FOREMAN_SMOKE_SHORT=1 bun run smoke` | Final: **16 passed, 0 failed**. | | `bun run build` | Passed; binary reports `foreman v0.1.0`. | | `git diff --check` | Passed. | Revert verification produced the expected failures: 24 in the original regression batch, 7 in the redaction batch, 4 review regressions, 2 additional ownership/archive regressions and the path-identity regression. Fixes were restored afterward. Legacy compatibility intentionally passes against the baseline. Earlier failures were corrected, including diagnostic path context, raw-capture assertions and the discarded tail-omission policy. The initial smoke run had one tail assertion failure; subsequent smoke runs passed all 16 cases. `bun run check` was not run. Built-binary QA with temporary homes confirmed: - Baseline Start deleted damaged history; the fix refuses reuse and preserves it. - Baseline Unicode waits failed; the fix completes waits and continuations. - Token-shaped diagnostic values persisted before and are redacted afterward. - After the real five-minute deadline, baseline state was `lost` while Codex remained alive. The fixed build reported `lost` after Codex exited. Evidence is under `/tmp/foreman-b-revert-e7gjxev7/`. **5. Review** Review: [review.md](/tmp/scratch) 1. Repeated full-log version scans: **fixed** with validated metadata caching. 2. Unversioned oversized-capture marker: **fixed**. 3. Multiline PEM leakage through stderr: **blocked**, described below. 4. Concurrent retirement returning before cleanup: **fixed** with shared resource completion. 5. Journal reconciliation collecting all history: **fixed** with a streaming search. 6. Stderr test observing file creation before content: **fixed** by waiting for committed contents. One independent review pass was performed, as requested. **6. Look closer at** - Format-cache invalidation and its serialized-writer assumption. - Resource-finalizer ordering in `makeAppServer.close`, especially when merging Part A’s shutdown changes. - `archiveRun`’s `beforeArchive` effect, which keeps compatibility validation ahead of worktree removal. **7. Open** Approval is needed for the synthetic PEM fixture with a `pragma: allowlist secret` comment. The pending fix belongs in the stderr handler at `src/supervisor/app-server.ts:127`: track private-key-block state across lines and suppress short payload lines until the END marker. Its regression must exercise the actual stderr transport. The PreToolUse secret-write hook explicitly rejected the synthetic PEM markers and required approval plus the pragma. The orchestrator request timed out without an answer. I left that fixture and fix unwritten; short PEM payload lines can still persist, so this unit is not complete.
  • +1:10:29

    turn 1: completed

  • +1:10:30

    running → idle

The fix-supervisor delegate from foreman's own release, 70 minutes replayed in one, including the question Codex asked and Claude's answer. Codex's events and foreman's output are recorded. Claude's side of the conversation was written for this page.

Running two agents

If you run Codex beside Claude Code yourself, you carry every message between them. foreman gives that job to Claude, which wrote the plan and reviews the result anyway.

By hand

  1. You paste Claude's spec into a Codex session and watch it work.
  2. Codex asks a question while you're at lunch, and the turn sits there.
  3. Its changes land in your checkout, mixed with whatever Claude is doing.
  4. You paste the result back into Claude and ask it to review.

Through foreman

  1. Claude writes a contract and starts Codex in a fresh worktree with one command.
  2. foreman holds Codex's question until Claude answers it, and the turn picks up where it stopped.
  3. Each delegate works in its own worktree on its own branch, away from your checkout.
  4. Claude reads the hand-off and the diff, refactors, runs your checks and commits.

A model for each job

Claude Code is best at the long view: planning, architecture, and keeping many tasks moving to a reviewed finish. Codex has models that are cheaper per task and good at the work in between. foreman makes them available to Claude the way its own subagents are: start one with a contract, wait on it in the background, answer it, review it.

Claude Code

orchestrator

Plans and architects the change, splits it into contracts, answers delegates' questions, reviews every diff, runs your checks and commits.

How Claude drives a delegate · written for this page

  • $ foreman start <name> --new-worktree --contract <file> --model gpt-sol --wait
  • $ foreman answer <name> <question-id> "<decision>" --wait
  • $ foreman steer <name> "<correction>"
  • $ foreman result <name>
  • $ foreman archive <name>

On this page: Designed this page and wrote every contract behind it.

sol

gpt-sol

The everyday worker. Implements a written contract, runs the repo's checks and hands back a report. foreman's default model.

On this page: Built the command tabs and llms.txt (site-commands).

terra

gpt-terra

The cheapest model, and effective on narrow work: tests for existing behaviour, classification, mechanical edits.

On this page: Wrote the browser and accessibility tests (site-e2e).

astra

gpt-astra

The design model. Visual work and interface details that need taste, for much less than the same work on Claude's largest models.

On this page: Designed the console replay at the top (site-console).

The delegates get close to Claude's quality when the repository tells them how to work. Codex reads AGENTS.md and the rules the contract names, runs under the same hooks Claude does (.codex/hooks.json), and every contract ends with an independent review in a fresh Codex process before the hand-off. Claude still reads the diff, so the review bar doesn't move; Claude's usage goes to planning and review, and the implementation runs on your ChatGPT plan.

How a session runs

Claude splits a feature into three tasks and gives each to a Codex delegate on the model that suits it, then answers a question, redirects a turn and lands all three. The diagram is a simulation with compressed timings; the commands, states and question text are foreman's.

Claude Code writes three contracts and starts Codex delegates on astra, sol and terra in separate worktrees. The foreman daemon routes their events. It holds site-commands' question while the other two work, wakes Claude and releases the call after Claude answers. Claude steers site-e2e, reviews site-console, starts a second turn on the same thread, then reviews, checks, commits and merges all three before archiving their clean worktrees.

Step 4 of 10: Hold a question for Claude

Each lane's commands are sampled from its delegate's recording; question and answer from site-commands. Narration written for this page.
  1. 1. Write three contracts

    Claude splits the page into three tasks, each with its own May change line. Astra handles design taste, sol implementation, and terra tests.

    console.md · written for this page
    Task: Hero console
    May change: site/src/components/landing/SupervisionConsole.tsx, site/src/components/landing/SupervisionConsole.test.tsx, site/src/components/landing/console/, site/src/data/supervision.ts, site/src/data/supervision.test.ts
    commands.md · written for this page
    Task: Command tabs + llms.txt
    May change: site/src/components/landing/CommandTabs.tsx, site/src/components/landing/CommandTabs.test.tsx, site/src/data/commands.ts, site/src/data/commands.test.ts, site/src/pages/llms.txt.ts
    e2e.md · written for this page
    Task: Browser + accessibility checks
    May change: site/e2e/, site/playwright.config.ts
  2. 2. Start three worktrees

    The daemon creates each .claude/worktrees/<name> directory on foreman/<name>, runs bun install, then starts a Codex turn. The starts are staggered.

    Claude's commands · written for this page
    foreman start site-console --new-worktree --setup "bun install" --contract console.md --write --model gpt-astra
    
    foreman start site-commands --new-worktree --setup "bun install" --contract commands.md --write --model gpt-sol
    
    foreman start site-e2e --new-worktree --setup "bun install" --contract e2e.md --write --model gpt-terra
  3. 3. Wait while all three work

    Claude runs one wait in the background and goes idle. Commands and file writes stream from the delegates to the dispatch board.

    Claude's commands · written for this page
    foreman wait --all
  4. 4. Hold a question for Claude

    site-commands calls ask_orchestrator. The daemon holds the tool call, marks the run waiting, and wakes Claude with question q1.

    question q1Recorded question · site-commands · q1

    The required strict install-command drift check finds landing.ts install.options npx command `npx @steamfield/foreman doctor`, while README.md only contains `npx @steamfield/foreman` (Install). The contract forbids editing either here or loosening the test. Please align the source copy/README in your scope so the exact-command test can pass; I will retain the strict comparison.

  5. 5. Answer and resume waiting

    Claude answers; the held call releases and site-commands keeps working. Claude runs the next wait command printed with the answer, including its cursor.

    Recorded answer

    Your test is right and the page copy is wrong. Change the npx option in site/src/data/landing.ts to exactly "npx @steamfield/foreman" (I made the same one-line change on the base branch, so the hunks will match at merge). You may edit that one line of landing.ts; nothing else in it. Keep the strict comparison.

    Claude's commands · written for this page
    foreman answer site-commands q1 "Your test is right and the page copy is wrong. Change the npx option in site/src/data/landing.ts to exactly \"npx @steamfield/foreman\" (I made the same one-line change on the base branch, so the hunks will match at merge). You may edit that one line of landing.ts; nothing else in it. Keep the strict comparison."
    
    foreman wait --all --after eyJfdGFnIjoiR3JvdXBDdXJzb3IiLCJncm91cCI6In4vc3JjL2ZvcmVtYW4iLCJwb3NpdGlvbnMiOnsiZml4LWNsaSI6eyJpZGVudGl0eSI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XEiOjIyfSwic2l0ZS1jb21tYW5kcyI6eyJpZGVudGl0eSI6IjIwMjYtMTEtMDZUMDk6MjQ6MjUuNTI2WjowMWExYjAyYy03NzNjLTdmYzItOWJiOS02YzgwZTgyMjQ1NmEiLCJzZXEiOjI5fX19
    
  6. 6. Steer the active test turn

    Claude adds the 375px check while site-e2e is running, with no question pending. Steer changes the current turn's instructions.

    Claude's commands · written for this page
    foreman steer site-e2e "Also check 375px widths."
  7. 7. Review the first result

    The wait returns done for site-console with its digest. Claude reads the result and diff, runs the site's checks, and commits the reviewed work.

    Read the recorded digest
    Recorded digest · site-console
    run:       site-console  idle  20m28s  (gpt-astra, high, priority, write)
    dir:       ~/.foreman/runs/site-console
    worktree:  ~/src/foreman/.claude/worktrees/site-console
    branch:    foreman/site-console (foreman-created, base 2ba8209483831f8b7fbbe811b104cf20a8aa6378)
    turn:      1 (start)
    question:  (none)
    commands:  82 (8 failed, 0 blocked by repo hooks)
      last:    /bin/zsh -lc 'git diff --check && git status --short'  exit=0
    files written:
      site/.astro/collections/blog.schema.json
      site/.astro/content-assets.mjs
      site/.astro/content-modules.mjs
      site/.astro/content.d.ts
      site/.astro/data-store.json
      site/.astro/settings.json
      site/.astro/types.d.ts
      site/src/components/landing/SupervisionConsole.test.tsx
      site/src/components/landing/SupervisionConsole.tsx
      site/src/components/landing/console/ConsoleText.tsx
      site/src/components/landing/console/EventFeed.tsx
      site/src/components/landing/console/Transcript.tsx
      site/src/data/supervision.test.ts
      site/src/data/supervision.ts
    outside May change:  (none)
    new in git status since start:
      M  site/src/components/landing/SupervisionConsole.tsx
      M  site/src/data/supervision.ts
      ?? site/src/components/landing/SupervisionConsole.test.tsx
      ?? site/src/components/landing/console/ConsoleText.tsx
      ?? site/src/components/landing/console/EventFeed.tsx
      ?? site/src/components/landing/console/Transcript.tsx
      ?? site/src/data/supervision.test.ts
    tokens:    7.7M in (98% cached), 35.2K out
    
    Claude's commands · written for this page
    foreman result site-console
  8. 8. Follow up on the same thread

    Claude starts turn 2 in site-console's existing thread and worktree. The small correction finishes, and Claude reviews and commits it.

    Claude's commands · written for this page
    foreman followup site-console "Drop the false scope flags from the final step."
  9. 9. Land the remaining work

    site-commands finishes, then site-e2e. Claude reviews each diff, runs the checks, commits the work and merges all three branches.

    Claude's commands · written for this page
    foreman result site-commands
    
    foreman result site-e2e
  10. 10. Archive the merged runs

    Claude archives all three runs after their branches are merged and worktrees are clean. The worktrees and branches are removed; their records stay on the board.

    Claude's commands · written for this page
    foreman archive site-console
    
    foreman archive site-commands
    
    foreman archive site-e2e

Run states

Every run moves through the same states. Claude waits on it in the background and only steps in when foreman reports a question or the end of a turn.

  1. Contract

    Contract

    foreman reports

    Nothing yet. foreman sends the contract to Codex as the first turn's prompt, after a short preamble about working in a worktree and leaving changes uncommitted.

    Claude does

    Write the goal, a - May change: line, the repo’s checks and the hand-off Codex should leave. Keep changes uncommitted for review.

    Command / arguments
    --contract <file>

    Explanations and command templates written for this page. Recorded excerpts are labeled.

  2. Start

    Start

    foreman reports

    foreman creates .claude/worktrees/<name> on branch foreman/<name>, runs the setup command, then starts the turn. This recording is the delegate that set up this site.

    Recorded: foreman start --wait
    site-scaffold
    ~/.foreman/runs/site-scaffold
    worktree: ~/src/foreman/.claude/worktrees/site-scaffold
    branch: foreman/site-scaffold

    Claude does

    Start with the repo’s install command and --write. Run start --wait in the background so Claude can keep working.

    Command / arguments
    foreman start <name> --new-worktree --setup "<install>" --contract <file> --write --wait

    Explanations and command templates written for this page. Recorded excerpts are labeled.

  3. Running

    Running

    foreman reports

    The turn is active. Claude's background wait stays quiet until the run needs it, for up to 60 minutes by default.

    Claude does

    Codex works while Claude’s background wait is idle. Use steer to change the active turn, or interrupt to stop it.

    Command / arguments
    foreman wait <name>
    foreman steer <name> "<message>"
    foreman interrupt <name>

    Explanations and command templates written for this page. Recorded excerpts are labeled.

  4. Question

    Question

    foreman reports

    Codex called ask_orchestrator. foreman holds the call open, and the wait returns question with an id. This is q1 from fix-supervisor, as Codex wrote it.

    Recorded: fix-supervisor q1
    O7's implemented policy omits persisted command output tails. The real smoke self-review succeeded (nested codex exec exit 0 and hand-off REVIEW-OK), but smoke/real-codex.test.ts:242 requires REVIEW-OK in outputTail. smoke/ is outside this unit's May change scope, blocking green acceptance. May I change only this assertion to require exitCode: 0 and outputTail: "" (the preceding assertion already verifies REVIEW-OK in the completed hand-off), then rerun smoke?

    Claude does

    Answer the question with --wait to resume the held call and keep watching, or defer it to release the call without deciding. Codex then continues with independent work, avoids irreversible steps on the decision and lists it under Open. The question timeout (15 minutes by default) does the same, and Claude can still answer later.

    Command / arguments
    foreman answer <name> <id> "<text>" --wait

    Explanations and command templates written for this page. Recorded excerpts are labeled.

  5. Done

    Done

    foreman reports

    done means the turn ended; assess its hand-off and checks before accepting the work.

    Recorded: the wait result
    done        site-scaffold turn 1
    
    run:       site-scaffold  idle  22m32s  (gpt-sol, high, priority, write)
    dir:       ~/.foreman/runs/site-scaffold
    worktree:  ~/src/foreman/.claude/worktrees/site-scaffold
    branch:    foreman/site-scaffold (foreman-created, base aef7e30c8438e7eeddac7099008c6e0fb51b429f)
    turn:      1 (start)
    question:  (none)
    commands:  169 (24 failed, 0 blocked by repo hooks)
      last:    /bin/zsh -lc 'on-port 4323'  exit=1

    Claude does

    Read the hand-off and diff. Check the result before accepting it; use followup if another turn is needed.

    Command / arguments
    foreman result <name>

    Explanations and command templates written for this page. Recorded excerpts are labeled.

  6. Failed

    Failed

    foreman reports

    The turn ended with an error. The result includes Codex's hand-off if it left one, and its edits stay in the worktree.

    Claude does

    Read the failure and inspect the edits left in place. Use followup to start another turn on the inactive run.

    Command / arguments
    foreman followup <name> "<message>" --wait

    Explanations and command templates written for this page. Recorded excerpts are labeled.

  7. Interrupted

    Interrupted

    foreman reports

    The turn stopped before it finished, after foreman interrupt for example. Its edits stay in the worktree.

    Claude does

    Inspect the edits left in place after the turn stopped. The run accepts followup when Claude is ready to continue.

    Command / arguments
    foreman followup <name> "<message>" --wait

    Explanations and command templates written for this page. Recorded excerpts are labeled.

  8. Lost

    Lost

    foreman reports

    lost means the daemon can no longer supervise the run, after a crash for example. The edits are still in the worktree.

    Claude does

    Inspect the run and its worktree before deciding how to recover. Do not treat lost supervision as completed work.

    Command / arguments
    foreman status <name>
    foreman doctor

    Explanations and command templates written for this page. Recorded excerpts are labeled.

  9. Claude decides

    Claude decides

    foreman reports

    Nothing runs. The run is inactive with its edits, its Codex thread and the failure kept, and the result names a transient: or usage-limit: hint when there is one.

    Claude does

    Read foreman result and the worktree, then decide. If the work is on track, send a followup with what to fix (and a larger --budget if the turn ran out): the next turn continues the same Codex thread. If the approach went wrong, or a lost run has no saved thread, archive it with --keep-worktree and dispatch a fresh run from a new contract.

    Command / arguments
    foreman result <name>
    foreman followup <name> --file <followup> --wait

    Explanations and command templates written for this page. Recorded excerpts are labeled.

  10. Review and commit

    Review and commit

    foreman reports

    Nothing new. The run stays idle, with its edits uncommitted in the worktree until Claude commits them.

    Claude does

    Read the hand-off with foreman result and inspect the diff in the worktree. Refactor, run the repo’s checks, then commit and merge useful work. foreman never commits.

    Command / arguments
    foreman result <name>
    git -C .claude/worktrees/<name> diff

    Explanations and command templates written for this page. Recorded excerpts are labeled.

  11. Archive

    Archive

    foreman reports

    foreman removes the worktree and branch only when that loses nothing: no uncommitted or untracked files, and a branch that is unchanged or merged. Otherwise it refuses and lists what's left.

    Recorded: foreman archive site-scaffold
    ~/.foreman/runs/.archive/site-scaffold-1793956815386
    

    Claude does

    Archive after review and merging useful work. If cleanup would lose work, foreman refuses. Use --keep-worktree to archive the run while keeping its worktree and branch.

    Command / arguments
    foreman archive <name>
    foreman archive <name> --keep-worktree

    Explanations and command templates written for this page. Recorded excerpts are labeled.

Contracts and digests

Claude hands Codex a written contract: the goal, the files it may change, the checks to run and the report to end with. When the turn ends, foreman's digest lists every file Codex wrote and flags the ones outside the contract's scope.

# Contract: the supervision console (hero demo)

## Goal

Build the hero's supervision console: one framed console, two panes on one clock, replaying the recorded `fix-supervisor` run (`fixtures/runs/fix-supervisor.json`, loaded with `loadRun("fix-supervisor")`). It answers the hero's question, "what is it?", by showing supervision happening: Claude delegates, Codex works, Codex asks, Claude answers, the turn finishes, Claude reviews. See `docs/PRODUCT.md` section 1 and `src/data/landing.ts` `hero`.

…

## Scope

May change- May change: `site/src/data/supervision.ts`, `site/src/data/supervision.test.ts`,

`site/src/components/landing/SupervisionConsole.tsx`,

`site/src/components/landing/SupervisionConsole.test.tsx`,

`site/src/components/landing/console/` (new, for subcomponents if you need them).

- Must not change: everything else, including `index.astro`, `primitives.tsx`, `global.css`,

`runs.ts`, `landing.ts` and `fixtures/`. If you need a primitive or token changed, say so in

the hand-off with the exact change; if it blocks you, ask.

- Locked: none.

…

Read the full contract
# Contract: the supervision console (hero demo)

You are working in a git worktree for an orchestrator who reviews, refactors and commits your
work. Work here, not in the main checkout. Leave changes uncommitted and do not push.
Ask through `ask_orchestrator` only when blocked by something the contract and repo do not
settle, or when a decision with real consequences is needed. Those calls pause your work.
Progress reports, findings and corrections go in the hand-off, not in questions.

## Context for every unit

`site/` is foreman's landing page (Astro 7 static, React islands, Tailwind 4, Bun), at
https://foreman.steamfield.io. Four delegates build its sections in parallel from the same
commit, each owning different files. The orchestrator designed the page and owns the layout,
the tokens and `src/pages/index.astro`, which already renders your component through the
stub interface in your scope. Keep that interface's export names and props unless the
contract says otherwise; you may enrich the types it names.

Read first, in `site/`: `AGENTS.md`, `docs/PRODUCT.md` (the spec: your section's question and
outline entry), `DESIGN.md` (all of it: tokens, the rule about orange, type, shape, motion,
accessibility), `src/styles/global.css` (token utility names), `src/components/landing/primitives.tsx`
(reuse `Section`, `DataTable`, `CodeFrame`, `StateBadge`, `Inline`; don't fork them),
`src/data/runs.ts` (the recorded-run types), `src/lib/format.ts`, `src/data/landing.ts` (copy),
and `src/pages/index.astro` (where your component sits). Look at one recording in
`fixtures/runs/` and `fixtures/cli/`.

Rules that apply to every unit:

- Demos replay recordings. Never hand-write foreman output or Codex events: take them from
  `fixtures/`. Prose written for the page (Claude's side of a conversation, captions) is
  labeled as written for the page where it appears beside recorded output.
- Style with the token utilities from `global.css` (`bg-console`, `text-ink-3`, `rounded-frame`,
  `font-display`...), never raw hex, never `dark:` variants. A value you need that isn't a
  token: ask, don't invent one.
- Every island server-renders a useful final state: with no JavaScript and under reduced
  motion it shows the finished content, statically, and nothing depends on animation to be
  readable. Use `@steamfield/ui` (read `site/node_modules/@steamfield/ui/README.md` and its
  `.d.ts` files) for clocks, gating to on-screen, copy buttons and tabs rather than writing
  your own. Its playback gate already handles reduced motion and `[data-sf-motion="reduce"]`.
- Keyboard: every control is a real `<button>` or link, focus is visible (the global focus
  ring), and interactive demos announce state changes politely (`aria-live="polite"`) without
  re-announcing every streamed line.
- Phone widths (375px) work: no horizontal page scroll, long command lines scroll inside
  their own frame.
- Analytics: islands call `track()` from `src/lib/analytics.ts` with events declared in
  `src/lib/events.ts`; the names you need already exist.
- A sibling site built the same way, for reading only (never copy names or paths into tracked
  files): `~/Projects/rr/site/` (`src/components/landing/TerminalPlayer.tsx`,
  `CommandTabs.tsx`, `FlowDiagram.tsx`, `MonitorStage.tsx` and their tests show how islands
  there use `@steamfield/ui` and how they're tested).

## Goal

Build the hero's supervision console: one framed console, two panes on one clock, replaying the
recorded `fix-supervisor` run (`fixtures/runs/fix-supervisor.json`, loaded with
`loadRun("fix-supervisor")`). It answers the hero's question, "what is it?", by showing
supervision happening: Claude delegates, Codex works, Codex asks, Claude answers, the turn
finishes, Claude reviews. See `docs/PRODUCT.md` section 1 and `src/data/landing.ts` `hero`.

The run took 70.5 minutes. The replay compresses it to about 60 seconds of playback.

### The two panes

Left, "Claude Code" (narrower, about 5/12 at desktop): Claude's side, as a Claude-Code-style
transcript: a `❯` user turn, Claude's short prose, and `Bash(...)` tool calls with an indented
`⎿` result. Steps, in order, each pinned to a moment of the run's clock:

1. User (written for the page): "Fix part B of the release findings: supervisor state,
   persistence and recovery. Hand it to Codex."
2. Claude prose (written): one sentence saying it wrote a contract and is starting a delegate
   in its own worktree, waiting in the background.
3. Tool call at t=0: `foreman start fix-supervisor --new-worktree --setup "bun install"
   --contract fix-supervisor.md --write --wait`, shown as running in the background. Its
   result lines are the recorded digest's `run:`, `worktree:` and `branch:` lines (from
   `run.digest`, the first lines of a real `foreman status` for this run). Label the step
   "background" while the run is active.
4. At q1's asked time: the background wait returns `question` with id `q1` and the full
   recorded question text (from `run.questions`). The `q1` marker uses `signal`, per the rule
   about orange.
5. Immediately after: tool call `foreman answer fix-supervisor q1 "<recorded answer text>"
   --wait`, result `ok`, then the step continues in the background. The answer text is
   `run.questions` q1's `Resolved.text`, verbatim (it is long; the console truncates it
   visually with a "show all" control, never in the data).
6. At q2's asked time: the wait returns `question` q2 (recorded text). Claude does not answer
   it (in reality no one did). At q2's resolved time, show the recorded auto-answer text and a
   one-line note written for the page that the 15-minute question timeout expired and foreman
   told Codex to proceed and record its choice.
7. At turn completion: the wait returns `done`, followed by the recorded digest's `commands:`
   and `outside May change:` lines, then Claude prose (written): it will read the hand-off,
   review the diff and run the checks before committing.

Right, "Codex: fix-supervisor" (wider): the delegate as foreman sees it. A header row with a
`StateBadge` (surface `console`) that follows the recorded `state` events (`running`,
`waiting` while a question is pending, `done` once idle after a completed turn), the elapsed
run time in foreman's format (`formatElapsed`), and counters for commands (with failed count),
files written and tokens (`formatTokens` on input and output, from the latest recorded totals
you can reach at that point, or the final `run.tokens` once done; don't invent intermediate
token values if the fixture lacks them: in that case show tokens only once done). Below it,
a feed of the recorded events: commands with an exit mark (exit 0 in the `done` state color,
non-zero in `failed`, null as running), file writes as relative paths, Codex's messages,
the hook block, and the two questions highlighted in `signal`. The feed keeps roughly the
last 12 entries visible and scrolls within itself; long commands truncate to one line with
the full text available (title attribute is enough).

The replay clock: map run time to playback time piecewise, so long quiet stretches speed by,
and hold about 2.5 seconds of playback at each question, the answer and the completion so a
reader can read them. Put this mapping in `src/data/supervision.ts` as pure functions with
unit tests (monotonic, total close to 60s, holds at the marked moments). Not every one of the
417 events needs to appear: thin the command stream deterministically (for example the
commands around each marked moment plus an even sample elsewhere) while keeping every
message, question, hook block, file write and state change.

Controls in the frame's bar: Pause/Play and Replay buttons, and a short label such as
"replaying 70m30s in 1m". Playback starts when the console is on screen (the library's
playback gate) and fires `demo_replayed {id: "supervision"}` when the reader presses Replay.

Final state (no JS, reduced motion, and after playback): both panes show the whole story: the
left pane's full transcript, the right pane's header in its final state with the last entries
of the feed and the two questions visible. Below the frame, render `hero.consoleCaption` from
`src/data/landing.ts` as the caption.

Layout: at 1024px and up the panes sit side by side inside one console frame; below, they
stack, Claude first. Height is fixed at desktop (about 34rem) so the page doesn't jump while
playing. The frame follows `DESIGN.md` "Shape and depth" (the console shadow) and uses the
`console` tokens.

## Interface

- `src/data/supervision.ts`: `buildConsoleScript(run: Run): ConsoleScript` and the
  `ConsoleScript` type (you design its fields), plus the time-mapping helpers. Pure, no React.
- `src/components/landing/SupervisionConsole.tsx`: `SupervisionConsole({ script })`, rendered
  by `index.astro` as `<SupervisionConsole client:visible script={...} />`. Keep the export
  name and the `script` prop.

## Scope

- May change: `site/src/data/supervision.ts`, `site/src/data/supervision.test.ts`,
  `site/src/components/landing/SupervisionConsole.tsx`,
  `site/src/components/landing/SupervisionConsole.test.tsx`,
  `site/src/components/landing/console/` (new, for subcomponents if you need them).
- Must not change: everything else, including `index.astro`, `primitives.tsx`, `global.css`,
  `runs.ts`, `landing.ts` and `fixtures/`. If you need a primitive or token changed, say so in
  the hand-off with the exact change; if it blocks you, ask.
- Locked: none.

## Skills to apply

Find the newest installed Claude Code `claude-essentials` marketplace copy:

```sh
ce=$(ls -d "$HOME"/.claude/plugins/cache/*/ce/*/ | sort -V | tail -1)
```

Read the applicable skills; say in the hand-off where they changed your approach. The repo's
own rules win where they differ.

- `ce:writing-tests`: `${ce}skills/writing-tests/SKILL.md` for every test, including
  `references/waiting-typescript.md` for tests that wait on timers, and
  `references/flaky-tests.md` for isolation and repeat-run checks.
- `${ce}skills/design/SKILL.md` and `references/craft-tailwind.md`: craft rules for anything
  visual. `DESIGN.md` wins where they differ.
- `${ce}skills/architecting-systems/SKILL.md`: keep data shaping (pure, tested, in `src/data/`
  or `src/lib/`) separate from rendering.
- `${ce}skills/writer/SKILL.md`: any copy you write (captions, labels, empty states).

## Acceptance (every unit)

From `site/`, iterate until these pass:

```sh
bunx vitest run <your test files>
make lint
make check
make test
make build
```

Tests run in Vitest with happy-dom and Testing Library, through the component's real props
built from the real fixtures; drive time with fake timers or the library's test hooks, never
sleeps. Test the server-rendered final state (render to static markup) as well as the
interactive behaviour. Run each new test file three times on its own, then `make test` once.
Don't run `stacks verify` (the orchestrator does).

Then QA as the first user: run `make dev` (set `PORT_WEB` to a free port; `free-port 4400`
prints one), open the page with a real browser (Playwright from `node_modules` or the
`playwright-cli` skill if installed), and check your section at 1440px and 375px wide, with
motion on and with `prefers-reduced-motion: reduce`, and with JavaScript disabled. Save
screenshots to your review directory (below) and list them in the hand-off. Fix what looks
wrong against `DESIGN.md`. Stop the dev server when done.

## Do not

- Commit or push; leave changes for review.
- Disable lint, weaken a test, add a cast or suppress a type error to get green.
- Add features, options, abstractions or mechanisms the goal and acceptance do not need.
- Add a dependency; `@steamfield/ui`, React and Tailwind cover this.
- Edit `~/.codex` config, hooks, trust or auth.
- Mention any repository outside this one in a tracked file.

## Review before hand-off

Once acceptance checks pass, get one independent review in a fresh Codex process and resolve
its findings. Read `${ce}agents/code-reviewer.md`. There is no repo reviewer for `site/`.

Use separate simple commands and the file-writing tool, not a shell function, grouped command,
heredoc or generated shell script. Run from the worktree root:

```sh
mktemp -d
```

Keep the printed absolute directory as the review directory, outside the worktree. With the
file-writing tool, write `<review-directory>/prompt.md` containing, in this order:

1. The marketplace reviewer agent body without YAML frontmatter.
2. The applicable skill paths.
3. These task instructions and the full filled contract:

   "Review uncommitted changes and new files in {ABSOLUTE WORKTREE PATH} against base
   site/landing. Your sandbox is read-only; don't run tests or edit files. The author already
   ran the checks. Check the contract, site/DESIGN.md and site/AGENTS.md and report every real
   defect with a file:line reference."

Then run one plain command, replacing `{REVIEW DIR}` with that printed absolute path:

```sh
codex exec --ephemeral --sandbox read-only -m "gpt-astra" -c 'model_reasoning_effort="high"' -c 'service_tier="priority"' -o "{REVIEW DIR}/review.md" - < "{REVIEW DIR}/prompt.md"
```

Read the resulting `review.md`. Fix every finding or explain in the hand-off why it is wrong.
A bug finding gets a regression test before the fix. Rerun affected acceptance checks after
fixing. One independent review only. If the review cannot run, ask the orchestrator rather
than claiming it passed.

## Hand-off

Leave everything uncommitted and end with this report, naming files and symbols:

1. Summary: what you built, in two or three sentences.
2. Files: each file created or changed and why.
3. Decisions: choices left open, deviations and why, and where skills changed the approach.
4. Checks: each command and result with test counts; each new test file's three isolated runs
   and the full-suite result. QA: what you ran, the screenshot paths, what you changed.
5. Review: the review file's absolute path, each finding and its resolution or dispute.
6. Look closer at: assumptions, edge cases or tests the orchestrator should examine.
7. Open: unfinished work, blockers and questions.
foreman status site-console
run:       site-console  idle  20m28s  (gpt-astra, high, priority, write)
dir:       ~/.foreman/runs/site-console
worktree:  ~/src/foreman/.claude/worktrees/site-console
branch:    foreman/site-console (foreman-created, base 2ba8209483831f8b7fbbe811b104cf20a8aa6378)
turn:      1 (start)
question:  (none)
commands:  82 (8 failed, 0 blocked by repo hooks)
  last:    /bin/zsh -lc 'git diff --check && git status --short'  exit=0
files written:
  site/.astro/collections/blog.schema.json
  site/.astro/content-assets.mjs
  site/.astro/content-modules.mjs
  site/.astro/content.d.ts
  site/.astro/data-store.json
  site/.astro/settings.json
  site/.astro/types.d.ts
  site/src/components/landing/SupervisionConsole.test.tsx
  site/src/components/landing/SupervisionConsole.tsx
  site/src/components/landing/console/ConsoleText.tsx
  site/src/components/landing/console/EventFeed.tsx
  site/src/components/landing/console/Transcript.tsx
  site/src/data/supervision.test.ts
  site/src/data/supervision.ts
outside May change:  (none)
new in git status since start:
  M  site/src/components/landing/SupervisionConsole.tsx
  M  site/src/data/supervision.ts
  ?? site/src/components/landing/SupervisionConsole.test.tsx
  ?? site/src/components/landing/console/ConsoleText.tsx
  ?? site/src/components/landing/console/EventFeed.tsx
  ?? site/src/components/landing/console/Transcript.tsx
  ?? site/src/data/supervision.test.ts
tokens:    7.7M in (98% cached), 35.2K out

foreman checks every file Codex wrote against the contract's May change line and lists any strays under outside May change:. This is the delegate that built the replay at the top of this page; it stayed inside its list.

Questions from Codex

Codex asks through a tool call that foreman holds open. Claude's background wait returns with the question, and the held call resumes once Claude answers. Both questions below are copied from the fix-supervisor run.

  1. +20:21 · Codex asks q1

    O7's implemented policy omits persisted command output tails. The real smoke self-review succeeded (nested codex exec exit 0 and hand-off REVIEW-OK), but smoke/real-codex.test.ts:242 requires REVIEW-OK in outputTail. smoke/ is outside this unit's May change scope, blocking green acceptance. May I change only this assertion to require exitCode: 0 and outputTail: "" (the preceding assertion already verifies REVIEW-OK in the completed hand-off), then rerun smoke?

    +20:40 · answered by Claude · 19s later

    No: don't drop command output tails. Losing them makes foreman events useless exactly when a command fails. Use the conventional policy instead: keep the tails (and the stderr and raw capture you bound), but pass them through redaction of secret-looking values (reuse logging.ts's redaction rules: secret-like keys and token-shaped values such as sk-..., ghp_..., Bearer ..., long base64/hex blobs, KEY=value pairs whose key looks secret), and keep everything under the private 0700 home. Document the policy and its limits (redaction is best effort) in the RFC. Then the smoke assertion stays as it is. Add tests that a token-shaped value in command output is redacted in events.jsonl and codex.jsonl.
  2. +39:08 · repo hook refused a write

    hook-blocked
    BLOCKED: possible secret in the write to supervisor-integration.test.ts.
    
    Detected:
    - Private key (PEM)
    
    Read credentials from environment variables (document them in .env.example) or a secrets manager.
    If this is a deliberate fixture, ask the user, then mark the line with a "pragma: allowlist secret" comment.
    Never work around this block.

    +39:16 · Codex asks q2

    The required independent review found multiline PEM leakage in stderr redaction. The patch hook blocked a regression fixture containing only a PEM BEGIN/END marker around the literal synthetic payload 'short-private-key-payload'. The hook explicitly requires approval plus a 'pragma: allowlist secret' comment for deliberate fixtures. May I add this synthetic fixture with that pragma, then implement and verify line-aware PEM redaction?

    +54:16 · auto-answered by foreman after the timeout · 15m00s later

    No answer from the orchestrator. Proceed with your best judgment and note this question and your choice under Open in the hand-off.

Parallel runs

Each run gets its own worktree and branch, so independent tasks can run at the same time. One foreman wait --all watches every run in the repository and returns when any of them needs Claude.

Parallel release runs, measured from the earliest start
RunStartEndDurationCommands (failed)Files writtenOutput tokensQuestions asked
fix-cli+00:17+25:0324m46s180 (27 failed)2565.2KNone
fix-daemon+00:00+25:5925m59s232 (43 failed)1257.3KNone
fix-supervisor+00:03+1:10:3470m30s299 (34 failed)18174.8Kq1 at +20:25, q2 at +39:19
fix-worktrees+00:10+29:1229m01s186 (23 failed)1569.0KNone

The four delegates that fixed foreman's release blockers, started from the same commit within seconds of each other. Each owned a different set of files.

Base commit 39aec16 · foreman wait --all

Commands

Claude runs these through its shell tool, and every one takes --json for a single machine-readable result. The output is recorded from real runs, including the ones that built this page.

Command captions are written for this page. Console output is recorded.

Recorded: start --wait
foreman start site-scaffold --new-worktree --setup "bun install && cd site && bun install" --contract site-scaffold.md --write --model gpt-sol --wait
site-scaffold
~/.foreman/runs/site-scaffold
worktree: ~/src/foreman/.claude/worktrees/site-scaffold
branch: foreman/site-scaffold
done        site-scaffold turn 1

run:       site-scaffold  idle  22m32s  (gpt-sol, high, priority, write)
dir:       ~/.foreman/runs/site-scaffold
worktree:  ~/src/foreman/.claude/worktrees/site-scaffold
branch:    foreman/site-scaffold (foreman-created, base aef7e30c8438e7eeddac7099008c6e0fb51b429f)
turn:      1 (start)
question:  (none)
commands:  169 (24 failed, 0 blocked by repo hooks)
  last:    /bin/zsh -lc 'on-port 4323'  exit=1
files written:
  site/.astro/collections/blog.schema.json
  site/.astro/content-assets.mjs
  site/.astro/content-modules.mjs
  site/.astro/content.d.ts
  site/.astro/data-store.json
  site/.astro/settings.json
  site/.astro/types.d.ts
  site/.claude/README.md
  site/.env.example
  site/.gitignore
  site/.node-version
  site/.stacks/NOTES.md
  site/.stacks/state/.playwright-cli/page-2026-11-06T09-16-38-026Z.yml
  site/.stacks/state/.playwright-cli/page-2026-11-06T09-16-44-815Z.yml
  site/.stacks/state/playwright-qa/console-2026-11-06T09-03-52-977Z.log
  site/.stacks/state/playwright-qa/page-2026-11-06T09-03-53-075Z.yml
  site/.stacks/state/playwright-qa/page-2026-11-06T09-05-31-225Z.yml
  site/.stacks/state/playwright-qa/page-2026-11-06T09-05-51-816Z.yml
  site/.stacks/state/playwright-qa/page-2026-11-06T09-06-05-382Z.yml
  site/.stacks/state/playwright-qa/page-2026-11-06T09-06-05-767Z.yml
  site/.stacks/state/playwright-qa/page-2026-11-06T09-06-19-312Z.yml
  site/.stacks/state/runs.jsonl
  site/AGENTS.md
  site/Makefile
  site/README.md
  site/astro.config.mjs
  site/bun.lock
  site/docs/DEVELOPMENT.md
  site/package.json
  site/public/default-og.svg
  site/src/components/PostList.tsx
  site/src/components/posts.test.tsx
  site/src/config.ts
  site/src/content/blog/welcome.mdx
  site/src/layouts/BaseLayout.astro
  site/src/layouts/PostLayout.astro
  site/src/lib/analytics.test.ts
  site/src/lib/analytics.ts
  site/src/lib/events.ts
  site/src/pages/404.astro
  site/src/pages/blog/[...slug].astro
  site/src/pages/blog/index.astro
  site/src/pages/blog/rss.xml.ts
  site/src/pages/index.astro
  site/src/styles/global.css
  site/src/styles/sf-theme.css
  site/tests/build.test.mjs
  site/tests/deploy.test.mjs
  site/vitest.config.ts
  site/wrangler.jsonc
outside May change:  (none)
new in git status since start:
  D  site/src/pages/[...slug].astro
  D  site/src/pages/rss.xml.ts
  M  site/.claude/README.md
  M  site/.env.example
  M  site/.gitignore
  M  site/AGENTS.md
  M  site/Makefile
  M  site/README.md
  M  site/astro.config.mjs
  M  site/docs/DEVELOPMENT.md
  M  site/package.json
  M  site/public/default-og.svg
  M  site/src/components/PostList.tsx
  M  site/src/components/posts.test.tsx
  M  site/src/config.ts
  M  site/src/content/blog/welcome.mdx
  M  site/src/layouts/BaseLayout.astro
  M  site/src/layouts/PostLayout.astro
  M  site/src/lib/analytics.test.ts
  M  site/src/lib/analytics.ts
  M  site/src/lib/events.ts
  M  site/src/pages/404.astro
  M  site/src/pages/index.astro
  M  site/src/styles/global.css
  M  site/tests/build.test.mjs
  M  site/tests/deploy.test.mjs
  M  site/vitest.config.ts
  M  site/wrangler.jsonc
  ?? site/.node-version
  ?? site/bun.lock
  ?? site/src/pages/blog/[...slug].astro
  ?? site/src/pages/blog/index.astro
  ?? site/src/pages/blog/rss.xml.ts
  ?? site/src/styles/sf-theme.css
tokens:    17.1M in (99% cached), 53K out

Hand-off (turn 1):
1. **Summary**

The site foundation is green. Dependencies, shared UI styles, consent analytics, blog relocation, and Pages configuration are ready; `/` remains a placeholder. Changes are uncommitted, confined to `site/`, and nothing was pushed or deployed.

2. **Files**

All paths below are relative to `site/`.

| Files | Change |
|---|---|
| `package.json`, `bun.lock`, `.node-version` | Installed dependencies and recorded Bun/Node versions. |
| `.env.example`, `.gitignore` | Documented analytics variables; ignored Wrangler output. |
| `AGENTS.md`, `README.md`, `docs/DEVELOPMENT.md` | Filled setup, publishing, analytics, deployment, and workaround guidance. |
| `.claude/README.md` | Removed the remaining scaffold marker. |
| `Makefile`, `wrangler.jsonc` | Added deployment targets, credential checks, and compatibility date. |
| `astro.config.mjs`, `src/config.ts` | Production URL, blog sitemap paths, metadata, and one syntax theme. |
| `public/default-og.svg` | Replaced scaffold branding with foreman. |
| `src/pages/index.astro`, `src/pages/404.astro` | Placeholder landing page and home recovery link. |
| `src/pages/blog/index.astro` | Moved the blog listing under `/blog`. |
| `src/pages/[...slug].astro` → `src/pages/blog/[...slug].astro` | Relocated post routes and `getStaticPaths`. |
| `src/pages/rss.xml.ts` → `src/pages/blog/rss.xml.ts` | Relocated RSS `GET` and post links. |
| `src/content/blog/welcome.mdx` | Marked the welcome post draft. |
| `src/components/PostList.tsx`, `src/components/posts.test.tsx` | Updated and tested `/blog/<slug>` links. |
| `src/layouts/BaseLayout.astro`, `src/layouts/PostLayout.astro` | Shared consent banner, footer privacy link, metadata, and single-theme prose. |
| `src/styles/global.css`, `src/styles/sf-theme.css` | Shared UI imports, layer ordering, and marked placeholder tokens. |
| `src/lib/events.ts` | Declared the four typed event/property contracts. |
| `src/lib/analytics.ts` | Implemented `applyConsent`, site stamping, withdrawal cleanup, restoration handling, and Logs exclusion. |
| `src/lib/analytics.test.ts`, `vitest.config.ts` | Real SDK offline coverage, including remote console capture and cached-page restoration. |
| `tests/build.test.mjs` | Empty-production assertions, preserved publishing coverage, and env-aware `assertAnalyticsBundle`. |
| `tests/deploy.test.mjs` | Updated Pages routes, redirects, draft exclusion, and feed caching checks. |

Local findings and QA notes are in ignored `site/.stacks/NOTES.md`. The manifest and protected design/product/fixture paths were untouched.

3. **Decisions**

Applied the contract’s decisions. `/blog` is canonical under `trailingSlash: "never"`; Pages redirects `/blog/`, while Astro dev displays its trailing-slash diagnostic.

Documented three dependency workarounds: TypeScript 6 for checker compatibility, matching `@emnapi/runtime`, and PostHog’s session-storage cleanup/internal Logs override. Fonts are installed but unwired; theme tokens remain placeholders.

4. **Checks**

| Command | Final result |
|---|---|
| `make install`, `CI=1 make install` | Passed, including frozen lockfile. |
| `make lint` | Passed. |
| `make check` | Passed: 0 errors, warnings, or hints. |
| `make test` | Passed: 22 tests across 5 files. |
| `make coverage` | Passed: 80% statements, 81.17% lines. |
| `make build` | Passed: 5 build assertions. |
| `PUBLIC_POSTHOG_KEY=phc_test make build` | Passed; analytics/banner code present. |
| `PUBLIC_POSTHOG_KEY= make build` | Passed; analytics/banner JavaScript absent. |
| `make deploy-check` | Passed: 5 build and 5 Pages assertions. |
| `PORT_WEB=4323 stacks verify` | **Green: 12 passed, 0 failed, 0 skipped; 17.1s.** |
| `git diff --check` | Passed. |

Changed test files each passed three isolated runs: analytics 10 tests, components 3, build 5, deployment 5. The full suite passed afterward.

Also exercised `make help`, `make format`, `make clean`, `make new-article`, and `make preview`. Both manual deploy targets correctly refused missing credentials with expected exit 2.

Browser QA covered `/`, `/blog/`, canonical `/blog`, a missing URL, the dev-only welcome draft, and its hydrated read toggle. Keyed production showed the shared banner; Accept/Decline persisted across reloads. Production excludes post pages and lists only `/` in the sitemap. All QA servers are stopped.

5. **Review**

Report: [review.md](/tmp/scratch).

The single independent review reported three findings, all reproduced and resolved:

- Remote console capture bypassed `before_send`: disabled Logs and added remote-config coverage.
- Cached consent survived sibling withdrawal: added live consent gating and persisted-`pageshow` cleanup.
- Build assertions ignored env files: switched to Vite production env precedence and tested a keyed `.env.production` build.

Affected checks were rerun. No second review was performed.

6. **Look closer at**

The PostHog internal extension override and session-storage key cleanup deserve attention during SDK upgrades. Live recordings were not sent; SDK tests and browser analytics requests stayed offline. The scaffold still has no favicon.

7. **Open**

No foundation blockers or unanswered questions. External setup remains: connect Pages and the custom domain, configure the shared PostHog key, and enable cookieless tracking. Landing design, final tokens, font imports, and event callers remain with the orchestrator.

cursor: eyJfdGFnIjoiR3JvdXBDdXJzb3IiLCJncm91cCI6In4vc3JjL2ZvcmVtYW4iLCJwb3NpdGlvbnMiOnsic2l0ZS1zY2FmZm9sZCI6eyJpZGVudGl0eSI6IjIwMjYtMTEtMDZUMDg6NTY6MzMuMzQ2WjowMWExYjAxMi1mMzU5LTdjOTMtODhkYS0wYzIwYzFmZjRmNGEiLCJzZXEiOjE2OTF9fX0
next: foreman wait site-scaffold --after eyJfdGFnIjoiR3JvdXBDdXJzb3IiLCJncm91cCI6In4vc3JjL2ZvcmVtYW4iLCJwb3NpdGlvbnMiOnsic2l0ZS1zY2FmZm9sZCI6eyJpZGVudGl0eSI6IjIwMjYtMTEtMDZUMDg6NTY6MzMuMzQ2WjowMWExYjAxMi1mMzU5LTdjOTMtODhkYS0wYzIwYzFmZjRmNGEiLCJzZXEiOjE2OTF9fX0
Recorded: wait --all
foreman wait --all --after eyJfdGFnIjoiR3JvdXBDdXJzb3IiLCJncm91cCI6In4vc3JjL2ZvcmVtYW4iLCJwb3NpdGlvbnMiOnsiZml4LWNsaSI6eyJpZGVudGl0e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ZS1ldmlkZW5jZSI6eyJpZGVudGl0eSI6IjIwMjYtMTEtMDZUMDk6MjQ6MjIuNzY3WjowMWExYjAyYy02Yzc3LTcyMDMtYWU1Yy04NGVkYjk4YzY1ODkiLCJzZXEiOjQzfSwic2l0ZS1jb21tYW5kcyI6eyJpZGVudGl0eSI6IjIwMjYtMTEtMDZUMDk6MjQ6MjUuNTI2WjowMWExYjAyYy03NzNjLTdmYzItOWJiOS02YzgwZTgyMjQ1NmEiLCJzZXEiOjU0fX19 --timeout 9m
Recorded: answer
foreman answer site-commands q1 "Your test is right and the page copy is wrong. Change the npx option in site/src/data/landing.ts to exactly \"npx @steamfield/foreman\" (I made the same one-line change on the base branch, so the hunks will match at merge). You may edit that one line of landing.ts; nothing else in it. Keep the strict comparison."
ok
next: foreman wait --all --after eyJfdGFnIjoiR3JvdXBDdXJzb3IiLCJncm91cCI6In4vc3JjL2ZvcmVtYW4iLCJwb3NpdGlvbnMiOnsiZml4LWNsaSI6eyJpZGVudGl0eSI6IjIwMjYtMTEtMDZUMDM6Mzk6NTMuMTg1WjowMWExYWVmMS0wN2YwLTcwODAtOGM1MS0wOGQ1ZDdhZTMwMDQiLCJzZXEiOjMzNTh9LCJmaXgtZGFlbW9uIjp7ImlkZW50aXR5IjoiMjAyNi0xMS0wNlQwMzozOTozNS45NDNaOjAxYTFhZWYwLWM0OTctNzUxMi1hZjYwLWNlMmZjODk0MjcyZiIsInNlcSI6Mzk0N30sImZpeC1zdXBlcnZpc29yIjp7ImlkZW50aXR5IjoiMjAyNi0xMS0wNlQwMzozOTozOS40OTFaOjAxYTFhZWYwLWQyNmMtNzBiMi1iYWMxLWU1NTBhNzk0MDc5YyIsInNlcSI6MjMxOH0sImZpeC13b3JrdHJlZXMiOnsiaWRlbnRpdHkiOiIyMDI2LTExLTA2VDAzOjM5OjQ2LjQxMFo6MDFhMWFlZjAtZWQ3OS03NDcyLWI4MDUtMTY5YjJiZTUwYzQ3Iiwic2VxIjozMjY2fSwic2l0ZS1jb25zb2xlIjp7ImlkZW50aXR5IjoiMjAyNi0xMS0wNlQwOToyNDoxOS4xMjVaOjAxYTFiMDJjLTVlM2UtNzEwMi1iMzZiLTBkMTI1YTY0NGRkNyIsInNlcSI6MzB9LCJzaXRlLWxpZmVjeWNsZSI6eyJpZGVudGl0eSI6IjIwMjYtMTEtMDZUMDk6MjQ6MjAuMjM5WjowMWExYjAyYy02MjlhLTcwMjEtOWIxMy1lYTAzMTdlNjM1NGIiLCJzZXEiOjI4fSwic2l0ZS1ldmlkZW5jZSI6eyJpZGVudGl0eSI6IjIwMjYtMTEtMDZUMDk6MjQ6MjIuNzY3WjowMWExYjAyYy02Yzc3LTcyMDMtYWU1Yy04NGVkYjk4YzY1ODkiLCJzZXEiOjIyfSwic2l0ZS1jb21tYW5kcyI6eyJpZGVudGl0eSI6IjIwMjYtMTEtMDZUMDk6MjQ6MjUuNTI2WjowMWExYjAyYy03NzNjLTdmYzItOWJiOS02YzgwZTgyMjQ1NmEiLCJzZXEiOjI5fX19
Recorded: status
foreman status
fix-cli  idle  turn 1 (start)  24m46s
fix-daemon  idle  turn 1 (start)  25m59s
fix-supervisor  idle  turn 1 (start)  70m30s
fix-worktrees  idle  turn 1 (start)  29m01s
site-scaffold  running  turn 1 (start)  3m09s
Recorded: result
foreman result site-scaffold
run:       site-scaffold  idle  22m32s  (gpt-sol, high, priority, write)
dir:       ~/.foreman/runs/site-scaffold
worktree:  ~/src/foreman/.claude/worktrees/site-scaffold
branch:    foreman/site-scaffold (foreman-created, base aef7e30c8438e7eeddac7099008c6e0fb51b429f)
turn:      1 (start)
question:  (none)
commands:  169 (24 failed, 0 blocked by repo hooks)
  last:    /bin/zsh -lc 'on-port 4323'  exit=1
files written:
  site/.astro/collections/blog.schema.json
  site/.astro/content-assets.mjs
  site/.astro/content-modules.mjs
  site/.astro/content.d.ts
  site/.astro/data-store.json
  site/.astro/settings.json
  site/.astro/types.d.ts
  site/.claude/README.md
  site/.env.example
  site/.gitignore
  site/.node-version
  site/.stacks/NOTES.md
  site/.stacks/state/.playwright-cli/page-2026-11-06T09-16-38-026Z.yml
  site/.stacks/state/.playwright-cli/page-2026-11-06T09-16-44-815Z.yml
  site/.stacks/state/playwright-qa/console-2026-11-06T09-03-52-977Z.log
  site/.stacks/state/playwright-qa/page-2026-11-06T09-03-53-075Z.yml
  site/.stacks/state/playwright-qa/page-2026-11-06T09-05-31-225Z.yml
  site/.stacks/state/playwright-qa/page-2026-11-06T09-05-51-816Z.yml
  site/.stacks/state/playwright-qa/page-2026-11-06T09-06-05-382Z.yml
  site/.stacks/state/playwright-qa/page-2026-11-06T09-06-05-767Z.yml
  site/.stacks/state/playwright-qa/page-2026-11-06T09-06-19-312Z.yml
  site/.stacks/state/runs.jsonl
  site/AGENTS.md
  site/Makefile
  site/README.md
  site/astro.config.mjs
  site/bun.lock
  site/docs/DEVELOPMENT.md
  site/package.json
  site/public/default-og.svg
  site/src/components/PostList.tsx
  site/src/components/posts.test.tsx
  site/src/config.ts
  site/src/content/blog/welcome.mdx
  site/src/layouts/BaseLayout.astro
  site/src/layouts/PostLayout.astro
  site/src/lib/analytics.test.ts
  site/src/lib/analytics.ts
  site/src/lib/events.ts
  site/src/pages/404.astro
  site/src/pages/blog/[...slug].astro
  site/src/pages/blog/index.astro
  site/src/pages/blog/rss.xml.ts
  site/src/pages/index.astro
  site/src/styles/global.css
  site/src/styles/sf-theme.css
  site/tests/build.test.mjs
  site/tests/deploy.test.mjs
  site/vitest.config.ts
  site/wrangler.jsonc
outside May change:  (none)
new in git status since start:
  D  site/src/pages/[...slug].astro
  D  site/src/pages/rss.xml.ts
  M  site/.claude/README.md
  M  site/.env.example
  M  site/.gitignore
  M  site/AGENTS.md
  M  site/Makefile
  M  site/README.md
  M  site/astro.config.mjs
  M  site/docs/DEVELOPMENT.md
  M  site/package.json
  M  site/public/default-og.svg
  M  site/src/components/PostList.tsx
  M  site/src/components/posts.test.tsx
  M  site/src/config.ts
  M  site/src/content/blog/welcome.mdx
  M  site/src/layouts/BaseLayout.astro
  M  site/src/layouts/PostLayout.astro
  M  site/src/lib/analytics.test.ts
  M  site/src/lib/analytics.ts
  M  site/src/lib/events.ts
  M  site/src/pages/404.astro
  M  site/src/pages/index.astro
  M  site/src/styles/global.css
  M  site/tests/build.test.mjs
  M  site/tests/deploy.test.mjs
  M  site/vitest.config.ts
  M  site/wrangler.jsonc
  ?? site/.node-version
  ?? site/bun.lock
  ?? site/src/pages/blog/[...slug].astro
  ?? site/src/pages/blog/index.astro
  ?? site/src/pages/blog/rss.xml.ts
  ?? site/src/styles/sf-theme.css
tokens:    17.1M in (99% cached), 53K out

Hand-off (turn 1):
1. **Summary**

The site foundation is green. Dependencies, shared UI styles, consent analytics, blog relocation, and Pages configuration are ready; `/` remains a placeholder. Changes are uncommitted, confined to `site/`, and nothing was pushed or deployed.

2. **Files**

All paths below are relative to `site/`.

| Files | Change |
|---|---|
| `package.json`, `bun.lock`, `.node-version` | Installed dependencies and recorded Bun/Node versions. |
| `.env.example`, `.gitignore` | Documented analytics variables; ignored Wrangler output. |
| `AGENTS.md`, `README.md`, `docs/DEVELOPMENT.md` | Filled setup, publishing, analytics, deployment, and workaround guidance. |
| `.claude/README.md` | Removed the remaining scaffold marker. |
| `Makefile`, `wrangler.jsonc` | Added deployment targets, credential checks, and compatibility date. |
| `astro.config.mjs`, `src/config.ts` | Production URL, blog sitemap paths, metadata, and one syntax theme. |
| `public/default-og.svg` | Replaced scaffold branding with foreman. |
| `src/pages/index.astro`, `src/pages/404.astro` | Placeholder landing page and home recovery link. |
| `src/pages/blog/index.astro` | Moved the blog listing under `/blog`. |
| `src/pages/[...slug].astro` → `src/pages/blog/[...slug].astro` | Relocated post routes and `getStaticPaths`. |
| `src/pages/rss.xml.ts` → `src/pages/blog/rss.xml.ts` | Relocated RSS `GET` and post links. |
| `src/content/blog/welcome.mdx` | Marked the welcome post draft. |
| `src/components/PostList.tsx`, `src/components/posts.test.tsx` | Updated and tested `/blog/<slug>` links. |
| `src/layouts/BaseLayout.astro`, `src/layouts/PostLayout.astro` | Shared consent banner, footer privacy link, metadata, and single-theme prose. |
| `src/styles/global.css`, `src/styles/sf-theme.css` | Shared UI imports, layer ordering, and marked placeholder tokens. |
| `src/lib/events.ts` | Declared the four typed event/property contracts. |
| `src/lib/analytics.ts` | Implemented `applyConsent`, site stamping, withdrawal cleanup, restoration handling, and Logs exclusion. |
| `src/lib/analytics.test.ts`, `vitest.config.ts` | Real SDK offline coverage, including remote console capture and cached-page restoration. |
| `tests/build.test.mjs` | Empty-production assertions, preserved publishing coverage, and env-aware `assertAnalyticsBundle`. |
| `tests/deploy.test.mjs` | Updated Pages routes, redirects, draft exclusion, and feed caching checks. |

Local findings and QA notes are in ignored `site/.stacks/NOTES.md`. The manifest and protected design/product/fixture paths were untouched.

3. **Decisions**

Applied the contract’s decisions. `/blog` is canonical under `trailingSlash: "never"`; Pages redirects `/blog/`, while Astro dev displays its trailing-slash diagnostic.

Documented three dependency workarounds: TypeScript 6 for checker compatibility, matching `@emnapi/runtime`, and PostHog’s session-storage cleanup/internal Logs override. Fonts are installed but unwired; theme tokens remain placeholders.

4. **Checks**

| Command | Final result |
|---|---|
| `make install`, `CI=1 make install` | Passed, including frozen lockfile. |
| `make lint` | Passed. |
| `make check` | Passed: 0 errors, warnings, or hints. |
| `make test` | Passed: 22 tests across 5 files. |
| `make coverage` | Passed: 80% statements, 81.17% lines. |
| `make build` | Passed: 5 build assertions. |
| `PUBLIC_POSTHOG_KEY=phc_test make build` | Passed; analytics/banner code present. |
| `PUBLIC_POSTHOG_KEY= make build` | Passed; analytics/banner JavaScript absent. |
| `make deploy-check` | Passed: 5 build and 5 Pages assertions. |
| `PORT_WEB=4323 stacks verify` | **Green: 12 passed, 0 failed, 0 skipped; 17.1s.** |
| `git diff --check` | Passed. |

Changed test files each passed three isolated runs: analytics 10 tests, components 3, build 5, deployment 5. The full suite passed afterward.

Also exercised `make help`, `make format`, `make clean`, `make new-article`, and `make preview`. Both manual deploy targets correctly refused missing credentials with expected exit 2.

Browser QA covered `/`, `/blog/`, canonical `/blog`, a missing URL, the dev-only welcome draft, and its hydrated read toggle. Keyed production showed the shared banner; Accept/Decline persisted across reloads. Production excludes post pages and lists only `/` in the sitemap. All QA servers are stopped.

5. **Review**

Report: [review.md](/tmp/scratch).

The single independent review reported three findings, all reproduced and resolved:

- Remote console capture bypassed `before_send`: disabled Logs and added remote-config coverage.
- Cached consent survived sibling withdrawal: added live consent gating and persisted-`pageshow` cleanup.
- Build assertions ignored env files: switched to Vite production env precedence and tested a keyed `.env.production` build.

Affected checks were rerun. No second review was performed.

6. **Look closer at**

The PostHog internal extension override and session-storage key cleanup deserve attention during SDK upgrades. Live recordings were not sent; SDK tests and browser analytics requests stayed offline. The scaffold still has no favicon.

7. **Open**

No foundation blockers or unanswered questions. External setup remains: connect Pages and the custom domain, configure the shared PostHog key, and enable cookieless tracking. Landing design, final tokens, font imports, and event callers remain with the orchestrator.
Recorded: archive
foreman archive site-scaffold
~/.foreman/runs/.archive/site-scaffold-1793956815386
Recorded: doctor
foreman doctor
foreman 0.1.0 (darwin, compiled: true)
foreman on PATH is this binary: true
Codex executable: codex
Config: ok
Config file: ~/.foreman/config.json
Home: ~/.foreman
Codex: 0.166.0
Protocol matches: true
Logged in: true
Repo hooks:
  pre_tool_use:0:0  trusted
  pre_tool_use:1:0  trusted
  foreman start will accept runs here (hook trust).
Daemon: running 0.1.0 (pid 80808)
Daemon build: 3f15d9857eb70c7211b0d6273ad35cfcdaf7f85b1180de0b8d5d57b6c7c6ce57
Daemon build matches this CLI: true

Safeguards

foreman's guardrails
GuardrailWhat foreman does
Read-only by defaultCodex can't write files unless the run is started with --write.
One worktree per run--new-worktree creates .claude/worktrees/<name> on branch foreman/<name>; your checkout is untouched.
Repo hooks must be trustedIf the repo has .codex/hooks.json, start refuses until those hooks are trusted in Codex. foreman never approves hooks itself.
No commits, no mergesChanges stay uncommitted in the worktree until Claude reviews them. foreman never commits or merges.
Archive keeps unmerged workforeman archive removes a worktree only when it holds no uncommitted files and its branch is merged or unchanged.
Your ChatGPT login, no API keysforeman uses the Codex CLI's login and never passes API key variables from your environment to Codex.
Budgets and timeoutsA turn's budget defaults to 60 minutes. An unanswered question times out after 15 minutes and Codex continues with independent work, lists the decision under Open and avoids irreversible steps on it.
Private stateRun records live under ~/.foreman, which the daemon restricts to your user (mode 0700).

Output for agents

Every result ends with a next: line naming the command to run next. Its cursor means Claude never sees the same event twice.

Wait outcomes

foreman wait outcomes
OutcomeMeaning
eventsAttention: question, done, failed, interrupted or lost, with a digest for each reported run
timeoutNo new attention before the deadline; continue with the printed command
none--all has no active runs or unseen attention in the group

Exit codes

foreman exit codes
CodeMeaning
0Success, including wait outcomes and doctor with unavailable probes
1Internal error
2Invalid command, arguments or input file
3Invalid configuration
4Daemon unavailable
5Codex unavailable
6Permission denied, including input files, run data, repo hooks, or daemon sockets
7Run or question not found
8Run conflict, including unreadable or unsupported run data
9Invalid worktree or missing dependencies
10Repo hook trust not confirmed
130Interrupted CLI invocation

Install

npm i -g @steamfield/foreman
bun add -g @steamfield/foreman
npx @steamfield/foreman

Once per repository

Run foreman skill install for the agent entry point, then foreman guide for the workflow. In the main checkout, open Codex and trust the project. If the repo has .codex/hooks.json, run /hooks in Codex and approve them. Then check:

foreman doctor
foreman 0.1.0 (darwin, compiled: true)
foreman on PATH is this binary: true
Codex executable: codex
Config: ok
Config file: ~/.foreman/config.json
Home: ~/.foreman
Codex: 0.166.0
Protocol matches: true
Logged in: true
Repo hooks:
  pre_tool_use:0:0  trusted
  pre_tool_use:1:0  trusted
  foreman start will accept runs here (hook trust).
Daemon: running 0.1.0 (pid 80808)
Daemon build: 3f15d9857eb70c7211b0d6273ad35cfcdaf7f85b1180de0b8d5d57b6c7c6ce57
Daemon build matches this CLI: true

What you need

  • macOS or Linux, on arm64 or x64
  • git, and Node 26 or newer for the npm launcher
  • Codex CLI 0.166.0, signed in with codex login
  • A git repository with at least one commit