interplane.Get Omega
Read in your language

crumb-spec

Crumb Protocol specification and filesystem standard for sovereign AI agents

Brought by drakestapleton

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
3This 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
9Every 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
19Before opening or mutating files in directory `D`:
201. **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.
242. **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)
30If performing a multi-step operation or modifying shared files:
311. Open `.crumb.local` (create if absent).
322. Insert an entry under `locks`:
33 ```json
34 "src/service.rs": {
35 "holder": "<AGENT_ID>",
36 "intent": "Refactoring connection pool timeout handling",
37 "acquired_at": "2026-09-18T20:30:00Z",
38 "ttl_seconds": 1800
39 }
40 ```
413. Update `active_scents` with your current focus.
42
43### Phase 3: Execute
44Perform the necessary code generation, refactoring, testing, or debugging while preserving the invariants declared in `.crumb`.
45
46### Phase 4: Whisper and Scent Dropping
47Upon task completion, pause, or delegation:
481. **Release Lock**: Remove your lock from `locks` in `.crumb.local`.
492. **Append History Vector**: Record what was done:
50 ```json
51 {
52 "agent": "<AGENT_ID>",
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 ```
603. **Leave Whispers for Succeeding Agents**:
61 If a test failed, an assumption needs review, or work was partially delegated:
62 ```json
63 {
64 "from": "<AGENT_ID>",
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
76When an agent sniffs a directory and finds an active lock held by another agent:
77
781. **Lock Expired (`now - acquired_at > ttl_seconds`)**:
79 - The agent may break the stale lock, remove the entry, and proceed.
802. **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.
833. **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
90When an orchestrator spawns subagents:
911. The orchestrator leaves a whisper in the root directory specifying subagent IDs and assigned tasks.
922. Each subagent navigates to its assigned target directory, sniffs the `.crumb`, and registers its own scent in `.crumb.local`.
933. When the subagent completes its goal, it writes a completion whisper and terminates cleanly.
944. The parent orchestrator sniffs the target directory to verify the completion receipt.