Visual Docs
Create a clear visual atlas of a codebase, feature, workflow, agent system, or change set.
Default output:
docs/{slug}/
graph.json
index.html
index.html must be standalone, embed the exact graph.json, work from file://, and open in the default browser at the end.
The goal is not a pretty report. The goal is that a reader can look at the page and immediately know:
- what this thing is
- where the code starts
- what folders matter
- what arrows connect inputs, code, agents, data, and outputs
- one or more real examples that prove the flow
- what to inspect next for common tasks
Design Basis
Use these ideas quietly; do not name them in the generated HTML unless useful:
- C4-style zoom: context -> containers/packages -> components/modules -> code.
- Runtime scenarios: static structure is not enough; show at least one input-to-output path.
- Code tours: teach through ordered, evidence-backed steps anchored to files.
- Diataxis separation: keep explanation, navigation, reference, and tasks visually distinct.
- Program comprehension is both top-down and bottom-up: start with the mental model, then show exact files and evidence.
Visual Atlas Standard
Every output must follow this structure. If a section cannot be proven, keep it visible and mark it No source found with searched places.
Start Here
- One sentence:
{name} is a {category} for {audience}: it {main job}.
- Show source root, mode, branch/commit, and confidence.
- Show the main path in one line with arrows and verbs.
- Show 3-5 "start reading here" files.
System Shape
- Full searchable/collapsible file tree from
sourceRoot.
- Top-level folder table with: role, why open, key files, example task, evidence.
- Mark generated, vendored, binary, deleted, or skipped areas.
Maps
- Context map: actors/external systems -> this repo.
- Container/package map: apps/packages/modules and ownership boundaries.
- Runtime/change map: input -> entry -> core -> data/config/provider/tools -> output.
- Subsystem maps when detected: agents, prompts, tools, MCP, providers, routes, workflows, plugins.
- Every edge has a visible verb and evidence.
Guided Tours
- 2-4 ordered examples from README, tests, fixtures, demos, commands, or diff hunks.
- Each tour has 3-7 steps.
- Each step has: action, file/path, what happens, why it matters, evidence.
- At least one tour must be a normal runtime/user path for repo/feature mode.
- For change mode, include a before -> after tour.
Deep Lenses
- Agent lens when agents/prompts/tools/providers/workers exist.
- Domain lens when business rules matter.
- Data/API lens when schemas, routes, migrations, or storage matter.
- UI lens when components/screens/state matter.
Next Actions
- Task-oriented navigation: "to change X, start at Y, then check Z."
- Tests/examples to run or inspect.
- Risks, unknowns, disabled/dead paths, missing tests.
The first screen must show the answer and the start of the main path. It must not be a cover page.
Hard Rules
- No unlabeled lines. A line without a verb is noise.
- No giant radial mind map as the primary view.
- No cards replacing the file tree or flow maps.
- No vague claims without evidence.
- No fake examples. Derived examples must be labeled
derived from code.
- No language mixing in UI labels. Keep code identifiers unchanged.
- No CDN, external assets, build step, dev server, or runtime JSON fetch.
- No generated UI label
Golden path.
- Keep diagrams compact. Use details/search/drill-down for depth.
Trigger Modes
Choose the narrowest mode that answers the user:
repo: explain an unfamiliar repository.
feature: explain a feature, module, command, component, API route, tool, prompt stack, or agent system.
changes: explain a branch, PR, local changes, diff, or recent commits.
domain: explain business/product logic behind the code.
Mode requirements:
repo: full file tree, top-level folder atlas, context/container/runtime maps, normal runtime tour, deep lenses for detected subsystems.
feature: boundary file tree, entry point, owner module, input/output, runtime map, examples/tests, nearby code that is not the live path.
changes: base ref, changed-file tree, before/after map, affected contracts, changed examples/tests, blast radius, rollback/risk notes.
domain: actors, objects, actions, outcomes, decisions, rules, domain flow, code locations, real examples.
Scope Rules
- Record current
pwd as sourceRoot.
- Start analysis from
sourceRoot, not automatically from repository root.
- Find nearest git root only for branch, commit, status, diff, and tracked path metadata.
- If broader context is needed, state why in
graph.json.scope.
- Respect
.gitignore; skip generated/build noise unless requested.
- Use tracked files when possible:
git ls-files
If git is unavailable, walk the filesystem and mark that in fileTree.generatedFrom.
Language
Match the user's language.
- Russian request -> Russian UI, headings, summaries, examples, risks, and notes.
- English request -> English output.
- Keep paths, code identifiers, commands, schema keys, API names, class/function names, and quoted source text unchanged.
- Do not mix English section labels into Russian output.
Investigation Workflow
Read before drawing.
- Identify mode, language, source root, git root, branch, commit, and user question.
- Build inventory:
- tracked file count and full file tree
- top-level folders and package boundaries
- manifests, README/docs, scripts, tests, examples, fixtures
- entry points: CLI, routes, exports, commands, screens, SDK calls
- agents/prompts/tools/MCP/providers/workflows/plugins if present
- Build an evidence ledger:
- claim
- source path/line, command output, test, fixture, or diff hunk
- confidence:
EXTRACTED, INFERRED, or AMBIGUOUS
- searched places when evidence is missing
- Trace live paths:
- imports/calls/routes
- config/env/provider reads
- data/schema/storage writes
- spawned agents/workers/tools
- prompt selection and model/provider routing
- Extract tours:
- README quick start or usage
- tests/fixtures/demos
- one real command or user action
- diff hunks for change mode
- Build
graph.json.
- Build standalone
index.html.
- Validate.
- Open the page.
Never invent a relationship because it would make a nicer diagram.
File Tree Contract
Repo and change docs need a real file tree.
fileTree must include:
root
generatedFrom
totalFiles
truncated
skipped
nodes
Each node should have:
path
name
type: file|dir
role: entry|core|agent|prompt|tool|route|schema|config|test|docs|data|ui|generated|skipped|unknown
importance: primary|supporting|reference|test|generated|skipped|unknown
whyOpen
evidence
children
For large repos, keep the tree complete in data and collapsed in UI. If the HTML would become unusable, set truncated: true, state the threshold, and show the exact inclusion rule.
Map Contract
Every map is directional.
Use this edge shape:
{
"source": "node.id",
"target": "node.id",
"verb": "loads",
"label": "loads config",
"confidence": "EXTRACTED",
"evidence": ["src/config.ts:12"]
}
Good:
User request --starts--> CLI --loads--> local agents --runs--> agent runtime --calls--> tools --returns--> edits
Bad:
CLI -> runtime -> tools
Use 4-8 nodes per map. Make multiple small maps instead of one huge graph.
Guided Tour Contract
Every atlas needs tours. A tour is a real path through the code.
{
"title": "Run the CLI",
"source": "README.md:31",
"kind": "runtime|feature|change|agent|domain",
"steps": [
{
"label": "Install command",
"file": "README.md",
"line": 31,
"does": "documents npm install",
"why": "this is the user-facing entry",
"evidence": ["README.md:31"]
}
],
"proves": "the CLI entry path is documented"
}
If no real examples exist, show:
No real example found.
Searched: README, tests, fixtures, demos, constants, package scripts.
Agent Lens
If the repo contains agents, prompts, tools, MCP servers, providers, workers, skills, or handoffs, include an agent lens.
Detect:
- folders/files named
agents, .agents, skills, prompts, tools, mcp, providers, models, workflows, runtime, orchestrator
- YAML/JSON/TOML manifests defining agents/tools/skills/permissions
- prompt templates and system/instruction prompts
- code that spawns workers, routes models/providers, grants tools, or runs tool calls
Show:
- agent definitions and where they live
- prompt sources and selection
- allowed tools and MCP/server connections
- input -> control -> tool call -> output lifecycle
- handoff/spawn routes between agents
- provider/model routing and fallback when visible
- tests/examples proving the path
- unknowns when a route cannot be proven
graph.json Minimum Shape
Detailed schema and HTML patterns live in references/atlas-contract.md. Read it when implementing a full atlas or when schema details are unclear.
Minimum required keys:
{
"schemaVersion": "visual-docs.v2",
"project": {
"name": "string",
"slug": "string",
"mode": "repo|feature|changes|domain",
"language": "string",
"category": "string",
"audience": "string",
"summary": "string",
"sourceRoot": "string",
"gitRoot": "string|null",
"gitCommit": "string|null",
"branch": "string|null"
},
"scope": {
"question": "string",
"included": [],
"skipped": [],
"baseRef": "string|null"
},
"fileTree": {},
"startHere": {
"mainPath": [],
"startFiles": []
},
"folders": [],
"nodes": [],
"maps": [],
"tours": [],
"lenses": [],
"examples": [],
"nextActions": [],
"risks": [],
"unknowns": [],
"quality": { "checks": [] }
}
Use schemaVersion: "visual-docs.v2" for new outputs. If updating old v1 output, migrate it to v2.
HTML Contract
One vertical page. No tabs by default.
Required order:
- Sticky mini-nav and stats.
- Start Here.
- System Shape: file tree plus folder atlas.
- Maps.
- Guided Tours.
- Deep Lenses.
- Examples and evidence.
- Next Actions.
- Risks and Unknowns.
- Node/edge/file explorer.
Design:
- Clean monochrome Paperwork style.
- Thin borders, flat sections, readable whitespace.
- Color only for status: green proven, amber inferred, red risk/fail.
- No glass, blur, gradients, glows, heavy shadows, pastel/rainbow decoration, or decorative blobs.
- Long paths wrap inside their own cells.
- Mobile has no horizontal page scroll. Wide maps/tables may scroll inside their own container only.
- Hover/click states do not move layout.
Interactions:
- Search/filter file tree.
- Click file/tree/map/tour step to show details and evidence.
- Map nodes link to file paths.
- Tour steps show file, line, what happens, why it matters.
Validation
Before finishing:
graph.json parses.
schemaVersion is visual-docs.v2.
project.mode is valid.
- Mode-required fields are present or visibly marked missing.
fileTree exists for repo/change docs and includes count, source, skipped areas, and nodes.
maps exist and every edge has source, target, verb, confidence, and evidence.
tours exist with real source evidence or a visible "No real example found" note.
- Agent lens exists when agent/prompt/tool/provider/workflow files are detected, or absence is stated with searched places.
index.html embeds the exact JSON:
<script type="application/json" id="graph-data">
{...exact graph.json copy...}
</script>
- Embedded JSON equals
graph.json.
- Inline JS syntax is valid.
- No browser-global DOM id usage like
title.textContent.
- No CDN, external assets, build step, dev server, or runtime JSON fetch.
- Page opens from
file://.
- Top navigation and section headings use the output language.
- First screen satisfies Start Here.
- Full file tree appears before dense graph/explorer sections.
- Maps have visible arrow verbs.
- Guided tours are visible before raw node explorer.
- No generated UI label
Golden path.
- No horizontal page scroll on mobile.
quality.checks records failures instead of hiding them.
Use a browser smoke test when browser tooling is available. At minimum, parse JSON, compare embedded JSON, and validate inline JS.
Finish
Open the generated page:
open docs/{slug}/index.html
Final response should include:
- output path
- mode
- source root
- language
- what maps/tours/lenses were generated
- limitations/unknowns
- validation summary
- whether the page opened
Source: PabloNAX/visual-docs — distributed by TomeVault.
1---2name: visual-docs3description: Use when asked to explain, document, visualize, map, teach, onboard, or make an HTML explainer for a repo, feature, module, agent system, prompt stack, provider route, business flow, code pipeline, or code changes/diff. Produces evidence-first graph.json plus a standalone Visual Atlas HTML page that opens from file://.4---56# Visual Docs78Create a clear visual atlas of a codebase, feature, workflow, agent system, or change set.910Default output:1112```text13docs/{slug}/14 graph.json15 index.html16```1718`index.html` must be standalone, embed the exact `graph.json`, work from `file://`, and open in the default browser at the end.1920The goal is not a pretty report. The goal is that a reader can look at the page and immediately know:2122- what this thing is23- where the code starts24- what folders matter25- what arrows connect inputs, code, agents, data, and outputs26- one or more real examples that prove the flow27- what to inspect next for common tasks2829## Design Basis3031Use these ideas quietly; do not name them in the generated HTML unless useful:3233- C4-style zoom: context -> containers/packages -> components/modules -> code.34- Runtime scenarios: static structure is not enough; show at least one input-to-output path.35- Code tours: teach through ordered, evidence-backed steps anchored to files.36- Diataxis separation: keep explanation, navigation, reference, and tasks visually distinct.37- Program comprehension is both top-down and bottom-up: start with the mental model, then show exact files and evidence.3839## Visual Atlas Standard4041Every output must follow this structure. If a section cannot be proven, keep it visible and mark it `No source found` with searched places.42431. **Start Here**44 - One sentence: `{name} is a {category} for {audience}: it {main job}.`45 - Show source root, mode, branch/commit, and confidence.46 - Show the main path in one line with arrows and verbs.47 - Show 3-5 "start reading here" files.48492. **System Shape**50 - Full searchable/collapsible file tree from `sourceRoot`.51 - Top-level folder table with: role, why open, key files, example task, evidence.52 - Mark generated, vendored, binary, deleted, or skipped areas.53543. **Maps**55 - Context map: actors/external systems -> this repo.56 - Container/package map: apps/packages/modules and ownership boundaries.57 - Runtime/change map: input -> entry -> core -> data/config/provider/tools -> output.58 - Subsystem maps when detected: agents, prompts, tools, MCP, providers, routes, workflows, plugins.59 - Every edge has a visible verb and evidence.60614. **Guided Tours**62 - 2-4 ordered examples from README, tests, fixtures, demos, commands, or diff hunks.63 - Each tour has 3-7 steps.64 - Each step has: action, file/path, what happens, why it matters, evidence.65 - At least one tour must be a normal runtime/user path for repo/feature mode.66 - For change mode, include a before -> after tour.67685. **Deep Lenses**69 - Agent lens when agents/prompts/tools/providers/workers exist.70 - Domain lens when business rules matter.71 - Data/API lens when schemas, routes, migrations, or storage matter.72 - UI lens when components/screens/state matter.73746. **Next Actions**75 - Task-oriented navigation: "to change X, start at Y, then check Z."76 - Tests/examples to run or inspect.77 - Risks, unknowns, disabled/dead paths, missing tests.7879The first screen must show the answer and the start of the main path. It must not be a cover page.8081## Hard Rules8283- No unlabeled lines. A line without a verb is noise.84- No giant radial mind map as the primary view.85- No cards replacing the file tree or flow maps.86- No vague claims without evidence.87- No fake examples. Derived examples must be labeled `derived from code`.88- No language mixing in UI labels. Keep code identifiers unchanged.89- No CDN, external assets, build step, dev server, or runtime JSON fetch.90- No generated UI label `Golden path`.91- Keep diagrams compact. Use details/search/drill-down for depth.9293## Trigger Modes9495Choose the narrowest mode that answers the user:9697- `repo`: explain an unfamiliar repository.98- `feature`: explain a feature, module, command, component, API route, tool, prompt stack, or agent system.99- `changes`: explain a branch, PR, local changes, diff, or recent commits.100- `domain`: explain business/product logic behind the code.101102Mode requirements:103104- `repo`: full file tree, top-level folder atlas, context/container/runtime maps, normal runtime tour, deep lenses for detected subsystems.105- `feature`: boundary file tree, entry point, owner module, input/output, runtime map, examples/tests, nearby code that is not the live path.106- `changes`: base ref, changed-file tree, before/after map, affected contracts, changed examples/tests, blast radius, rollback/risk notes.107- `domain`: actors, objects, actions, outcomes, decisions, rules, domain flow, code locations, real examples.108109## Scope Rules1101111. Record current `pwd` as `sourceRoot`.1122. Start analysis from `sourceRoot`, not automatically from repository root.1133. Find nearest git root only for branch, commit, status, diff, and tracked path metadata.1144. If broader context is needed, state why in `graph.json.scope`.1155. Respect `.gitignore`; skip generated/build noise unless requested.1166. Use tracked files when possible:117118```bash119git ls-files120```121122If git is unavailable, walk the filesystem and mark that in `fileTree.generatedFrom`.123124## Language125126Match the user's language.127128- Russian request -> Russian UI, headings, summaries, examples, risks, and notes.129- English request -> English output.130- Keep paths, code identifiers, commands, schema keys, API names, class/function names, and quoted source text unchanged.131- Do not mix English section labels into Russian output.132133## Investigation Workflow134135Read before drawing.1361371. Identify mode, language, source root, git root, branch, commit, and user question.1382. Build inventory:139 - tracked file count and full file tree140 - top-level folders and package boundaries141 - manifests, README/docs, scripts, tests, examples, fixtures142 - entry points: CLI, routes, exports, commands, screens, SDK calls143 - agents/prompts/tools/MCP/providers/workflows/plugins if present1443. Build an evidence ledger:145 - claim146 - source path/line, command output, test, fixture, or diff hunk147 - confidence: `EXTRACTED`, `INFERRED`, or `AMBIGUOUS`148 - searched places when evidence is missing1494. Trace live paths:150 - imports/calls/routes151 - config/env/provider reads152 - data/schema/storage writes153 - spawned agents/workers/tools154 - prompt selection and model/provider routing1555. Extract tours:156 - README quick start or usage157 - tests/fixtures/demos158 - one real command or user action159 - diff hunks for change mode1606. Build `graph.json`.1617. Build standalone `index.html`.1628. Validate.1639. Open the page.164165Never invent a relationship because it would make a nicer diagram.166167## File Tree Contract168169Repo and change docs need a real file tree.170171`fileTree` must include:172173- `root`174- `generatedFrom`175- `totalFiles`176- `truncated`177- `skipped`178- `nodes`179180Each node should have:181182- `path`183- `name`184- `type`: `file|dir`185- `role`: `entry|core|agent|prompt|tool|route|schema|config|test|docs|data|ui|generated|skipped|unknown`186- `importance`: `primary|supporting|reference|test|generated|skipped|unknown`187- `whyOpen`188- `evidence`189- `children`190191For large repos, keep the tree complete in data and collapsed in UI. If the HTML would become unusable, set `truncated: true`, state the threshold, and show the exact inclusion rule.192193## Map Contract194195Every map is directional.196197Use this edge shape:198199```json200{201 "source": "node.id",202 "target": "node.id",203 "verb": "loads",204 "label": "loads config",205 "confidence": "EXTRACTED",206 "evidence": ["src/config.ts:12"]207}208```209210Good:211212```text213User request --starts--> CLI --loads--> local agents --runs--> agent runtime --calls--> tools --returns--> edits214```215216Bad:217218```text219CLI -> runtime -> tools220```221222Use 4-8 nodes per map. Make multiple small maps instead of one huge graph.223224## Guided Tour Contract225226Every atlas needs tours. A tour is a real path through the code.227228```json229{230 "title": "Run the CLI",231 "source": "README.md:31",232 "kind": "runtime|feature|change|agent|domain",233 "steps": [234 {235 "label": "Install command",236 "file": "README.md",237 "line": 31,238 "does": "documents npm install",239 "why": "this is the user-facing entry",240 "evidence": ["README.md:31"]241 }242 ],243 "proves": "the CLI entry path is documented"244}245```246247If no real examples exist, show:248249```text250No real example found.251Searched: README, tests, fixtures, demos, constants, package scripts.252```253254## Agent Lens255256If the repo contains agents, prompts, tools, MCP servers, providers, workers, skills, or handoffs, include an agent lens.257258Detect:259260- folders/files named `agents`, `.agents`, `skills`, `prompts`, `tools`, `mcp`, `providers`, `models`, `workflows`, `runtime`, `orchestrator`261- YAML/JSON/TOML manifests defining agents/tools/skills/permissions262- prompt templates and system/instruction prompts263- code that spawns workers, routes models/providers, grants tools, or runs tool calls264265Show:266267- agent definitions and where they live268- prompt sources and selection269- allowed tools and MCP/server connections270- input -> control -> tool call -> output lifecycle271- handoff/spawn routes between agents272- provider/model routing and fallback when visible273- tests/examples proving the path274- unknowns when a route cannot be proven275276## graph.json Minimum Shape277278Detailed schema and HTML patterns live in `references/atlas-contract.md`. Read it when implementing a full atlas or when schema details are unclear.279280Minimum required keys:281282```json283{284 "schemaVersion": "visual-docs.v2",285 "project": {286 "name": "string",287 "slug": "string",288 "mode": "repo|feature|changes|domain",289 "language": "string",290 "category": "string",291 "audience": "string",292 "summary": "string",293 "sourceRoot": "string",294 "gitRoot": "string|null",295 "gitCommit": "string|null",296 "branch": "string|null"297 },298 "scope": {299 "question": "string",300 "included": [],301 "skipped": [],302 "baseRef": "string|null"303 },304 "fileTree": {},305 "startHere": {306 "mainPath": [],307 "startFiles": []308 },309 "folders": [],310 "nodes": [],311 "maps": [],312 "tours": [],313 "lenses": [],314 "examples": [],315 "nextActions": [],316 "risks": [],317 "unknowns": [],318 "quality": { "checks": [] }319}320```321322Use `schemaVersion: "visual-docs.v2"` for new outputs. If updating old v1 output, migrate it to v2.323324## HTML Contract325326One vertical page. No tabs by default.327328Required order:3293301. Sticky mini-nav and stats.3312. Start Here.3323. System Shape: file tree plus folder atlas.3334. Maps.3345. Guided Tours.3356. Deep Lenses.3367. Examples and evidence.3378. Next Actions.3389. Risks and Unknowns.33910. Node/edge/file explorer.340341Design:342343- Clean monochrome Paperwork style.344- Thin borders, flat sections, readable whitespace.345- Color only for status: green proven, amber inferred, red risk/fail.346- No glass, blur, gradients, glows, heavy shadows, pastel/rainbow decoration, or decorative blobs.347- Long paths wrap inside their own cells.348- Mobile has no horizontal page scroll. Wide maps/tables may scroll inside their own container only.349- Hover/click states do not move layout.350351Interactions:352353- Search/filter file tree.354- Click file/tree/map/tour step to show details and evidence.355- Map nodes link to file paths.356- Tour steps show file, line, what happens, why it matters.357358## Validation359360Before finishing:361362- `graph.json` parses.363- `schemaVersion` is `visual-docs.v2`.364- `project.mode` is valid.365- Mode-required fields are present or visibly marked missing.366- `fileTree` exists for repo/change docs and includes count, source, skipped areas, and nodes.367- `maps` exist and every edge has source, target, verb, confidence, and evidence.368- `tours` exist with real source evidence or a visible "No real example found" note.369- Agent lens exists when agent/prompt/tool/provider/workflow files are detected, or absence is stated with searched places.370- `index.html` embeds the exact JSON:371372```html373<script type="application/json" id="graph-data">374{...exact graph.json copy...}375</script>376```377378- Embedded JSON equals `graph.json`.379- Inline JS syntax is valid.380- No browser-global DOM id usage like `title.textContent`.381- No CDN, external assets, build step, dev server, or runtime JSON fetch.382- Page opens from `file://`.383- Top navigation and section headings use the output language.384- First screen satisfies Start Here.385- Full file tree appears before dense graph/explorer sections.386- Maps have visible arrow verbs.387- Guided tours are visible before raw node explorer.388- No generated UI label `Golden path`.389- No horizontal page scroll on mobile.390- `quality.checks` records failures instead of hiding them.391392Use a browser smoke test when browser tooling is available. At minimum, parse JSON, compare embedded JSON, and validate inline JS.393394## Finish395396Open the generated page:397398```bash399open docs/{slug}/index.html400```401402Final response should include:403404- output path405- mode406- source root407- language408- what maps/tours/lenses were generated409- limitations/unknowns410- validation summary411- whether the page opened412413---414> Source: [PabloNAX/visual-docs](https://github.com/PabloNAX/visual-docs) — distributed by [TomeVault](https://tomevault.io).415<!-- tomevault:4.0:skill_md:2026-07-01 -->