[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M76V34F8ZBT7Z38RNHXREY0H":3,"skill-same:01M76V34F8ZBT7Z38RNHXREY0H":63},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":31,"ownerHtmlUrl":32,"ownerBlogUrl":6,"ownerDescription":33,"updatedAt":34,"install":35,"resources":48},"01M76V34F8ZBT7Z38RNHXREY0H","steadfaste-design",null,"steadfaste design-doc and governance-cycle work.","lukemcqueen\u002Fsteadfaste-fleet","lukemcqueen","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F405240?v=4","01M757MHPAGRXTJAT46SKZP98R","Luke McQueen","01M757MHPZ573KP8DT9GB8SBQ7",4,"MIT","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fsoftware-development\u002Fsteadfaste-design\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nversion: 1.0.0\nname: steadfaste-design\ncategory: software-development\ndescription: steadfaste design-doc and governance-cycle work.\n---\n\n# steadfaste — architecture & design-doc work\n\n## When this applies\nAny change to the steadfaste architecture (repo `~\u002Fsteadfaste`): covenant\u002Fspec docs, design mechanism docs, grounded research reviews, the governance cycles that gate them, and the **build execution** of the frozen spec (`docs\u002Fdesign\u002Fbuild-tasks.md` → the BUILD\u002FCHECK split). This is the fleet owner's (Luke) product: **settle the design before building** — the design docs are the deliverable, not code. Core = the Constitution (unamendable Rust core) + Covenant (bond of trust); Agent\u002FWorker\u002Fharnesses\u002Fgateways are all swappable behind it.\n\n## Standing preferences (Luke)\n- **Settle design first, thoroughly.** \"Take your time, no rush to build.\" Build only after a design looks bulletproof. Ground every claim in primary sources (read real docs\u002Frepos; mark UNKNOWN rather than guess).\n- **DESIGN-FIRST GATE: \"research X for the interface\" means write a design doc, NOT code.** Even when the request mentions an interface\u002FAPI, and even if you already have a RED test written — the deliverable is a thorough design doc unless Luke explicitly says implement\u002Fbuild. If you catch yourself writing implementation files for a design request, delete them and write the doc. Luke has corrected this mid-task; a half-built implementation is wasted work, the design was the ask.\n- **\"Research X\" = consult the expert model directly (DeepSeek Pro via OpenRouter), not vendor-doc browsing.** When Luke names a model\u002Fprovider as the research source, prompt it via the OpenRouter API with the concrete design question — crawling the vendor's docs site is the wrong path. Ground the doc in what the consult returned, marking UNKNOWN what the consult could not confirm.\n- **Every new subsystem design doc must state explicitly: (1) its relationship to the Ledger — which stream it is, what it must never touch, the wall between it and the single writer; and (2) its scale-ladder placement — zero-config at 1 agent, inert-until-needed heavy paths, per-tier operator steps.** Luke checks these first; a doc missing them reads as unreviewed.\n- **When Luke interjects a mid-task correction, pivot immediately after the current tool result** — do not push the interrupted path to completion first. Corrections arrive as narrow one-line messages and each narrows the deliverable (design-only, organize with the corpus, must not interfere with the Ledger); the interrupted path's remaining work is now waste.\n- **Keep the core pure\u002Ffocused.** Design an *interface* when it serves the product's GTM (enterprise deal-opener); DEFER adapters\u002Ftransports\u002Fimplementation until a client or deal demands it (anti-bloat). Never let external policy\u002Fadapter become an authority over the Law.\n- **Current vs historical separated.** Current docs live in `spec\u002F` + `docs\u002Fdesign\u002F` + `docs\u002Fresearch\u002F`; stale\u002Fone-off artifacts move to `docs\u002Fhistorical\u002F`. Keep every doc listed in `docs\u002FREADME.md` map.\n- **Anti-bloat test for any new surface:** \"is this needed to govern well, or is it a client wanting to be pretty \u002F a feature that loses the core?\" The latter is out of scope.\n- **Verify-before-add, even on the user's own idea:** when Luke proposes adding a capability, do NOT fold it in just because he asked. First overlap-check it against the settled concepts (a per-model bundle vs PromptState\u002Finject-prompt vs Charter\u002Flevers vs the reputation permutation — complementary, not redundant), state the overlap analysis, then add it with the invariants that keep it safe. Show the verification was done, not just that you complied (\"don't just do it because i want it... verify this makes sense with our system\").\n- **Judge \"do we need steadfaste-fleet concept X here?\" by comparing topologies, not by presence:** bus\u002Fbrain existed in hermes because it is a FLEET of autonomous agents with independent state; steadfaste is ONE accountable core + swappable isolated workers + the Ledger as single truth. A capability whose purpose the opposite topology already serves (coordination → the single-writer Ledger; knowledge → Ledger + Model Reputation Library) is a DELIBERATE EXCLUSION, and the exclusion is recorded as a reasoned decision, not an omission.\n- **Scale ladder governs scope:** features are sized so \"easy at 1 agent\" needs zero config, and heavy machinery (mTLS, consensus, PgBouncer, sharded writer) is REJECTED for small scale with the exact tier+trigger to reconsider. The 1000-agent path must be an EXTENSION of the 1-agent path, never a rewrite.\n\n## Procedure (every design change)\n1. Open a governance cycle: `begin_change`.\n2. Write\u002Fappend the design doc (see doc-writing pitfalls).\n3. If the doc is one the docs map lists, add it to the `docs\u002FREADME.md` map row.\n4. Commit with a message that states: the design decision, the grounding\u002Fsources, and the scope line (v1-build vs designed\u002Fdemand-gated vs never\u002Fanti-bloat).\n5. `feedback_accept(cycle_id)` then `end_change(task_id)`.\n\nPitfalls in the procedure:\n- **Subagent writes are ALSO governance-gated**, even into `\u002Ftmp`. Subagents must open\u002Fclose their own cycles; writes are refused until they do.\n- **Known MCP arg-drop**: `begin_change`\u002F`inbox_send_task` intermittently serialize EMPTY args. Retry 2–3x max, then report the blocker — don't loop.\n- Successfully draining the research fan-out does NOT close the work: synthesize findings into a doc under your own cycle before reporting.\n\n## The grounded research \"party\" pattern\nFor \"are we design-right \u002F is it bulletproof\" reviews, dispatch PARALLEL subagents via `delegate_task`, one task per DOMAIN CLUSTER, each instructed to read that domain's PRIMARY docs and return structured findings. Synthesize into a research doc under your own governance cycle.\n- Use a fixed verdict vocabulary per system: **VALIDATES \u002F BORROW \u002F GAP-RISK**, each = a one-line finding + the mechanism, not a narrative.\n- If a subagent returns only PART of its assigned set, re-dispatch the missing cluster — do not assume a partial result is complete (one fan-out returned only 1 of 3 clusters; the rest had to be re-dispatched).\n- Ground in repo READMEs\u002Fofficial docs; mark UNKNOWN explicitly, never fabricate.\n- Reuse the standard task-prompt + output schema: `references\u002Fresearch-party-schema.md`.\n\n### The \"frozen for years\" hardening review (interface-freeze + cross-OS + adversarial sweep)\nWhen the goal is \"core\u002Finterface rock-solid and UNCHANGEABLE for years\" (also: a platform that cannot be tested yet, e.g. a PC\u002FWindows port), run a 3-DEEPSEEPRO-PASS hardening party in addition to any design review:\n- **LA — frozen-interface integrity:** what breaks an additive-only interface over 3+ years. Key findings to check for: shape-freezed but MEANING-drifting fields (semantic-freeze layer — pin prose definition + invariant fixture per field, not just a type); codegen-from-schema must be the PRIMARY path (parity-testing only DETECTS drift, it does not prevent it); version-negotiation in the handshake (negotiate frame version, not just capability scope); deprecation calendar + compat matrix + wire-visible payload versioning; unknown-type-IGNORE must be scoped to telemetry (must-understand content rides `kind`, never the ignorable channel).\n- **LB — cross-OS forward-design:** decide the interface amends NOW for the untestable OS so the port cannot break the frozen contract later. The decisive mechanism: a **`platform_caps` capability declaration** on both handshakes (freeze\u002Fkill\u002Fegress_revoke\u002Fcontainment\u002Fpath_style enums) so \"stop\" is declared per-host rather than assuming POSIX SIGSTOP (Windows has no SIGSTOP — the guarantee must read \"freeze if the host can freeze, else atomic tree-kill ~500ms\"). Separate DECIDE-NOW (declarations, additive) from DEFER (pure plumbing).\n- **LC — adversarial final sweep:** 11-finding sweep for logic contradictions across docs (e.g. single-writer vs federation — pin ONE designated writer-core, others submit), security holes in the n-arrow cases (egress-proxy revocation must DROP ESTABLISHED connections not just update the allowlist; emergency-stop must kill pid-namespace-init or cgroup.kill, NOT process-group, or setsid\u002Fdouble-fork escapes; Ledger HMAC with a fleet-shared key is forgeable — use unkeyed SHA-256 chaining + Ed25519-verifiable checkpoints), and seed-pinning (use TWO seeds: a RECORDED reproducibility seed + an UNRECORDED anti-gaming CSPRNG, or colluders predict pair-review).\n- Synthesize all three into one research doc with a concrete \"before the freeze ships\" action list. Do dependencies explicitly (HMAC fix precedes verify-from-checkpoint; two-seed precedes collusion defense).\n\n### The scale-ladder design shape (\"easy for the 1\u002F2\u002F10\u002F1000-person\")\nWhen sizing a feature\u002Farchitecture for adoption, structure it as a 4-rung scale ladder — produce per-rung (persona, topology, what \"easy\" means, the zero-config default, which gaps bite hardest), plus the complete gap-accommodation table marking each gap **BUILT-IN (v1, zero config) vs SCALE-UP-GUIDANCE (tier + concrete operator step)**, and a what-changes-per-rung (automatic vs operator-decides) summary. The honesty rule that governs it: a small deployment must never inherit heavier machinery it doesn't need, and the 1000-agent path is an EXTENSION never a rewrite — test: \"if the 1-person must touch a knob to get an honest answer, or the 1000-person must rewrite to add capacity, it's broken.\" Performance\u002Fsingle-writer\u002Fconsensus items marked \"BUILT-IN\" that are actually load-dependent are wrong-axis errors — code path may exist in v1 but lie INERT at n=1, activating on demand.\n\n## Story & slicing the build requirements (v1 → vertical stories)\n\nWhen the ask is \"story and slice the requirements\" (Luke, recurring — planning\nthe build in user-valuable slices before code), the deliverable is a vertical\nstory\u002Fslice plan doc under `docs\u002Fdesign\u002F` (current plan:\n`docs\u002Fdesign\u002Fstory-slices.md`), cut from the BUILD-READY blueprint — NOT the\nblueprint's §7 crate order presented on its own, and NOT the old\nPi-vocabulary story (`docs\u002Fhistorical\u002Fstory\u002Fcoding-agent-story.md`, superseded).\n\n- **Slice by covenant promise, vertically.** Each story crosses Wire framing →\n  Constitution → Ledger and lands as a demonstrable, user-visible governance\n  outcome (a verdict, a stop, an audit, a kept promise). \"Done\" for a story =\n  its owned conformance tests (blueprint §5) green against the real pipeline.\n- **The done-map is the discipline:** every conformance test is owned by EXACTLY\n  one story. Reproduce the test→story table so nothing is owned twice and\n  nothing is unowned; that table is the single source of truth for \"which tests\n  ship with which story.\"\n- **One deliberate horizontal substrate first.** The core is a single Rust\n  binary assembled crate-by-crate, so the first story is the substrate that\n  freezes and proves the two halves named \"core & interface\": the Wire ABI\n  (one `abi.schema.json`, codegen primary, byte-parity, handshake fail-closed)\n  and the Ledger (hash chain + single-writer, verify-on-read). State explicitly\n  WHY it is the one non-user-valuable horizontal — it IS the core+interface;\n  nothing downstream is testable honestly until the loop exists.\n- **Map to §7** in a table so the vertical (stories) and horizontal (crate\n  build) views agree; order stories by dependency (substrate → run →\n  verification needs ride later stories).\n- **Stay faithful to §6 IN-scope** plus the anti-bloat test: a slice that is\n  data → a Ledger fold\u002Fview; judgment → a governed worker over the ABI;\n  enforcement → a core gate; a client wanting to be pretty → a client of an\n  interface, never core. Project v1.1+\u002Fv2 (surface, gateway, fleet) separately\n  as DESIGN, marked not-core-blockers.\n- **Per story:** As-a\u002Fso-that framing, Given\u002FWhen\u002FThen acceptance (one happy +\n  one error scenario), INVEST, dependencies, and a scale note — the\n  `story-decomposition` vertical-slicing discipline applied to a governed\n  monolith.\n- Register the new doc in `docs\u002FREADME.md` CURRENT table; note it supersedes the\n  historical story.\n\n## Executing the build — the BUILD vs CHECK split\n\nThe build is a frozen-spec implementation (`docs\u002Fdesign\u002Fcore-build-blueprint.md`)\ndriven top-to-bottom through `docs\u002Fdesign\u002Fbuild-tasks.md` — numbered tasks, each\ntagged BUILD or CHECK, with a status column. The split is the whole discipline:\n\n- **BUILD = mechanical shape\u002Fwiring** (a struct, an enum, a DDL). The compiler\n  + a happy-path test catch the errors. **Delegate BUILD to subagents**\n  (`delegate_task`), in parallel where independent, and verify their self-report\n  against real `cargo test` output before trusting it (a subagent's \"done\" is a\n  claim, not proof).\n- **A subagent transcribes your spec LITERALLY — your spec's bugs become its\n  bugs.** A missing `rename_all` or `skip_serializing_if` in the type spec you\n  hand over is copied verbatim into the output, and the subagent will not catch\n  it because it followed you faithfully. Review delegated output against the\n  codebase's own wire conventions (the serde pitfalls above), not just\n  diff-check it against your own prompt — the spec author and the reviewer must\n  be different eyes.\n- **CHECK = a security guarantee** — the conformance tests plus the\n  canonicalization \u002F tamper \u002F stop \u002F redaction \u002F replay functions they prove.\n  Silent-when-wrong; a weak model must never write them. **Do CHECK tasks\n  yourself** (the strong model). Stop before each CHECK, commit the accumulated\n  BUILD work, and report for strong-model review. Never hand a CHECK to a\n  subagent.\n- **Drive autonomously, top-to-bottom.** The owner should only have to say\n  \"continue\" — not re-prompt per task. Do CHECKs yourself, delegate BUILD,\n  commit each task, and report the next task to hand off.\n- **Session-tail handoff, not in-session slicing.** When the next phase is a\n  large build and this session is already long, stop after the survey: close\n  the cycle and emit a SELF-CONTAINED handoff prompt instead — repo state\n  (HEAD + green test count), what exists vs what doesn't, the task table with\n  BUILD\u002FCHECK tags, and the TDD\u002Fgovernance\u002Fcommit rules a cold session needs.\n  Hand it to the owner verbatim for a fresh session (\"Don't slice yet — give\n  me a prompt for another session to do it\", 2026-09-23; the fresh session\n  then built Story 7 end-to-end off that prompt).\n\n**One task = one file (or one tightly-coupled pair) + one test + one RED→GREEN\ncycle.** Never batch unrelated edits. After every task, `cd core && cargo test`\nmust be full-suite green before commit.\n\n- **Every task — BUILD and CHECK alike, and including delegated output — closes\n  with edge-case tests and an adversarial review.** This is a standing operator\n  directive, not a per-task request: probe the boundaries (empty input, integer\n  extremes, malformed\u002Fwrong-typed input, reordered\u002Fduplicate data) and attack the\n  implementation's assumptions with a scratch probe rather than reasoning from\n  memory. A finding becomes either a fix (a panic path, a lenient parse) or a\n  pinned fail-closed test — never a silent acceptance. **For a typed-probability\n  threshold gate (a verdict split at a LM\u002FHI band), pin the EXACT seam values\n  both sides of every threshold and the type extremes** — `LO-1`, `LO`, `HI`,\n  `HI+1`, and the domain limits (`0`, `1_000_000` ppm), plus the wrong-typed\n  answer failing closed. Representative middles (a confident-low, a confident-high,\n  a mid value) pass while the inclusive\u002Fexclusive edge is silently wrong; a\n  security gate's contract IS the seam.\n\n**A hand-written `validate()` on a typed record must bound EVERY numeric field,\nnot just the ones the happy-path example exercises.** Adversarial review caught\n`conf_ppm`\u002F`score_ppm` passing at >1,000,000 while only `p_ppm` and the\ndistribution sums were checked — the example tested a noul and a choice, never a\nscore, so the score branch's bounds were never exercised. Enumerate the record's\nfields in the validator and give each a bound (or a sum-to-exact rule), then write\none adversarial test per field that violates it.\n\n**A conformance test is expected to reveal spec-vs-code divergence.** When the\ntest fails not because the code is missing but because the code *violates the\nfrozen contract* (e.g. the spec says \"unknown `type` → ignore\" but a derived\n`Deserialize` rejects it), that is the test working. Write the test first\n(RED), then apply the minimal fix that makes the *code* match the *frozen spec*\n— you are implementing an already-settled rule, never re-designing, and never\nweakening the assertion to make the code look correct.\n\n**serde pitfalls — the abi\u002Fledger\u002Fwire crates are serde-heavy; these recur:**\n- `#[serde(deserialize_with = \"f\")]` on an `Option\u003CT>` field **overrides the\n  implicit missing-field default** — an absent field becomes a `missing field\n  \u003Cx>` error. Pair it with an explicit `#[serde(default)]`, or a frame that\n  legitimately omits the field regresses.\n- **\"Ignore unknown enum variant\" (an additive registry like `EventType`) is not\n  free** — a derived `Option\u003CMyEnum>` REJECTS an unknown variant. Write a custom\n  deserializer that maps unknown *strings* to `None` while still rejecting\n  non-string values (the malformed-known-field case). The ignore is a *policy*\n  on one field, never an `untagged` enum.\n- `serde_json::Value` from a helper that returns a temporary cannot be indexed\n  by reference (`golden()[\"kinds\"].as_object()`) — E0716 \"temporary dropped\n  while borrowed\". Bind the `Value` to a `let` first, then index.\n- **Every enum needs `#[serde(rename_all = \"snake_case\")]`** (verbs\u002Fdiscriminants\n  like `Kind`\u002F`Trust`) or `SCREAMING_SNAKE_CASE` (registries like `EventType`\u002F\n  `VerificationStatus`). A missing `rename_all` serializes the PascalCase variant\n  name (`Allow` not `allow`) — a silent wire-convention divergence that a\n  round-trip test will NOT catch (it round-trips fine) but a golden-fixture or\n  convention review will.\n- **Every optional field needs its OWN `#[serde(skip_serializing_if =\n  \"Option::is_none\")]`** — it is NOT inherited from the struct or a sibling\n  field. A struct-variant field (`GateDecision::Veto.rule_id`) serializes as\n  `\"rule_id\": null` unless annotated, violating the omit-never-null rule (LA-11).\n- **\"No float in hashed content\" detection = `serde_json::Number::is_f64()`.**\n  Probe the real parser before trusting it: `-0`, `1e2`, `1.0`, and any integer\n  past `u64::MAX` all parse to `is_f64()==true` (the last becomes scientific\n  notation — the exact non-deterministic form the rule exists to block);\n  `u64::MAX`\u002F`i64::MIN` stay exact `is_f64()==false`. Reject `is_f64()`\n  recursively over the value, before serializing. In a *test* asserting a\n  serialized record is float-free, walk the parsed JSON value checking\n  `!n.is_f64()` at every number — do NOT scan the serialized string for `.`\u002F`e`\u002F`E`,\n  because ordinary field values (\"severity\", \"verification\") contain those\n  characters and trip a false positive. The string-level guarantee is also\n  dependent on field names; the value-walk is not.\n\n**Don't let `cargo fmt -p \u003Ccrate>` creep the commit.** It reformats the whole\ncrate — including pre-existing files that were never rustfmt-clean — so\n`git status` shows unrelated `M` files. Revert the files you didn't otherwise\ntouch (`git checkout -- …`) and keep the commit to the task's own files. To\nconfirm remaining fmt diffs are pre-existing rather than yours: `git stash`,\nre-run `cargo fmt --check` on the clean tree, `git stash pop` — if the diff\npersists without your changes, leave it alone.\n\n## The codegen-primary build (abi-codegen)\n\nThe generator (`core\u002Fcrates\u002Fabi-codegen`, lib+bin) reads a schema and emits the\nSHAPE-ONLY types; two targets (`abi`, `surface`). Codegen only reproduces a\nschema that carries `x-rust` metadata — wire `enum`\u002F`properties` values alone\nrecord neither rename_case, integer widths, nor the serde attribute set, so a\nschema without `x-rust` cannot be regenerated faithfully.\n\n- **Shape vs logic split is the whole point.** The generator emits rename_all,\n  derive flags (`copy`\u002F`eq`), field order, widths, and serde attrs — nothing\n  else. Doc comments flow from the schema `description`. Logic moves OUT to\n  hand-written files: `impl Default` → `*_policy.rs`, `#[cfg(test)]` modules →\n  `tests\u002F`, projection fns → `surface\u002Fsrc\u002Fprojections.rs`. A\n  `deserialize_with`\u002F`tag`\u002F`skip_serializing_if` attribute is WIRING the\n  generator reproduces verbatim, but the function it points at\n  (`frame_policy::deserialize_ignorable_type`) stays hand-written.\n- **Field order lives in an explicit `x-rust.fields` array, never JSON key\n  order** — `serde_json::Map` is a `BTreeMap`, which re-sorts keys and drops\n  insertion order; emitting in `$defs`\u002F`properties` order scrambles struct\n  fields (a silent wire regression a round-trip test won't catch).\n- **`--target` on a cargo-built tool collides with cargo's own cross-compile\n  `--target` flag.** `cargo run -p abi-codegen --target surface` is swallowed\n  by cargo and fails on a nonexistent target triple; use `cargo run -p\n  abi-codegen -- --target surface`, and make the generator's banner\u002Fdoc\n  comments state the `--`-separated invocation, not the one cargo swallows.\n- **Never run `cargo fmt -p \u003Ccrate>` on a crate that contains GENERATED files**\n  — rustfmt reformats the generated output, which then diverges from the\n  generator bytes and fails the committed-match test; regenerate to restore.\n  `cargo fmt -p` only the hand-written crates\u002Ffiles.\n- **A generator is production code → it needs a test.** A bare `main.rs` bin\n  trips the TDD Iron Law gate (no test target); refactor to lib+bin and expose\n  `generate(schema, target)` as a lib fn so the idempotence + committed-match\n  tests can call it directly.\n- **Idempotence is the load-bearing guarantee** — fixed layout, ordered arrays,\n  no timestamps or HashMap iteration. The committed-match test (generated\n  output == committed files byte-for-byte) is the \"regenerate → zero diff\"\n  CHECK; prove it non-vacuous by hand-editing a generated file and watching the\n  test fail before trusting it.\n\n## \"Show the current design\" — the component & interface accommodation map\n\nWhen Luke asks to see the current design, or to make sure all components and\ninterfaces are accommodated, the deliverable is ONE inventory doc — not a chat\nsummary alone: `docs\u002Farchitecture\u002Fcomponent-interface-map.md`, plus a row in\n`docs\u002FREADME.md` (the only index; give it a slot in a reading path too).\n\n- **Two tables, one row per part:** components (C1…Cn) and interfaces (I1…In).\n  Every row carries: where it lives, the doc that specifies it, its status\n  (SETTLED \u002F BUILD-READY \u002F DESIGN \u002F DEFERRED \u002F STANDARD \u002F NOT-THE-PRODUCT), its\n  **relationship to the Ledger**, and its **scale rung**. Make Ledger and scale\n  *columns* — that is the pair Luke checks first, and a column cannot dodge them\n  the way prose can.\n- **State the accommodation test at the top, then apply it:** a component is\n  accommodated when it has (1) a folder home, (2) a specifying doc, (3) a named\n  interface into the core, (4) a Ledger rule, (5) a scale rung. An interface is\n  accommodated when it has a stable envelope, one canonical schema artifact, and\n  a no-bypass path through the Constitution.\n- **The gaps get their own ranked table** — id, what is missing, why it matters,\n  the smallest fix — each marked structural or thin. Never silently omit a part\n  with no home; never pad the inventory with a part that does not exist.\n- **Do NOT invent the missing design to close a gap.** A naming\u002Fstructure\n  question (which folder the human surface lives in) is the owner's call — name\n  it, name the smallest fix, and let him settle it.\n- **Close the contradiction loop in the same commit.** Surveying for the map is\n  where cross-doc drift surfaces (a stale count, a README tree that disagrees\n  with the designed tree and with disk); the map commit is the one that must\n  leave the corpus consistent.\n\n## Reviewing an external project's source against the design\nWhen asked to \"check \u003Cvendor\u002Fproject>'s source against our core\u002Finterface,\" the\ndeliverable is a grounded research doc under the verdict vocabulary\n(VALIDATES \u002F BORROW \u002F GAP-RISK), with every adoptable mechanism APPLIED into the\ndoc that owns it before the cycle closes — a finding without a home is an orphan.\n1. **Triage the repo listing first** (org repos via the GitHub API): separate the\n   1–2 repos that touch OUR seams (adapters, packaging, wire-like contracts)\n   from apps\u002Feval-corpora, vendored forks of other projects (no design of theirs\n   to review), and unlicensed repos (excluded — nothing is taken from them).\n   Record the exclusion lists so the omissions are decisions, not gaps.\n2. **Read the load-bearing source modules, not READMEs** — the adapter\u002Fcontract\n   types, registry, policy modules, and the lifecycle\u002Finstall paths. Cite by\n   module path; anything not verified from source goes in an explicit UNKNOWN\n   section. Closed-source parts of the vendor get no claims at all.\n3. **One numbered finding per mechanism**, each with: the mechanism (quote only\n   when the quote IS the rule), what it means for our design, the Ledger\n   relationship, and the scale rung. A finding may be a deliberate DIVERGENCE —\n   when our rule is stricter than the market's, record that we are stricter and\n   why, never import the permissive branch.\n4. **Apply each borrow into its owning doc in the same commit** (interface\n   contract changes into the interface doc, host\u002Fcapability rules into the\n   blueprint, packaging acceptance bars into the gap ledger, a row into\n   `docs\u002FREADME.md`), and state in the review's \"where each lands\" table that\n   nothing changed in the frozen envelope \u002F single writer \u002F v1 scope unless it\n   truly did.\n5. Split a large new doc across multiple tool calls — draft the file, then\n   append sections via `patch` — rather than one oversized write.\n\n### From BORROW findings to a story\u002Fslice plan — split v1-core vs v2-deferred FIRST\n\nWhen a grounded review produces BORROW findings and Luke then says \"story and\nslice the gaps,\" the honest answer is usually **most of them are not v1-core\nsliceable**, and padding the plan with fake slices is the failure shape. Before\ncutting any slices:\n\n- **Check `core-build-blueprint.md` §6** with `search_files` for what is already\n  `DEFERRED v2, out of core`. Almost every borrow that touches routing \u002F the\n  model pool \u002F the Model Reputation Library \u002F the Evaluator-L2b-critic is\n  already deferred — so it becomes a **recorded DEFERRAL with a v2 trigger**, not\n  a v1 slice. The borrow note is already applied into the owning doc (step 4);\n  the slice plan just names the trigger under which the v2 subsystem will pick\n  it up.\n- **Only an additive core change is a genuine v1 slice** — a new `EventType`\n  member, a new additive field on the frozen schema. Verify against the live\n  enum\u002Fschema (`core\u002Fcrates\u002Fabi\u002Fsrc\u002Fenums.rs`, `abi.schema.json`), never\n  intuition: grep the actual variant list before declaring something \"additive,\n  already covered.\" (e.g. `TOOL_LOADED` is a real add because the enum has\n  `TOOL_REQUESTED\u002FSTARTED\u002FFINISHED` but not it; an \"already covered\" claim is\n  only safe after reading the enum.)\n- **A one-BUILD\u002FCHECK-story slice plan is a correct outcome, not a thin one.**\n  State the v1-vs-deferred split in a table (finding → verdict → v1 core? →\n  disposition), put the single additive slice in BUILD\u002FCHECK form, and record\n  the rest as deferrals. If a borrow reduces to \"already covered by the existing\n  event\u002Ffield,\" collapse it and say so rather than inventing work.\n- **A deferral whose only open question is a one-word owner decision** (e.g.\n  \"is event X distinct from event Y, or does the existing one suffice?\") goes in\n  the slice plan as a named decision point blocking its BUILD — do not silently\n  pick, and do not build past it.\n\n## Designing an external-vendor integration (\"integrate X for the system\")\n\nWhen asked to design an integration with an external product (a runtime, an observability platform, a\npolicy engine), the deliverable is a design\u002Fplan doc under `docs\u002Fdesign\u002F` — requirements, invariants,\nconformance tests, scope split, story slices, Ledger relationship, scale ladder — and the work order is:\n\n1. **Verify the product exists and read its OWN docs before designing anything.** `web_extract` is\n   unavailable on the ddgs backend (search-only), and vendor doc sites may refuse a browser `fetch`\n   (docs.nvidia.com did) — but `raw.githubusercontent.com\u002F\u003Cowner>\u002F\u003Crepo>\u002Fmain\u002F\u003Cpath>` works from\n   `browser_exec`'s `js()` with an async IIFE, and the git trees API\n   (`\u002Frepos\u002F\u003Co>\u002F\u003Cr>\u002Fgit\u002Ftrees\u002FHEAD?recursive=1`) gives the doc file list. Read the real extension\u002FAPI\n   docs, not the marketing page, and cite the paths in the doc's grounding line.\n2. **Record what the docs do NOT say as UNKNOWN, never as a requirement.** A vendor's silence on\n   fail-closed behavior (e.g. what a gateway does when an external interceptor is unreachable) is not a\n   guarantee — it becomes a pre-slice verification test plus an explicit open item.\n3. **Decide the authority topology explicitly and state the failure mode.** For a governed core\n   integrating an enforcement engine: the core decides, the vendor enforces, the vendor's config is a\n   DERIVED SUBSET of the frozen Mandate, and the vendor's audit log is diagnostics (best-effort) while\n   the Ledger is evidence. Name the concrete breakage if both claim to decide.\n4. **Overlap-check before adopting the vendor's primitives.** Map every vendor extension point onto an\n   existing steadfaste seam and say which is the FIRST slice and why the others are not (the one that\n   governs *creation* beats the one that polices traffic afterwards).\n5. **Apply the anti-bloat rule to the consult's own requirements.** A model consult reliably proposes\n   mTLS, HA\u002Fleader election, and extra replicas — all rejected at n=1 with the rung+trigger recorded\n   instead. Also reject: reimplementing the vendor's core competency inside the core (kernel sandboxing\n   is the canonical NEVER), and letting the vendor own the evidence store.\n6. **Observability integrations have one hard rule:** the platform is evidence, never the authorizer,\n   and never in a synchronous decision path. Scores\u002Fmetrics from an eventually-consistent store\n   (seconds to minutes) become admissible only as an anchored, hashed, integer projection in the Ledger;\n   a gate reads the anchor and fails CLOSED on absence. Out-of-range values are rejected, never clamped.\n7. **Give the integration a zero-config default that needs no vendor** (local file sink + a\n   `trace \u003Crun_id>`-style local join) and make vendor compatibility a matter of *pointing* a standard\n   protocol (OTLP) at it, with the vendor mapping living in the sink crate, never in the core.\n\n### When the owner hands you a conceptual interface or a phased plan\n\n- **A hand-drawn interface is reviewed, never copied.** The deliverable is a *right \u002F wrong \u002F missing* review plus a\n  settled version, with `[corrected]` marks and the reason. Recurring corrections: authorization must not move into a\n  component that only enforces (`execute(…, AuthorizedAction)` is wrong — the provider executes a constrained process,\n  the core authorizes); a policy parameter must be DERIVED from the Mandate\u002FCharter, never caller-authored (an\n  authored policy is a bypass vector); numeric fields become integer-only snake_case (`cpu_limit_millicores`,\n  `memory_limit_bytes`); a Promise\u002Fasync shape becomes a synchronous trait; and every capability a provider cannot\n  enforce must be *declared* so the job is refused rather than silently under-enforced.\n- **A phased plan (30\u002F60\u002F90) expands into per-phase requirements + stories + the tests they own**, plus an anti-bloat\n  fence naming what each phase must NOT grow into, and an explicit \"these dates are planning artifacts, these\n  demonstrations are targets\" note.\n- **Experiment plans pre-register their numbers.** Every claim gets: what it supports, what it does NOT support, the\n  falsifier, and the pre-registered inputs (suite\u002Fpolicy\u002Fthreshold hashes committed before the run). Each harness needs\n  a non-vacuity test proving it FAILS when it should, and every result must state \"targets vs measured\" plus its\n  conditions. \"100% prevention\" is never the claim — \"no bypass in the pre-registered suite, on the tested day\" is.\n- **A scope-reduction message arriving mid-consult goes into the prompt before launch** — append it as an addendum\n  asking for the minimal component set, rather than re-running the consult.\n\n## Doc-writing pitfalls (these cost real time — proven)\n- **Append large markdown via `write_file` to \u002Ftmp then `cat >> file`** — do NOT use `printf`\u002Fheredoc; backticks\u002Fquotes get shell-escaped and the command errors or writes garbled bytes. The same `>\u002Ftmp` + `cat >>` rule applies to APPENDING a large block to a code file: `patch`'s fuzzy matcher can grab the WRONG closing brace and corrupt the file (an MN3 append to `fold.rs` merged the new `calibration_fold` block INTO the `RefusalFold` struct and renamed an unrelated field). Recovery is `git checkout -- \u003Cfile>` then re-append via `cat >>`; grep the diff after a large append confirms nothing got nested.\n- **Before appending a numbered `## N.` section, grep `^## N.` in the target.** If a collision exists (an added `## 8.` collided with an existing `## 8.` this project), renumber the NEW section (8→9) AND its subsections (8.1→9.1).\n- **After ANY `write_file`, re-read your own written section.** Placeholders are not auto-filled (saw a literal `\"v\": null — placeholder` ship), and multi-bullet prose gets mangled (dup\u002Fmissing words, stray tokens). `write_file` writes bytes; it does not proofread.\n- **Proofread prose for typos before commit** — misspellings such as `agentatic`, `tracable`, `\"A get, not a stylistic note\"` slipped through and needed a separate fix pass.\n- When a patch \"fix\" accidentally merges\u002Fgarbles an adjacent sentence, repair that sentence immediately (re-read the diff), not with an appended \"UPDATE\" note.\n\n## Public README & marketing copy (the user-facing face of the repo)\n\nLuke treats the README as **part selling the repo** — but sells *honestly and conservatively*. When asked to write or rewrite the README (or any public-facing doc), follow these standing preferences — they override generic prose instincts:\n\n- **Be proud of the genuinely novel and good parts; do NOT oversell.** State the real facts that make it strong (stable core, swappable agents, tamper-evident evidence, enterprise governance). Cut value-judgment claims about your own quality (e.g. \"Engineered extremely well\" was rejected: \"people will judge it for themselves\"). Cut unverifiable forward-claims (e.g. \"a 2026 thing works in 2029\") — state the mechanism that makes it true (additive-only contract) instead. \"Be conservative in statements. Do not oversell something you can't verify.\"\n- **Strip PII and the owner's identity from public docs.** No personal names, no real IPs\u002Fidentifiers. The remote repo may still carry the owner handle — that's the repo URL, not doc content, and is fine.\n- **Do NOT use Luke's spoken\u002Finternal words in public copy.** Rejected outright: \"boring\", \"non-coder\", \"settled\", \"swappable\", \"watched by arithmetic\". \"North star\" is a concept you *talk about*, not a heading — use \"What we build\". Branded terms (Constitution, Covenant) are fine but use them SPARINGLY — only a few capitalized concepts stay memorable; when every mechanism gets a name, metaphor competes with engineering.\n- **The README is not a diary.** Do not enumerate every request made this session; keep only important product info. \"Stop repeating everything I request as if everyone in the world needs to hear it.\"\n- **Teach the product in order** (this is the shape): what it is → the idea (agents replaceable, foundation not) → built for trust → architecture → why it exists → technology → enterprise governance → status. Learn concepts in sequence; don't open with several competing headlines.\n- **Plain spoken prose over branded stacking.** If a block reads like a creed (titles + prometheus of internal names in bullets: Constitution\u002FCovenant\u002FLedger\u002FGate\u002FVERIFY), rewrite it as natural sentences that keep the facts (\"Rust core, one static binary… the core handles the store, a tamper-evident ledger, config validation…\").\n- **Pitfall — a \"wrong online version\" is usually an UNPUSHED branch.** Before\n  editing a README (or any doc) the user says looks wrong online, count the\n  unpushed commits (`git log --oneline origin\u002Fmain..main | wc -l`) and check\n  `git status -sb`. Local main can be many commits ahead (this session: 76) while `origin\u002Fmain` shows a stale version with old content (Python, owner name, missing citations). The on-disk copy was already correct; the real fix was PUSHING. Pushing N commits is a meaningful action — get explicit go-ahead first, then `git push origin main` and verify sync (`git status -sb` shows no ahead\u002Fbehind) + confirm the remote branch via `git show origin\u002Fmain:README.md`.\n\n## Two-harness coexistence (steadfaste + steadfaste-fleet)\n\nIf asked \"should the two harnesses play nice \u002F can they coexist,\" the answer is **good neighbors, never a merged system**: steadfaste is the eventual target core, steadfaste-fleet is the incumbent fleet. Keep them SEPARATE (own Postgres DBs, own ports, own config\u002Fstate dirs — steadfaste never touches `~\u002F.hermes*`, hermes never steadfaste's); decide the two real seams (skills\u002Fprompts → Model Profiles mapping; the Telegram-token decision) as boundaries, not merges; coordinate state across them in ONE direction only (steadfaste's Ledger can CONSUME hermes events via an adapter — hermes's bus never drives steadfaste's core). The migration rule: nothing committed to the incumbent is unavailable to the target, and nothing the target does requires the incumbent (\"route around hermes when it breaks\"). A steadfaste-fleet agent\u002Fworker talking to steadfaste registers as a governed worker through the secure-registration flow (`references\u002Fworker-registration.md`) — it does not get process-lineage trust.\n\n## Live-testing the governed lifecycle (verify the Wire, don't just trust unit tests)\n\nWhen asked \"test a sub-agent command with it\" (or verifying lifecycle work), drive the REAL binary with JSONL frames — the conformance tests cover the session API, not the wire loops:\n\n1. Build once (`cd core && cargo build`), then either:\n   - **stdin path** (single shot): pipe a JSONL frame sequence to `core\u002Ftarget\u002Fdebug\u002Fsteadfaste` from a Python script (`subprocess.run([...], input=frames+\"\\n\")`) and read the ACK frames back; or\n   - **socket path** (shared session): start `core\u002Ftarget\u002Fdebug\u002Fsteadfaste --serve \u002Ftmp\u002Fsteadfaste.sock &`, connect a `socket.AF_UNIX` client, send frames line-by-line, read one ACK line per frame, then `pkill -f 'steadfaste --serve'` and remove the socket when done.\n2. Frame shape: `{\"version\":1,\"kind\":\u003Clowercase snake_case verb>,\"job_id\":...,\"seq\":N,\"ts\":\u003CRFC3339 UTC>,\"trust\":\"untrusted\",\"data\":{...}}`. Kinds are the enum's snake_case names (`commission`, `started`, `progress`, `result`, `stop`, `keep_alive`, ...) — a PascalCase kind is rejected as `unknown variant` (parse error ACK, job_id empty).\n3. Assert on `data.state` and `data.ledger_len`, **never on the ACK's `kind`** — the ACK frames echo a fixed label regardless of the request kind; `data.state` (Handshake → Commissioned → Running → Result) is the real lifecycle readout.\n4. Always include the negative sequence — a governed system is proven by its rejections: duplicate `commission`, a `result` naming a foreign job id, heartbeat on a finished\u002Freleased lease. Both listeners share ONE dispatch, so expect IDENTICAL responses per step: `kind:error` with `TransitionError` or the lease errors (`JobAlreadyLeased` on a dup commission, `NotLeaseHolder` for a foreign job's advancing frame, `LeaseReleased`\u002F`LeaseNotFound` on a dead-lease heartbeat). Parity = identical kind + state + error on EVERY step — if the two transports ever disagree again, that is a regression of the shared-dispatch invariant: record it in the design-gaps ledger, never accommodate it in the probe. A success-only script proves nothing. An error ACK does NOT prove the state didn't move — verify from the NEXT step's observed state, never from the error alone. Even a REJECTED attempt is appended (auditable): `ledger_len` grows on a refused action, so assert `data.state`\u002F`kind`, not that `ledger_len` stayed put. And when re-running a stored probe after a legitimate behavior change, re-derive its expectations (which frames answer, expected states) from the NEW behavior FIRST — stale hardcoded expectations make a PASS read as a FAIL and send you debugging the wrong thing.\n5. **Plain heartbeats are `keep_alive`, not repeated `progress`.** Every governance kind advances the lifecycle, so a second `progress` from the same state is a TransitionError, not a no-op; `keep_alive` is the passive lease-renewal verb. Reserve `progress`\u002F`started`\u002F`result` for actual state transitions.\n6. **Verify both wire listeners separately** — the stdin loop and the `--serve` loop are separate code paths that CAN diverge (the serve loop has lagged the stdin loop on lifecycle mapping). A green stdin run does not prove the serve path; drive both with the same frame sequence before claiming parity.\n7. Cleanup: kill the serve process and remove the socket file in the same session — a stale `\u002Ftmp\u002Fsteadfaste.sock` makes the next `--serve` start look successful while clients connect to a dead listener. `pkill -f 'steadfaste --serve'` from a bash tool call can SIGTERM the tool's own wrapper shell (pattern matches it) — verify with a socket `connect()` instead and clean the socket file separately.\n8. **Promote a probe that must stay into a cargo integration test in the owning crate** (`core\u002Fcrates\u002Fsteadfaste\u002Ftests\u002F…`): spawn the real binary with `Command::new(env!(\"CARGO_BIN_EXE_steadfaste\")).arg(\"--serve\")`, poll-connect the socket until it accepts (never sleep blind), give EACH test a unique socket path — tests run in parallel, and two tests deriving one path from the pid collide and fail with `ConnectionReset` mid-sequence — and clean up in `Drop` (kill + wait + remove socket). A manual Python probe explores; the committed integration test is the regression net.\n9. **Grep the dispatch arms (`SessionManager::dispatch`) before trusting a documented verb.** An unmapped kind falls into the passive `_ => Ok(self.state())` arm, which ACKs it as OK while touching nothing — exactly how `keep_alive` silently stopped renewing leases while the docs called it the passive lease-renewal verb. A new verb needs an explicit match arm plus a test for the dead\u002Funknown-lease case.\n\n**Wire findings that touch the single-writer dispatch story get RECORDED, not patched.** When live testing surfaces a cross-listener divergence that changes the dispatch\u002Fownership design, add a row to the findings ledger (`docs\u002Fdesign\u002Fdesign-gaps.md`, the ID | Sev | finding | status\u002Fwhere-it-lands table style), point the `build-tasks.md` header at it, and leave the design decision to Luke — the design-first gate applies during build too. Fix in the same cycle only the unambiguous defect (a documented verb that silently no-ops), with its conformance test. **Write each finding row from the probe transcript, not from the design intent** — cross-check the claimed mechanism against the observed step sequence (an error followed by a still-advancing state proves the mutation happened despite the error) before committing the row; a row narrated from the intended design has claimed \"rejected before touching state\" when the probe had just proved the opposite, and had to be rewritten before commit.\n\n### When a recorded finding becomes a build task — unify, don't accommodate\n\nWhen Luke says continue on a recorded divergence, the fix direction is **unify the dispatch, never accommodate per-transport**: two transports of one core answering the same frame differently get ONE shared dispatch function both call — per-transport patches that make observed outputs match just re-create the divergence on the next verb.\n\n- **Gate before mutate, record the refusal.** An ownership\u002Fauthorization gate runs BEFORE the state transition; the refused attempt is still appended through an append-only path (auditable), and the error names the actual failure (a dedicated `NotLeaseHolder` variant, not a reused `JobAlreadyLeased` — a wrong error name sends clients debugging the wrong thing). A gate placed after the mutation protects nothing.\n- **Carve exemptions from pinned tests, not intuition.** Before adding a gate, grep the existing test suite for legitimate flows the gate would refuse (the pinned stop-after-failed → Closed client test forced the one exemption: sealing an already-terminal session is record-keeping, not work). Each exemption stays pinned by that existing test.\n- **Layer the verification: unit conformance first, live probe second.** RED→GREEN the gate at the SessionManager level (state unmoved + attempt appended + the holder still lands), then re-run the live parity probe to prove the transports stayed in lockstep — the unit test proves the rule, the probe proves the wiring.\n\n## Pitfalls that recur on the steadfaste repo\n- **A shared doc-freshness hook may expect a `docs\u002FDOCS-INDEX.md` that steadfaste does not have.** Its canonical doc map is `docs\u002FREADME.md` (which IS updated). Do NOT invent a parallel `DOCS-INDEX.md` to placate the hook — that is a second source of truth and bloat. Recognize it as a mismatched steadfaste-fleet hook expectation and leave it (or flag scoping the hook to steadfaste's real index — the operator's call).\n- **After a hardening fix, historical gap-analysis docs go stale.** If a hardening pass fixes a design gap in the live docs (e.g. Ledger HMAC → unkeyed SHA-256 + Ed25519), a *historical* gap-analysis doc that still documents the OLD design as an open gap is now partly wrong. Leave a pure historical record as-is, but flag the staleness rather than silently propagating the old design as current; update any CURRENT doc, never the historical one.\n- Always confirm sync after a push with `git status -sb` (no ahead\u002Fbehind) and `git show origin\u002Fmain:\u003Cfile>` on the shipped file.\n- **Open the governance cycle BEFORE the first `terminal` call.** The lock is\n  repo-scoped and the enforcer blocks `terminal` for ANY command inside\n  `~\u002Fsteadfaste` — even a read-only `ls`, `git status`, or `find`. `read_file`,\n  `search_files`, and `skill_view` stay allowed, so survey the docs first and\n  `begin_change` the moment a shell command is needed; retrying a blocked call\n  never works.\n- **\"Exists\" means \"has files\" — never infer from a folder name or README tree.**\n  `core\u002F` holds the Rust workspace (crates under `core\u002Fcrates\u002F`), `prototype-ts\u002F`\n  holds the TS prototype, while `worker\u002F`, `web\u002F`, `gateway\u002F`, `packaging\u002F`,\n  `governance\u002F`, `test\u002F`, and `config\u002F` remain EMPTY placeholder directories;\n  git does not track empty dirs, so a folder in the designed tree need not be on\n  disk. The build advances over time, so COUNT rather than trust this\n  sentence: `for d in core worker web gateway packaging governance test config prototype-ts; do printf '%-14s %s\\n' \"$d\" \"$(find \"$d\" -type f | wc -l)\"; done` — a component's state is the file count, not the folder existence.\n- **`docs\u002Fdesign\u002Fbuild-tasks.md` lists every task TWICE — the cumulative top\n  table AND the per-story section tables — and they silently diverge.** A task\n  marked ✅ in the top table can still sit ⬜ in its Story section below, and\n  the \"Path at a glance\" story-map block at the top goes stale the moment a\n  released story's next marker isn't moved. The doc header's \"Where we are\" is\n  the agreed source of truth, so before polling a task\u002Fstatus column from a\n  section table, cross-check it against the top table + header, and when a\n  build task lands, update BOTH the cumulative row and the story-section row in\n  the same commit — never just one copy.\n- **The `build-tasks.md` \"Where we are\" test-count header is hand-maintained and\n  drifts.** Verify the true count with `cargo test --workspace -- --list 2>\u002Fdev\u002Fnull\n  | grep -cE ': test$'` — the `--list` count is authoritative; the \"N passed\" sum\n  over-inflates it because some target shards are counted more than once. To prove\n  a change is exactly +N (and catch a stale header you would otherwise propagate),\n  `git stash`, run the count (BEFORE), `git stash pop`, run it again (AFTER), diff.\n  Correct the number in the same commit rather than carrying a header that already\n  disagrees with the suite.\n- **A rejected push usually means origin\u002Fmain advanced with a PEER's work — count\n  AFTER the merge, never propagate either side's header count.** A mid-build\n  `git pull --rebase` that lands a parallel author's commit (e.g. another agent's\n  Story) will conflict on the hand-maintained count header precisely because both\n  sides rewrote it. Resolve the header by MEASURING the merged tree\n  (`cargo test --workspace -- --list | grep -cE ': test$'`) + the MERGED `test\n  result` lines, combining BOTH bodies of work, not by taking either line's \"N\".\n  **If the peer brought failing tests (e.g. live-API integration tests hitting a\n  real provider), prove they are pre-existing before claiming green**: `git show\n  \u003Cpeer-commit>:\u003Cpath> | md5sum` vs the merged file (byte-identical + your diff is\n  confined to other crates = not yours). Then put the HONEST number + a named\n  caveat (\"4 pre-existing `live_jev` live-API tests fail without a valid key\") in\n  the header — a header that claims all green while the suite is red is a lie\n  that misleads every reader. A peer's live-API failure is that peer's domain;\n  document + flag it, do not silently fix it into your unrelated slice.\n- **Adding a wire\u002Fsurface type is now SCHEMA-FIRST, not hand-edits.** CG1–CG4\n  and surface Slice 0.3 built the generator (`abi-codegen`), which is the\n  primary path: `abi.schema.json` (and `surface\u002Finterface.schema.json`) carry an\n  `x-rust` block per `$def` (rename_case, integer widths, field order,\n  Option-ness, serde attrs) + a `description` (the semantic freeze), and the\n  shape files (`abi\u002Fsrc\u002F*.rs`, `surface\u002Fsrc\u002Freads.rs`\u002F`verbs.rs`) are GENERATED\n  from them with a `GENERATED — DO NOT EDIT` banner. To add a type: (1) add the\n  `$def` with its `x-rust`; (2) register it in `abi\u002Ftests\u002Fschema_complete.rs`\n  (`WIRE_TYPES` for a Rust type, `DATA_PAYLOAD_DEFS` for a `*_data` payload);\n  (3) `cargo run -p abi-codegen` (or `-- --target surface`) to regenerate;\n  (4) STILL hand-update the golden\u002Fparity fixtures\n  (`tests\u002Fgolden\u002Fabi_parity.golden.json`, `all_event_types()`, `roundtrip_upper`)\n  — the generator does NOT emit those. The committed-match + idempotence tests\n  (`abi-codegen\u002Ftests\u002F`) and the CI `git diff --exit-code` gate then enforce no\n  manual divergence. Grep the variant name across `core\u002Fcrates\u002Fabi\u002F` before\n  declaring an add complete — an \"already covered, additive\" claim is only safe\n  after reading the live schema+enum.\n- **Any new `$def` in `abi.schema.json` MUST be registered in `abi\u002Ftests\u002Fschema_complete.rs`\n  (the CG1.2 inventory guard) or `every_schema_def_is_accounted_for` fails the suite.**\n  The guard's `WIRE_TYPES` lists Rust wire types by PascalCase name\n  (`Kind`, `Frame`, `ReviewVerdict`, `JudgmentData`, `JudgmentAnswer`); a `$def`\n  with no Rust struct (a `*_data` payload) goes in `DATA_PAYLOAD_DEFS` keyed to a\n  data-carrying `Kind`. The `$def` NAME must match the Rust type exactly: a\n  `snake_case` `$def` like `judgment_data` against a `JudgmentData` struct breaks\n  the guard (it looks for the PascalCase wire-type name in `WIRE_TYPES`). This\n  guard is a LATER addition than the golden\u002Fparity lists — a new wire-shape commit\n  must touch it too, and the enum+golden+parity list in the pitfall above is no\n  longer sufficient on its own.\n- **After a `git pull --rebase` that re-merges `abi.schema.json`, grep for\n  DUPLICATE `$def` keys and stale cases BEFORE trusting the schema.** When a\n  parallel branch\u002Fcommit also edited the schema (upstream CG1.1 did), git\n  auto-merges by line and can leave two `WorkerRole` defs (our `\"judge\"` version\n  plus upstream's `primary\u002Fcritic`) or one def under a stale case. JSON with\n  duplicate keys parses but the LAST wins — a silent behavioral change. Fix by\n  consolidating to one canonical def (the one carrying every member) and confirm\n  `schema_complete.rs` still accounts for every key. Run\n  `python3 -c \"import json;json.load(open('core\u002Fcrates\u002Fabi\u002Fabi.schema.json'))\"`\n  won't catch a duplicate-key collision; grep for the key count instead.\n- **The pre-commit secret-leak detector flags the frozen `abi.schema.json`\n  `\"$schema\": \"https:\u002F\u002Fjson-schema.org\u002F…\"` line as a \"non-placeholder domain\".**\n  That is a non-blocking false positive (it is the JSON Schema draft URI, not PII).\n  Do not \"fix\" the URI or add an ignore — the warning is cosmetic and the commit\n  lands.\n- **Any design that puts model probabilities, confidence, or scores on the\n  Ledger as decimals is unappendable.** `canonical_json` rejects every IEEE-754\n  float (`CanonicalError::FloatRejected`, pinned by `ledger\u002Ftests\u002Fentry_hash.rs`\n  + `edge_cases.rs`). Quantize at the *schema* boundary, not by the consumer:\n  integer parts-per-million (`u32`, 0–1,000,000); every distribution sums to\n  exactly 1,000,000 (largest-remainder residual); raw provider bytes ride by\n  hash, never inline. This is what `judgment-abstraction.md` got wrong (Jev\n  `noul: 0.87` could never append) and why `machine-native-substrate.md` §4.3\n  quantizes to ppm.\n- **The machine-native \u002F judgment layer is owned by\n  `docs\u002Fdesign\u002Fmachine-native-substrate.md`; MN0–MN3 have SHIPPED, MN4–MN7 are the\n  remaining slices.** Shipped: MN0 (`WorkerRole::Judge` in `abi\u002Fsrc\u002Freview.rs`,\n  `judgment_data`\u002F`JudgmentAnswer` in `abi\u002Fsrc\u002Fjudgment.rs`,\n  `EventType::JudgmentRendered`; the CG2 shape\u002Flogic split keeps `validate()` +\n  `judge_commission()` in `judgment_policy.rs`), MN1 (`Constitution::judgment()\n  append`), MN2 (`constitution\u002Fsrc\u002Fdecision_class.rs` compose grammar —\n  `compose(floor,a) ≥ floor`, untrusted-never-clears, undecidable-escalates),\n  MN3 (`calibration_fold` in `ledger\u002Fsrc\u002Ffold.rs`). When asked to build the apply\n  step of compose, the surface judgment reads, the autonomy dial, the judge\n  adapters, or a judge baseline battery, start at §6's slice table — the design\n  (invariants MN-1..MN-10, output classes, Decision Classes) is settled.\n- **The concrete, tested Jev integration patterns live in\n  `docs\u002Fresearch\u002Ften-levels-of-jev-2026-09-30.md`** (digest of\n  `disler\u002Ften-levels-of-jev`: 30 Jev use cases in 10 levels). When asked how Jev\n  integrates into steadfaste, or to wire a Jev gate\u002Froute\u002Fcheap-read, start there:\n  it maps each level onto the machine-native design (what VALIDATES, what BORROWs\n  — hook placement at tool_call\u002Ftool_result\u002Fturn_end, cheap file reads, parallel\n  fan-out — and the deliberate divergences: weights-in-code and agent-authored\n  questions are forbidden by the compose grammar \u002F MN-3). It also records Luke's\n  cost posture: Pi (`@earendil-works\u002Fpi-coding-agent`) as the coding agent + Jev\n  for judgment + offline coding (`offline_code`\u002F`qwen2.5:3b`) for generation.\n- **The coding-agent model-cost routing design lives in\n  `docs\u002Fdesign\u002Fcoding-cost-routing.md`** (pi → Jev \u002F offline \u002F other at the\n  lowest honest model cost, commissioned by the Steward over the Telegram\n  gateway). When asked how coding work should route models, or to wire the pi\n  harness's cost layer, start there: a three-tier resource model (T0 Jev\n  judgment ~$16.80\u002Fmillion, T1 offline_code+qwen2.5:3b codegen at $0 marginal,\n  T2 hosted workhorse, T3 hosted reasoning), a governed four-class routing\n  Decision Class (BOUNDED\u002FROUTINE\u002FCOMPLEX\u002FCREATIVE → cheapest capable tier, per\n  MN-3 the question is the policy), five Jev judge-worker hooks in the pi loop\n  (routing classifier, destructive-command gate, compaction scoring, cheap file\n  reads, output screening), and monotone-toward-caution failover (never downgrade\n  a tier, fail closed to the Steward on undecidable). The routing classification\n  is itself a Jev `choice` — it never costs an LLM call; the verbosity tier rides\n  the same routing (BOUNDED→MINIMAL … CREATIVE→FULL). The core routing module is\n  BUILT (`core\u002Fcrates\u002Fconstitution\u002Fsrc\u002Frouting.rs`: `route_for_class` \u002F\n  `route_from_answers`, provider-neutral — takes `JudgmentAnswer`, never a Jev\n  handle — fail-closed undecidable\u002Funknown\u002Fmissing → T3); the CR0–CR7 build\n  track (one test owned once) is in `build-tasks.md`. **pi install:**\n  `npm install -g @earendil-works\u002Fpi-coding-agent` — requires Node `>=22.19.0`,\n  NOT Node 24 (Node 24 was only the ten-levels repo's own TS requirement, not\n  pi's).\n- **Neither pi nor Jev is load-bearing — both are swappable behind adapter seams\n  (a standing design rule: \"easy swappability and interoperability is very\n  important\").** A coding agent (pi) is ONE adapter behind a GENERIC\n  coding-worker event interface (`on_tool_call`\u002F`on_tool_result`\u002F`on_turn_end`\u002F\n  `on_context_gather`\u002F`on_output`) — the Jev hooks are defined against that\n  interface, never pi's extension API; pi maps its own events onto it and is the\n  reference adapter. A judgment model (Jev) is ONE provider behind the judgment\n  client (`decide(class, state, questions)`), resolved from config — Jev\u002Fvon\u002F\n  own-model are provider profiles (swap = base_url + api_key + model_id; tier\n  gating + shadow gate unproven providers). No consumer code hard-references pi\n  or Jev. Interop test: swap the harness, swap the provider — the governed\n  pipeline behaves identically.\n- **A record that a downstream fold\u002Freport JOINs on must carry its join key\n  whenever it can reach a calibratable (outcome-bearing) state — refuse an\n  unlinked record loudly, never append it as a silent orphan.** The\n  `calibration_fold` in `ledger\u002Fsrc\u002Ffold.rs` joins each escalating judgment to the\n  same job's later `ratified`\u002F`veto` via `job_id`; if `judgment_entry` wrote\n  `job_id: None`, every escalating judgment would be counted as `no_outcome`\n  forever and nothing would explain the gap. So `Constitution::judgment()`\n  REFUSES an escalating-but-jobless judgment (`HandleError::EscalationUnlinked`,\n  nothing appended) — a loud defect with its own test (escalating+None refused,\n  shadow\u002Fproceed+None ok, escalating+Some linked). General rule: when you add a\n  fold or report that links records by a key, make the WRITE of that key\n  fail-closed for the records the fold depends on, and give the missing-key\n  error a distinct variant so the caller sees WHY, not a generic failure.\n- **Verify a peer's cited docs exist on THIS checkout before propagating them.**\n  A parallel agent\u002FOpus may cite `steward-tui.md`, `baml-evaluation.md`, or a\n  commit hash that live only on its own branch\u002Fworktree, not `main` — `search_files`\n  for the cited path before baking it into a doc, and cite the real source\n  (`core-interface.md` §7\u002F§8 held the TUI and \"judgment runs as a governed\n  worker\" rules here) instead of the phantom one.\n- **A governance verb (stop\u002Fveto\u002Fdirect) must never hard-code a `job_id`, `seq`,\n  or `ts` — it targets the job the caller actually holds.** The Steward TUI's\n  `stop()` shipped `job_id: \"job-1\"` with a fixed `seq: 1` and a constant `ts`;\n  since the TUI's job counter starts at 2, the emergency stop fired at a job\n  that was never commissioned. Track `current_job` + a per-job sequence in the\n  client state, timestamp with a now() helper, and keep that logic in the\n  crate's `lib.rs` (testable without a terminal) rather than in the interactive\n  `main.rs` rendering loop. When fixing a client\u002FTUI bug, extract the pure\n  decision into the lib so it can be TDD'd; the rendering loop should only wire\n  I\u002FO and input.\n\n## The doc-corpus shape (current vs historical) — keep it this way\n\nThe corpus is organized so a PM, a builder, and an auditor each get an ordered\nreading path, and no reader has to guess what is current:\n\n- `docs\u002FREADME.md` is **the map and the ONLY index** (never create a parallel\n  `DOCS-INDEX.md`): three reading paths, a `Status` on every current doc, \"the\n  system in one screen\", and a current-vs-historical table.\n- **Every current doc opens with one line:** `> **Status:** \u003C…> **Audience:** \u003C…> **Pairs with:** \u003C…>`.\n- `docs\u002Fdesign\u002Fcore-build-blueprint.md` is the **BUILD-READY v1 contract** — the\n  doc stories and slices are cut from (§5 conformance tests, §6 scope line, §7\n  build order). `docs\u002Fdesign\u002Fstory-slices.md` is the **current story\u002Fslice plan**\n  cut from it (vertical stories, each conformance test owned once; supersedes\n  `docs\u002Fhistorical\u002Fstory\u002Fcoding-agent-story.md`). `docs\u002Fdesign\u002Fdesign-gaps.md`\n  is the **open\u002Fresolved ledger** and the single place that lists what must\n  close before Story 1.\n- **Superseded material MOVES to `docs\u002Fhistorical\u002F`** with a header saying it is\n  historical, what supersedes it, and which of its ids stay canonical (e.g. the\n  build-readiness review's `B-S1.x` ids).\n- **Fix contradictions where they live, never annotate them:** a stale verdict\n  (\"NOT build-ready\"), a stale count (`27 truths` when §0 has 35), or a stale\n  status line (\"do not write code against this\") misleads every future reader.\n- **Recount every number from the file that owns it; never trust a summary\n  line.** A doc header claimed \"15 governing truths\" while `spec\u002Fcore-spec.md` §0\n  held 35 — count the entries in the owning file\n  (`awk 'NR>=\u003Cstart>&&NR\u003C=\u003Cend>' \u003Cfile> | grep -cE '^[0-9]+\\.'`), then grep the\n  whole corpus for every other restatement of that number so they all move with it.\n\nPitfalls on a **docs-only commit** in this repo (both cost a wasted cycle):\n- The enforcer MAY block `git commit` claiming \"changes to skills\u002F, tests\u002F\" even\n  when the diff is pure markdown — when it does, load `adversarial-verifier` and\n  retry once; the pre-commit gate then reports `Adversarial verify: passed on N\n  file(s)`. It is not guaranteed: a clean docs commit can reach the same gate and\n  pass on the first try, so do not pre-load extra skills on speculation.\n- The hook prints ~11 `DOCS AUDIT … docs\u002FDOCS-INDEX.md was not updated` warnings\n  for any docs change. They are the mismatched steadfaste-fleet expectation (see the\n  pitfall above), **not a block** — the commit lands.\n\n## Prototype code changes (prototype-ts)\nBeyond docs, the repo ships a TypeScript prototype under `prototype-ts\u002F` (Bun, `bun test`, frozen core = `abi.ts` + `loop.ts`). Rules for code work there:\n\n- **TDD is enforced: RED (watch the test fail) → GREEN → full suite.** Run `bun test \u003Cfile>` per cycle and the full `bun test` before commit. Verify the demo still runs: `bun run prototype-ts\u002Fmain.ts --fake`.\n- **Config\u002Foverride convention (established):** precedence chain env var → `STEADFASTE_CONFIG` JSON file → built-in default, implemented in `prototype-ts\u002Fconfig.ts`. NEVER let the frozen core (`loop.ts`\u002F`abi.ts`) read config — the core takes values as explicit options; config is worker-side plumbing that assembles them. **Fail-closed validation:** unknown JSON keys and bad numbers throw at load time — a typo'd threshold silently falling back to a default means an operator believes a limit is tighter than it is.\n- **Run an adversarial boundary probe against the config loader BEFORE declaring config work done** — feed every env key the pathological inputs (`\"\"`, whitespace-only, `0x10`, `Infinity`, `NaN`, `1e300`, fractional-for-int, duplicate list entries, empty list entries) and verify each either throws naming the key or normalizes correctly. A plain `Number()` parse accepts seven kinds of garbage that silently disable a safety limit; the probe is the only way to see what the parser actually accepts.\n- **Settle the edge-case matrix in the DESIGN DOC before build, not just in code.** One rule covers every row: *a value that looks set must be set* (fail-closed — reject at startup with named key) or *a component that fails must degrade, not lie* (fail-safe — drop+counter, isolate the failing sink, never block the caller). Structure as tables per layer: config values \u002F runtime failures \u002F core-interface cross-refs. Luke asked for this explicitly; a design that leaves edge cases to the builder's improvisation is not settled.\n- **Fixed-interval retry sleeps synchronize contenders (thundering herd) — always full jitter.** Under N-way contention a fixed sleep wakes all waiters on the same boundary and the wave grows with each collision; this is a stability bug at the 1000-agent tier, invisible at n=1. Exponential backoff with FULL JITTER (uniform `[0, cap]`, cap = `min(base·2^attempt, timeout\u002F4)`), jitter-off mode only for debugging contention patterns. File lives as a class-level test (`lock-jitter.test.ts`) asserting cap growth + bounds.\n- **Export the module-private lock\u002Fwrapper function to run a live multi-writer contention probe** — a unit test can't prove \"no lost updates\"; a script spinning N concurrent `withLock` writers against one state file and asserting every update landed can. One `export` keyword on the wrapper is the whole cost.\n- **Technology-choice reviews for this repo: vindicate-or-fix, with the reason recorded.** Structure: (1) a table of load-bearing choices each with verdict + WHY it holds (not narratives), (2) findings FIXED this cycle with mechanism + verification, (3) observations already-owned-elsewhere recorded without action. The repo's habit of naming its own ceilings (single-writer honesty, rejected bloat with triggers, inert-until-needed) makes the audit mostly vindications — that is the goal; write the doc as `docs\u002Fdesign\u002Ftechnology-choice-review.md`.\n- **Validate by VALUE TYPE, not key-by-key:** shared helpers `intEnv` (whole numbers: ms durations, run counts, tier numbers), `numEnv` (decimal rates), `fracEnv` (0–1 fractions), `strEnv` (reject whitespace-only) — each with a strict base-10 decimal regex, a magnitude guard (>1e9 rejected: a 1e300 retention value silently disables rotation), and a named-key error. Run cross-field rules (e.g. otlp sink requires endpoint) AFTER key-level parsing so the error names the real mistake, not a downstream red herring.\n- **Every `.env.example` key must be actually wired** in the config loader — grep the loader for each var name before committing the example file. Document each key with: what it does, the sensible range, and which design doc pins the default. Known groundings: trust-tier thresholds → core-spec §4f \u002F design-gaps (b); baselining → baselining-scale-ladder zero-config row; validation gates → token-efficiency §4.6–4.9; pair-review rate → cross-agent-collusion; log verbosity\u002Fretention\u002Fsinks\u002Fsampling → observability-logging §5 + §10.1 (hot\u002Fwarm retention and rotation cap are the §10 growth numbers).\n- **NEVER `write_file` a file you are only extending (`.env.example`, append-style edits) — `write_file` REPLACES the whole file.** Draft the new section to \u002Ftmp and `cat >> file` instead; the doc-append rule exists for the same reason. After an accidental clobber, `git show HEAD:\u003Cfile> > file` to restore, then append — and verify the full key count afterwards (grep -c 'STEADFASTE_').\n- **Treat trust\u002Fvalidation thresholds as POLICY, not tuning** in analysis: they decide how much evidence trust is earned with. Deliberately NOT configurable: ABI version, tier caps (Operators ≤2), the two-seed pair-review mechanism (only the rate is a lever — schedule unpredictability is a security property). Config-request touching those = design conversation, not a knob.\n- **Before blaming your change for a failing repo test, stash and run it on a clean tree** — prototype tests can be pre-broken (test-dir import paths drifted after a repo restructure). If pre-existing, fixing it belongs in the same commit (contract rule: no known issues left unfixed), noted in the message.\n- **Test isolation: reset ALL `STEADFASTE_*` env vars in a `finally` after any expected-throw config test** — a leaked bad value poisons sibling test files that load config through the store, failing them mysteriously. One `resetEnv()` helper covering every `STEADFASTE_` key; `clearConfigCache()` after every env mutation (config is cached).\n- **Multi-line commit messages: write the message to a file and `git commit -F \u003Cfile>`.** Inline multi-line messages in a shell tool call break on quotes\u002Fapostrophes\u002Fparens and split into bogus pathspecs.\n- **After a governance gate blocks `git add A B C && git commit`, verify what actually staged before re-committing — a blocked commit can SPLIT the change.** The adversarial-verify gate can refuse the commit after the add already ran (or the add rolled back); re-adding only a subset then commits a test-only commit and leaves the source uncommitted, an intermediate HEAD that fails `cargo test`. Before retrying with a subset, check `git status` and stage the WHOLE intended set so source + test + docs land as one atomic commit. If a split already happened, repair with `git reset --soft HEAD~2 && git commit -F \u003Cmsg>` to squash the fragments back into one compiling HEAD.\n- **Nested heredocs inside a `terminal()`\u002F`execute_code` string break on quoting — write the script to a file first, then run it.** A Python patcher or TS probe containing `\u003C\u003C'EOF'` cannot be passed as an inline shell string (the inner heredoc collides with the outer string literal); `write_file('\u002Ftmp\u002Fscript.py')` then `terminal('python3 \u002Ftmp\u002Fscript.py')` always works. Same for any multi-line script with backticks or `${}` interpolation.\n- **For outside-expert model input on a design question, consult DeepSeek Pro via OpenRouter** — recipe and pitfalls (reasoning-model token budget, empty-content trap) in `references\u002Fllm-consult-via-openrouter.md`. Treat the answer as expert input to overlap-check, never as the design itself.\n- **Fetch external APIs (GitHub org listings, raw file reads) via `browser_exec`'s\n  `js()` with `fetch()`, not `terminal curl`** — a shell curl of an external API\n  can sit awaiting user consent and stall the session; the browser fetch returns\n  the JSON in one call. Parse the JSON in the same browser_exec call (json.loads\n  of the innerText). **The `fetch` must be wrapped in an async IIFE inside `js()`\n  (`js(\"(async () => {...})()\")))` — a top-level `await fetch(...)` in the\n  `browser_exec` `code` block fails with `SyntaxError: 'await' outside async\n  function`, because the code runs as a sync Python exec. Use\n  `raw.githubusercontent.com\u002F\u003Cowner>\u002F\u003Crepo>\u002F\u003Cbranch>\u002F\u003Cpath>` for raw file content\n  (with `await r.text()`), and the git trees API\n  (`\u002Frepos\u002F\u003Cowner>\u002F\u003Crepo>\u002Fgit\u002Ftrees\u002FHEAD?recursive=1` → `tree[].path`) for the\n  file list before deciding which files to read.\n- **Split any doc write that would exceed roughly 8K tokens of arguments into a\n  small initial `write_file` + successive `patch` appends** — a single oversized\n  write can be cut off mid-stream and silently not land; re-read the file after\n  each chunk to confirm where to continue.\n- **Domain-skill write gates fire per file type: first a suggestion, then a\n  hard block** (`docs\u002F*.md` → `documentation-auditing`, repo `.py` →\n  `codebase-design`). Load the named skill on the FIRST warning instead of\n  retrying or switching tools — the retried write is refused outright, and\n  each blocked attempt burns a cycle.\n\n## Docs archive regeneration\nOn request, regenerate the portable archive under a governance cycle:\n`tar czf \u002Ftmp\u002Fsteadfaste-docs-\u003CYYYYmmdd-HHMM>.tar.gz spec\u002F docs\u002F README.md`, then VERIFY the expected file is present (`tar tzf … | grep \u003Cfile>`), then deliver as `MEDIA:\u002Fabs\u002Fpath` in Telegram. Include both the byte size and the design-doc count in the report.\n\n## Surface authority: every drive verb must DECLARE its authority\n\nThe core enforces surface authority server-side (`session.rs`\n`authority_required_for_kind`): `Commission`\u002F`Ratified`\u002F`Veto` need **Partner**,\n`Direct`\u002F`Stop`\u002F`Resume`\u002F`DryRun`\u002F`Cancel` need **Steward**, worker verbs\n(`Started`\u002F`Progress`\u002F`Result`\u002F`Failed`\u002F`KeepAlive`) are ungated. The declared\nlevel rides the frame's **data** as `\"authority_level\": \"observer\"|\"partner\"|\"steward\"`;\n`extract_declared_authority` in `steadfaste\u002Fsrc\u002Fmain.rs` reads it. With no\ndeclaration the effective level is the stored lease authority, falling back to\n**Observer** — fail-closed. Symptom: an Error ACK\n`Unauthorized { kind: \"Commission\", required: Partner, actual: Observer }`.\n\n- **The raw wire `Client` declares nothing**, so anything driving it by hand must\n  put `authority_level` in the frame data itself. `SurfaceClient`\n  (`steadfaste-surface`) injects it and derives `seq`\u002F`ts` — **prefer it for any\n  drive verb**; a hand-built frame is how the TUI silently lost its authority\n  (its `commission()` and `stop_frame()` were rejected by the gate, a real\n  production break invisible to its unit tests, which only covered the lib\n  helpers).\n- **Test frames are drive verbs too.** `steadfaste-client`'s\n  `commission_gets_ack`\u002F`serve_lifecycle`\u002F`shared_session` and `steadfaste`'s\n  `wire_serve` helpers all had to declare authority; a frame builder helper is\n  the right place (inject once, not per call site).\n- **A gate's failure can be downstream.** `Lease(NotLeaseHolder)` on `Stop` was\n  *not* a lease bug — the commission that should have acquired the lease had\n  been rejected as Observer, so the test's `expect(\"commission\")` passed while\n  nothing was leased. Fix the first rejection, re-read the later error.\n- **A doc comment can contradict the code and outlive it.**\n  `dispatch_with_authority`'s comment claimed `None` → backward-compatible\n  `Steward`; the code (correctly) falls back to `Observer`. Fix the comment where\n  it lives; never \"fix\" the fail-closed code to match a stale comment.\n\n## The Telegram gateway (`core\u002Fcrates\u002Fsteadfaste-gateway`)\n\nNot the empty `gateway\u002F` placeholder dir — that holds only the Surface contract\n(`gateway\u002Fcontract.md`, interface **I6**). The crate drives the core through\n`steadfaste-surface`'s `SurfaceClient`, never a hand-built frame. Layout:\n`surface.rs` (neutral contract v1), `auth.rs` (fail-closed allowlist),\n`command.rs` (the §2.3 command→drive-verb map + `verb()`), `format.rs`\n(chunking + MarkdownV2 escaping), `dedupe.rs` (`update_id` ring), `telegram.rs`\n(adapter + `callback_data` codec + `callback_to_command`), `main.rs` (Gateway\nCore).\n\n- **A button tap must take the SAME path as the typed command** —\n  `callback_to_command` feeds the same `Command` enum, so a callback can never\n  reach a verb the slash form could not.\n- **`Checkpoint` is an `EventType`, not a v1 `Kind`** — `\u002Fcheckpoint` maps to no\n  drive verb; reply honestly rather than inventing one.\n- **Chat `ratify` must be refused until a read channel exists.** A ratify\n  certifies a specific escalation's `payload_hash`; with no `steadfaste.read.*`\n  on `SurfaceClient` the gateway cannot fetch it, and sending an invented hash\n  is a **forged certification**. Refuse and record the gap (G-GW-1).\n- **Verify end-to-end against a stub Bot API, not just unit tests.** Point\n  `STEADFASTE_TELEGRAM_API_BASE` at a local HTTP stub that serves `\u002FgetUpdates`\n  and records `\u002FsendMessage`, run the real `steadfaste-gateway` binary against\n  the real core, and assert: authorized command → reply, **unauthorized → no\n  reply at all**, callback answered, reply chunked\u002Fescaped. Env: token\n  `STEADFASTE_TELEGRAM_TOKEN`, allowlist `..._ALLOWED_USERS`\u002F`..._ALLOWED_CHATS`.\n  The gateway **refuses to start** with no allowlist (fail-closed).\n\n## Test-suite hygiene on this repo\n\n- **A single broken test file in an unrelated crate blocks the WHOLE workspace\n  suite from compiling** — one missing import (`unfreeze` in\n  `wire\u002Ftests\u002Fspawn.rs`) hides every other crate's results and makes the run\n  look like \"one failing test\". Always run `cargo test --workspace\n  --no-fail-fast` and grep `^error: test failed` for the true target list; fix\n  the compile error first.\n- **A live-API test must be OPT-IN, not triggered by an ambient credential.**\n  `live_jev` skipped only when `TYPESAFE_API_KEY` was unset, but this host has\n  one exported for unrelated tooling — so a plain `cargo test` did a live, paid\n  run against a provider that rejected it (HTTP 400 `api_usage_error`). Gate on\n  `STEADFASTE_LIVE_JEV=1` **and** the key. A test that spends money must never\n  run as a side effect.\n- **Measure the test count, never propagate it.** The `--list` count is\n  authoritative: `cargo test --workspace -- --list 2>\u002Fdev\u002Fnull | grep -cE ': test$'`.\n  After a `git pull --rebase` that lands a peer's work, re-measure on the MERGED\n  tree (the header conflicts on every parallel edit); the \"N passed\" sum\n  over-inflates. Header lived in `build-tasks.md` (\"Where we are\") and\n  `docs\u002FREADME.md` — both must move together.\n- **Probe discipline pays again: two of my own probes were wrong before the code\n  was.** (1) an assertion looked for the raw `job-e2e` in wire text that was\n  correctly MarkdownV2-escaped to `job\\-e2e`; (2) a count expected two\n  backslashes where one is right. Check the probe's own assumptions before\n  declaring a bug — the code was correct both times.\n- **The pre-commit secret-leak detector false-positives on the real Telegram API\n  base URL** (`https:\u002F\u002Fapi.telegram.org` flagged as a \"non-placeholder domain\")\n  and on the frozen JSON-Schema `$schema` URI. Non-blocking; do not \"fix\" the\n  URL or add an ignore.\n","# steadfaste — architecture & design-doc work\n\n## When this applies\nAny change to the steadfaste architecture (repo `~\u002Fsteadfaste`): covenant\u002Fspec docs, design mechanism docs, grounded research reviews, the governance cycles that gate them, and the **build execution** of the frozen spec (`docs\u002Fdesign\u002Fbuild-tasks.md` → the BUILD\u002FCHECK split). This is the fleet owner's (Luke) product: **settle the design before building** — the design docs are the deliverable, not code. Core = the Constitution (unamendable Rust core) + Covenant (bond of trust); Agent\u002FWorker\u002Fharnesses\u002Fgateways are all swappable behind it.\n\n## Standing preferences (Luke)\n- **Settle design first, thoroughly.** \"Take your time, no rush to build.\" Build only after a design looks bulletproof. Ground every claim in primary sources (read real docs\u002Frepos; mark UNKNOWN rather than guess).\n- **DESIGN-FIRST GATE: \"research X for the interface\" means write a design doc, NOT code.** Even when the request mentions an interface\u002FAPI, and even if you already have a RED test written — the deliverable is a thorough design doc unless Luke explicitly says implement\u002Fbuild. If you catch yourself writing implementation files for a design request, delete them and write the doc. Luke has corrected this mid-task; a half-built implementation is wasted work, the design was the ask.\n- **\"Research X\" = consult the expert model directly (DeepSeek Pro via OpenRouter), not vendor-doc browsing.** When Luke names a model\u002Fprovider as the research source, prompt it via the OpenRouter API with the concrete design question — crawling the vendor's docs site is the wrong path. Ground the doc in what the consult returned, marking UNKNOWN what the consult could not confirm.\n- **Every new subsystem design doc must state explicitly: (1) its relationship to the Ledger — which stream it is, what it must never touch, the wall between it and the single writer; and (2) its scale-ladder placement — zero-config at 1 agent, inert-until-needed heavy paths, per-tier operator steps.** Luke checks these first; a doc missing them reads as unreviewed.\n- **When Luke interjects a mid-task correction, pivot immediately after the current tool result** — do not push the interrupted path to completion first. Corrections arrive as narrow one-line messages and each narrows the deliverable (design-only, organize with the corpus, must not interfere with the Ledger); the interrupted path's remaining work is now waste.\n- **Keep the core pure\u002Ffocused.** Design an *interface* when it serves the product's GTM (enterprise deal-opener); DEFER adapters\u002Ftransports\u002Fimplementation until a client or deal demands it (anti-bloat). Never let external policy\u002Fadapter become an authority over the Law.\n- **Current vs historical separated.** Current docs live in `spec\u002F` + `docs\u002Fdesign\u002F` + `docs\u002Fresearch\u002F`; stale\u002Fone-off artifacts move to `docs\u002Fhistorical\u002F`. Keep every doc listed in `docs\u002FREADME.md` map.\n- **Anti-bloat test for any new surface:** \"is this needed to govern well, or is it a client wanting to be pretty \u002F a feature that loses the core?\" The latter is out of scope.\n- **Verify-before-add, even on the user's own idea:** when Luke proposes adding a capability, do NOT fold it in just because he asked. First overlap-check it against the settled concepts (a per-model bundle vs PromptState\u002Finject-prompt vs Charter\u002Flevers vs the reputation permutation — complementary, not redundant), state the overlap analysis, then add it with the invariants that keep it safe. Show the verification was done, not just that you complied (\"don't just do it because i want it... verify this makes sense with our system\").\n- **Judge \"do we need steadfaste-fleet concept X here?\" by comparing topologies, not by presence:** bus\u002Fbrain existed in hermes because it is a FLEET of autonomous agents with independent state; steadfaste is ONE accountable core + swappable isolated workers + the Ledger as single truth. A capability whose purpose the opposite topology already serves (coordination → the single-writer Ledger; knowledge → Ledger + Model Reputation Library) is a DELIBERATE EXCLUSION, and the exclusion is recorded as a reasoned decision, not an omission.\n- **Scale ladder governs scope:** features are sized so \"easy at 1 agent\" needs zero config, and heavy machinery (mTLS, consensus, PgBouncer, sharded writer) is REJECTED for small scale with the exact tier+trigger to reconsider. The 1000-agent path must be an EXTENSION of the 1-agent path, never a rewrite.\n\n## Procedure (every design change)\n1. Open a governance cycle: `begin_change`.\n2. Write\u002Fappend the design doc (see doc-writing pitfalls).\n3. If the doc is one the docs map lists, add it to the `docs\u002FREADME.md` map row.\n4. Commit with a message that states: the design decision, the grounding\u002Fsources, and the scope line (v1-build vs designed\u002Fdemand-gated vs never\u002Fanti-bloat).\n5. `feedback_accept(cycle_id)` then `end_change(task_id)`.\n\nPitfalls in the procedure:\n- **Subagent writes are ALSO governance-gated**, even into `\u002Ftmp`. Subagents must open\u002Fclose their own cycles; writes are refused until they do.\n- **Known MCP arg-drop**: `begin_change`\u002F`inbox_send_task` intermittently serialize EMPTY args. Retry 2–3x max, then report the blocker — don't loop.\n- Successfully draining the research fan-out does NOT close the work: synthesize findings into a doc under your own cycle before reporting.\n\n## The grounded research \"party\" pattern\nFor \"are we design-right \u002F is it bulletproof\" reviews, dispatch PARALLEL subagents via `delegate_task`, one task per DOMAIN CLUSTER, each instructed to read that domain's PRIMARY docs and return structured findings. Synthesize into a research doc under your own governance cycle.\n- Use a fixed verdict vocabulary per system: **VALIDATES \u002F BORROW \u002F GAP-RISK**, each = a one-line finding + the mechanism, not a narrative.\n- If a subagent returns only PART of its assigned set, re-dispatch the missing cluster — do not assume a partial result is complete (one fan-out returned only 1 of 3 clusters; the rest had to be re-dispatched).\n- Ground in repo READMEs\u002Fofficial docs; mark UNKNOWN explicitly, never fabricate.\n- Reuse the standard task-prompt + output schema: `references\u002Fresearch-party-schema.md`.\n\n### The \"frozen for years\" hardening review (interface-freeze + cross-OS + adversarial sweep)\nWhen the goal is \"core\u002Finterface rock-solid and UNCHANGEABLE for years\" (also: a platform that cannot be tested yet, e.g. a PC\u002FWindows port), run a 3-DEEPSEEPRO-PASS hardening party in addition to any design review:\n- **LA — frozen-interface integrity:** what breaks an additive-only interface over 3+ years. Key findings to check for: shape-freezed but MEANING-drifting fields (semantic-freeze layer — pin prose definition + invariant fixture per field, not just a type); codegen-from-schema must be the PRIMARY path (parity-testing only DETECTS drift, it does not prevent it); version-negotiation in the handshake (negotiate frame version, not just capability scope); deprecation calendar + compat matrix + wire-visible payload versioning; unknown-type-IGNORE must be scoped to telemetry (must-understand content rides `kind`, never the ignorable channel).\n- **LB — cross-OS forward-design:** decide the interface amends NOW for the untestable OS so the port cannot break the frozen contract later. The decisive mechanism: a **`platform_caps` capability declaration** on both handshakes (freeze\u002Fkill\u002Fegress_revoke\u002Fcontainment\u002Fpath_style enums) so \"stop\" is declared per-host rather than assuming POSIX SIGSTOP (Windows has no SIGSTOP — the guarantee must read \"freeze if the host can freeze, else atomic tree-kill ~500ms\"). Separate DECIDE-NOW (declarations, additive) from DEFER (pure plumbing).\n- **LC — adversarial final sweep:** 11-finding sweep for logic contradictions across docs (e.g. single-writer vs federation — pin ONE designated writer-core, others submit), security holes in the n-arrow cases (egress-proxy revocation must DROP ESTABLISHED connections not just update the allowlist; emergency-stop must kill pid-namespace-init or cgroup.kill, NOT process-group, or setsid\u002Fdouble-fork escapes; Ledger HMAC with a fleet-shared key is forgeable — use unkeyed SHA-256 chaining + Ed25519-verifiable checkpoints), and seed-pinning (use TWO seeds: a RECORDED reproducibility seed + an UNRECORDED anti-gaming CSPRNG, or colluders predict pair-review).\n- Synthesize all three into one research doc with a concrete \"before the freeze ships\" action list. Do dependencies explicitly (HMAC fix precedes verify-from-checkpoint; two-seed precedes collusion defense).\n\n### The scale-ladder design shape (\"easy for the 1\u002F2\u002F10\u002F1000-person\")\nWhen sizing a feature\u002Farchitecture for adoption, structure it as a 4-rung scale ladder — produce per-rung (persona, topology, what \"easy\" means, the zero-config default, which gaps bite hardest), plus the complete gap-accommodation table marking each gap **BUILT-IN (v1, zero config) vs SCALE-UP-GUIDANCE (tier + concrete operator step)**, and a what-changes-per-rung (automatic vs operator-decides) summary. The honesty rule that governs it: a small deployment must never inherit heavier machinery it doesn't need, and the 1000-agent path is an EXTENSION never a rewrite — test: \"if the 1-person must touch a knob to get an honest answer, or the 1000-person must rewrite to add capacity, it's broken.\" Performance\u002Fsingle-writer\u002Fconsensus items marked \"BUILT-IN\" that are actually load-dependent are wrong-axis errors — code path may exist in v1 but lie INERT at n=1, activating on demand.\n\n## Story & slicing the build requirements (v1 → vertical stories)\n\nWhen the ask is \"story and slice the requirements\" (Luke, recurring — planning\nthe build in user-valuable slices before code), the deliverable is a vertical\nstory\u002Fslice plan doc under `docs\u002Fdesign\u002F` (current plan:\n`docs\u002Fdesign\u002Fstory-slices.md`), cut from the BUILD-READY blueprint — NOT the\nblueprint's §7 crate order presented on its own, and NOT the old\nPi-vocabulary story (`docs\u002Fhistorical\u002Fstory\u002Fcoding-agent-story.md`, superseded).\n\n- **Slice by covenant promise, vertically.** Each story crosses Wire framing →\n  Constitution → Ledger and lands as a demonstrable, user-visible governance\n  outcome (a verdict, a stop, an audit, a kept promise). \"Done\" for a story =\n  its owned conformance tests (blueprint §5) green against the real pipeline.\n- **The done-map is the discipline:** every conformance test is owned by EXACTLY\n  one story. Reproduce the test→story table so nothing is owned twice and\n  nothing is unowned; that table is the single source of truth for \"which tests\n  ship with which story.\"\n- **One deliberate horizontal substrate first.** The core is a single Rust\n  binary assembled crate-by-crate, so the first story is the substrate that\n  freezes and proves the two halves named \"core & interface\": the Wire ABI\n  (one `abi.schema.json`, codegen primary, byte-parity, handshake fail-closed)\n  and the Ledger (hash chain + single-writer, verify-on-read). State explicitly\n  WHY it is the one non-user-valuable horizontal — it IS the core+interface;\n  nothing downstream is testable honestly until the loop exists.\n- **Map to §7** in a table so the vertical (stories) and horizontal (crate\n  build) views agree; order stories by dependency (substrate → run →\n  verification needs ride later stories).\n- **Stay faithful to §6 IN-scope** plus the anti-bloat test: a slice that is\n  data → a Ledger fold\u002Fview; judgment → a governed worker over the ABI;\n  enforcement → a core gate; a client wanting to be pretty → a client of an\n  interface, never core. Project v1.1+\u002Fv2 (surface, gateway, fleet) separately\n  as DESIGN, marked not-core-blockers.\n- **Per story:** As-a\u002Fso-that framing, Given\u002FWhen\u002FThen acceptance (one happy +\n  one error scenario), INVEST, dependencies, and a scale note — the\n  `story-decomposition` vertical-slicing discipline applied to a governed\n  monolith.\n- Register the new doc in `docs\u002FREADME.md` CURRENT table; note it supersedes the\n  historical story.\n\n## Executing the build — the BUILD vs CHECK split\n\nThe build is a frozen-spec implementation (`docs\u002Fdesign\u002Fcore-build-blueprint.md`)\ndriven top-to-bottom through `docs\u002Fdesign\u002Fbuild-tasks.md` — numbered tasks, each\ntagged BUILD or CHECK, with a status column. The split is the whole discipline:\n\n- **BUILD = mechanical shape\u002Fwiring** (a struct, an enum, a DDL). The compiler\n  + a happy-path test catch the errors. **Delegate BUILD to subagents**\n  (`delegate_task`), in parallel where independent, and verify their self-report\n  against real `cargo test` output before trusting it (a subagent's \"done\" is a\n  claim, not proof).\n- **A subagent transcribes your spec LITERALLY — your spec's bugs become its\n  bugs.** A missing `rename_all` or `skip_serializing_if` in the type spec you\n  hand over is copied verbatim into the output, and the subagent will not catch\n  it because it followed you faithfully. Review delegated output against the\n  codebase's own wire conventions (the serde pitfalls above), not just\n  diff-check it against your own prompt — the spec author and the reviewer must\n  be different eyes.\n- **CHECK = a security guarantee** — the conformance tests plus the\n  canonicalization \u002F tamper \u002F stop \u002F redaction \u002F replay functions they prove.\n  Silent-when-wrong; a weak model must never write them. **Do CHECK tasks\n  yourself** (the strong model). Stop before each CHECK, commit the accumulated\n  BUILD work, and report for strong-model review. Never hand a CHECK to a\n  subagent.\n- **Drive autonomously, top-to-bottom.** The owner should only have to say\n  \"continue\" — not re-prompt per task. Do CHECKs yourself, delegate BUILD,\n  commit each task, and report the next task to hand off.\n- **Session-tail handoff, not in-session slicing.** When the next phase is a\n  large build and this session is already long, stop after the survey: close\n  the cycle and emit a SELF-CONTAINED handoff prompt instead — repo state\n  (HEAD + green test count), what exists vs what doesn't, the task table with\n  BUILD\u002FCHECK tags, and the TDD\u002Fgovernance\u002Fcommit rules a cold session needs.\n  Hand it to the owner verbatim for a fresh session (\"Don't slice yet — give\n  me a prompt for another session to do it\", 2026-09-23; the fresh session\n  then built Story 7 end-to-end off that prompt).\n\n**One task = one file (or one tightly-coupled pair) + one test + one RED→GREEN\ncycle.** Never batch unrelated edits. After every task, `cd core && cargo test`\nmust be full-suite green before commit.\n\n- **Every task — BUILD and CHECK alike, and including delegated output — closes\n  with edge-case tests and an adversarial review.** This is a standing operator\n  directive, not a per-task request: probe the boundaries (empty input, integer\n  extremes, malformed\u002Fwrong-typed input, reordered\u002Fduplicate data) and attack the\n  implementation's assumptions with a scratch probe rather than reasoning from\n  memory. A finding becomes either a fix (a panic path, a lenient parse) or a\n  pinned fail-closed test — never a silent acceptance. **For a typed-probability\n  threshold gate (a verdict split at a LM\u002FHI band), pin the EXACT seam values\n  both sides of every threshold and the type extremes** — `LO-1`, `LO`, `HI`,\n  `HI+1`, and the domain limits (`0`, `1_000_000` ppm), plus the wrong-typed\n  answer failing closed. Representative middles (a confident-low, a confident-high,\n  a mid value) pass while the inclusive\u002Fexclusive edge is silently wrong; a\n  security gate's contract IS the seam.\n\n**A hand-written `validate()` on a typed record must bound EVERY numeric field,\nnot just the ones the happy-path example exercises.** Adversarial review caught\n`conf_ppm`\u002F`score_ppm` passing at >1,000,000 while only `p_ppm` and the\ndistribution sums were checked — the example tested a noul and a choice, never a\nscore, so the score branch's bounds were never exercised. Enumerate the record's\nfields in the validator and give each a bound (or a sum-to-exact rule), then write\none adversarial test per field that violates it.\n\n**A conformance test is expected to reveal spec-vs-code divergence.** When the\ntest fails not because the code is missing but because the code *violates the\nfrozen contract* (e.g. the spec says \"unknown `type` → ignore\" but a derived\n`Deserialize` rejects it), that is the test working. Write the test first\n(RED), then apply the minimal fix that makes the *code* match the *frozen spec*\n— you are implementing an already-settled rule, never re-designing, and never\nweakening the assertion to make the code look correct.\n\n**serde pitfalls — the abi\u002Fledger\u002Fwire crates are serde-heavy; these recur:**\n- `#[serde(deserialize_with = \"f\")]` on an `Option\u003CT>` field **overrides the\n  implicit missing-field default** — an absent field becomes a `missing field\n  \u003Cx>` error. Pair it with an explicit `#[serde(default)]`, or a frame that\n  legitimately omits the field regresses.\n- **\"Ignore unknown enum variant\" (an additive registry like `EventType`) is not\n  free** — a derived `Option\u003CMyEnum>` REJECTS an unknown variant. Write a custom\n  deserializer that maps unknown *strings* to `None` while still rejecting\n  non-string values (the malformed-known-field case). The ignore is a *policy*\n  on one field, never an `untagged` enum.\n- `serde_json::Value` from a helper that returns a temporary cannot be indexed\n  by reference (`golden()[\"kinds\"].as_object()`) — E0716 \"temporary dropped\n  while borrowed\". Bind the `Value` to a `let` first, then index.\n- **Every enum needs `#[serde(rename_all = \"snake_case\")]`** (verbs\u002Fdiscriminants\n  like `Kind`\u002F`Trust`) or `SCREAMING_SNAKE_CASE` (registries like `EventType`\u002F\n  `VerificationStatus`). A missing `rename_all` serializes the PascalCase variant\n  name (`Allow` not `allow`) — a silent wire-convention divergence that a\n  round-trip test will NOT catch (it round-trips fine) but a golden-fixture or\n  convention review will.\n- **Every optional field needs its OWN `#[serde(skip_serializing_if =\n  \"Option::is_none\")]`** — it is NOT inherited from the struct or a sibling\n  field. A struct-variant field (`GateDecision::Veto.rule_id`) serializes as\n  `\"rule_id\": null` unless annotated, violating the omit-never-null rule (LA-11).\n- **\"No float in hashed content\" detection = `serde_json::Number::is_f64()`.**\n  Probe the real parser before trusting it: `-0`, `1e2`, `1.0`, and any integer\n  past `u64::MAX` all parse to `is_f64()==true` (the last becomes scientific\n  notation — the exact non-deterministic form the rule exists to block);\n  `u64::MAX`\u002F`i64::MIN` stay exact `is_f64()==false`. Reject `is_f64()`\n  recursively over the value, before serializing. In a *test* asserting a\n  serialized record is float-free, walk the parsed JSON value checking\n  `!n.is_f64()` at every number — do NOT scan the serialized string for `.`\u002F`e`\u002F`E`,\n  because ordinary field values (\"severity\", \"verification\") contain those\n  characters and trip a false positive. The string-level guarantee is also\n  dependent on field names; the value-walk is not.\n\n**Don't let `cargo fmt -p \u003Ccrate>` creep the commit.** It reformats the whole\ncrate — including pre-existing files that were never rustfmt-clean — so\n`git status` shows unrelated `M` files. Revert the files you didn't otherwise\ntouch (`git checkout -- …`) and keep the commit to the task's own files. To\nconfirm remaining fmt diffs are pre-existing rather than yours: `git stash`,\nre-run `cargo fmt --check` on the clean tree, `git stash pop` — if the diff\npersists without your changes, leave it alone.\n\n## The codegen-primary build (abi-codegen)\n\nThe generator (`core\u002Fcrates\u002Fabi-codegen`, lib+bin) reads a schema and emits the\nSHAPE-ONLY types; two targets (`abi`, `surface`). Codegen only reproduces a\nschema that carries `x-rust` metadata — wire `enum`\u002F`properties` values alone\nrecord neither rename_case, integer widths, nor the serde attribute set, so a\nschema without `x-rust` cannot be regenerated faithfully.\n\n- **Shape vs logic split is the whole point.** The generator emits rename_all,\n  derive flags (`copy`\u002F`eq`), field order, widths, and serde attrs — nothing\n  else. Doc comments flow from the schema `description`. Logic moves OUT to\n  hand-written files: `impl Default` → `*_policy.rs`, `#[cfg(test)]` modules →\n  `tests\u002F`, projection fns → `surface\u002Fsrc\u002Fprojections.rs`. A\n  `deserialize_with`\u002F`tag`\u002F`skip_serializing_if` attribute is WIRING the\n  generator reproduces verbatim, but the function it points at\n  (`frame_policy::deserialize_ignorable_type`) stays hand-written.\n- **Field order lives in an explicit `x-rust.fields` array, never JSON key\n  order** — `serde_json::Map` is a `BTreeMap`, which re-sorts keys and drops\n  insertion order; emitting in `$defs`\u002F`properties` order scrambles struct\n  fields (a silent wire regression a round-trip test won't catch).\n- **`--target` on a cargo-built tool collides with cargo's own cross-compile\n  `--target` flag.** `cargo run -p abi-codegen --target surface` is swallowed\n  by cargo and fails on a nonexistent target triple; use `cargo run -p\n  abi-codegen -- --target surface`, and make the generator's banner\u002Fdoc\n  comments state the `--`-separated invocation, not the one cargo swallows.\n- **Never run `cargo fmt -p \u003Ccrate>` on a crate that contains GENERATED files**\n  — rustfmt reformats the generated output, which then diverges from the\n  generator bytes and fails the committed-match test; regenerate to restore.\n  `cargo fmt -p` only the hand-written crates\u002Ffiles.\n- **A generator is production code → it needs a test.** A bare `main.rs` bin\n  trips the TDD Iron Law gate (no test target); refactor to lib+bin and expose\n  `generate(schema, target)` as a lib fn so the idempotence + committed-match\n  tests can call it directly.\n- **Idempotence is the load-bearing guarantee** — fixed layout, ordered arrays,\n  no timestamps or HashMap iteration. The committed-match test (generated\n  output == committed files byte-for-byte) is the \"regenerate → zero diff\"\n  CHECK; prove it non-vacuous by hand-editing a generated file and watching the\n  test fail before trusting it.\n\n## \"Show the current design\" — the component & interface accommodation map\n\nWhen Luke asks to see the current design, or to make sure all components and\ninterfaces are accommodated, the deliverable is ONE inventory doc — not a chat\nsummary alone: `docs\u002Farchitecture\u002Fcomponent-interface-map.md`, plus a row in\n`docs\u002FREADME.md` (the only index; give it a slot in a reading path too).\n\n- **Two tables, one row per part:** components (C1…Cn) and interfaces (I1…In).\n  Every row carries: where it lives, the doc that specifies it, its status\n  (SETTLED \u002F BUILD-READY \u002F DESIGN \u002F DEFERRED \u002F STANDARD \u002F NOT-THE-PRODUCT), its\n  **relationship to the Ledger**, and its **scale rung**. Make Ledger and scale\n  *columns* — that is the pair Luke checks first, and a column cannot dodge them\n  the way prose can.\n- **State the accommodation test at the top, then apply it:** a component is\n  accommodated when it has (1) a folder home, (2) a specifying doc, (3) a named\n  interface into the core, (4) a Ledger rule, (5) a scale rung. An interface is\n  accommodated when it has a stable envelope, one canonical schema artifact, and\n  a no-bypass path through the Constitution.\n- **The gaps get their own ranked table** — id, what is missing, why it matters,\n  the smallest fix — each marked structural or thin. Never silently omit a part\n  with no home; never pad the inventory with a part that does not exist.\n- **Do NOT invent the missing design to close a gap.** A naming\u002Fstructure\n  question (which folder the human surface lives in) is the owner's call — name\n  it, name the smallest fix, and let him settle it.\n- **Close the contradiction loop in the same commit.** Surveying for the map is\n  where cross-doc drift surfaces (a stale count, a README tree that disagrees\n  with the designed tree and with disk); the map commit is the one that must\n  leave the corpus consistent.\n\n## Reviewing an external project's source against the design\nWhen asked to \"check \u003Cvendor\u002Fproject>'s source against our core\u002Finterface,\" the\ndeliverable is a grounded research doc under the verdict vocabulary\n(VALIDATES \u002F BORROW \u002F GAP-RISK), with every adoptable mechanism APPLIED into the\ndoc that owns it before the cycle closes — a finding without a home is an orphan.\n1. **Triage the repo listing first** (org repos via the GitHub API): separate the\n   1–2 repos that touch OUR seams (adapters, packaging, wire-like contracts)\n   from apps\u002Feval-corpora, vendored forks of other projects (no design of theirs\n   to review), and unlicensed repos (excluded — nothing is taken from them).\n   Record the exclusion lists so the omissions are decisions, not gaps.\n2. **Read the load-bearing source modules, not READMEs** — the adapter\u002Fcontract\n   types, registry, policy modules, and the lifecycle\u002Finstall paths. Cite by\n   module path; anything not verified from source goes in an explicit UNKNOWN\n   section. Closed-source parts of the vendor get no claims at all.\n3. **One numbered finding per mechanism**, each with: the mechanism (quote only\n   when the quote IS the rule), what it means for our design, the Ledger\n   relationship, and the scale rung. A finding may be a deliberate DIVERGENCE —\n   when our rule is stricter than the market's, record that we are stricter and\n   why, never import the permissive branch.\n4. **Apply each borrow into its owning doc in the same commit** (interface\n   contract changes into the interface doc, host\u002Fcapability rules into the\n   blueprint, packaging acceptance bars into the gap ledger, a row into\n   `docs\u002FREADME.md`), and state in the review's \"where each lands\" table that\n   nothing changed in the frozen envelope \u002F single writer \u002F v1 scope unless it\n   truly did.\n5. Split a large new doc across multiple tool calls — draft the file, then\n   append sections via `patch` — rather than one oversized write.\n\n### From BORROW findings to a story\u002Fslice plan — split v1-core vs v2-deferred FIRST\n\nWhen a grounded review produces BORROW findings and Luke then says \"story and\nslice the gaps,\" the honest answer is usually **most of them are not v1-core\nsliceable**, and padding the plan with fake slices is the failure shape. Before\ncutting any slices:\n\n- **Check `core-build-blueprint.md` §6** with `search_files` for what is already\n  `DEFERRED v2, out of core`. Almost every borrow that touches routing \u002F the\n  model pool \u002F the Model Reputation Library \u002F the Evaluator-L2b-critic is\n  already deferred — so it becomes a **recorded DEFERRAL with a v2 trigger**, not\n  a v1 slice. The borrow note is already applied into the owning doc (step 4);\n  the slice plan just names the trigger under which the v2 subsystem will pick\n  it up.\n- **Only an additive core change is a genuine v1 slice** — a new `EventType`\n  member, a new additive field on the frozen schema. Verify against the live\n  enum\u002Fschema (`core\u002Fcrates\u002Fabi\u002Fsrc\u002Fenums.rs`, `abi.schema.json`), never\n  intuition: grep the actual variant list before declaring something \"additive,\n  already covered.\" (e.g. `TOOL_LOADED` is a real add because the enum has\n  `TOOL_REQUESTED\u002FSTARTED\u002FFINISHED` but not it; an \"already covered\" claim is\n  only safe after reading the enum.)\n- **A one-BUILD\u002FCHECK-story slice plan is a correct outcome, not a thin one.**\n  State the v1-vs-deferred split in a table (finding → verdict → v1 core? →\n  disposition), put the single additive slice in BUILD\u002FCHECK form, and record\n  the rest as deferrals. If a borrow reduces to \"already covered by the existing\n  event\u002Ffield,\" collapse it and say so rather than inventing work.\n- **A deferral whose only open question is a one-word owner decision** (e.g.\n  \"is event X distinct from event Y, or does the existing one suffice?\") goes in\n  the slice plan as a named decision point blocking its BUILD — do not silently\n  pick, and do not build past it.\n\n## Designing an external-vendor integration (\"integrate X for the system\")\n\nWhen asked to design an integration with an external product (a runtime, an observability platform, a\npolicy engine), the deliverable is a design\u002Fplan doc under `docs\u002Fdesign\u002F` — requirements, invariants,\nconformance tests, scope split, story slices, Ledger relationship, scale ladder — and the work order is:\n\n1. **Verify the product exists and read its OWN docs before designing anything.** `web_extract` is\n   unavailable on the ddgs backend (search-only), and vendor doc sites may refuse a browser `fetch`\n   (docs.nvidia.com did) — but `raw.githubusercontent.com\u002F\u003Cowner>\u002F\u003Crepo>\u002Fmain\u002F\u003Cpath>` works from\n   `browser_exec`'s `js()` with an async IIFE, and the git trees API\n   (`\u002Frepos\u002F\u003Co>\u002F\u003Cr>\u002Fgit\u002Ftrees\u002FHEAD?recursive=1`) gives the doc file list. Read the real extension\u002FAPI\n   docs, not the marketing page, and cite the paths in the doc's grounding line.\n2. **Record what the docs do NOT say as UNKNOWN, never as a requirement.** A vendor's silence on\n   fail-closed behavior (e.g. what a gateway does when an external interceptor is unreachable) is not a\n   guarantee — it becomes a pre-slice verification test plus an explicit open item.\n3. **Decide the authority topology explicitly and state the failure mode.** For a governed core\n   integrating an enforcement engine: the core decides, the vendor enforces, the vendor's config is a\n   DERIVED SUBSET of the frozen Mandate, and the vendor's audit log is diagnostics (best-effort) while\n   the Ledger is evidence. Name the concrete breakage if both claim to decide.\n4. **Overlap-check before adopting the vendor's primitives.** Map every vendor extension point onto an\n   existing steadfaste seam and say which is the FIRST slice and why the others are not (the one that\n   governs *creation* beats the one that polices traffic afterwards).\n5. **Apply the anti-bloat rule to the consult's own requirements.** A model consult reliably proposes\n   mTLS, HA\u002Fleader election, and extra replicas — all rejected at n=1 with the rung+trigger recorded\n   instead. Also reject: reimplementing the vendor's core competency inside the core (kernel sandboxing\n   is the canonical NEVER), and letting the vendor own the evidence store.\n6. **Observability integrations have one hard rule:** the platform is evidence, never the authorizer,\n   and never in a synchronous decision path. Scores\u002Fmetrics from an eventually-consistent store\n   (seconds to minutes) become admissible only as an anchored, hashed, integer projection in the Ledger;\n   a gate reads the anchor and fails CLOSED on absence. Out-of-range values are rejected, never clamped.\n7. **Give the integration a zero-config default that needs no vendor** (local file sink + a\n   `trace \u003Crun_id>`-style local join) and make vendor compatibility a matter of *pointing* a standard\n   protocol (OTLP) at it, with the vendor mapping living in the sink crate, never in the core.\n\n### When the owner hands you a conceptual interface or a phased plan\n\n- **A hand-drawn interface is reviewed, never copied.** The deliverable is a *right \u002F wrong \u002F missing* review plus a\n  settled version, with `[corrected]` marks and the reason. Recurring corrections: authorization must not move into a\n  component that only enforces (`execute(…, AuthorizedAction)` is wrong — the provider executes a constrained process,\n  the core authorizes); a policy parameter must be DERIVED from the Mandate\u002FCharter, never caller-authored (an\n  authored policy is a bypass vector); numeric fields become integer-only snake_case (`cpu_limit_millicores`,\n  `memory_limit_bytes`); a Promise\u002Fasync shape becomes a synchronous trait; and every capability a provider cannot\n  enforce must be *declared* so the job is refused rather than silently under-enforced.\n- **A phased plan (30\u002F60\u002F90) expands into per-phase requirements + stories + the tests they own**, plus an anti-bloat\n  fence naming what each phase must NOT grow into, and an explicit \"these dates are planning artifacts, these\n  demonstrations are targets\" note.\n- **Experiment plans pre-register their numbers.** Every claim gets: what it supports, what it does NOT support, the\n  falsifier, and the pre-registered inputs (suite\u002Fpolicy\u002Fthreshold hashes committed before the run). Each harness needs\n  a non-vacuity test proving it FAILS when it should, and every result must state \"targets vs measured\" plus its\n  conditions. \"100% prevention\" is never the claim — \"no bypass in the pre-registered suite, on the tested day\" is.\n- **A scope-reduction message arriving mid-consult goes into the prompt before launch** — append it as an addendum\n  asking for the minimal component set, rather than re-running the consult.\n\n## Doc-writing pitfalls (these cost real time — proven)\n- **Append large markdown via `write_file` to \u002Ftmp then `cat >> file`** — do NOT use `printf`\u002Fheredoc; backticks\u002Fquotes get shell-escaped and the command errors or writes garbled bytes. The same `>\u002Ftmp` + `cat >>` rule applies to APPENDING a large block to a code file: `patch`'s fuzzy matcher can grab the WRONG closing brace and corrupt the file (an MN3 append to `fold.rs` merged the new `calibration_fold` block INTO the `RefusalFold` struct and renamed an unrelated field). Recovery is `git checkout -- \u003Cfile>` then re-append via `cat >>`; grep the diff after a large append confirms nothing got nested.\n- **Before appending a numbered `## N.` section, grep `^## N.` in the target.** If a collision exists (an added `## 8.` collided with an existing `## 8.` this project), renumber the NEW section (8→9) AND its subsections (8.1→9.1).\n- **After ANY `write_file`, re-read your own written section.** Placeholders are not auto-filled (saw a literal `\"v\": null — placeholder` ship), and multi-bullet prose gets mangled (dup\u002Fmissing words, stray tokens). `write_file` writes bytes; it does not proofread.\n- **Proofread prose for typos before commit** — misspellings such as `agentatic`, `tracable`, `\"A get, not a stylistic note\"` slipped through and needed a separate fix pass.\n- When a patch \"fix\" accidentally merges\u002Fgarbles an adjacent sentence, repair that sentence immediately (re-read the diff), not with an appended \"UPDATE\" note.\n\n## Public README & marketing copy (the user-facing face of the repo)\n\nLuke treats the README as **part selling the repo** — but sells *honestly and conservatively*. When asked to write or rewrite the README (or any public-facing doc), follow these standing preferences — they override generic prose instincts:\n\n- **Be proud of the genuinely novel and good parts; do NOT oversell.** State the real facts that make it strong (stable core, swappable agents, tamper-evident evidence, enterprise governance). Cut value-judgment claims about your own quality (e.g. \"Engineered extremely well\" was rejected: \"people will judge it for themselves\"). Cut unverifiable forward-claims (e.g. \"a 2026 thing works in 2029\") — state the mechanism that makes it true (additive-only contract) instead. \"Be conservative in statements. Do not oversell something you can't verify.\"\n- **Strip PII and the owner's identity from public docs.** No personal names, no real IPs\u002Fidentifiers. The remote repo may still carry the owner handle — that's the repo URL, not doc content, and is fine.\n- **Do NOT use Luke's spoken\u002Finternal words in public copy.** Rejected outright: \"boring\", \"non-coder\", \"settled\", \"swappable\", \"watched by arithmetic\". \"North star\" is a concept you *talk about*, not a heading — use \"What we build\". Branded terms (Constitution, Covenant) are fine but use them SPARINGLY — only a few capitalized concepts stay memorable; when every mechanism gets a name, metaphor competes with engineering.\n- **The README is not a diary.** Do not enumerate every request made this session; keep only important product info. \"Stop repeating everything I request as if everyone in the world needs to hear it.\"\n- **Teach the product in order** (this is the shape): what it is → the idea (agents replaceable, foundation not) → built for trust → architecture → why it exists → technology → enterprise governance → status. Learn concepts in sequence; don't open with several competing headlines.\n- **Plain spoken prose over branded stacking.** If a block reads like a creed (titles + prometheus of internal names in bullets: Constitution\u002FCovenant\u002FLedger\u002FGate\u002FVERIFY), rewrite it as natural sentences that keep the facts (\"Rust core, one static binary… the core handles the store, a tamper-evident ledger, config validation…\").\n- **Pitfall — a \"wrong online version\" is usually an UNPUSHED branch.** Before\n  editing a README (or any doc) the user says looks wrong online, count the\n  unpushed commits (`git log --oneline origin\u002Fmain..main | wc -l`) and check\n  `git status -sb`. Local main can be many commits ahead (this session: 76) while `origin\u002Fmain` shows a stale version with old content (Python, owner name, missing citations). The on-disk copy was already correct; the real fix was PUSHING. Pushing N commits is a meaningful action — get explicit go-ahead first, then `git push origin main` and verify sync (`git status -sb` shows no ahead\u002Fbehind) + confirm the remote branch via `git show origin\u002Fmain:README.md`.\n\n## Two-harness coexistence (steadfaste + steadfaste-fleet)\n\nIf asked \"should the two harnesses play nice \u002F can they coexist,\" the answer is **good neighbors, never a merged system**: steadfaste is the eventual target core, steadfaste-fleet is the incumbent fleet. Keep them SEPARATE (own Postgres DBs, own ports, own config\u002Fstate dirs — steadfaste never touches `~\u002F.hermes*`, hermes never steadfaste's); decide the two real seams (skills\u002Fprompts → Model Profiles mapping; the Telegram-token decision) as boundaries, not merges; coordinate state across them in ONE direction only (steadfaste's Ledger can CONSUME hermes events via an adapter — hermes's bus never drives steadfaste's core). The migration rule: nothing committed to the incumbent is unavailable to the target, and nothing the target does requires the incumbent (\"route around hermes when it breaks\"). A steadfaste-fleet agent\u002Fworker talking to steadfaste registers as a governed worker through the secure-registration flow (`references\u002Fworker-registration.md`) — it does not get process-lineage trust.\n\n## Live-testing the governed lifecycle (verify the Wire, don't just trust unit tests)\n\nWhen asked \"test a sub-agent command with it\" (or verifying lifecycle work), drive the REAL binary with JSONL frames — the conformance tests cover the session API, not the wire loops:\n\n1. Build once (`cd core && cargo build`), then either:\n   - **stdin path** (single shot): pipe a JSONL frame sequence to `core\u002Ftarget\u002Fdebug\u002Fsteadfaste` from a Python script (`subprocess.run([...], input=frames+\"\\n\")`) and read the ACK frames back; or\n   - **socket path** (shared session): start `core\u002Ftarget\u002Fdebug\u002Fsteadfaste --serve \u002Ftmp\u002Fsteadfaste.sock &`, connect a `socket.AF_UNIX` client, send frames line-by-line, read one ACK line per frame, then `pkill -f 'steadfaste --serve'` and remove the socket when done.\n2. Frame shape: `{\"version\":1,\"kind\":\u003Clowercase snake_case verb>,\"job_id\":...,\"seq\":N,\"ts\":\u003CRFC3339 UTC>,\"trust\":\"untrusted\",\"data\":{...}}`. Kinds are the enum's snake_case names (`commission`, `started`, `progress`, `result`, `stop`, `keep_alive`, ...) — a PascalCase kind is rejected as `unknown variant` (parse error ACK, job_id empty).\n3. Assert on `data.state` and `data.ledger_len`, **never on the ACK's `kind`** — the ACK frames echo a fixed label regardless of the request kind; `data.state` (Handshake → Commissioned → Running → Result) is the real lifecycle readout.\n4. Always include the negative sequence — a governed system is proven by its rejections: duplicate `commission`, a `result` naming a foreign job id, heartbeat on a finished\u002Freleased lease. Both listeners share ONE dispatch, so expect IDENTICAL responses per step: `kind:error` with `TransitionError` or the lease errors (`JobAlreadyLeased` on a dup commission, `NotLeaseHolder` for a foreign job's advancing frame, `LeaseReleased`\u002F`LeaseNotFound` on a dead-lease heartbeat). Parity = identical kind + state + error on EVERY step — if the two transports ever disagree again, that is a regression of the shared-dispatch invariant: record it in the design-gaps ledger, never accommodate it in the probe. A success-only script proves nothing. An error ACK does NOT prove the state didn't move — verify from the NEXT step's observed state, never from the error alone. Even a REJECTED attempt is appended (auditable): `ledger_len` grows on a refused action, so assert `data.state`\u002F`kind`, not that `ledger_len` stayed put. And when re-running a stored probe after a legitimate behavior change, re-derive its expectations (which frames answer, expected states) from the NEW behavior FIRST — stale hardcoded expectations make a PASS read as a FAIL and send you debugging the wrong thing.\n5. **Plain heartbeats are `keep_alive`, not repeated `progress`.** Every governance kind advances the lifecycle, so a second `progress` from the same state is a TransitionError, not a no-op; `keep_alive` is the passive lease-renewal verb. Reserve `progress`\u002F`started`\u002F`result` for actual state transitions.\n6. **Verify both wire listeners separately** — the stdin loop and the `--serve` loop are separate code paths that CAN diverge (the serve loop has lagged the stdin loop on lifecycle mapping). A green stdin run does not prove the serve path; drive both with the same frame sequence before claiming parity.\n7. Cleanup: kill the serve process and remove the socket file in the same session — a stale `\u002Ftmp\u002Fsteadfaste.sock` makes the next `--serve` start look successful while clients connect to a dead listener. `pkill -f 'steadfaste --serve'` from a bash tool call can SIGTERM the tool's own wrapper shell (pattern matches it) — verify with a socket `connect()` instead and clean the socket file separately.\n8. **Promote a probe that must stay into a cargo integration test in the owning crate** (`core\u002Fcrates\u002Fsteadfaste\u002Ftests\u002F…`): spawn the real binary with `Command::new(env!(\"CARGO_BIN_EXE_steadfaste\")).arg(\"--serve\")`, poll-connect the socket until it accepts (never sleep blind), give EACH test a unique socket path — tests run in parallel, and two tests deriving one path from the pid collide and fail with `ConnectionReset` mid-sequence — and clean up in `Drop` (kill + wait + remove socket). A manual Python probe explores; the committed integration test is the regression net.\n9. **Grep the dispatch arms (`SessionManager::dispatch`) before trusting a documented verb.** An unmapped kind falls into the passive `_ => Ok(self.state())` arm, which ACKs it as OK while touching nothing — exactly how `keep_alive` silently stopped renewing leases while the docs called it the passive lease-renewal verb. A new verb needs an explicit match arm plus a test for the dead\u002Funknown-lease case.\n\n**Wire findings that touch the single-writer dispatch story get RECORDED, not patched.** When live testing surfaces a cross-listener divergence that changes the dispatch\u002Fownership design, add a row to the findings ledger (`docs\u002Fdesign\u002Fdesign-gaps.md`, the ID | Sev | finding | status\u002Fwhere-it-lands table style), point the `build-tasks.md` header at it, and leave the design decision to Luke — the design-first gate applies during build too. Fix in the same cycle only the unambiguous defect (a documented verb that silently no-ops), with its conformance test. **Write each finding row from the probe transcript, not from the design intent** — cross-check the claimed mechanism against the observed step sequence (an error followed by a still-advancing state proves the mutation happened despite the error) before committing the row; a row narrated from the intended design has claimed \"rejected before touching state\" when the probe had just proved the opposite, and had to be rewritten before commit.\n\n### When a recorded finding becomes a build task — unify, don't accommodate\n\nWhen Luke says continue on a recorded divergence, the fix direction is **unify the dispatch, never accommodate per-transport**: two transports of one core answering the same frame differently get ONE shared dispatch function both call — per-transport patches that make observed outputs match just re-create the divergence on the next verb.\n\n- **Gate before mutate, record the refusal.** An ownership\u002Fauthorization gate runs BEFORE the state transition; the refused attempt is still appended through an append-only path (auditable), and the error names the actual failure (a dedicated `NotLeaseHolder` variant, not a reused `JobAlreadyLeased` — a wrong error name sends clients debugging the wrong thing). A gate placed after the mutation protects nothing.\n- **Carve exemptions from pinned tests, not intuition.** Before adding a gate, grep the existing test suite for legitimate flows the gate would refuse (the pinned stop-after-failed → Closed client test forced the one exemption: sealing an already-terminal session is record-keeping, not work). Each exemption stays pinned by that existing test.\n- **Layer the verification: unit conformance first, live probe second.** RED→GREEN the gate at the SessionManager level (state unmoved + attempt appended + the holder still lands), then re-run the live parity probe to prove the transports stayed in lockstep — the unit test proves the rule, the probe proves the wiring.\n\n## Pitfalls that recur on the steadfaste repo\n- **A shared doc-freshness hook may expect a `docs\u002FDOCS-INDEX.md` that steadfaste does not have.** Its canonical doc map is `docs\u002FREADME.md` (which IS updated). Do NOT invent a parallel `DOCS-INDEX.md` to placate the hook — that is a second source of truth and bloat. Recognize it as a mismatched steadfaste-fleet hook expectation and leave it (or flag scoping the hook to steadfaste's real index — the operator's call).\n- **After a hardening fix, historical gap-analysis docs go stale.** If a hardening pass fixes a design gap in the live docs (e.g. Ledger HMAC → unkeyed SHA-256 + Ed25519), a *historical* gap-analysis doc that still documents the OLD design as an open gap is now partly wrong. Leave a pure historical record as-is, but flag the staleness rather than silently propagating the old design as current; update any CURRENT doc, never the historical one.\n- Always confirm sync after a push with `git status -sb` (no ahead\u002Fbehind) and `git show origin\u002Fmain:\u003Cfile>` on the shipped file.\n- **Open the governance cycle BEFORE the first `terminal` call.** The lock is\n  repo-scoped and the enforcer blocks `terminal` for ANY command inside\n  `~\u002Fsteadfaste` — even a read-only `ls`, `git status`, or `find`. `read_file`,\n  `search_files`, and `skill_view` stay allowed, so survey the docs first and\n  `begin_change` the moment a shell command is needed; retrying a blocked call\n  never works.\n- **\"Exists\" means \"has files\" — never infer from a folder name or README tree.**\n  `core\u002F` holds the Rust workspace (crates under `core\u002Fcrates\u002F`), `prototype-ts\u002F`\n  holds the TS prototype, while `worker\u002F`, `web\u002F`, `gateway\u002F`, `packaging\u002F`,\n  `governance\u002F`, `test\u002F`, and `config\u002F` remain EMPTY placeholder directories;\n  git does not track empty dirs, so a folder in the designed tree need not be on\n  disk. The build advances over time, so COUNT rather than trust this\n  sentence: `for d in core worker web gateway packaging governance test config prototype-ts; do printf '%-14s %s\\n' \"$d\" \"$(find \"$d\" -type f | wc -l)\"; done` — a component's state is the file count, not the folder existence.\n- **`docs\u002Fdesign\u002Fbuild-tasks.md` lists every task TWICE — the cumulative top\n  table AND the per-story section tables — and they silently diverge.** A task\n  marked ✅ in the top table can still sit ⬜ in its Story section below, and\n  the \"Path at a glance\" story-map block at the top goes stale the moment a\n  released story's next marker isn't moved. The doc header's \"Where we are\" is\n  the agreed source of truth, so before polling a task\u002Fstatus column from a\n  section table, cross-check it against the top table + header, and when a\n  build task lands, update BOTH the cumulative row and the story-section row in\n  the same commit — never just one copy.\n- **The `build-tasks.md` \"Where we are\" test-count header is hand-maintained and\n  drifts.** Verify the true count with `cargo test --workspace -- --list 2>\u002Fdev\u002Fnull\n  | grep -cE ': test$'` — the `--list` count is authoritative; the \"N passed\" sum\n  over-inflates it because some target shards are counted more than once. To prove\n  a change is exactly +N (and catch a stale header you would otherwise propagate),\n  `git stash`, run the count (BEFORE), `git stash pop`, run it again (AFTER), diff.\n  Correct the number in the same commit rather than carrying a header that already\n  disagrees with the suite.\n- **A rejected push usually means origin\u002Fmain advanced with a PEER's work — count\n  AFTER the merge, never propagate either side's header count.** A mid-build\n  `git pull --rebase` that lands a parallel author's commit (e.g. another agent's\n  Story) will conflict on the hand-maintained count header precisely because both\n  sides rewrote it. Resolve the header by MEASURING the merged tree\n  (`cargo test --workspace -- --list | grep -cE ': test$'`) + the MERGED `test\n  result` lines, combining BOTH bodies of work, not by taking either line's \"N\".\n  **If the peer brought failing tests (e.g. live-API integration tests hitting a\n  real provider), prove they are pre-existing before claiming green**: `git show\n  \u003Cpeer-commit>:\u003Cpath> | md5sum` vs the merged file (byte-identical + your diff is\n  confined to other crates = not yours). Then put the HONEST number + a named\n  caveat (\"4 pre-existing `live_jev` live-API tests fail without a valid key\") in\n  the header — a header that claims all green while the suite is red is a lie\n  that misleads every reader. A peer's live-API failure is that peer's domain;\n  document + flag it, do not silently fix it into your unrelated slice.\n- **Adding a wire\u002Fsurface type is now SCHEMA-FIRST, not hand-edits.** CG1–CG4\n  and surface Slice 0.3 built the generator (`abi-codegen`), which is the\n  primary path: `abi.schema.json` (and `surface\u002Finterface.schema.json`) carry an\n  `x-rust` block per `$def` (rename_case, integer widths, field order,\n  Option-ness, serde attrs) + a `description` (the semantic freeze), and the\n  shape files (`abi\u002Fsrc\u002F*.rs`, `surface\u002Fsrc\u002Freads.rs`\u002F`verbs.rs`) are GENERATED\n  from them with a `GENERATED — DO NOT EDIT` banner. To add a type: (1) add the\n  `$def` with its `x-rust`; (2) register it in `abi\u002Ftests\u002Fschema_complete.rs`\n  (`WIRE_TYPES` for a Rust type, `DATA_PAYLOAD_DEFS` for a `*_data` payload);\n  (3) `cargo run -p abi-codegen` (or `-- --target surface`) to regenerate;\n  (4) STILL hand-update the golden\u002Fparity fixtures\n  (`tests\u002Fgolden\u002Fabi_parity.golden.json`, `all_event_types()`, `roundtrip_upper`)\n  — the generator does NOT emit those. The committed-match + idempotence tests\n  (`abi-codegen\u002Ftests\u002F`) and the CI `git diff --exit-code` gate then enforce no\n  manual divergence. Grep the variant name across `core\u002Fcrates\u002Fabi\u002F` before\n  declaring an add complete — an \"already covered, additive\" claim is only safe\n  after reading the live schema+enum.\n- **Any new `$def` in `abi.schema.json` MUST be registered in `abi\u002Ftests\u002Fschema_complete.rs`\n  (the CG1.2 inventory guard) or `every_schema_def_is_accounted_for` fails the suite.**\n  The guard's `WIRE_TYPES` lists Rust wire types by PascalCase name\n  (`Kind`, `Frame`, `ReviewVerdict`, `JudgmentData`, `JudgmentAnswer`); a `$def`\n  with no Rust struct (a `*_data` payload) goes in `DATA_PAYLOAD_DEFS` keyed to a\n  data-carrying `Kind`. The `$def` NAME must match the Rust type exactly: a\n  `snake_case` `$def` like `judgment_data` against a `JudgmentData` struct breaks\n  the guard (it looks for the PascalCase wire-type name in `WIRE_TYPES`). This\n  guard is a LATER addition than the golden\u002Fparity lists — a new wire-shape commit\n  must touch it too, and the enum+golden+parity list in the pitfall above is no\n  longer sufficient on its own.\n- **After a `git pull --rebase` that re-merges `abi.schema.json`, grep for\n  DUPLICATE `$def` keys and stale cases BEFORE trusting the schema.** When a\n  parallel branch\u002Fcommit also edited the schema (upstream CG1.1 did), git\n  auto-merges by line and can leave two `WorkerRole` defs (our `\"judge\"` version\n  plus upstream's `primary\u002Fcritic`) or one def under a stale case. JSON with\n  duplicate keys parses but the LAST wins — a silent behavioral change. Fix by\n  consolidating to one canonical def (the one carrying every member) and confirm\n  `schema_complete.rs` still accounts for every key. Run\n  `python3 -c \"import json;json.load(open('core\u002Fcrates\u002Fabi\u002Fabi.schema.json'))\"`\n  won't catch a duplicate-key collision; grep for the key count instead.\n- **The pre-commit secret-leak detector flags the frozen `abi.schema.json`\n  `\"$schema\": \"https:\u002F\u002Fjson-schema.org\u002F…\"` line as a \"non-placeholder domain\".**\n  That is a non-blocking false positive (it is the JSON Schema draft URI, not PII).\n  Do not \"fix\" the URI or add an ignore — the warning is cosmetic and the commit\n  lands.\n- **Any design that puts model probabilities, confidence, or scores on the\n  Ledger as decimals is unappendable.** `canonical_json` rejects every IEEE-754\n  float (`CanonicalError::FloatRejected`, pinned by `ledger\u002Ftests\u002Fentry_hash.rs`\n  + `edge_cases.rs`). Quantize at the *schema* boundary, not by the consumer:\n  integer parts-per-million (`u32`, 0–1,000,000); every distribution sums to\n  exactly 1,000,000 (largest-remainder residual); raw provider bytes ride by\n  hash, never inline. This is what `judgment-abstraction.md` got wrong (Jev\n  `noul: 0.87` could never append) and why `machine-native-substrate.md` §4.3\n  quantizes to ppm.\n- **The machine-native \u002F judgment layer is owned by\n  `docs\u002Fdesign\u002Fmachine-native-substrate.md`; MN0–MN3 have SHIPPED, MN4–MN7 are the\n  remaining slices.** Shipped: MN0 (`WorkerRole::Judge` in `abi\u002Fsrc\u002Freview.rs`,\n  `judgment_data`\u002F`JudgmentAnswer` in `abi\u002Fsrc\u002Fjudgment.rs`,\n  `EventType::JudgmentRendered`; the CG2 shape\u002Flogic split keeps `validate()` +\n  `judge_commission()` in `judgment_policy.rs`), MN1 (`Constitution::judgment()\n  append`), MN2 (`constitution\u002Fsrc\u002Fdecision_class.rs` compose grammar —\n  `compose(floor,a) ≥ floor`, untrusted-never-clears, undecidable-escalates),\n  MN3 (`calibration_fold` in `ledger\u002Fsrc\u002Ffold.rs`). When asked to build the apply\n  step of compose, the surface judgment reads, the autonomy dial, the judge\n  adapters, or a judge baseline battery, start at §6's slice table — the design\n  (invariants MN-1..MN-10, output classes, Decision Classes) is settled.\n- **The concrete, tested Jev integration patterns live in\n  `docs\u002Fresearch\u002Ften-levels-of-jev-2026-09-30.md`** (digest of\n  `disler\u002Ften-levels-of-jev`: 30 Jev use cases in 10 levels). When asked how Jev\n  integrates into steadfaste, or to wire a Jev gate\u002Froute\u002Fcheap-read, start there:\n  it maps each level onto the machine-native design (what VALIDATES, what BORROWs\n  — hook placement at tool_call\u002Ftool_result\u002Fturn_end, cheap file reads, parallel\n  fan-out — and the deliberate divergences: weights-in-code and agent-authored\n  questions are forbidden by the compose grammar \u002F MN-3). It also records Luke's\n  cost posture: Pi (`@earendil-works\u002Fpi-coding-agent`) as the coding agent + Jev\n  for judgment + offline coding (`offline_code`\u002F`qwen2.5:3b`) for generation.\n- **The coding-agent model-cost routing design lives in\n  `docs\u002Fdesign\u002Fcoding-cost-routing.md`** (pi → Jev \u002F offline \u002F other at the\n  lowest honest model cost, commissioned by the Steward over the Telegram\n  gateway). When asked how coding work should route models, or to wire the pi\n  harness's cost layer, start there: a three-tier resource model (T0 Jev\n  judgment ~$16.80\u002Fmillion, T1 offline_code+qwen2.5:3b codegen at $0 marginal,\n  T2 hosted workhorse, T3 hosted reasoning), a governed four-class routing\n  Decision Class (BOUNDED\u002FROUTINE\u002FCOMPLEX\u002FCREATIVE → cheapest capable tier, per\n  MN-3 the question is the policy), five Jev judge-worker hooks in the pi loop\n  (routing classifier, destructive-command gate, compaction scoring, cheap file\n  reads, output screening), and monotone-toward-caution failover (never downgrade\n  a tier, fail closed to the Steward on undecidable). The routing classification\n  is itself a Jev `choice` — it never costs an LLM call; the verbosity tier rides\n  the same routing (BOUNDED→MINIMAL … CREATIVE→FULL). The core routing module is\n  BUILT (`core\u002Fcrates\u002Fconstitution\u002Fsrc\u002Frouting.rs`: `route_for_class` \u002F\n  `route_from_answers`, provider-neutral — takes `JudgmentAnswer`, never a Jev\n  handle — fail-closed undecidable\u002Funknown\u002Fmissing → T3); the CR0–CR7 build\n  track (one test owned once) is in `build-tasks.md`. **pi install:**\n  `npm install -g @earendil-works\u002Fpi-coding-agent` — requires Node `>=22.19.0`,\n  NOT Node 24 (Node 24 was only the ten-levels repo's own TS requirement, not\n  pi's).\n- **Neither pi nor Jev is load-bearing — both are swappable behind adapter seams\n  (a standing design rule: \"easy swappability and interoperability is very\n  important\").** A coding agent (pi) is ONE adapter behind a GENERIC\n  coding-worker event interface (`on_tool_call`\u002F`on_tool_result`\u002F`on_turn_end`\u002F\n  `on_context_gather`\u002F`on_output`) — the Jev hooks are defined against that\n  interface, never pi's extension API; pi maps its own events onto it and is the\n  reference adapter. A judgment model (Jev) is ONE provider behind the judgment\n  client (`decide(class, state, questions)`), resolved from config — Jev\u002Fvon\u002F\n  own-model are provider profiles (swap = base_url + api_key + model_id; tier\n  gating + shadow gate unproven providers). No consumer code hard-references pi\n  or Jev. Interop test: swap the harness, swap the provider — the governed\n  pipeline behaves identically.\n- **A record that a downstream fold\u002Freport JOINs on must carry its join key\n  whenever it can reach a calibratable (outcome-bearing) state — refuse an\n  unlinked record loudly, never append it as a silent orphan.** The\n  `calibration_fold` in `ledger\u002Fsrc\u002Ffold.rs` joins each escalating judgment to the\n  same job's later `ratified`\u002F`veto` via `job_id`; if `judgment_entry` wrote\n  `job_id: None`, every escalating judgment would be counted as `no_outcome`\n  forever and nothing would explain the gap. So `Constitution::judgment()`\n  REFUSES an escalating-but-jobless judgment (`HandleError::EscalationUnlinked`,\n  nothing appended) — a loud defect with its own test (escalating+None refused,\n  shadow\u002Fproceed+None ok, escalating+Some linked). General rule: when you add a\n  fold or report that links records by a key, make the WRITE of that key\n  fail-closed for the records the fold depends on, and give the missing-key\n  error a distinct variant so the caller sees WHY, not a generic failure.\n- **Verify a peer's cited docs exist on THIS checkout before propagating them.**\n  A parallel agent\u002FOpus may cite `steward-tui.md`, `baml-evaluation.md`, or a\n  commit hash that live only on its own branch\u002Fworktree, not `main` — `search_files`\n  for the cited path before baking it into a doc, and cite the real source\n  (`core-interface.md` §7\u002F§8 held the TUI and \"judgment runs as a governed\n  worker\" rules here) instead of the phantom one.\n- **A governance verb (stop\u002Fveto\u002Fdirect) must never hard-code a `job_id`, `seq`,\n  or `ts` — it targets the job the caller actually holds.** The Steward TUI's\n  `stop()` shipped `job_id: \"job-1\"` with a fixed `seq: 1` and a constant `ts`;\n  since the TUI's job counter starts at 2, the emergency stop fired at a job\n  that was never commissioned. Track `current_job` + a per-job sequence in the\n  client state, timestamp with a now() helper, and keep that logic in the\n  crate's `lib.rs` (testable without a terminal) rather than in the interactive\n  `main.rs` rendering loop. When fixing a client\u002FTUI bug, extract the pure\n  decision into the lib so it can be TDD'd; the rendering loop should only wire\n  I\u002FO and input.\n\n## The doc-corpus shape (current vs historical) — keep it this way\n\nThe corpus is organized so a PM, a builder, and an auditor each get an ordered\nreading path, and no reader has to guess what is current:\n\n- `docs\u002FREADME.md` is **the map and the ONLY index** (never create a parallel\n  `DOCS-INDEX.md`): three reading paths, a `Status` on every current doc, \"the\n  system in one screen\", and a current-vs-historical table.\n- **Every current doc opens with one line:** `> **Status:** \u003C…> **Audience:** \u003C…> **Pairs with:** \u003C…>`.\n- `docs\u002Fdesign\u002Fcore-build-blueprint.md` is the **BUILD-READY v1 contract** — the\n  doc stories and slices are cut from (§5 conformance tests, §6 scope line, §7\n  build order). `docs\u002Fdesign\u002Fstory-slices.md` is the **current story\u002Fslice plan**\n  cut from it (vertical stories, each conformance test owned once; supersedes\n  `docs\u002Fhistorical\u002Fstory\u002Fcoding-agent-story.md`). `docs\u002Fdesign\u002Fdesign-gaps.md`\n  is the **open\u002Fresolved ledger** and the single place that lists what must\n  close before Story 1.\n- **Superseded material MOVES to `docs\u002Fhistorical\u002F`** with a header saying it is\n  historical, what supersedes it, and which of its ids stay canonical (e.g. the\n  build-readiness review's `B-S1.x` ids).\n- **Fix contradictions where they live, never annotate them:** a stale verdict\n  (\"NOT build-ready\"), a stale count (`27 truths` when §0 has 35), or a stale\n  status line (\"do not write code against this\") misleads every future reader.\n- **Recount every number from the file that owns it; never trust a summary\n  line.** A doc header claimed \"15 governing truths\" while `spec\u002Fcore-spec.md` §0\n  held 35 — count the entries in the owning file\n  (`awk 'NR>=\u003Cstart>&&NR\u003C=\u003Cend>' \u003Cfile> | grep -cE '^[0-9]+\\.'`), then grep the\n  whole corpus for every other restatement of that number so they all move with it.\n\nPitfalls on a **docs-only commit** in this repo (both cost a wasted cycle):\n- The enforcer MAY block `git commit` claiming \"changes to skills\u002F, tests\u002F\" even\n  when the diff is pure markdown — when it does, load `adversarial-verifier` and\n  retry once; the pre-commit gate then reports `Adversarial verify: passed on N\n  file(s)`. It is not guaranteed: a clean docs commit can reach the same gate and\n  pass on the first try, so do not pre-load extra skills on speculation.\n- The hook prints ~11 `DOCS AUDIT … docs\u002FDOCS-INDEX.md was not updated` warnings\n  for any docs change. They are the mismatched steadfaste-fleet expectation (see the\n  pitfall above), **not a block** — the commit lands.\n\n## Prototype code changes (prototype-ts)\nBeyond docs, the repo ships a TypeScript prototype under `prototype-ts\u002F` (Bun, `bun test`, frozen core = `abi.ts` + `loop.ts`). Rules for code work there:\n\n- **TDD is enforced: RED (watch the test fail) → GREEN → full suite.** Run `bun test \u003Cfile>` per cycle and the full `bun test` before commit. Verify the demo still runs: `bun run prototype-ts\u002Fmain.ts --fake`.\n- **Config\u002Foverride convention (established):** precedence chain env var → `STEADFASTE_CONFIG` JSON file → built-in default, implemented in `prototype-ts\u002Fconfig.ts`. NEVER let the frozen core (`loop.ts`\u002F`abi.ts`) read config — the core takes values as explicit options; config is worker-side plumbing that assembles them. **Fail-closed validation:** unknown JSON keys and bad numbers throw at load time — a typo'd threshold silently falling back to a default means an operator believes a limit is tighter than it is.\n- **Run an adversarial boundary probe against the config loader BEFORE declaring config work done** — feed every env key the pathological inputs (`\"\"`, whitespace-only, `0x10`, `Infinity`, `NaN`, `1e300`, fractional-for-int, duplicate list entries, empty list entries) and verify each either throws naming the key or normalizes correctly. A plain `Number()` parse accepts seven kinds of garbage that silently disable a safety limit; the probe is the only way to see what the parser actually accepts.\n- **Settle the edge-case matrix in the DESIGN DOC before build, not just in code.** One rule covers every row: *a value that looks set must be set* (fail-closed — reject at startup with named key) or *a component that fails must degrade, not lie* (fail-safe — drop+counter, isolate the failing sink, never block the caller). Structure as tables per layer: config values \u002F runtime failures \u002F core-interface cross-refs. Luke asked for this explicitly; a design that leaves edge cases to the builder's improvisation is not settled.\n- **Fixed-interval retry sleeps synchronize contenders (thundering herd) — always full jitter.** Under N-way contention a fixed sleep wakes all waiters on the same boundary and the wave grows with each collision; this is a stability bug at the 1000-agent tier, invisible at n=1. Exponential backoff with FULL JITTER (uniform `[0, cap]`, cap = `min(base·2^attempt, timeout\u002F4)`), jitter-off mode only for debugging contention patterns. File lives as a class-level test (`lock-jitter.test.ts`) asserting cap growth + bounds.\n- **Export the module-private lock\u002Fwrapper function to run a live multi-writer contention probe** — a unit test can't prove \"no lost updates\"; a script spinning N concurrent `withLock` writers against one state file and asserting every update landed can. One `export` keyword on the wrapper is the whole cost.\n- **Technology-choice reviews for this repo: vindicate-or-fix, with the reason recorded.** Structure: (1) a table of load-bearing choices each with verdict + WHY it holds (not narratives), (2) findings FIXED this cycle with mechanism + verification, (3) observations already-owned-elsewhere recorded without action. The repo's habit of naming its own ceilings (single-writer honesty, rejected bloat with triggers, inert-until-needed) makes the audit mostly vindications — that is the goal; write the doc as `docs\u002Fdesign\u002Ftechnology-choice-review.md`.\n- **Validate by VALUE TYPE, not key-by-key:** shared helpers `intEnv` (whole numbers: ms durations, run counts, tier numbers), `numEnv` (decimal rates), `fracEnv` (0–1 fractions), `strEnv` (reject whitespace-only) — each with a strict base-10 decimal regex, a magnitude guard (>1e9 rejected: a 1e300 retention value silently disables rotation), and a named-key error. Run cross-field rules (e.g. otlp sink requires endpoint) AFTER key-level parsing so the error names the real mistake, not a downstream red herring.\n- **Every `.env.example` key must be actually wired** in the config loader — grep the loader for each var name before committing the example file. Document each key with: what it does, the sensible range, and which design doc pins the default. Known groundings: trust-tier thresholds → core-spec §4f \u002F design-gaps (b); baselining → baselining-scale-ladder zero-config row; validation gates → token-efficiency §4.6–4.9; pair-review rate → cross-agent-collusion; log verbosity\u002Fretention\u002Fsinks\u002Fsampling → observability-logging §5 + §10.1 (hot\u002Fwarm retention and rotation cap are the §10 growth numbers).\n- **NEVER `write_file` a file you are only extending (`.env.example`, append-style edits) — `write_file` REPLACES the whole file.** Draft the new section to \u002Ftmp and `cat >> file` instead; the doc-append rule exists for the same reason. After an accidental clobber, `git show HEAD:\u003Cfile> > file` to restore, then append — and verify the full key count afterwards (grep -c 'STEADFASTE_').\n- **Treat trust\u002Fvalidation thresholds as POLICY, not tuning** in analysis: they decide how much evidence trust is earned with. Deliberately NOT configurable: ABI version, tier caps (Operators ≤2), the two-seed pair-review mechanism (only the rate is a lever — schedule unpredictability is a security property). Config-request touching those = design conversation, not a knob.\n- **Before blaming your change for a failing repo test, stash and run it on a clean tree** — prototype tests can be pre-broken (test-dir import paths drifted after a repo restructure). If pre-existing, fixing it belongs in the same commit (contract rule: no known issues left unfixed), noted in the message.\n- **Test isolation: reset ALL `STEADFASTE_*` env vars in a `finally` after any expected-throw config test** — a leaked bad value poisons sibling test files that load config through the store, failing them mysteriously. One `resetEnv()` helper covering every `STEADFASTE_` key; `clearConfigCache()` after every env mutation (config is cached).\n- **Multi-line commit messages: write the message to a file and `git commit -F \u003Cfile>`.** Inline multi-line messages in a shell tool call break on quotes\u002Fapostrophes\u002Fparens and split into bogus pathspecs.\n- **After a governance gate blocks `git add A B C && git commit`, verify what actually staged before re-committing — a blocked commit can SPLIT the change.** The adversarial-verify gate can refuse the commit after the add already ran (or the add rolled back); re-adding only a subset then commits a test-only commit and leaves the source uncommitted, an intermediate HEAD that fails `cargo test`. Before retrying with a subset, check `git status` and stage the WHOLE intended set so source + test + docs land as one atomic commit. If a split already happened, repair with `git reset --soft HEAD~2 && git commit -F \u003Cmsg>` to squash the fragments back into one compiling HEAD.\n- **Nested heredocs inside a `terminal()`\u002F`execute_code` string break on quoting — write the script to a file first, then run it.** A Python patcher or TS probe containing `\u003C\u003C'EOF'` cannot be passed as an inline shell string (the inner heredoc collides with the outer string literal); `write_file('\u002Ftmp\u002Fscript.py')` then `terminal('python3 \u002Ftmp\u002Fscript.py')` always works. Same for any multi-line script with backticks or `${}` interpolation.\n- **For outside-expert model input on a design question, consult DeepSeek Pro via OpenRouter** — recipe and pitfalls (reasoning-model token budget, empty-content trap) in `references\u002Fllm-consult-via-openrouter.md`. Treat the answer as expert input to overlap-check, never as the design itself.\n- **Fetch external APIs (GitHub org listings, raw file reads) via `browser_exec`'s\n  `js()` with `fetch()`, not `terminal curl`** — a shell curl of an external API\n  can sit awaiting user consent and stall the session; the browser fetch returns\n  the JSON in one call. Parse the JSON in the same browser_exec call (json.loads\n  of the innerText). **The `fetch` must be wrapped in an async IIFE inside `js()`\n  (`js(\"(async () => {...})()\")))` — a top-level `await fetch(...)` in the\n  `browser_exec` `code` block fails with `SyntaxError: 'await' outside async\n  function`, because the code runs as a sync Python exec. Use\n  `raw.githubusercontent.com\u002F\u003Cowner>\u002F\u003Crepo>\u002F\u003Cbranch>\u002F\u003Cpath>` for raw file content\n  (with `await r.text()`), and the git trees API\n  (`\u002Frepos\u002F\u003Cowner>\u002F\u003Crepo>\u002Fgit\u002Ftrees\u002FHEAD?recursive=1` → `tree[].path`) for the\n  file list before deciding which files to read.\n- **Split any doc write that would exceed roughly 8K tokens of arguments into a\n  small initial `write_file` + successive `patch` appends** — a single oversized\n  write can be cut off mid-stream and silently not land; re-read the file after\n  each chunk to confirm where to continue.\n- **Domain-skill write gates fire per file type: first a suggestion, then a\n  hard block** (`docs\u002F*.md` → `documentation-auditing`, repo `.py` →\n  `codebase-design`). Load the named skill on the FIRST warning instead of\n  retrying or switching tools — the retried write is refused outright, and\n  each blocked attempt burns a cycle.\n\n## Docs archive regeneration\nOn request, regenerate the portable archive under a governance cycle:\n`tar czf \u002Ftmp\u002Fsteadfaste-docs-\u003CYYYYmmdd-HHMM>.tar.gz spec\u002F docs\u002F README.md`, then VERIFY the expected file is present (`tar tzf … | grep \u003Cfile>`), then deliver as `MEDIA:\u002Fabs\u002Fpath` in Telegram. Include both the byte size and the design-doc count in the report.\n\n## Surface authority: every drive verb must DECLARE its authority\n\nThe core enforces surface authority server-side (`session.rs`\n`authority_required_for_kind`): `Commission`\u002F`Ratified`\u002F`Veto` need **Partner**,\n`Direct`\u002F`Stop`\u002F`Resume`\u002F`DryRun`\u002F`Cancel` need **Steward**, worker verbs\n(`Started`\u002F`Progress`\u002F`Result`\u002F`Failed`\u002F`KeepAlive`) are ungated. The declared\nlevel rides the frame's **data** as `\"authority_level\": \"observer\"|\"partner\"|\"steward\"`;\n`extract_declared_authority` in `steadfaste\u002Fsrc\u002Fmain.rs` reads it. With no\ndeclaration the effective level is the stored lease authority, falling back to\n**Observer** — fail-closed. Symptom: an Error ACK\n`Unauthorized { kind: \"Commission\", required: Partner, actual: Observer }`.\n\n- **The raw wire `Client` declares nothing**, so anything driving it by hand must\n  put `authority_level` in the frame data itself. `SurfaceClient`\n  (`steadfaste-surface`) injects it and derives `seq`\u002F`ts` — **prefer it for any\n  drive verb**; a hand-built frame is how the TUI silently lost its authority\n  (its `commission()` and `stop_frame()` were rejected by the gate, a real\n  production break invisible to its unit tests, which only covered the lib\n  helpers).\n- **Test frames are drive verbs too.** `steadfaste-client`'s\n  `commission_gets_ack`\u002F`serve_lifecycle`\u002F`shared_session` and `steadfaste`'s\n  `wire_serve` helpers all had to declare authority; a frame builder helper is\n  the right place (inject once, not per call site).\n- **A gate's failure can be downstream.** `Lease(NotLeaseHolder)` on `Stop` was\n  *not* a lease bug — the commission that should have acquired the lease had\n  been rejected as Observer, so the test's `expect(\"commission\")` passed while\n  nothing was leased. Fix the first rejection, re-read the later error.\n- **A doc comment can contradict the code and outlive it.**\n  `dispatch_with_authority`'s comment claimed `None` → backward-compatible\n  `Steward`; the code (correctly) falls back to `Observer`. Fix the comment where\n  it lives; never \"fix\" the fail-closed code to match a stale comment.\n\n## The Telegram gateway (`core\u002Fcrates\u002Fsteadfaste-gateway`)\n\nNot the empty `gateway\u002F` placeholder dir — that holds only the Surface contract\n(`gateway\u002Fcontract.md`, interface **I6**). The crate drives the core through\n`steadfaste-surface`'s `SurfaceClient`, never a hand-built frame. Layout:\n`surface.rs` (neutral contract v1), `auth.rs` (fail-closed allowlist),\n`command.rs` (the §2.3 command→drive-verb map + `verb()`), `format.rs`\n(chunking + MarkdownV2 escaping), `dedupe.rs` (`update_id` ring), `telegram.rs`\n(adapter + `callback_data` codec + `callback_to_command`), `main.rs` (Gateway\nCore).\n\n- **A button tap must take the SAME path as the typed command** —\n  `callback_to_command` feeds the same `Command` enum, so a callback can never\n  reach a verb the slash form could not.\n- **`Checkpoint` is an `EventType`, not a v1 `Kind`** — `\u002Fcheckpoint` maps to no\n  drive verb; reply honestly rather than inventing one.\n- **Chat `ratify` must be refused until a read channel exists.** A ratify\n  certifies a specific escalation's `payload_hash`; with no `steadfaste.read.*`\n  on `SurfaceClient` the gateway cannot fetch it, and sending an invented hash\n  is a **forged certification**. Refuse and record the gap (G-GW-1).\n- **Verify end-to-end against a stub Bot API, not just unit tests.** Point\n  `STEADFASTE_TELEGRAM_API_BASE` at a local HTTP stub that serves `\u002FgetUpdates`\n  and records `\u002FsendMessage`, run the real `steadfaste-gateway` binary against\n  the real core, and assert: authorized command → reply, **unauthorized → no\n  reply at all**, callback answered, reply chunked\u002Fescaped. Env: token\n  `STEADFASTE_TELEGRAM_TOKEN`, allowlist `..._ALLOWED_USERS`\u002F`..._ALLOWED_CHATS`.\n  The gateway **refuses to start** with no allowlist (fail-closed).\n\n## Test-suite hygiene on this repo\n\n- **A single broken test file in an unrelated crate blocks the WHOLE workspace\n  suite from compiling** — one missing import (`unfreeze` in\n  `wire\u002Ftests\u002Fspawn.rs`) hides every other crate's results and makes the run\n  look like \"one failing test\". Always run `cargo test --workspace\n  --no-fail-fast` and grep `^error: test failed` for the true target list; fix\n  the compile error first.\n- **A live-API test must be OPT-IN, not triggered by an ambient credential.**\n  `live_jev` skipped only when `TYPESAFE_API_KEY` was unset, but this host has\n  one exported for unrelated tooling — so a plain `cargo test` did a live, paid\n  run against a provider that rejected it (HTTP 400 `api_usage_error`). Gate on\n  `STEADFASTE_LIVE_JEV=1` **and** the key. A test that spends money must never\n  run as a side effect.\n- **Measure the test count, never propagate it.** The `--list` count is\n  authoritative: `cargo test --workspace -- --list 2>\u002Fdev\u002Fnull | grep -cE ': test$'`.\n  After a `git pull --rebase` that lands a peer's work, re-measure on the MERGED\n  tree (the header conflicts on every parallel edit); the \"N passed\" sum\n  over-inflates. Header lived in `build-tasks.md` (\"Where we are\") and\n  `docs\u002FREADME.md` — both must move together.\n- **Probe discipline pays again: two of my own probes were wrong before the code\n  was.** (1) an assertion looked for the raw `job-e2e` in wire text that was\n  correctly MarkdownV2-escaped to `job\\-e2e`; (2) a count expected two\n  backslashes where one is right. Check the probe's own assumptions before\n  declaring a bug — the code was correct both times.\n- **The pre-commit secret-leak detector false-positives on the real Telegram API\n  base URL** (`https:\u002F\u002Fapi.telegram.org` flagged as a \"non-placeholder domain\")\n  and on the frozen JSON-Schema `$schema` URI. Non-blocking; do not \"fix\" the\n  URL or add an ignore.\n",{"name":5,"version":24,"category":25,"description":7},"1.0.0","software-development","main","6509c2742680f6f230c89044437ab43c0e29d530","skills\u002Fsoftware-development\u002Fsteadfaste-design",1,"https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet","steadfaste.com","https:\u002F\u002Fgithub.com\u002Flukemcqueen","AI Architect | Building Hermes Cortex: governed multi-agent AI for autonomous software engineering | Enterprise Tech Consultant","2026-11-14 22:33:34",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add lukemcqueen\u002Fsteadfaste-fleet --skill steadfaste-design",{"tool":41,"command":42},"bunx","bunx skills add lukemcqueen\u002Fsteadfaste-fleet --skill steadfaste-design",{"tool":44,"command":45},"pnpm","pnpm dlx skills add lukemcqueen\u002Fsteadfaste-fleet --skill steadfaste-design","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fsoftware-development\u002Fsteadfaste-design\u002FSKILL.md",true,[49,55,59],{"path":50,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":53,"sourceHtmlUrl":54},"references\u002Fllm-consult-via-openrouter.md","REFERENCE","参考文档",2127,"https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fsoftware-development\u002Fsteadfaste-design\u002Freferences\u002Fllm-consult-via-openrouter.md",{"path":56,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":57,"sourceHtmlUrl":58},"references\u002Fresearch-party-schema.md",2302,"https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fsoftware-development\u002Fsteadfaste-design\u002Freferences\u002Fresearch-party-schema.md",{"path":60,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":61,"sourceHtmlUrl":62},"references\u002Fworker-registration.md",3908,"https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fsoftware-development\u002Fsteadfaste-design\u002Freferences\u002Fworker-registration.md",[64,72,79,86,93,100],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":71},"01M7DXY4G8NSVB59K8B6S2AQNP","macbook-linux-maintenance","Legacy MacBook Linux fixes: GPU wedge, reboot hang, thermal.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fmacbook-linux-maintenance\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":71},"01M7DXXYJCXFJ3TGB84ZQ8KFE6","governance-regression-triage","Triage a host's governance issues: what changed.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fgovernance-regression-triage\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":71},"01M7DXXSAP1G8FDRJAMXQGBBMK","enforcement-immutability","Use when enforcement files lose their immutable flag.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fenforcement-immutability\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":71},"01M78SSDQVRYX64Y16X32TC0NS","steadfaste-fleet-repo-deploy","Use when committing to the steadfaste-fleet repo.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fsteadfaste-fleet-repo-deploy\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":71},"01M78SS928F3R2RJAYVW4E30CE","steadfaste-fleet-maintenance","Maintain an installed Steadfaste Fleet instance — update both the upstream Hermes Agent and the fleet repo layer, merge diverged histories, sync skills safely, and troubleshoot common issues. Covers the dual-update workflow (hermes update + fleet-update.sh), encrypted brain data backup, mycortex import, and recovery techniques.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fsteadfaste-fleet-maintenance\u002FSKILL.md",[],[],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":71},"01M78SP1CHW0T0BWE5ZT6JBPX8","fleet-preflight","DEPRECATED alias — merged into survey-before-action (2026-08-20). Load survey-before-action instead; its \"Repo-Specific Pre-Flight\" section covers git search, Hermes boundary, and deployment verification.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Ffleet-preflight\u002FSKILL.md",[],[]]