|
| 1 | +# codehands-runner |
| 2 | + |
| 3 | +Given a repo and a prompt, the runner makes a private copy of the repo (a git worktree on a new branch). It runs Claude Code or Codex there with no screen and turns their output into events. Someone can then stop, resume, approve or reject the change. |
| 4 | + |
| 5 | +Owner: Tahira · Consumed by: the daemon in `codehands-cli` (Midhat) · Contract: [`codehands-contracts`](../codehands-contracts) |
| 6 | + |
| 7 | +## Layout |
| 8 | + |
| 9 | +| Path | What | When | |
| 10 | +| --- | --- | --- | |
| 11 | +| `src/fake-runner.ts` | Stand-in that emits 12 events, 300 ms apart. Midhat plugs it in today. Also the demo backup | Mon, done | |
| 12 | +| `src/session-store.ts` | Session records and the legal state moves | Mon, done | |
| 13 | +| `src/events.ts` | `seq` 1, 2, 3 … per session | Mon, done | |
| 14 | +| `src/agents/claude-code.ts` | `claude -p` arguments, done. Stream-json line → events, to do | Tue | |
| 15 | +| `src/git/worktree.ts` | Branch names, done. Worktree add, remove and prune, to do | Tue, Wed | |
| 16 | +| `src/runner.ts` | `start`, then `diff`, `approve`, `reject`, `stop`, then `resume` | Tue to Thu | |
| 17 | +| `src/git/diff.ts` | `git add -A`, `diff --cached --binary`, commit | Wed | |
| 18 | +| `src/process/kill-tree.ts` | Stop politely, then kill the whole process tree | Wed | |
| 19 | +| `src/agents/codex.ts` | `codex exec --json` → events | Thu pm, Fri | |
| 20 | +| `src/memory/notes.ts` | Per-repo notes in, a summary appended after each run | Fri | |
| 21 | +| `scripts/spike.sh` | Monday's hand spike, saves `test/fixtures/spike-1.jsonl` | Mon | |
| 22 | +| `scripts/reset-fixture.sh` | Puts the fixture repo back to its starting state before a rehearsal | Wed night | |
| 23 | + |
| 24 | +## Run it |
| 25 | + |
| 26 | +Clone `codehands-contracts` next to this repo and build it first: |
| 27 | + |
| 28 | +```bash |
| 29 | +cd ../codehands-contracts && pnpm install && pnpm build |
| 30 | +cd ../codehands-runner && pnpm install |
| 31 | +pnpm test # parser tests replay recorded JSONL, no API cost |
| 32 | +pnpm fake # print the fake runner's events |
| 33 | +``` |
| 34 | + |
| 35 | +Add the runtime dependencies when you start on Tuesday: `pnpm add execa tree-kill`. |
| 36 | + |
| 37 | +## Rules this week |
| 38 | + |
| 39 | +- Only run on our own repos. There is no sandbox until week 2. |
| 40 | +- `acceptEdits` plus a short `--allowedTools` list. Never use `--dangerously-skip-permissions`. Always pass `--max-budget-usd`. |
| 41 | +- API keys never go into events, logs or the diff. |
| 42 | + |
| 43 | +The full week is in `codehands-docs/weeks/week-1/tahira.md`. |
0 commit comments