trinity-method-sdk 2.0.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.
Files changed (191) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/LICENSE +21 -0
  3. package/README.md +555 -0
  4. package/dist/cli/commands/deploy/agents.d.ts +14 -0
  5. package/dist/cli/commands/deploy/agents.js +59 -0
  6. package/dist/cli/commands/deploy/ci-cd.d.ts +13 -0
  7. package/dist/cli/commands/deploy/ci-cd.js +50 -0
  8. package/dist/cli/commands/deploy/claude-setup.d.ts +17 -0
  9. package/dist/cli/commands/deploy/claude-setup.js +91 -0
  10. package/dist/cli/commands/deploy/configuration.d.ts +13 -0
  11. package/dist/cli/commands/deploy/configuration.js +215 -0
  12. package/dist/cli/commands/deploy/directories.d.ts +12 -0
  13. package/dist/cli/commands/deploy/directories.js +38 -0
  14. package/dist/cli/commands/deploy/gitignore.d.ts +12 -0
  15. package/dist/cli/commands/deploy/gitignore.js +53 -0
  16. package/dist/cli/commands/deploy/index.d.ts +38 -0
  17. package/dist/cli/commands/deploy/index.js +156 -0
  18. package/dist/cli/commands/deploy/knowledge-base.d.ts +16 -0
  19. package/dist/cli/commands/deploy/knowledge-base.js +75 -0
  20. package/dist/cli/commands/deploy/linting.d.ts +18 -0
  21. package/dist/cli/commands/deploy/linting.js +51 -0
  22. package/dist/cli/commands/deploy/metrics.d.ts +13 -0
  23. package/dist/cli/commands/deploy/metrics.js +34 -0
  24. package/dist/cli/commands/deploy/pre-flight.d.ts +13 -0
  25. package/dist/cli/commands/deploy/pre-flight.js +29 -0
  26. package/dist/cli/commands/deploy/root-files.d.ts +16 -0
  27. package/dist/cli/commands/deploy/root-files.js +178 -0
  28. package/dist/cli/commands/deploy/sdk-install.d.ts +12 -0
  29. package/dist/cli/commands/deploy/sdk-install.js +57 -0
  30. package/dist/cli/commands/deploy/summary.d.ts +14 -0
  31. package/dist/cli/commands/deploy/summary.js +130 -0
  32. package/dist/cli/commands/deploy/templates.d.ts +14 -0
  33. package/dist/cli/commands/deploy/templates.js +84 -0
  34. package/dist/cli/commands/deploy/types.d.ts +39 -0
  35. package/dist/cli/commands/deploy/types.js +5 -0
  36. package/dist/cli/commands/update/agents.d.ts +14 -0
  37. package/dist/cli/commands/update/agents.js +31 -0
  38. package/dist/cli/commands/update/backup.d.ts +31 -0
  39. package/dist/cli/commands/update/backup.js +97 -0
  40. package/dist/cli/commands/update/commands.d.ts +14 -0
  41. package/dist/cli/commands/update/commands.js +75 -0
  42. package/dist/cli/commands/update/index.d.ts +15 -0
  43. package/dist/cli/commands/update/index.js +118 -0
  44. package/dist/cli/commands/update/knowledge-base.d.ts +14 -0
  45. package/dist/cli/commands/update/knowledge-base.js +38 -0
  46. package/dist/cli/commands/update/pre-flight.d.ts +13 -0
  47. package/dist/cli/commands/update/pre-flight.js +37 -0
  48. package/dist/cli/commands/update/summary.d.ts +20 -0
  49. package/dist/cli/commands/update/summary.js +47 -0
  50. package/dist/cli/commands/update/templates.d.ts +14 -0
  51. package/dist/cli/commands/update/templates.js +25 -0
  52. package/dist/cli/commands/update/types.d.ts +13 -0
  53. package/dist/cli/commands/update/types.js +7 -0
  54. package/dist/cli/commands/update/utils.d.ts +11 -0
  55. package/dist/cli/commands/update/utils.js +19 -0
  56. package/dist/cli/commands/update/verification.d.ts +20 -0
  57. package/dist/cli/commands/update/verification.js +54 -0
  58. package/dist/cli/commands/update/version.d.ts +18 -0
  59. package/dist/cli/commands/update/version.js +36 -0
  60. package/dist/cli/commands/update.d.ts +7 -0
  61. package/dist/cli/commands/update.js +7 -0
  62. package/dist/cli/index.d.ts +3 -0
  63. package/dist/cli/index.js +36 -0
  64. package/dist/cli/types.d.ts +77 -0
  65. package/dist/cli/types.js +5 -0
  66. package/dist/cli/utils/deploy-ci.d.ts +22 -0
  67. package/dist/cli/utils/deploy-ci.js +138 -0
  68. package/dist/cli/utils/deploy-linting.d.ts +3 -0
  69. package/dist/cli/utils/deploy-linting.js +136 -0
  70. package/dist/cli/utils/detect-stack.d.ts +3 -0
  71. package/dist/cli/utils/detect-stack.js +270 -0
  72. package/dist/cli/utils/error-classes.d.ts +63 -0
  73. package/dist/cli/utils/error-classes.js +84 -0
  74. package/dist/cli/utils/error-handler.d.ts +59 -0
  75. package/dist/cli/utils/error-handler.js +127 -0
  76. package/dist/cli/utils/errors.d.ts +52 -0
  77. package/dist/cli/utils/errors.js +102 -0
  78. package/dist/cli/utils/get-sdk-path.d.ts +18 -0
  79. package/dist/cli/utils/get-sdk-path.js +31 -0
  80. package/dist/cli/utils/inject-dependencies.d.ts +2 -0
  81. package/dist/cli/utils/inject-dependencies.js +55 -0
  82. package/dist/cli/utils/linting-tools.d.ts +8 -0
  83. package/dist/cli/utils/linting-tools.js +206 -0
  84. package/dist/cli/utils/metrics/code-quality.d.ts +32 -0
  85. package/dist/cli/utils/metrics/code-quality.js +122 -0
  86. package/dist/cli/utils/metrics/dependency-parser.d.ts +21 -0
  87. package/dist/cli/utils/metrics/dependency-parser.js +153 -0
  88. package/dist/cli/utils/metrics/file-complexity.d.ts +26 -0
  89. package/dist/cli/utils/metrics/file-complexity.js +77 -0
  90. package/dist/cli/utils/metrics/framework-detector.d.ts +17 -0
  91. package/dist/cli/utils/metrics/framework-detector.js +120 -0
  92. package/dist/cli/utils/metrics/git-metrics.d.ts +30 -0
  93. package/dist/cli/utils/metrics/git-metrics.js +83 -0
  94. package/dist/cli/utils/metrics/index.d.ts +28 -0
  95. package/dist/cli/utils/metrics/index.js +100 -0
  96. package/dist/cli/utils/template-processor.d.ts +10 -0
  97. package/dist/cli/utils/template-processor.js +188 -0
  98. package/dist/cli/utils/validate-path.d.ts +80 -0
  99. package/dist/cli/utils/validate-path.js +180 -0
  100. package/dist/index.d.ts +6 -0
  101. package/dist/index.js +8 -0
  102. package/dist/templates/agents/aj-team/apo-documentation-specialist.md.template +572 -0
  103. package/dist/templates/agents/aj-team/bas-quality-gate.md.template +906 -0
  104. package/dist/templates/agents/aj-team/bon-dependency-manager.md.template +636 -0
  105. package/dist/templates/agents/aj-team/cap-configuration-specialist.md.template +670 -0
  106. package/dist/templates/agents/aj-team/dra-code-reviewer.md.template +768 -0
  107. package/dist/templates/agents/aj-team/kil-task-executor.md.template +764 -0
  108. package/dist/templates/agents/aj-team/uro-refactoring-specialist.md.template +759 -0
  109. package/dist/templates/agents/audit/juno-auditor.md.template +447 -0
  110. package/dist/templates/agents/deployment/ein-cicd.md.template +694 -0
  111. package/dist/templates/agents/deployment/ino-context.md.template +733 -0
  112. package/dist/templates/agents/deployment/tan-structure.md.template +661 -0
  113. package/dist/templates/agents/deployment/zen-knowledge.md.template +451 -0
  114. package/dist/templates/agents/leadership/aj-cc.md.template +462 -0
  115. package/dist/templates/agents/leadership/aj-maestro.md.template +943 -0
  116. package/dist/templates/agents/leadership/aly-cto.md.template +407 -0
  117. package/dist/templates/agents/planning/eus-decomposer.md.template +496 -0
  118. package/dist/templates/agents/planning/mon-requirements.md.template +323 -0
  119. package/dist/templates/agents/planning/ror-design.md.template +465 -0
  120. package/dist/templates/agents/planning/tra-planner.md.template +432 -0
  121. package/dist/templates/ci/cd.yml.template +175 -0
  122. package/dist/templates/ci/ci.yml.template +196 -0
  123. package/dist/templates/ci/generic-ci.yml +115 -0
  124. package/dist/templates/ci/github-actions.yml +86 -0
  125. package/dist/templates/ci/gitlab-ci.yml +103 -0
  126. package/dist/templates/claude/EMPLOYEE-DIRECTORY.md.template +545 -0
  127. package/dist/templates/documentation/ROOT-README.md.template +307 -0
  128. package/dist/templates/documentation/SUBDIRECTORY-README.md.template +261 -0
  129. package/dist/templates/investigations/bug.md.template +484 -0
  130. package/dist/templates/investigations/feature.md.template +564 -0
  131. package/dist/templates/investigations/performance.md.template +625 -0
  132. package/dist/templates/investigations/security.md.template +714 -0
  133. package/dist/templates/investigations/technical.md.template +433 -0
  134. package/dist/templates/knowledge-base/AI-DEVELOPMENT-GUIDE.md.template +957 -0
  135. package/dist/templates/knowledge-base/ARCHITECTURE.md.template +452 -0
  136. package/dist/templates/knowledge-base/CODING-PRINCIPLES.md.template +750 -0
  137. package/dist/templates/knowledge-base/DOCUMENTATION-CRITERIA.md.template +1118 -0
  138. package/dist/templates/knowledge-base/ISSUES.md.template +539 -0
  139. package/dist/templates/knowledge-base/TESTING-PRINCIPLES.md.template +894 -0
  140. package/dist/templates/knowledge-base/Technical-Debt.md.template +640 -0
  141. package/dist/templates/knowledge-base/To-do.md.template +407 -0
  142. package/dist/templates/knowledge-base/Trinity.md.template +464 -0
  143. package/dist/templates/linting/flutter/.pre-commit-config.yaml.template +27 -0
  144. package/dist/templates/linting/flutter/analysis_options.yaml.template +26 -0
  145. package/dist/templates/linting/nodejs/.eslintrc-commonjs.json.template +19 -0
  146. package/dist/templates/linting/nodejs/.eslintrc-esm.json.template +19 -0
  147. package/dist/templates/linting/nodejs/.eslintrc-typescript.json.template +22 -0
  148. package/dist/templates/linting/nodejs/.pre-commit-config.yaml.template +51 -0
  149. package/dist/templates/linting/nodejs/.prettierrc.json.template +10 -0
  150. package/dist/templates/linting/python/.flake8.template +16 -0
  151. package/dist/templates/linting/python/.pre-commit-config.yaml.template +30 -0
  152. package/dist/templates/linting/python/pyproject.toml.template +38 -0
  153. package/dist/templates/linting/rust/.pre-commit-config.yaml.template +28 -0
  154. package/dist/templates/linting/rust/clippy.toml.template +14 -0
  155. package/dist/templates/linting/rust/rustfmt.toml.template +12 -0
  156. package/dist/templates/root/CLAUDE.md.template +65 -0
  157. package/dist/templates/root/TRINITY.md.template +52 -0
  158. package/dist/templates/shared/claude-commands/trinity-agents.md.template +168 -0
  159. package/dist/templates/shared/claude-commands/trinity-audit.md.template +646 -0
  160. package/dist/templates/shared/claude-commands/trinity-changelog.md.template +624 -0
  161. package/dist/templates/shared/claude-commands/trinity-continue.md.template +549 -0
  162. package/dist/templates/shared/claude-commands/trinity-create-investigation.md.template +232 -0
  163. package/dist/templates/shared/claude-commands/trinity-decompose.md.template +181 -0
  164. package/dist/templates/shared/claude-commands/trinity-design.md.template +347 -0
  165. package/dist/templates/shared/claude-commands/trinity-docs.md.template +2093 -0
  166. package/dist/templates/shared/claude-commands/trinity-end.md.template +397 -0
  167. package/dist/templates/shared/claude-commands/trinity-init.md.template +606 -0
  168. package/dist/templates/shared/claude-commands/trinity-investigate-templates.md.template +725 -0
  169. package/dist/templates/shared/claude-commands/trinity-orchestrate.md.template +1061 -0
  170. package/dist/templates/shared/claude-commands/trinity-plan-investigation.md.template +135 -0
  171. package/dist/templates/shared/claude-commands/trinity-plan.md.template +201 -0
  172. package/dist/templates/shared/claude-commands/trinity-readme.md.template +1971 -0
  173. package/dist/templates/shared/claude-commands/trinity-requirements.md.template +148 -0
  174. package/dist/templates/shared/claude-commands/trinity-start.md.template +268 -0
  175. package/dist/templates/shared/claude-commands/trinity-verify.md.template +453 -0
  176. package/dist/templates/shared/claude-commands/trinity-workorder.md.template +249 -0
  177. package/dist/templates/source/base-CLAUDE.md.template +310 -0
  178. package/dist/templates/source/flutter-CLAUDE.md.template +593 -0
  179. package/dist/templates/source/nodejs-CLAUDE.md.template +531 -0
  180. package/dist/templates/source/python-CLAUDE.md.template +510 -0
  181. package/dist/templates/source/react-CLAUDE.md.template +513 -0
  182. package/dist/templates/source/rust-CLAUDE.md.template +653 -0
  183. package/dist/templates/source/tests-CLAUDE.md.template +432 -0
  184. package/dist/templates/trinity/CLAUDE.md.template +372 -0
  185. package/dist/templates/work-orders/ANALYSIS-TEMPLATE.md.template +276 -0
  186. package/dist/templates/work-orders/AUDIT-TEMPLATE.md.template +262 -0
  187. package/dist/templates/work-orders/IMPLEMENTATION-TEMPLATE.md.template +260 -0
  188. package/dist/templates/work-orders/INVESTIGATION-TEMPLATE.md.template +206 -0
  189. package/dist/templates/work-orders/PATTERN-TEMPLATE.md.template +320 -0
  190. package/dist/templates/work-orders/VERIFICATION-TEMPLATE.md.template +273 -0
  191. package/package.json +94 -0
