@caddis/cli 0.4.0 → 0.4.2

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.
Files changed (21) hide show
  1. package/bundles/antigravity-plugin/plugin.json +1 -1
  2. package/bundles/antigravity-plugin/scripts/check_doc_coverage.py +1 -1
  3. package/bundles/antigravity-plugin/scripts/setup_project_ai.py +34 -5
  4. package/bundles/antigravity-plugin/skills/_registry.md +2 -0
  5. package/bundles/antigravity-plugin/skills/safe-cleanup/SKILL.md +176 -0
  6. package/bundles/antigravity-plugin/skills/tech-explainer/SKILL.md +280 -0
  7. package/bundles/antigravity-plugin/skills/tech-explainer/assets/skeleton.md +255 -0
  8. package/bundles/antigravity-plugin/skills/tech-explainer/evals/evals.json +50 -0
  9. package/bundles/antigravity-plugin/skills/tech-explainer/references/diagrams.md +237 -0
  10. package/bundles/antigravity-plugin/skills/tech-explainer/references/language.md +141 -0
  11. package/bundles/antigravity-plugin-extras/plugin.json +1 -1
  12. package/bundles/antigravity-plugin-extras/skills/_registry.md +1 -0
  13. package/bundles/antigravity-plugin-extras/skills/safe-cleanup/SKILL.md +176 -0
  14. package/bundles/codex/.codex/skills/devops/safe-cleanup/SKILL.md +176 -0
  15. package/bundles/codex/.codex/skills/docs/tech-explainer/SKILL.md +280 -0
  16. package/bundles/codex/.codex/skills/docs/tech-explainer/assets/skeleton.md +255 -0
  17. package/bundles/codex/.codex/skills/docs/tech-explainer/evals/evals.json +50 -0
  18. package/bundles/codex/.codex/skills/docs/tech-explainer/references/diagrams.md +237 -0
  19. package/bundles/codex/.codex/skills/docs/tech-explainer/references/language.md +141 -0
  20. package/bundles/manifest.json +3 -3
  21. package/package.json +1 -1
