Skip to content
ImagineWorld

Artifacts

node_idnode-book_agentic-spec-driven-development_chapter-10-artifacts
node_typechapter-node
schema_profileworld.chapter_node.v1
statusactive
entropyhigh
manifoldworld
domainimagineworld.net
authorityinforms
layercorpus
chapter_num10
chapter_titleArtifacts
governed_byCORPUS
constitutional_citationCONSTITUTION
local graph

Earlier chapters explained why Markdown is the preferred format for working with AI. Markdown is compact, carries formatting, is cheap in tokens, and AI can read and edit it with no special tools. For the work covered so far — rules, logs, decisions, written content — Markdown is the right answer.

But not everything belongs in text.

Think about the work that has nothing to do with prose. In a software specification, you might sketch a user flow or draw a diagram of your data model. You might map out the screens of your app and how they connect. Other kinds of work follow the same pattern. A contract gets a structure diagram of the parties and how they relate to each other. A research protocol gets a participant-flow diagram. A policy gets a decision tree showing which rule applies when. A dashboard spec gets a data-flow diagram.

None of these tasks is naturally textual. They are visual. There is a reason for that. When information has structure — relationships, hierarchies, sequences, quantities — a visual representation lets you grasp it at a glance. You see the shape of the thing. You spot a missing connection, a dead-end branch, a column that does not add up. The whole review takes seconds.

Now try the same exercise in text. Describe a user flow in sentences. Write out every entity in your data model, every attribute, every relationship, every constraint — in paragraphs. List your revenue projections as rows of numbers in plain prose. Doable? Yes — but reading it back is slow and tiring, and you will miss things. The realistic outcome is worse: you will skim, and skimming defeats the purpose of the review.

This is not only intuition. Research backs it up: more than fifty studies comparing illustrated content to text alone found that visuals improve understanding by an average of 83%. In engineering work, the number is much higher.

The gap is not subtle. Visual formats are how humans process structured information. Text is how we process narrative. When you force structured information into a narrative format, you are working against the way your brain prefers to operate.

AI is built the opposite way — the LLM produces text, and text only. When you ask for a user flow, the LLM writes the steps in Markdown. When you ask for a data model, the LLM lists entities and relationships in sentences or tables. When you ask for a flowchart, the LLM describes one. It does not draw one. It cannot.

For narrative content — a product description, a set of rules, a decision log — this is fine. Text is the right format. You read it, you evaluate it, you move on. Structured content is where the trouble starts.

The instinctive reaction is obvious. You need a diagram, so you tell AI to produce one. Most AI agents include tools for generating visualizations. Mermaid is one common option — a diagramming language the LLM writes as text and the browser then displays as graphics. You say “draw me a user flow for the booking process,” AI produces a diagram, and you open it. Quick, visual, satisfying.

You review the diagram. The booking confirmation step is missing — the flow goes straight from payment to the home screen. You tell AI to fix it. AI updates the diagram. You look again. Better; you move on.

This feels efficient. But you have just made the diagram the de facto source of truth for your user flow. The diagram is now the only place where your booking flow is defined. Every time AI needs to reference the user flow — to build a feature, check a requirement, or answer a question — AI has to open the diagram and interpret it. Not just read it; reason about it. A diagram shows an arrow pointing from payment to the home screen, but it does not say why. The business rationale, the architectural constraint, the UX decision behind that arrow — none of that lives in the diagram. AI has to infer your intent from shapes and lines, and that is where errors creep in.

It gets worse as the project grows. You have a user-flow diagram, a data-model diagram, an architecture diagram, a revenue chart. AI now has to open, parse, and interpret multiple diagram files whenever it needs context. Each interpretation is a chance to misread a connection or miss the reasoning behind it. You have moved the source of truth into the format AI handles worst.

Now imagine you have been working this way for a few weeks. You have corrected the diagrams many times. The diagrams reflect your latest decisions. Then you ask AI to generate a database schema from the data model.

AI does not have a text description of the data model. AI has a diagram, opens it, tries to extract the entities and relationships, and produces a schema. But in the process it misses a field — the “cancellation reason” on the booking entity, the one you added to the diagram two weeks ago. AI dropped it during extraction — maybe a missed node, maybe a misread relationship. You do not catch the missing field right away because the schema is large and one missing line is easy to overlook.

Two weeks later, you discover that your cancellation analytics are empty. You trace the problem back to the schema, then to the data-model diagram, then to the field that AI failed to extract. Two weeks of work built on a misread diagram.

This is not a one-time risk. It is structural. Every time AI works from a diagram instead of a textual description, AI has only shapes and lines, without the rationale behind them. The errors accumulate. You will catch them eventually — once the damage is visible — but by then recovery takes real effort. The same pattern applies outside software: in contracts, research protocols, policies, and anywhere else a diagram becomes the authoritative record. The format best for human review is the worst for AI to reason from.

The alternative is to lead with text. Instead of asking AI to draw a diagram directly, you ask AI to produce a textual description first — a Markdown file for the user flow, the data model, or whatever structured content you need. That file does two jobs. It carries enough structure for AI to generate the diagram from it. And it carries what the diagram cannot: the rationale, the constraints, the decisions behind each shape. That Markdown file then serves as the source of truth for all downstream work, not just for the visualization.

The workflow looks like this. You make a request. AI writes a Markdown file — a textual description of, say, the booking user flow. Then AI generates a diagram from that description — a Mermaid file, an HTML page, a rendered flowchart. You open the visual output, take a few seconds with it, and decide: is this right, or does it need changes?

You review the diagram — not the Markdown. The visual format is where your human judgment works best.

If something is off, you describe what needs to change. AI updates the Markdown file — the text — and regenerates the diagram from the updated text. You review the new diagram. Quick cycles, visual feedback, minimal effort per round. The critical difference is that every correction goes into the text first. The diagram is always regenerated from the text. The diagram is never patched directly.

