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/README.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 / README.md` 154 lines · 7418 bytes Raw Blame History Rendered 1 # The Crumb Protocol (RFC-0001) 2 3 An open, vendor-neutral filesystem standard for autonomous AI agent spatial grounding, architectural memory, and peer pheromone coordination. 4 5 Free and open for anyone to adopt, implement, extend, and embed across all agent frameworks, IDEs, and autonomous developer swarms. 6 7 ``` 8 ┌────────────────────────────────────────────────────────┐ 9 │ The Crumb Paradigm │ 10 ├────────────────────────────┬───────────────────────────┤ 11 │ Durable Topography │ Ephemeral Scent │ 12 │ (`.crumb`) │ (`.crumb.local`) │ 13 ├────────────────────────────┼───────────────────────────┤ 14 │ • Checked into git │ • Ignored by git │ 15 │ • Defines directory purpose│ • Real-time agent scents │ 16 │ • Spatial parent (`above`) │ • Inter-agent whispers │ 17 │ • Architecture invariants │ • Read/write leases │ 18 │ • Exported interfaces │ • Rolling action vectors │ 19 └────────────────────────────┴───────────────────────────┘ 20 ``` 21 22 --- 23 24 ## The Problem: Agent Amnesia and Context Collapse 25 26 Existing AI software development agents suffer from three structural flaws: 27 28 1. **Context Collapse Across Subdirectories**: LLM context windows degrade when stuffed with arbitrary file trees. When an agent enters a nested subdirectory, it loses awareness of parent boundaries, domain invariants, and global architecture. 29 2. **Multi-Agent Race Conditions**: When multiple autonomous agents (coder, reviewer, verifier, tester) operate simultaneously in a repository, they have no shared physical presence. Agents blind-overwrite each other's work, duplicate tasks, or break assumptions established by a peer. 30 3. **Database Disconnect**: External vector databases or centralized state stores create an out-of-band dependency. When a human developer or another machine clones the repository, that external memory is absent. 31 32 --- 33 34 ## The Solution: Filesystem-Native Memory 35 36 The Crumb Protocol solves these flaws by anchoring agent intelligence directly into the filesystem itself using two lightweight JSON files placed in relevant directories: 37 38 - **`.crumb` (Durable Repository Topology)**: Checked into source control. Establishes the purpose of the directory, its architectural layer, explicit non-negotiable invariants, and pointers to parent and child domains. 39 - **`.crumb.local` (Ephemeral Agent Pheromones)**: Kept in `.gitignore`. Acts as a live pheromone trail tracking which agents are currently active, what intent vectors they are executing, non-blocking inter-agent whispers, and operational locks. 40 41 --- 42 43 ## Core Specification Overview 44 45 Full details are documented in [SPEC.md](SPEC.md). 46 47 ### 1. The Durable Crumb (`.crumb`) 48 49 Located at directory roots. Must be valid JSON matching [schema/crumb.schema.json](schema/crumb.schema.json). 50 51 ```json 52 { 53 "schema_version": "1.0.0", 54 "name": "spark-adapters", 55 "layer": "core/runtime", 56 "purpose": "Provider adapters for frontier LLMs and local MAX distillation", 57 "above": { 58 "name": "aien-sovereign-core", 59 "path": "../../", 60 "invariants": ["Pure native Rust", "Zero disk secrets"] 61 }, 62 "below": [ 63 { "name": "providers", "role": "API translation modules for third-party endpoints" }, 64 { "name": "distill", "role": "Dual-rollout consensus engine" } 65 ], 66 "invariants": [ 67 "All network calls must support cancellation tokens", 68 "Secrets must resolve dynamically via hardware TPM vault, never .env files" 69 ], 70 "exports": [ 71 "spark_adapters::router::route_completion", 72 "spark_adapters::distill::run_dual_rollout" 73 ] 74 } 75 ``` 76 77 ### 2. The Ephemeral Crumb (`.crumb.local`) 78 79 Located alongside `.crumb`. Never committed to git. Must match [schema/crumb-local.schema.json](schema/crumb-local.schema.json). 80 81 ```json 82 { 83 "schema_version": "1.0.0", 84 "directory": "crates/spark-adapters", 85 "active_scents": { 86 "AIEN": { 87 "focus": "Refactoring OpenAI adapter error handling", 88 "updated_at": "2026-09-18T20:30:00Z", 89 "ttl_seconds": 3600 90 } 91 }, 92 "locks": { 93 "src/router.rs": { 94 "holder": "AIEN", 95 "intent": "Adding Anthropic Claude 3.7 hybrid reasoning token schema", 96 "acquired_at": "2026-09-18T20:28:15Z" 97 } 98 }, 99 "whispers": [ 100 { 101 "from": "VerifierAgent", 102 "message": "Verify test_anthropic_thinking passes before merging router changes", 103 "target_file": "src/router.rs", 104 "timestamp": "2026-09-18T20:25:00Z" 105 } 106 ], 107 "history": [ 108 { 109 "agent": "AIEN", 110 "action": "modify", 111 "target": "src/router.rs", 112 "intent": "Implement adaptive temperature scaling", 113 "vector": "inference-stability", 114 "timestamp": "2026-09-18T20:20:00Z" 115 } 116 ] 117 } 118 ``` 119 120 --- 121 122 ## The Four Axioms of the Crumb Rule 123 124 Any autonomous agent operating in a Crumb-enabled repository must adhere to four axioms: 125 126 1. **Sniff Before Touch**: Before opening or modifying any file, the agent must check for `.crumb` and `.crumb.local`. If a peer agent holds an active lock on the file, the agent must yield, collaborate, or wait. 127 2. **Respect Invariants**: The `invariants` block in `.crumb` is authoritative. An agent must never introduce code, dependencies, or patterns that violate declared directory invariants. 128 3. **Leave a Scent**: When starting a non-trivial task, the agent registers its presence in `active_scents`. When finishing or pausing, it appends an action entry to `history`. 129 4. **Whisper on Transition**: When delegating work to a subagent or completing a step that requires review, the agent leaves an explicit message in `whispers`. 130 131 --- 132 133 ## How to Adopt and Extend 134 135 The Crumb Protocol is intentionally simple and dependency-free. You do not need any specific library to read or write crumbs: 136 137 - **Any language can parse it**: It is standard JSON. 138 - **Reference Clients**: See [examples/reference-clients/](examples/reference-clients/) for zero-dependency Python, TypeScript, Shell, and Rust implementations. 139 - **CLI Tooling**: An ultra-fast native Rust implementation is available at [spark-crumbs](https://github.com/aien-dev/spark-crumbs). 140 - **Custom Extensions**: Teams can add custom keys under `extensions` or create new dialects. See [EXTENDING.md](EXTENDING.md). 141 142 --- 143 144 ## Documentation Roadmap 145 146 - [SPEC.md](SPEC.md): Formal RFC-0001 specification. 147 - [WHY.md](WHY.md): Deep architectural rationale comparing crumbs to vector search and prompt stuffing. 148 - [ROLES.md](ROLES.md): Complete operational manual for autonomous agents adopting the Crumb role. 149 - [EXTENDING.md](EXTENDING.md): Guide for creating custom crumb schemas and tool integrations. 150 - [SECURITY.md](SECURITY.md): Guidelines on credential isolation and zero disk secrets. 151 152 ## License 153 154 Dual-licensed under MIT and Apache-2.0. Free for commercial, personal, academic, and sovereign agent use.