Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/crumb-spec/blob/main/ROLES.md # crumb-spec Crumb Protocol specification and filesystem standard for sovereign AI agents Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `crumb-spec / ROLES.md` 94 lines · 3972 bytes Raw Blame History Rendered 1 # The Agent Crumb Role and Behavioral Protocol 2 3 This document defines how autonomous agents, coding assistants, and subagents must behave when operating inside a Crumb-enabled codebase. 4 5 --- 6 7 ## 1. The Four Operational Phases 8 9 Every interaction with a codebase follows a four-step lifecycle: 10 11 ``` 12 ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ 13 │ 1. Sniff │ ──> │ 2. Lease │ ──> │ 3. Execute │ ──> │ 4. Whisper │ 14 │ (Read Scent) │ │ (Advisory) │ │ (Mutate/Test)│ │ & Scent │ 15 └──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘ 16 ``` 17 18 ### Phase 1: Sniff 19 Before opening or mutating files in directory `D`: 20 1. **Inspect `.crumb`**: 21 - Verify directory role and boundary. 22 - Read and respect `invariants`. If your planned change violates an invariant, stop immediately. 23 - Note the `above` reference to understand parent expectations. 24 2. **Inspect `.crumb.local`**: 25 - Check `locks` for existing claims on target files. 26 - Read `whispers` for notes left by prior agents. 27 - Read `active_scents` to identify peer agents working concurrently. 28 29 ### Phase 2: Lease (Advisory Lock) 30 If performing a multi-step operation or modifying shared files: 31 1. Open `.crumb.local` (create if absent). 32 2. Insert an entry under `locks`: 33 ```json 34 "src/service.rs": { 35 "holder": "", 36 "intent": "Refactoring connection pool timeout handling", 37 "acquired_at": "2026-09-18T20:30:00Z", 38 "ttl_seconds": 1800 39 } 40 ``` 41 3. Update `active_scents` with your current focus. 42 43 ### Phase 3: Execute 44 Perform the necessary code generation, refactoring, testing, or debugging while preserving the invariants declared in `.crumb`. 45 46 ### Phase 4: Whisper and Scent Dropping 47 Upon task completion, pause, or delegation: 48 1. **Release Lock**: Remove your lock from `locks` in `.crumb.local`. 49 2. **Append History Vector**: Record what was done: 50 ```json 51 { 52 "agent": "", 53 "action": "modify", 54 "target": "src/service.rs", 55 "intent": "Refactor pool timeouts", 56 "vector": "performance-resilience", 57 "timestamp": "2026-09-18T20:42:00Z" 58 } 59 ``` 60 3. **Leave Whispers for Succeeding Agents**: 61 If a test failed, an assumption needs review, or work was partially delegated: 62 ```json 63 { 64 "from": "", 65 "to": "ReviewerAgent", 66 "message": "Connection pooling timeouts verified under load. Ready for PR review.", 67 "target_file": "src/service.rs", 68 "timestamp": "2026-09-18T20:42:10Z" 69 } 70 ``` 71 72 --- 73 74 ## 2. Agent Conflict Resolution Rules 75 76 When an agent sniffs a directory and finds an active lock held by another agent: 77 78 1. **Lock Expired (`now - acquired_at > ttl_seconds`)**: 79 - The agent may break the stale lock, remove the entry, and proceed. 80 2. **Lock Active on Same Target**: 81 - The agent MUST NOT overwrite the locked file without coordination. 82 - The agent SHOULD switch to an independent task, or leave a high-priority whisper requesting release. 83 3. **Lock Active on Different Target in Same Directory**: 84 - The agent MAY proceed on its non-conflicting file, provided it respects the broader directory scent. 85 86 --- 87 88 ## 3. Subagent Handoff Protocol 89 90 When an orchestrator spawns subagents: 91 1. The orchestrator leaves a whisper in the root directory specifying subagent IDs and assigned tasks. 92 2. Each subagent navigates to its assigned target directory, sniffs the `.crumb`, and registers its own scent in `.crumb.local`. 93 3. When the subagent completes its goal, it writes a completion whisper and terminates cleanly. 94 4. The parent orchestrator sniffs the target directory to verify the completion receipt.