|
| 1 | +# tomllm |
| 2 | + |
| 3 | +TOML + LLM comment conventions: tribal knowledge in `#comments`, stripped for data pipelines. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +`.tomllm` files are **valid TOML** with enriched `#` comment semantics: |
| 8 | + |
| 9 | +- Comments associate with the next key-value pair or section header |
| 10 | +- Special prefixes encode tribal knowledge: `# 🤓`, `# @tribal:`, `# @example:`, `# @requires:` |
| 11 | +- Tail-map block (last ≤10 lines): fast executive agent scanning without full context load |
| 12 | +- Comments are FOR agents reading the **source file** as documentation — strip them for downstream pipelines |
| 13 | + |
| 14 | +## Cognitive Tiers |
| 15 | + |
| 16 | +Each `.tomllm` file MAY declare its required cognitive tier in the tail-map: |
| 17 | + |
| 18 | +| Tier | Models | Tasks | |
| 19 | +|------|--------|-------| |
| 20 | +| `sm0l` | qwen2.5-3B, haiku | classify, route, grep, format | |
| 21 | +| `ch0nky` | qwen3-coder (local) | implement, refactor, debug | |
| 22 | +| `frontier` | claude-opus/sonnet | architecture, security, novel design | |
| 23 | + |
| 24 | +## Example |
| 25 | + |
| 26 | +```toml |
| 27 | +# @tribal: always use uv pip, never pip install directly |
| 28 | +# @example: uv pip install requests |
| 29 | +package_manager = "uv" |
| 30 | + |
| 31 | +# b00t:map v1 |
| 32 | +# summary: Python toolchain config |
| 33 | +# tags: python, uv |
| 34 | +# tier: sm0l |
| 35 | +# complexity: 2 |
| 36 | +``` |
| 37 | + |
| 38 | +## Usage |
| 39 | + |
| 40 | +### Rust |
| 41 | + |
| 42 | +```rust |
| 43 | +use tomllm::TomllmDoc; |
| 44 | + |
| 45 | +let doc = TomllmDoc::parse(input)?; |
| 46 | +let clean_json = doc.strip_for_pipeline(); // stripped TOML as JSON |
| 47 | +let tier = doc.cognitive_tier(); // sm0l / ch0nky / frontier |
| 48 | +let map = doc.map_block; // Option<MapBlock> |
| 49 | +``` |
| 50 | + |
| 51 | +### Python (maturin) |
| 52 | + |
| 53 | +```python |
| 54 | +from tomllm import TomllmDoc, MapBlock |
| 55 | + |
| 56 | +doc = TomllmDoc.parse(text) |
| 57 | +print(doc.cognitive_tier()) # "sm0l" |
| 58 | +print(doc.strip_for_pipeline()) # JSON string |
| 59 | + |
| 60 | +block = MapBlock.from_text(text) |
| 61 | +if block: |
| 62 | + print(block.summary, block.tier, block.tags) |
| 63 | +``` |
| 64 | + |
| 65 | +### TypeScript / WASM |
| 66 | + |
| 67 | +```typescript |
| 68 | +import init, { TomllmDoc } from '@promptexecution/tomllm'; |
| 69 | + |
| 70 | +await init(); |
| 71 | +const doc = TomllmDoc.parse(text); |
| 72 | +``` |
| 73 | + |
| 74 | +## Install |
| 75 | + |
| 76 | +```bash |
| 77 | +# Rust |
| 78 | +cargo add tomllm |
| 79 | + |
| 80 | +# Python |
| 81 | +pip install tomllm |
| 82 | + |
| 83 | +# npm |
| 84 | +npm install @promptexecution/tomllm |
| 85 | +``` |
| 86 | + |
| 87 | +## Tail-map format |
| 88 | + |
| 89 | +```toml |
| 90 | +# b00t:map v1 |
| 91 | +# summary: one-line human+LLM description |
| 92 | +# tags: comma, separated, keywords |
| 93 | +# tier: sm0l|ch0nky|frontier |
| 94 | +# cmds: b00t hive activate inference-qwen3, b00t hive status |
| 95 | +# complexity: 1-10 |
| 96 | +``` |
| 97 | + |
| 98 | +## License |
| 99 | + |
| 100 | +MIT |
| 101 | + |
| 102 | +<!-- b00t:map v1 |
| 103 | +summary: tomllm — TOML + LLM comment conventions crate |
| 104 | +tags: toml, llm, agent, config, annotations, wasm, python |
| 105 | +tier: sm0l |
| 106 | +cmds: cargo test, maturin build --features python, wasm-pack build |
| 107 | +complexity: 3 |
| 108 | +--> |
0 commit comments