@erclx/aitk 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aitk",
3
3
  "description": "Automated governance, versioning, and discovery tools for Claude Code.",
4
- "version": "0.8.0",
4
+ "version": "0.9.0",
5
5
  "author": {
6
6
  "name": "Eric Le",
7
7
  "url": "https://github.com/erclx"
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: claude-address-review
3
+ description: What the review return leg is for, the gaps it closes, and why the push lands before the reply
4
+ ---
5
+
6
+ # Claude address review requirement
7
+
8
+ ## Gap
9
+
10
+ Without this skill, review findings are worked in whatever order the author read them and the thread never records which landed. A reply posted before the push describes code the remote does not have, so a reviewer checks the branch and finds the old version. A failing check gets treated as separate from the review, which produces a follow-up that answers every comment and leaves continuous integration red. One finding nobody can resolve stalls the rest.
11
+
12
+ ## Must
13
+
14
+ - Treat a failing check as a finding alongside the review comments, so the follow-up closes both
15
+ - Handle each finding independently, so one unresolved item does not block the others
16
+ - Verify before pushing, since a red follow-up costs the reviewer a second pass
17
+ - Push before replying, so the comment never runs ahead of the code it describes
18
+ - Map every finding to what changed, or to a one-line reason when it is a question or a conscious accept
19
+ - Post the terminal comment only when the findings are addressed and every check passes
20
+
21
+ ## Must not
22
+
23
+ - Merge, or read the closing comment as an approval. The author cannot approve their own pull request.
24
+ - Write a review. This skill consumes findings and does not produce them.
25
+ - Post the closing comment while a check is failing
26
+ - Reimplement the follow-up push or the doc refresh. Both have owners, and a second copy here drifts from them.
27
+ - Edit silently. A finding answered without a reply leaves the reviewer re-deriving the change from the diff.
28
+
29
+ ## Guards
30
+
31
+ - No open pull request for the current branch: stop
32
+ - The pull request carries no review comments or threads: stop with a pass
33
+
34
+ ## Out of scope
35
+
36
+ - Writing the review, which `claude-pr-review` owns. The split is by side of the channel: that one posts findings from an independent session and this one is the worker's return leg.
37
+ - Staging, committing, and pushing the follow-up, which `git-followup` owns under this skill's direction
38
+ - Refreshing the `.claude/` docs the fixes made stale, which `claude-docs` owns
39
+ - Re-reviewing its own fixes, which hands back to the orchestrator
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: claude-autoship
3
+ description: What the post-plan pipeline is for, the gaps it closes, and why every stop leaves the work recoverable
4
+ ---
5
+
6
+ # Claude autoship requirement
7
+
8
+ ## Gap
9
+
10
+ Without this skill, the run from an approved plan to an open pull request is a conversation. A session implements, then asks what comes next, and the answer varies by session. Review gets skipped on a diff that needed one, or spent on prose already gated by a hook. A run that halts leaves no stated resume point, so the user reconstructs how far it got from the working tree.
11
+
12
+ ## Must
13
+
14
+ - Take the approved plan for the branch as the scope, and implement only what it describes
15
+ - Give every step a stop condition, and leave the code on the branch and the receipts on disk at each one
16
+ - Classify the changed-file list before review, so a prose-only diff skips a code review with no signal on it
17
+ - Stop on any critical or should-fix finding rather than acting on it
18
+ - Open the pull request as a draft, then watch continuous integration to a terminal state
19
+ - Name the recovery for the stop it took, since the value of stopping is that the user knows where to resume
20
+
21
+ ## Must not
22
+
23
+ - Expand past the plan, refactor a neighbor, or touch a file outside it without reason
24
+ - Loop on a failed verify. One fix attempt against the reported errors, then stop.
25
+ - Fix a review finding or a failing check. Both stops are deliberate, since a green pull request reached by auto-fix hides what broke.
26
+ - Run the memory Apply phase. Promoting an entry changes how the agent operates and ships as its own change.
27
+ - Read an empty changed-file list as prose-only. It satisfies that test vacuously and would route the branch past review instead of through it.
28
+
29
+ ## Guards
30
+
31
+ - Detached HEAD: stop, no slug resolves
32
+ - No approved plan at the branch's plan path: stop and route to the planning skill
33
+ - Uncommitted changes unrelated to the plan: stop
34
+ - No diff baseline against main: stop
35
+ - Empty changed-file list: stop, and never advise removing the output from `.gitignore` to get past it
36
+
37
+ ## Out of scope
38
+
39
+ - Writing the plan, which `claude-feature` owns. This chain starts from one already approved.
40
+ - The behavior of each step, owned by the skill invoked. This skill owns the order and the stop conditions.
41
+ - The resume path after a stop, which `git-ship` owns. That skill is the tail of this same sequence, which is why the two overlap by design.
@@ -1,53 +1,65 @@
1
1
  ---
2
2
  name: claude-diagram
3
- description: Drafts `.claude/DIAGRAMS.md` with one or more Mermaid diagrams describing the project's architecture, request flow, retrieval or data pipeline, and deployment. Reads `.claude/ARCHITECTURE.md` and `REQUIREMENTS.md` when present, falls back to a code-structure scan. Use when asked to "draw the architecture", "diagram the system", "show the components", "give me a flow chart", or "visualize the project". Do NOT use for design tokens (use `claude-design-extract`) or UI audits (use `claude-ux-audit`).
3
+ description: Writes per-kind Mermaid diagram entries into `.claude/diagrams/`, covering system context, components, request flow, data pipeline, and deployment. Reads `.claude/ARCHITECTURE.md` and `REQUIREMENTS.md` when present, falls back to a code-structure scan. Use when asked to "draw the architecture", "diagram the system", "show the components", "give me a flow chart", "refresh the deploy diagram", or "visualize the project". Do NOT use for design tokens (use `claude-design-extract`) or UI audits (use `claude-ux-audit`).
4
4
  ---
5
5
 
6
6
  # Claude diagram
7
7
 
8
+ Write one entry per diagram kind. Never rewrite the folder wholesale. A pass that refreshes the deploy view leaves the other four files byte-identical, which is the whole reason the surface is a folder.
9
+
8
10
  ## Guards
9
11
 
10
12
  - If no `.claude/ARCHITECTURE.md`, no `.claude/REQUIREMENTS.md`, and no top-level folder structure to scan, stop: `❌ No source signal. Add .claude/ARCHITECTURE.md or run inside a project folder.`
11
13
 
12
- ## Step 1: read sources in parallel
14
+ ## Step 1: read sources and locate the surface
13
15
 
14
- Read these from the project root, skipping any that do not exist:
16
+ Read these from the project root in parallel, skipping any that do not exist:
15
17
 
18
+ - `.claude/diagrams/index.md` and every `.claude/diagrams/*.md`: which entries exist and what they already say
19
+ - `.claude/REQUIREMENTS.md`: users, external dependencies, tech stack, MVP feature list
16
20
  - `.claude/ARCHITECTURE.md`: layered components, key technical decisions
17
- - `.claude/REQUIREMENTS.md`: tech stack, MVP feature list
18
21
  - `CLAUDE.md`: project type, conventions
19
22
  - `package.json`, `pyproject.toml`, `Cargo.toml`: language and framework markers
20
23
  - Top-level folder layout and root config files via `ls`: deploy targets, infrastructure config, component boundaries
21
24
 
22
- Run all reads in parallel. Do not recurse speculatively.
25
+ Do not recurse speculatively.
23
26
 
24
- ## Step 2: pick which diagrams to emit
27
+ Follow `.claude/standards/diagrams.md` for frontmatter, entry kinds, layout, budgets, accessibility, verification, and explanation rules, or `${CLAUDE_SKILL_DIR}/../../standards/diagrams.md` when the project does not have it.
25
28
 
26
- Emit a diagram only when its source signal exists. Skip the rest, do not pad the file.
29
+ ### Migrating a pre-split flat file
27
30
 
28
- - **Components** (`flowchart TB` with `subgraph` boundaries): always, when any signal exists. Shows the layered structure of the system.
29
- - **Request flow** (`sequenceDiagram`): when prose describes a request lifecycle, an agent loop, or interaction between actors
30
- - **Data pipeline** (`flowchart TB`): when prose mentions retrieval, ranking, queues, ETL, or pipelines
31
- - **Deployment** (`flowchart TB`): when the top-level listing contains deploy or infrastructure config, or `.claude/ARCHITECTURE.md` has a deploy section
31
+ When `.claude/diagrams/` holds no entry and `.claude/DIAGRAMS.md` exists, this pass converts it. An entry is any `*.md` in the folder other than `index.md`. The seed ships `index.md` alone, so a folder holding only the catalog is an empty set and still converts. Split each H2 section into the entry whose kind it matches, carry its mermaid body and explanation prose across unchanged, and add the frontmatter the standard requires. Leave `.claude/DIAGRAMS.md` on disk so the split can be compared against its source, and say in Step 7 that deleting it is the user's call.
32
32
 
33
- Stay inside `flowchart` and `sequenceDiagram`. Do not emit C4, state, ER, or class diagrams. They render inconsistently across viewers.
33
+ Convert only. Do not redraw a diagram during a migration pass, since a rewrite and a move landing together leaves no way to tell which one broke a diagram.
34
34
 
35
- Follow `.claude/standards/diagrams.md` for layout, budgets, accessibility, verification, labeling, narrative, and explanation rules, or `${CLAUDE_SKILL_DIR}/../../standards/diagrams.md` when the project does not have it. `flowchart TB` is the default. Reach for `flowchart LR` only when a pipeline genuinely cannot read top-to-bottom, and call it out in the explanation paragraph.
35
+ ## Step 2: pick which entries this pass writes
36
36
 
37
- ## Step 3: write the file
37
+ Write an entry only when its source signal exists, and only when this pass has a reason to touch it. Skip the rest and leave their files alone.
38
38
 
39
- Read the existing `.claude/DIAGRAMS.md` from the project root when it is present, then write to that path. Always overwrite. The prior content is what tells Step 4 which mermaid bodies this pass actually changed.
39
+ Count entries the way Step 1 does, excluding `index.md`. Counting the catalog as an entry sends a first pass down the compare branch with nothing to compare, and it writes nothing.
40
40
 
41
- File format:
41
+ - The user named a kind: write that one.
42
+ - The user asked broadly and the folder holds no entry: write every kind whose signal exists.
43
+ - The user asked broadly and at least one entry exists: compare each entry against its source signal and write only the ones whose signal moved. Report the untouched ones as current.
42
44
 
43
- ````markdown
44
- # Diagrams
45
+ The standard fixes one filename and one `category` value per kind. Use them verbatim rather than inventing a name, since a refresh finds its target by filename and a new name writes a duplicate entry beside the old one. Emit `system-context.md` whenever `.claude/REQUIREMENTS.md` exists, since it is the entry a reader outside the team opens first and the set is incomplete without it.
46
+
47
+ Stay inside `flowchart` and `sequenceDiagram`. C4, state, ER, and class diagrams render inconsistently across viewers.
48
+
49
+ ## Step 3: write the entries
50
+
51
+ One file per kind at `.claude/diagrams/<kind>.md`. Write only the files Step 2 selected.
45
52
 
46
- <one-paragraph note on what this file contains and which sources drove it>
53
+ ````markdown
54
+ ---
55
+ title: <what the entry answers, sentence case>
56
+ description: <the question it settles and the signal that drives it>
57
+ category: <the kind, matching the standard>
58
+ ---
47
59
 
48
- ## <Section title>
60
+ # <Same as title>
49
61
 
50
- <one-line description of what this diagram shows>
62
+ <one-line statement of what the diagram shows>
51
63
 
52
64
  ```mermaid
53
65
  <diagram type>
@@ -56,22 +68,34 @@ File format:
56
68
  <body>
57
69
  ```
58
70
 
59
- ## <Next section>
60
-
61
- ...
71
+ <one to three explanation paragraphs>
62
72
  ````
63
73
 
64
- When sources came from a code scan rather than planning prose, lead the intro paragraph with `Source: code.` and add `Fidelity is lower than prose-driven diagrams. Verify against the project's intent.`
74
+ When sources came from a code scan rather than planning prose, lead the explanation with `Source: code.` and add `Fidelity is lower than prose-driven diagrams. Verify against the project's intent.`
65
75
 
66
76
  Quote node labels containing spaces or special characters with double quotes (`A["Web shell"]`). Avoid parentheses inside labels, they break some renderers. Use `<br/>` for line breaks inside labels.
67
77
 
68
- Apply the toolkit's prose bans to the entire file, including inside mermaid `subgraph` labels and node text. No em-dashes, no semicolons. Use a colon or split into two sentences instead. The standards-audit hook treats mermaid syntax as prose and will reject the file on every violation, forcing a retry per label.
78
+ Apply the toolkit's prose bans to the whole file, including inside mermaid `subgraph` labels and node text. No em-dashes, no semicolons. Use a colon or split into two sentences instead. The pedagogical voice the standard asks for is a yield on voice alone and buys no exemption from these bans.
79
+
80
+ Nothing enforces the ban inside the diagram. The standards-audit hook toggles on a fence and skips every line within it, so a label carrying an em dash passes silently while the same character in the explanation paragraph below is caught. Check the labels by reading them. This is the one place in the file where the author is the only gate.
69
81
 
70
- ## Step 4: render what this pass changed
82
+ ## Step 4: regenerate the catalog
83
+
84
+ ```bash
85
+ aitk indexes regen
86
+ ```
87
+
88
+ Run it after the last entry is written. It rebuilds `.claude/diagrams/index.md` from sibling frontmatter and groups entries under their `category`. Never hand-edit that file.
89
+
90
+ When `aitk` is not on PATH, say so in Step 7 and name `.claude/diagrams/index.md` as stale rather than writing it by hand.
91
+
92
+ Scaffold `.claude/diagrams/index.md` with `title` and `subtitle` frontmatter before the first regen when the folder is new and the seed did not provide one. The subtitle routes a first-time reader to the system context entry, since the catalog sorts categories alphabetically rather than in narrative order.
93
+
94
+ ## Step 5: render what this pass changed
71
95
 
72
96
  A source that satisfies every rule in the standard can still render as a picture that asserts something false about the system. Verification runs on the image.
73
97
 
74
- Render each diagram this pass wrote or changed. Skip any whose mermaid body is unchanged from the content read in Step 3, since an untouched diagram cannot develop a new render defect and the cost is linear in diagram count.
98
+ Render each entry this pass wrote. Skip every entry Step 2 left alone, since an untouched diagram cannot develop a new render defect.
75
99
 
76
100
  Before the first render in a project, say what is about to block:
77
101
 
@@ -82,44 +106,50 @@ Rendering to verify layout. The first run downloads the Mermaid CLI and takes ab
82
106
  Write each diagram's mermaid body to its own scratch file, then render it:
83
107
 
84
108
  ```bash
85
- mkdir -p .claude/.tmp/diagrams && bunx -y @mermaid-js/mermaid-cli -i .claude/.tmp/diagrams/<slug>.mmd -o .claude/.tmp/diagrams/<slug>.png
109
+ mkdir -p .claude/.tmp/diagrams && bunx -y @mermaid-js/mermaid-cli -i .claude/.tmp/diagrams/<kind>.mmd -o .claude/.tmp/diagrams/<kind>.png
86
110
  ```
87
111
 
88
112
  Render to PNG. An SVG export reads back as markup with no recoverable spatial meaning, so it cannot be verified. Use `bunx` when bun is available. Fall back to `npx -y @mermaid-js/mermaid-cli ...` otherwise.
89
113
 
90
114
  Renders are verification artifacts, not deliverables. They stay in `.claude/.tmp/diagrams/` and are never committed.
91
115
 
92
- When the render fails for any reason (no browser engine, no network, no package manager), continue to Step 6 and name the skipped check in the chat output. A missing renderer degrades the loop, it does not fail it.
116
+ When the render fails for any reason (no browser engine, no network, no package manager), continue to Step 7 and name the skipped check in the chat output. A missing renderer degrades the loop, it does not fail it.
93
117
 
94
- ## Step 5: read the render back
118
+ ## Step 6: read the renders back
95
119
 
96
- Read each PNG and judge the picture against what the diagram means to say. Follow the verification properties in `.claude/standards/diagrams.md`, or `${CLAUDE_SKILL_DIR}/../../standards/diagrams.md` when the project does not have it.
120
+ Read each PNG and judge the picture against what the entry means to say. Apply the verification properties in the standard.
97
121
 
98
- Fix the source and re-render. Stop after two correction passes on a diagram.
122
+ Fix the source and re-render. Stop after two correction passes on an entry.
99
123
 
100
- When a defect survives, write the diagram and name the defect in the chat output. A diagram whose author states the flaw is recoverable. A wrong diagram reported as verified is not.
124
+ When a defect survives, keep the entry and name the defect in the chat output. A diagram whose author states the flaw is recoverable. A wrong diagram reported as verified is not.
101
125
 
102
- ## Step 6: chat output
126
+ ## Step 7: chat output
103
127
 
104
128
  ```plaintext
105
- 📝 Wrote .claude/DIAGRAMS.md with N diagrams.
129
+ 📝 Wrote N entries to .claude/diagrams/
130
+ .claude/diagrams/<kind>.md
131
+ <one line per entry written>
132
+
133
+ Left untouched: <kind, kind> <omitted when the folder was empty>
106
134
 
107
135
  Verified N renders. <defect or skipped check, one line each, omitted when clean>
108
136
 
109
137
  Open in any viewer with native Mermaid support (VS Code with `bierner.markdown-mermaid`, GitHub, Cursor) to render. Ask to export if you want SVG or PNG files.
110
138
  ```
111
139
 
112
- Do not echo the diagram bodies in chat. Never report a clean verification when a render was skipped or a defect survived.
140
+ Emit the full path for every file written. Do not echo the diagram bodies in chat. Never report a clean verification when a render was skipped or a defect survived. Never report an entry as written when this pass left it alone.
141
+
142
+ After a migration pass, add: `Converted .claude/DIAGRAMS.md into N entries. The original is untouched, delete it once you have compared the split against it.`
113
143
 
114
- ## Step 7: export on request
144
+ ## Step 8: export on request
115
145
 
116
146
  If the user asks to export the diagrams (`export to svg`, `give me images`, `render to png`), run:
117
147
 
118
148
  ```bash
119
- mkdir -p .claude/review/diagrams && bunx -y @mermaid-js/mermaid-cli -i .claude/DIAGRAMS.md -o .claude/review/diagrams/diagram.png
149
+ mkdir -p .claude/review/diagrams && bunx -y @mermaid-js/mermaid-cli -i .claude/diagrams/<kind>.md -o .claude/review/diagrams/<kind>.png
120
150
  ```
121
151
 
122
- Export PNG by default. Swap `diagram.png` for `diagram.svg` only when the user asks for vector, and never for the Step 4 verification path. The CLI writes one file per `mermaid` block (`diagram-1.png`, `diagram-2.png`, ...). Output line:
152
+ Export PNG by default. Swap the extension for `.svg` only when the user asks for vector, and never for the Step 5 verification path. The CLI writes one file per `mermaid` block, suffixing when an entry holds more than one. Export every entry when the user names no kind. Output line:
123
153
 
124
154
  ```plaintext
125
155
  📝 Wrote N files to .claude/review/diagrams/
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: claude-docs
3
+ description: What the planning-doc reconcile is for, the gaps it closes, and why the diff decides completion alone
4
+ ---
5
+
6
+ # Claude docs requirement
7
+
8
+ ## Gap
9
+
10
+ Without this skill, the planning docs describe the scope the session opened with. An outcome the diff shipped stays unchecked, so the board reports finished work as open and the next session re-plans it. A requirement or architecture decision that changed mid-cycle lives only in the conversation and dies with it. Plans for closed tasks accumulate in the live folder, so the folder stops indicating what is in flight.
11
+
12
+ ## Must
13
+
14
+ - Take completion from the diff and everything else from the session, since completion is a fact about the repository rather than about the conversation
15
+ - Match an outcome on the behavior it names, never on a filename or a commit subject
16
+ - Leave an outcome unchecked when the diff is ambiguous. An unmarked shipped outcome costs one manual edit and a wrongly marked one hides work that never happened.
17
+ - Write tracked docs at the current worktree root and the task board at the main root, since only the first commits with the branch
18
+ - Count every other citation before archiving a plan, comparing resolved targets rather than raw strings or bare filenames
19
+ - Retarget a closed task at the archived plan, so the reasoning behind finished work stays reachable
20
+
21
+ ## Must not
22
+
23
+ - Infer a new task from the diff. Only outcomes already on the board get marked.
24
+ - Touch task files the session did not change, outside the board-wide plans sweep that exists to clear a missed archive
25
+ - Widen what a writing step reads when the baseline is unusable. Widening a read is safe and widening a write stubs a surface for every file in the repository.
26
+ - Edit `CLAUDE.md` inline. Every change there goes through a diff-and-approve gate, so this skill only flags.
27
+ - Create a context entry or delete a plan
28
+
29
+ ## Guards
30
+
31
+ - No `.claude/` directory: stop and name the command that sets one up
32
+ - No session divergence and no queued outcome the diff shipped: stop with a pass, since both conditions have to hold
33
+
34
+ ## Out of scope
35
+
36
+ - Creating a task file or moving one off the board, which `claude-tasks` owns
37
+ - Public-facing docs, which `docs-sync` owns. This skill reconciles the `.claude/` planning surface.
38
+ - Regenerating the task index, owned by a hook
39
+ - Redrawing diagrams, which `claude-diagram` owns. This skill flags staleness and leaves the re-run to the author.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: claude-pr-review
3
+ description: What the independent pull request review is for, the gaps it closes, and why it posts twice
4
+ ---
5
+
6
+ # Claude PR review requirement
7
+
8
+ ## Gap
9
+
10
+ Without this skill, a pull request is reviewed only by the session that wrote it, which cannot see the roadmap sequence or a sibling branch in flight. Findings land in chat, where they are read once and leave the thread with no record. A review that opens and never closes is worse than none, since a reader scanning the thread cannot tell an unanswered review from a confirmed one, and the author's claim that findings are fixed is the only evidence they are.
11
+
12
+ ## Must
13
+
14
+ - Post both passes. A first pass opens the review against the whole change, and a close-out confirms the prior findings landed.
15
+ - Detect the pass from the thread rather than taking it from the caller, matching the heading for equality so a neighboring comment cannot be read as a prior pass
16
+ - Scope a close-out to the commits added since the prior pass, once that commit is confirmed to still reach the head
17
+ - Apply the integration, contract, and consumer lenses a self-review structurally cannot
18
+ - Post a close-out even with nothing to report, since a first pass left unanswered reads as a review nobody closed
19
+ - Key the body file on both the pull request number and the head commit, so no two passes overwrite each other
20
+
21
+ ## Must not
22
+
23
+ - Merge. Review and post, and leave the gate to the human.
24
+ - Publish a claim the skill did not check. A failed fetch and a rebase both strand the prior commit, and only one of them is a rebase.
25
+ - Invent a third heading, or append a number GitHub already renders
26
+ - Review local uncommitted changes
27
+ - Lecture on process. The lenses land as findings, not as asides.
28
+
29
+ ## Guards
30
+
31
+ - No open pull request for the target branch: stop and route to the local review skill
32
+ - The fetch of the pull request head fails: stop rather than falling through to a full pass
33
+
34
+ ## Out of scope
35
+
36
+ - Fixing what it finds, which `claude-address-review` owns. The split is by side of the channel: this one posts findings from an independent session and that one consumes them.
37
+ - Reviewing local uncommitted work, which `claude-review` owns. That one writes to disk for the session that wrote the code, and this one posts to a pull request it did not write.
38
+ - Merging, which stays the human's decision
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: claude-review
3
+ description: What local review is for, the gaps it closes, and why it reports without fixing
4
+ ---
5
+
6
+ # Claude review requirement
7
+
8
+ ## Gap
9
+
10
+ Without this skill, a branch ships on the confidence of the session that wrote it. Review happens in chat and evaporates, so the ship step has no receipt to gate on. What review does happen mixes style opinion with real defects at one severity, and a reader cannot tell which blocks the merge. Worst, a diff that resolves empty against a stale base reports a clean branch instead of admitting the skill could not see the work.
11
+
12
+ ## Must
13
+
14
+ - Read the project's own context before the diff, so a decision already settled is not reported as a defect
15
+ - Resolve the base ref once, preferring the remote over local `main`, and reuse it in the guard and the read
16
+ - Say when the baseline is unusable and name the narrowed scope, rather than letting a clean summary read as a clean branch
17
+ - Flag only what will cause incorrect behavior or break a documented rule
18
+ - Grade every finding, since the caller gates on the counts rather than on the prose
19
+ - Write the report to disk under a branch-derived slug, so what the ship step reads outlives the session
20
+
21
+ ## Must not
22
+
23
+ - Fix, rewrite, or suggest a refactor outside a finding. Reporting is the whole job.
24
+ - Flag style, linter territory, or anything resting on unverified state. A false positive erodes trust in the pass.
25
+ - Substitute the whole tree for a missing baseline
26
+ - Repeat the full report in chat. The file is the report and a chat copy of it goes stale immediately.
27
+ - Stage or commit the receipt, which is gitignored scratch
28
+ - Auto-trigger on a vague signal. Require an explicit request or a pipeline invocation.
29
+
30
+ ## Guards
31
+
32
+ - The staged set, the branch set, and the working set are all empty: stop with a pass
33
+ - Baseline unusable: continue on the uncommitted set and lead the report with the warning
34
+
35
+ ## Out of scope
36
+
37
+ - Reviewing an open pull request, which `claude-pr-review` owns. The split is by vantage: this one reviews local work for the session that wrote it and writes to disk.
38
+ - Deciding whether the findings block the ship. This skill grades and the caller gates.
39
+ - Fixing anything it found, which `claude-address-review` owns once the work is on a pull request
@@ -131,7 +131,7 @@ Before the first feature session on a UI-heavy project, pick a design tier. The
131
131
  | `aitk:claude-feature` | Before implementation, scan for conflicts and ambiguities |
132
132
  | `aitk:claude-roadmap` | Sequence MVP scope into ordered versions in `.claude/ROADMAP.md` |
133
133
  | `aitk:claude-orchestrate` | Assert the orchestrator role, refill the ready queue, and dispatch the roadmap, feature, and review skills |
134
- | `aitk:claude-diagram` | Draft `.claude/DIAGRAMS.md` with mermaid diagrams from architecture and code, then verify each rendered image |
134
+ | `aitk:claude-diagram` | Draft per-kind mermaid entries under `.claude/diagrams/` from architecture and code, then verify each rendered image |
135
135
  | `aitk:claude-design-propose` | Day one on a UI project, draft `.claude/DESIGN.md` from requirements. Use `claude-design-extract` if UI already exists |
136
136
  | `aitk:claude-review` | In a fresh session, review all changes since main |
137
137
  | `aitk:claude-pr-review` | Review an open PR from an independent session, then close the review out against the commits added since |
@@ -57,7 +57,7 @@ Scaffold installs tooling and seeds. It does not fill the planning docs or the d
57
57
 
58
58
  1. Fill `.claude/REQUIREMENTS.md` and `.claude/ARCHITECTURE.md`. The seed provides the files, the scope and decisions are yours to write.
59
59
  2. For a UI project, invoke `aitk:claude-design-propose` to draft `.claude/DESIGN.md` from the requirements and a `## Personality` section. Skip for non-UI projects.
60
- 3. Optionally invoke `aitk:claude-diagram` to draft `.claude/DIAGRAMS.md` from the architecture. It renders each diagram to verify the layout, which downloads the Mermaid CLI on first use and takes about 15 seconds. A machine without a renderer still gets the diagrams and is told which check was skipped.
60
+ 3. Optionally invoke `aitk:claude-diagram` to draft entries under `.claude/diagrams/` from the architecture and the requirements. One file per diagram kind, so a later refresh of one kind leaves the others untouched. It renders each diagram it writes to verify the layout, which downloads the Mermaid CLI on first use and takes about 15 seconds. A machine without a renderer still gets the diagrams and is told which check was skipped.
61
61
  4. Start the feature loop. See [AI workflow](ai-workflow.md) for the per-feature sequence.
62
62
 
63
63
  ### Stack decision
@@ -1,6 +1,7 @@
1
1
  ---
2
- description: Route .claude/DIAGRAMS.md edits to the diagrams standard for Mermaid conventions
2
+ description: Route .claude/diagrams edits to the diagrams standard for Mermaid conventions
3
3
  paths:
4
+ - '.claude/diagrams/**'
4
5
  - '.claude/DIAGRAMS.md'
5
6
  ---
6
7
 
@@ -8,4 +9,11 @@ paths:
8
9
 
9
10
  ## Authority
10
11
 
11
- - Follow `.claude/standards/diagrams.md` for Mermaid diagram layout, labeling, and narrative. It is the single source.
12
+ - Follow `.claude/standards/diagrams.md` for Mermaid diagram layout, budgets, accessibility, verification, and explanation prose. It is the single source.
13
+ - A diagram entry carries structure and flow, not implementation. Read the standard before adding or revising a kind.
14
+
15
+ ## Scope
16
+
17
+ - Write a new diagram to `.claude/diagrams/<kind>.md`, never to `.claude/DIAGRAMS.md`
18
+ - Convert a `.claude/DIAGRAMS.md` left by an older install into per-kind entries before editing it
19
+ - Refresh only the entries whose source signal moved. Do not rewrite the folder wholesale.
@@ -15,4 +15,4 @@ paths:
15
15
 
16
16
  ## Authority
17
17
 
18
- - Follow `.claude/standards/skill.md` for skill structure, frontmatter fields, and invocation rules. It is the single source.
18
+ - Follow `.claude/standards/skill.md` for skill structure, frontmatter fields, invocation rules, and the shape a `REQUIREMENT.md` states. It is the single source.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@erclx/aitk",
3
3
  "type": "module",
4
- "version": "0.8.0",
4
+ "version": "0.9.0",
5
5
  "description": "Infrastructure and quality tooling for developer workflows",
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -75,7 +75,7 @@ log_step "Assert scaffold"
75
75
  # no assertion can truncate silently: init still exits 0 because run_domain
76
76
  # catches a failed domain, and the gate stays green while the target is
77
77
  # missing everything that domain provides.
78
- for path in "CLAUDE.md" ".claude/snippets/compact-summary.md" ".claude/standards/prose.md" ".claude/wiki/index.md" ".claude" ".claude/context/index.md" ".claude/wireframes/index.md" \
78
+ for path in "CLAUDE.md" ".claude/snippets/compact-summary.md" ".claude/standards/prose.md" ".claude/wiki/index.md" ".claude" ".claude/context/index.md" ".claude/wireframes/index.md" ".claude/diagrams/index.md" \
79
79
  ".prettierrc" ".editorconfig" ".lintstagedrc" ".husky/pre-commit" ".github/workflows/verify.yml" "scripts/verify.sh" \
80
80
  ".claude/rules/core/000-constitution.md"; do
81
81
  if [ ! -e "$TARGET_DIR/$path" ]; then
@@ -7,7 +7,13 @@ const SEEDS_DIR = join('tooling', 'claude', 'seeds')
7
7
  const CLAUDE_DIR = '.claude'
8
8
  const CLAUDE_MD = 'CLAUDE.md'
9
9
  const HOOKS = 'hooks'
10
- const SUBDIRS: readonly string[] = [HOOKS, 'context', 'tasks', 'wireframes']
10
+ const SUBDIRS: readonly string[] = [
11
+ HOOKS,
12
+ 'context',
13
+ 'diagrams',
14
+ 'tasks',
15
+ 'wireframes',
16
+ ]
11
17
 
12
18
  export type SeedScope = 'claude' | 'root'
13
19
 
@@ -1,34 +1,83 @@
1
1
  ---
2
2
  title: Diagram reference
3
- description: Conventions for Mermaid diagrams in .claude/DIAGRAMS.md
3
+ description: Shape and content rules for .claude/diagrams/<kind>.md files
4
4
  ---
5
5
 
6
6
  # Diagram reference
7
7
 
8
- Applies to Mermaid diagrams in `.claude/DIAGRAMS.md`. Goal: diagrams that render cleanly in narrow-column renderers (VS Code preview, GitHub PR view, Cursor) and read pedagogically without surrounding prose.
8
+ Applies to per-kind entries under `.claude/diagrams/`. Skip for `index.md`, which is regenerated by `aitk indexes regen`.
9
+
10
+ A diagram entry answers one question about the system with one or more Mermaid diagrams and the prose that makes them readable. It is not a rendering of the file tree. The check for any single line: does it tell a reader something the code layout would not have told them? If not, it belongs in `.claude/context/`.
11
+
12
+ ## What a working entry looks like
13
+
14
+ An entry works when a reader who has not opened the repository can answer its question:
15
+
16
+ - What are the parts, and which ones talk to each other?
17
+ - Which direction does the work flow, and where does it start?
18
+ - What would break if one box were removed?
19
+
20
+ An entry that fails these is non-conforming regardless of whether it satisfies every section rule below. The fences are the means. These three questions are the test.
21
+
22
+ ## Frontmatter
23
+
24
+ - `title` (required): sentence case, names what the entry answers (`System context`, `Request flow`), not what it draws.
25
+ - `description` (required): one line on which question the entry settles and which source signal drives it.
26
+ - `category` (required): the diagram kind, one of the five in Entry kinds. It is the grouping field `aitk indexes regen` renders headings from.
27
+
28
+ All three feed `.claude/diagrams/index.md` when regenerated. The catalog sorts categories alphabetically rather than in narrative order, so an entry cannot rely on its position to introduce another. Each entry names its own starting point, and the catalog's subtitle routes a first-time reader to the system context entry.
29
+
30
+ ## Entry kinds
31
+
32
+ Five kinds, each with a fixed filename and a fixed `category` value. Write a kind only when its source signal exists, and leave the rest absent rather than padding the folder.
33
+
34
+ - `system-context.md`, category `System context` (`flowchart TB`): who uses the system, what it talks to, and where its boundary sits. Drawn from `.claude/REQUIREMENTS.md`. This is the entry a reader outside the team opens first, and the only kind that draws the world outside the boundary.
35
+ - `components.md`, category `Components` (`flowchart TB` with `subgraph` boundaries): the layered structure inside the boundary. Drawn from `.claude/ARCHITECTURE.md`.
36
+ - `request-flow.md`, category `Request flow` (`sequenceDiagram`): a request lifecycle, an agent loop, or an interaction between actors.
37
+ - `data-pipeline.md`, category `Data pipeline` (`flowchart TB`): retrieval, ranking, queues, or ETL.
38
+ - `deployment.md`, category `Deployment` (`flowchart TB`): hosts, services, and infrastructure config.
39
+
40
+ The filenames are fixed rather than free, so a session refreshing one kind finds the file it is meant to overwrite instead of writing a second entry beside it under a name of its own.
41
+
42
+ Stay inside `flowchart` and `sequenceDiagram`. C4, state, ER, and class diagrams render inconsistently across viewers.
43
+
44
+ The kinds drift at rates spanning roughly an order of magnitude, which is why they are separate files. A deploy change rewrites one entry and leaves the other four untouched.
45
+
46
+ A second entry for one kind takes a suffixed name (`request-flow-admin.md`) and repeats the kind's `category` verbatim, which is what the grouping field is for. One entry per kind is the ordinary case, so most catalogs show one entry under each heading.
9
47
 
10
48
  ## Layout
11
49
 
12
50
  - Declare `flowchart TB` by default. Mermaid ignores a subgraph's direction whenever that subgraph links outward, and an architecture diagram links across its subgraphs as the normal case, so top-bottom is a declaration rather than a guarantee.
13
51
  - Restructure a diagram that renders diagonal or left-to-right. Repeating the direction keyword does not fix it.
14
- - Render a component, context, or pipeline diagram taller than wide. A `sequenceDiagram` is wide by construction and is exempt.
52
+ - Render a context, component, or pipeline diagram taller than wide. A `sequenceDiagram` is wide by construction and is exempt.
15
53
  - Do not let independent nodes render in a row. A row of siblings reads as a sequential chain and asserts a pipeline the system does not have.
16
54
  - Do not converge many edges on one node from one side. A crossing bundle is unreadable whatever it encodes.
17
55
  - Keep node labels short. Three or four words max. Detail goes in the paragraph below the diagram.
18
56
  - Use `<br/>` for a second short line on a node when the label is two ideas, never for a sentence.
19
- - Subgraphs are for grouping unrelated lanes (offline versus online, browser versus server). Do not subgraph a single linear flow.
57
+ - Subgraphs are for grouping unrelated lanes such as offline versus online or browser versus server. Do not subgraph a single linear flow.
20
58
 
21
59
  ## Budgets
22
60
 
23
61
  - Hold a diagram to roughly 5 to 10 nodes. Split it past 15.
24
62
  - Watch edge count harder than node count. It binds first, and a diagram whose edges outnumber its nodes is already too dense to read.
25
63
  - Treat a diagram that cannot be described in one sentence as two diagrams.
64
+ - Keep an entry to one diagram by default. A second fence in the same file needs its own H2 naming what it adds, and a third is a sign the entry covers two kinds.
26
65
  - Warn rather than refuse on a budget, and name the split that would fix it. These numbers come from published Mermaid practice rather than from a measurement in this repository, so a hard refusal on them will be wrong sometimes and unarguable when it is.
27
66
 
28
67
  ## Accessibility
29
68
 
30
69
  - Give every diagram `accTitle` and `accDescr`. `accTitle` names what the diagram answers. `accDescr` states the structure in one sentence for a reader who cannot see the render.
31
70
 
71
+ ## Explanation
72
+
73
+ - One to three short paragraphs below each diagram. Plain English and pedagogical.
74
+ - Lead with what the diagram shows. Follow with why this shape was chosen and what alternative was rejected, when the choice was non-obvious.
75
+ - Reference one or two specific code paths the reader can open. Do not enumerate every file.
76
+ - Do not duplicate prose across entries. An entry that restates its neighbor has taken the neighbor's job.
77
+ - The audience is mixed, so vocabulary runs as a gradient across the set. `System context` assumes no knowledge of the repository. `Deployment` may assume the reader has read the others.
78
+
79
+ This section states the voice for the surface, which is what claims the yield `standards/prose.md` grants to a surface whose own standard sets it. Explanation prose is pedagogical here and the default developer-facing voice does not apply. The yield covers voice alone. Punctuation, formatting, and language bans stay in force, and the standards-audit hook enforces them on every write.
80
+
32
81
  ## Verification
33
82
 
34
83
  - Judge a diagram from its rendered image, not from its source. Direction, sibling rows, and edge bundles are visible only in the output.
@@ -36,20 +85,21 @@ Applies to Mermaid diagrams in `.claude/DIAGRAMS.md`. Goal: diagrams that render
36
85
  - Apply four tests as a reviewer, the same ones the author applied: direction held, no sibling row reading as a chain, no crossing edge bundle, taller than wide outside a sequence diagram.
37
86
  - State which verification was skipped when no renderer is available. A diagram written without a render is still shippable, and one reported as verified without a render is not.
38
87
 
39
- ## Narrative
88
+ ## What moves to .claude/context/
40
89
 
41
- - Build a narrative arc across the file, not a parallel list of unrelated views. Start with the whole system in five or six boxes. Drill into one phase per section.
42
- - Order sections chronologically when possible: framing, then setup, then a query travels through, then measurement.
43
- - One H2 per diagram. The H2 names what the diagram answers, not what it shows ("How the corpus gets populated", not "Corpus ingestion").
90
+ Implementation detail that answers how a component is built belongs in a `.claude/context/` entry, not a diagram:
44
91
 
45
- ## Explanation
92
+ - Function names, call signatures, and lifecycle ordering
93
+ - Library versions, config keys, and environment variable names
94
+ - Retry counts, timeouts, and batch sizes
95
+ - Workarounds and rejected approaches that need more than one sentence
46
96
 
47
- - One to three short paragraphs below each diagram. Plain English, pedagogical, no marketing copy.
48
- - Lead with what the diagram shows. Follow with why this shape was chosen and what alternative was rejected, when the choice was non-obvious.
49
- - Reference one or two specific code paths the reader can open. Do not enumerate every file.
50
- - Do not duplicate prose between sections. Each paragraph earns its line.
97
+ Reference the context entry by path when a reader needs the mechanism. The diagram stays answerable on its own for structure and flow.
51
98
 
52
99
  ## Maintenance
53
100
 
54
- - When the system changes (new layer, new provider, new deploy posture), audit `.claude/DIAGRAMS.md` in the same PR. A diagram showing a defunct host or library is worse than no diagram.
55
- - Mermaid blocks are inside fenced code, so the prose-standards hook ignores them. The explanation paragraph below is still prose. Follow `standards/prose.md`.
101
+ - When the system changes, update the entries whose source signal changed and leave the rest alone. Rewriting the folder wholesale reproduces the defect the per-kind split exists to end.
102
+ - A diagram showing a defunct host or library is worse than no diagram. Audit the affected entry in the same PR.
103
+ - `System context` has no named source signal beyond `.claude/REQUIREMENTS.md`, so nothing tells a session it went stale. Re-read it when the boundary or the set of external dependencies moves.
104
+ - Mermaid blocks are inside fenced code, so the prose-standards hook ignores them. The explanation paragraphs around them are still prose. Follow `standards/prose.md`.
105
+ - The punctuation bans still apply to node and subgraph labels, and nothing checks them there. An em dash in a label passes every gate the repository has, so read the labels before shipping the entry.
@@ -10,7 +10,7 @@ Reference docs for consistent authoring across the toolkit and target projects.
10
10
  - [Architecture reference](architecture.md): Shape and content rules for .claude/ARCHITECTURE.md
11
11
  - [Context entry reference](context.md): Shape and content rules for .claude/context/<domain>.md entries
12
12
  - [Design reference](design.md): Shape and content rules for .claude/DESIGN.md
13
- - [Diagram reference](diagrams.md): Conventions for Mermaid diagrams in .claude/DIAGRAMS.md
13
+ - [Diagram reference](diagrams.md): Shape and content rules for .claude/diagrams/<kind>.md files
14
14
  - [Prose reference](prose.md): Voice, structure, formatting, and language rules for reference markdown
15
15
  - [Readme reference](readme.md): Readme structure and content conventions
16
16
  - [Requirements reference](requirements.md): Shape and content rules for .claude/REQUIREMENTS.md
@@ -5,7 +5,7 @@ description: Voice, structure, formatting, and language rules for reference mark
5
5
 
6
6
  # Prose reference
7
7
 
8
- Applies to markdown reference docs, READMEs, and inline documentation in repos. It is the default voice for `.md` files and yields to any surface with its own voice, such as blogs, emails, changelogs, or commit messages.
8
+ Applies to markdown reference docs, READMEs, and inline documentation in repos. It is the default voice for `.md` files and yields to any surface with its own voice, such as blogs, emails, changelogs, or commit messages. It also yields wherever another standard states the voice for the surface it governs, which is how a surface claims the exemption without this file having to name it. The yield covers voice alone. Punctuation, formatting, and language rules below stay in force on every surface, since the standards-audit hook is the only gate on published text.
9
9
 
10
10
  ## Voice
11
11
 
@@ -14,6 +14,7 @@ The claude stack installs the `.claude/` workflow directory into a project. Stat
14
14
  ├── ARCHITECTURE.md ← seeded. Technical design decisions and open questions
15
15
  ├── DESIGN.md ← seeded. Visual intent and the decisions behind it
16
16
  ├── wireframes/ ← seeded. Per-surface ASCII layouts. `index.md` is the discovery anchor; `<surface>.md` files hold the sketches and behavior bullets.
17
+ ├── diagrams/ ← seeded. Per-kind Mermaid views. `index.md` is the discovery anchor. `<kind>.md` files hold one diagram each, grouped by the `category` frontmatter field.
17
18
  ├── GOV.md ← retired. Removed by `aitk gov sync` if present from a prior install
18
19
  ├── settings.json ← seeded. Project-level Claude Code config (PreToolUse and PostToolUse hooks). User-level config installed separately via `aitk claude setup`.
19
20
  ├── plans/ ← execution detail for multi-step tasks, gitignored. `feature-*.md` entries swept by claude-docs.
@@ -32,6 +33,10 @@ Convert by hand, once per project:
32
33
  2. Run `aitk indexes regen --no-stage --root . .claude/tasks/<any-task>.md` to build the catalog.
33
34
  3. Delete `.claude/TASKS.md`, and swap its `.gitignore` entry for `.claude/tasks/`.
34
35
 
36
+ ## Upgrading from a single-file diagram set
37
+
38
+ A project installed before the diagram surface became a folder still holds `.claude/DIAGRAMS.md`. Unlike the board, this one migrates itself. The `claude-diagram` skill reads the flat file when `.claude/diagrams/` holds no entries, splits it by kind into the folder, and reports what it wrote. The old file stays on disk so the split can be compared against its source, and deleting it is a manual step once that check passes.
39
+
35
40
  ## Gitignore
36
41
 
37
42
  - `# Claude`: `.claude/.tmp/`, `.claude/memory/`, `.claude/plans/`, `.claude/review/`, `.claude/worktrees/`, `.claude/tasks/`
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: Diagrams
3
+ subtitle: Per-kind Mermaid views loaded on demand. Start with system context.
4
+ ---
5
+
6
+ # Diagrams
7
+
8
+ Per-kind Mermaid views loaded on demand. Start with system context.