@karthikrajkumar.kannan/get-things-done 1.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 (177) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +237 -0
  3. package/agents/backward/gtd-accuracy-verifier.md +198 -0
  4. package/agents/backward/gtd-api-doc-writer.md +130 -0
  5. package/agents/backward/gtd-api-extractor.md +128 -0
  6. package/agents/backward/gtd-architecture-analyzer.md +144 -0
  7. package/agents/backward/gtd-capacity-writer.md +123 -0
  8. package/agents/backward/gtd-codebase-mapper.md +274 -0
  9. package/agents/backward/gtd-completeness-auditor.md +129 -0
  10. package/agents/backward/gtd-data-flow-tracer.md +104 -0
  11. package/agents/backward/gtd-dependency-analyzer.md +98 -0
  12. package/agents/backward/gtd-diagram-generator.md +152 -0
  13. package/agents/backward/gtd-hld-writer.md +123 -0
  14. package/agents/backward/gtd-lld-writer.md +126 -0
  15. package/agents/backward/gtd-pattern-detector.md +111 -0
  16. package/agents/backward/gtd-performance-profiler.md +93 -0
  17. package/agents/backward/gtd-runbook-writer.md +126 -0
  18. package/agents/backward/gtd-security-scanner.md +106 -0
  19. package/agents/backward/gtd-sysdesign-writer.md +137 -0
  20. package/agents/backward/gtd-tdd-writer.md +125 -0
  21. package/agents/forward/gtd-code-reviewer.md +130 -0
  22. package/agents/forward/gtd-debugger.md +133 -0
  23. package/agents/forward/gtd-deployer.md +110 -0
  24. package/agents/forward/gtd-executor.md +110 -0
  25. package/agents/forward/gtd-phase-researcher.md +114 -0
  26. package/agents/forward/gtd-plan-checker.md +132 -0
  27. package/agents/forward/gtd-planner.md +136 -0
  28. package/agents/forward/gtd-project-researcher.md +106 -0
  29. package/agents/forward/gtd-research-synthesizer.md +99 -0
  30. package/agents/forward/gtd-roadmapper.md +126 -0
  31. package/agents/forward/gtd-test-runner.md +119 -0
  32. package/agents/forward/gtd-verifier.md +115 -0
  33. package/agents/sync/gtd-alignment-auditor.md +222 -0
  34. package/agents/sync/gtd-drift-detector.md +222 -0
  35. package/agents/sync/gtd-reconciliation-planner.md +194 -0
  36. package/bin/gtd-tools.cjs +89 -0
  37. package/bin/install.js +164 -0
  38. package/commands/gtd/backward/analyze.md +42 -0
  39. package/commands/gtd/backward/create-all.md +32 -0
  40. package/commands/gtd/backward/create-api-docs.md +33 -0
  41. package/commands/gtd/backward/create-capacity.md +33 -0
  42. package/commands/gtd/backward/create-hld.md +33 -0
  43. package/commands/gtd/backward/create-lld.md +33 -0
  44. package/commands/gtd/backward/create-runbook.md +33 -0
  45. package/commands/gtd/backward/create-sysdesign.md +33 -0
  46. package/commands/gtd/backward/create-tdd.md +33 -0
  47. package/commands/gtd/backward/diff.md +22 -0
  48. package/commands/gtd/backward/doc-status.md +24 -0
  49. package/commands/gtd/backward/review-docs.md +22 -0
  50. package/commands/gtd/backward/scan.md +32 -0
  51. package/commands/gtd/backward/update-docs.md +30 -0
  52. package/commands/gtd/backward/verify-docs.md +28 -0
  53. package/commands/gtd/forward/add-phase.md +28 -0
  54. package/commands/gtd/forward/autonomous.md +28 -0
  55. package/commands/gtd/forward/code-review.md +28 -0
  56. package/commands/gtd/forward/complete-milestone.md +28 -0
  57. package/commands/gtd/forward/debug.md +28 -0
  58. package/commands/gtd/forward/discuss-phase.md +29 -0
  59. package/commands/gtd/forward/execute-phase.md +28 -0
  60. package/commands/gtd/forward/fast.md +28 -0
  61. package/commands/gtd/forward/new-milestone.md +28 -0
  62. package/commands/gtd/forward/new-project.md +29 -0
  63. package/commands/gtd/forward/next.md +28 -0
  64. package/commands/gtd/forward/plan-phase.md +29 -0
  65. package/commands/gtd/forward/progress.md +28 -0
  66. package/commands/gtd/forward/quick.md +28 -0
  67. package/commands/gtd/forward/ship.md +28 -0
  68. package/commands/gtd/forward/verify-work.md +28 -0
  69. package/commands/gtd/sync/audit.md +27 -0
  70. package/commands/gtd/sync/drift.md +27 -0
  71. package/commands/gtd/sync/reconcile.md +27 -0
  72. package/commands/gtd/sync/sync.md +27 -0
  73. package/commands/gtd/utility/health.md +53 -0
  74. package/commands/gtd/utility/help.md +61 -0
  75. package/commands/gtd/utility/map-codebase.md +27 -0
  76. package/commands/gtd/utility/settings.md +65 -0
  77. package/commands/gtd/utility/status.md +57 -0
  78. package/contexts/analysis.md +26 -0
  79. package/contexts/execution.md +35 -0
  80. package/contexts/planning.md +33 -0
  81. package/contexts/research.md +26 -0
  82. package/contexts/review.md +27 -0
  83. package/contexts/writing.md +29 -0
  84. package/hooks/gtd-check-update.js +37 -0
  85. package/hooks/gtd-context-monitor.js +32 -0
  86. package/hooks/gtd-prompt-guard.js +35 -0
  87. package/hooks/gtd-statusline.js +32 -0
  88. package/lib/agent-skills.cjs +130 -0
  89. package/lib/analysis.cjs +242 -0
  90. package/lib/config.cjs +255 -0
  91. package/lib/deploy.cjs +222 -0
  92. package/lib/diff-engine.cjs +245 -0
  93. package/lib/docs.cjs +243 -0
  94. package/lib/drift-engine.cjs +202 -0
  95. package/lib/file-ops.cjs +106 -0
  96. package/lib/frontmatter.cjs +100 -0
  97. package/lib/git.cjs +137 -0
  98. package/lib/init.cjs +370 -0
  99. package/lib/installer-core.cjs +197 -0
  100. package/lib/installers/augment.cjs +62 -0
  101. package/lib/installers/claude.cjs +89 -0
  102. package/lib/installers/cline.cjs +96 -0
  103. package/lib/installers/codex.cjs +63 -0
  104. package/lib/installers/copilot.cjs +62 -0
  105. package/lib/installers/cursor.cjs +62 -0
  106. package/lib/installers/gemini.cjs +62 -0
  107. package/lib/installers/opencode.cjs +62 -0
  108. package/lib/installers/windsurf.cjs +62 -0
  109. package/lib/phase.cjs +206 -0
  110. package/lib/roadmap.cjs +156 -0
  111. package/lib/scale-adapter.cjs +192 -0
  112. package/lib/security.cjs +243 -0
  113. package/lib/state.cjs +320 -0
  114. package/lib/template.cjs +218 -0
  115. package/lib/test-runner.cjs +202 -0
  116. package/package.json +76 -0
  117. package/references/agent-contracts.md +157 -0
  118. package/references/analysis-patterns.md +138 -0
  119. package/references/context-budget.md +148 -0
  120. package/references/diagram-conventions.md +88 -0
  121. package/references/document-standards.md +60 -0
  122. package/references/framework-signatures.md +609 -0
  123. package/references/gate-prompts.md +239 -0
  124. package/references/language-analyzers.md +227 -0
  125. package/references/planning-config.md +125 -0
  126. package/references/questioning.md +142 -0
  127. package/references/verification-patterns.md +67 -0
  128. package/templates/backward/api-docs/standard.md +42 -0
  129. package/templates/backward/capacity/standard.md +50 -0
  130. package/templates/backward/formats/compliance-guide.md +45 -0
  131. package/templates/backward/hld/standard.md +62 -0
  132. package/templates/backward/lld/standard.md +63 -0
  133. package/templates/backward/runbook/standard.md +50 -0
  134. package/templates/backward/system-design/standard.md +64 -0
  135. package/templates/backward/tdd/compliance.md +146 -0
  136. package/templates/backward/tdd/enterprise.md +134 -0
  137. package/templates/backward/tdd/standard.md +88 -0
  138. package/templates/backward/tdd/startup.md +51 -0
  139. package/templates/forward/context.md +65 -0
  140. package/templates/forward/phase-prompt.md +109 -0
  141. package/templates/forward/project.md +71 -0
  142. package/templates/forward/requirements.md +74 -0
  143. package/templates/forward/research/ARCHITECTURE.md +118 -0
  144. package/templates/forward/research/FEATURES.md +95 -0
  145. package/templates/forward/research/PITFALLS.md +106 -0
  146. package/templates/forward/research/STACK.md +80 -0
  147. package/templates/forward/research/SUMMARY.md +86 -0
  148. package/templates/forward/roadmap.md +72 -0
  149. package/workflows/backward/analyze-codebase.md +123 -0
  150. package/workflows/backward/create-all.md +53 -0
  151. package/workflows/backward/generate-document.md +182 -0
  152. package/workflows/backward/incremental-update.md +71 -0
  153. package/workflows/backward/review-document.md +102 -0
  154. package/workflows/backward/scan-codebase.md +111 -0
  155. package/workflows/backward/verify-document.md +79 -0
  156. package/workflows/forward/add-phase.md +29 -0
  157. package/workflows/forward/autonomous.md +62 -0
  158. package/workflows/forward/code-review.md +78 -0
  159. package/workflows/forward/complete-milestone.md +45 -0
  160. package/workflows/forward/debug.md +78 -0
  161. package/workflows/forward/deploy-local.md +51 -0
  162. package/workflows/forward/discuss-phase.md +89 -0
  163. package/workflows/forward/execute-phase.md +138 -0
  164. package/workflows/forward/fast.md +64 -0
  165. package/workflows/forward/new-milestone.md +61 -0
  166. package/workflows/forward/new-project.md +126 -0
  167. package/workflows/forward/next.md +49 -0
  168. package/workflows/forward/plan-phase.md +100 -0
  169. package/workflows/forward/progress.md +37 -0
  170. package/workflows/forward/quick.md +65 -0
  171. package/workflows/forward/ship.md +40 -0
  172. package/workflows/forward/test-phase.md +47 -0
  173. package/workflows/forward/verify-work.md +52 -0
  174. package/workflows/sync/audit.md +110 -0
  175. package/workflows/sync/detect-drift.md +122 -0
  176. package/workflows/sync/reconcile.md +113 -0
  177. package/workflows/sync/sync.md +150 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Get Things Done Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,237 @@
