From dc2508f941a9fdaa4b20a0cb71514d9070287a44 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Fri, 6 Nov 2026 16:43:45 -0600 Subject: [PATCH 1/9] docs: correct Crumb store scope and deployed-evidence assumptions (refs #158) --- skills/crumb-protocol/SKILL.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/skills/crumb-protocol/SKILL.md b/skills/crumb-protocol/SKILL.md index 9045456..5648507 100644 --- a/skills/crumb-protocol/SKILL.md +++ b/skills/crumb-protocol/SKILL.md @@ -5,7 +5,7 @@ description: Work with the AIEN Crumb Protocol correctly. Use before editing, cr # Crumb Protocol: coordinate through the repository, not the chat log -Crumbs are how agents in AIEN repositories find out what a directory is for, who is already working in it, and what changed under it, without anyone handing over the whole architecture. The doctrine calls this spatial grounding and provenance; the rules below are what is enforced. Do not confuse the Crumb Protocol with Crumbline, the training curriculum in `aien-sovereign-core/crates/crumbs`, which shares a word and nothing else. +Crumbs are how agents in AIEN repositories find out what a directory is for, who is already working in it, and what changed under it, without anyone handing over the whole architecture. The doctrine calls this spatial grounding and provenance. Verify which commands and runtime hooks enforce each rule; prose and advisory notices alone do not enforce exclusion. Do not confuse the Crumb Protocol with Crumbline, the training curriculum in `aien-sovereign-core/crates/crumbs`, which shares a word and nothing else. Sources, read 2026-10-25: the protocol page https://github.com/aien-dev/aien-architecture-mv/blob/main/docs/CRUMB_PROTOCOL.md, the agent workflow https://github.com/aien-dev/aien-architecture-mv/blob/main/docs/crumbs/AGENT_WORKFLOW.md, and the tool itself https://github.com/aien-dev/aien-architecture-mv/blob/909f8094b644c490a0ed49503ef5f294787886a7/tools/crumb/crumb.c, whose usage and exit codes are the truth where documents disagree. The frozen normative text is RFC-0001 in https://github.com/aien-dev/crumb-spec-mv (`SPEC.md`, `ROLES.md`, `schema/crumb.schema.json`) at commit `10b8251`; that repository was renamed from `aien-spark/crumb-spec` and is archived read-only, so old links still name the previous owner. @@ -22,7 +22,13 @@ Two writers, one file. Humans and agents own the semantic kernel: `purpose`, `la A repository's root crumb names where the repository hangs in the org graph under `extensions.map` (PENDING with `synapse-map`, 2026-10-27): `{"parent": "owner/repo@" or null, "parent_status": "CONFIRMED"}`, next to the ordinary top-level `purpose` and `layer`. The parent cannot be a top-level key because of `additionalProperties: false`. `synapse-map import` treats a parent without this crumb entry as INFERRED. `crumb claim` locks directories inside one checkout's shared store; leases that must be visible across repositories, sessions and outside targets (PRs, branches, email recipients) go through `synapse-claims`. -Inside a git repository, live coordination no longer lives in `.crumb.local`: new writes go to the shared store under `/crumb/v1/{dirs,agents,continuations,ledger}`. The old file is a read path, merged in with provenance when present. So do not write `.crumb.local` by hand, and never delete or edit the store to clear a state you do not like; the tool keeps it transactionally consistent for a reason. +For the C `crumb` tool, repository operations use `CRUMB_COORD_ROOT`, then `git config crumb.coordinationRoot`, then `/crumb/v1`. Linked worktrees share the default store; independent clones and other machines do not. Confirm the resolved store and expected STORE_ID for each worker before claiming shared coordination. Use a registered identity and strict checking supported by the deployed tool. An identical copied marker does not prove two paths reach the same live store. + +Keep stores separated by repository unless the chosen interface explicitly namespaces repository identities. The C tool keys paths relative to a repository, so pointing unrelated repositories at one unnamespaced root can create false conflicts. Remote workers must reach the same authority through a verified supported transport, not independent synchronized copies. + +The older Rust CLI and spark-crumbs still write `.crumb.local` as directory-local telemetry. They are a different implementation from the transactional C store. Treat their history and whispers as advisory; they establish neither an exclusive claim nor delivery into another model session. Never delete a store to silence a conflict. + +Source audit, 2026-11-06: C tool at aien-architecture-mv `12ad0141b41ec67ef5aa51cb4e1815894c1083bb`; CLI and spark-crumbs at aien-sovereign-core-mv `dffdbd195edcbe1ec3bd2fa255355b15c530f31e`. Track runtime integration in [core #924](https://github.com/aien-dev/aien-sovereign-core-mv/issues/924) and existing [session delivery #587](https://github.com/aien-dev/aien-sovereign-core-mv/issues/587). Installed versions and cross-machine behavior remain to be measured. Legacy warning: the older Rust implementation wrote `version`, `dir_path`, `history` and `whispers` into `.crumb`. Those files still exist in some repositories. The tool leaves them untouched and reports them as legacy. Do not copy that shape into a new crumb. @@ -49,7 +55,7 @@ crumb close "" # release, history ``` - Claim before a multi-step change to shared files, and for any path another agent could pick up. Defaults are a 3600 s scent and an 1800 s lock; state a longer ttl when the work needs it. -- Targets are repository relative, so a claim from any worktree protects that path in all of them. +- Targets are repository relative. Claims contend only when workers use the same authoritative store and compatible key interpretation. Verify contention from two independent clones as well as two linked worktrees. The lock is advisory: the actual writing tool must check ownership and lease validity before its effect. - Exit 2 on `claim` means another agent holds it, and the tool prints the holder, worktree and intent. Stop, work elsewhere, or whisper at `high` priority to coordinate. Do not treat it as a tool bug and do not work anyway. The same code is returned by `crumb create` on a directory that already has a crumb, so read the message. - Whisper the seam you found, the trap you hit, the state you left. Not a status report and not the conversation. - Close after the branch is pushed, naming what landed. @@ -76,7 +82,7 @@ crumb migrate [root] # strip committed generated data and mark the root on- crumb validate [path] # RFC-0001 required-field check; exit 1 if any file is invalid ``` -What makes a crumb stale: verify rebuilds every crumb from the tracked blobs in the working tree and compares content digests, ignoring stamps, bottom up. A crumb is current when the tree and the last commits beneath it match what compile would write now. In practice: finish the content change, compile, then commit the crumbs in the same commit as the work. +First read the root's `extensions.generated_policy`. In legacy mode, verify compares generated content digests and compile refreshes committed generated data. In `on-demand` mode, committed `extensions.generated` is stale; compile strips it and digest derives it when requested. Do not regenerate and commit roll-up data in an on-demand repository. Core main at `dffdbd195edcbe1ec3bd2fa255355b15c530f31e` already selects on-demand mode. Preserve handwritten purpose, exports and invariants when reconciling old branches. Measured 2026-10-25 in a scratch git repository with the pinned tool: `compile` then `commit` then `verify` gave `OK`; adding one file afterwards gave `STALE` for both crumbs and `verify` exit 1 with `run: crumb compile`; recompiling and committing restored `OK`, and a further compile rewrote nothing. In a repository that has been migrated to on-demand generated data, a committed `extensions.generated` block is itself stale by design and compile strips it. @@ -98,9 +104,9 @@ tests/gates/run.sh crumb-verify # needs the ../aien-architecture sibling; wi That step archives the aien-architecture commit named in `crumb.lock`, builds `tools/crumb/crumb` from it, and runs `crumb verify .`. The readiness path is the same judgement: `aien-local-ci verify ` prints the pinned tool and a CURRENT or STALE status, and a repository is READY only when its crumbs are CURRENT. That gate step runs inside the untrusted candidate check; the trusted readiness path does not take its checker from the candidate (below). -Failure means the committed crumb text lost its fixed point with the tree at that commit: source changed after the last compile, someone hand-edited generated data, or the layout moved. It is never "the gate is noisy". +Classify the actual error before repair: missing repository/tool/dependency, invalid JSON, legacy stale generated data, or generated data forbidden by on-demand mode. A failed wrapper is not proof of stale content. `crumb verify` does not execute invariant checks or prove peer coordination. -Tool skew is the usual cause of a disagreement, because four paths can pick four different builds: the repository gate from `crumb.lock`, the hosted workflow from its own pin, a worker's readiness check, and your own compile. On this machine `omega-mv` pins `d0f0b95d`, while `aien-sovereign-core-mv`, the hosted workflow and the sandbox install pin `94fffbcf`. Use the pin the repository names. +Compare the repository gate, hosted workflow, trusted readiness checker and worker tool identities. Core source at `dffdbd195edcbe1ec3bd2fa255355b15c530f31e` pins `12ad0141b41ec67ef5aa51cb4e1815894c1083bb`; this is not evidence of the installed worker or hosted checker version. Read each actual pin and binary identity instead of treating old machine-specific values in a guide as current. Which tree may choose the checker changed in aien-sovereign-core-mv main `2369d7c834971eb91b8a20bab40b6ca7692064f5` (PR #771, fixing issue #770, merged 2026-10-26). That state is MERGED in source and NOT_DEPLOYED: no trusted verifier, local-CI helper, shim or doctor from it was installed or restarted, so an operator install that predates the cutover still follows the older rule (the candidate tree's `crumb.lock`, else the in-tree tool when the tree is aien-architecture, else the sandbox build). Check the installed copy before relying on either rule. The merged rule: @@ -164,7 +170,7 @@ State what you ran and what it returned. A crumb change is part of the change un Merged to core main on 2026-10-31 as `b7f2250a` (core#887, DRA-95). The merge came from the `ready-to-merge` label with no review; a post-merge review found no reason to revert. Every invariant in a shipped-path `.crumb` ends with `Check: `, naming the test or script that enforces it, for example `"A reused KV block never exposes the previous sequence's KV. Check: cargo test -p aien-kv-cache --test kv_lifecycle_qualification -- --exact freed_block_reuse_never_exposes_previous_sequence_kv"`. An invariant with no check you can name and run does not go in the crumb; list it in the PR as unenforced instead. -These crumbs are hand-written and do not parse as the `DirCrumb` struct that `spark-crumbs` and the `aien` CLI read. Until a loader fix merges, `spark-crumbs show`, `sniff` or `record`, and `aien` nest, sniff or show, run in such a directory, overwrite its `.crumb` with an auto-sensed one, and `crumb verify` still passes. Do not run them there; if one ran, restore the file with `git checkout -- /.crumb` before committing. +The source at core `dffdbd195edcbe1ec3bd2fa255355b15c530f31e` now treats foreign handwritten crumbs as read-only and includes preservation tests in both implementations. Verify the installed binary before assuming that fix is deployed. Inspect and preserve valid uncommitted semantic edits when recovering an old overwrite; do not blindly restore a whole file. The separate telemetry race, hidden I/O errors and hard-coded CLI worker identity remain tracked in core #924. `om/crumb-coverage/run.sh` (Omega, omc pinned in `om/crumb-coverage/omega.pin`, omega-mv `b3346c2e`) counts tracked directories, directories with a `.crumb`, and directories with at least one invariant whose `Check:` resolves to an existing test function or repository script, and lists every check that does not resolve. Without `AIEN_OMC` hashing to the pin it exits 77 NOT_RUN. Measured 2026-10-31 on core main `b7f2250a`: `tracked_dirs 780`, `crumb_dirs 41`, `enforced_dirs 28`, `invariants 46 resolved 46 unresolved 0`; `--self-test` PASS. Before the merge, main `43495111` had 17 of 780 directories with a crumb and 0 enforced. From 43cd762f897e4ee9b01feb4152aa70fb39b084a2 Mon Sep 17 00:00:00 2001 From: Drake Stapleton <213298340+drakestapleton@users.noreply.github.com> Date: Fri, 6 Nov 2026 18:38:09 -0600 Subject: [PATCH 2/9] crumb-protocol: section 12, enforced repositories, crumb check and the session bridge (core#924, core#587) Documents the crumb924 branches (aien-architecture-mv fix/crumb-924-crumb-c, core fix/crumb-924-bridge and fix/crumb-924-telemetry) as IMPLEMENTED/TESTED/PENDING: per-session identity, crumb check exit codes, (key, generation) fencing, layout-2 repository namespaces and store-init, fail-closed enforcement, board delivery with ack after the turn, and the limits (heuristic terminal detection, ungated tools). Carried with de960faa (refs #158). Agent: crumb924 (Hermes worker, claude-opus-5-5, anthropic) --- skills/crumb-protocol/SKILL.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/skills/crumb-protocol/SKILL.md b/skills/crumb-protocol/SKILL.md index 5648507..4e4339d 100644 --- a/skills/crumb-protocol/SKILL.md +++ b/skills/crumb-protocol/SKILL.md @@ -175,3 +175,29 @@ The source at core `dffdbd195edcbe1ec3bd2fa255355b15c530f31e` now treats foreign `om/crumb-coverage/run.sh` (Omega, omc pinned in `om/crumb-coverage/omega.pin`, omega-mv `b3346c2e`) counts tracked directories, directories with a `.crumb`, and directories with at least one invariant whose `Check:` resolves to an existing test function or repository script, and lists every check that does not resolve. Without `AIEN_OMC` hashing to the pin it exits 77 NOT_RUN. Measured 2026-10-31 on core main `b7f2250a`: `tracked_dirs 780`, `crumb_dirs 41`, `enforced_dirs 28`, `invariants 46 resolved 46 unresolved 0`; `--self-test` PASS. Before the merge, main `43495111` had 17 of 780 directories with a crumb and 0 enforced. The coverage report is advisory: no gate runs it, and `CRUMB-VERIFY` checks only that crumbs are current, not that their checks pass. Resolving a check proves the named test exists, not that it passes; run it. The `.crumb.local` wording in section 1 and the binding-rules change are tracked in aien-dev/omega-harness#158 pending DRA-97 and DRA-98. + +## 12. Enforced repositories, `crumb check` and the session bridge (crumb924, core#924, core#587) + +Status, 2026-11-06: IMPLEMENTED and TESTED on branches, PENDING merge. aien-architecture-mv `fix/crumb-924-crumb-c` (the C tool), aien-sovereign-core-mv `fix/crumb-924-bridge` (`swarm-bridge`, its Hermes shell hooks and the OMP extension) and `fix/crumb-924-telemetry` (`aien-cli`, `spark-crumbs`). Nothing below is deployed until the operator records the installed binary hashes; before that, a repository is not enforced and every lock is advisory. Check `crumb check` exists in the build you run (`crumb` with no arguments prints its usage) before relying on this section. + +What enforcement is. A repository opts in with `git config crumb.enforce true`. In it, the runtime's write gate (Hermes `pre_tool_call` shell hook, OMP `tool_call` extension) runs `crumb check ` before each `write_file`, `patch` and terminal write it can see, and blocks the call on anything but exit 0. Paths outside enforced repositories are not gated. + +Your identity is `.`: the agent name (`AIEN_AGENT_NAME`, else the Hermes profile, else the runtime) and the runtime's own session id, never a constant. Every subagent has its own. Use the exact string the bridge prints in its first-turn notice and in every block message, verbatim; ids match `^[A-Za-z0-9][A-Za-z0-9_.@-]{0,159}$` and nothing is rewritten into an alias. A second live session presenting your id is refused. + +```sh +crumb claim . "" # prints ... generation ; a directory lease covers what is below it +crumb check . [--key K] [--generation N] # HELD by key generation expires