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 Source # The Agent Crumb Role and Behavioral Protocol This document defines how autonomous agents, coding assistants, and subagents must behave when operating inside a Crumb-enabled codebase. ## 1. The Four Operational Phases Every interaction with a codebase follows a four-step lifecycle: ``` ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ 1. Sniff │ ──> │ 2. Lease │ ──> │ 3. Execute │ ──> │ 4. Whisper │ │ (Read Scent) │ │ (Advisory) │ │ (Mutate/Test)│ │ & Scent │ └──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘ ``` ### Phase 1: Sniff Before opening or mutating files in directory `D`: - Inspect `.crumb`: - Verify directory role and boundary. - Read and respect `invariants`. If your planned change violates an invariant, stop immediately. - Note the `above` reference to understand parent expectations. - Inspect `.crumb.local`: - Check `locks` for existing claims on target files. - Read `whispers` for notes left by prior agents. - Read `active_scents` to identify peer agents working concurrently. ### Phase 2: Lease (Advisory Lock) If performing a multi-step operation or modifying shared files: - Open `.crumb.local` (create if absent). - Insert an entry under `locks`: ``` "src/service.rs": { "holder": "", "intent": "Refactoring connection pool timeout handling", "acquired_at": "2026-09-18T20:30:00Z", "ttl_seconds": 1800 } ``` - Update `active_scents` with your current focus. ### Phase 3: Execute Perform the necessary code generation, refactoring, testing, or debugging while preserving the invariants declared in `.crumb`. ### Phase 4: Whisper and Scent Dropping Upon task completion, pause, or delegation: - Release Lock: Remove your lock from `locks` in `.crumb.local`. - Append History Vector: Record what was done: ``` { "agent": "", "action": "modify", "target": "src/service.rs", "intent": "Refactor pool timeouts", "vector": "performance-resilience", "timestamp": "2026-09-18T20:42:00Z" } ``` - Leave Whispers for Succeeding Agents: If a test failed, an assumption needs review, or work was partially delegated: ``` { "from": "", "to": "ReviewerAgent", "message": "Connection pooling timeouts verified under load. Ready for PR review.", "target_file": "src/service.rs", "timestamp": "2026-09-18T20:42:10Z" } ``` ## 2. Agent Conflict Resolution Rules When an agent sniffs a directory and finds an active lock held by another agent: - Lock Expired (`now - acquired_at > ttl_seconds`): - The agent may break the stale lock, remove the entry, and proceed. - Lock Active on Same Target: - The agent MUST NOT overwrite the locked file without coordination. - The agent SHOULD switch to an independent task, or leave a high-priority whisper requesting release. - Lock Active on Different Target in Same Directory: - The agent MAY proceed on its non-conflicting file, provided it respects the broader directory scent. ## 3. Subagent Handoff Protocol When an orchestrator spawns subagents: - The orchestrator leaves a whisper in the root directory specifying subagent IDs and assigned tasks. - Each subagent navigates to its assigned target directory, sniffs the `.crumb`, and registers its own scent in `.crumb.local`. - When the subagent completes its goal, it writes a completion whisper and terminates cleanly. - The parent orchestrator sniffs the target directory to verify the completion receipt.