§18. Instructions to the coding agent (AGENTS.md)
planarian @ a924e09 · Spec v4.6 · snapshot main · all versions
- First deliverable, before any other code: the Phase A fault catalog (
crates/gym/catalog/phase-a/:00-format.tomland one<family>.tomlper §15 family, read in filename order as one document), one entry per §15 family at minimum, each withinject,required_post,intent,family; stop for owner review. - Second deliverable: the GA demonstration script (
gym/demo.sh): fault → repair; bad config → revert; killplanariadduringActivating; watchdog reverts; restart daemon; reconciliation record printed. Build toward making it pass; everything else is in service of it. - Implement Phase A only; traits for B–E with one implementation.
- Build order (historical; every crate exists at v4.6):
schema→txn(with the journal and thefakebackends) →policy→state+backends/linux(systemd, logind, sysfs) →exec+backends/linux(nixos-rebuild) →watchdog→changes→incident→diagnose→gym→intent→cli→daemon→console. The console Graph view may be built as soon asstateworks. - Preserve however the schema evolves: I5, I6, I10–I25;
digest()excludes resources and timestamps;Proposalis the only write path; policy facts derived by the executor; gym scores onrequired_postand intent cases, never on absence of errors; diagnoser before any model; probes with side effects other thanNoneor a boundedMeasurementnever on a cadence. - Do not resolve §19 items;
TODO(owner)with the stated default. - No language model, LLM API, or prompt anywhere in Phase A.
- Where NixOS and this spec disagree on mechanism, follow NixOS and record in
docs/deviations.md. - Every executor outcome must be reproducible from the log: proposal, pre/post state,
DerivedFacts,PolicyVersion, probe evidence, decision, outcome. schema,policy,txnin the Verus subset; landpolicyproofs before startingexec.- The Asterinas and Firecracker gym targets may stay red in A. Classify failures; fix only
Core. - Every new
assume/external_bodyadds a line todocs/assumptions.mdin the same PR. - The fake backend used by the transaction kernel MUST satisfy every entry in
docs/assumptions.md, not only the trait signatures: it is a second real implementation, not a mock. The gym runs the kernel against it under injectedPartial,Unknown, and fenced outcomes. - The journal is hash-chained from the first commit that writes it (I18).
- Never implement Planarian’s response to its own failure inside
planariad; it lives innix/posture.nixas systemd and initrd units (§12d). - Report the invisibility budget (§21) and the verification ratio (§17a) from the first gym run; treat any degradation as a failing test.
docs/future-work.mdis non-normative. Cite it; do not implement from it. If anything there seems to block Phase A, stop and ask.- Phase A was held open for v4.4: the schema-affecting changes (
Override, theActorshape, the security floor, the hash-chained journal) land before the Phase A proofs are written, not as migrations after them. - Keep
docs/bypasses.mdcurrent (§17b): a PR that adds a path to the machine adds a row or says it opens none. - v4.6 handoff, in this order. (a) Reconcile: the close-out review in the project (“Phase A close-out review, head 805cd1c”) lists every finding with its status at that head; before touching anything, confirm each item you take on is still open at your head and record which commit closed the ones that aren’t. (b) B-20 first (I24; §11, §16): register the row, fix, add
agent-name-collisionto both harnesses. (c) The documentation sweep: every doc agrees with head and with this spec before any further status is cited (ga-status.md’s summary;guarantees.md’s accounting;bypasses.md’s three tables;AGENTS.mdmirroring §18 rules 0–23;catalog-review.md’s counts and a v4.6 section; the catalog’s header (phase-a/00-format.toml); the deviations rows §28 names). (d) The §28 required changes, one PR each, each with its §15 acceptance case landing in the same PR. (e) §15’s harness contract and §17a’s accounting checks. (f) Then, and only then, run the whole VM catalog on one commit and updatega-status.mdfrom that run; a gate claim cites one commit and one run, never a union of runs. - Equivalent effects, equivalent treatment. When two spellings of a request, two paths to a commit, or two sources of a proposal produce the same effect on the machine, they get the same derived facts, the same floors, and the same bookkeeping (§11, I25). A PR that adds a spelling, a path or a source states which existing one it is equivalent to and shows the gym case that holds them equal.
- Nothing is derived from a failed tool. A backend or helper that exits nonzero, times out, or returns truncated output never contributes a smaller plan, a
Nonedisruption, or a passing verdict; the step fails or the change parks (§9 step 3, §15 harness contract). - The guarantees site (§17c) builds on every push. A change that renames an obligation, adds an invariant or assumption, or adds a bypass row makes the site resolve in the same PR.
- Property tests for logic, regression tests for bugs (owner decision, Nov 3). A PR that changes a pure fold, parser, classifier, ordering or state machine carries a property test (proptest, or a Kani harness where one fits) stating the invariant it changes, not only an example input, and shows that the test fails without the change. A PR that fixes a bug adds a test that fails on the unfixed code and a row to
docs/regression-ledger.md(bug, fix, test, kind, evidence it fails on revert); a bug that only a kernel or a VM can show cites its VM test there. Nix wiring, documentation and fixtures need none and say so.