This means AI never needs to read a diagram to know what your project contains. AI reads the Markdown file, because that is where all decisions live. The diagrams exist only for you, the human, to review visually. They are output, not input.

The booking-flow example is one instance of a broader pattern. The Markdown file is the source of truth — SOT for short. The diagram is the artifact — ART for short.

SOT files are the authoritative record of what your project is. Prefer Markdown for them, because Markdown is what AI reads and edits most efficiently. Your user flow, your data model, your revenue projections — the textual representations of each — are SOT files.

ART files are often the visual outputs generated from SOT files. A diagram of your user flow. A chart of your revenue projections. A diagram of your data model. Each artifact is generated from a specific set of SOT files and can be regenerated at any time.

ART files can also be text. Imagine you are writing a book — each chapter is its own Markdown file, and those are the SOT files. You ask AI to assemble the chapters into a single large file: the whole book. That assembled file is ART, whatever its type — Markdown, Word, PDF, HTML. The book is regenerated from scratch after any chapter change. What makes a file an artifact is not its type but the process that creates it: automatic, requiring no judgment beyond what already lives in the SOT files.

The pattern rests on one rule. Facts and judgment calls live in SOT files. They never live in ART files. ART files are generated cleanly from the SOT files — built from scratch every time, not patched — and exist for review and testing. The final spec or product is itself one or more ART files. When you spot a problem in an artifact, do not edit the artifact. Record the missing fact or the corrected decision in the SOT files, regenerate the artifact, and review again. The artifact is always a derivative; it is never the original.

A note for software engineers: The strongest form of this pattern, when you are building software end-to-end, is to treat the code itself as an artifact — the spec becomes the source of truth, used by AI to generate the code. The book does not pursue this directly — but this is how I build new projects now: a working pattern, not a thought experiment.

You could enforce this discipline manually — remind AI on every turn to update the text first, then regenerate the artifact. But eventually you will forget, and AI will patch the ART file directly. The ART file quietly becomes a source of ground truths — facts and decisions that live there and nowhere else. Those facts are hard to extract from the artifact. The moment you remember the protocol and regenerate, those facts are lost. The solution is not to rely on your memory for every prompt you write. You write a rule.

Setting this up has two halves. First, put regen-all.md — the procedure for the full rebuild — on disk at the project root; the rules you are about to record will reference it there. Download the file from agentic-spec.com/downloads/regen-all.md or copy it from Appendix E. Second, record the rules in CLAUDE.md. Then walk through what regen-all.md actually says.

Now for the CLAUDE.md side.

You:

