@zio.dev/zio-blocks 0.0.31 → 0.0.33

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.
@@ -0,0 +1,407 @@
1
+ # Docs Critique Subagent Implementation Plan
2
+
3
+ > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
+
5
+ **Goal:** Add a maker-critic agent workflow that automatically reviews documentation for content quality, technical accuracy, completeness, and consistency.
6
+
7
+ **Architecture:** A pure-coordinator skill (`docs-critique`) spawns a maker agent to run a doc creation skill, then spawns a fresh critic agent to review the output. The orchestrator passes critique back to the maker via `SendMessage`. The maker fixes its own work. Critic is freshly spawned each review round.
8
+
9
+ **Tech Stack:** Claude Code skills, Claude Code agent definitions, Agent tool, SendMessage
10
+
11
+ **Spec:** `docs/superpowers/specs/2026-03-19-docs-critique-subagent-design.md`
12
+
13
+ ---
14
+
15
+ ## File Structure
16
+
17
+ | File | Responsibility |
18
+ |------|---------------|
19
+ | `.claude/agents/docs-critic.md` | Critic agent definition — persona, review dimensions, severity rubric, report format. Read-only tools. |
20
+ | `.claude/skills/docs-critique/SKILL.md` | Orchestrating skill — pure coordinator that spawns maker, spawns critic, passes messages, manages iteration loop. Never edits files. |
21
+
22
+ ---
23
+
24
+ ### Task 1: Create the Critic Agent Definition
25
+
26
+ **Files:**
27
+ - Create: `.claude/agents/docs-critic.md`
28
+
29
+ - [ ] **Step 1: Create the `.claude/agents/` directory**
30
+
31
+ Run: `mkdir -p /home/milad/sources/scala/zio-blocks-new/.claude/agents`
32
+
33
+ - [ ] **Step 2: Write the critic agent definition**
34
+
35
+ Create `.claude/agents/docs-critic.md` with this exact content:
36
+
37
+ ```markdown
38
+ ---
39
+ name: docs-critic
40
+ description: Reviews ZIO Blocks documentation for content quality, technical accuracy, completeness, and consistency. Returns a structured report with severity-rated findings. Read-only — never modifies files.
41
+ tools: Read, Glob, Grep
42
+ model: sonnet
43
+ color: purple
44
+ ---
45
+
46
+ You are a senior technical writer and Scala developer reviewing ZIO Blocks documentation. You are skeptical by default — assume the document has problems and find them.
47
+
48
+ ## Inputs
49
+
50
+ You will receive:
51
+ 1. A documentation file path to review
52
+ 2. A list of relevant Scala source file paths (read them yourself)
53
+ 3. A list of related documentation file paths (read them yourself)
54
+ 4. (Optional) Results from mechanical checks already performed — skip those areas
55
+
56
+ ## Review Dimensions
57
+
58
+ Evaluate the document across four dimensions:
59
+
60
+ ### Content Quality
61
+ - Is there motivation before code? Does the reader understand *why* before *how*?
62
+ - Are examples realistic (not toy `foo`/`bar` examples)?
63
+ - Is the narrative arc logical — does each section build on the previous?
64
+ - Is the writing appropriate for the target audience?
65
+ - Is the prose clear and concise?
66
+
67
+ ### Technical Accuracy
68
+ - Do API signatures in the doc match the actual source code? (Read the source files to verify.)
69
+ - Are code examples correct beyond just compiling? Would they produce the described output?
70
+ - Does the described behavior match the actual implementation?
71
+ - Are type parameters, return types, and method names accurate?
72
+
73
+ **Note:** You cannot compile code. Your accuracy checks are static text comparisons against source files. Flag anything you cannot verify with certainty.
74
+
75
+ ### Completeness
76
+ - Are all required sections present for this doc type?
77
+ - **Reference pages** (`docs/reference/`): Overview, Construction, Predefined Instances, Operators, Comparison, Advanced Usage
78
+ - **How-to guides** (`docs/guides/`): Prerequisites, Steps, Verification, Troubleshooting
79
+ - **Tutorials** (`docs/tutorials/`): Introduction, Prerequisites, Steps, Summary, Next Steps
80
+ - If the doc type cannot be determined from its path, skip required-sections check and note this in your report.
81
+ - Are edge cases and error scenarios mentioned?
82
+ - Are cross-references to related types/pages adequate?
83
+
84
+ ### Consistency
85
+ - Does terminology match related documentation pages? (Read the related docs to verify.)
86
+ - Are there contradictions with other pages?
87
+ - Is the tone consistent with the rest of the documentation?
88
+
89
+ ## Severity Rubric
90
+
91
+ Rate each finding:
92
+
93
+ - **HIGH**: Factually wrong, misleading, or missing critical content. A reader following this doc would be confused or write buggy code.
94
+ - **MEDIUM**: Incomplete, unclear, or inconsistent. A reader could figure it out but shouldn't have to.
95
+ - **LOW**: Stylistic nit or minor improvement. A reader wouldn't notice.
96
+
97
+ ## Report Format
98
+
99
+ You MUST structure your response exactly like this:
100
+
101
+ ## Docs Critic Report: <filename>
102
+
103
+ ### Summary
104
+ <1-2 sentence overall assessment>
105
+
106
+ ### Findings
107
+
108
+ #### [HIGH/dimension] <title>
109
+ **Location:** <section name or line range>
110
+ **Issue:** <what's wrong>
111
+ **Evidence:** <quote from source code or related doc that proves it>
112
+ **Suggested fix:** <concrete suggestion>
113
+
114
+ #### [MEDIUM/dimension] <title>
115
+ **Location:** <section name or line range>
116
+ **Issue:** <what's wrong>
117
+ **Evidence:** <supporting evidence>
118
+ **Suggested fix:** <concrete suggestion>
119
+
120
+ #### [LOW/dimension] <title>
121
+ **Location:** <section name or line range>
122
+ **Issue:** <what's wrong>
123
+ **Suggested fix:** <concrete suggestion>
124
+
125
+ ### Verdict
126
+ <APPROVED | ITERATE — N high, M medium issues remain>
127
+
128
+ ## Rules
129
+
130
+ - Always read the source files before making accuracy claims. Never guess.
131
+ - Always read related docs before making consistency claims.
132
+ - If you find no issues, return APPROVED with an empty Findings section.
133
+ - Never suggest fixes that require information you don't have.
134
+ - Never modify any files. You are read-only.
135
+ ```
136
+
137
+ - [ ] **Step 3: Verify the file was created correctly**
138
+
139
+ Run: `head -5 /home/milad/sources/scala/zio-blocks-new/.claude/agents/docs-critic.md`
140
+ Expected: The YAML frontmatter starting with `---` and `name: docs-critic`
141
+
142
+ - [ ] **Step 4: Commit**
143
+
144
+ ```bash
145
+ git add .claude/agents/docs-critic.md
146
+ git commit -m "feat: add docs-critic agent definition
147
+
148
+ Read-only agent that reviews documentation for content quality,
149
+ technical accuracy, completeness, and consistency. Returns structured
150
+ reports with severity-rated findings."
151
+ ```
152
+
153
+ ---
154
+
155
+ ### Task 2: Create the Orchestrating Skill
156
+
157
+ **Files:**
158
+ - Create: `.claude/skills/docs-critique/SKILL.md`
159
+
160
+ - [ ] **Step 1: Create the skill directory**
161
+
162
+ Run: `mkdir -p /home/milad/sources/scala/zio-blocks-new/.claude/skills/docs-critique`
163
+
164
+ - [ ] **Step 2: Write the orchestrating skill**
165
+
166
+ Create `.claude/skills/docs-critique/SKILL.md` with this exact content:
167
+
168
+ ````markdown
169
+ ---
170
+ name: docs-critique
171
+ description: >
172
+ Run a documentation creation skill with automatic maker-critic review loop.
173
+ Spawns a maker agent to run the skill, then a critic agent to review the output.
174
+ The maker receives critique and fixes its own work. Iterates until approved or
175
+ max 3 rounds. Pure coordinator — never edits files itself.
176
+ argument-hint: "<skill-name> <skill-args>"
177
+ allowed-tools: Agent, Glob, Grep, Read, SendMessage
178
+ ---
179
+
180
+ # Documentation Critique Loop
181
+
182
+ ## Arguments
183
+
184
+ 1. **skill-name** — The documentation skill to run (e.g., `docs-data-type-ref`, `docs-how-to-guide`, `docs-tutorial`, `docs-document-pr`, `docs-enrich-section`, `docs-add-missing-section`)
185
+ 2. **skill-args** — Arguments to pass to the skill (e.g., `Schema`, `TypeId`)
186
+
187
+ Example invocation: `/docs-critique docs-data-type-ref Schema`
188
+
189
+ ## Role
190
+
191
+ You are a **pure coordinator**. You NEVER read, write, or edit documentation files yourself. You ONLY:
192
+ 1. Spawn agents
193
+ 2. Pass messages between agents
194
+ 3. Parse critic reports to decide next action
195
+ 4. Report final status to the user
196
+
197
+ ## Phase 1: Spawn Maker Agent
198
+
199
+ Spawn a general-purpose agent via the `Agent` tool:
200
+
201
+ ```
202
+ Agent(
203
+ description: "Run doc creation skill",
204
+ prompt: "Run /<skill-name> <skill-args>. Complete all steps of the skill.
205
+ When done, report the absolute path of the generated/modified
206
+ documentation file as the LAST line of your response, in the format:
207
+ DOC_PATH: <absolute-path>"
208
+ )
209
+ ```
210
+
211
+ Parse the maker's response to extract the doc file path from the `DOC_PATH:` line.
212
+
213
+ **Error handling:** If the maker does not return a `DOC_PATH:` line, ask the user which file was generated and use that path.
214
+
215
+ Save the maker's agent ID for later `SendMessage` calls. The `Agent` tool returns an `agentId` in its result — store this value. You will use it as the `to` field in `SendMessage` to route critique back to the maker.
216
+
217
+ ## Phase 2: Gather Critic Context
218
+
219
+ Using the doc file path from Phase 1, gather context for the critic. You MAY use `Glob` and `Grep` for this phase only — this is the one exception to the "never read files" rule, because you need file paths (not content) to pass to the critic.
220
+
221
+ 1. **Source files** — Extract the type name from the doc path (e.g., `docs/reference/schema.md` → `Schema`). Find source files:
222
+ ```
223
+ Glob: **/<TypeName>.scala
224
+ Grep: "class <TypeName>" or "trait <TypeName>" or "object <TypeName>"
225
+ ```
226
+ Also find test files:
227
+ ```
228
+ Glob: **/<TypeName>Spec.scala or **/<TypeName>Test.scala
229
+ ```
230
+
231
+ 2. **Related docs** — Find sibling pages using two methods:
232
+ - **sidebars.js** (preferred): Read `sidebars.js` and find the array containing the doc's ID. Extract sibling page IDs from the same array. Map IDs to file paths.
233
+ - **Fallback glob** (if sidebars.js parsing fails): Glob the parent directory:
234
+ ```
235
+ Glob: docs/reference/*.md (for reference pages)
236
+ Glob: docs/guides/*.md (for guides)
237
+ Glob: docs/tutorials/*.md (for tutorials)
238
+ ```
239
+
240
+ 3. Collect all found paths into two lists: `source_files` and `related_docs`.
241
+
242
+ ## Phase 3: Spawn Critic Agent
243
+
244
+ Spawn the `docs-critic` agent:
245
+
246
+ ```
247
+ Agent(
248
+ description: "Review documentation",
249
+ subagent_type: "docs-critic",
250
+ prompt: "Review the following documentation file for content quality,
251
+ technical accuracy, completeness, and consistency.
252
+
253
+ Documentation file: <doc-path>
254
+
255
+ Source files to check accuracy against:
256
+ <list of source_files, one per line>
257
+
258
+ Related documentation to check consistency against:
259
+ <list of related_docs, one per line>
260
+
261
+ Read each file yourself using the Read tool. Return your
262
+ structured report."
263
+ )
264
+ ```
265
+
266
+ **Error handling:** If the critic's response does not contain a `### Findings` section or a `### Verdict` line, treat it as an agent failure. Retry by spawning a fresh critic with the same prompt. If the second attempt also fails, report the raw response to the user and stop.
267
+
268
+ ## Phase 4: Triage
269
+
270
+ Parse the critic's `### Verdict` line:
271
+
272
+ - **`APPROVED`** → Report success to user. Done.
273
+ - **`ITERATE`** with HIGH or MEDIUM findings → Enter Phase 5.
274
+ - Only LOW findings → Send LOWs to maker for a single-pass fix:
275
+ ```
276
+ SendMessage(
277
+ to: <maker-agent-id>,
278
+ message: "The documentation critic found minor issues. Fix them if easy,
279
+ skip if not. One commit per fix.
280
+ Commit format: docs(<file-stem>): fix LOW/<dimension> — <description>
281
+
282
+ <paste LOW findings here>"
283
+ )
284
+ ```
285
+ Done after maker responds.
286
+
287
+ ## Phase 5: Fix Loop
288
+
289
+ **Maximum 3 rounds.** Track the current round number.
290
+
291
+ **Severity-based iteration rules:**
292
+ - **HIGH** findings: iterate until fixed (up to round 3)
293
+ - **MEDIUM** findings: iterate at most once — if a MEDIUM finding persists after round 1, do not iterate further for it
294
+ - After round 1, only HIGH findings drive further iteration
295
+
296
+ ### Each Round:
297
+
298
+ **Step A — Send critique to maker:**
299
+
300
+ For round 1, send all HIGH and MEDIUM findings:
301
+ ```
302
+ SendMessage(
303
+ to: <maker-agent-id>,
304
+ message: "The documentation critic found issues that need fixing.
305
+ Fix ALL HIGH and MEDIUM findings below. For each fix:
306
+ - Make a separate git commit
307
+ - Commit format: docs(<file-stem>): fix <SEVERITY>/<dimension> — <description>
308
+ - If multiple findings target the same paragraph, combine into one commit
309
+ using the highest severity level
310
+
311
+ <paste HIGH and MEDIUM findings here>"
312
+ )
313
+ ```
314
+
315
+ For rounds 2+, send only HIGH findings (MEDIUM issues have had their one iteration).
316
+
317
+ Wait for the maker to respond confirming fixes are done.
318
+
319
+ **Step B — Spawn fresh critic:**
320
+
321
+ Spawn a NEW `docs-critic` agent (do NOT reuse the previous one — fresh eyes each round):
322
+
323
+ ```
324
+ Agent(
325
+ description: "Re-review documentation round N",
326
+ subagent_type: "docs-critic",
327
+ prompt: <same prompt as Phase 3, identical>
328
+ )
329
+ ```
330
+
331
+ **Step C — Check verdict:**
332
+
333
+ - `APPROVED` → Report success to user. Done.
334
+ - `ITERATE` with only MEDIUM findings remaining (no HIGH) → Done. MEDIUM had its one iteration.
335
+ - `ITERATE` with HIGH findings and round < 3 → Go to next round.
336
+ - `ITERATE` and round = 3 → Report remaining issues to user:
337
+ "The documentation was reviewed 3 times. These issues remain unresolved:
338
+ <paste remaining findings>
339
+ Please review manually."
340
+
341
+ ## Output
342
+
343
+ When done, report to the user:
344
+ - Whether the doc was APPROVED or has remaining issues
345
+ - How many rounds were needed
346
+ - Summary of findings fixed (count by severity)
347
+ ````
348
+
349
+ - [ ] **Step 3: Verify the file was created correctly**
350
+
351
+ Run: `head -10 /home/milad/sources/scala/zio-blocks-new/.claude/skills/docs-critique/SKILL.md`
352
+ Expected: The YAML frontmatter with `name: docs-critique`
353
+
354
+ - [ ] **Step 4: Commit**
355
+
356
+ ```bash
357
+ git add .claude/skills/docs-critique/SKILL.md
358
+ git commit -m "feat: add docs-critique orchestrating skill
359
+
360
+ Pure coordinator that spawns a maker agent to run any doc creation
361
+ skill, then spawns a fresh critic agent each round to review. Passes
362
+ critique back to maker via SendMessage. Severity-gated iteration
363
+ with max 3 rounds."
364
+ ```
365
+
366
+ ---
367
+
368
+ ### Task 3: Manual Smoke Test
369
+
370
+ **Files:**
371
+ - None (testing only)
372
+
373
+ - [ ] **Step 1: Verify the critic agent is recognized**
374
+
375
+ Run: `ls -la /home/milad/sources/scala/zio-blocks-new/.claude/agents/docs-critic.md`
376
+ Expected: File exists with correct permissions
377
+
378
+ - [ ] **Step 2: Verify the skill is recognized**
379
+
380
+ Run: `ls -la /home/milad/sources/scala/zio-blocks-new/.claude/skills/docs-critique/SKILL.md`
381
+ Expected: File exists with correct permissions
382
+
383
+ - [ ] **Step 3: Test invocation with an existing doc**
384
+
385
+ In a new Claude Code session, run:
386
+ ```
387
+ /docs-critique docs-data-type-ref TypeId
388
+ ```
389
+
390
+ Verify:
391
+ - The orchestrator spawns a maker agent that runs `/docs-data-type-ref TypeId`
392
+ - After the maker finishes, the orchestrator gathers source file and related doc paths
393
+ - The orchestrator spawns a `docs-critic` agent with the gathered context
394
+ - The critic returns a structured report with `### Findings` and `### Verdict`
395
+ - If ITERATE, the orchestrator sends findings to the maker via SendMessage
396
+ - The maker fixes issues and commits
397
+ - The loop repeats until APPROVED or 3 rounds
398
+
399
+ - [ ] **Step 4: Verify error handling — malformed critic report**
400
+
401
+ If the critic returns a malformed report (no `### Verdict`), verify:
402
+ - The orchestrator retries once
403
+ - If still malformed, it reports the raw response and stops
404
+
405
+ - [ ] **Step 5: Commit any fixes discovered during smoke test**
406
+
407
+ If any issues are found in the agent definition or skill during testing, fix them and commit each fix separately.
@@ -0,0 +1,222 @@
1
+ # Design: Subagent-Based Documentation Review
2
+
3
+ **Date:** 2026-03-19
4
+ **Status:** Draft
5
+ **Scope:** Add a maker-critic workflow to all documentation creation skills
6
+
7
+ ## Problem
8
+
9
+ The existing documentation pipeline has layered mechanical checks (writing style, mdoc conventions, compilation gates) but lacks a content-level reviewer. No system verifies that documentation is clear, technically accurate against source code, complete in coverage, or consistent with related pages. These gaps are caught only by human review — if at all.
10
+
11
+ ## Decisions
12
+
13
+ | Decision | Choice |
14
+ |----------|--------|
15
+ | Critique level | Full spectrum — content quality, technical accuracy, completeness, consistency |
16
+ | Trigger scope | All 6 creation skills automatically |
17
+ | Iteration model | Severity-gated — iterate for HIGH/MEDIUM, single pass for LOW |
18
+ | Architecture | Maker-critic agent pair — maker produces and fixes, critic reviews, orchestrator coordinates |
19
+ | Output format | Structured report + commit-per-fix |
20
+ | Critic context | Doc file + source code + related docs |
21
+ | Who fixes | The maker agent — it receives critique and fixes its own work |
22
+ | Agent lifecycles | Maker stays alive across rounds; critic freshly spawned each round |
23
+
24
+ ## Architecture: Maker Agent + Critic Agent + Orchestrator
25
+
26
+ Three components:
27
+
28
+ 1. **`.claude/agents/docs-critic.md`** — Reusable agent definition with persona, review dimensions, severity rubric, and report format. Read-only tools (`Read`, `Glob`, `Grep`).
29
+ 2. **`.claude/skills/docs-critique/SKILL.md`** — Pure coordinator that spawns the maker, spawns the critic, passes messages between them, and manages the iteration loop. Never edits files itself.
30
+ 3. **Maker agent** — A general-purpose agent spawned by the orchestrator to run the doc creation skill. Stays alive via `SendMessage` to receive critique and fix its own work.
31
+
32
+ ## Agent Definition: `docs-critic`
33
+
34
+ **Persona:** Senior technical writer and Scala developer. Skeptical by default — assumes the doc has problems and looks for them.
35
+
36
+ **Tools:** `Read`, `Glob`, `Grep` only. No write access.
37
+
38
+ **Review Dimensions:**
39
+
40
+ | Dimension | What it checks |
41
+ |-----------|---------------|
42
+ | Content Quality | Clarity, narrative flow, example realism, audience fit, motivation before code |
43
+ | Technical Accuracy | API signatures match source (static text comparison — critic cannot compile), examples correct beyond compilation, described behavior matches implementation |
44
+ | Completeness | Required sections present (detect doc type from path/frontmatter, compare against appropriate section list: `docs-data-type-ref` for reference pages, `docs-how-to-guide` for guides, `docs-tutorial` for tutorials; if doc type cannot be determined, skip required-sections check and note in report), edge cases mentioned, error scenarios covered, cross-references adequate |
45
+ | Consistency | Matches terminology/tone of related docs, no contradictions with other pages |
46
+
47
+ **Severity Rubric:**
48
+
49
+ | Severity | Definition | Iteration? |
50
+ |----------|-----------|------------|
51
+ | HIGH | Factually wrong, misleading, or missing critical content. Reader would be confused or write buggy code. | Yes — must iterate until fixed |
52
+ | MEDIUM | Incomplete, unclear, or inconsistent. Reader could figure it out but shouldn't have to. | Yes — iterate once |
53
+ | LOW | Stylistic nit, minor improvement. Reader wouldn't notice. | No — single pass, fix if easy |
54
+
55
+ **Report Format:**
56
+
57
+ ```
58
+ ## Docs Critic Report: <filename>
59
+
60
+ ### Summary
61
+ <1-2 sentence overall assessment>
62
+
63
+ ### Findings
64
+
65
+ #### [HIGH/accuracy] <title>
66
+ **Location:** <section name or line range>
67
+ **Issue:** <what's wrong>
68
+ **Evidence:** <quote from source code or related doc that proves it>
69
+ **Suggested fix:** <concrete suggestion>
70
+
71
+ #### [MEDIUM/completeness] <title>
72
+ ...
73
+
74
+ ### Verdict
75
+ <APPROVED | ITERATE — N high, M medium issues remain>
76
+ ```
77
+
78
+ ## Orchestrating Skill: `docs-critique`
79
+
80
+ **Invocation:** `/docs-critique <skill-name> <skill-args>`
81
+
82
+ Example: `/docs-critique docs-data-type-ref Schema`
83
+
84
+ The orchestrator is a pure coordinator. It never reads, writes, or edits documentation files. It only spawns agents and passes messages between them.
85
+
86
+ ### Phase 1: Spawn Maker Agent
87
+
88
+ Spawn a general-purpose agent via the `Agent` tool:
89
+
90
+ ```
91
+ "Run /docs-data-type-ref for Schema. Complete all steps of the skill.
92
+ Report the path of the generated documentation file when done."
93
+ ```
94
+
95
+ The maker agent runs the full creation skill (research, write, verify, format, integrate) and returns the doc file path.
96
+
97
+ ### Phase 2: Gather Critic Context
98
+
99
+ Using the doc path returned by the maker, the orchestrator prepares context for the critic:
100
+
101
+ 1. Extract type names from the doc path/filename
102
+ 2. Find corresponding Scala source files and tests (via `Glob`/`Grep`)
103
+ 3. Find related doc pages (scan `sidebars.js` for siblings, scan doc for cross-reference links)
104
+ 4. Collect these as a list of file paths
105
+
106
+ ### Phase 3: Spawn Critic Agent
107
+
108
+ Spawn `docs-critic` agent with a prompt containing:
109
+
110
+ - The doc file path (agent reads it via `Read` tool for live content)
111
+ - List of relevant source file paths (agent reads them itself)
112
+ - List of related doc file paths (agent reads them itself)
113
+
114
+ Passing paths rather than inline content keeps the prompt small and ensures the agent sees live file state.
115
+
116
+ **Error handling:** If the agent returns a response without a `### Findings` section or without a `### Verdict` line, treat it as an agent failure. Retry once. If the second attempt also fails, report the raw response to the user and skip the fix loop.
117
+
118
+ ### Phase 4: Triage
119
+
120
+ Parse the critic's report. Sort findings by severity.
121
+
122
+ - Any HIGH or MEDIUM → enter fix loop (Phase 5)
123
+ - Only LOW → send LOWs to maker for single-pass fix, done
124
+ - No findings → APPROVED, done
125
+
126
+ ### Phase 5: Fix Loop (severity-gated, max 3 rounds)
127
+
128
+ ```
129
+ Round 1:
130
+ Orchestrator → SendMessage to Maker Agent:
131
+ "The critic found these issues. Fix all HIGH and MEDIUM findings.
132
+ One commit per fix (co-located issues may share a commit).
133
+ Commit format: docs(<file-stem>): fix <severity>/<dimension> — <description>"
134
+ Maker fixes and commits
135
+ Orchestrator → Spawn fresh Critic Agent (fresh eyes)
136
+ Critic re-reviews → returns new report
137
+ If new HIGH/MEDIUM → Round 2
138
+
139
+ Round 2:
140
+ Orchestrator → SendMessage to Maker Agent with new findings
141
+ Maker fixes and commits
142
+ Orchestrator → Spawn fresh Critic Agent
143
+ Critic re-reviews
144
+ If still HIGH/MEDIUM → Round 3 (final)
145
+
146
+ Round 3 (cap):
147
+ Orchestrator → SendMessage to Maker Agent with remaining findings
148
+ Maker fixes what it can
149
+ Orchestrator reports any remaining issues to user
150
+ ```
151
+
152
+ **Why fresh critic each round:** The critic gets true fresh eyes on each re-review — no anchoring to its prior findings or assumptions. This catches regressions that a persistent critic might overlook because it "already checked that."
153
+
154
+ **Co-located issues:** When multiple findings target the same paragraph or sentence, the maker combines them into a single commit with the highest severity level. Example: `docs(schema): fix HIGH/accuracy+completeness — correct API and add missing context in Construction`
155
+
156
+ ## Data Flow
157
+
158
+ ```
159
+ User invokes: /docs-critique docs-data-type-ref Schema
160
+ │
161
+ ▼
162
+ Orchestrator (pure coordinator, never edits files)
163
+ │
164
+ ├──► Phase 1: Spawn Maker Agent
165
+ │ Maker runs /docs-data-type-ref Schema
166
+ │ Produces doc, commits, returns doc path
167
+ │
168
+ ├──► Phase 2: Gather critic context
169
+ │ Find source files, related docs
170
+ │
171
+ ├──► Phase 3: Spawn Critic Agent (fresh)
172
+ │ Critic reads doc + sources + related docs
173
+ │ Returns structured report
174
+ │
175
+ ├──► Phase 4: Triage by severity
176
+ │ HIGH/MEDIUM found?
177
+ │ │
178
+ │ ┌───┴────┐
179
+ │ │ yes │ no
180
+ │ ▼ ▼
181
+ │ Phase 5 Single-pass LOWs → Done
182
+ │ │
183
+ │ ├──► SendMessage → Maker: "Fix these issues"
184
+ │ │ Maker fixes, commits (one per fix)
185
+ │ │
186
+ │ ├──► Spawn fresh Critic Agent
187
+ │ │ Critic re-reviews
188
+ │ │ APPROVED? → Done
189
+ │ │ ITERATE? → next round (max 3)
190
+ │ │
191
+ │ └──► Round cap reached → report remaining to user
192
+ │
193
+ └──► Final state: APPROVED or remaining issues reported
194
+ ```
195
+
196
+ ## Integration Into Creation Skills
197
+
198
+ **No modifications to existing skills.** The orchestrator wraps them — the maker agent runs the skill as-is, then stays alive to receive critique. This is less invasive and keeps existing skills clean.
199
+
200
+ The user invokes `/docs-critique <skill-name> <args>` instead of invoking the creation skill directly. The orchestrator handles the rest.
201
+
202
+ ## File Inventory
203
+
204
+ **New files (2):**
205
+
206
+ - `.claude/agents/docs-critic.md` — critic agent definition
207
+ - `.claude/skills/docs-critique/SKILL.md` — orchestrating skill (pure coordinator)
208
+
209
+ **Modified files (0):**
210
+
211
+ No existing skills are modified.
212
+
213
+ ## Token Cost Estimate
214
+
215
+ - Maker agent (creation + alive across rounds): ~30-50K tokens
216
+ - Critic agent per spawn: ~15-25K tokens
217
+ - Orchestrator overhead: ~2-5K tokens
218
+
219
+ Typical scenarios:
220
+ - APPROVED on first review: ~50-80K tokens (maker + 1 critic)
221
+ - 1 round of fixes: ~70-110K tokens (maker + 2 critics)
222
+ - 3 rounds (worst case): ~110-150K tokens (maker + 3 critics)
@@ -74,8 +74,8 @@ These are core public API types that users interact with directly. Each needs a
74
74
 
