interplane.Get Omega
Read in your language

aien-architecture-mv

Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.

Brought by drakestapleton

branch main Branches Tags History

aien-architecture-mv / docs / crumbs / AGENT_WORKFLOW.md

55 lines · 5533 bytes Raw Blame History Rendered
1# How an agent works with Crumbs (RFC-0001 + RFC-0002)
2
3One rule, always: **before modifying an unfamiliar repository path, inspect the applicable Crumb. Respect its invariants and shared locks. Follow related Crumbs, Git history, evidence and active continuation state until the purpose of the code is understood. Do not rely on undocumented assumptions from previous sessions.** Context is loaded on demand; nobody hands you the whole architecture up front.
4
5## Meeting an unfamiliar file
6```
7crumb explain native/kernel/core/infer.c
8```
9You get, in bounded sections: what the directory is for and its layer; the invariants it inherits from parent crumbs; who holds locks or scents there right now; the last commits that touched the path and any commit the crumb calls significant; evidence references; and the newest Continuation Crumb whose scope includes it, with its PROVEN / PARTIAL / BLOCKED lines. Follow the references that matter (`git show <sha>`, the receipt file, the related `.crumb`) instead of reading everything.
10
11## Doing a cut (RFC-0001 lifecycle, now repository-wide)
12```
13crumb sniff <agent> <dir> # read before touching; shows agents, locks, whispers from EVERY worktree
14crumb claim <agent> <dir> <target> "<intent>" # exit 2 = someone else holds it: stop, read their scent, do not take it
15crumb update <agent> <dir> "<focus>" # heartbeat while you work
16crumb whisper <agent> <dir> - "<finding>" # what the next agent must know
17crumb close <agent> <dir> <target> modify "<what landed>" # after pushing
18```
19`<agent>` is a stable session id you choose once (e.g. `claude-l6b-7f32`), never a process id. Targets are repository-relative; it does not matter which worktree you run the command in.
20
21## Enforced repositories: one identity per session, check before every write (RFC-0002 sections 2.7, 2.8)
22In a repository with `git config crumb.enforce true` (or `CRUMB_ENFORCE=1`) the write gate of your runtime runs `crumb check <you> <repo-root> <path>` before each write and blocks on anything but exit 0. So:
23- Your `<agent>` is `<agent-name>.<session-id>` (matches `^[A-Za-z0-9][A-Za-z0-9_.@-]{0,159}$`, used verbatim). Never share it with another session: a second live session presenting it is refused.
24- Claim before you write: `crumb claim <you> . <path-or-dir> "<intent>" <ttl>`. A directory lease covers everything below it; a claim that overlaps another agent's lease (same path, an ancestor or a descendant) exits 2. Note the `generation <N>` it prints.
25- `crumb check <you> . <path> [--generation N] [--key K]` answers `HELD ... generation <N> expires <time>` (exit 0) or `REFUSED absent|expired|held-by <who>|key <have>!=<want>|generation <have>!=<want> ...` (exit 2). A re-check passes both `--key` and `--generation` from the HELD line. Exit 1, 3 or 4 mean the store itself is broken or misconfigured: stop and report it; do not work around it.
26- Renew (claim again) before `expires`; a renewal keeps the generation, a lapsed lease does not.
27
28Onboarding a repository (once per shared root, then once per clone), which is also the migration rule from a layout-1 store (old leases are not carried over; close them in the old store):
29```
30git config crumb.coordinationRoot /abs/shared/root # the same absolute directory in every clone
31crumb store-init . # first clone only: layout 2 (refused unless old flat record dirs are provably empty)
32git config crumb.storeId "$(crumb store-id .)" # every clone
33git config crumb.repoId <owner>/<repo> # only if origin is not host/<owner>/<repo>
34git config crumb.enforce true # every clone
35```
36
37## Ending a long session (QUIESCE -> CHECKPOINT -> VERIFY -> WHISPER -> RELEASE)
381. Quiesce: no new branches, decisions or workers; finish the cut in hand to a clean boundary or record exactly where it stopped.
392. `crumb checkpoint <agent> --reason context-pressure` (today: `cc.sh new`), fill the record from the machine state (`git`, receipts, test output), not from memory. Tag every fact PROVEN (with a reference) / PARTIAL / BLOCKED (named dependency) / ASSUMED / OPEN. Keep the definition of done verbatim. Order next tasks by dependency with gates. Carry operator boundaries and who-owns-what.
403. Seal (`--seal` / `cc.sh seal`): the checks must pass; the tool leaves the pointer whisper.
414. Release every lock with `crumb close`.
42
43## Starting a session (SNIFF -> RESOLVE -> REVALIDATE -> LEASE -> RESUME)
441. `crumb sniff` the root: the high-priority whisper names the continuation id (or read `continuations/LATEST`).
452. `crumb resume <id>` (today: `cc.sh resume <id>`): prints the record and compares it with the live repository; stale or superseded pins are flagged.
463. Judge each flag yourself: has the top blocker been fixed since? did main move past the pin? Record verdicts. Re-read the cheapest critical receipt; do not rerun long gates just to feel sure.
474. Re-claim the owned paths. Exit 2 means another agent is there: stop.
485. Do `first_action`. Only now.
49
50## What not to do
51- Do not paste the previous conversation into the new one.
52- Do not call something PROVEN because a previous agent sounded sure. Point at the receipt or downgrade it.
53- Do not soften the definition of done while checkpointing.
54- Do not write to `.crumb.local` inside a repository; the shared store is authoritative. Legacy files are read, imported with provenance, and left alone.
55- Do not start work before the lock table is rebuilt.