Repository navigation
Description
Parent
Ticket HR1 of spec #2427 (0.1.2). This is the contract-first ticket: the harness-row contract, the driver's row loader and the kit check for rows, so nine rows can build in parallel without sharing a file. Size: L.
What to build
1. The contract, adapters/local/harness-row.md. Write it as the spec's Implementation Decisions set it, word for word where they fix a rule. It covers:
- The row: the fields
harness,program,start,wake,session,modes,env,loginanddaemon. A placeholder ({prompt},{model},{session},{mode}) fills a whole argument, and{mode}splices that mode's fixed arguments.wakemust hold{session}. Session ids match[A-Za-z0-9._:-]{1,100}. - The row folder:
row.json,fake,README.md(opening with where the login lives), an optionaltest_row.py, andevidence/. - The merge gate: a row merges after its live 5-of-5.
2. The driver (adapters/local/driver). Claude and codex stay built in, and their behaviour doesn't change. For any other harness, start reads harnesses/<harness>/row.json. A row that is missing, has a repeated key or breaks the contract is a D3 error that names the row file, never its contents.
- Chosen session id: the driver makes the UUID before the first turn and saves it.
- Reported session id: the driver reads it from the run's log once the turn has printed it, then saves it. When it isn't there yet, wake refuses and starts nothing.
- What a turn gets: the row's
envis added to the turn's environment, and only the approved mode's arguments are passed. - What stays the same: stop, the approvals, the fleet.md rows, the first-turn watch and the credential check.
- The errors: the "use one of" error lists the built-ins plus the row folders.
3. The fake library, adapters/local/fixtures/fake_cli.py. A row's fake parses its own CLI's command line and calls the library. The library does the rest, as fixtures/fake-harness does today:
- posts and edits the builder note in
KIT_TRACKER; - detaches a worker and waits to be stopped;
- records each turn's session id;
- prints the session id when the row reports it;
- when told to, starts a double-forked background process that stands in for a CLI's service.
4. The runner, adapters/local/test_harnesses.py. For every folder in adapters/local/harnesses/, or in --rows <dir> for its own tests, it does these, then runs the row's test_row.py if there is one:
- checks the contract;
- runs
kernel/driver-kit/kit.pywith--trackeragainst the driver, with the row'sfakeonPATHunderprogramand the fakegh; - requires the five pass lines;
- requires wake's session id to equal start's;
- requires
envvalues to pass the kit'sholds_credential; - requires the background process, when one is declared, to have ended after stop.
5. Planted rows, adapters/local/fixtures/rows/. One good example row, plus each bad row the spec's Seam 1 names, with the exact line each must fail on.
7. Effort, a first-class setting like the model (J318). Each row must take exactly one of two forms:
- It passes the user's effort to the CLI: an
effortobject maps each effort value the user may set (as driver v1's comingeffortstart field names them, spec 0.1.2 spec: Effort everywhere: every driver passes the user's effort, or says plainly it can't #2471) to the fixed arguments it adds where an{effort}placeholder sits, or to the fixedenvsetting it makes. It names the exact flag or setting. - The host can't set effort:
"effort": "none: <one line why, naming the primary source>".
Both the row file and its README say which form it is. {effort} may appear in start only, or in both start and wake, because some CLIs refuse an effort flag on resume. A row must not claim an effort value that its CLI silently ignores for some models: it either checks the model first or declares none for that case. An effort flag that needs another flag with it, such as a model, keeps both in the same row's argument list.
The driver builds the effort arguments with the row's argument builder. When a start carries an effort, the effort reaches the CLI. When the row has none, or doesn't list that value, the start is a D3 refusal that starts nothing, and its next is exactly this host can't set effort: remove the effort for this harness in your Models table or Roster to run it at the host's default (the planner's J318 wording, shared with #2471). A start with an effort never falls back to a default. The effort start field itself is added to driver v1, the schema and version's can list by #2471. Until then, build this so it is wired and tested below the start field: the {effort} placeholder, the refusal, and a function that turns a row plus a request into the turn's command line and environment. #2471's local-driver work then only turns the field on. No per-row note goes in version, because its schema is fixed. The local driver lists effort in can (claude and codex take it), and each row's README has one table line, Effort: none or the exact flag or setting. That line is the hook #2471's local-driver ticket (EF4) reads: name it in harness-row.md. A none row's start gets the exact D3 refusal above. Match #2471's field name and values once its contract is posted.
The runner checks every row:
- A row that claims effort: for each listed value, the user's value reaches the fake CLI's argument list or its environment. The fake records both.
- A row that can't set effort: its row and README say so, and a request with an effort is refused.
The planted rows add one row that claims effort but whose {effort} never reaches the command line, and one row with no effort form at all.
8. Signed out, per row (planner ruling). There are two optional, data-only fields:
signed_out: fixed, case-insensitive patterns that mean the CLI isn't signed in, matched anywhere in a log line, including inside a JSON line. A turn that exits 0 with a match still fails start. The driver's built-in check keeps its line-start rule;login_command: the exact command the user runs to sign in.
login keeps its meaning: where the login lives. When a turn's output matches a row's pattern, start fails with D3 the harness is not signed in, and the next names that row's login_command, never a generic failure. No pattern is a program. The runner validates both fields. The planted rows add a bad pattern, and a good row whose fake prints its signed-out line inside a JSON line and exits 0 must get the not-signed-in error.
Safety (binding): never start a real agent CLI. Before running the kit, any driver test or any template-derived command, put stubs that refuse and exit 1 first on PATH, in a private temp dir, for every agent CLI name: claude, codex, cursor-agent, agent, pi, opencode, copilot, goose, gemini, kimi, qwen, cline, kilo, crush, vibe, auggie, kiro-cli, junie, amp, agy, oz, sculpt, hermes, acpx and droid. The runner does the same, putting only the row's own fake ahead of them. Record it in the PR's Facts.
6. Add the CI line python3 -I adapters/local/test_harnesses.py under the kernel kits' tests in .github/workflows/ci.yml. Add one "Harness rows" paragraph to adapters/local/README.md that points to the contract.
Stacking: polish F (#2292, PR #2321) is approved at f54f17bb16da2d0134ac3657c39c2d296009df14 and waits for the 0.1.1 cut. It owns the same adapters/local/driver, README.md and test_driver.py. Branch from that head, open a draft PR that names it, and merge only after #2321. Don't change test_driver.py, except to keep it green. The kit's files belong to KY1 (#2379), so leave them alone.
Owned paths
adapters/local/driveradapters/local/README.mdadapters/local/harness-row.md(new)adapters/local/test_harnesses.py(new)adapters/local/fixtures/fake_cli.py(new)adapters/local/fixtures/rows/(new)adapters/local/evidence/(shared: this ticket's red and green files only).github/workflows/ci.yml(shared: the one test_harnesses.py line)
Relies on: kernel/driver.v1.md, kernel/driver-kit/kit.py, kernel/driver-kit/schema.json
Links
none
Acceptance criteria
- The runner fails on each planted row with its named reason (red, saved in
evidence/), and the example row passes all five kit checks plus the session, env and background-process checks -
test_driver.pypasses unchanged for claude and codex - A start with an unknown harness, or with a broken row, is a D3 error that starts nothing, and wake before a reported session id is known starts nothing
- Effort: the runner fails the two planted effort rows. The example row's effort values each reach the fake's command line, and a no-effort row refuses a request that carries an effort, starting nothing and never falling back to a default
- A row folder without
row.jsonfails the contract check, and a row's ownsigned_outline gives the not-signed-in error with itslogin_command - No row needs to edit a file outside its own
adapters/local/harnesses/<harness>/folder: the runner discovers rows, and CI runs only the runner
Proof
P1 (contract): the runner's red then green on the planted rows, and test_driver.py green.
Activity
30 remaining items
#2431 R5: a planted row that lists medium and unlisted among its effo…
#2431 R5: the runner's refused-effort check picks a valid effort id t…
#2431 R6: a row's env and effort setting reach only the harness, neve…
#2431 R6: the supervisor keeps the driver's environment and gives the…
#2431 R7: a row's credential-shaped fixed arguments are refused namin…
#2431 R7: every fixed argument a row passes, alone, as a flag and its…
#2431 R8: the positive fixture's service stays in the turn's process …
#2431: the fixture's two services are named functions, the README's l…
#2431: R1 to R8 fixed, the README login paragraph and the changelog l…
#2431: the runner stubs 31 agent CLI names, adding boat, pane, opencl…
#2431 R2: a wake while the first turn runs and its session id is alre…
#2431 R2: wake saves only a newly reported session id or before a new…