Spec: Archify maps — vendored renderer, pure Blueprint→IR compiler, generated maps¶
- ID: 010-archify-maps
- Status: shipped
- Owner: @bamr87
- Created: 2026-08-28
- Roadmap link: adoption/plug-and-play — a factory, a fleet, and a run should each be legible as one map; see ADR-034 in docs/DECISIONS.md
- Golden-rules compliance: confirmed against CLAUDE.md § Golden rules
1. Problem & Motivation¶
GitFactory has three graph-shaped things a reader needs to understand at a glance — an assembly line (trigger → gates → agent → sinks), a fleet (workflows and the belts between them), and a run — and today only the authoring canvas renders any of them, as an editable React Flow graph that cannot be shared, exported, searched, or route-traced. The Fleet Observe map is a second, read-only React Flow renderer of the same idea.
The user asked to rebuild the framework around tt-a1i/archify. Verified against its source (README, SKILL.md, DESIGN.md, PRODUCT.md, schemas): archify is a Node CLI + agent skill that compiles a typed JSON IR (architecture / workflow / sequence / dataflow / lifecycle) into a self-contained interactive HTML/SVG map with search, focus, route tracing, reach analysis, guided views, presentation mode, and truthful exports. It is not a component library and its renderers import node:fs/node:path/node:crypto/node:child_process, so it cannot run inside the static frontend. This spec adopts it where it fits: as the visualization layer, fed by a pure compiler from GitFactory's own data model, rendered at build time and by the factory in CI.
2. Origin & Background¶
- Backlog items claimed: BL-20260828-03
- Builds on
compile.assemblyLines()(ADR-010, ADR-028) as the partition that names lines, and onfleet/parse.ts+fleet/import.ts(ADR-011) as the reverse-import of any repo's workflows. - Companion specs (separate packages, sequenced after this one): the design-language migration to archify's DESIGN.md tokens, and the in-app Map surfaces (Build drawer, Fleet Observe replacement, Docs embeds, demo tour step).
3. Goals¶
- G1: Every assembly line in a blueprint compiles to a valid archify workflow IR that passes
validate --quality showcasewith zero diagnostics. - G2: Every reverse-imported fleet compiles to a valid archify architecture IR under the same gate.
- G3: Maps for gitorio's own blueprints and the demo fleet are generated by a committed, idempotent script and served with the app, carrying the
GENERATED BY GITFACTORYprovenance header. - G4: Archify is available as a pinned, vendored tool for scripts, CI, and Claude Code sessions — never as a browser dependency.
4. Non-Goals¶
- NG1: No in-browser rendering. The renderers are script-shaped (
loadDiagram(argv)→writeDiagram(fs)at module scope); embedding them would mean a fork. Decision D-1 of the plan: pre-rendered only. - NG2: No replacement of the React Flow authoring canvas — archify has no editing model.
- NG3: No sequence / lifecycle / dataflow compilers in this package; they are follow-ups once the two core maps have shipped.
- NG4: No changes to the design tokens or to any panel — that is the companion design-language spec.
5. User Stories¶
- As a maintainer, I want a shareable, searchable map of each assembly line, so that a reviewer can trace trigger → agent → sink without opening the app.
- As a fleet operator, I want a map of a repo's workflows and belts, so that I can explain the automation to someone who has never seen the YAML.
- As a Claude Code session, I want the archify skill available in the repo, so that agents can author diagrams for docs against the pinned version.
6. Functional Requirements¶
- FR-1: Archify is vendored under
vendor/archify/pinned to an upstream commit recorded invendor/archify/VENDOR.md(SHA, version, date, what was omitted), with its MITLICENSEintact; the tree renders and validates with nonpm install. - FR-2: A pure vocabulary module
app/src/archify/vocabulary.tsmaps every registry machine type to an archifycomponentType(trigger → external, gate/rate/filter → security, agent → backend, ledger/evidence → database, dispatch sinks → messagebus, cross-repo sinks → cloud, other sinks → frontend) and to a swimlane; a drift guard fails when a registry type has no mapping. - FR-3:
toWorkflowIR(blueprint, line)inapp/src/archify/ir.tscompiles one assembly line to a workflow IR: lanes by role, columns from topological depth with same-lane overlap resolution,mainPath= the longest trigger→sink path, a bot-actor guard node in an exception lane whenever the line is loop-prone (ADR-009's condition), andmeta.quality_profile = 'showcase'. - FR-4:
toArchitectureIR(fleet)compiles aFleetto an architecture IR: components = workflows (capped at 12, prioritising generated, agent-bearing, and belted workflows, with the remainder collapsed into one external "N more" component), one boundary per repo, connections from fleet edges, grid layout. - FR-5:
app/scripts/gen-maps.ts(vite-node) writes IR JSON + rendered HTML for every line of every.factory/*.blueprint.jsonand for the demo fleet intoapp/public/maps/, prepends aGENERATED BY GITFACTORYheader with the blueprint hash and the archify SHA, strips the external Google Fonts link so Pages serves it offline, and is idempotent (--checkexits non-zero on drift). - FR-6: CI gains a
diagram-gatejob:gen-maps --checkplusarchify validate --quality showcase --jsonover every generated IR. - FR-7: The archify skill is installed for Claude Code sessions as
.claude/skills/archifypointing at the vendored tree, and/compile-checkgains a diagram step.
7. Non-Functional Requirements¶
- NFR-STATIC-1: Nothing under
vendor/is imported byapp/src/**at runtime; the production bundle size is unchanged (golden rule #1). - NFR-PURE-1:
ir.tsandvocabulary.tsperform no I/O and read no globals; they are exercised by vitest invariant tests (golden rule #3). - NFR-SEC-1: No vendored command that reaches the network is ever invoked (
brands captureis excluded from scripts and CI); generated maps make zero external requests. - NFR-LIC-1: The MIT license and upstream attribution travel with the vendored tree;
NOTICEnames the source and commit. - NFR-GEN-1: Generated maps are byte-stable across two runs on the same input (determinism), so
--checkis a meaningful gate.
8. Blueprint & Schema Impact¶
None to schema/blueprint.schema.json. Archify's own schemas are vendored under vendor/archify/schemas/ and are the contract the IR is validated against.
9. Compiler & Workflow Impact¶
compile.ts is untouched; assemblyLines() is consumed as-is. No generated factory--*.yml changes. No upstream claude-code-action inputs involved.
10. UI Impact¶
None in this package (NG4). app/public/maps/ becomes a served static directory that the companion UI spec embeds.
11. Security Impact¶
No new tool grants, no permissions: deltas, no secrets: the gate runs in CI with the default read token and the generator runs locally. Untrusted content: fleet workflow YAML and blueprint text flow into map labels — the IR compiler truncates labels and passes them through archify's HTML escaping; the generated HTML is served, never executed against a token. Fork PRs run diagram-gate with no secrets available (golden rule #9).
12. Acceptance Criteria¶
- AC-1: Given
vendor/archify, whennode vendor/archify/bin/archify.mjs render workflowruns twice on the same example with nonode_modules, then the outputs are byte-identical andvalidate --quality showcasereportsok: true. - AC-2: Given every machine type in
MACHINES, when the vocabulary is queried, then each returns a componentType and a lane (drift-guard test). - AC-3: Given
.factory/blueprint.jsonand.factory/docs-gardener.blueprint.json, when each line is compiled withtoWorkflowIRand validated with the vendored CLI at showcase quality, then every line passes with zero diagnostics. - AC-4: Given the three demo repos imported through the demo client, when compiled with
toArchitectureIRand validated at showcase quality, then each passes with zero diagnostics. - AC-5: Given a loop-prone line (an issue/PR/comment trigger feeding a writing sink), when compiled, then the IR contains a guard node in a lane with
variant: 'exception'and an edge from the trigger to it; a cron-only line contains none. - AC-6: Given a clean checkout, when
gen-mapsruns and thengen-maps --checkruns, then the second exits 0; and when a generated map is edited by hand,--checkexits non-zero. - AC-7: Given the production build, when the bundle is inspected, then no chunk contains vendored archify source and
app/dist/maps/*.htmlexist.
13. Risks & Open Questions¶
- R-1: Upstream tracks a
-devversion with no npm release; pinning to a SHA means drift is manual — mitigated byVENDOR.md+ a follow-up BL for a monthly upstream check. - R-2: Archify's "one story, ≤12 primary nodes" fights 31-workflow fleets — mitigated by the FR-4 cap and per-repo boundaries; per-district maps are a follow-up.
- R-3: ~700 kB per map — served as static assets outside the JS budget, loaded on demand by the companion UI spec.
14. Out of Scope / Follow-ups¶
- Sequence maps from run jobs, lifecycle maps for the perfection loop, dataflow maps for belts (NG3).
- The Cartographer factory line (push on
.factory/**→ regenerate → PR) once the generator has proven stable locally. - Deploy
compare(before/after fleet maps attached to a deploy PR).