@@ -0,0 +1,1971 @@
1
+ # Trinity README Management
2
+
3
+ **Purpose:** Launch APO (Documentation Specialist) to ensure 100% CLAUDE.md → README.md coverage with accurate, up-to-date content.
4
+
5
+ **Use Case:** Create missing READMEs, update existing READMEs with current codebase reality, fix inaccuracies.
6
+
7
+ **Deliverable:** README audit report in `trinity/reports/README-AUDIT-{date}.md`
8
+
9
+ ---
10
+
11
+ ## Overview
12
+
13
+ The `/trinity-readme` command invokes APO (Documentation Specialist) to manage README.md files across the codebase. This command focuses exclusively on ensuring every directory with a CLAUDE.md file has a corresponding README.md file that is accurate and up-to-date.
14
+
15
+ **APO's Responsibilities:**
16
+ - Discover all CLAUDE.md files in the codebase
17
+ - Audit existing READMEs for factual inaccuracies
18
+ - Update root README.md with current project state
19
+ - Create missing subdirectory READMEs
20
+ - Fix all identified inaccuracies
21
+
22
+ **What This Command Does NOT Handle:**
23
+ - ❌ docs/ directory organization (use `/trinity-docs`)
24
+ - ❌ CHANGELOG.md updates (use `/trinity-changelog`)
25
+ - ❌ API documentation generation
26
+ - ❌ Code comments or inline documentation
27
+
28
+ ---
29
+
30
+ ## CRITICAL: APO Must Perform Work DIRECTLY
31
+
32
+ **APO is NOT a planning agent. APO is an EXECUTION agent for documentation.**
33
+
34
+ **✅ APO MUST:**
35
+ - Read, analyze, and UPDATE existing README files **in this command execution**
36
+ - CREATE missing README files **in this command execution**
37
+ - Fix ALL factual inaccuracies identified in Phase 2 **immediately in Phase 3-5**
38
+ - Apply updates directly to files (use Edit/Write tools)
39
+ - Report COMPLETED work in Phase 7 (past tense: "Updated README.md")
40
+
41
+ **❌ APO MUST NOT:**
42
+ - Create work orders for README updates
43
+ - Create "recommendations" instead of performing updates
44
+ - Skip updates because "it's too much work"
45
+ - Defer work to future execution
46
+ - Ask for user approval before fixing factual errors
47
+
48
+ **If APO identifies an inaccuracy in Phase 2, APO MUST fix it in Phases 3-5. No exceptions.**
49
+
50
+ ---
51
+
52
+ ## When to Use `/trinity-readme`
53
+
54
+ ### Perfect Use Cases:
55
+ ✅ **After Codebase Changes** - Ensure READMEs reflect current state
56
+ ✅ **Missing READMEs** - Create READMEs for directories with CLAUDE.md
57
+ ✅ **Inaccurate READMEs** - Fix outdated counts, features, versions
58
+ ✅ **New Directories** - Add READMEs for newly added code sections
59
+ ✅ **Pre-Release** - Verify all READMEs are current before release
60
+
61
+ ### When NOT to Use:
62
+ ❌ **CHANGELOG Updates** - Use `/trinity-changelog` instead
63
+ ❌ **docs/ Organization** - Use `/trinity-docs` instead
64
+ ❌ **API Documentation** - Use specialized API doc generators
65
+ ❌ **During Active Development** - Wait for stable state
66
+
67
+ ---
68
+
69
+ ## Usage
70
+
71
+ ### Basic Usage (Scans Entire Codebase)
72
+ ```bash
73
+ /trinity-readme
74
+ ```
75
+
76
+ APO performs complete README management:
77
+ 1. Discovers all CLAUDE.md files
78
+ 2. Audits existing READMEs for inaccuracies
79
+ 3. Updates root README.md
80
+ 4. Creates missing subdirectory READMEs
81
+ 5. Fixes all identified inaccuracies
82
+ 6. Generates audit report
83
+
84
+ ---
85
+
86
+ ## APO Execution Principles
87
+
88
+ ### Unlimited Token Budget
89
+
90
+ **CRITICAL: APO has NO token budget limits for this command.**
91
+
92
+ **✅ APO MUST:**
93
+ 1. Complete ALL 7 phases regardless of token usage
94
+ 2. Create/update ALL required READMEs (no "budget exceeded" stops)
95
+ 3. Fix ALL inaccuracies identified in Phase 2 (100% completion required)
96
+ 4. NEVER claim "token budget constraints" as reason for incomplete work
97
+
98
+ **❌ APO MUST NOT:**
99
+ 1. Stop execution due to token concerns
100
+ 2. Skip READMEs due to "budget constraints"
101
+ 3. Defer work to future sessions due to token usage
102
+ 4. Report "partial completion" due to budget limits
103
+
104
+ **If APO approaches context limit, Claude Code will handle pagination automatically. APO should continue working.**
105
+
106
+ ---
107
+
108
+ ## Phase Execution Rules
109
+
110
+ **ALL 7 phases are MANDATORY. APO MUST execute phases in sequence.**
111
+
112
+ **FORBIDDEN:**
113
+ - ❌ Skipping phases
114
+ - ❌ "Deferring" phases to future sessions
115
+ - ❌ Claiming phases are "optional"
116
+ - ❌ Stopping early claiming "critical work complete"
117
+
118
+ **If APO cannot complete a phase:**
119
+ 1. APO MUST report specific blocker (e.g., "File X not found")
120
+ 2. APO MUST attempt workaround or alternative approach
121
+ 3. APO MUST document in Phase 7 report which phase(s) could not complete and why
122
+ 4. APO MUST NOT skip to Phase 7 without attempting ALL phases
123
+
124
+ **Example INVALID justifications:**
125
+ - "Deferred to future sessions" ❌
126
+ - "Already comprehensive" ❌
127
+ - "Critical work complete" ❌
128
+ - "Token budget concerns" ❌
129
+
130
+ **Example VALID blockers:**
131
+ - "README.md file not found, cannot verify version" ✅
132
+ - "CLAUDE.md syntax error prevents parsing" ✅
133
+
134
+ ---
135
+
136
+ ## Phase Dependency Enforcement
137
+
138
+ **CRITICAL: Each phase has DEPENDENCIES that MUST be satisfied before execution.**
139
+
140
+ ### Phase Execution Flow
141
+
142
+ ```
143
+ Phase 1: README Discovery
144
+ ↓ (MUST complete before Phase 2)
145
+ Phase 2: README Audit
146
+ ↓ (MUST complete before Phase 2.5)
147
+ Phase 2.5: Fix Commitment
148
+ ↓ (MUST complete before Phase 3)
149
+ Phase 3: Root README Update
150
+ ↓ (MUST complete before Phase 3-checkpoint)
151
+ Phase 3-checkpoint (MUST PASS before Phase 4)
152
+
153
+ Phase 4: Subdirectory README Creation
154
+ ↓ (MUST complete before Phase 4-checkpoint)
155
+ Phase 4-checkpoint (MUST PASS before Phase 5)
156
+
157
+ Phase 5: Existing README Updates
158
+ ↓ (MUST complete before Phase 6)
159
+ Phase 6: Final Validation
160
+ ↓ (MUST complete before Phase 7)
161
+ Phase 7: Audit Report
162
+ ```
163
+
164
+ ### Phase Dependency Rules
165
+
166
+ **Phase 1 → Phase 2 Dependency:**
167
+ - ✅ Phase 1 MUST discover ALL CLAUDE.md files before Phase 2 begins
168
+ - ❌ CANNOT start Phase 2 until Phase 1 discovery is complete
169
+ - **Why:** Phase 2 needs to know which READMEs exist
170
+
171
+ **Phase 2 → Phase 2.5 Dependency:**
172
+ - ✅ Phase 2 MUST audit ALL existing READMEs before Phase 2.5
173
+ - ❌ CANNOT create Phase 2.5 commitment list until Phase 2 audit is complete
174
+ - **Why:** Phase 2.5 lists ALL inaccuracies found in Phase 2
175
+
176
+ **Phase 2.5 → Phase 3 Dependency:**
177
+ - ✅ Phase 2.5 MUST create complete inaccuracy commitment list before Phase 3
178
+ - ❌ CANNOT start Phase 3 until Phase 2.5 commitment exists
179
+ - **Why:** Phase 3 MUST apply ALL Phase 2.5 corrections
180
+
181
+ **Phase 3 → Phase 3-checkpoint Dependency:**
182
+ - ✅ Phase 3 MUST execute completely before Phase 3-checkpoint
183
+ - ❌ CANNOT run Phase 3-checkpoint until root README.md is updated
184
+ - **Why:** Checkpoint verifies Phase 3 execution and Phase 2.5 fixes applied
185
+
186
+ **Phase 3-checkpoint → Phase 4 Dependency:**
187
+ - ✅ Phase 3-checkpoint MUST return PASSED before Phase 4 starts
188
+ - ❌ CANNOT create subdirectory READMEs until root README is verified
189
+ - **Why:** Ensures root documentation is correct before subdirectory work
190
+
191
+ **Phase 4 → Phase 4-checkpoint Dependency:**
192
+ - ✅ Phase 4 MUST create ALL missing subdirectory READMEs before Phase 4-checkpoint
193
+ - ❌ CANNOT run Phase 4-checkpoint until Phase 4 work is complete
194
+ - **Why:** Phase 4-checkpoint verifies 100% README coverage from Phase 4
195
+
196
+ **Phase 4-checkpoint → Phase 5 Dependency:**
197
+ - ✅ Phase 4-checkpoint MUST return PASSED before Phase 5 starts
198
+ - ❌ CANNOT update existing READMEs until new READMEs are verified created
199
+ - **Why:** Ensures all required READMEs exist before applying Phase 2.5 fixes
200
+
201
+ **Phase 6 → Phase 7 Dependency:**
202
+ - ✅ Phase 6 final validation MUST complete before Phase 7 report
203
+ - ❌ CANNOT generate report until validation confirms 100% coverage
204
+ - **Why:** Report must reflect verified reality, not assumptions
205
+
206
+ ---
207
+
208
+ ## APO's 7-Phase README Management Process
209
+
210
+ ### Phase 1: README Discovery (SYSTEMATIC)
211
+ **Goal:** Identify ALL CLAUDE.md files and check for corresponding READMEs
212
+
213
+ **CRITICAL: APO MUST Execute Systematically - NO ASSUMPTIONS - VERIFY COMPLETENESS**
214
+
215
+ **Step 1: Execute Glob Search**
216
+
217
+ ```bash
218
+ Use Glob tool with pattern: "**/CLAUDE.md"
219
+ ```
220
+
221
+ **Step 2: Paste Raw Glob Output (MANDATORY - VALIDATION CHECKPOINT)**
222
+
223
+ **CRITICAL: APO MUST paste the complete, unfiltered Glob tool output below.**
224
+
225
+ **DO NOT summarize, filter, or process the output. Paste it exactly as returned by the Glob tool.**
226
+
227
+ ```
228
+ === GLOB TOOL OUTPUT START ===
229
+ {paste complete Glob output here - every single line}
230
+ === GLOB TOOL OUTPUT END ===
231
+ ```
232
+
233
+ **Step 3: Count Validation (ENFORCED)**
234
+
235
+ Count the lines in the Glob tool output pasted in Step 2:
236
+
237
+ ```javascript
238
+ glob_output_lines = {manually count lines in pasted Glob output above}
239
+ apo_reported_count = {APO's count of CLAUDE.md files to report}
240
+
241
+ // VALIDATION CHECK (MANDATORY)
242
+ if (apo_reported_count !== glob_output_lines) {
243
+ ❌ CRITICAL ERROR: Count mismatch - Phase 1 validation FAILED
244
+
245
+ - Glob tool returned: {glob_output_lines} lines
246
+ - APO planned to report: {apo_reported_count} files
247
+ - Discrepancy: {Math.abs(glob_output_lines - apo_reported_count)} files
248
+
249
+ **STOP EXECUTION IMMEDIATELY**
250
+ **APO MUST use glob_output_lines as the correct count**
251
+ **Re-count using the pasted Glob output as source of truth**
252
+
253
+ } else {
254
+ ✅ Count validation PASSED: {apo_reported_count} == {glob_output_lines}
255
+ }
256
+ ```
257
+
258
+ **CRITICAL: If counts don't match, APO CANNOT proceed. Must use Glob output line count.**
259
+
260
+ **Step 4: Build Inventory from Validated Glob Output**
261
+
262
+ For EACH line in the pasted Glob output (process all {glob_output_lines} lines):
263
+
264
+ ```javascript
265
+ for (let i = 0; i < glob_output_lines; i++) {
266
+ path = glob_output[i] // Each line from pasted output
267
+ directory = dirname(path)
268
+ readme_path = directory + "/README.md"
269
+
270
+ if exists(readme_path):
271
+ existing_readmes.push(directory)
272
+ else:
273
+ missing_readmes.push(directory)
274
+ }
275
+ ```
276
+
277
+ **Step 5: Report Complete Inventory (Using Validated Count)**
278
+
279
+ APO MUST output:
280
+
281
+ ```markdown
282
+ === PHASE 1 DISCOVERY RESULTS ===
283
+
284
+ **Total CLAUDE.md files:** {glob_output_lines} (validated against Glob tool output)
285
+
286
+ **Glob Tool Output Validation:**
287
+ ✅ Raw Glob output pasted in Step 2
288
+ ✅ Reported count ({glob_output_lines}) matches Glob output lines
289
+ ✅ All {glob_output_lines} paths processed
290
+
291
+ **CLAUDE.md file paths (ALL {glob_output_lines} PATHS):**
292
+ 1. {absolute path 1 from Glob output line 1}
293
+ 2. {absolute path 2 from Glob output line 2}
294
+ ...
295
+ {glob_output_lines}. {absolute path N from Glob output line N}
296
+
297
+ **Directories with READMEs:** {existing_readmes.length}
298
+ {list all paths}
299
+
300
+ **Directories MISSING READMEs:** {missing_readmes.length}
301
+ {list all paths - this becomes Phase 4 work list}
302
+
303
+ **Coverage:** {(existing_readmes.length / glob_output_lines) * 100}%
304
+ ```
305
+
306
+ **Step 6: Self-Verification Checklist (MANDATORY OUTPUT)**
307
+
308
+ APO MUST answer ALL checklist items:
309
+
310
+ ```markdown
311
+ === PHASE 1 SELF-VERIFICATION ===
312
+
313
+ 1. **Glob Output Pasted:**
314
+ - Did I paste the raw Glob output in Step 2? ✅ YES | ❌ NO
315
+ - Evidence: See "GLOB TOOL OUTPUT START/END" markers above
316
+
317
+ 2. **Nested Directory Check:**
318
+ - Did Glob find ANY paths matching `*/src/`? ✅ YES (found: {list}) | ❌ NO
319
+
320
+ 3. **Nested Directory Check:**
321
+ - Did Glob find ANY paths matching `*/app/`? ✅ YES (found: {list}) | ❌ NO
322
+
323
+ 4. **Nested Directory Check:**
324
+ - Did Glob find ANY paths matching `*/lib/`? ✅ YES (found: {list}) | ❌ NO
325
+
326
+ 5. **Count Validation:**
327
+ - Does my reported count ({glob_output_lines}) match Glob output lines? ✅ YES | ❌ NO
328
+ - If NO: STOP and use Glob output count
329
+
330
+ 6. **Project Structure Sanity:**
331
+ - For project with backend/, frontend/, database/, trinity/, do I expect nested CLAUDE.md files? ✅ YES | ❌ NO
332
+ - If YES but none found: Re-run Glob with explicit paths
333
+
334
+ **Self-Verification Action:**
335
+
336
+ IF any critical item = ❌ NO:
337
+ Re-run Glob with explicit patterns:
338
+ - backend/**/CLAUDE.md
339
+ - frontend/**/CLAUDE.md
340
+ - database/**/CLAUDE.md
341
+ - trinity/**/CLAUDE.md
342
+ Merge results and re-validate
343
+
344
+ **Checklist Completion:** ✅ 6/6 items verified
345
+ ```
346
+
347
+ ---
348
+
349
+ ### Phase 2: README Audit (Root + Subdirectories)
350
+ **Goal:** Identify factual inaccuracies in existing READMEs
351
+
352
+ **CRITICAL: Phase 2 MUST audit BOTH root README.md AND subdirectory READMEs**
353
+
354
+ **Audit Scope:**
355
+ 1. **Root README.md** (Phase 2a-2f) - MANDATORY
356
+ 2. **Existing Subdirectory READMEs** (Phase 2g) - MANDATORY
357
+
358
+ #### 2a. Root README.md Quantitative Claims Audit (MANDATORY)
359
+
360
+ **CRITICAL: This section audits ROOT README.md specifically, not subdirectory READMEs.**
361
+
362
+ **Step 1: Load Root README.md**
363
+
364
+ ```bash
365
+ Read README.md
366
+
367
+ # If file doesn't exist: Skip Phase 2a-2f (proceed to Phase 2g)
368
+ # If file exists: Continue to Step 2
369
+ ```
370
+
371
+ **Step 2: Extract Quantitative Claims from Root README.md**
372
+
373
+ If root README.md makes numeric claims, verify them:
374
+
375
+ 1. **Count Claims:**
376
+ - "50+ features" → Count actual features
377
+ - "12 API endpoints" → Count actual endpoints
378
+ - "100+ tests" → Count test files/cases
379
+ - "8 integrations" → Count integration implementations
380
+
381
+ 2. **How to Verify:**
382
+ - Use Grep to search for feature implementations
383
+ - Count files matching patterns (test files, spec files, etc.)
384
+ - Read API route files to count endpoints
385
+ - Check configuration files for integrations
386
+
387
+ 3. **Record Inaccuracies for Phase 2.5:**
388
+ - Replace vague claims ("many features") with exact counts
389
+ - Remove inflated numbers (claimed 100, found 42)
390
+ - Update outdated counts (README says 5, code has 12)
391
+
392
+ #### 2b. Root README.md Feature/Functionality Claims Audit
393
+
394
+ **CRITICAL: This section audits ROOT README.md specifically.**
395
+
396
+ If root README.md lists features, verify each one exists:
397
+
398
+ 1. **For each feature listed:**
399
+ - Search codebase for implementation
400
+ - Verify feature is actually functional (not just TODO)
401
+ - Check if feature is documented correctly
402
+
403
+ 2. **Result:**
404
+ - ✅ Feature exists → Keep in README
405
+ - ❌ Feature doesn't exist → Remove from README or mark as "Planned"
406
+ - ⏳ Feature is TODO/planned → Move to "Roadmap" section
407
+
408
+ #### 2c. Root README.md Installation/Setup Instructions Audit
409
+
410
+ **CRITICAL: This section audits ROOT README.md specifically.**
411
+
412
+ Test that documented setup in root README.md actually works:
413
+
414
+ 1. **Check Prerequisites:**
415
+ - README says "Node 16+" → Verify package.json engines field
416
+ - README says "PostgreSQL required" → Check if actually used
417
+
418
+ 2. **Check Installation Steps:**
419
+ - README shows `npm install` → Verify package.json exists
420
+ - README references config files → Verify they exist
421
+
422
+ 3. **Check Configuration:**
423
+ - README references .env variables → List what's actually used
424
+ - README shows config examples → Verify config schema matches code
425
+
426
+ #### 2d. Root README.md Version Information Audit
427
+
428
+ **CRITICAL: This section audits ROOT README.md specifically.**
429
+
430
+ Ensure version claims in root README.md are accurate:
431
+
432
+ 1. **Check Version Consistency:**
433
+ - Project manifest version (package.json, Cargo.toml, pyproject.toml, etc.)
434
+ - README version badges/claims
435
+ - CHANGELOG latest version
436
+
437
+ 2. **Check Compatibility Claims:**
438
+ - "Works with Node 14-18" → Verify package.json engines
439
+ - "Compatible with React 17+" → Verify peerDependencies
440
+
441
+ #### 2e. Root README.md Links and References Audit
442
+
443
+ **CRITICAL: This section audits ROOT README.md specifically.**
444
+
445
+ Check all documentation links in root README.md work:
446
+
447
+ 1. **Internal Links:**
448
+ - For each `[text](./path/file.md)` link → Verify file exists
449
+ - For each `[Section](#heading)` link → Verify heading exists
450
+
451
+ 2. **External Links:**
452
+ - Badge links → Verify they work
453
+ - Documentation links → Check if still valid
454
+
455
+ 3. **Cross-References:**
456
+ - README mentions "see CONTRIBUTING.md" → Verify file exists
457
+ - README references docs/ → Verify directory exists
458
+
459
+ #### 2f. Root README.md Cross-Reference with Audit Report (If Available)
460
+
461
+ **CRITICAL: This section audits ROOT README.md specifically.**
462
+
463
+ If JUNO audit report exists, cross-reference root README.md claims:
464
+
465
+ 1. Read `trinity/reports/CODEBASE-AUDIT-{latest}.md`
466
+ 2. Extract actual counts (files, components, tests, etc.)
467
+ 3. Use audit findings as source of truth for root README.md
468
+ 4. Identify inaccuracies in root README.md for Phase 2.5 commitment
469
+
470
+ **Output:** List of root README.md inaccuracies found (to be added to Phase 2.5 commitment list)
471
+
472
+ ---
473
+
474
+ #### 2g. Existing Subdirectory README Audit (COMPREHENSIVE)
475
+
476
+ **CRITICAL: This section audits SUBDIRECTORY READMEs, not root.**
477
+
478
+ For EACH existing subdirectory README (from Phase 1 existing_readmes list):
479
+
480
+ 1. **Read the README:**
481
+ ```bash
482
+ Read {directory}/README.md
483
+ ```
484
+
485
+ 2. **Check for Inaccuracies:**
486
+ - Outdated descriptions of directory purpose
487
+ - Incorrect file counts or lists
488
+ - Broken links to other docs
489
+ - References to deleted files
490
+
491
+ 3. **Record Inaccuracies:**
492
+ - Add to Phase 2.5 commitment list
493
+ - Note which README has the issue
494
+ - Describe what needs to be fixed
495
+
496
+ **APO MUST audit ALL existing subdirectory READMEs, not just root.**
497
+
498
+ ---
499
+
500
+ #### 2h. Command/Script/CLI Validation (COMPREHENSIVE)
501
+
502
+ **CRITICAL: Verify ALL documented commands, scripts, and CLI tools actually exist**
503
+
504
+ **Goal:** Find commands in README that don't exist in the codebase or have changed
505
+
506
+ **Step 1: Extract Command References from README**
507
+
508
+ Scan README.md for command patterns:
509
+ - Bash/shell commands: `` `npm run test` ``, `` `python manage.py` ``, `` `cargo build` ``
510
+ - CLI invocations: `` `npx trinity deploy` ``, `` `./scripts/setup.sh` ``
511
+ - Script references: "Run `make install`", "Execute `build.sh`"
512
+ - Package commands: `` `pip install` ``, `` `yarn start` ``, `` `go run` ``
513
+
514
+ **Step 2: Categorize Commands**
515
+
516
+ Group commands by type:
517
+
518
+ 1. **npm/yarn/pnpm scripts:**
519
+ - Extract: All `` `npm run <script>` ``, `` `yarn <script>` ``, `` `pnpm <script>` ``
520
+ - Verify against: `package.json` scripts section
521
+
522
+ 2. **Python scripts:**
523
+ - Extract: `` `python <script>` ``, `` `python -m <module>` ``, CLI tools
524
+ - Verify against: Actual .py files, pyproject.toml, setup.py
525
+
526
+ 3. **Shell scripts:**
527
+ - Extract: `` `./scripts/setup.sh` ``, `` `bash build.sh` ``
528
+ - Verify against: Actual script files in repository
529
+
530
+ 4. **Custom CLI tools:**
531
+ - Extract: `` `npx <package>` ``, custom binaries
532
+ - Verify against: package.json bin field, local executables
533
+
534
+ 5. **Makefile targets:**
535
+ - Extract: `` `make <target>` ``
536
+ - Verify against: Makefile contents
537
+
538
+ **Step 3: Verification Process**
539
+
540
+ For EACH documented command:
541
+
542
+ ```javascript
543
+ // For npm scripts
544
+ if (command matches "npm run <script>"):
545
+ Read package.json
546
+ Search for script in "scripts" section
547
+
548
+ if NOT found:
549
+ ❌ Inaccuracy: "npm run <script>" documented but script doesn't exist in package.json
550
+ Add to Phase 2.5 commitment
551
+
552
+ // For script files
553
+ if (command matches "./<path>/script.sh"):
554
+ Check if file exists at that path
555
+
556
+ if NOT found:
557
+ ❌ Inaccuracy: Script file documented but doesn't exist
558
+ Add to Phase 2.5 commitment
559
+
560
+ // For custom CLI tools
561
+ if (command matches "npx <tool>"):
562
+ Read package.json
563
+ Check if tool is in dependencies or bin
564
+
565
+ if NOT found:
566
+ ❌ Inaccuracy: CLI tool documented but not installed/configured
567
+ Add to Phase 2.5 commitment
568
+ ```
569
+
570
+ **Step 4: Common Command Validation Patterns**
571
+
572
+ **Node.js Projects:**
573
+ ```bash
574
+ README says: `npm test`
575
+ Verify: "test" exists in package.json scripts
576
+ ```
577
+
578
+ **Python Projects:**
579
+ ```bash
580
+ README says: `python manage.py migrate`
581
+ Verify: manage.py exists and has migrate command
582
+ ```
583
+
584
+ **Custom Scripts:**
585
+ ```bash
586
+ README says: `./scripts/deploy.sh`
587
+ Verify: scripts/deploy.sh file exists
588
+ ```
589
+
590
+ **Makefile:**
591
+ ```bash
592
+ README says: `make build`
593
+ Verify: Makefile exists and has "build:" target
594
+ ```
595
+
596
+ **Step 5: Record Inaccuracies**
597
+
598
+ For each invalid command found, add to Phase 2.5 commitment:
599
+
600
+ ```markdown
601
+ ❌ **Non-existent Command**
602
+ - **File:** README.md (line X)
603
+ - **Current (WRONG):** "Run `npm run deploy`"
604
+ - **Reality:** No "deploy" script exists in package.json
605
+ - **Correct:** Remove reference OR add script to package.json
606
+ - **Fix in:** Phase 3 (Root README Update)
607
+ ```
608
+
609
+ ---
610
+
611
+ #### 2i. Code Example Validation (COMPREHENSIVE)
612
+
613
+ **CRITICAL: Verify code examples in README actually work with current codebase**
614
+
615
+ **Goal:** Find outdated code examples that don't match current API/structure
616
+
617
+ **Step 1: Extract Code Examples from README**
618
+
619
+ Find all code blocks in README.md:
620
+ - `` ```javascript `` blocks
621
+ - `` ```python `` blocks
622
+ - `` ```bash `` blocks
623
+ - `` ```typescript `` blocks
624
+ - Inline code showing API usage
625
+
626
+ **Step 2: Categorize Examples**
627
+
628
+ 1. **Import/Require Statements:**
629
+ ```javascript
630
+ import { SomeClass } from './src/lib'
631
+ ```
632
+ Verify: Does `./src/lib` export `SomeClass`?
633
+
634
+ 2. **API Usage Examples:**
635
+ ```javascript
636
+ const result = api.fetchData({ option: true })
637
+ ```
638
+ Verify: Does `api.fetchData` exist? Does it accept `option` parameter?
639
+
640
+ 3. **Configuration Examples:**
641
+ ```javascript
642
+ {
643
+ "setting": "value",
644
+ "newFeature": true
645
+ }
646
+ ```
647
+ Verify: Are these valid config options in current version?
648
+
649
+ 4. **Function Call Examples:**
650
+ ```python
651
+ result = calculate_total(items, tax_rate)
652
+ ```
653
+ Verify: Does `calculate_total` exist? Does it take these parameters?
654
+
655
+ **Step 3: Validation Process**
656
+
657
+ For code examples showing **function calls**:
658
+ ```bash
659
+ Example shows: `api.login(username, password)`
660
+
661
+ Use Grep to search codebase for:
662
+ - "function login" (JavaScript)
663
+ - "def login" (Python)
664
+ - "fn login" (Rust)
665
+
666
+ Check if function signature matches documented usage
667
+ ```
668
+
669
+ For code examples showing **imports**:
670
+ ```bash
671
+ Example shows: import { Auth } from '@/lib/auth'
672
+
673
+ Use Grep to find:
674
+ - export.*Auth in files matching lib/auth pattern
675
+
676
+ Verify export actually exists
677
+ ```
678
+
679
+ **Step 4: Common Validation Checks**
680
+
681
+ 1. **API signature changes:**
682
+ - README shows: `user.save()`
683
+ - Reality: `user.save()` now requires `user.save({ validate: true })`
684
+ - Result: ❌ Example is outdated
685
+
686
+ 2. **Deprecated methods:**
687
+ - README shows: `db.connect()`
688
+ - Reality: `db.connect()` was deprecated, now use `db.initialize()`
689
+ - Result: ❌ Example uses deprecated API
690
+
691
+ 3. **Changed file paths:**
692
+ - README shows: `import from './utils/helper'`
693
+ - Reality: File moved to `./lib/utils/helper`
694
+ - Result: ❌ Import path is wrong
695
+
696
+ **Step 5: Record Inaccuracies**
697
+
698
+ ```markdown
699
+ ❌ **Outdated Code Example**
700
+ - **File:** README.md (line X)
701
+ - **Current (WRONG):** Shows `api.connect(url)` usage
702
+ - **Reality:** API now requires `api.connect({ url, timeout })`
703
+ - **Correct:** Update example to current API signature
704
+ - **Fix in:** Phase 3 (Root README Update)
705
+ ```
706
+
707
+ ---
708
+
709
+ #### 2j. API/Function Reference Validation (COMPREHENSIVE)
710
+
711
+ **CRITICAL: Verify documented functions, classes, and APIs actually exist**
712
+
713
+ **Goal:** Find README claims about APIs/functions that don't exist or are misnamed
714
+
715
+ **Step 1: Extract API References from README**
716
+
717
+ Look for documented APIs:
718
+ - "The `calculateTotal()` function handles..."
719
+ - "Use the `DataProcessor` class to..."
720
+ - "Call `api.authenticate()` to..."
721
+ - "The `useAuth()` hook provides..."
722
+
723
+ **Step 2: Validation Process**
724
+
725
+ For EACH mentioned function/class/API:
726
+
727
+ ```bash
728
+ README mentions: "calculateTotal() function"
729
+
730
+ Use Grep to search entire codebase:
731
+ Pattern 1: "function calculateTotal"
732
+ Pattern 2: "calculateTotal ="
733
+ Pattern 3: "def calculateTotal"
734
+ Pattern 4: "fn calculate_total"
735
+
736
+ If NO matches found:
737
+ ❌ Inaccuracy: Function documented but doesn't exist
738
+ Add to Phase 2.5 commitment
739
+ ```
740
+
741
+ **Step 3: Common Validation Patterns**
742
+
743
+ **JavaScript/TypeScript:**
744
+ ```bash
745
+ README claims: "useAuth() hook"
746
+ Grep for: "export.*useAuth" OR "function useAuth"
747
+ If not found: ❌ Hook doesn't exist
748
+ ```
749
+
750
+ **Python:**
751
+ ```bash
752
+ README claims: "DataProcessor class"
753
+ Grep for: "class DataProcessor"
754
+ If not found: ❌ Class doesn't exist
755
+ ```
756
+
757
+ **Rust:**
758
+ ```bash
759
+ README claims: "parse_config() function"
760
+ Grep for: "pub fn parse_config" OR "fn parse_config"
761
+ If not found: ❌ Function doesn't exist
762
+ ```
763
+
764
+ **Step 4: Name Mismatch Detection**
765
+
766
+ Common issues:
767
+ - README says `getUserData()` but code has `fetchUserData()`
768
+ - README says `AuthService` but code has `AuthenticationService`
769
+ - README says `validate()` but code has `validateInput()`
770
+
771
+ **Step 5: Record Inaccuracies**
772
+
773
+ ```markdown
774
+ ❌ **Non-existent API Reference**
775
+ - **File:** README.md (line X)
776
+ - **Current (WRONG):** "Call the `processPayment()` function"
777
+ - **Reality:** No function named `processPayment` exists in codebase
778
+ - **Correct:** Remove reference OR verify correct function name
779
+ - **Fix in:** Phase 3 (Root README Update)
780
+ ```
781
+
782
+ ---
783
+
784
+ #### 2k. Dependency Claims Validation (COMPREHENSIVE)
785
+
786
+ **CRITICAL: Verify documented dependencies match actual project dependencies**
787
+
788
+ **Goal:** Find mismatches between README claims and actual package manifests
789
+
790
+ **Step 1: Identify Package Manifest File**
791
+
792
+ Detect project type and read manifest:
793
+
794
+ ```javascript
795
+ if exists("package.json"):
796
+ manifest = "package.json"
797
+ type = "Node.js"
798
+
799
+ else if exists("pyproject.toml"):
800
+ manifest = "pyproject.toml"
801
+ type = "Python"
802
+
803
+ else if exists("Cargo.toml"):
804
+ manifest = "Cargo.toml"
805
+ type = "Rust"
806
+
807
+ else if exists("go.mod"):
808
+ manifest = "go.mod"
809
+ type = "Go"
810
+
811
+ Read {manifest}
812
+ ```
813
+
814
+ **Step 2: Extract Dependency Claims from README**
815
+
816
+ Look for:
817
+ - "Requires React 18+"
818
+ - "Built with Express.js"
819
+ - "Uses PostgreSQL database"
820
+ - "Depends on axios, lodash, and moment"
821
+ - Version badges showing specific versions
822
+
823
+ **Step 3: Validation Process**
824
+
825
+ **For Version Claims:**
826
+ ```bash
827
+ README claims: "Requires Node 16+"
828
+
829
+ Read package.json
830
+ Check "engines" field:
831
+ "engines": { "node": ">=14.0.0" } ← Mismatch!
832
+
833
+ ❌ Inaccuracy: README says Node 16+, package.json says 14+
834
+ Add to Phase 2.5 commitment
835
+ ```
836
+
837
+ **For Dependency Lists:**
838
+ ```bash
839
+ README claims: "Built with Express, MongoDB, and Redis"
840
+
841
+ Read package.json dependencies
842
+ Check if listed:
843
+ ✅ express: found
844
+ ❌ mongodb: NOT found (uses mongoose instead)
845
+ ✅ redis: found
846
+
847
+ ❌ Inaccuracy: MongoDB not directly listed as dependency
848
+ Add to Phase 2.5 commitment
849
+ ```
850
+
851
+ **For Framework Claims:**
852
+ ```bash
853
+ README claims: "React 17 application"
854
+
855
+ Read package.json
856
+ Check react version:
857
+ "react": "^18.2.0" ← Mismatch!
858
+
859
+ ❌ Inaccuracy: README says React 17, actually using React 18
860
+ Add to Phase 2.5 commitment
861
+ ```
862
+
863
+ **Step 4: Common Validation Checks**
864
+
865
+ 1. **Node version mismatch:**
866
+ - README: "Node 14+"
867
+ - package.json engines: "node": ">=16.0.0"
868
+ - Result: ❌ Outdated requirement
869
+
870
+ 2. **Missing dependencies:**
871
+ - README: "Uses axios for HTTP"
872
+ - package.json: No axios dependency
873
+ - Result: ❌ Dependency not installed
874
+
875
+ 3. **Wrong framework version:**
876
+ - README: "Vue 2 project"
877
+ - package.json: "vue": "^3.0.0"
878
+ - Result: ❌ Wrong major version
879
+
880
+ 4. **Deprecated package claims:**
881
+ - README: "Uses moment.js"
882
+ - package.json: Uses date-fns instead
883
+ - Result: ❌ Wrong package reference
884
+
885
+ **Step 5: Record Inaccuracies**
886
+
887
+ ```markdown
888
+ ❌ **Dependency Mismatch**
889
+ - **File:** README.md (line X)
890
+ - **Current (WRONG):** "Requires Node.js 14+"
891
+ - **Reality:** package.json specifies "node": ">=16.9.0"
892
+ - **Correct:** "Requires Node.js 16.9+"
893
+ - **Fix in:** Phase 3 (Root README Update)
894
+ ```
895
+
896
+ ---
897
+
898
+ #### 2l. Stale Content Detection (COMPREHENSIVE)
899
+
900
+ **CRITICAL: Find markers of outdated/unmaintained content in README**
901
+
902
+ **Goal:** Detect TODO markers, outdated dates, and other staleness indicators
903
+
904
+ **Step 1: Search for Staleness Markers**
905
+
906
+ Scan README.md for common stale content patterns:
907
+
908
+ **TODO/WIP Markers:**
909
+ ```markdown
910
+ - TODO: Add authentication docs
911
+ - [ ] Update installation section
912
+ - WIP: This section is under construction
913
+ - FIXME: Verify these instructions
914
+ - Coming soon: API documentation
915
+ ```
916
+
917
+ **Outdated Date References:**
918
+ ```markdown
919
+ - "Last updated: 2021"
920
+ - "As of January 2022"
921
+ - "In version 1.0 (released 2020)"
922
+ ```
923
+
924
+ **Placeholder Text:**
925
+ ```markdown
926
+ - "[Insert description here]"
927
+ - "TBD"
928
+ - "To be documented"
929
+ - "{your-project-name}"
930
+ - "Replace this with..."
931
+ ```
932
+
933
+ **Deprecated Warnings:**
934
+ ```markdown
935
+ - "⚠️ This feature is deprecated"
936
+ - "DEPRECATED: Use XYZ instead"
937
+ - "⚠️ Legacy API - do not use"
938
+ ```
939
+
940
+ **Step 2: Validation Process**
941
+
942
+ For EACH staleness marker found:
943
+
944
+ ```bash
945
+ # TODO markers
946
+ if README contains "TODO:":
947
+ Extract full TODO line
948
+ Determine if TODO is still valid or should be removed
949
+
950
+ if TODO is >6 months old based on git history:
951
+ ❌ Inaccuracy: Stale TODO marker
952
+ Add to Phase 2.5 commitment
953
+
954
+ # Outdated dates
955
+ if README contains year < (current_year - 1):
956
+ ❌ Inaccuracy: Reference to old year
957
+ Verify if section needs updating
958
+ Add to Phase 2.5 commitment
959
+
960
+ # Placeholder text
961
+ if README contains "[Insert" OR "TBD" OR "{your-":
962
+ ❌ Inaccuracy: Placeholder text never replaced
963
+ Add to Phase 2.5 commitment
964
+ ```
965
+
966
+ **Step 3: Cross-Reference with Project State**
967
+
968
+ **Check if "Coming Soon" features exist:**
969
+ ```bash
970
+ README says: "Coming soon: Dark mode support"
971
+
972
+ Use Grep to search codebase for dark mode implementation
973
+
974
+ if dark mode implementation found:
975
+ ❌ Inaccuracy: Feature exists but README still says "coming soon"
976
+ Add to Phase 2.5 commitment
977
+ ```
978
+
979
+ **Check deprecation warnings validity:**
980
+ ```bash
981
+ README says: "⚠️ DEPRECATED: oldFunction() - use newFunction() instead"
982
+
983
+ Use Grep to check if oldFunction still exists
984
+
985
+ if oldFunction() removed from codebase:
986
+ ❌ Inaccuracy: Deprecation warning for removed function (should be deleted)
987
+ Add to Phase 2.5 commitment
988
+ ```
989
+
990
+ **Step 4: Version-Specific Content Audit**
991
+
992
+ Compare README version references with actual version:
993
+
994
+ ```bash
995
+ Read package.json (or Cargo.toml, pyproject.toml)
996
+ current_version = "2.5.0"
997
+
998
+ Scan README for version mentions:
999
+ "In version 1.0" ← Outdated reference
1000
+ "As of v2.0" ← Verify if still accurate for v2.5
1001
+ "New in version 2.5" ← Current, keep
1002
+ ```
1003
+
1004
+ **Step 5: Record Inaccuracies**
1005
+
1006
+ ```markdown
1007
+ ❌ **Stale Content Marker**
1008
+ - **File:** README.md (line X)
1009
+ - **Current (WRONG):** "TODO: Add deployment docs"
1010
+ - **Reality:** Deployment docs exist in docs/deployment.md
1011
+ - **Correct:** Replace TODO with link to deployment docs
1012
+ - **Fix in:** Phase 3 (Root README Update)
1013
+ ```
1014
+
1015
+ ```markdown
1016
+ ❌ **Outdated Date Reference**
1017
+ - **File:** README.md (line Y)
1018
+ - **Current (WRONG):** "Last updated: January 2022"
1019
+ - **Reality:** Current year is 2025, content is stale
1020
+ - **Correct:** Update date or remove if unnecessary
1021
+ - **Fix in:** Phase 3 (Root README Update)
1022
+ ```
1023
+
1024
+ ```markdown
1025
+ ❌ **Placeholder Text**
1026
+ - **File:** README.md (line Z)
1027
+ - **Current (WRONG):** "Clone the repository: git clone {repository-url}"
1028
+ - **Reality:** Actual repository URL should be inserted
1029
+ - **Correct:** Replace {repository-url} with actual URL from package.json repository field
1030
+ - **Fix in:** Phase 3 (Root README Update)
1031
+ ```
1032
+
1033
+ ---
1034
+
1035
+ **APO MUST audit ALL existing subdirectory READMEs, not just root.**
1036
+
1037
+ ---
1038
+
1039
+ ### Phase 2.5: Fix Commitment (CRITICAL ACCOUNTABILITY)
1040
+
1041
+ **Goal:** Create explicit list of ALL inaccuracies found in Phase 2 that MUST be fixed in Phases 3-5
1042
+
1043
+ **CRITICAL: This phase creates accountability. APO commits to fixing these issues.**
1044
+
1045
+ **APO MUST output:**
1046
+
1047
+ ```markdown
1048
+ === PHASE 2.5: FIX COMMITMENT LIST ===
1049
+
1050
+ **Total Inaccuracies Found:** {count}
1051
+
1052
+ **Root README.md Inaccuracies ({count}):**
1053
+
1054
+ 1. ❌ **{Inaccuracy Title}**
1055
+ - **File:** README.md (line {X})
1056
+ - **Current (WRONG):** "{text}"
1057
+ - **Correct:** "{text}"
1058
+ - **Fix in:** Phase 3 (Root README Update)
1059
+ - **Status:** ⏳ COMMITTED TO FIX
1060
+
1061
+ 2. ❌ **{Inaccuracy Title}**
1062
+ - **File:** README.md (line {Y})
1063
+ - **Current (WRONG):** "{text}"
1064
+ - **Correct:** "{text}"
1065
+ - **Fix in:** Phase 3 (Root README Update)
1066
+ - **Status:** ⏳ COMMITTED TO FIX
1067
+
1068
+ **Subdirectory README Inaccuracies ({count}):**
1069
+
1070
+ 1. ❌ **{Inaccuracy Title}**
1071
+ - **File:** {directory}/README.md (line {Z})
1072
+ - **Current (WRONG):** "{text}"
1073
+ - **Correct:** "{text}"
1074
+ - **Fix in:** Phase 5 (Existing README Updates)
1075
+ - **Status:** ⏳ COMMITTED TO FIX
1076
+
1077
+ **Commitment:**
1078
+ - APO commits to fixing ALL {total_count} inaccuracies
1079
+ - Phase 3 will fix {root_readme_count} root README inaccuracies
1080
+ - Phase 5 will fix {subdirectory_count} subdirectory README inaccuracies
1081
+ - Phase 7 report will show ✅ FIXED status for each item
1082
+
1083
+ **If APO skips ANY fix, APO MUST explain WHY in Phase 7 report.**
1084
+ ```
1085
+
1086
+ **CRITICAL: Every inaccuracy in this list MUST be fixed. No exceptions without valid reason.**
1087
+
1088
+ ---
1089
+
1090
+ ### Phase 3: Root README Update
1091
+
1092
+ **⚠️ CRITICAL: THIS PHASE IS MANDATORY - CANNOT BE SKIPPED**
1093
+
1094
+ **Execution Policy:**
1095
+ - ✅ APO MUST execute this phase regardless of perceived need
1096
+ - ✅ APO MUST read root README.md even if it appears current
1097
+ - ✅ APO MUST audit ALL sections (Features, Installation, Usage, etc.)
1098
+ - ✅ APO MUST apply ALL Phase 2.5 inaccuracy corrections for root README.md
1099
+ - ❌ APO CANNOT skip this phase with "no updates needed" reasoning
1100
+ - ❌ APO CANNOT defer this phase to "future work"
1101
+ - ❌ APO CANNOT prioritize Phase 4 over Phase 3
1102
+
1103
+ **Valid Skip Conditions:** NONE (this phase always executes)
1104
+
1105
+ **Invalid Skip Justifications (FORBIDDEN):**
1106
+ - ❌ "Root README.md appears current"
1107
+ - ❌ "No inaccuracies found in Phase 2"
1108
+ - ❌ "Prioritizing subdirectory READMEs"
1109
+ - ❌ "Token budget optimization"
1110
+ - ❌ "README is already comprehensive"
1111
+
1112
+ ---
1113
+
1114
+ **MANDATORY ACTIONS (APO MUST Complete ALL - Cannot Skip):**
1115
+
1116
+ 1. **Read Current README.md:**
1117
+ ```bash
1118
+ Read README.md
1119
+ ```
1120
+
1121
+ 2. **Apply Phase 2.5 Fixes for Root README:**
1122
+ - For EACH inaccuracy marked "Fix in: Phase 3" in Phase 2.5 list
1123
+ - Use Edit tool to apply correction
1124
+ - Update status from ⏳ COMMITTED to ✅ FIXED
1125
+
1126
+ 3. **Update Project Description:**
1127
+ - Verify description matches current project state
1128
+ - Update if project scope has changed
1129
+
1130
+ 4. **Update Features Section:**
1131
+ - Add any new features discovered in Phase 2
1132
+ - Remove deprecated/removed features
1133
+ - Ensure feature list is accurate
1134
+
1135
+ 5. **Update Installation/Setup:**
1136
+ - Verify prerequisites are current
1137
+ - Check installation steps still work
1138
+ - Update configuration examples if needed
1139
+
1140
+ 6. **Update Version/Compatibility:**
1141
+ - Verify version badges are current
1142
+ - Update compatibility claims (Node version, dependencies, etc.)
1143
+
1144
+ 7. **Update Links:**
1145
+ - Fix any broken internal links
1146
+ - Update references to renamed/moved files
1147
+ - Verify external links still work
1148
+
1149
+ **APO Output:**
1150
+ - Number of Phase 2.5 fixes applied: {count}
1151
+ - Number of sections updated: {count}
1152
+ - Total edits made: {count}
1153
+
1154
+ ---
1155
+
1156
+ ### Phase 3-checkpoint: Root README Verification (MANDATORY GATE)
1157
+
1158
+ **CRITICAL: APO CANNOT proceed to Phase 4 until this checkpoint PASSES**
1159
+
1160
+ **Goal:** Verify Phase 3 executed completely and root README.md is accurate
1161
+
1162
+ **Step 1: Verify Phase 3 Execution**
1163
+
1164
+ APO MUST verify:
1165
+ ```
1166
+ Did APO use Read tool on README.md? (YES/NO)
1167
+ Did APO apply ALL Phase 2.5 fixes for root README? (count applied / count committed)
1168
+ Did APO update outdated sections? (list sections updated)
1169
+ ```
1170
+
1171
+ **Step 2: Count Changes Made**
1172
+
1173
+ ```javascript
1174
+ changes_made = {
1175
+ phase_2_5_fixes: 0, // Corrections from Phase 2.5
1176
+ section_updates: 0, // Updates to Features, Installation, etc.
1177
+ total_edits: 0 // Total Edit tool calls on README.md
1178
+ }
1179
+ ```
1180
+
1181
+ **Step 3: Checkpoint Decision (BINARY)**
1182
+
1183
+ ```
1184
+ IF Phase 3 was executed (Read tool used + audit performed):
1185
+ IF changes_made.total_edits > 0 OR changes_made.phase_2_5_fixes == phase_2_5_root_count:
1186
+ status = PASSED (changes applied OR all fixes applied)
1187
+ ELSE:
1188
+ IF all_sections_verified AND no_inaccuracies_found:
1189
+ status = PASSED (file is 100% correct)
1190
+ ELSE:
1191
+ status = FAILED (audit incomplete)
1192
+ ELSE:
1193
+ status = FAILED (Phase 3 was skipped)
1194
+ ```
1195
+
1196
+ **ONLY TWO VALID STATUSES:**
1197
+ - ✅ **PASSED** - Phase 3 executed AND (changes applied OR file verified 100% correct)
1198
+ - ❌ **FAILED** - Phase 3 skipped OR audit incomplete
1199
+
1200
+ **Step 4: Checkpoint Report**
1201
+
1202
+ APO MUST output:
1203
+
1204
+ ```markdown
1205
+ === PHASE 3-CHECKPOINT: ROOT README VERIFICATION ===
1206
+
1207
+ **Phase 3 Execution:** {✅ EXECUTED | ❌ SKIPPED}
1208
+ **Read tool used on README.md:** {✅ YES | ❌ NO}
1209
+ **Changes applied:** {count} edits
1210
+ **Phase 2.5 fixes applied:** {count}/{total} fixes
1211
+
1212
+ **Checkpoint Status:** {✅ PASSED | ❌ FAILED}
1213
+
1214
+ **If PASSED:**
1215
+ ✅ Root README.md was properly audited and updated.
1216
+ Proceeding to Phase 4 (Subdirectory README Creation).
1217
+
1218
+ **If FAILED:**
1219
+ ❌ Phase 3-checkpoint FAILED
1220
+ Reason: {specific reason}
1221
+
1222
+ **ACTION REQUIRED:**
1223
+ APO MUST immediately return to Phase 3 and execute it completely:
1224
+ 1. Read root README.md
1225
+ 2. Apply ALL Phase 2.5 corrections
1226
+ 3. Update outdated sections
1227
+ 4. Re-run Phase 3-checkpoint
1228
+ ```
1229
+
1230
+ **Step 5: Checkpoint Action (ENFORCED)**
1231
+
1232
+ ```python
1233
+ if status == PASSED:
1234
+ print("✅ Phase 3-checkpoint PASSED - Proceeding to Phase 4")
1235
+ goto Phase_4
1236
+
1237
+ elif status == FAILED:
1238
+ print("❌ Phase 3-checkpoint FAILED")
1239
+ print("Root README.md was not properly updated. Returning to Phase 3.")
1240
+
1241
+ # MANDATORY LOOP-BACK
1242
+ goto Phase_3
1243
+ # Execute Phase 3 completely
1244
+ # Re-run Phase 3-checkpoint
1245
+ # Repeat until PASSED
1246
+ ```
1247
+
1248
+ **APO CANNOT execute Phase 4 until this checkpoint returns PASSED.**
1249
+
1250
+ ---
1251
+
1252
+ ### Phase 4: Subdirectory README Creation
1253
+
1254
+ **Goal:** Create README.md for EVERY directory with CLAUDE.md (100% coverage)
1255
+
1256
+ **CRITICAL: This phase creates NEW READMEs only. Phase 5 updates existing ones.**
1257
+
1258
+ **Step 1: Identify Directories Needing READMEs**
1259
+
1260
+ Use the `missing_readmes` list from Phase 1 Discovery.
1261
+
1262
+ ```javascript
1263
+ directories_to_create = missing_readmes // From Phase 1
1264
+ total_to_create = directories_to_create.length
1265
+ ```
1266
+
1267
+ **Step 2: For EACH Missing README, Create It**
1268
+
1269
+ ```javascript
1270
+ for each directory in directories_to_create:
1271
+ // 1. Read CLAUDE.md for context
1272
+ Read {directory}/CLAUDE.md
1273
+
1274
+ // 2. Determine directory type (see templates below)
1275
+ type = detectDirectoryType(directory)
1276
+
1277
+ // 3. Generate README content using appropriate template
1278
+ readme_content = generateREADME(type, claude_md_content, directory)
1279
+
1280
+ // 4. Write README.md
1281
+ Write {directory}/README.md
1282
+ readme_content
1283
+ ```
1284
+
1285
+ **README Templates by Directory Type:**
1286
+
1287
+ **Type A: Root Directory**
1288
+ - **Detection:** Directory is "." or root
1289
+ - **Template:** Standard root README (Features, Installation, Usage, etc.)
1290
+
1291
+ **Type B: Feature/Component Directory**
1292
+ - **Detection:** Directory name like "api/", "web/", "backend/", "frontend/"
1293
+ - **Template:**
1294
+ ```markdown
1295
+ # {Directory Name}
1296
+
1297
+ {Purpose extracted from CLAUDE.md}
1298
+
1299
+ ## Overview
1300
+ {Brief description of what this directory contains}
1301
+
1302
+ ## Structure
1303
+ {Use ls to show subdirectories and key files}
1304
+
1305
+ ## Key Components
1306
+ {List major files/modules with descriptions}
1307
+
1308
+ ## Documentation
1309
+ See [{directory}/CLAUDE.md](CLAUDE.md) for architecture details.
1310
+ ```
1311
+
1312
+ **Type C: Trinity Directory**
1313
+ - **Detection:** Directory name is "trinity"
1314
+ - **Template:**
1315
+ ```markdown
1316
+ # Trinity Method
1317
+
1318
+ Trinity Method v2.0 implementation for {project name}.
1319
+
1320
+ ## Directory Structure
1321
+ {Use ls to show trinity/ subdirectories}
1322
+
1323
+ ## Key Files
1324
+ {List actual files in trinity/knowledge-base/ with line counts}
1325
+
1326
+ ## Trinity Commands
1327
+ ```bash
1328
+ /trinity-start # Start workflow guide
1329
+ /trinity-audit # Run codebase audit
1330
+ /trinity-readme # Update READMEs
1331
+ /trinity-docs # Organize docs/
1332
+ /trinity-changelog # Update CHANGELOG
1333
+ ```
1334
+
1335
+ ## Documentation
1336
+ See [trinity/CLAUDE.md](CLAUDE.md) for Trinity Method context.
1337
+ ```
1338
+
1339
+ **Type D: Test Directory**
1340
+ - **Detection:** Directory name contains "test", "__tests__", "spec"
1341
+ - **Template:**
1342
+ ```markdown
1343
+ # {Directory Name}
1344
+
1345
+ {Extract testing info from CLAUDE.md}
1346
+
1347
+ ## Test Structure
1348
+ {Use ls to show test files and subdirectories}
1349
+
1350
+ ## Running Tests
1351
+ {Extract test commands from CLAUDE.md or package.json scripts}
1352
+
1353
+ ## Documentation
1354
+ See [{directory}/CLAUDE.md](CLAUDE.md) for testing patterns.
1355
+ ```
1356
+
1357
+ **Type E: Nested Subdirectory (2+ levels deep)**
1358
+ - **Detection:** Path has 2+ levels (e.g., `backend/src`, `frontend/app`)
1359
+ - **Template:**
1360
+ ```markdown
1361
+ # {Directory Name}
1362
+
1363
+ {Purpose extracted from CLAUDE.md}
1364
+
1365
+ ## Location in Project
1366
+ **Path:** `{relative_path_from_root}`
1367
+ **Parent:** `{parent_directory_name}`
1368
+ **Level:** {depth} levels from root
1369
+
1370
+ ## Directory Contents
1371
+ {Use ls to show subdirectories and files}
1372
+
1373
+ ## Purpose
1374
+ {Extract from CLAUDE.md}
1375
+
1376
+ ## Key Components
1377
+ {List major files/subdirectories with descriptions}
1378
+
1379
+ ## Documentation
1380
+ See [{directory}/CLAUDE.md](CLAUDE.md) for details.
1381
+ ```
1382
+
1383
+ **Step 3: Track Creation**
1384
+
1385
+ ```javascript
1386
+ created_readmes = [] // List of paths created
1387
+ for each directory in directories_to_create:
1388
+ if README created successfully:
1389
+ created_readmes.push(directory)
1390
+ ```
1391
+
1392
+ **APO Output:**
1393
+ ```markdown
1394
+ === PHASE 4: SUBDIRECTORY README CREATION ===
1395
+
1396
+ **READMEs to Create:** {total_to_create}
1397
+ **READMEs Created:** {created_readmes.length}
1398
+
1399
+ **Created:**
1400
+ 1. ✅ {directory1}/README.md ({line_count} lines)
1401
+ 2. ✅ {directory2}/README.md ({line_count} lines)
1402
+ ...
1403
+
1404
+ **Completion:** {(created_readmes.length / total_to_create) * 100}%
1405
+ ```
1406
+
1407
+ ---
1408
+
1409
+ ### Phase 4-checkpoint: README Coverage Verification (MANDATORY CHECKPOINT)
1410
+
1411
+ **CRITICAL: APO CANNOT proceed to Phase 5 until this checkpoint PASSES**
1412
+
1413
+ **Goal:** Ensure 100% completion of Phase 4 README creation requirements
1414
+
1415
+ **Step 1: Re-run Glob for Independent Validation (MANDATORY)**
1416
+
1417
+ **CRITICAL: DO NOT use Phase 1 cached count. Run fresh Glob for cross-validation.**
1418
+
1419
+ ```bash
1420
+ Use Glob with pattern: "**/CLAUDE.md"
1421
+ ```
1422
+
1423
+ **Paste Fresh Glob Output:**
1424
+ ```
1425
+ === PHASE 4-CHECKPOINT FRESH GLOB OUTPUT START ===
1426
+ {paste complete Glob output here}
1427
+ === PHASE 4-CHECKPOINT FRESH GLOB OUTPUT END ===
1428
+ ```
1429
+
1430
+ Count lines in fresh Glob output:
1431
+ ```javascript
1432
+ fresh_glob_count = {count lines in fresh Glob output above}
1433
+ ```
1434
+
1435
+ **Step 2: Validate Phase 1 Accuracy (CROSS-CHECK)**
1436
+
1437
+ ```javascript
1438
+ phase1_count = {count from Phase 1 Discovery}
1439
+ fresh_glob_count = {count from Step 1 fresh Glob}
1440
+
1441
+ if (fresh_glob_count !== phase1_count) {
1442
+ ❌ CRITICAL ERROR: Phase 1 discovery was INCOMPLETE
1443
+
1444
+ - Phase 1 reported: {phase1_count} CLAUDE.md files
1445
+ - Fresh Glob found: {fresh_glob_count} CLAUDE.md files
1446
+ - Discrepancy: {Math.abs(fresh_glob_count - phase1_count)} files
1447
+
1448
+ **PHASE 1 ERROR DETECTED - MANDATORY LOOP-BACK**
1449
+
1450
+ **ACTION REQUIRED:**
1451
+ 1. RETURN TO PHASE 1
1452
+ 2. Re-run discovery with fresh Glob count: {fresh_glob_count}
1453
+ 3. Update missing_readmes list with ALL missing READMEs
1454
+ 4. RETURN TO PHASE 4 with corrected list
1455
+ 5. Create ALL missing READMEs
1456
+ 6. Re-run Phase 4-checkpoint
1457
+
1458
+ **APO CANNOT proceed until Phase 1 count matches fresh Glob count**
1459
+
1460
+ } else {
1461
+ ✅ Phase 1 validation PASSED: {phase1_count} == {fresh_glob_count}
1462
+ }
1463
+ ```
1464
+
1465
+ **Step 3: Calculate Coverage (Using Validated Count)**
1466
+
1467
+ Use fresh_glob_count as source of truth:
1468
+
1469
+ ```javascript
1470
+ total_claude_directories = fresh_glob_count // VALIDATED count
1471
+ total_with_readmes = {count directories that have README.md}
1472
+ total_missing = total_claude_directories - total_with_readmes
1473
+
1474
+ coverage_percentage = (total_with_readmes / total_claude_directories) * 100
1475
+ ```
1476
+
1477
+ **Step 4: Pass/Fail Decision (BINARY - NO "PARTIAL")**
1478
+
1479
+ ```
1480
+ if coverage == 100%:
1481
+ status = PASS
1482
+ else:
1483
+ status = FAIL
1484
+ ```
1485
+
1486
+ **ONLY TWO VALID STATUSES:**
1487
+ - ✅ **PASSED** - Coverage = 100%
1488
+ - ❌ **FAILED** - Coverage < 100%
1489
+
1490
+ **APO MUST Output Checkpoint Report:**
1491
+
1492
+ ```markdown
1493
+ === PHASE 4-CHECKPOINT: README COVERAGE VERIFICATION ===
1494
+
1495
+ **Phase 1 Count:** {phase1_count}
1496
+ **Fresh Glob Count:** {fresh_glob_count}
1497
+ **Count Validation:** {✅ PASSED | ❌ FAILED}
1498
+
1499
+ **Total CLAUDE.md Directories:** {fresh_glob_count}
1500
+ **Directories with READMEs:** {total_with_readmes}
1501
+ **Coverage:** {coverage_percentage}% ({total_with_readmes}/{fresh_glob_count})
1502
+
1503
+ **Checkpoint Status:** {✅ PASS | ❌ FAIL}
1504
+
1505
+ **If PASS:**
1506
+ ✅ 100% README coverage achieved. All directories with CLAUDE.md have READMEs.
1507
+ Proceeding to Phase 5.
1508
+
1509
+ **If FAIL:**
1510
+ ❌ Phase 4-checkpoint FAILED
1511
+ Coverage: {coverage_percentage}% (< 100%)
1512
+
1513
+ **Missing READMEs:**
1514
+ {list directories that have CLAUDE.md but no README.md}
1515
+
1516
+ **ACTION REQUIRED:**
1517
+ APO MUST immediately return to Phase 4 and create the missing READMEs.
1518
+ DO NOT proceed to Phase 5 until Phase 4-checkpoint PASSES.
1519
+ ```
1520
+
1521
+ **Step 5: Checkpoint Action (ENFORCED)**
1522
+
1523
+ ```python
1524
+ if status == PASS:
1525
+ print("✅ Phase 4-checkpoint PASSED - Proceeding to Phase 5")
1526
+ goto Phase_5
1527
+
1528
+ elif status == FAIL:
1529
+ print("❌ Phase 4-checkpoint FAILED")
1530
+ print(f"Coverage = {coverage_percentage}% (need 100%)")
1531
+
1532
+ # MANDATORY LOOP-BACK
1533
+ goto Phase_4
1534
+ # Create ALL missing READMEs
1535
+ # Re-run Phase 4-checkpoint
1536
+ # Repeat until PASSED
1537
+ ```
1538
+
1539
+ ---
1540
+
1541
+ ### Phase 5: Existing README Updates
1542
+
1543
+ **Goal:** Apply Phase 2.5 fixes to subdirectory READMEs
1544
+
1545
+ **CRITICAL: This phase fixes inaccuracies in READMEs that already existed before this command.**
1546
+
1547
+ **Step 1: Get List of Subdirectory Fixes**
1548
+
1549
+ From Phase 2.5 commitment list, filter for:
1550
+ - Inaccuracies marked "Fix in: Phase 5"
1551
+ - These are subdirectory README inaccuracies (not root)
1552
+
1553
+ ```javascript
1554
+ subdirectory_fixes = phase_2_5_list.filter(fix => fix.phase == "Phase 5")
1555
+ total_fixes = subdirectory_fixes.length
1556
+ ```
1557
+
1558
+ **Step 2: Apply Each Fix**
1559
+
1560
+ ```javascript
1561
+ for each fix in subdirectory_fixes:
1562
+ // 1. Read the README with the inaccuracy
1563
+ Read {fix.file}
1564
+
1565
+ // 2. Apply correction using Edit tool
1566
+ Edit {fix.file}
1567
+ old_string = {fix.current_wrong}
1568
+ new_string = {fix.correct}
1569
+
1570
+ // 3. Update fix status
1571
+ fix.status = ✅ FIXED
1572
+ ```
1573
+
1574
+ **Step 3: Verify All Fixes Applied**
1575
+
1576
+ ```javascript
1577
+ fixes_applied = subdirectory_fixes.filter(fix => fix.status == "✅ FIXED").length
1578
+ fixes_skipped = total_fixes - fixes_applied
1579
+ completion = (fixes_applied / total_fixes) * 100
1580
+ ```
1581
+
1582
+ **APO Output:**
1583
+
1584
+ ```markdown
1585
+ === PHASE 5: EXISTING README UPDATES ===
1586
+
1587
+ **Subdirectory Fixes to Apply:** {total_fixes}
1588
+ **Fixes Applied:** {fixes_applied}
1589
+ **Fixes Skipped:** {fixes_skipped}
1590
+ **Completion:** {completion}%
1591
+
1592
+ **Applied Fixes:**
1593
+ 1. ✅ {directory1}/README.md - {inaccuracy description}
1594
+ 2. ✅ {directory2}/README.md - {inaccuracy description}
1595
+ ...
1596
+
1597
+ **Skipped Fixes (If Any):**
1598
+ 1. ⏭️ {directory}/README.md - {inaccuracy description}
1599
+ - **Reason:** {valid skip reason}
1600
+ ```
1601
+
1602
+ **If APO skips ANY Phase 2.5 inaccuracy fix, APO MUST explain WHY with valid skip reason in Phase 7 report "Skipped Updates" section.**
1603
+
1604
+ ---
1605
+
1606
+ ### Phase 6: Final Validation (MANDATORY OVERRIDE)
1607
+
1608
+ **CRITICAL: This validation runs before Phase 7 and OVERRIDES any previous checkpoint results if coverage < 100%.**
1609
+
1610
+ **Goal:** Independent verification of 100% README coverage
1611
+
1612
+ **Step 1: Independent Final Glob (FORCED EXECUTION)**
1613
+
1614
+ ```bash
1615
+ Use Glob with pattern: "**/CLAUDE.md"
1616
+ ```
1617
+
1618
+ **Paste Final Glob Output:**
1619
+ ```
1620
+ === PHASE 6 FINAL GLOB OUTPUT START ===
1621
+ {paste complete Glob output here}
1622
+ === PHASE 6 FINAL GLOB OUTPUT END ===
1623
+ ```
1624
+
1625
+ Count lines:
1626
+ ```javascript
1627
+ final_glob_count = {count lines in final Glob output above}
1628
+ ```
1629
+
1630
+ **Step 2: Verify README.md Exists for EACH CLAUDE.md**
1631
+
1632
+ APO MUST check EACH path in the final Glob output:
1633
+
1634
+ ```javascript
1635
+ missing_readmes = []
1636
+
1637
+ for each_path in final_glob_output:
1638
+ directory = dirname(each_path)
1639
+ readme_path = directory + "/README.md"
1640
+
1641
+ if exists(readme_path):
1642
+ ✅ {directory}: README.md EXISTS
1643
+ else:
1644
+ ❌ {directory}: README.md MISSING
1645
+ missing_readmes.push(directory)
1646
+ ```
1647
+
1648
+ **Required Output:**
1649
+ ```markdown
1650
+ === PHASE 6: FINAL README VERIFICATION ===
1651
+
1652
+ 1. ✅ {directory1}: README.md exists
1653
+ 2. ✅ {directory2}: README.md exists
1654
+ 3. ❌ {directory3}: README.md MISSING ← COVERAGE FAILURE
1655
+ ...
1656
+
1657
+ **Total CLAUDE.md directories:** {final_glob_count}
1658
+ **READMEs existing:** {existing_count}
1659
+ **Final Coverage:** {(existing_count / final_glob_count) * 100}%
1660
+ ```
1661
+
1662
+ **Step 3: Coverage Validation**
1663
+
1664
+ ```javascript
1665
+ final_coverage = (existing_count / final_glob_count) * 100
1666
+
1667
+ if (final_coverage < 100) {
1668
+ validation_status = "❌ FAILED"
1669
+ reason = f"README coverage = {final_coverage}% (< 100%)"
1670
+ } else {
1671
+ validation_status = "✅ PASSED"
1672
+ reason = "100% README coverage verified"
1673
+ }
1674
+ ```
1675
+
1676
+ **Step 4: Validation Report**
1677
+
1678
+ ```markdown
1679
+ === PHASE 6: FINAL VALIDATION RESULT ===
1680
+
1681
+ **Final Coverage:** {final_coverage}%
1682
+ **Validation Status:** {validation_status}
1683
+
1684
+ **If FAILED:**
1685
+ ❌ README coverage is incomplete
1686
+ - Required: 100%
1687
+ - Actual: {final_coverage}%
1688
+ - Missing: {final_glob_count - existing_count} READMEs
1689
+
1690
+ **Missing READMEs:**
1691
+ {list all directories from missing_readmes array}
1692
+
1693
+ **This validation OVERRIDES previous checkpoint claims if coverage < 100%.**
1694
+
1695
+ **If PASSED:**
1696
+ ✅ 100% README coverage verified
1697
+ All directories with CLAUDE.md have README.md files.
1698
+ ```
1699
+
1700
+ **If validation FAILED, overall command status is ❌ FAILED regardless of checkpoint results.**
1701
+
1702
+ ---
1703
+
1704
+ ### Phase 7: README Audit Report
1705
+
1706
+ **APO Generates:** `trinity/reports/README-AUDIT-{date}.md`
1707
+
1708
+ **CRITICAL: Report MUST document COMPLETED work, not future recommendations.**
1709
+
1710
+ **Required Report Structure:**
1711
+
1712
+ ```markdown
1713
+ # README Audit Report
1714
+
1715
+ **Project:** {project-name}
1716
+ **Audit Date:** {date}
1717
+ **Auditor:** APO (Documentation Specialist)
1718
+ **Command:** /trinity-readme
1719
+
1720
+ ---
1721
+
1722
+ ## Executive Summary
1723
+
1724
+ **README Coverage:** {final_coverage}% ({existing_count}/{total_count} directories)
1725
+ **Inaccuracies Found:** {total_inaccuracies}
1726
+ **Inaccuracies Fixed:** {fixed_count}/{total_inaccuracies}
1727
+ **READMEs Created:** {created_count}
1728
+ **READMEs Updated:** {updated_count}
1729
+
1730
+ **COMMAND EXECUTION STATUS:** {✅ SUCCESS | ❌ FAILED}
1731
+
1732
+ ---
1733
+
1734
+ ## Hard Requirements Status
1735
+
1736
+ 1. **Phase Execution:** {executed}/7 phases {✅ PASS | ❌ FAIL}
1737
+ 2. **README Coverage:** {final_coverage}% {✅ PASS (100%) | ❌ FAIL (< 100%)}
1738
+ 3. **Phase 2.5 Fixes:** {fixes_completion}% {✅ PASS (100%) | ❌ FAIL (< 100%)}
1739
+ 4. **Phase 3-checkpoint:** {✅ PASSED | ❌ FAILED}
1740
+ 5. **Phase 4-checkpoint:** {✅ PASSED | ❌ FAILED}
1741
+ 6. **Phase 6 Validation:** {✅ PASSED | ❌ FAILED}
1742
+
1743
+ **If ALL 6 hard requirements = ✅: STATUS = ✅ SUCCESS**
1744
+ **If ANY hard requirement = ❌: STATUS = ❌ FAILED**
1745
+
1746
+ ---
1747
+
1748
+ ## Phase Execution Summary
1749
+
1750
+ ### Phase 1: Discovery
1751
+ - **CLAUDE.md files found:** {count}
1752
+ - **Existing READMEs:** {count}
1753
+ - **Missing READMEs:** {count}
1754
+ - **Initial coverage:** {percentage}%
1755
+
1756
+ ### Phase 2: Audit
1757
+ - **Root README inaccuracies:** {count}
1758
+ - **Subdirectory README inaccuracies:** {count}
1759
+ - **Total inaccuracies found:** {total_count}
1760
+
1761
+ ### Phase 2.5: Fix Commitment
1762
+ - **Committed to fix:** {total_count} inaccuracies
1763
+
1764
+ ### Phase 3: Root README Update
1765
+ - **Phase 2.5 fixes applied:** {count}/{total_root_fixes}
1766
+ - **Sections updated:** {list}
1767
+ - **Total edits:** {count}
1768
+
1769
+ ### Phase 3-checkpoint
1770
+ - **Status:** {✅ PASSED | ❌ FAILED}
1771
+
1772
+ ### Phase 4: Subdirectory README Creation
1773
+ - **READMEs created:** {created_count}
1774
+ - **Directories covered:** {list}
1775
+
1776
+ ### Phase 4-checkpoint
1777
+ - **Fresh Glob count:** {count}
1778
+ - **Coverage:** {percentage}%
1779
+ - **Status:** {✅ PASSED | ❌ FAILED}
1780
+
1781
+ ### Phase 5: Existing README Updates
1782
+ - **Subdirectory fixes applied:** {count}/{total_subdirectory_fixes}
1783
+
1784
+ ### Phase 6: Final Validation
1785
+ - **Final Glob count:** {count}
1786
+ - **Final coverage:** {percentage}%
1787
+ - **Status:** {✅ PASSED | ❌ FAILED}
1788
+
1789
+ ---
1790
+
1791
+ ## Phase 2.5 Inaccuracies → Fixes Applied
1792
+
1793
+ **Root README.md Fixes ({count}):**
1794
+
1795
+ 1. ✅ **{Inaccuracy Title}**
1796
+ - **Was (WRONG):** "{text}"
1797
+ - **Now (CORRECT):** "{text}"
1798
+ - **Status:** ✅ FIXED
1799
+
1800
+ {list all root README fixes}
1801
+
1802
+ **Subdirectory README Fixes ({count}):**
1803
+
1804
+ 1. ✅ **{Inaccuracy Title}**
1805
+ - **File:** {directory}/README.md
1806
+ - **Was (WRONG):** "{text}"
1807
+ - **Now (CORRECT):** "{text}"
1808
+ - **Status:** ✅ FIXED
1809
+
1810
+ {list all subdirectory README fixes}
1811
+
1812
+ **Phase 2.5 Completion:** ✅ {fixed_count}/{total_count} inaccuracies fixed ({percentage}%)
1813
+
1814
+ ---
1815
+
1816
+ ## README Coverage Report
1817
+
1818
+ **Total CLAUDE.md Files:** {count}
1819
+ **Directories with READMEs:** {count}/{total} ({percentage}%)
1820
+
1821
+ ### Created READMEs ({created_count} total):
1822
+ - ✅ `{directory1}/README.md` ({line_count} lines)
1823
+ - ✅ `{directory2}/README.md` ({line_count} lines)
1824
+ ...
1825
+
1826
+ ### Updated READMEs ({updated_count} total):
1827
+ - ✅ `README.md` (root) - Fixed {count} inaccuracies
1828
+ - ✅ `{directory}/README.md` - Fixed {count} inaccuracies
1829
+ ...
1830
+
1831
+ ### Existing READMEs (No Changes Needed) ({count} total):
1832
+ - ✅ `{directory}/README.md` - Already accurate
1833
+ ...
1834
+
1835
+ **Coverage:** {percentage}% ({count}/{total} directories)
1836
+ **Expected:** 100% coverage
1837
+
1838
+ ---
1839
+
1840
+ ## Skipped Updates (With Justification)
1841
+
1842
+ {If any Phase 2.5 fixes were skipped, list them here with valid reasons}
1843
+
1844
+ **No skipped updates** ✅
1845
+
1846
+ OR
1847
+
1848
+ 1. ⏭️ **{Inaccuracy}**
1849
+ - **File:** {file}
1850
+ - **Reason:** {valid skip reason}
1851
+ - **Impact:** {describe impact}
1852
+
1853
+ ---
1854
+
1855
+ ## Validation Results
1856
+
1857
+ ### Phase 3-checkpoint (Root README Verification)
1858
+ - **Status:** {✅ PASSED | ❌ FAILED}
1859
+ - **Fixes Applied:** {count}/{total_root_fixes}
1860
+
1861
+ ### Phase 4-checkpoint (Coverage Verification)
1862
+ - **Status:** {✅ PASSED | ❌ FAILED}
1863
+ - **Coverage:** {percentage}%
1864
+ - **Phase 1 vs Fresh Glob Match:** {✅ YES | ❌ NO}
1865
+
1866
+ ### Phase 6 Final Validation
1867
+ - **Status:** {✅ PASSED | ❌ FAILED}
1868
+ - **Final Coverage:** {percentage}%
1869
+ - **Missing READMEs:** {list if any}
1870
+
1871
+ ---
1872
+
1873
+ ## Command Execution Status
1874
+
1875
+ **Hard Requirements Met:** {count}/6
1876
+
1877
+ **Execution Status:** {✅ SUCCESS | ❌ FAILED}
1878
+
1879
+ **If SUCCESS:**
1880
+ ✅ All hard requirements met
1881
+ ✅ 100% README coverage achieved
1882
+ ✅ All inaccuracies fixed
1883
+ ✅ All checkpoints passed
1884
+
1885
+ **If FAILED:**
1886
+ ❌ One or more hard requirements NOT met:
1887
+ - {list failed requirements}
1888
+
1889
+ **Recommendation:** {action user should take}
1890
+
1891
+ ---
1892
+
1893
+ **Report Generated:** {timestamp}
1894
+ **Report Location:** trinity/reports/README-AUDIT-{date}.md
1895
+ ```
1896
+
1897
+ ---
1898
+
1899
+ ## Work Completion Criteria
1900
+
1901
+ **APO's work is considered COMPLETE when:**
1902
+
1903
+ ### Hard Requirements (100% Compliance Required):
1904
+
1905
+ 1. **Phase Execution:** 7/7 phases executed ✅
1906
+ 2. **README Coverage:** 100% (every directory with CLAUDE.md has README.md) ✅
1907
+ 3. **Phase 2.5 Fixes:** 100% of inaccuracies fixed ✅
1908
+ 4. **Phase 3-checkpoint:** PASSED ✅
1909
+ 5. **Phase 4-checkpoint:** PASSED ✅
1910
+ 6. **Phase 6 Validation:** PASSED ✅
1911
+
1912
+ **If ANY hard requirement ≠ ✅: Command status = ❌ FAILED**
1913
+
1914
+ ### Soft Requirements (Best Effort):
1915
+
1916
+ 1. README quality meets documentation standards
1917
+ 2. READMEs use consistent formatting
1918
+ 3. All links in READMEs work
1919
+
1920
+ **Soft requirements can be partially met without affecting SUCCESS status.**
1921
+
1922
+ ---
1923
+
1924
+ ## Success/Failure Determination
1925
+
1926
+ ```python
1927
+ # Hard requirements check
1928
+ hard_req_1 = (phases_executed == 7)
1929
+ hard_req_2 = (final_coverage == 100)
1930
+ hard_req_3 = (phase_2_5_completion == 100)
1931
+ hard_req_4 = (phase_3_checkpoint == "PASSED")
1932
+ hard_req_5 = (phase_4_checkpoint == "PASSED")
1933
+ hard_req_6 = (phase_6_validation == "PASSED")
1934
+
1935
+ all_hard_requirements_met = (
1936
+ hard_req_1 and hard_req_2 and hard_req_3 and
1937
+ hard_req_4 and hard_req_5 and hard_req_6
1938
+ )
1939
+
1940
+ if all_hard_requirements_met:
1941
+ status = "✅ SUCCESS"
1942
+ else:
1943
+ status = "❌ FAILED"
1944
+ # List which requirements failed
1945
+ ```
1946
+
1947
+ **CRITICAL: Status determination uses Phase 6 final validation result, not Phase 4-checkpoint.**
1948
+
1949
+ If Phase 6 validation shows coverage < 100%, status = ❌ FAILED even if Phase 4-checkpoint claimed PASSED.
1950
+
1951
+ ---
1952
+
1953
+ ## Post-Execution Checklist
1954
+
1955
+ **After `/trinity-readme` completes, verify:**
1956
+
1957
+ 1. ✅ Check final report in `trinity/reports/README-AUDIT-{date}.md`
1958
+ 2. ✅ Verify coverage = 100% in report
1959
+ 3. ✅ Verify all Phase 2.5 fixes show "✅ FIXED" status
1960
+ 4. ✅ Verify all checkpoints show "✅ PASSED"
1961
+ 5. ✅ Check "COMMAND EXECUTION STATUS" = "✅ SUCCESS"
1962
+
1963
+ **If status ≠ SUCCESS:**
1964
+ - Review which hard requirements failed
1965
+ - Check missing READMEs list
1966
+ - Re-run command if failures detected
1967
+
1968
+ ---
1969
+
1970
+ **Command Specification Version:** 2.0.0
1971
+ **Last Updated:** 2025-12-27