amplifier-foundation/amplifier-foundation/skills/bundle-to-dot/SKILL.md
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.
npx skillsauth add microsoft/amplifier-foundation bundle-to-dotInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
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).
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.
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 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.
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:
label="..." values on nodes and clusters, plus the graph titlesource_hash="..." graph attribute exactly as-is\n for line breaksbundle.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.
| 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 |
generate-bundle-docs
Calls bundle_repo_dot(repo_path), checks freshness via source_hash, writes
bundle.dot (optionally LLM-enhanced) and renders bundle.png at the repo root.
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.png
Regenerate when any of the following change in the repository:
bundle.md / bundle.yaml at repo rootbehaviors/ (behavior bundles)bundles/ (standalone bundles)agents/ (agent definitions)context/ (context files)providers/, experiments/Tip: If unsure, run validate-bundle-repo — it checks hashes and
regenerates only if stale.
from amplifier_foundation.bundle_docs import bundle_repo_dot
dot_content = bundle_repo_dot(repo_root) # returns DOT string with source_hash
The function is the sole public entry point. It takes a str | Path pointing
to the repository root and returns a complete DOT graph string.
Before committing a bundle or behavior change:
bundle.dot exists at repo rootsource_hash in bundle.dot matches current repo state (or run generate-bundle-docs)bundle.png exists and is freshdevelopment
Use when starting work in any repository, and again at each work-phase transition (design, coding, debugging, verification, opening a PR). Loads the canonical per-repo-conventions guidance from foundation:docs/PER_REPO_CONVENTIONS.md — the discovery pattern for AGENTS.md, PR templates, CONTRIBUTING.md, and contextual files (PRINCIPLES.md, SMOKE_TESTS.md, KNOWN_ISSUES.md), plus the re-read cadence and verification gradient.
tools
Use when creating a new Amplifier module (tool, hook, orchestrator, context, or provider). Covers the mount() contract, protocol compliance validation, placeholder patterns, and the module directory structure. Prevents the common mistake of creating no-op mount() stubs that fail protocol_compliance validation.
tools
Use when creating a new Amplifier module (tool, hook, orchestrator, context, or provider). Covers the mount() contract, protocol compliance validation, placeholder patterns, and the module directory structure. Prevents the common mistake of creating no-op mount() stubs that fail protocol_compliance validation.
testing
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.