RECORD THE FOLLOWING DURABLE RULES:
1. Protocol value generated for the File Registry's Protocol section. The
protocol governs files that are regenerated from other registered files:
- AI MUST NOT modify a generated file except by regeneration.
- The Dependencies column of a generated file MUST list at least one
registered file; every entry in the Dependencies column MUST resolve to a
registered file.
- The Instructions column MUST reference a single registered file of type
rules; that referenced file contains the generation procedure.
2. A placement convention for the File Registry's Subfolder section: files with
protocol generated MUST be placed in the artifacts/ subfolder of the project
root.
3. Acyclicity discipline for the File Registry's Discipline section, applied to
the Dependencies column across all generated files:
- The Dependencies cells MUST NOT form a chain that loops back on itself.
- A registry change that would introduce such a loop MUST be refused.
4. "Artifacts Protocol" section in CLAUDE.md must include:
- When the user requests a change to a file with protocol generated,
interpret it as a request to change the source files referenced in the
generated file's Dependencies column - or the file in its Instructions
column if the change is about the generation procedure itself. If in
doubt which file(s) to modify, always ask the user; NEVER GUESS.
- NEVER read a file with protocol generated except (a) as part of
regenerating that same file, when the tooling requires reading what is
being written; or (b) when the user explicitly directs and approves the
read.
- Regeneration is always manual. AI MUST NOT regenerate a generated file as
a side effect of any other action. Regeneration happens only when the
user explicitly invokes the regen-all trigger.
5. The "regen-all" trigger:
- AI MUST read regen-all.md and follow its procedure when the user invokes
any natural-language trigger for a full rebuild (for example, "regen
all", "regen all artifacts", "regenerate all artifacts", "regen-all.md").
THEN REGISTER regen-all.md in the Registered Files table with the following column
values:
- Subfolder: (empty - project root)
- File: regen-all.md
- Type: rules
- Protocol: editable
- Dependencies: (empty)
- Instructions: (empty)
- Description: "Procedure for full artifact rebuild - loaded conditionally when
the user asks to regenerate all artifacts."

AI:

...
Approve the rule additions as rewritten?
1. Approve rewritten wording
2. Approve original wording
3. Hold - I want to revise
4. Something else

You:

#2 (Approve original wording)

AI:

Approve the regen-all.md registry row as proposed?
1. Approve as proposed
2. Hold - I want to adjust
3. Something else

You:

#1 (Approve as proposed)

AI:

Does "MUST NOT modify a generated file except by regeneration" forbid
deletion/move, or only content edits?
1. Contents only - delete/move stays governed by Inventory change
2. Broad - deletion/move also forbidden except via regen

You:

#2 (Broad)

AI:

...
Done.
One forward note: regen-all.md already exists on disk but I have not read or
touched it - its content is out of scope of what you approved. When you're ready to
author its procedure, that's a separate request governed by rule-analysis.md (since
it's a rules-type file).

You:

Approved regen-all.md

AI:

Acknowledged. I've read regen-all.md now - the file already contains a full
four-step procedure (collect → order → present → regenerate), so "approved" reads
as your sign-off on its content as the authoritative regen-all procedure referenced
from the new Artifacts Protocol section.
...
The trigger is now live: any future message of the form "regen all" / "regen all
artifacts" / "regenerate all artifacts" / "regen-all.md" will cause me to re-read
regen-all.md and execute its four steps. I will not execute it now - you haven't
asked.

The prompt that opens this section — the one that begins “RECORD THE FOLLOWING DURABLE RULES” — carried five rule changes plus a registry entry in a single message. It is enough to define a new file protocol, govern how the protocol interacts with the existing rule set, and connect the trigger that invokes the regeneration procedure. The exchange above shows the protocol being recorded into CLAUDE.md after the standard rule-analysis loop. What follows walks through that opening prompt clause by clause, in the order the prompt presented them: each quoted snippet is paired with a short explanation of what it does and how it slots into the rule set built so far.

Protocol value `generated` for the File Registry's Protocol section. The protocol
governs files that are regenerated from other registered files:

This introduces a new Protocol value alongside the existing read-only, append-only, and editable. The existing protocols all govern files authored directly — by AI or by the user. generated is the first protocol for files whose contents are derived — produced by applying a recorded procedure to other registered files. AI consults the Protocol slot in the registry before any read or write, so adding generated here is what makes the rest of the rules in this set enforceable file by file.

AI MUST NOT modify a `generated` file except by regeneration.

This is the hard line that makes the protocol meaningful. The registry indicates that the file’s contents are the output of running its Instructions procedure over its Dependencies sources, never the result of a direct edit.

The Dependencies column of a `generated` file MUST list at least one registered
file; every entry in the `Dependencies` column MUST resolve to a registered file.

This activates the Dependencies column for this protocol. The “at least one entry” requirement keeps the protocol honest: a generated file with no sources is a contradiction. The resolution requirement relies on the pre-existing Reference resolution rule, so every dependency entry points to an actual registered row.

The Instructions column MUST reference a single registered file of type `rules`;
that referenced file contains the generation procedure.

This pins down where the generation procedure lives. Each generated file’s recipe sits in its own rules-type file referenced through Instructions. This keeps CLAUDE.md from accumulating procedural detail and lets each artifact declare its own recipe by name.

A placement convention for the File Registry's Subfolder section: files with
protocol `generated` MUST be placed in the `artifacts/` subfolder of the project
root.

This is a blanket placement rule. All generated files share one location, so the regen-all procedure can walk through them in a predictable order, and anyone inspecting the project knows immediately where derived artifacts live.

Acyclicity discipline for the File Registry's Discipline section, applied to the
Dependencies column across all `generated` files:

This frames the next two requirements as a new bullet inside the Discipline section. The scope is generated files only.

The Dependencies cells MUST NOT form a chain that loops back on itself.

This rules out circular dependencies. If file A’s Dependencies include B, and B’s include A — or any longer chain that closes back on itself — then no regeneration ordering exists and the regen-all procedure halts. This rule keeps the registry structure coherent and the rebuild well-defined.

A registry change that would introduce such a loop MUST be refused.

The check happens at registration time, not regeneration time. AI refuses to record a row whose Dependencies would introduce a cycle. This catches mistakes before any file is touched, instead of waiting for a regen-all attempt to surface them.

'Artifacts Protocol' section in CLAUDE.md must include:

This introduces an ’entirely new section. The protocol value, placement, and acyclicity rules slot into existing File Registry subsections; the rules that follow are behavioral disciplines that apply when AI interacts with a generated file — so they live in their own section.

When the user requests a change to a file with protocol `generated`, interpret it
as a request to change the source files referenced in the generated file's
Dependencies column - or the file in its Instructions column if the change is about
the generation procedure itself. If in doubt which file(s) to modify, always ask
the user; NEVER GUESS.

This is the redirect rule. The user thinks in terms of the visible output (“change the homepage title from X to Y”); this rule tells AI to translate the request into an edit on the underlying source — or, when the issue is procedural (“the homepage should also list draft chapters”), on the Instructions file. The NEVER GUESS clause is a hard stop: when multiple sources plausibly contain the target, AI must ask rather than pick.

NEVER read a file with protocol `generated` except (a) as part of regenerating that
same file, when the tooling requires reading what is being written; or (b) when the
user explicitly directs and approves the read.

This is a no-read rule with two explicit exceptions. The intent is that AI treats generated files as opaque downstream artifacts — knowing their content invites editing them in place rather than going through the redirect rule above. Exception (a) is a tooling concession: some file-writing tools require seeing the current state before performing an edit, and refusing those tools would block legitimate regeneration. Exception (b) is the user-controlled override for any case the standing rule does not anticipate.

Regeneration is always manual. AI MUST NOT regenerate a `generated` file as a side
effect of any other action. Regeneration happens only when the user explicitly
invokes the regen-all trigger.

This closes off auto-regeneration. AI never decides on its own to refresh a generated file — not when a source file is edited, not when a registry row is added, not in response to any other action. Only an explicit regen-all invocation triggers a rebuild. You pay the regeneration cost (and get the audit trail) at your own pace.

The 'regen-all' trigger:

This introduces the explicit invocation mechanism that the previous clause alludes to.

AI MUST read `regen-all.md` and follow its procedure when the user invokes any
natural-language trigger for a full rebuild (for example, 'regen all', 'regen all
artifacts', 'regenerate all artifacts', 'regen-all.md').

This defines how regen-all activates. The list of phrases is illustrative (“for example”) rather than exhaustive, so any unambiguous full-rebuild phrasing is a legitimate trigger. On any such trigger, AI re-reads the procedure file fresh — since the procedure itself can change over time — before executing it.

THEN REGISTER `regen-all.md` in the Registered Files table

This is the registration step that follows. Without it, the new Artifacts Protocol referring to regen-all.md would contain an unresolved file reference. Registering regen-all.md closes that gap.

Subfolder: (empty - project root);
File: `regen-all.md`;
Type: `rules`;
Protocol: `editable`;
Dependencies: (empty);
Instructions: (empty);
Description: 'Procedure for full artifact rebuild - loaded conditionally when the
user asks to regenerate all artifacts.'

This specifies the registration details for regen-all.md. Its type is rules because it encodes a procedure; its editable protocol allows AI to edit it under the standing Rule Management approval flow. Dependencies and Instructions are empty, as the editable protocol requires. The description clarifies that the file is loaded conditionally — only when the regen-all trigger fires.

The regen-all.md file you placed on disk at the start of this section is reproduced in full in Appendix E. What follows walks through it section by section.

# Regenerate All Artifacts Protocol
This file states the procedure AI MUST follow when the user asks to regenerate all
artifacts. The procedure performs a full rebuild and does not consider file
modification times.
A *generated file* is a registered file with protocol `generated`. This procedure
regenerates every generated file in the project.
The procedure has four steps, executed in order. Steps 1 and 2 prepare; Step 3
presents the plan and waits for user approval; Step 4 executes the regeneration.

The opening states what the rule does, names the single vocabulary term the steps rely on, and previews the four-step structure. The structure separates preparation from action: the first two steps build and validate the plan, the third surfaces the plan for your approval, the fourth regenerates. Each step is a small, named operation; you can reason about whether the procedure is doing the right thing without holding the whole sequence in your head.

## Step 1: Collect the Generated Files
- AI MUST identify every generated file.
- For each generated file, AI MUST read its `Dependencies` and `Instructions` cells
from the **File Registry**.
- Every entry in the `Dependencies` cell MUST resolve to a registered file via
the **Reference resolution** rule. Unresolved entries MUST trigger the **Undefined
References** rule.
- The `Instructions` cell MUST be non-empty and MUST resolve to a registered
`rules`-type file. An empty or unresolved `Instructions` cell on a generated file
MUST be reported as a registry violation; the procedure halts.

Step 1 collects every generated file and reads the rows that describe how each file connects to the rest of the project. AI needs both the list and the stated dependencies to regenerate the files in the right order — a file’s sources have to be ready before the file itself can be built. The reference checks catch problems early: a typo in a Dependencies cell, an Instructions file that has been renamed without updating the row, an empty Instructions cell that someone forgot to fill in. The checks are cheap and the scope is bounded; they fail loudly instead of producing a quietly broken artifact later.

## Step 2: Order the Generated Files
- AI MUST sort the generated files so that, for every file in the list, all the
generated files listed in its `Dependencies` cell are placed before it in the
sorted list.
- If no such ordering is possible because two or more generated files depend on
each other directly or through a chain, AI MUST identify those files, present them
to the user, abort the procedure, and not proceed to subsequent steps.

Step 2 catches the structural failure that breaks every build system: circular dependencies. If A depends on B, and B depends on A, neither can be built first, and no valid sort exists. The acyclicity discipline you added to CLAUDE.md earlier in this section prevents loops from being registered in the first place, but the procedure verifies again here — paranoia is cheap. The sort itself is one bullet of plain English — doing the work that for decades required dedicated software build tools.

## Step 3: Present the Plan
- AI MUST present the regeneration plan to the user as a table - one row per
generated file, in the order computed in Step 2 - with columns:
- File: the file's registered name.
- Instructions: the registered name of the file referenced by the file's
`Instructions` cell.
- Dependencies: the registered names of the files listed in the file's
`Dependencies` cell.
AI MUST wait for explicit user approval before proceeding to Step 4. Without
approval, the procedure halts and no files are modified.

Step 3 is the safety check. Before AI spends tokens regenerating everything, you see the plan and approve it. The table layout makes the plan scannable — file by file — so you can spot a mis-registered dependency or an unexpected entry before any work happens. The approval gate takes the same shape as every other consequential action in the project: stop, present, wait for an explicit go-ahead.

## Step 4: Regenerate
- After approval, AI MUST delete every file inside the `artifacts/` subfolder of the
project root. Subfolders inside `artifacts/` are removed along with their contents.
- For each generated file, in the order computed in Step 2, AI MUST produce the
generated file's content by applying the instructions in the file referenced by the
generated file's `Instructions` cell, and record it at the generated file's
registered location (its `Subfolder` and `File` cells).
- After every generated file is regenerated, AI MUST report each file that was
regenerated, in the order they were regenerated.

Step 4 does the work. The clean sweep comes first — artifacts/ is emptied entirely, so nothing stale can survive the rebuild. Then every generated file is regenerated from scratch, in the order from Step 2. The rule delegates the per-artifact logic to the instructions file: how those instructions read or use the dependencies — directly, through tool calls, or in any other way — is the instructions file’s responsibility, not regen-all’s. The rule fixes only two things: which file is being regenerated, and where its output lands. Reproducibility of the regenerated artifact’s content is therefore a property of the instructions file, not of the regen procedure. The final report tells you what was regenerated, so you can spot a missing entry — a file you expected to see in the list but did not — before reviewing.

The chapter has assembled the pieces: the generated protocol, the placement convention, the acyclicity discipline, the Artifacts Protocol section, and the four-step regen-all procedure. The pieces connect on paper. Their shape becomes clear only when you watch them work on something real.

The example is the errata-submission flow the agentic-spec.com site offers to readers. The feature is small — a page where readers report errors they find in the book — but it has the right shape for this walk-through: a multi-step user flow that benefits from a visual review, a procedure for turning the steps into a diagram, and a generated artifact that the rules govern from the moment it is registered. Six short interactions cover a full cycle: write the source of truth, write the generation procedure, register the artifact slot, build it, change a design decision through the source, and rebuild.

Start where the rule says to start: in text. The feature is a multi-step user flow with rationale on each step. Markdown handles both the steps and the rationale. The diagram comes later, generated from the same file; at this point the file has no partner artifact.

The prompt below is concrete and scoped, and includes a request to capture rationale for each step. The rationale matters because it is what the diagram cannot carry: the diagram shows the shape of the flow, but the reasoning behind each shape lives only in the text.

You:

Draft a new file errata-flow.md and register it. It is the source-of-truth
description of the errata-submission user flow for agentic-spec.com.
Steps:
1. Reader visits the errata-submission web page.
2. The page displays the book's table of contents - chapters, sections within
each chapter, and subsections within each section - as an always-visible tree.
3. Reader selects the chapter / section / subsection where the erratum is. The
selection becomes the location of the report.
4. The form appears with the selected location displayed (not editable from the
form itself - to change it, the user goes back to the TOC). The form has two
fields:
- Explanation of the error (required, multi-line text)
- Proposed correction (optional, multi-line text)
5. Reader clicks Submit. Submission opens the user's default email client with a
pre-composed email: addressed to [email protected], subject "Erratum:
[chapter] / [section] / [subsection]", body containing the location, the
explanation, and (if provided) the proposed correction, in a well-structured
plain-text format.
6. The user reviews the composed email in their client and sends it themselves.
The site does not send mail and does not retain the submission.
Capture rationale next to each step so a future reader can see why each decision
was made - at minimum: why the entry point is the TOC rather than a per-chapter
button, why location is not editable on the form, why explanation is required and
proposed correction is optional, and why submission is delegated to the user's
email client rather than POST-ed to a server.

AI:

Here is my proposed registry row for errata-flow.md. There is one item that needs
an extra approval beyond the row itself - the Type value - because the closed Type
list does not currently have a value that fits a product/feature specification.
Proposed registry row
SubfolderFileTypeProtocolDependenciesInstructionsDescription
errata-flow.mdspeceditableSource-of-truth specification of the errata-submission user flow for agentic-spec.com.
Rationale per column
Type - spec (NEW value, needs to be added to the closed Type list). The current
Type list is rules and log. Neither fits:
...
Proposed definition to add to the Type list in CLAUDE.md:
- spec - a source-of-truth description of a project artifact's behavior or
design.
This is general enough to cover other feature specs likely to follow (per Project
Intent: promotion, errata, reader assistance).
...
Protocol - editable. The spec is hand-maintained and will evolve as the design
evolves. Not generated (no upstream source files), not append-only (revisions need
to overwrite, not accrete), not read-only (AI needs to edit it). Per the editable
protocol, Dependencies and Instructions are left empty.
Subfolder - empty (project root). The errata flow is the first spec file. Placing
it at root mirrors how the other singular project-shape files sit (CLAUDE.md,
rule-analysis.md, etc.). If more spec files arrive later, we can propose a specs/
placement convention then. I considered proposing specs/ now but would rather not
introduce a convention before there is a second occupant for it.
Description. Plain statement of what the file is and which flow it specifies.
What I need from you before proceeding
1. Approve adding spec to the closed Type list with the definition above (or
propose a different name / definition).
2. Approve the registry row as proposed (or adjust Subfolder - root vs. a new
specs/ subfolder).
3. Approve writing errata-flow.md with the six-step flow plus rationale-per-step
as you described.
Once approved, I'll commit the Type-list edit in CLAUDE.md, add the registry row,
and write errata-flow.md - in that order.

You:

#1 - approved adding spec Type #2 - approved registry row, with a change - I like
the idea of placing all spec files in the specs/ sub-folder #3 - approved
errata-flow.md

AI:

Done. The three approved changes are in place.
CLAUDE.md - added spec to the closed Type list, and inserted the registry row:
SubfolderFileTypeProtocolDependenciesInstructionsDescription
specserrata-flow.mdspeceditableSource-of-truth specification of the errata-submission user flow for agentic-spec.com.
specs/errata-flow.md - six steps with rationale on each, covering the four you
named (TOC vs. per-chapter button, location not editable on the form, explanation
required vs. correction optional, mailto: vs. server POST).

The exchange added one new entry to the closed Type list — spec, for source-of-truth descriptions of a project artifact’s behavior or design — and one new placement convention: the specs/ subfolder, which you proposed during approval. The spec file itself is on disk at specs/errata-flow.md, registered with protocol editable, and stands as the authoritative description of the errata-submission flow. The file is reproduced in Appendix G and can also be downloaded from agentic-spec.com/downloads/specs/errata-flow-v1.md.

Nothing has been generated yet. The source exists; the visual does not.

The next piece is the recipe: the procedure AI follows whenever the artifact is regenerated.

The prompt below specifies the procedure in detail. It names the tool (Mermaid), the diagram shape (flowchart TD), which parts of the spec become nodes, which transitions become arrows, and — explicitly — what does not belong in the diagram (the rationale text from the spec). The constraints are deliberate. They pin down the rendering so the procedure produces the same result on every run, regardless of which session triggers it.

You:

Draft a new rules file gen-errata-flow.md and register it. This file is the
procedure for generating a self-contained HTML page that renders the
errata-submission flow as a Mermaid flowchart.
The procedure must produce a single HTML document such that:
1. The page is self-contained: it embeds the Mermaid CDN script and renders
without any other assets.
2. The diagram is a Mermaid flowchart TD block.
3. Each step from errata-flow.md becomes one node, labeled with the step's
headline phrase (not the rationale).
4. Sequential steps are connected with default arrows.
5. The branch in the form between "explanation only" and "explanation + proposed
correction" is shown explicitly on the diagram.
6. The handoff to the email client is rendered as a distinct node, visually
distinguishing the on-site portion of the flow from the off-site portion (use
a different node shape or a labeled boundary).
7. No rationale text from the SOT appears anywhere in the diagram or the HTML.

AI:

Draft of gen-errata-flow.md:
...
Proposed registry row
SubfolderFileTypeProtocolDependenciesInstructionsDescription
gen-errata-flow.mdruleseditableProcedure for generating errata-flow.html - a self-contained Mermaid flowchart of the errata-submission flow - from errata-flow.md.
What I need from you
1. Approve the draft of gen-errata-flow.md (as written / with edits / hold).
2. Approve the registry row (root subfolder / move to a new subfolder / hold).
Once approved I'll commit both - the registry row first, then the file - and stop.
The eventual errata-flow.html and its registry row will come up when you trigger
the regeneration.

The draft of gen-errata-flow.md is in Appendix H.

You:

#1 - Approved
#2 - Approved

AI:

Both changes are committed.
CLAUDE.md - registry row added at line 211:
SubfolderFileTypeProtocolDependenciesInstructionsDescription
gen-errata-flow.mdruleseditableProcedure for generating errata-flow.html - a self-contained Mermaid flowchart of the errata-submission flow - from errata-flow.md.
gen-errata-flow.md - written at the project root with the approved draft.
The procedure stays inert until you invoke a generation trigger. When you do, the
procedure's own rule about registering artifacts/errata-flow.html (protocol
generated, Instructions gen-errata-flow.md, Dependencies errata-flow.md) will be
the first thing I bring to you for approval before any file is written.

The procedure now lives at gen-errata-flow.md (project root, protocol editable) and is registered in CLAUDE.md. Registering the procedure does not run it. The full text is in Appendix H.

At this point the project holds two of the three pieces: the spec and the procedure. The third piece — the generated artifact itself — has not been registered yet. That comes next.

A generated file is governed by its registry row from the moment the row is registered, before any of the file’s content appears on disk. The row pins down the protocol, the placement, the dependencies, and the procedure. After this step the project knows precisely what the artifact is and how it gets built; the only thing missing is the regeneration trigger that produces the file’s content.

This step is also where the closed Type list gets its second new entry. The existing types (rules, log, spec) all describe authored content; a rendered HTML view of a spec is none of those. A new type value is proposed and approved alongside the registry row.

You:

Register a new generated file errata-flow.html.
- Subfolder: artifacts/
- File: errata-flow.html
- Type: (you propose - what makes sense for a rendered HTML diagram?)
- Protocol: generated
- Dependencies: errata-flow.md
- Instructions: gen-errata-flow.md
- Description: (you propose)

AI:

Two things you flagged for me to propose - Type and Description. Type is the harder
one because none of the closed list (rules, log, spec) fits a derived rendering.
Type proposal: add view (NEW value)
Why none of the existing types fit. rules is for AI-behavior rule files. log is
for timestamped entries. spec is for source-of-truth descriptions - but
errata-flow.html is not a source of truth; it is a derivation of one
(errata-flow.md). Calling the HTML a spec would blur the distinction between
canonical content and a regenerable view of it. If the HTML ever drifted from the
MD, the MD wins by definition - that's the textbook anti-meaning of "spec" in this
project.
Proposed definition (to add to the closed Type list):
- view - a file containing a derived rendering of source-of-truth content,
presented for human consumption.
...
Description proposal
Self-contained HTML rendering of the errata-submission user flow as a Mermaid
flowchart TD. Generated from errata-flow.md via gen-errata-flow.md.
Full proposed registry row
SubfolderFileTypeProtocolDependenciesInstructionsDescription
artifactserrata-flow.htmlviewgeneratederrata-flow.mdgen-errata-flow.mdSelf-contained HTML rendering of the errata-submission user flow as a Mermaid flowchart TD. Generated from errata-flow.md via gen-errata-flow.md.
Note on artifact existence. Registering this row does not create the file. The
gen-errata-flow.md procedure says the row MUST exist before the file is written, so
this registration sets up the slot. The file itself appears only when you invoke
the generator.
What I need from you
1. Approve adding view to the closed Type list with the definition above - or
propose a different name / definition, or stretch an existing type.
2. Approve the registry row as proposed - or adjust the Description.
Once approved I'll commit the Type-list edit and the registry row to CLAUDE.md in
that order. The HTML file itself stays uncreated until you trigger generation.

You:

Both approved

AI:

Both committed in CLAUDE.md.
Type list (line 122) - added:
- view - a file containing a derived rendering of source-of-truth content,
presented for human consumption.
Registered Files (line 216) - added:
SubfolderFileTypeProtocolDependenciesInstructionsDescription
artifactserrata-flow.htmlviewgeneratederrata-flow.mdgen-errata-flow.mdSelf-contained HTML rendering of the errata-submission user flow as a Mermaid flowchart TD. Generated from errata-flow.md via gen-errata-flow.md.
The slot is now reserved. The file itself does not yet exist on disk - that comes
when you trigger generation via regen-all.md or directly. At that point the
procedure in gen-errata-flow.md runs and produces artifacts/errata-flow.html.

The closed Type list now carries a new entry — view, for derived renderings of source-of-truth content presented for human consumption. The registry holds three rows that together describe the full pipeline: specs/errata-flow.md (the source), gen-errata-flow.md (the procedure), and artifacts/errata-flow.html (the slot for the output). The HTML file itself does not yet exist; the slot is reserved, not filled. The rules treat the unbuilt file as off-limits to direct edits even though there is nothing on disk to edit — worth noticing, because that protection keeps the protocol airtight from the very first regeneration onward.

Everything is in place. Time to run the procedure.

The prompt below — regen all artifacts — is one of the natural-language triggers registered in CLAUDE.md for regen-all.md. AI loads the procedure file fresh and walks through its four steps: collect the generated files, sort them by dependency order, present the regeneration plan and wait for approval, then sweep artifacts/ and rebuild. With only one generated file in the project, the sort is trivial and the sweep does nothing (the artifacts/ directory does not yet exist), but the procedure runs the same way it will run when the project carries dozens of artifacts.

You:

regen all artifacts

AI:

Following the procedure in regen-all.md.
Step 1 - Generated files collected
One generated file in the registry: errata-flow.html.
- Dependencies cell: errata-flow.md → resolves to registered file
specs/errata-flow.md. √
- Instructions cell: gen-errata-flow.md → resolves to registered file
gen-errata-flow.md, type rules. √
Step 2 - Order
Only one generated file. Dependency order is trivially [errata-flow.html]. No
cycles.
Step 3 - Regeneration plan
#FileInstructionsDependencies
1artifacts/errata-flow.htmlgen-errata-flow.mdspecs/errata-flow.md
Step 4 will (per regen-all.md):
1. Delete every file inside artifacts/ (including any subfolders and their
contents).
2. Regenerate artifacts/errata-flow.html by applying gen-errata-flow.md to
specs/errata-flow.md.
3. Report what was regenerated.
The artifacts/ directory does not yet exist on disk (this is the first regen).
Step 4's deletion sweep will therefore be a no-op before the new file is written.
Approve the plan and I'll execute Step 4. Without approval, the procedure halts
and no files are modified.

You:

Approved
Step 4 complete - regeneration report
Artifacts swept. artifacts/ did not exist on disk before this run, so the
pre-write deletion was a no-op. Regenerated, in order:
1. artifacts/errata-flow.html - produced by applying gen-errata-flow.md to
specs/errata-flow.md.
...
Open the file in a browser to verify rendering - that check is outside the
procedure's mandated steps, so I haven't done it for you, but if anything looks off
let me know and I'll iterate by editing gen-errata-flow.md (procedure-level) or
specs/errata-flow.md (content-level) and regenerating.

A real HTML file now exists at artifacts/errata-flow.html. Open it in a browser to see the following:

flowchart TD
  subgraph onsite["On-site (agentic-spec.com)"]
    S1["Reader visits the errata-submission web page"]
    S2["The page displays the book’s table of contents as an always-visible tree"]
    S3["Reader selects the chapter / section / subsection where the erratum is"]
    S4["The form appears with the selected location displayed"]
    S5["Reader clicks Submit"]
    S1 --> S2 --> S3 --> S4
    S4 -- "explanation only" --> S5
    S4 -- "explanation + proposed correction" --> S5
  end
  subgraph offsite["Off-site (reader’s email client)"]
    S6["The reader reviews the composed email in their client and sends it themselves"]
  end
  S5 --> S6

Every node in the diagram traces back to a step in errata-flow.md. The visual boundary that separates the on-site portion of the flow from the off-site email-client handoff matches exactly the structural distinction the spec called for. The diagram is built — but what matters more is that it was built from the text. The Markdown file is the only place where a future change has to land.

Look at the diagram, and one thing stands out: the reader has no chance to review the composed email before the email client opens. Some email clients send messages silently. Fix the gap.

This is the case the Artifacts Protocol was designed for. The natural instinct is to open the HTML and patch in the missing step. The protocol forbids the patch. The change has to go into the spec — the only place that holds the reasoning along with the steps. The HTML is treated as opaque downstream output: AI will not read it and will not edit it. The point of this subsection is to watch AI route the request to the spec automatically, without being reminded.

You:

Looking at the rendered flow, the user has no opportunity to see the email that is
about to be composed before their email client takes over. Add a step between
Submit and the email-client handoff: the site shows a preview of the subject and
body; the user can edit either inline if they want, and only after confirming does
the email client open with the (possibly edited) content. Update so the flow
reflects this.

AI:

The flow change lives in specs/errata-flow.md (the dependency). Per the Artifacts
Protocol, I'll update the source of truth and stop there - errata-flow.html is
generated and must not be hand-edited, and "Regeneration is always manual" so I
won't refresh the HTML as a side effect of this edit. I'll flag the regen at the
end.
...
Updated specs/errata-flow.md. The flow is now seven steps:
1. Reader visits the page
2. TOC displays
3. Reader selects location
4. Form appears
5. Reader clicks Submit (now assembles the email and advances to the preview, no
longer opens the email client directly)
6. NEW. Site shows an editable preview; reader edits inline if desired and
confirms (or cancels back to Step 4)
7. (was Step 6.) Confirm triggers the mailto: handoff; reader's email client
opens with the (possibly edited) content; reader reviews and sends
Cross-references in Step 5 (mailto: handoff at Step 7) and Step 7 ("On Confirm in
Step 6…") were reconciled. Step 5's structured-email rationale stayed intact since
the email shape itself didn't change; Step 7's rationale was softened - the
email-client review is no longer the only chance to inspect, but still useful for
signature blocks and the final send action staying on the user's side. The new
Step 6 carries its own rationale: a mailto: handoff is unreliable as a review
surface (minimal compose windows, hidden bodies, awkward mobile editing), so the
on-site preview makes the review guaranteed and the edits non-droppable.
The HTML is now stale. artifacts/errata-flow.html still shows the six-step flow.
Per the Artifacts Protocol I haven't regenerated it as a side effect - say "regen
all" (or any of the trigger phrases) when you want the diagram refreshed.

The spec now has seven steps; the artifact still has six. AI updated errata-flow.md (the new content is in Appendix J), softened the rationale on the original review step that no longer carries the email-review burden alone, added rationale on the new on-site preview step, and stopped. Two protocol rules combined to produce that behavior: the rule that any change request aimed at a generated file is interpreted as a change to its sources, and the rule that regeneration is always manual. The drift between the spec and the artifact is now visible — and the protocol holds until you explicitly invoke a rebuild.

The trigger phrase this time is shorter (regen all rather than regen all artifacts), but the procedure is the same: a fresh read of regen-all.md, the four steps, and the plan presented for approval before any file is touched.

You:

regen all

AI:

Following regen-all.md.
Step 1 - Generated files collected
One generated file: artifacts/errata-flow.html.
- Dependencies cell: errata-flow.md → resolves to specs/errata-flow.md. √
- Instructions cell: gen-errata-flow.md → resolves to root-level
gen-errata-flow.md, type rules. √
Step 2 - Order
Single file. Order: [errata-flow.html]. No cycles possible.
Step 3 - Regeneration plan
#FileInstructionsDependencies
1artifacts/errata-flow.htmlgen-errata-flow.mdspecs/errata-flow.md
Step 4 will (per regen-all.md):
1. Delete every file inside artifacts/ - this run, that means the stale
errata-flow.html from the previous regen gets removed.
2. Regenerate artifacts/errata-flow.html from specs/errata-flow.md (now seven
steps with the on-site preview at Step 6) via gen-errata-flow.md.
3. Report what was regenerated.
Approve and I'll execute Step 4.

You:

go

AI:

The shell rm hit a sandbox permission boundary. The Write tool uses a different
path and will overwrite the file in place - functionally equivalent to
delete-then-write for this artifacts/ directory which contains only the one file.
Proceeding.
Step 4 complete - regeneration report
- Artifacts swept. The single stale file in artifacts/ was the previous
errata-flow.html; it was replaced in place by the new build (the bash rm was
blocked by sandbox permissions, but Write overwrites the same path through
the file-tool channel - net effect identical for an artifacts/ containing
only this one file).
- Regenerated, in order:
1. artifacts/errata-flow.html - produced by applying gen-errata-flow.md to
the updated 7-step specs/errata-flow.md.
What changed vs. the previous build
- Seven node labels now instead of six. The new S6 node carries the
preview-and-confirm step; S7 (formerly S6) carries the email-client review.
- The on-site subgraph grew to include S6 (the preview is on the site), so the
subgraph boundary now sits between S6 → S7 rather than S5 → S6. The mailto:
handoff arrow is the only edge that crosses the boundary.
- The Step 4 → Step 5 form branch is unchanged - explanation only and
explanation + proposed correction arrows are still the two labeled paths from
the form to Submit.
Open it in a browser to verify the rendering matches the updated flow.

Open the new errata-flow.html in a browser to see the following:

flowchart TD
  subgraph onsite["On-site (agentic-spec.com)"]
    S1["Reader visits the errata-submission web page"]
    S2["The page displays the book’s table of contents as an always-visible tree"]
    S3["Reader selects the chapter / section / subsection where the erratum is"]
    S4["The form appears with the selected location displayed"]
    S5["Reader clicks Submit"]
    S6["The site shows an editable preview of the email; the reader edits inline if desired and confirms"]
    S1 --> S2 --> S3 --> S4
    S4 -- "explanation only" --> S5
    S4 -- "explanation + proposed correction" --> S5
    S5 --> S6
  end
  subgraph offsite["Off-site (reader’s email client)"]
    S7["The reader reviews the composed email in their client and sends it themselves"]
  end
  S6 --> S7

The new build replaces the stale one. The HTML now shows seven nodes; the preview-and-confirm step appears as a distinct node inside the on-site portion of the diagram. The procedure did not change. Only the source changed — and the rebuild carried that single change through to the diagram.

This is the SOT–ART pattern in motion. You think in the source; you look at the artifact. Corrections never go into the artifact, and the artifact never holds a fact that is not already in the source. When you spot a problem in the diagram, AI fixes it in the source — only in the source. The diagram catches up on the next regeneration, and only when you ask for it.

If you are curious what is inside errata-flow.html, look it up in Appendix I. The latest version of errata-flow.md is in Appendix J, and can also be downloaded from agentic-spec.com/downloads/specs/errata-flow-v2.md.

A note on scale. Built end-to-end for a single diagram, the SOT–ART pattern can look like a lot of setup for one rendered flowchart. In practice, the overhead is much smaller. Many diagrams of the same kind — and sometimes diagrams of different kinds — can share a single source-of-truth file and come out of it as a single generated artifact. One data-model SOT can produce every entity-relationship diagram (ERD — a visual map of the entities a system tracks and the relationships among them) in the project; one user-flow SOT can produce every flow diagram. The overhead stays manageable as the project grows.

The pattern works the other way too. A single source file can produce more than one artifact. The same data-model SOT can produce both the ERDs a human reviews and the data definition language (DDL — the statements a database engine reads to create tables, columns, and constraints). The Dependencies and Instructions columns on the registry let you set up either arrangement, and the same regen-all procedure rebuilds them all.

A faster option than regen-all is incremental regeneration — rebuilding only the artifacts that are out of date. The book does not ship this rule. Building the rule is the challenge.

The mtime — short for modification time — is the timestamp the file system records when a file was last changed.

When a file is out of date. A generated file is out of date when its mtime is older than the mtime of any file it depends on, or older than the mtime of the file in its Instructions cell. If an artifact is older than anything it was generated from, the artifact is stale.

The shape of the rule. Your new regen-incremental.md is regen-all.md with a per-file filter. The setup is the same — collect the files with protocol generated, sort them into regeneration order, verify no loops, present the plan, wait for approval. The walk through the

files is the same too, with one difference: at each file, regenerate only if the file is out of date relative to its Dependencies and Instructions entries. Otherwise, leave the file alone. The wipe step from regen-all is gone — emptying artifacts/ would defeat the purpose of an incremental build, since you would lose every artifact you were trying to preserve.

Trigger and ambiguity. The new rule loads conditionally, like regen-all, on a natural-language trigger you register. Because the two triggers are easy to confuse, add this rule […] when the user’s phrasing does not make clear whether they want the full rebuild or the incremental one, AI MUST ask before executing.