ADR-0014: AI documentation architecture
- Status: accepted
- Date: 2026-07-15
- Amended: 2026-10-25 — the one doc set is also rendered as the template's website, from
docs/in place (see Amendment (2026-10-25) below) - Amended: 2026-10-26 — reviewers declare what they own, the index lists the agents, hooks and MCP servers, a rare skill may ship hidden, and the docs-sync ladder gains ask rungs (see Amendment (2026-10-26) below)
- Amended: 2026-11-08 —
.mcp.jsongains the Aspire MCP server, a local command that reads and drives the running AppHost (see Amendment (2026-11-08) below)
Context
Section titled “Context”The repo must be first-class for AI coding agents (Claude Code especially) without maintaining a parallel, drift-prone copy of the docs. Claude Code does not read AGENTS.md natively; other tools (Copilot, Cursor, etc.) do.
Decision
Section titled “Decision”AGENTS.mdis the canonical, tool-neutral instruction file — architecture, exact commands, dependency-flow rules, three-tier boundaries (always / ask-first / never). Kept lean (~1 screen).CLAUDE.mdis a thin wrapper whose first line is@AGENTS.md(imports it at session start) plus a short Claude-specific note..github/copilot-instructions.mdpoints atAGENTS.md.- Layer conventions live in
.claude/rules/*.mdwithpaths:frontmatter so they load only when an agent touches that layer — no permanent context cost. - Skills (
.claude/skills/) encode procedures (add-feature, remove-feature, add-integration, add-migration, new-adr, run-app; add-toggle stays in the template's repository); subagents (.claude/agents/) provide focused reviewers. - One doc set, not two: humans and agents read the same
docs/. The "AI layer" is indexes + scoped rules, never parallel prose.docs/INDEX.mdis the agent entry point;docs/adr/supplies the "why". - Docs-sync is layered by strength: a soft
PostToolUsehook reminder → anAGENTS.mdinstruction → a hard CI check (scripts/check-docs-drift.shmaps every changed path under a feature's folders to that feature'sdocs/features/<feature>.mdand fails a PR that changes one without the other; auth, identity and hardening code likewise needdocs/threat-model.md). Only the CI check guarantees sync. .mcp.jsonships Microsoft Learn, Context7, and Playwright servers (project-scoped; consumers approve on first use).
Consequences
Section titled “Consequences”- Instructions work across Claude Code and other agents from one source.
- Feature docs can't silently drift from feature code (CI gate; override via the
docs-not-neededlabel). - Adding a convention means adding or editing a rule file, not enlarging a monolith.
Amendment (2026-10-25): the website renders the same doc set
Section titled “Amendment (2026-10-25): the website renders the same doc set”The template's repository publishes docs/ as its documentation website (ADR-0031). Astro and
Starlight render the files where they are, with no copy and nothing added to them, so the rule above
still holds: one doc set, which people read on GitHub and on the site and agents read in the repository.
A doc stays plain GitHub Markdown; the site's build adapts it (titles, links, the conditionals) and fails
on a link or an anchor that points nowhere. A generated project gets neither the site nor this amendment.
Amendment (2026-10-26): reviewers own their ground, and the index lists the whole toolkit
Section titled “Amendment (2026-10-26): reviewers own their ground, and the index lists the whole toolkit”- Every reviewer in
.claude/agents/opens with three lines: Owns, Out of scope (naming the reviewer that owns each item) and Overlap. No two reviewers own the same item, and a point another reviewer owns gets one line naming that reviewer, never a second finding, so a change read by several gets each point once.AGENTS.mdsays which reviewer a change needs:code-reviewer,architecture-guard,test-reviewer,security-reviewerand, with the UI,ui-reviewer. docs/INDEX.mdlists the agents, the hooks and the MCP servers beside the rules and the skills, each with when it applies, andscripts/check-adr-links.shfails when a reviewer, a hook or a feature doc is missing from it, or when.claude/settings.jsonruns a hook that does not exist.- A rare procedure may ship as a skill hidden from the model (
disable-model-invocation: truein its frontmatter): its description stays out of every session's context until someone invokes it by name. - The docs-sync ladder gains ask rungs: above the soft
PostToolUsereminder, aPreToolUsehook may ask the person before an edit the conventions reserve to a generator or to their judgement. A hook ships with a self-test, and none is the only guard: each stays backed by anAGENTS.mdinstruction and, where one exists, a CI check.
Amendment (2026-11-08): the Aspire MCP server
Section titled “Amendment (2026-11-08): the Aspire MCP server”.mcp.jsonships a fourth server,aspire, started asaspire agent mcp. Unlike the other three it is neither a hosted URL nor a package fetched on first use: it is the Aspire CLI the developer installed, so it needs the Aspire CLI 13.5 or later onPATH(./scripts/doctor.shreports whether it is there and new enough), and without it the server does not start.- It reads the running app: while an
aspire runis in progress under the working directory, it lists the AppHost's resources and their state, each resource's console and structured logs, and the traces, so an agent reads them instead of scraping the terminal or guessing from the dashboard (docs/INDEX.md, therun-appskill). With no AppHost running it has nothing to read. - It also acts on it: it can start, stop and restart a resource of the
aspire runin progress. It is approved on first use like the others: an interactive Claude Code session asks before using it, and a headlessclaude -prun loads it without asking.
The documentation of Trellis.Templates 0.2.0 · release notes