pan-wizard 2.8.1 → 2.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.
- package/README.md +4 -2
- package/bin/install.js +23 -0
- package/commands/pan/focus-design.md +235 -12
- package/commands/pan/focus-doc-audit.md +530 -0
- package/commands/pan/focus-drift-walking.md +525 -0
- package/commands/pan/focus-plan.md +204 -12
- package/commands/pan/profile.md +2 -1
- package/package.json +1 -1
- package/pan-wizard-core/bin/lib/commands.cjs +29 -7
- package/pan-wizard-core/bin/lib/config.cjs +10 -0
- package/pan-wizard-core/bin/lib/core.cjs +168 -21
- package/pan-wizard-core/bin/lib/verify.cjs +283 -4
- package/pan-wizard-core/bin/pan-tools.cjs +11 -2
- package/pan-wizard-core/references/model-profiles.md +191 -62
- package/pan-wizard-core/workflows/help.md +11 -1
- package/pan-wizard-core/workflows/profile.md +8 -1
- package/pan-wizard-core/workflows/settings.md +14 -0
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: focus-doc-audit
|
|
3
|
+
group: Focus
|
|
4
|
+
description: Multi-dimensional document audit — accuracy, freshness, links, cross-consistency, and structural quality
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Edit
|
|
9
|
+
- Bash
|
|
10
|
+
- Grep
|
|
11
|
+
- Glob
|
|
12
|
+
- Agent
|
|
13
|
+
- WebFetch
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# /pan:focus-doc-audit — Deep Document Audit & Quality Assessment
|
|
17
|
+
|
|
18
|
+
Audit project documentation for accuracy, freshness, broken links, structural quality, cross-document consistency, and code alignment. $ARGUMENTS
|
|
19
|
+
|
|
20
|
+
**Goal:** Produce a confidence-scored audit of every documentation file in the project. Every claim in every document is verified against the actual codebase. Broken links are found. Stale counts are flagged. Contradictions between documents are exposed. The output is a per-file quality score with actionable fix lists, optionally auto-repaired.
|
|
21
|
+
|
|
22
|
+
**Methodology:** Combines claim extraction, fact verification, link validation, cross-reference consistency checking, structural linting, freshness dating, and readability scoring into a comprehensive audit pipeline. Inspired by financial audit methodology — every material claim requires supporting evidence.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## CRITICAL: Project Scope Boundary
|
|
27
|
+
|
|
28
|
+
This command audits the **host project's documentation** — NOT PAN Wizard's own infrastructure files.
|
|
29
|
+
|
|
30
|
+
**NEVER audit, modify, or report issues in these PAN directories:**
|
|
31
|
+
- `.claude/`, `.github/copilot-instructions.md`, `.opencode/`, `.gemini/`, `.codex/` — PAN runtime directories
|
|
32
|
+
- `.planning/` — PAN planning state (read for context, never audit as project docs)
|
|
33
|
+
- Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
|
|
34
|
+
|
|
35
|
+
**These directories are PAN's own tooling.** Documentation audit applies to the project's README, guides, API docs, architecture docs, and code comments — not to PAN's installed agents or command definitions.
|
|
36
|
+
|
|
37
|
+
If you find yourself auditing a PAN command file — STOP. Refocus on the project's actual documentation.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## MANDATORY: Execute ALL Phases Automatically
|
|
42
|
+
|
|
43
|
+
When `/pan:focus-doc-audit` is invoked, execute ALL phases for the selected mode without stopping. Do NOT ask questions between phases. Do NOT skip phases beyond what the mode specifies. Produce a complete audit report at the end.
|
|
44
|
+
|
|
45
|
+
**Usage:**
|
|
46
|
+
```
|
|
47
|
+
/pan:focus-doc-audit # Audit core docs (README, main docs)
|
|
48
|
+
/pan:focus-doc-audit <file> # Audit a specific file
|
|
49
|
+
/pan:focus-doc-audit <directory> # Audit all markdown files in directory
|
|
50
|
+
/pan:focus-doc-audit --deep # Deep audit: verify every claim against code
|
|
51
|
+
/pan:focus-doc-audit --links # Link validation pass only
|
|
52
|
+
/pan:focus-doc-audit --fix # Auto-fix simple issues (counts, versions, dates, links)
|
|
53
|
+
/pan:focus-doc-audit --all # Audit ALL documentation files project-wide
|
|
54
|
+
/pan:focus-doc-audit --score-only # Skip fix suggestions, just output scores
|
|
55
|
+
/pan:focus-doc-audit --min-score <N> # Only report files scoring below N% (default: 100 = report all)
|
|
56
|
+
/pan:focus-doc-audit --format <type> # Output: markdown (default), json, checklist
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Audit Dimensions
|
|
62
|
+
|
|
63
|
+
Every document is scored across 8 independent dimensions. The final score is a weighted average.
|
|
64
|
+
|
|
65
|
+
| Dimension | Weight | What It Measures |
|
|
66
|
+
|-----------|--------|-----------------|
|
|
67
|
+
| **Accuracy** | 25% | Do factual claims match the codebase? |
|
|
68
|
+
| **Freshness** | 15% | Are versions, dates, and counts current? |
|
|
69
|
+
| **Completeness** | 15% | Does it cover all features/files it should? |
|
|
70
|
+
| **Link Integrity** | 15% | Do all internal and external links resolve? |
|
|
71
|
+
| **Cross-Consistency** | 10% | Does it agree with other project docs? |
|
|
72
|
+
| **Structural Quality** | 10% | Proper markdown, tables, code blocks, headings? |
|
|
73
|
+
| **Actionability** | 5% | Are instructions executable? Can a user follow them? |
|
|
74
|
+
| **Readability** | 5% | Clear language, logical flow, appropriate length? |
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Phase 0: Target Discovery & Truth Extraction
|
|
79
|
+
|
|
80
|
+
### 0.1 Identify Audit Targets
|
|
81
|
+
If no file/directory argument provided, auto-discover core documentation:
|
|
82
|
+
|
|
83
|
+
**Priority 1 — Always audit:**
|
|
84
|
+
- `README.md` — Primary project documentation
|
|
85
|
+
- `CLAUDE.md` — AI assistant instructions (if exists)
|
|
86
|
+
- `CONTRIBUTING.md` — Contributor guide (if exists)
|
|
87
|
+
- `CHANGELOG.md` — Version history (if exists)
|
|
88
|
+
|
|
89
|
+
**Priority 2 — Audit if present:**
|
|
90
|
+
- `docs/` or `Docs/` — Documentation directory
|
|
91
|
+
- `INSTALL.md` or `SETUP.md` — Installation guide
|
|
92
|
+
- `ARCHITECTURE.md` or `docs/ARCHITECTURE.md` — Architecture docs
|
|
93
|
+
- `API.md` or `docs/API.md` — API reference
|
|
94
|
+
- `SECURITY.md` — Security documentation
|
|
95
|
+
- `FAQ.md` — Frequently asked questions
|
|
96
|
+
|
|
97
|
+
**Priority 3 — Audit with `--all`:**
|
|
98
|
+
- All `*.md` files in the project (excluding PAN directories and `node_modules/`)
|
|
99
|
+
- All `*.rst`, `*.adoc` files (if project uses those formats)
|
|
100
|
+
- Per-directory `README.md` files
|
|
101
|
+
|
|
102
|
+
### 0.2 Extract Ground Truth
|
|
103
|
+
Before auditing any document, establish facts from code:
|
|
104
|
+
|
|
105
|
+
**Version Truth:**
|
|
106
|
+
| Source | How to Extract |
|
|
107
|
+
|--------|---------------|
|
|
108
|
+
| `package.json` | `version` field |
|
|
109
|
+
| `Cargo.toml` | `version` under `[package]` |
|
|
110
|
+
| `CMakeLists.txt` | `project(... VERSION X.Y.Z)` |
|
|
111
|
+
| `*.csproj` | `<Version>` or `<PackageVersion>` |
|
|
112
|
+
| `pyproject.toml` | `version` under `[project]` or `[tool.poetry]` |
|
|
113
|
+
| `pubspec.yaml` | `version` field |
|
|
114
|
+
| `build.gradle` | `version` property |
|
|
115
|
+
| `go.mod` | Module path version suffix |
|
|
116
|
+
|
|
117
|
+
**Count Truth:**
|
|
118
|
+
| Metric | How to Count |
|
|
119
|
+
|--------|-------------|
|
|
120
|
+
| Source files | `find` / `Get-ChildItem` by extension, excluding generated/vendored |
|
|
121
|
+
| Test files | Count test files by project convention (`*.test.*`, `*_test.*`, `test_*.*`, `*Spec.*`) |
|
|
122
|
+
| Test count | Parse test runner output or count `test(` / `it(` / `[Fact]` / `#[test]` / `def test_` |
|
|
123
|
+
| Commands/endpoints | Count route definitions, CLI command registrations |
|
|
124
|
+
| Components/modules | Count directories with source files in `src/` or equivalent |
|
|
125
|
+
| Dependencies | Count entries in lockfile or dependency sections |
|
|
126
|
+
|
|
127
|
+
**Build Command Truth:**
|
|
128
|
+
- Extract from `Makefile`, `package.json` scripts, `Taskfile`, CI config, or README build section
|
|
129
|
+
- Validate syntax (do commands reference existing scripts/tools?)
|
|
130
|
+
|
|
131
|
+
### 0.3 Build Truth Cache
|
|
132
|
+
Store extracted truth for cross-reference during audit:
|
|
133
|
+
|
|
134
|
+
```markdown
|
|
135
|
+
| Fact | Value | Source |
|
|
136
|
+
|------|-------|--------|
|
|
137
|
+
| Project name | {name} | {config file} |
|
|
138
|
+
| Version | {version} | {config file} |
|
|
139
|
+
| Source file count | {N} | Directory scan |
|
|
140
|
+
| Test file count | {N} | Directory scan |
|
|
141
|
+
| Test case count | {N} | Source scan / test runner |
|
|
142
|
+
| Module count | {N} | Directory scan |
|
|
143
|
+
| Dependency count | {N} | Lockfile |
|
|
144
|
+
| Build command | {cmd} | {source} |
|
|
145
|
+
| Test command | {cmd} | {source} |
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Phase 1: Claim Extraction
|
|
151
|
+
|
|
152
|
+
For each target document, extract every verifiable claim.
|
|
153
|
+
|
|
154
|
+
### 1.1 Claim Categories
|
|
155
|
+
|
|
156
|
+
| Category | Pattern | Example |
|
|
157
|
+
|----------|---------|---------|
|
|
158
|
+
| **Version claim** | `v1.2.3`, `version 1.2`, `Version: X` | "Currently at v3.1.0" |
|
|
159
|
+
| **Count claim** | Number + noun | "42 test suites", "15 API endpoints" |
|
|
160
|
+
| **File path claim** | Path-like strings | "`src/core/handler.ts`" |
|
|
161
|
+
| **Command claim** | Code block with shell prefix or instruction | "`npm run build`" |
|
|
162
|
+
| **Feature claim** | "supports X", "includes Y", "provides Z" | "Supports hot reloading" |
|
|
163
|
+
| **Architecture claim** | Component relationships, data flow | "The API layer calls the service layer" |
|
|
164
|
+
| **Status claim** | "complete", "in progress", "planned", emoji status | "✅ Authentication complete" |
|
|
165
|
+
| **Date claim** | Dates or relative time references | "Last updated March 2026" |
|
|
166
|
+
| **Link claim** | Markdown links, URLs | `[API docs](./docs/api.md)` |
|
|
167
|
+
| **Dependency claim** | Named dependencies or requirements | "Requires Node.js 18+" |
|
|
168
|
+
|
|
169
|
+
### 1.2 Extraction Protocol
|
|
170
|
+
For each document:
|
|
171
|
+
|
|
172
|
+
1. Read the entire document
|
|
173
|
+
2. Parse every paragraph, table cell, list item, and code block
|
|
174
|
+
3. Tag each verifiable claim with: `{category, text, line_number, verification_method}`
|
|
175
|
+
4. Count total claims — this becomes the denominator for accuracy scoring
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Phase 2: Fact Verification
|
|
180
|
+
|
|
181
|
+
Verify each extracted claim against ground truth.
|
|
182
|
+
|
|
183
|
+
### 2.1 Version Verification
|
|
184
|
+
```
|
|
185
|
+
For each version claim:
|
|
186
|
+
1. Find the canonical version source (Phase 0.2)
|
|
187
|
+
2. Compare: exact match required
|
|
188
|
+
3. Score: PASS (match) / FAIL (mismatch) / SKIP (no canonical source)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### 2.2 Count Verification
|
|
192
|
+
```
|
|
193
|
+
For each count claim:
|
|
194
|
+
1. Identify what's being counted
|
|
195
|
+
2. Run the actual count (Phase 0.2 methods)
|
|
196
|
+
3. Compare:
|
|
197
|
+
- Exact match → PASS
|
|
198
|
+
- Within 10% → WARNING (acceptable drift)
|
|
199
|
+
- Off by > 10% → FAIL
|
|
200
|
+
- Cannot verify → SKIP (note why)
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### 2.3 File Path Verification
|
|
204
|
+
```
|
|
205
|
+
For each file path claim:
|
|
206
|
+
1. Resolve path relative to document location
|
|
207
|
+
2. Check: file/directory exists?
|
|
208
|
+
- Exists → PASS
|
|
209
|
+
- Exists at different location → FAIL + suggest correct path
|
|
210
|
+
- Doesn't exist → FAIL (dead reference)
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### 2.4 Command Verification
|
|
214
|
+
```
|
|
215
|
+
For each command claim:
|
|
216
|
+
1. Parse the command
|
|
217
|
+
2. Check: referenced tool/script exists? (e.g., does `npm` script exist in package.json?)
|
|
218
|
+
3. Check: referenced files/paths in command exist?
|
|
219
|
+
4. If --deep: attempt dry-run validation (syntax check, --help, etc.)
|
|
220
|
+
5. Score: PASS / WARNING (tool exists but can't validate) / FAIL (tool/path missing)
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### 2.5 Feature Verification
|
|
224
|
+
```
|
|
225
|
+
For each feature claim:
|
|
226
|
+
1. Search codebase for implementation evidence
|
|
227
|
+
2. Grep for feature keywords, class names, function names
|
|
228
|
+
3. Score:
|
|
229
|
+
- Implementation found → PASS
|
|
230
|
+
- Partial implementation → WARNING
|
|
231
|
+
- No evidence found → FAIL (aspirational documentation)
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### 2.6 Architecture Verification
|
|
235
|
+
```
|
|
236
|
+
For each architecture claim:
|
|
237
|
+
1. Verify stated components exist as directories/modules
|
|
238
|
+
2. Verify stated relationships via import/dependency analysis
|
|
239
|
+
3. Score:
|
|
240
|
+
- All components exist and relationships hold → PASS
|
|
241
|
+
- Components exist but relationships differ → WARNING
|
|
242
|
+
- Components missing → FAIL
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### 2.7 Status Verification
|
|
246
|
+
```
|
|
247
|
+
For each status claim:
|
|
248
|
+
1. Check "complete" claims → verify implementation exists
|
|
249
|
+
2. Check "in progress" claims → verify partial implementation
|
|
250
|
+
3. Check "planned" claims → verify NOT implemented (avoid stale "planned" for shipped features)
|
|
251
|
+
4. Score: PASS / FAIL (wrong status)
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### 2.8 Link Verification
|
|
255
|
+
```
|
|
256
|
+
For each link:
|
|
257
|
+
Internal markdown links:
|
|
258
|
+
1. Resolve relative to document
|
|
259
|
+
2. Check file exists
|
|
260
|
+
3. If anchor (#heading), verify heading exists in target
|
|
261
|
+
4. Score: PASS / FAIL (broken)
|
|
262
|
+
|
|
263
|
+
External URLs (with --deep):
|
|
264
|
+
1. HTTP HEAD request
|
|
265
|
+
2. Score: PASS (2xx) / WARNING (3xx redirect) / FAIL (4xx/5xx)
|
|
266
|
+
|
|
267
|
+
Without --deep:
|
|
268
|
+
External URLs scored as SKIP
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### 2.9 Date Verification
|
|
272
|
+
```
|
|
273
|
+
For each date claim:
|
|
274
|
+
1. Calculate age from current date
|
|
275
|
+
2. Score:
|
|
276
|
+
- < 30 days → PASS (fresh)
|
|
277
|
+
- 30-90 days → WARNING (aging)
|
|
278
|
+
- > 90 days → FAIL (stale, unless historically accurate)
|
|
279
|
+
3. Exception: changelog dates, historical references → always PASS
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### 2.10 Dependency Verification
|
|
283
|
+
```
|
|
284
|
+
For each dependency claim:
|
|
285
|
+
1. Check if named dependency exists in lockfile/config
|
|
286
|
+
2. Check if stated version constraint matches actual
|
|
287
|
+
3. Score: PASS / FAIL (missing or wrong version)
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Phase 3: Cross-Document Consistency
|
|
293
|
+
|
|
294
|
+
### 3.1 Build Cross-Reference Matrix
|
|
295
|
+
For all audited documents, extract overlapping claims and check for contradictions:
|
|
296
|
+
|
|
297
|
+
```markdown
|
|
298
|
+
| Claim | Doc A says | Doc B says | Match? |
|
|
299
|
+
|-------|-----------|-----------|--------|
|
|
300
|
+
| Version | 2.3.1 (README L5) | 2.3.0 (INSTALL L12) | ❌ CONFLICT |
|
|
301
|
+
| Build cmd | npm run build (README L42) | npm run build (CONTRIBUTING L8) | ✅ |
|
|
302
|
+
| Test count | 150 (README L30) | 142 (CLAUDE.md L18) | ⚠️ INCONSISTENT |
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### 3.2 Consistency Rules
|
|
306
|
+
|
|
307
|
+
| Rule | Description |
|
|
308
|
+
|------|-------------|
|
|
309
|
+
| **Version unanimity** | ALL docs must state the same version |
|
|
310
|
+
| **Command unanimity** | Build/test/run commands must be identical across docs |
|
|
311
|
+
| **Count consistency** | Same metric should have same value everywhere |
|
|
312
|
+
| **Feature consistency** | A feature listed as "supported" in one doc can't be "planned" in another |
|
|
313
|
+
| **Architecture consistency** | Component names and relationships must agree |
|
|
314
|
+
|
|
315
|
+
### 3.3 Source of Truth Resolution
|
|
316
|
+
When documents disagree, determine which is correct:
|
|
317
|
+
|
|
318
|
+
```
|
|
319
|
+
Config files > README > CLAUDE.md > docs/ > CHANGELOG > inline comments
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
The document closer to code is more likely correct.
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## Phase 4: Structural & Readability Analysis
|
|
327
|
+
|
|
328
|
+
### 4.1 Structural Quality Checks
|
|
329
|
+
|
|
330
|
+
| Check | Verification | Severity |
|
|
331
|
+
|-------|-------------|----------|
|
|
332
|
+
| **Heading hierarchy** | H1 → H2 → H3 (no skipped levels) | LOW |
|
|
333
|
+
| **Table formatting** | All tables render correctly in standard markdown | MEDIUM |
|
|
334
|
+
| **Code block language tags** | Every code block has a language identifier | LOW |
|
|
335
|
+
| **Orphan TOC entries** | Table of contents links resolve to headings | HIGH |
|
|
336
|
+
| **Duplicate headings** | No two headings at same level with identical text | LOW |
|
|
337
|
+
| **Empty sections** | No heading followed immediately by another heading | MEDIUM |
|
|
338
|
+
| **Consistent list style** | All lists use same marker (`-` vs `*` vs `1.`) | LOW |
|
|
339
|
+
| **Line length** | No lines > 200 chars (breaks some renderers) | LOW |
|
|
340
|
+
| **Trailing whitespace** | Trailing spaces except intentional line breaks | INFO |
|
|
341
|
+
| **Missing blank lines** | Blank line before/after headings, code blocks, tables | LOW |
|
|
342
|
+
|
|
343
|
+
### 4.2 Readability Assessment
|
|
344
|
+
|
|
345
|
+
| Metric | Assessment Method |
|
|
346
|
+
|--------|-----------------|
|
|
347
|
+
| **Logical flow** | Do sections follow a natural reading order? (intro → concepts → usage → reference → troubleshooting) |
|
|
348
|
+
| **First-contact clarity** | Can someone unfamiliar with the project understand the first 3 paragraphs? |
|
|
349
|
+
| **Instruction completeness** | Do "how to" sections have ALL steps? No assumed knowledge gaps? |
|
|
350
|
+
| **Example quality** | Are code examples complete, copy-pasteable, and correct? |
|
|
351
|
+
| **Jargon density** | Are project-specific terms explained on first use? |
|
|
352
|
+
|
|
353
|
+
Score each as: GOOD / ACCEPTABLE / POOR
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## Phase 5: Auto-Fix (requires --fix)
|
|
358
|
+
|
|
359
|
+
### 5.1 Auto-Fixable Issues
|
|
360
|
+
|
|
361
|
+
| Issue Type | Fix Strategy | Risk |
|
|
362
|
+
|-----------|-------------|------|
|
|
363
|
+
| Wrong version number | Replace with canonical version from config | LOW — version is factual |
|
|
364
|
+
| Wrong count (> 10% drift) | Replace with actual count | LOW — count is factual |
|
|
365
|
+
| Stale date | Update to current date | LOW — date is factual |
|
|
366
|
+
| Broken internal link (file moved) | Update to new path if unambiguous | LOW — path is factual |
|
|
367
|
+
| Broken internal link (file deleted) | Remove link, keep text | MEDIUM — loses reference |
|
|
368
|
+
| Missing language tag on code block | Infer from content, add tag | LOW — cosmetic |
|
|
369
|
+
| Wrong command (script name changed) | Update to current script name | MEDIUM — verify first |
|
|
370
|
+
|
|
371
|
+
### 5.2 Manual-Review Issues (flagged but NOT auto-fixed)
|
|
372
|
+
|
|
373
|
+
| Issue Type | Why Not Auto-Fix |
|
|
374
|
+
|-----------|-----------------|
|
|
375
|
+
| Feature accuracy | Requires understanding intent |
|
|
376
|
+
| Architecture descriptions | Complex, may need restructuring |
|
|
377
|
+
| Purpose statements | Subjective |
|
|
378
|
+
| Status claims | May need product owner input |
|
|
379
|
+
| External broken links | May be temporary outage |
|
|
380
|
+
| Cross-document conflicts | Need to determine which doc is authoritative |
|
|
381
|
+
| Command semantics | Syntax correct but intent may differ |
|
|
382
|
+
|
|
383
|
+
### 5.3 Fix Safety Protocol
|
|
384
|
+
1. Record every change: file, line, before, after
|
|
385
|
+
2. Only modify documentation files (`.md`, `.rst`, `.adoc`) — NEVER source code
|
|
386
|
+
3. Make minimal changes — don't rewrite paragraphs
|
|
387
|
+
4. If a fix is ambiguous, flag for manual review instead
|
|
388
|
+
5. Report all fixes in the audit output
|
|
389
|
+
|
|
390
|
+
---
|
|
391
|
+
|
|
392
|
+
## Phase 6: Scoring & Report Generation
|
|
393
|
+
|
|
394
|
+
### 6.1 Per-File Scoring
|
|
395
|
+
|
|
396
|
+
For each audited file, compute dimension scores:
|
|
397
|
+
|
|
398
|
+
```
|
|
399
|
+
Accuracy = (verified_claims_passed / total_verifiable_claims) × 100
|
|
400
|
+
Freshness = (fresh_items / total_dated_items) × 100
|
|
401
|
+
Completeness = (documented_features / total_features_in_scope) × 100
|
|
402
|
+
Link Integrity = (valid_links / total_links) × 100
|
|
403
|
+
Cross-Consistency = (consistent_claims / total_overlapping_claims) × 100
|
|
404
|
+
Structural Quality = (passed_structural_checks / total_structural_checks) × 100
|
|
405
|
+
Actionability = (executable_instructions / total_instructions) × 100
|
|
406
|
+
Readability = average(flow_score, clarity_score, example_score) as percentage
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
**Overall File Score:**
|
|
410
|
+
```
|
|
411
|
+
Score = (Accuracy × 0.25) + (Freshness × 0.15) + (Completeness × 0.15) +
|
|
412
|
+
(Link Integrity × 0.15) + (Cross-Consistency × 0.10) +
|
|
413
|
+
(Structural Quality × 0.10) + (Actionability × 0.05) + (Readability × 0.05)
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### 6.2 Score Interpretation
|
|
417
|
+
|
|
418
|
+
| Score | Grade | Meaning |
|
|
419
|
+
|-------|-------|---------|
|
|
420
|
+
| 95-100% | A+ | Excellent — documentation is trustworthy |
|
|
421
|
+
| 85-94% | A | Good — minor issues only |
|
|
422
|
+
| 75-84% | B | Acceptable — some claims need updating |
|
|
423
|
+
| 60-74% | C | Below standard — multiple stale/wrong claims |
|
|
424
|
+
| 40-59% | D | Poor — documentation is unreliable |
|
|
425
|
+
| 0-39% | F | Failing — documentation is actively harmful |
|
|
426
|
+
|
|
427
|
+
### 6.3 Audit Report Structure
|
|
428
|
+
|
|
429
|
+
```markdown
|
|
430
|
+
## Document Audit Report
|
|
431
|
+
|
|
432
|
+
**Project:** {name} v{version}
|
|
433
|
+
**Date:** {date}
|
|
434
|
+
**Files audited:** {N}
|
|
435
|
+
**Total claims verified:** {N}
|
|
436
|
+
**Overall project documentation score:** {N}%
|
|
437
|
+
|
|
438
|
+
---
|
|
439
|
+
|
|
440
|
+
### File Scores
|
|
441
|
+
|
|
442
|
+
| File | Score | Grade | Accuracy | Freshness | Links | Top Issue |
|
|
443
|
+
|------|-------|-------|----------|-----------|-------|-----------|
|
|
444
|
+
| README.md | 87% | A | 92% | 80% | 100% | Version stale by 1 minor |
|
|
445
|
+
| CONTRIBUTING.md | 71% | C | 65% | 90% | 85% | 7 dead file references |
|
|
446
|
+
| docs/API.md | 43% | D | 30% | 20% | 60% | Major feature undocumented |
|
|
447
|
+
|
|
448
|
+
---
|
|
449
|
+
|
|
450
|
+
### Critical Findings (must fix)
|
|
451
|
+
|
|
452
|
+
| ID | File | Line | Category | Finding | Correct Value |
|
|
453
|
+
|----|------|------|----------|---------|---------------|
|
|
454
|
+
| A-01 | README.md | 5 | Version | States v2.1.0 | Actual: v2.3.1 |
|
|
455
|
+
| A-02 | README.md | 42 | Command | `npm run deploy` | Script removed in v2.2 |
|
|
456
|
+
| A-03 | docs/API.md | 15 | Feature | "OAuth support" documented | Not implemented |
|
|
457
|
+
|
|
458
|
+
---
|
|
459
|
+
|
|
460
|
+
### Warnings (should fix)
|
|
461
|
+
|
|
462
|
+
| ID | File | Line | Category | Finding |
|
|
463
|
+
|----|------|------|----------|---------|
|
|
464
|
+
| W-01 | README.md | 30 | Count | Test count 150, actual 163 (8.7% drift) |
|
|
465
|
+
| W-02 | CLAUDE.md | 18 | Date | "Last updated Jan 2026" — 79 days old |
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
### Cross-Document Conflicts
|
|
470
|
+
|
|
471
|
+
| Claim | Documents | Values | Resolution |
|
|
472
|
+
|-------|-----------|--------|------------|
|
|
473
|
+
| Version | README vs INSTALL | v2.3.1 vs v2.3.0 | Update INSTALL to v2.3.1 |
|
|
474
|
+
| Build cmd | README vs CONTRIBUTING | `npm build` vs `npm run build` | Verify which works |
|
|
475
|
+
|
|
476
|
+
---
|
|
477
|
+
|
|
478
|
+
### Fixes Applied (if --fix)
|
|
479
|
+
|
|
480
|
+
| File | Line | Change | Before | After |
|
|
481
|
+
|------|------|--------|--------|-------|
|
|
482
|
+
| README.md | 5 | Version update | v2.1.0 | v2.3.1 |
|
|
483
|
+
| README.md | 30 | Test count | 150 tests | 163 tests |
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
### 6.4 Project-Wide Summary
|
|
487
|
+
|
|
488
|
+
```markdown
|
|
489
|
+
### Documentation Health Summary
|
|
490
|
+
|
|
491
|
+
| Dimension | Project Average | Worst File | Best File |
|
|
492
|
+
|-----------|----------------|-----------|-----------|
|
|
493
|
+
| Accuracy | 78% | docs/API.md (30%) | CHANGELOG.md (100%) |
|
|
494
|
+
| Freshness | 85% | INSTALL.md (60%) | README.md (95%) |
|
|
495
|
+
| Completeness | 72% | docs/API.md (40%) | README.md (90%) |
|
|
496
|
+
| Link Integrity | 91% | CONTRIBUTING.md (85%) | README.md (100%) |
|
|
497
|
+
| Cross-Consistency | 88% | — | — |
|
|
498
|
+
| Structural Quality | 95% | docs/API.md (80%) | README.md (100%) |
|
|
499
|
+
| Actionability | 82% | INSTALL.md (70%) | CONTRIBUTING.md (95%) |
|
|
500
|
+
| Readability | 88% | — | — |
|
|
501
|
+
|
|
502
|
+
**Recommended priority:** Fix docs/API.md (Grade F) → Fix CONTRIBUTING.md (Grade C) → Update INSTALL.md freshness
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
---
|
|
506
|
+
|
|
507
|
+
## NEVER DO
|
|
508
|
+
|
|
509
|
+
- Audit PAN infrastructure files (`.claude/`, `.planning/`, `pan-wizard-core/`)
|
|
510
|
+
- Modify source code files — only documentation files
|
|
511
|
+
- Auto-fix ambiguous issues (purpose statements, architecture descriptions)
|
|
512
|
+
- Report claims as FAIL without checking against actual code first
|
|
513
|
+
- Count external link failures during outages as permanent failures
|
|
514
|
+
- Invent ground truth — always extract from actual config/code files
|
|
515
|
+
- Skip the claim extraction step — every finding must trace to a specific claim
|
|
516
|
+
- Give a file 100% score without verifying at least the version, counts, and links
|
|
517
|
+
- Report findings without file path and line number
|
|
518
|
+
|
|
519
|
+
## ALWAYS DO
|
|
520
|
+
|
|
521
|
+
- Extract ground truth from config/code BEFORE auditing documents
|
|
522
|
+
- Verify every factual claim against the codebase
|
|
523
|
+
- Include line numbers for every finding
|
|
524
|
+
- Score every file across all 8 dimensions
|
|
525
|
+
- Sort critical findings first
|
|
526
|
+
- Check cross-document consistency when auditing multiple files
|
|
527
|
+
- Provide the correct value alongside every FAIL finding
|
|
528
|
+
- Distinguish between "wrong" (FAIL) and "stale" (WARNING) and "missing" (INFO)
|
|
529
|
+
- Report total claims verified — this gives confidence in audit thoroughness
|
|
530
|
+
- Produce a project-wide health summary when auditing multiple files
|