bundle-to-dot
Skill17 starsChanged 3 months agoMITView on GitHub
Convention for the v3 bundle documentation system: a single bundle.dot + bundle.png per repo, generated by bundle_repo_dot(). Use when generating, validating, or interpreting bundle documentation files. Covers 7-cluster DOT structure, token cost model, color conventions, external reference distinction, freshness tracking via source_hash, generation recipes, and the lifecycle model.
In this repository5 other files it gives its agents.
- context/understanding-mechanisms/mechanisms/agents.mdAGENTS.md
- libraries/AGENTS.mdAGENTS.md
- creating-amplifier-modulesSkill
- per-repo-conventionsSkill
- fixture-skillSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 104
Keep ALL structural elements unchanged (node IDs, edges, shapes, colors, clusters)
- Very specific: line 105
ONLY rewrite label="..." values on nodes and clusters, plus the graph title
- Very specific: line 106
Keep the source_hash="..." graph attribute exactly as-is
- Very specific: line 162
Tip: If unsure, run validate-bundle-repo — it checks hashes and regenerates only if stale.
- Distinctive: line 182
Before committing a bundle or behavior change:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Bundle Documentation Convention (v3)
Overview
The v3 bundle documentation system produces a single DOT diagram per repository:
| Output | What it is | Location |
bundle.dot | Full 7-cluster structural diagram of the entire repo | Repo root |
bundle.png | Rendered PNG of the diagram | Repo root |
Both files embed a source_hash for freshness tracking. The diagram is
generated by calling bundle_repo_dot(repo_root) from amplifier_foundation.bundle_docs.
What the DOT Shows
The bundle.dot diagram maps the entire repository into 7 cluster subgraphs:
| Cluster | Directory | What it contains |
| Behaviors | behaviors/ | Reusable capability packages (thin bundles) |
| Standalones | bundles/ | Self-contained session bundles |
| Agents | agents/ | Agent .md files with frontmatter |
| Modules | tools/modules | Tool and module declarations |
| Providers | providers/ | Provider configurations |
| Experiments | experiments/ | Experimental bundles (exp-* naming) |
| Context Files | context/ | Shared context files |
The root bundle node is rendered at the center with edges to the clusters that it composes. External references (bundles from other repos) appear with visual distinction (see External References below).
Token Cost Model
The structural DOT encodes the token cost of each component:
| Component | Cost source |
| Tool/module | Tool schema token count (estimated from schema YAML) |
| Agent | meta.description token count + body |
| Context file | Full file content token count (recursive @mention expansion) |
| Bundle instruction | Markdown body token count |
Edges in the DOT reflect composition relationships. Heavier nodes (high token count) appear in more prominent visual styles. The summary node at the bottom of each diagram shows total estimated token cost for the composition.
Visual Conventions
Node Colors (actual code constants from bundle_to_dot.py)
| Element | Fill color | Hex | Notes |
| Root bundle | teal/mint | #80cbc4 | bundle.md at repo root |
| Behavior | light teal | #e0f2f1 | Entries in behaviors/ |
| Standalone | teal/mint | #80cbc4 | Entries in bundles/ (same as root) |
| Agent | light green | #c8e6c9 | Agent .md files |
| Module/tool | light blue | #bbdefb | Tool/module declarations |
| Provider | light grey | #e0e0e0 | Provider configurations |
| Experiment | light purple | #e1bee7 | Entries in experiments/ |
| Context file | light purple | #e1bee7 | Context .md files |
| Cluster fill | near white | #f9f9f9 | Subgraph background |
| Summary node | blue-grey | #eceff1 | Cost summary footer node |
External References
External bundles (referenced by URI, not local to the repo) are visually distinct from local nodes:
| Edge style | Meaning |
| Solid | Local reference — included in token cost count |
| Dashed + red border | External with hidden cost (_COLOR_EXTERNAL_COST = "red") — the external bundle contributes tokens at runtime but is NOT counted in the local total |
Dashed + muted fill (#f5f5f5) | External with no additional cost — referenced externally but costs are borne elsewhere |
The legend node embedded in the DOT explains these conventions inline.
LLM Enhancement
By default, the generate-bundle-docs recipe sends the structural DOT to
foundation:zen-architect for label enhancement: node labels are rewritten
with concise, accessible English summaries rather than raw filenames.
To skip LLM enhancement (structural-only, faster):
# In recipe context
enhance_diagrams: "false"Rules for the LLM enhancement step:
- Keep ALL structural elements unchanged (node IDs, edges, shapes, colors, clusters)
- ONLY rewrite
label="..."values on nodes and clusters, plus the graph title - Keep the
source_hash="..."graph attribute exactly as-is - Labels must be ≤2-3 lines; use
\nfor line breaks
Freshness Model
bundle.dot embeds source_hash="<hash>" as a graph attribute. The hash is
derived from all repository entry points combined (all bundle, behavior, agent,
tool, context, and hook files). If any of these change, the hash changes and
bundle.dot is considered stale.
Findings
| Code | Severity | Meaning |
BUNDLE_DOT_MISSING | SUGGESTION | No bundle.dot found at repo root |
BUNDLE_DOT_STALE | WARNING | bundle.dot source_hash doesn't match current repo state |
Generation
Direct (bulk generation)
generate-bundle-docsCalls bundle_repo_dot(repo_path), checks freshness via source_hash, writes
bundle.dot (optionally LLM-enhanced) and renders bundle.png at the repo root.
Via validation (automatic)
validate-bundle-repo auto-regenerates a stale or missing bundle.dot as a
side effect of validation:
validate-bundle-repo → detects missing/stale → regenerates bundle.dot + bundle.pngLifecycle: When to Regenerate
Regenerate when any of the following change in the repository:
bundle.md/bundle.yamlat repo root- Any file in
behaviors/(behavior bundles) - Any file in
bundles/(standalone bundles) - Any file in
agents/(agent definitions) - Any file in
context/(context files) - Any tool/module declaration
- Any hook definition
- Any file in
providers/,experiments/
Tip: If unsure, run validate-bundle-repo — it checks hashes and
regenerates only if stale.
API Reference
from amplifier_foundation.bundle_docs import bundle_repo_dot
dot_content = bundle_repo_dot(repo_root) # returns DOT string with source_hashThe function is the sole public entry point. It takes a str | Path pointing
to the repository root and returns a complete DOT graph string.
Checklist
Before committing a bundle or behavior change:
bundle.dotexists at repo rootsource_hashinbundle.dotmatches current repo state (or rungenerate-bundle-docs)bundle.pngexists and is fresh
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

