crumb-spec
Crumb Protocol specification and filesystem standard for sovereign AI agents
Brought by drakestapleton
crumb-spec / EXTENDING.md
| 1 | # Extending the Crumb Protocol |
| 2 | |
| 3 | The Crumb Protocol is designed to be fully extensible. Anyone can create custom metadata schemas, domain-specific extensions, and agent tool bindings without breaking standard compatibility. |
| 4 | |
| 5 | --- |
| 6 | |
| 7 | ## 1. Using the `extensions` Block |
| 8 | |
| 9 | Both `.crumb` and `.crumb.local` reserve an optional top-level `extensions` dictionary for custom metadata. Standard parsers will preserve these fields unchanged during read-modify-write operations. |
| 10 | |
| 11 | ### Example: Security and Compliance Extension |
| 12 | ```json |
| 13 | { |
| 14 | "schema_version": "1.0.0", |
| 15 | "name": "payment-vault", |
| 16 | "purpose": "Encrypted credit card token storage", |
| 17 | "invariants": ["Zero plaintext cards"], |
| 18 | "extensions": { |
| 19 | "security": { |
| 20 | "pci_dss_level": 1, |
| 21 | "audit_required_on_mutation": true, |
| 22 | "sanitization_routine": "crate::vault::sanitize_payload" |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | ``` |
| 27 | |
| 28 | ### Example: ML and Weights Extension |
| 29 | ```json |
| 30 | { |
| 31 | "schema_version": "1.0.0", |
| 32 | "name": "vision-encoder", |
| 33 | "purpose": "SigLIP2 vision encoder weights and forward pass", |
| 34 | "extensions": { |
| 35 | "ml": { |
| 36 | "framework": "Modular MAX", |
| 37 | "model_type": "bfloat16", |
| 38 | "kv_cache_dim": 128, |
| 39 | "supported_devices": ["cuda", "grace-blackwell"] |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | ``` |
| 44 | |
| 45 | --- |
| 46 | |
| 47 | ## 2. Creating Custom Scent Types in `.crumb.local` |
| 48 | |
| 49 | You can extend `active_scents` with custom telemetry: |
| 50 | ```json |
| 51 | { |
| 52 | "active_scents": { |
| 53 | "BenchmarkBot": { |
| 54 | "focus": "Running continuous inference latency sweeps", |
| 55 | "updated_at": "2026-09-18T20:45:00Z", |
| 56 | "ttl_seconds": 600, |
| 57 | "metadata": { |
| 58 | "batch_size": 32, |
| 59 | "current_throughput_tok_per_sec": 482.5 |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | ``` |
| 65 | |
| 66 | --- |
| 67 | |
| 68 | ## 3. Integrating with Existing Agent Frameworks |
| 69 | |
| 70 | ### In LangChain / LangGraph |
| 71 | Add a pre-tool hook that reads `.crumb` from the current working directory and prepends `invariants` into the agent's scratchpad. |
| 72 | |
| 73 | ### In Claude Code / Cursor / Windsurf |
| 74 | Add a prompt rule or system instruction: |
| 75 | > "Before editing any file, read .crumb and .crumb.local in the enclosing folder. Obey all declared invariants and do not modify files held under an active lock." |
| 76 | |
| 77 | ### In Custom Rust / Python Pipelines |
| 78 | Use the reference readers in `examples/reference-clients/` to integrate sniffing directly into tool calling loops. |