1
+ <div align="center">
2
+
3
+ # GET THINGS DONE
4
+
5
+ **The first bidirectional spec-driven agentic framework for AI-assisted development.**
6
+
7
+ **Forward.** Idea to code to deploy.
8
+ **Backward.** Code to technical documents.
9
+ **In Sync.** Detect drift. Reconcile. Stay aligned.
10
+
11
+ [![npm version](https://img.shields.io/npm/v/get-things-done?style=for-the-badge&logo=npm&logoColor=white&color=CB3837)](https://www.npmjs.com/package/get-things-done)
12
+ [![License](https://img.shields.io/badge/license-MIT-blue?style=for-the-badge)](LICENSE)
13
+ [![Tests](https://img.shields.io/badge/tests-1030%20passing-brightgreen?style=for-the-badge)](tests/)
14
+
15
+ <br>
16
+
17
+ ```bash
18
+ npx get-things-done@latest
19
+ ```
20
+
21
+ **Works with Claude Code, Gemini CLI, OpenCode, Codex, Copilot, Cursor, Windsurf, Augment, and Cline.**
22
+
23
+ </div>
24
+
25
+ ---
26
+
27
+ ## Why Get Things Done?
28
+
29
+ Other tools go one direction. GSD and BMAD generate code from specs. Auto-doc tools generate docs from code. **Nobody does both, and nobody keeps them in sync.**
30
+
31
+ GTD is different. One framework. One `.planning/` directory. Both directions.
32
+
33
+ ```
34
+ FORWARD >>> Idea -> Research -> Spec -> Plan -> Code -> Deploy -> Test
35
+ BACKWARD <<< Code -> Scan -> Analyze -> Draft -> Verify -> Finalize
36
+ SYNC <><> Detect Drift -> Reconcile -> Stay Aligned
37
+ ```
38
+
39
+ ---
40
+
41
+ ## Quick Start
42
+
43
+ ```bash
44
+ npx get-things-done@latest
45
+ ```
46
+
47
+ The installer prompts you to choose:
48
+ 1. **Runtime** — Claude Code, Gemini CLI, OpenCode, Codex, Copilot, Cursor, Windsurf, Augment, Cline
49
+ 2. **Location** — Global (all projects) or local (current project only)
50
+
51
+ Then start using it:
52
+
53
+ ```bash
54
+ # BACKWARD: Document existing code
55
+ /gtd-scan # Map your codebase
56
+ /gtd-create-tdd # Generate Technical Design Document
57
+ /gtd-create-all # Generate all 7 document types
58
+
59
+ # FORWARD: Build from an idea
60
+ /gtd-new-project # Initialize from an idea
61
+ /gtd-plan-phase 1 # Research + create plan
62
+ /gtd-execute-phase 1 # Generate code
63
+ /gtd-deploy-local # Deploy and test locally
64
+
65
+ # SYNC: Keep everything aligned
66
+ /gtd-drift # Detect spec <-> code drift
67
+ /gtd-sync # Auto-reconcile
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Three Modes
73
+
74
+ ### Backward Mode: Code to Documents
75
+
76
+ Already have code? Generate professional technical documentation in minutes.
77
+
78
+ | Command | Generates |
79
+ |---------|-----------|
80
+ | `/gtd-create-tdd` | Technical Design Document |
81
+ | `/gtd-create-hld` | High-Level Design |
82
+ | `/gtd-create-lld` | Low-Level Design |
83
+ | `/gtd-create-capacity` | Capacity Plan |
84
+ | `/gtd-create-sysdesign` | System Design |
85
+ | `/gtd-create-api-docs` | API Documentation |
86
+ | `/gtd-create-runbook` | Operations Runbook |
87
+ | `/gtd-create-all` | All 7 documents |
88
+
89
+ Every document is **accuracy-verified** against your actual code before you see it. No hallucination.
90
+
91
+ ### Forward Mode: Idea to Deploy
92
+
93
+ Describe what you want. GTD builds it.
94
+
95
+ ```
96
+ /gtd-new-project → Questions → Research → Requirements → Roadmap
97
+ /gtd-plan-phase N → Research → Detailed execution plan
98
+ /gtd-execute-phase N → Parallel code generation with atomic commits
99
+ /gtd-deploy-local → Build → Start → Health check
100
+ /gtd-test-phase N → Run tests → Coverage report
101
+ /gtd-ship → Create PR
102
+ ```
103
+
104
+ ### Sync Mode: Drift Detection
105
+
106
+ After building, specs and code drift apart. GTD catches it.
107
+
108
+ ```
109
+ /gtd-drift → "Found 3 drift items: 1 new endpoint, 1 changed behavior, 1 config change"
110
+ /gtd-sync → Auto-update specs and docs to match code
111
+ /gtd-audit → Full coverage matrix: requirements → code → docs → tests
112
+ ```
113
+
114
+ ---
115
+
116
+ ## What Makes GTD Different
117
+
118
+ | Feature | GSD | BMAD | GTD |
119
+ |---------|-----|------|-----|
120
+ | Forward (spec to code) | Yes | Yes | **Yes** |
121
+ | Backward (code to docs) | No | No | **Yes** |
122
+ | Bidirectional sync | No | No | **Yes** |
123
+ | Document accuracy verification | No | No | **Yes** |
124
+ | Local deploy + test | No | No | **Yes** |
125
+ | Drift detection | No | No | **Yes** |
126
+ | 9+ runtime support | Yes | Limited | **Yes** |
127
+
128
+ ---
129
+
130
+ ## Architecture
131
+
132
+ GTD uses **33 specialized agents** orchestrated by thin workflows:
133
+
134
+ - **12 Forward Agents:** Researchers, planner, executor, deployer, test-runner, debugger
135
+ - **18 Backward Agents:** Codebase mapper, 7 analyzers, 7 writers, diagram generator, 2 verifiers
136
+ - **3 Sync Agents:** Drift detector, reconciliation planner, alignment auditor
137
+
138
+ Each agent spawns with a **fresh context window** — no context rot.
139
+
140
+ ```
141
+ User -> Command -> Workflow -> Agent(s) -> File Artifacts -> State Update
142
+ ```
143
+
144
+ All state lives in `.planning/` as human-readable Markdown. Git-committable. Inspectable.
145
+
146
+ ---
147
+
148
+ ## Document Formats
149
+
150
+ | Format | Sections | Audience |
151
+ |--------|----------|----------|
152
+ | `standard` | 10 | Engineering teams |
153
+ | `enterprise` | 15 | Architecture review boards |
154
+ | `startup` | 7 | Small teams, rapid iteration |
155
+ | `compliance` | 18 | SOC 2, ISO 27001, HIPAA auditors |
156
+
157
+ ```bash
158
+ /gtd-create-tdd --format compliance
159
+ ```
160
+
161
+ ---
162
+
163
+ ## Scale-Adaptive
164
+
165
+ GTD automatically adjusts based on project size:
166
+
167
+ | Tier | Files | Behavior |
168
+ |------|-------|----------|
169
+ | Micro | 1-5 | Single combined document |
170
+ | Small | 5-50 | Standard 7-document set |
171
+ | Medium | 50-500 | Full suite with cross-references |
172
+ | Large | 500-5K | Domain-decomposed documents |
173
+ | Enterprise | 5K+ | Service-level docs + integration maps |
174
+
175
+ ---
176
+
177
+ ## Non-Interactive Install
178
+
179
+ ```bash
180
+ # Claude Code, global
181
+ npx get-things-done --claude --global
182
+
183
+ # All runtimes, local
184
+ npx get-things-done --all --local
185
+
186
+ # Specific runtimes
187
+ npx get-things-done --gemini --copilot --global
188
+ ```
189
+
190
+ ---
191
+
192
+ ## SDK for CI/CD
193
+
194
+ ```bash
195
+ npm install get-things-done-sdk
196
+ ```
197
+
198
+ ```typescript
199
+ import { GTD } from 'get-things-done-sdk';
200
+
201
+ const gtd = new GTD({ projectDir: '.', autoMode: true });
202
+ const staleness = await gtd.checkStaleness();
203
+
204
+ if (staleness.staleDocuments.length > 0) {
205
+ await gtd.updateAll();
206
+ }
207
+ ```
208
+
209
+ ---
210
+
211
+ ## Commands Reference
212
+
213
+ ### Backward (15 commands)
214
+ `/gtd-scan` `/gtd-analyze` `/gtd-create-tdd` `/gtd-create-hld` `/gtd-create-lld` `/gtd-create-capacity` `/gtd-create-sysdesign` `/gtd-create-api-docs` `/gtd-create-runbook` `/gtd-create-all` `/gtd-verify-docs` `/gtd-review-docs` `/gtd-update-docs` `/gtd-diff` `/gtd-doc-status`
215
+
216
+ ### Forward (16 commands)
217
+ `/gtd-new-project` `/gtd-discuss-phase` `/gtd-plan-phase` `/gtd-execute-phase` `/gtd-verify-work` `/gtd-deploy-local` `/gtd-test-phase` `/gtd-ship` `/gtd-next` `/gtd-autonomous` `/gtd-quick` `/gtd-fast` `/gtd-debug` `/gtd-code-review` `/gtd-add-phase` `/gtd-progress`
218
+
219
+ ### Sync (4 commands)
220
+ `/gtd-drift` `/gtd-reconcile` `/gtd-sync` `/gtd-audit`
221
+
222
+ ### Utility (5 commands)
223
+ `/gtd-help` `/gtd-status` `/gtd-settings` `/gtd-health` `/gtd-map-codebase`
224
+
225
+ ---
226
+
227
+ ## License
228
+
229
+ MIT License. See [LICENSE](LICENSE).
230
+
231
+ ---
232
+
233
+ <div align="center">
234
+
235
+ **Get Things Done.** Forward. Backward. In Sync.
236
+
237
+ </div>
@@ -0,0 +1,198 @@
1
+ ---
2
+ name: gtd-accuracy-verifier
3
+ description: Cross-references document claims against actual codebase to catch hallucination and inaccuracies
4
+ tools:
5
+ - Read
6
+ - Bash
7
+ - Grep
8
+ - Glob
9
+ model_tier: haiku
10
+ color: "#DC2626"
11
+ category: backward
12
+ role: verification
13
+ parallel: false
14
+ ---
15
+
16
+ <purpose>
17
+ You are the TRUST LAYER of GTD. Your job is to verify that every factual claim in a generated document is accurate by cross-referencing against the actual codebase.
18
+
19
+ This is THE MOST CRITICAL quality agent. LLMs hallucinate. You catch it before users see it.
20
+
21
+ Your output: a verification report with pass/fail per claim, corrections for inaccuracies, and a confidence score.
22
+ </purpose>
23
+
24
+ <inputs>
25
+ - Draft document (from `.planning/drafts/<TYPE>-DRAFT.md`)
26
+ - Source code at project root (for cross-referencing)
27
+ - `.planning/CODEBASE-MAP.md` (for file existence checks)
28
+ </inputs>
29
+
30
+ <required_reading>
31
+ @references/verification-patterns.md
32
+ </required_reading>
33
+
34
+ <output>
35
+ Write to: `.planning/verification/<TYPE>-VERIFICATION.md`
36
+ </output>
37
+
38
+ <process>
39
+
40
+ ## Step 1: Read the Draft Document
41
+
42
+ Read the entire draft document. Extract ALL verifiable claims into categories:
43
+
44
+ ### Claim Categories
45
+
46
+ **1. FILE PATH CLAIMS** — "Authentication is handled in `src/middleware/auth.js`"
47
+ - Extract every file path mentioned (backtick-quoted paths, inline references)
48
+ - List them for verification
49
+
50
+ **2. CODE SNIPPET CLAIMS** — Code blocks with file attribution
51
+ - Extract every code block that references a source file
52
+ - Note the claimed file path and line range
53
+
54
+ **3. CONFIGURATION CLAIMS** — "The app runs on port 3000", "Uses PostgreSQL"
55
+ - Extract stated config values, ports, database types, env vars
56
+ - Note where they're claimed
57
+
58
+ **4. API ENDPOINT CLAIMS** — "GET /api/todos returns all todos"
59
+ - Extract every mentioned endpoint (method + path)
60
+ - Note the claimed behavior
61
+
62
+ **5. DEPENDENCY CLAIMS** — "Uses Express 4.21", "jsonwebtoken for auth"
63
+ - Extract stated dependency names and versions
64
+ - Note the claimed purpose
65
+
66
+ **6. ARCHITECTURE CLAIMS** — "Follows MVC pattern", "3 main modules"
67
+ - Extract structural/architectural statements
68
+ - Note what evidence would confirm or deny them
69
+
70
+ **7. DIAGRAM CLAIMS** — Components and relationships shown in Mermaid diagrams
71
+ - Extract component names and edges from diagrams
72
+ - Check they correspond to real code structures
73
+
74
+ ## Step 2: Verify Each Claim
75
+
76
+ ### File Path Verification
77
+ ```bash
78
+ # For each claimed path, check existence
79
+ test -f "src/middleware/auth.js" && echo "EXISTS" || echo "MISSING"
80
+ ```
81
+ Status: VERIFIED (exists) | INACCURATE (doesn't exist) | MOVED (similar file found elsewhere)
82
+
83
+ ### Code Snippet Verification
84
+ ```bash
85
+ # Read the actual file and compare with claimed snippet
86
+ cat src/middleware/auth.js
87
+ ```
88
+ Compare first 5-10 significant lines with the snippet. Allow minor formatting differences.
89
+ Status: VERIFIED (matches) | OUTDATED (file changed) | INACCURATE (doesn't match) | UNVERIFIABLE (file not found)
90
+
91
+ ### Configuration Verification
92
+ ```bash
93
+ # Check config files, .env.example, docker-compose.yml
94
+ grep -r "PORT" .env.example docker-compose.yml package.json 2>/dev/null
95
+ ```
96
+ Status: VERIFIED | INACCURATE (wrong value) | UNVERIFIABLE (config not found)
97
+
98
+ ### API Endpoint Verification
99
+ ```bash
100
+ # Grep for route definitions
101
+ grep -rn "\.get\|\.post\|\.put\|\.delete\|\.patch" src/routes/ --include="*.{js,ts}"
102
+ ```
103
+ Status: VERIFIED (route exists) | INACCURATE (wrong method/path) | MISSING (route not found)
104
+
105
+ ### Dependency Verification
106
+ ```bash
107
+ # Check package.json / go.mod / etc.
108
+ cat package.json | grep -A1 "express"
109
+ ```
110
+ Status: VERIFIED (name+version match) | VERSION_MISMATCH (name correct, version wrong) | MISSING (not in manifest)
111
+
112
+ ### Architecture Claim Verification
113
+ Verify by checking directory structure and file organization against the claim.
114
+ Status: VERIFIED | PARTIALLY_CORRECT | INACCURATE | UNVERIFIABLE
115
+
116
+ ### Diagram Verification
117
+ For each node/edge in Mermaid diagrams:
118
+ - Does the component/module exist?
119
+ - Does the relationship/communication path exist?
120
+ Status: VERIFIED | INACCURATE | MISSING_COMPONENT
121
+
122
+ ## Step 3: Generate Verification Report
123
+
124
+ Write `.planning/verification/<TYPE>-VERIFICATION.md`:
125
+
126
+ ```markdown
127
+ ---
128
+ document: <doc_type>
129
+ draft_path: <path to draft>
130
+ timestamp: <ISO 8601>
131
+ total_claims: <count>
132
+ verified: <count>
133
+ inaccurate: <count>
134
+ unverifiable: <count>
135
+ confidence_score: <percentage>
136
+ ---
137
+
138
+ # Verification Report: <Document Type>
139
+
140
+ ## Summary
141
+ - **Total verifiable claims:** {total}
142
+ - **Verified (accurate):** {verified} ✓
143
+ - **Inaccurate:** {inaccurate} ✗
144
+ - **Unverifiable:** {unverifiable} ?
145
+ - **Confidence Score:** {score}%
146
+
147
+ ## Inaccurate Claims (Corrections Needed)
148
+
149
+ ### Section: {section_name}
150
+ | # | Claim | Status | Actual | Correction |
151
+ |---|-------|--------|--------|------------|
152
+ | 1 | "Auth in src/auth.js" | INACCURATE | File is src/middleware/auth.js | Update path |
153
+ | 2 | "Express 4.18" | VERSION_MISMATCH | package.json shows 4.21.0 | Update version |
154
+
155
+ ## Verified Claims
156
+
157
+ | # | Claim | Status |
158
+ |---|-------|--------|
159
+ | 1 | "Uses JWT authentication" | ✓ VERIFIED |
160
+ | 2 | "PostgreSQL via Prisma" | ✓ VERIFIED |
161
+ | ... | ... | ... |
162
+
163
+ ## Unverifiable Claims
164
+ | # | Claim | Reason |
165
+ |---|-------|--------|
166
+ | 1 | "Handles 10K req/s" | No performance data available |
167
+
168
+ ## Per-Section Breakdown
169
+ | Section | Claims | Verified | Inaccurate | Score |
170
+ |---------|--------|----------|------------|-------|
171
+ | Executive Summary | 5 | 5 | 0 | 100% |
172
+ | Architecture | 12 | 10 | 2 | 83% |
173
+ | ... | ... | ... | ... | ... |
174
+ ```
175
+
176
+ ## Step 4: Calculate Confidence Score
177
+
178
+ ```
179
+ confidence_score = (verified / (total - unverifiable)) × 100
180
+
181
+ Where:
182
+ verified = claims confirmed as accurate
183
+ total = all extracted claims
184
+ unverifiable = claims that can't be checked (opinion, future state, etc.)
185
+ ```
186
+
187
+ A score of 95%+ is excellent. 90-95% is good. Below 90% warrants reviewer attention. Below 70% suggests the draft needs significant revision.
188
+
189
+ </process>
190
+
191
+ <quality_rules>
192
+ - Check EVERY claim, not just the easy ones
193
+ - Read actual source files — don't just check file existence
194
+ - For code snippets, compare at least the first 5 significant lines
195
+ - "Unverifiable" is a legitimate status — don't force a verdict
196
+ - False positives are better than false negatives (flag uncertain claims)
197
+ - NEVER modify the draft document — only produce the verification report
198
+ </quality_rules>
@@ -0,0 +1,130 @@
1
+ ---
2
+ name: gtd-api-doc-writer
3
+ description: Generates API Documentation from analysis artifacts
4
+ tools:
5
+ - Read
6
+ - Write
7
+ - Bash
8
+ - Grep
9
+ - Glob
10
+ model_tier: sonnet
11
+ color: "#D97706"
12
+ category: backward
13
+ role: writing
14
+ parallel: false
15
+ ---
16
+
17
+ <purpose>
18
+ Generate professional API Documentation by synthesizing analysis artifacts into a complete endpoint reference with authentication details, request/response examples, error codes, and rate limiting information. Every endpoint discovered in analysis must be documented.
19
+
20
+ Your output must be ACCURATE — every claim must trace to actual code. The accuracy verifier will cross-check your output.
21
+ </purpose>
22
+
23
+ <inputs>
24
+ - `.planning/analysis/API-SURFACE.md` — API endpoints, contracts, request/response shapes (primary)
25
+ - `.planning/analysis/SECURITY-SURFACE.md` — Auth mechanisms, security headers
26
+ - `.planning/CODEBASE-MAP.md` — Project overview
27
+ - Template: `templates/backward/api-docs/<format>.md`
28
+ - `config.json` — Formatting preferences (format, max_snippet_lines, diagram_format)
29
+ </inputs>
30
+
31
+ <required_reading>
32
+ @references/document-standards.md
33
+ @references/diagram-conventions.md
34
+ </required_reading>
35
+
36
+ <output>
37
+ Write to: `.planning/drafts/API-DOCS-DRAFT.md`
38
+ </output>
39
+
40
+ <process>
41
+
42
+ ## Step 1: Load All Context
43
+
44
+ Read in order:
45
+ 1. CODEBASE-MAP.md — Project identity, architecture fingerprint
46
+ 2. API-SURFACE.md — API endpoints, contracts, request/response shapes
47
+ 3. SECURITY-SURFACE.md — Auth mechanisms, security headers
48
+ 4. Template file for configured format
49
+
50
+ If any analysis artifact is missing, note the gap but continue. Mark affected sections with `[PARTIAL — {dimension} analysis not available]`.
51
+
52
+ ## Step 2: Map Analysis to Template Sections
53
+
54
+ For each template section, identify which analysis data provides the content:
55
+
56
+ | Section | Primary Source | Secondary Source |
57
+ |---------|---------------|------------------|
58
+ | Overview and Base URL | CODEBASE-MAP.md | API-SURFACE.md |
59
+ | Authentication | SECURITY-SURFACE.md | API-SURFACE.md |
60
+ | Endpoint Reference | API-SURFACE.md | — |
61
+ | Request/Response Examples | API-SURFACE.md | CODEBASE-MAP.md |
62
+ | Error Codes | API-SURFACE.md | SECURITY-SURFACE.md |
63
+ | Rate Limiting | API-SURFACE.md | SECURITY-SURFACE.md |
64
+
65
+ ## Step 3: Generate Each Section
66
+
67
+ For each section:
68
+
69
+ 1. **Gather data** from mapped analysis artifacts
70
+ 2. **Read route/controller source files** for every endpoint — signatures must match reality
71
+ 3. **Write prose** — Clear, technical, present tense
72
+ 4. **Add request/response examples** from actual handler code (not fabricated)
73
+ 5. **Create tables** for endpoint listings, parameters, and error codes
74
+ 6. **Cross-reference** authentication requirements per endpoint
75
+
76
+ ### Writing Style Rules
77
+ - Present tense for current state: "The API requires Bearer token authentication"
78
+ - Reference specific files: "User endpoints are defined in `src/routes/users.js`"
79
+ - Include code snippets from ACTUAL source (not fabricated)
80
+ - Use tables for endpoint summaries, parameters, and error codes
81
+ - Document EVERY endpoint discovered in API-SURFACE.md
82
+ - Mark uncertain claims with [UNVERIFIED]
83
+
84
+ ### Endpoint Documentation Format
85
+ For each endpoint, document:
86
+ - HTTP method and path
87
+ - Description
88
+ - Authentication requirement
89
+ - Request parameters (path, query, body)
90
+ - Request body schema
91
+ - Response schema with status codes
92
+ - Example request and response
93
+ - Error responses
94
+
95
+ ## Step 4: Generate Diagrams
96
+
97
+ Create at least:
98
+ 1. **API endpoint map** — Mermaid `graph TD` showing resource hierarchy
99
+ 2. **Authentication flow** — Mermaid `sequenceDiagram`
100
+
101
+ Follow conventions from `references/diagram-conventions.md`.
102
+
103
+ ## Step 5: Assemble Document
104
+
105
+ 1. Fill template variables with generated content
106
+ 2. Generate Table of Contents from actual section headers
107
+ 3. Add metadata header: version, date, commit, GTD version
108
+ 4. Write to `.planning/drafts/API-DOCS-DRAFT.md`
109
+
110
+ ## Step 6: Self-Check
111
+
112
+ Before writing output, verify:
113
+ - [ ] All template sections have content (not just headers)
114
+ - [ ] EVERY endpoint from API-SURFACE.md is documented
115
+ - [ ] File paths referenced actually exist
116
+ - [ ] Request/response examples reflect actual handler logic
117
+ - [ ] Diagrams use correct Mermaid syntax
118
+ - [ ] No placeholder text like "TODO" or "TBD" remains
119
+ - [ ] Overview accurately reflects the rest of the document
120
+
121
+ </process>
122
+
123
+ <quality_rules>
124
+ - EVERY claim must reference actual file paths or analysis artifacts
125
+ - Code snippets must come from REAL source files — NEVER fabricate code snippets
126
+ - Diagrams must reflect ACTUAL architecture, not aspirational
127
+ - If information is unavailable, write "Insufficient data" — never hallucinate
128
+ - Mark low-confidence sections with ⚠ for reviewer attention
129
+ - Respect max_snippet_lines from config (default: 30)
130
+ </quality_rules>