75
75
  **Format codec modules:**
76
76
  - [ ] **`BsonEncoder` / `BsonDecoder` / `BsonCodec`** (schema-bson) — Core encoding/decoding types for BSON. **Scope: expand formats.md BSON section**. Source: `schema-bson/src/main/scala/zio/blocks/schema/bson/BsonTypes.scala`
77
- - [ ] **`MessagePackBinaryCodec`** (schema-messagepack) — Public codec for MessagePack. **Scope: expand formats.md MessagePack section**. Source: `schema-messagepack/src/main/scala/zio/blocks/schema/msgpack/MessagePackBinaryCodec.scala`
78
- - [ ] **`ThriftBinaryCodec`** (schema-thrift) — Public codec for Thrift. **Scope: expand formats.md Thrift section**. Source: `schema-thrift/src/main/scala/zio/blocks/schema/thrift/ThriftBinaryCodec.scala`
77
+ - [ ] **`MessagePackCodec`** (schema-messagepack) — Public codec for MessagePack. **Scope: expand formats.md MessagePack section**. Source: `schema-messagepack/src/main/scala/zio/blocks/schema/msgpack/MessagePackCodec.scala`
78
+ - [ ] **`ThriftCodec`** (schema-thrift) — Public codec for Thrift. **Scope: expand formats.md Thrift section**. Source: `schema-thrift/src/main/scala/zio/blocks/schema/thrift/ThriftCodec.scala`
79
79
  - [ ] **`ToonReader` / `ToonWriter`** (schema-toon) — Public codec for TOON. Referenced in 9-10 files. **Scope: expand formats.md TOON section**. Source: `schema-toon/src/main/scala/zio/blocks/schema/toon/`