@@ -0,0 +1,255 @@
1
+ <!--
2
+ tech-explainer skeleton. Copy, fill, delete what has nothing to say.
3
+ Slots marked [KEEP] are what make this an explainer rather than a summary.
4
+ Rename any section to fit the domain — keep the order.
5
+ If the repo requires document frontmatter, add it above the title (type: analysis).
6
+ -->
7
+
8
+ # \<The subject\> — a plain explainer
9
+
10
+ <!-- No name given? Use the role — "the engineering manager" — and leave this placeholder visible.
11
+ Never invent a name. -->
12
+ **Audience:** \<name or role of the reader\>, and anyone who did not do the \<testing / investigation / migration\>.
13
+ **Written in Simplified Technical English.** Short sentences. One idea per sentence.
14
+
15
+ ---
16
+
17
+ ## 1. Why this document exists [KEEP]
18
+
19
+ This document explains \<n\> things:
20
+
21
+ 1. \<question 1\>
22
+ 2. \<question 2\>
23
+ 3. \<question 3\>
24
+
25
+ Section \<n\> answers the \<the reader's own question\> directly.
26
+
27
+ ---
28
+
29
+ ## 2. Words used in this document [KEEP]
30
+
31
+ Use these words with one meaning only.
32
+
33
+ | Word | Meaning |
34
+ | ---------- | ------------------------------------------------ |
35
+ | **\<term\>** | \<one meaning, in plain words, no new jargon\> |
36
+
37
+ <!-- 8-12 rows. Highest value: terms two people in the thread have used differently. -->
38
+
39
+ ---
40
+
41
+ ## 3. What we are building
42
+
43
+ \<Two or three sentences. What the system does and why it exists.\>
44
+
45
+ ```mermaid
46
+ flowchart LR
47
+ A[("Source")] --> B["Work<br/>size"] --> C[("Result")]
48
+ ```
49
+
50
+ \<The physical facts: hardware, operating system, versions, scale.\>
51
+
52
+ ---
53
+
54
+ ## 4. The goal, in numbers [KEEP]
55
+
56
+ <!-- No agreed target? Retitle "The result, in numbers" and make the missing target the finding. -->
57
+
58
+ \<One sentence stating the target.\>
59
+
60
+ | Item | Value |
61
+ | ----------------------- | ----------- |
62
+ | \<basis\> | \<value\> |
63
+ | **\<what we need\>** | **\<n\>** |
64
+ | **\<what we measure\>** | **\<n\>** |
65
+ | **Gap** | **\<n x\>** |
66
+
67
+ <!-- If an earlier target has changed, say so and say why. -->
68
+
69
+ ---
70
+
71
+ ## 5. The layers — and \<the reader's specific question\>
72
+
73
+ **Short answer: \<the answer, in one or two sentences\>.**
74
+
75
+ \<Then earn it.\>
76
+
77
+ ```mermaid
78
+ flowchart TB
79
+ subgraph l1["LAYER 1 — <name> (<what this layer is for>)"]
80
+ direction LR
81
+ A["<b>Thing</b><br/>status"]
82
+ end
83
+ subgraph l2["LAYER 2 — <name> (<what this layer is for>)"]
84
+ B["<b>Thing</b>"]
85
+ end
86
+ A --> B
87
+ ```
88
+
89
+ \<One line: which layer is easy to change, which layer decides the outcome.\>
90
+
91
+ ### \<The options compared\>
92
+
93
+ | Option | What it adds | What is inside | Do we use it? |
94
+ | ------ | ------------ | -------------- | ------------- |
95
+ | | | | |
96
+
97
+ ---
98
+
99
+ ## 6. Why the work took so long — what we withdrew
100
+
101
+ <!-- Nothing withdrawn? Do NOT invent a retraction. Substitute "What this rests on": the assumptions
102
+ the argument depends on, each with what would falsify it. Same function — it shows the reader
103
+ where to attack. -->
104
+
105
+ \<n\> wrong results were found. **Every one was found by comparing a number against a second,
106
+ independent number.**
107
+
108
+ ```mermaid
109
+ flowchart LR
110
+ A["Change one thing"] --> B["Measure it"]
111
+ B --> C{"Does it agree with a<br/>second, independent number?"}
112
+ C -->|"No"| D["The instrument is wrong.<br/>Repair the test."]
113
+ D --> B
114
+ C -->|"Yes"| E["Record the result"]
115
+ ```
116
+
117
+ - We reported \<claim\>. **This was wrong.** \<Cause, and what caught it.\>
118
+ - We reported \<claim\>. **This was wrong.** \<Cause, and what caught it.\>
119
+
120
+ **Lesson:** \<one line\>.
121
+
122
+ ---
123
+
124
+ ## 7. Where the \<time / cost / data\> goes
125
+
126
+ We measured \<n\> samples.
127
+
128
+ ```mermaid
129
+ pie showData
130
+ title <what is being divided>
131
+ "<slice A>" : 0
132
+ "<slice B>" : 0
133
+ ```
134
+
135
+ \<The consequence: what this means for where effort should go.\>
136
+
137
+ ---
138
+
139
+ ## 8. What limits the result — \<n\> layers [KEEP — the most important diagram]
140
+
141
+ This is the most important diagram in this document. The layers are in order of size of effect.
142
+
143
+ ```mermaid
144
+ flowchart TB
145
+ subgraph L1["LAYER 1 — <cause> — LARGEST EFFECT — <magnitude>"]
146
+ M["<b>The claim.</b><br/>The comparison.<br/>The consequence."]
147
+ end
148
+ subgraph L2["LAYER 2 — <cause> — MEDIUM EFFECT — <magnitude>"]
149
+ E["<b>The claim.</b><br/>The evidence."]
150
+ end
151
+ subgraph L3["LAYER 3 — <cause> — SMALL EFFECT — <magnitude>"]
152
+ W["<b>The claim.</b><br/>The evidence."]
153
+ end
154
+ subgraph L4["LAYER 4 — <cause> — NO EFFECT"]
155
+ O["<b>The claim.</b><br/>The evidence."]
156
+ end
157
+ L1 --> L2 --> L3 --> L4
158
+ ```
159
+
160
+ **Read the diagram this way.** If we change \<the small layer\>, we gain \<small\>. If we change
161
+ \<the big layer\>, we gain \<big\>. \<Layer n\> is where the work must go.
162
+
163
+ ---
164
+
165
+ ## 9. \<n\> recommendations — what we checked
166
+
167
+ <!-- No formal list of recommendations? The reader still holds a belief. State it as they would
168
+ state it, then check it: claim / verdict / evidence. -->
169
+
170
+ We checked all \<n\> against our own measurements and against public evidence.
171
+
172
+ | # | Recommendation | Result | Evidence |
173
+ | --- | -------------- | ------ | -------- |
174
+ | 1 | | | |
175
+
176
+ ### Where the advice is right
177
+
178
+ \<Steelman. Concede what is genuinely true, with the arithmetic.\>
179
+
180
+ ```
181
+ <quantity> <value>
182
+ <quantity> <value>
183
+ Theoretical maximum <value>
184
+ Measured <value> (<percent>)
185
+ ```
186
+
187
+ ### Why \<the alarming number\> is not as bad as it looks
188
+
189
+ | System | Result |
190
+ | ----------------------- | ------ |
191
+ | \<independent source\> | |
192
+ | **\<ours\>** | |
193
+
194
+ **Conclusion: \<one sentence\>.**
195
+
196
+ ---
197
+
198
+ ## 10. What \<the constraint\> costs us, and what it gives us
199
+
200
+ ### The cost
201
+
202
+ | Option | Supported? | Note |
203
+ | ------ | ---------- | ---- |
204
+ | | | |
205
+
206
+ ### What it does not cost us
207
+
208
+ \<The belief people hold, checked. State plainly whether the evidence supports it.\>
209
+
210
+ ### What it gives us
211
+
212
+ \<The genuine benefit. Every constraint has one; naming it proves you are not just complaining.\>
213
+
214
+ ---
215
+
216
+ ## 11. What we do next [KEEP]
217
+
218
+ ```mermaid
219
+ flowchart TB
220
+ A["<b>Step 1 — <name></b><br/>What. How it is measured."] --> B
221
+ B["<b>Step 2 — <name></b><br/>What. What counts as passing."] --> C
222
+ C["<b>Step 3 — <name></b><br/>What."]
223
+ ```
224
+
225
+ **Step \<n\> is the most important step.** \<Why, with the number.\>
226
+
227
+ We also have \<n\> measurement gaps to close:
228
+
229
+ 1. \<What we never measured directly, and how long the direct check would take.\>
230
+
231
+ ---
232
+
233
+ ## 12. Questions for \<the reader\>
234
+
235
+ These would help us. \<Reader\> has more experience with \<the area\>.
236
+
237
+ 1. **\<Question?\>** \<Why the answer would change what we do.\>
238
+
239
+ ---
240
+
241
+ ## 13. Summary in five lines [KEEP]
242
+
243
+ 1. \<target vs measured vs gap\>
244
+ 2. \<the main cause\>
245
+ 3. \<the thing the reader thought was the cause, with its measured size\>
246
+ 4. \<the constraint, and what it really costs\>
247
+ 5. \<the next step\>
248
+
249
+ ---
250
+
251
+ ## Related documents
252
+
253
+ | Document | What it holds |
254
+ | -------- | ------------- |
255
+ | [`path`](path) | \<the detail this explainer deliberately leaves out\> |
@@ -0,0 +1,50 @@
1
+ {
2
+ "skill_name": "tech-explainer",
3
+ "evals": [
4
+ {
5
+ "id": 0,
6
+ "name": "answer-a-senior-colleagues-recommendations",
7
+ "prompt": "Our infra lead Priya sent three recommendations after our Postgres slowdown: (1) move the DB to NVMe, (2) bump shared_buffers to 32GB, (3) switch the connection pooler from pgbouncer to pgcat. I spent two weeks benchmarking. What I actually found: the p99 is dominated by one N+1 query in the orders service that fires ~340 round trips per page load — that's ~85% of the latency. Disk is already NVMe (she didn't know). shared_buffers helped 4% at 32GB. pgcat vs pgbouncer measured within 2%. I also had two results I had to retract along the way — my first benchmark used a warm cache so it showed a fake 3x win from shared_buffers, and I misread a pooler metric that made pgcat look 40% faster. Write this up for Priya. She's more senior than me and I need her to not feel dismissed.",
8
+ "expected_output": "A markdown explainer, STE, with: audience line naming Priya; vocabulary table; a ranked-effect Mermaid diagram putting the N+1 query at LAYER 1 ~85% and the pooler at the bottom with the measured 2%; a withdrawn-results section listing both retractions with what caught them; a 'where the advice is right' steelman; questions back to Priya; five-line summary.",
9
+ "assertions": [
10
+ "Contains a Mermaid flowchart TB whose subgraph titles carry effect magnitudes (e.g. LARGEST EFFECT / NO EFFECT plus a number or percentage), ordered largest effect first",
11
+ "The N+1 query is ranked as the largest effect and the connection pooler is ranked with its measured ~2%",
12
+ "All three of Priya's recommendations appear, each with a verdict and an evidence column",
13
+ "Contains a section that concedes where Priya is right before refuting anything",
14
+ "Contains a withdrawn/retracted-results section naming both wrong results and what caught each one",
15
+ "Contains a controlled-vocabulary table defining terms with one meaning each",
16
+ "Contains an audience line naming Priya and an explicit Simplified Technical English declaration",
17
+ "Contains a summary of about five numbered lines",
18
+ "No sentence exceeds 30 words in the body prose",
19
+ "Every headline number carries a unit and a basis (sample, date, or method)"
20
+ ],
21
+ "files": []
22
+ },
23
+ {
24
+ "id": 1,
25
+ "name": "explain-an-architecture-to-a-non-specialist",
26
+ "prompt": "My manager keeps asking why our nightly ETL takes 5 hours when 'it's just copying data'. Can you write something plain-English with diagrams that explains what the pipeline actually does end to end and where the 5 hours goes? Breakdown from last night's run: extract from Salesforce API 3h12m (rate limited to 100 req/min, 19k accounts), transform in dbt 41m, load to Snowflake 22m, dbt tests 45m. He's not technical but he's sharp and he'll ask good questions.",
27
+ "expected_output": "An explainer with a left-to-right pipeline flowchart, a pie chart of where the time goes with the run date, a vocabulary table defining rate limit / extract / transform / load / dbt, a ranked view showing the API rate limit dominates, and next steps. Should NOT invent numbers beyond those given.",
28
+ "assertions": [
29
+ "Contains a Mermaid flowchart LR showing extract -> transform -> load with the sizes on the nodes",
30
+ "Contains a Mermaid pie chart with showData whose slices match the given timings",
31
+ "Identifies the Salesforce API rate limit as the dominant cost with its share of the 5 hours",
32
+ "Contains a vocabulary table defining at least extract, transform, load, and rate limit",
33
+ "Invents no measurement not present in the prompt, or marks any inferred number as calculated",
34
+ "Contains a next-steps section that names which step matters most and why"
35
+ ],
36
+ "files": []
37
+ },
38
+ {
39
+ "id": 2,
40
+ "name": "negative-should-defer-to-explainer-doc",
41
+ "prompt": "Write the implementation spec for the Genesys-to-warehouse ETL that we're handing to the Infosys contractor team next week. They need the DDL, the extract queries, the load procedure, the schedule, and the acceptance criteria.",
42
+ "expected_output": "This is a build-handoff, not an understanding document. The correct behaviour is to route to the explainer-doc skill rather than produce a tech-explainer with a vocabulary table and ranked-layer diagram.",
43
+ "assertions": [
44
+ "Does not produce a tech-explainer-shaped document (no ranked-effect layer diagram, no five-line summary)",
45
+ "Routes to explainer-doc or otherwise produces an actionable build spec"
46
+ ],
47
+ "files": []
48
+ }
49
+ ]
50
+ }
@@ -0,0 +1,237 @@
1
+ # Diagram vocabulary for explainers
2
+
3
+ Four Mermaid patterns cover almost every explainer. Reusing a small set is deliberate: the reader
4
+ learns the visual grammar once, in §3, and reads every later diagram faster because of it. A document
5
+ where each diagram is a different Mermaid type makes the reader re-learn the notation five times.
6
+
7
+ ## Contents
8
+
9
+ - [Rule zero: does this diagram earn its place?](#rule-zero-does-this-diagram-earn-its-place)
10
+ - [Pattern 1 — the pipeline (`flowchart LR`)](#pattern-1--the-pipeline-flowchart-lr)
11
+ - [Pattern 2 — the layer stack (`flowchart TB` + subgraphs)](#pattern-2--the-layer-stack-flowchart-tb--subgraphs)
12
+ - [Pattern 3 — the ranked-effect diagram (the important one)](#pattern-3--the-ranked-effect-diagram-the-important-one)
13
+ - [Pattern 4 — the check loop](#pattern-4--the-check-loop)
14
+ - [Pattern 5 — proportion (`pie showData`)](#pattern-5--proportion-pie-showdata)
15
+ - [Pattern 6 — the next-steps chain](#pattern-6--the-next-steps-chain)
16
+ - [Syntax notes that bite](#syntax-notes-that-bite)
17
+
18
+ ## Rule zero: does this diagram earn its place?
19
+
20
+ Delete the diagram if a table says it better. Diagrams carry **shape and relationship**; tables carry
21
+ **detail and comparison**. A diagram listing five options with three attributes each is a table drawn
22
+ badly.
23
+
24
+ Four to six diagrams across a long document is right. Every one should answer a different question.
25
+
26
+ ## Pattern 1 — the pipeline (`flowchart LR`)
27
+
28
+ For §3, "what we are building". Left to right, one path, database shapes for stores. Put the size of
29
+ the data on the arrows or in the nodes — the reader's first question about a pipeline is "how big".
30
+
31
+ ````markdown
32
+ ```mermaid
33
+ flowchart LR
34
+ DB[("Customer<br/>database")] --> P["Build the prompt<br/>about 16,400 tokens"]
35
+ P --> S["LLM server<br/>on the H100 GPU"]
36
+ S --> J["JSON summary<br/>about 2,400 tokens"]
37
+ J --> O[("Stored<br/>summary")]
38
+ ```
39
+ ````
40
+
41
+ Keep it to five or six nodes. A pipeline diagram with fifteen boxes is an architecture diagram, and
42
+ the reader stops tracing it.
43
+
44
+ ## Pattern 2 — the layer stack (`flowchart TB` + subgraphs)
45
+
46
+ For §5, "what sits on what". One subgraph per layer, numbered and named. Peers go side by side inside
47
+ their layer with `direction LR`. Mark what you do **not** have — the absence is often the reader's
48
+ actual question.
49
+
50
+ ````markdown
51
+ ```mermaid
52
+ flowchart TB
53
+ subgraph programs["LAYER 1 — Programs (the wrapper you install)"]
54
+ direction LR
55
+ A["<b>Ollama</b><br/>installed and used"]
56
+ B["<b>llama-server</b><br/>installed and used"]
57
+ C["<b>LM Studio</b><br/>NOT installed"]
58
+ end
59
+
60
+ subgraph engine["LAYER 2 — Engine (this does the real work)"]
61
+ D["<b>llama.cpp / ggml</b><br/>CUDA calculation code"]
62
+ end
63
+
64
+ subgraph driver["LAYER 3 — Driver"]
65
+ E["NVIDIA driver, TCC mode"]
66
+ end
67
+
68
+ subgraph hardware["LAYER 4 — Hardware"]
69
+ F["H100 NVL GPU<br/>94 GB memory"]
70
+ end
71
+
72
+ A --> D
73
+ B --> D
74
+ C -.->|"would use the<br/>same engine"| D
75
+ D --> E
76
+ E --> F
77
+ ```
78
+ ````
79
+
80
+ Two techniques here do real work:
81
+
82
+ - **The dotted arrow with a label** (`C -.->|"would use the same engine"| D`) shows a hypothetical
83
+ without asserting it exists. This is how you answer "what if we used X?" inside the diagram.
84
+ - **The parenthetical in each subgraph title** ("the wrapper you install", "this does the real work")
85
+ tells the reader what the layer *is for*, which is what they actually lack.
86
+
87
+ Follow the diagram with the one-line consequence: *"Layer 1 is easy to change. Layer 2 decides the
88
+ speed."*
89
+
90
+ ## Pattern 3 — the ranked-effect diagram (the important one)
91
+
92
+ For §8, "what limits the result". This is the diagram the document exists to deliver. It is the layer
93
+ stack again, but **ordered by size of effect and labelled with the magnitude**.
94
+
95
+ ````markdown
96
+ ```mermaid
97
+ flowchart TB
98
+ subgraph L1["LAYER 1 — The model — LARGEST EFFECT — about 3x"]
99
+ M["<b>gpt-oss:120b writes 6,000 to 9,000 tokens.</b><br/>gpt-4o writes 2,373 tokens for the same job.<br/>The local model does about 3 times more work."]
100
+ end
101
+ subgraph L2["LAYER 2 — The engine — MEDIUM EFFECT — tens of percent"]
102
+ E["<b>llama.cpp has no Hopper-specific code.</b><br/>It cannot use the H100 FP8 units.<br/>Faster engines (vLLM, TensorRT-LLM) do not run on Windows."]
103
+ end
104
+ subgraph L3["LAYER 3 — The program — SMALL EFFECT — under 5%"]
105
+ W["<b>Ollama or llama-server or LM Studio.</b><br/>All contain the same engine.<br/>Measured difference is small."]
106
+ end
107
+ subgraph L4["LAYER 4 — The operating system — NO EFFECT"]
108
+ O["<b>Windows against Linux.</b><br/>For work held fully in GPU memory,<br/>measured difference is about zero."]
109
+ end
110
+ L1 --> L2 --> L3 --> L4
111
+ ```
112
+ ````
113
+
114
+ Construction rules:
115
+
116
+ - **Title format:** `LAYER n — <the thing> — <EFFECT SIZE IN CAPS> — <the number>`. The caps and the
117
+ number are what the reader takes away; the layer number just keeps the ordering legible.
118
+ - **Node body:** bold first line = the claim. Following lines = the evidence and the comparison. Three
119
+ lines per node is the ceiling.
120
+ - **The arrows mean rank, not flow.** `L1 --> L2 --> L3 --> L4` reads as descending importance. Say so
121
+ in the sentence above the diagram so nobody reads it as a data path.
122
+ - **Include the reader's preferred fix even when it ranks last.** Omitting it looks like evasion;
123
+ ranking it with a measured number is the argument.
124
+ - **A layer you did not measure says so** — "NOT MEASURED" is an honest rank. An invented one is the
125
+ fastest way to lose the reader who happens to know that layer.
126
+
127
+ Always follow it with the reading instruction:
128
+
129
+ > **Read the diagram this way.** If we change the program (Layer 3), we gain a few percent. If we
130
+ > change the model (Layer 1), we can gain about 3 times. Layer 1 is where the work must go.
131
+
132
+ ### The same move outside the "stack" case
133
+
134
+ Nothing here depends on the causes forming a real stack. When they do not, call them causes and rank
135
+ them by measured share — the diagram does exactly the same job:
136
+
137
+ ````markdown
138
+ ```mermaid
139
+ flowchart TB
140
+ subgraph L1["CAUSE 1 — The Salesforce rate limit — LARGEST EFFECT — 192 of 300 minutes, 64.0%"]
141
+ A["<b>19,000 accounts at 100 requests per minute needs 190 minutes.</b><br/>The extract took 192 minutes.<br/>It already runs at 99% of the permitted rate."]
142
+ end
143
+ subgraph L2["CAUSE 2 — The dbt tests — SECOND EFFECT — 45 of 300 minutes, 15.0%"]
144
+ B["<b>780 tests run after every load.</b><br/>Not yet split by severity."]
145
+ end
146
+ subgraph L3["CAUSE 3 — The load into Snowflake — SMALLEST EFFECT — 22 of 300 minutes, 7.3%"]
147
+ C["<b>This is the step people call 'copying the data'.</b><br/>It is 7.3% of the run."]
148
+ end
149
+ L1 --> L2 --> L3
150
+ ```
151
+ ````
152
+
153
+ Note the third node: the reader's own mental model ("it's just copying data") is named and ranked
154
+ rather than dismissed. That is the move, in one box.
155
+
156
+ ## Pattern 4 — the check loop
157
+
158
+ For §6, "why the work took so long" — the procedure that catches bad results. A decision diamond with
159
+ a failure branch that loops back.
160
+
161
+ ````markdown
162
+ ```mermaid
163
+ flowchart LR
164
+ A["Change one thing"] --> B["Measure it"]
165
+ B --> C{"Does the number agree<br/>with a second,<br/>independent number?"}
166
+ C -->|"No"| D["The instrument is wrong.<br/>Repair the test."]
167
+ D --> B
168
+ C -->|"Yes"| E["Record the result"]
169
+ ```
170
+ ````
171
+
172
+ The loop-back arrow is the content. It shows that the failure path is normal and expected, which is
173
+ what makes the withdrawn-results list read as rigour instead of incompetence.
174
+
175
+ ## Pattern 5 — proportion (`pie showData`)
176
+
177
+ For §7, "where the time goes". Use it when the reader is about to optimise the small slice.
178
+
179
+ ````markdown
180
+ ```mermaid
181
+ pie showData
182
+ title Time in one call
183
+ "Decode — write the answer" : 91.6
184
+ "Prefill — read the prompt" : 8.4
185
+ ```
186
+ ````
187
+
188
+ - `showData` prints the values — always use it; an unlabelled pie is a decoration.
189
+ - Up to five slices. Above five, use a table — the labels stop fitting and the small slices become
190
+ indistinguishable. If the natural breakdown is four or five stages, the pie is still the right
191
+ visual; do not split it artificially.
192
+ - **Say what the numbers are drawn from**, in the sentence above: a sample count where you have one
193
+ (*"We measured 223 samples of each stage"*), otherwise the single run and its date (*"From the run
194
+ of 2026-08-06"*). A one-run pie is honest as long as it says it is one run — a pie with no stated
195
+ basis is the single easiest thing in the document to misquote.
196
+ - Follow with the consequence: *"Earlier work tried to make prompt reading faster. That work can only
197
+ improve 8.4% of the time."*
198
+
199
+ ## Pattern 6 — the next-steps chain
200
+
201
+ For §11. Numbered steps, top to bottom, each with its method and its acceptance in the node.
202
+
203
+ ````markdown
204
+ ```mermaid
205
+ flowchart TB
206
+ A["<b>Step 1 — Test other models</b><br/>Find a model that writes shorter answers.<br/>Measure tokens per call, not tokens per second."] --> B
207
+ B["<b>Step 2 — Quality gate</b><br/>Check that the local model writes<br/>summaries that are good enough.<br/>15 test cases."] --> C
208
+ C["<b>Step 3 — Make it a service</b><br/>Run the server with NSSM.<br/>Confirm the GPU works from a service."]
209
+ ```
210
+ ````
211
+
212
+ Name the step that matters most immediately below, with the reason: *"Step 1 is the most important
213
+ step. The model decides about 3 times the work. No change to the server software can equal that."*
214
+
215
+ ## Syntax notes that bite
216
+
217
+ | Need | Write | Note |
218
+ | ----------------------- | -------------------------------------------- | -------------------------------------------------------------------- |
219
+ | Line break in a node | `<br/>` | Not `\n`. Renderers differ on `<br>` without the slash. |
220
+ | Bold inside a node | `["<b>Claim.</b><br/>Evidence."]` | Markdown `**` does not render inside Mermaid nodes. |
221
+ | Any label with punctuation | Wrap in double quotes: `A["a, b: c"]` | Unquoted `(`, `,`, `:`, `-` break the parser. |
222
+ | Database / store shape | `DB[("Customer<br/>database")]` | |
223
+ | Decision | `C{"Does it agree?"}` | |
224
+ | Hypothetical / optional | `C -.->|"would use"| D` | Dotted = does not exist today. |
225
+ | Peers side by side | `direction LR` inside the `subgraph` | Without it, subgraph children stack vertically. |
226
+ | Subgraph with a title | `subgraph id["The title text"]` | The bare form `subgraph The title` mangles punctuation. |
227
+
228
+ Check every diagram renders before shipping — a broken Mermaid block shows the reader raw source and
229
+ costs more credibility than the diagram was worth. In order of preference:
230
+
231
+ 1. **Paste into `mermaid.live`** — authoritative, and it points at the failing line.
232
+ 2. **VS Code / GitHub / GitLab preview** — all render every pattern above.
233
+ 3. **If you are offline**, read each block against the table above. Nearly every failure is one of
234
+ four things: an unquoted label containing `(`, `,`, `:` or `-`; a `<br>` without the slash;
235
+ markdown `**bold**` inside a node; or a `subgraph` title that is not bracketed and quoted.
236
+
237
+ Do not ship a diagram you have not checked by one of these three.