80
80
 
81
81
  **markdown module:**
@@ -244,7 +244,7 @@ Internal types that don't need documentation.
244
244
  | `Registry` / `Registry.Entry` | schema | Internal binding resolver storage |
245
245
  | `ObjectIdSupport` | schema-bson | Internal BSON ObjectId helper |
246
246
  | `BsonBuilder` / `BsonTrace` / `EncoderContext` / `BsonDecoderContext` | schema-bson | Internal codec implementation |
247
- | `MessagePackBinaryCodecDeriver` | schema-messagepack | Internal deriver |
247
+ | `MessagePackCodecDeriver` | schema-messagepack | Internal deriver |
248
248
  | `MessagePackReader` / `MessagePackWriter` | schema-messagepack | Internal binary readers/writers |
249
249
  | `Mixed` / `UniformRecords` | schema-toon | Internal codec strategy types |
250
250
  | `ArrayHeader` | schema-toon | Internal reader state |
@@ -313,8 +313,8 @@ Ordered TODO checklist grouped by module, with estimated scope.
313
313
  ### Format modules (expand `formats.md`)
314
314
 
315
315
  26. - [ ] Expand **BSON section** in `formats.md` with BsonEncoder/BsonDecoder API — *update existing*
316
- 27. - [ ] Expand **MessagePack section** in `formats.md` with MessagePackBinaryCodec API — *update existing*
317
- 28. - [ ] Expand **Thrift section** in `formats.md` with ThriftBinaryCodec API — *update existing*
316
+ 27. - [ ] Expand **MessagePack section** in `formats.md` with MessagePackCodec API — *update existing*
317
+ 28. - [ ] Expand **Thrift section** in `formats.md` with ThriftCodec API — *update existing*
318
318
  29. - [ ] Expand **TOON section** in `formats.md` with ToonReader/ToonWriter, Delimiter, config — *update existing*
319
319
 
320
320
  ### Depth improvements (existing pages)