wtf-p 0.3.0 → 0.5.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 (183) hide show
  1. package/README.md +146 -208
  2. package/bin/commands/doctor.js +88 -2
  3. package/bin/commands/install-logic.js +127 -36
  4. package/bin/commands/status.js +22 -4
  5. package/bin/commands/update.js +5 -4
  6. package/bin/install.js +66 -26
  7. package/bin/lib/analyze-impact.js +105 -0
  8. package/bin/lib/bib-format.js +161 -0
  9. package/bin/lib/bib-index.js +104 -0
  10. package/bin/lib/checkpoint.js +183 -0
  11. package/bin/lib/citation-fetcher.js +299 -0
  12. package/bin/lib/citation-ranker.js +133 -0
  13. package/bin/lib/context-primer.js +214 -0
  14. package/bin/lib/manifest.js +80 -2
  15. package/bin/lib/scholar-lookup.js +188 -0
  16. package/bin/lib/semantic-scholar.js +184 -0
  17. package/bin/lib/utils.js +22 -1
  18. package/bin/uninstall.js +270 -111
  19. package/core/write-the-f-paper/references/agent-model-matrix.md +62 -0
  20. package/core/write-the-f-paper/references/checkpoints.md +160 -9
  21. package/core/write-the-f-paper/references/context-fidelity.md +153 -0
  22. package/core/write-the-f-paper/references/deviation-rules.md +150 -0
  23. package/core/write-the-f-paper/references/git-integration.md +80 -0
  24. package/core/write-the-f-paper/references/orchestrator-pattern.md +167 -0
  25. package/core/write-the-f-paper/references/planning-config.md +135 -0
  26. package/core/write-the-f-paper/references/ui-brand.md +186 -0
  27. package/core/write-the-f-paper/templates/UAT.md +80 -0
  28. package/core/write-the-f-paper/templates/base-prefs.yaml +42 -0
  29. package/core/write-the-f-paper/templates/config.json +31 -5
  30. package/core/write-the-f-paper/workflows/create-outline.wcn.md +1 -1
  31. package/core/write-the-f-paper/workflows/execute-outline.md +163 -0
  32. package/core/write-the-f-paper/workflows/execute-outline.wcn.md +73 -0
  33. package/core/write-the-f-paper/workflows/execute-section.wcn.md +141 -169
  34. package/core/write-the-f-paper/workflows/plan-section.wcn.md +96 -103
  35. package/core/write-the-f-paper/workflows/research-gap.md +27 -3
  36. package/core/write-the-f-paper/workflows/research-gap.wcn.md +18 -1
  37. package/core/write-the-f-paper/workflows/verify-work.md +251 -0
  38. package/core/write-the-f-paper/workflows/verify-work.wcn.md +74 -0
  39. package/package.json +19 -7
  40. package/vendors/claude/.claude-plugin/plugin.json +2 -2
  41. package/vendors/claude/agents/wtfp/argument-verifier.md +189 -0
  42. package/vendors/claude/agents/wtfp/citation-expert.md +45 -0
  43. package/vendors/claude/agents/wtfp/citation-formatter.md +42 -0
  44. package/vendors/claude/agents/wtfp/coherence-checker.md +167 -0
  45. package/vendors/claude/agents/wtfp/outliner.md +259 -0
  46. package/vendors/claude/agents/wtfp/plan-checker.md +249 -0
  47. package/vendors/claude/agents/wtfp/prose-polisher.md +166 -0
  48. package/vendors/claude/agents/wtfp/research-synthesizer.md +215 -0
  49. package/vendors/claude/agents/wtfp/section-planner.md +364 -0
  50. package/vendors/claude/agents/wtfp/section-reviewer.md +182 -0
  51. package/vendors/claude/agents/wtfp/section-writer.md +312 -0
  52. package/vendors/claude/commands/wtfp/add-todo.md +108 -0
  53. package/vendors/claude/commands/wtfp/analyze-bib.md +60 -249
  54. package/vendors/claude/commands/wtfp/audit-milestone.md +286 -0
  55. package/vendors/claude/commands/wtfp/check-refs.md +60 -131
  56. package/vendors/claude/commands/wtfp/check-todos.md +152 -0
  57. package/vendors/claude/commands/wtfp/checkpoint.md +105 -0
  58. package/vendors/claude/commands/wtfp/contribute.md +1 -1
  59. package/vendors/claude/commands/wtfp/create-outline.md +109 -195
  60. package/vendors/claude/commands/wtfp/create-poster.md +1 -1
  61. package/vendors/claude/commands/wtfp/create-slides.md +1 -1
  62. package/vendors/claude/commands/wtfp/discuss-section.md +1 -1
  63. package/vendors/claude/commands/wtfp/execute-outline.md +257 -0
  64. package/vendors/claude/commands/wtfp/export-latex.md +1 -1
  65. package/vendors/claude/commands/wtfp/help.md +174 -280
  66. package/vendors/claude/commands/wtfp/insert-section.md +1 -1
  67. package/vendors/claude/commands/wtfp/list-assumptions.md +1 -1
  68. package/vendors/claude/commands/wtfp/map-project.md +35 -124
  69. package/vendors/claude/commands/wtfp/new-paper.md +88 -362
  70. package/vendors/claude/commands/wtfp/pause-writing.md +1 -1
  71. package/vendors/claude/commands/wtfp/plan-milestone-gaps.md +255 -0
  72. package/vendors/claude/commands/wtfp/plan-revision.md +1 -1
  73. package/vendors/claude/commands/wtfp/plan-section.md +165 -190
  74. package/vendors/claude/commands/wtfp/polish-prose.md +66 -118
  75. package/vendors/claude/commands/wtfp/progress.md +82 -254
  76. package/vendors/claude/commands/wtfp/quick.md +107 -0
  77. package/vendors/claude/commands/wtfp/remove-section.md +1 -1
  78. package/vendors/claude/commands/wtfp/report-bug.md +1 -1
  79. package/vendors/claude/commands/wtfp/request-feature.md +1 -1
  80. package/vendors/claude/commands/wtfp/research-gap.md +138 -151
  81. package/vendors/claude/commands/wtfp/resume-writing.md +1 -1
  82. package/vendors/claude/commands/wtfp/review-section.md +55 -333
  83. package/vendors/claude/commands/wtfp/settings.md +197 -0
  84. package/vendors/claude/commands/wtfp/submit-milestone.md +248 -99
  85. package/vendors/claude/commands/wtfp/update.md +112 -0
  86. package/vendors/claude/commands/wtfp/verify-work.md +254 -0
  87. package/vendors/claude/commands/wtfp/write-section.md +144 -180
  88. package/vendors/claude/mcp/research-server/package.json +13 -0
  89. package/vendors/claude/mcp/research-server/src/index.js +133 -0
  90. package/vendors/gemini/agents/wtfp/argument-verifier.md +184 -0
  91. package/vendors/gemini/agents/wtfp/citation-expert.md +41 -0
  92. package/vendors/gemini/agents/wtfp/citation-formatter.md +38 -0
  93. package/vendors/gemini/agents/wtfp/coherence-checker.md +162 -0
  94. package/vendors/gemini/agents/wtfp/outliner.md +252 -0
  95. package/vendors/gemini/agents/wtfp/plan-checker.md +244 -0
  96. package/vendors/gemini/agents/wtfp/prose-polisher.md +158 -0
  97. package/vendors/gemini/agents/wtfp/research-synthesizer.md +205 -0
  98. package/vendors/gemini/agents/wtfp/section-planner.md +355 -0
  99. package/vendors/gemini/agents/wtfp/section-reviewer.md +175 -0
  100. package/vendors/gemini/agents/wtfp/section-writer.md +304 -0
  101. package/vendors/gemini/commands/wtfp/add-todo.toml +102 -0
  102. package/vendors/gemini/commands/wtfp/analyze-bib.toml +126 -0
  103. package/vendors/gemini/commands/wtfp/audit-milestone.toml +278 -0
  104. package/vendors/gemini/commands/wtfp/check-refs.toml +123 -0
  105. package/vendors/gemini/commands/wtfp/check-todos.toml +145 -0
  106. package/vendors/gemini/commands/wtfp/checkpoint.toml +96 -0
  107. package/vendors/gemini/commands/wtfp/contribute.toml +269 -0
  108. package/vendors/gemini/commands/wtfp/create-outline.toml +180 -0
  109. package/vendors/gemini/commands/wtfp/create-poster.toml +36 -0
  110. package/vendors/gemini/commands/wtfp/create-slides.toml +35 -0
  111. package/vendors/gemini/commands/wtfp/discuss-section.toml +62 -0
  112. package/vendors/gemini/commands/wtfp/execute-outline.toml +247 -0
  113. package/vendors/gemini/commands/wtfp/export-latex.toml +209 -0
  114. package/vendors/gemini/commands/wtfp/help.toml +184 -0
  115. package/vendors/gemini/commands/wtfp/insert-section.toml +123 -0
  116. package/vendors/gemini/commands/wtfp/list-assumptions.toml +104 -0
  117. package/vendors/gemini/commands/wtfp/map-project.toml +99 -0
  118. package/vendors/gemini/commands/wtfp/new-paper.toml +160 -0
  119. package/vendors/gemini/commands/wtfp/pause-writing.toml +140 -0
  120. package/vendors/gemini/commands/wtfp/plan-milestone-gaps.toml +249 -0
  121. package/vendors/gemini/commands/wtfp/plan-revision.toml +171 -0
  122. package/vendors/gemini/commands/wtfp/plan-section.toml +212 -0
  123. package/vendors/gemini/commands/wtfp/polish-prose.toml +114 -0
  124. package/vendors/gemini/commands/wtfp/progress.toml +145 -0
  125. package/vendors/gemini/commands/wtfp/quick.toml +96 -0
  126. package/vendors/gemini/commands/wtfp/remove-section.toml +140 -0
  127. package/vendors/gemini/commands/wtfp/report-bug.toml +126 -0
  128. package/vendors/gemini/commands/wtfp/request-feature.toml +155 -0
  129. package/vendors/gemini/commands/wtfp/research-gap.toml +214 -0
  130. package/vendors/gemini/commands/wtfp/resume-writing.toml +136 -0
  131. package/vendors/gemini/commands/wtfp/review-section.toml +121 -0
  132. package/vendors/gemini/commands/wtfp/settings.toml +191 -0
  133. package/vendors/gemini/commands/wtfp/submit-milestone.toml +351 -0
  134. package/vendors/gemini/commands/wtfp/update.toml +107 -0
  135. package/vendors/gemini/commands/wtfp/verify-work.toml +245 -0
  136. package/vendors/gemini/commands/wtfp/write-section.toml +228 -0
  137. package/vendors/opencode/agents/wtfp/argument-verifier.md +184 -0
  138. package/vendors/opencode/agents/wtfp/citation-expert.md +41 -0
  139. package/vendors/opencode/agents/wtfp/citation-formatter.md +38 -0
  140. package/vendors/opencode/agents/wtfp/coherence-checker.md +162 -0
  141. package/vendors/opencode/agents/wtfp/outliner.md +252 -0
  142. package/vendors/opencode/agents/wtfp/plan-checker.md +244 -0
  143. package/vendors/opencode/agents/wtfp/prose-polisher.md +158 -0
  144. package/vendors/opencode/agents/wtfp/research-synthesizer.md +205 -0
  145. package/vendors/opencode/agents/wtfp/section-planner.md +355 -0
  146. package/vendors/opencode/agents/wtfp/section-reviewer.md +175 -0
  147. package/vendors/opencode/agents/wtfp/section-writer.md +304 -0
  148. package/vendors/opencode/commands/wtfp/add-todo.md +103 -0
  149. package/vendors/opencode/commands/wtfp/analyze-bib.md +127 -0
  150. package/vendors/opencode/commands/wtfp/audit-milestone.md +279 -0
  151. package/vendors/opencode/commands/wtfp/check-refs.md +124 -0
  152. package/vendors/opencode/commands/wtfp/check-todos.md +146 -0
  153. package/vendors/opencode/commands/wtfp/checkpoint.md +97 -0
  154. package/vendors/opencode/commands/wtfp/contribute.md +266 -0
  155. package/vendors/opencode/commands/wtfp/create-outline.md +181 -0
  156. package/vendors/opencode/commands/wtfp/create-poster.md +37 -0
  157. package/vendors/opencode/commands/wtfp/create-slides.md +36 -0
  158. package/vendors/opencode/commands/wtfp/discuss-section.md +63 -0
  159. package/vendors/opencode/commands/wtfp/execute-outline.md +248 -0
  160. package/vendors/opencode/commands/wtfp/export-latex.md +210 -0
  161. package/vendors/opencode/commands/wtfp/help.md +185 -0
  162. package/vendors/opencode/commands/wtfp/insert-section.md +124 -0
  163. package/vendors/opencode/commands/wtfp/list-assumptions.md +105 -0
  164. package/vendors/opencode/commands/wtfp/map-project.md +100 -0
  165. package/vendors/opencode/commands/wtfp/new-paper.md +161 -0
  166. package/vendors/opencode/commands/wtfp/pause-writing.md +141 -0
  167. package/vendors/opencode/commands/wtfp/plan-milestone-gaps.md +250 -0
  168. package/vendors/opencode/commands/wtfp/plan-revision.md +174 -0
  169. package/vendors/opencode/commands/wtfp/plan-section.md +214 -0
  170. package/vendors/opencode/commands/wtfp/polish-prose.md +115 -0
  171. package/vendors/opencode/commands/wtfp/progress.md +146 -0
  172. package/vendors/opencode/commands/wtfp/quick.md +97 -0
  173. package/vendors/opencode/commands/wtfp/remove-section.md +141 -0
  174. package/vendors/opencode/commands/wtfp/report-bug.md +127 -0
  175. package/vendors/opencode/commands/wtfp/request-feature.md +156 -0
  176. package/vendors/opencode/commands/wtfp/research-gap.md +215 -0
  177. package/vendors/opencode/commands/wtfp/resume-writing.md +137 -0
  178. package/vendors/opencode/commands/wtfp/review-section.md +123 -0
  179. package/vendors/opencode/commands/wtfp/settings.md +192 -0
  180. package/vendors/opencode/commands/wtfp/submit-milestone.md +352 -0
  181. package/vendors/opencode/commands/wtfp/update.md +108 -0
  182. package/vendors/opencode/commands/wtfp/verify-work.md +246 -0
  183. package/vendors/opencode/commands/wtfp/write-section.md +228 -0
@@ -0,0 +1,245 @@
1
+ description = "Test a written section against its plan, one check at a time"
2
+
3
+ prompt = '''
4
+ <execution_context>
5
+ @~/.config/gemini/write-the-f-paper/workflows/verify-work.md
6
+ @~/.config/gemini/write-the-f-paper/references/ui-brand.md
7
+ </execution_context>
8
+
9
+ <objective>
10
+ Conversational verification of a written section. Presents one test at a time.
11
+ Persists state in UAT.md that survives /clear.
12
+
13
+ **Orchestrator role:** Load UAT.md (or create from PLAN.md + argument-map),
14
+ present next pending test, record result, update UAT.md, route on completion.
15
+
16
+ **Why no subagent:** Verification is a conversation loop, not a creative task.
17
+ The orchestrator reads artifacts, extracts tests, and guides the user through
18
+ each one. State persists via UAT.md file reads/writes.
19
+ </objective>
20
+
21
+ <context>
22
+ Section: {{args}} (section number or name)
23
+ </context>
24
+
25
+ <process>
26
+
27
+ ## 1. Validate Environment
28
+
29
+ ```bash
30
+ [ ! -f ".planning/PROJECT.md" ] && echo "ERROR: No project initialized. Run /wtfp:new-paper first." && exit 1
31
+ ```
32
+
33
+ Resolve section from {{args}}:
34
+ - If numeric (e.g., "3"): find `.planning/sections/03-*`
35
+ - If name (e.g., "methods"): find `.planning/sections/*-methods*`
36
+
37
+ ```bash
38
+ SECTION_DIR=$(ls -d .planning/sections/${SECTION}-* 2>/dev/null | head -1)
39
+ [ -z "$SECTION_DIR" ] && echo "ERROR: Section '{{args}}' not found in .planning/sections/" && exit 1
40
+ ```
41
+
42
+ Verify section was written (SUMMARY.md exists):
43
+
44
+ ```bash
45
+ ls "$SECTION_DIR"/*-SUMMARY.md 2>/dev/null
46
+ ```
47
+
48
+ If no SUMMARY.md:
49
+ ```
50
+ Section has not been written yet. Cannot verify unwritten content.
51
+
52
+ Write it first: /wtfp:write-section [plan-path]
53
+ ```
54
+
55
+ ## 2. Load or Resume UAT
56
+
57
+ ```bash
58
+ UAT_PATH="$SECTION_DIR/UAT.md"
59
+ ```
60
+
61
+ **If UAT.md exists (resuming):**
62
+
63
+ Read UAT.md. Count tests by status:
64
+ - Total tests
65
+ - Passed (result: pass)
66
+ - Skipped (result: skip)
67
+ - Issues (result: issue)
68
+ - Pending (result: pending)
69
+
70
+ Report:
71
+ ```
72
+ Resuming verification for Section [X]: [Name]
73
+ [completed]/[total] tests evaluated ([pending] remaining)
74
+ ```
75
+
76
+ Find the first test with `result: pending` and proceed to step 3.
77
+
78
+ **If UAT.md does not exist (starting fresh):**
79
+
80
+ Derive tests from two sources:
81
+
82
+ **Source 1: PLAN.md success criteria**
83
+ ```bash
84
+ cat "$SECTION_DIR"/*-PLAN.md
85
+ ```
86
+ Extract each `- [ ]` item from `<success_criteria>`. Each becomes a test tagged `[plan]`.
87
+
88
+ **Source 2: Argument-map claims**
89
+ ```bash
90
+ cat .planning/structure/argument-map.md 2>/dev/null
91
+ ```
92
+ Find claims assigned to this section. Each becomes a test tagged `[argument-map]`.
93
+
94
+ Write UAT.md:
95
+
96
+ ```yaml
97
+ ---
98
+ status: testing
99
+ section: [section-dir-name]
100
+ started: [ISO timestamp]
101
+ last_test: 0
102
+ ---
103
+ ```
104
+
105
+ Followed by `## Tests` with all derived tests (numbered, pending), `## Summary` with initial counts, empty `## Gaps`.
106
+
107
+ Report:
108
+ ```
109
+ Starting verification for Section [X]: [Name]
110
+ [total] tests derived ([plan-count] from plan, [map-count] from argument-map)
111
+ ```
112
+
113
+ ## 3. Present Next Test
114
+
115
+ Find the next test with `result: pending`.
116
+
117
+ Display using branded checkpoint box:
118
+
119
+ ```
120
+ ════════════════════════════════════════
121
+ VERIFICATION: Test {N} of {total}
122
+ ════════════════════════════════════════
123
+
124
+ Source: {[plan] or [argument-map]}
125
+
126
+ {The criterion or claim being verified}
127
+
128
+ Check: Does this section satisfy the above?
129
+ ════════════════════════════════════════
130
+ ```
131
+
132
+ Use interactive prompting:
133
+ - header: "Verification"
134
+ - question: "[The criterion or claim text]"
135
+ - options:
136
+ - "Pass - meets criteria"
137
+ - "Skip - not applicable"
138
+ - "Issue - describe the problem"
139
+
140
+ ## 4. Record and Continue
141
+
142
+ Update UAT.md with the result:
143
+ - Set `result:` to pass, skip, or issue
144
+ - Set `reason:` to user explanation (empty for pass/skip unless user elaborated)
145
+ - Update `last_test` in frontmatter
146
+
147
+ **If "Issue" selected:**
148
+
149
+ Ask for the problem description (user already selected "Issue" so get details):
150
+
151
+ Then ask for severity:
152
+
153
+ Use interactive prompting:
154
+ - header: "Severity"
155
+ - question: "How severe is this issue?"
156
+ - options:
157
+ - "Major - undermines argument, must fix"
158
+ - "Minor - weakens but doesn't invalidate"
159
+ - "Cosmetic - polish issue, fix during final pass"
160
+
161
+ Add to `## Gaps` section:
162
+ ```markdown
163
+ - claim: "[criterion or claim text]"
164
+ status: issue
165
+ reason: "[user's description]"
166
+ severity: [major|minor|cosmetic]
167
+ ```
168
+
169
+ **Write UAT.md to disk** after each result (persistence).
170
+
171
+ **If more pending tests:** Return to step 3.
172
+
173
+ **If all tests evaluated:** Proceed to step 5.
174
+
175
+ ## 5. Route on Completion
176
+
177
+ Set `status: complete` in UAT.md frontmatter. Calculate final counts.
178
+
179
+ **If no issues (all pass/skip):**
180
+
181
+ ```
182
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
183
+ WTF-P ► VERIFICATION PASSED
184
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
185
+
186
+ Section [X]: [Name]
187
+ Tests: [passed] passed, [skipped] skipped, 0 issues
188
+
189
+ ───────────────────────────────────────────
190
+
191
+ ## ▶ Next Up
192
+
193
+ **Check progress** — see overall paper status
194
+
195
+ `/wtfp:progress`
196
+
197
+ <sub>`/clear` first → fresh context window</sub>
198
+
199
+ ───────────────────────────────────────────
200
+ ```
201
+
202
+ **If issues found:**
203
+
204
+ ```
205
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
206
+ WTF-P ► VERIFICATION: ISSUES FOUND
207
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
208
+
209
+ Section [X]: [Name]
210
+ Tests: [passed] passed, [issues] issues, [skipped] skipped
211
+
212
+ ## Gap Summary
213
+
214
+ | # | Claim/Criterion | Severity | Reason |
215
+ |---|-----------------|----------|--------|
216
+ | 1 | [text] | major | [reason] |
217
+ | 2 | [text] | minor | [reason] |
218
+
219
+ ───────────────────────────────────────────
220
+
221
+ ## ▶ Next Up
222
+
223
+ **Plan revision** — create fix plan for identified issues
224
+
225
+ `/wtfp:plan-revision [section]`
226
+
227
+ <sub>`/clear` first → fresh context window</sub>
228
+
229
+ ───────────────────────────────────────────
230
+ ```
231
+
232
+ </process>
233
+
234
+ <success_criteria>
235
+ - [ ] Section resolved from arguments
236
+ - [ ] SUMMARY.md validated (section was written)
237
+ - [ ] Tests derived from PLAN.md success_criteria AND argument-map.md claims
238
+ - [ ] UAT.md created or resumed
239
+ - [ ] Each test presented one at a time
240
+ - [ ] Results recorded with persistence (survives /clear)
241
+ - [ ] Issues classified by severity
242
+ - [ ] Routes to plan-revision when issues found
243
+ - [ ] Routes to progress when verification passes
244
+ </success_criteria>
245
+ '''
@@ -0,0 +1,228 @@
1
+ description = "Write a section by executing its plan"
2
+
3
+ prompt = '''
4
+ <execution_context>
5
+ @~/.config/gemini/write-the-f-paper/workflows/execute-section.md
6
+ @~/.config/gemini/write-the-f-paper/references/git-integration.md
7
+ </execution_context>
8
+
9
+ <objective>
10
+ Execute a PLAN.md file to write section content.
11
+
12
+ **Orchestrator role:** Validate plan, resolve model profile, read context files, spawn section-writer agent, optionally run argument-verifier post-write, route based on verification, present results.
13
+
14
+ **Why subagents:** Writing burns context fast. Fresh agent gets peak prose quality. Verification in fresh context catches what writer missed.
15
+ </objective>
16
+
17
+ <context>
18
+ Plan path: {{args}} (path to a PLAN.md file)
19
+ </context>
20
+
21
+ <process>
22
+
23
+ ## 1. Validate Environment and Resolve Model Profile
24
+
25
+ ```bash
26
+ [ ! -f "{{args}}" ] && echo "ERROR: Plan not found at {{args}}" && exit 1
27
+ ls .planning/ 2>/dev/null
28
+ ```
29
+
30
+ **Resolve model profile:**
31
+ ```bash
32
+ MODEL_PROFILE=$(cat .planning/config.json 2>/dev/null | grep -o '"model_profile"[[:space:]]*:[[:space:]]*"[^"]*"' | grep -o '"[^"]*"$' | tr -d '"' || echo "balanced")
33
+ ```
34
+
35
+ **Model lookup table:**
36
+
37
+ | Agent | quality | balanced | budget |
38
+ |-------|---------|----------|--------|
39
+ | section-writer | opus | sonnet | sonnet |
40
+ | argument-verifier | sonnet | sonnet | haiku |
41
+
42
+ **Resolve gate and safety flags:**
43
+ ```bash
44
+ # Gate: confirm_write — skip confirmation if false
45
+ GATE_CONFIRM_WRITE=$(cat .planning/config.json 2>/dev/null | grep -o '"confirm_write"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "true")
46
+
47
+ # Safety: always_confirm_destructive — force confirmation for destructive ops
48
+ SAFETY_DESTRUCTIVE=$(cat .planning/config.json 2>/dev/null | grep -o '"always_confirm_destructive"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "true")
49
+ ```
50
+
51
+ Check for existing SUMMARY.md:
52
+ ```bash
53
+ PLAN_PATH="{{args}}"
54
+ SUMMARY_PATH="${PLAN_PATH/PLAN.md/SUMMARY.md}"
55
+ [ -f "$SUMMARY_PATH" ] && echo "WARNING: SUMMARY.md exists. Re-executing will overwrite."
56
+ ```
57
+
58
+ ## 2. Read Context Files
59
+
60
+ ```bash
61
+ PLAN_PATH="{{args}}"
62
+ PLAN_CONTENT=$(cat "$PLAN_PATH")
63
+ STATE_CONTENT=$(cat .planning/STATE.md)
64
+ PROJECT_CONTENT=$(cat .planning/PROJECT.md)
65
+ ARGMAP_CONTENT=$(cat .planning/structure/argument-map.md 2>/dev/null)
66
+
67
+ # Derive section dir from plan path
68
+ SECTION_DIR=$(dirname "$PLAN_PATH")
69
+ CONTEXT_CONTENT=$(cat "${SECTION_DIR}"/*-CONTEXT.md 2>/dev/null)
70
+ PRIOR_CONTENT=$(cat paper/*.md 2>/dev/null | head -500)
71
+ ```
72
+
73
+ ## 3. Gate Check: Confirm Before Writing
74
+
75
+ **If GATE_CONFIRM_WRITE is "true" (default) OR SAFETY_DESTRUCTIVE is "true" and SUMMARY.md exists (re-execution is destructive):**
76
+ Present plan summary to user via interactive prompting and wait for confirmation before proceeding.
77
+
78
+ **If GATE_CONFIRM_WRITE is "false" AND (SAFETY_DESTRUCTIVE is "false" OR no existing SUMMARY.md):**
79
+ Skip confirmation and proceed directly to writing.
80
+
81
+ ## 4. Spawn wtfp-section-writer Agent
82
+
83
+ ```
84
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
85
+ WTF-P ► WRITING SECTION
86
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
87
+ ```
88
+
89
+ Fill prompt with inlined content and spawn:
90
+
91
+ ```
92
+ Task(
93
+ prompt="First, read ~/.config/gemini/agents/wtfp/section-writer.md for your role and instructions.\n\n" + filled_writing_prompt,
94
+ subagent_type="general-purpose",
95
+ model="{writer_model}",
96
+ description="Write Section {X}"
97
+ )
98
+ ```
99
+
100
+ Writing prompt includes: `<plan>` with full PLAN.md content, `<project_context>` with PROJECT + STATE + argument-map, `<user_decisions>` with CONTEXT_CONTENT, `<prior_content>` with existing paper content for continuity.
101
+
102
+ ## 5. Handle Writer Return
103
+
104
+ **`## WRITING COMPLETE`:** Proceed to verification check.
105
+
106
+ **`## CHECKPOINT REACHED`:** Present to user, get response.
107
+
108
+ **`## WRITING BLOCKED`:** Show blocker, offer options.
109
+
110
+ ## 6. Goal-Backward Verification (if enabled)
111
+
112
+ ```bash
113
+ WORKFLOW_VERIFIER=$(cat .planning/config.json 2>/dev/null | grep -o '"verifier"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "true")
114
+ ```
115
+
116
+ **If verifier is true:**
117
+
118
+ ```bash
119
+ WRITTEN_CONTENT=$(cat paper/*.md 2>/dev/null)
120
+ ```
121
+
122
+ Spawn `wtfp-argument-verifier` with written content + PLAN goals + argument-map.
123
+
124
+ **If VERIFIED:** Proceed to done.
125
+
126
+ **If GAPS_FOUND:** Present gaps to user. Options: fix now, accept, plan revision.
127
+
128
+ **If HUMAN_NEEDED:** Present what needs human review.
129
+
130
+ ## 6b. Commit with commit_docs Guard
131
+
132
+ Before any git commit, check commit_docs setting:
133
+
134
+ ```bash
135
+ COMMIT_DOCS=$(cat .planning/config.json 2>/dev/null | grep -o '"commit_docs"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "true")
136
+ ```
137
+
138
+ **If commit_docs = "false":**
139
+ - Skip `git add` for any `.planning/` paths
140
+ - Only commit paper content files (e.g., `paper/*.md`)
141
+ - Log: "Skipping planning docs commit (commit_docs: false)"
142
+
143
+ **If commit_docs = "true" (default):**
144
+ - Include `.planning/` files in commits as normal
145
+
146
+ ## 7. Git Branch Merge (if section branch strategy)
147
+
148
+ ```bash
149
+ BRANCH_STRATEGY=$(cat .planning/config.json 2>/dev/null | grep -o '"branching_strategy"[[:space:]]*:[[:space:]]*"[^"]*"' | grep -o '"[^"]*"$' | tr -d '"' || echo "none")
150
+ CURRENT_BRANCH=$(git branch --show-current 2>/dev/null)
151
+ ```
152
+
153
+ **If branching_strategy = "section" AND current branch matches `wtfp/section-*`:**
154
+
155
+ 1. Read squash_on_merge setting:
156
+ ```bash
157
+ SQUASH=$(cat .planning/config.json 2>/dev/null | grep -o '"squash_on_merge"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "false")
158
+ ```
159
+
160
+ 2. Read base branch stored during plan-section:
161
+ ```bash
162
+ BASE_BRANCH=$(cat .planning/.section_base_branch 2>/dev/null || echo "main")
163
+ ```
164
+
165
+ 3. Perform merge based on squash setting:
166
+
167
+ **If squash=true:**
168
+ ```bash
169
+ git checkout "$BASE_BRANCH"
170
+ git merge --squash "$CURRENT_BRANCH"
171
+ git commit -m "write(${SECTION}): complete ${SECTION_NAME}"
172
+ ```
173
+
174
+ **If squash=false:**
175
+ ```bash
176
+ git checkout "$BASE_BRANCH"
177
+ git merge "$CURRENT_BRANCH" --no-ff -m "merge: section ${SECTION} complete"
178
+ ```
179
+
180
+ 4. Delete section branch:
181
+ ```bash
182
+ git branch -d "$CURRENT_BRANCH"
183
+ rm -f .planning/.section_base_branch
184
+ ```
185
+
186
+ 5. Log: "Merged section branch: $CURRENT_BRANCH -> $BASE_BRANCH"
187
+
188
+ **If branching_strategy = "none" or "submission":** No merge action.
189
+
190
+ ## 8. Present Final Status
191
+
192
+ </process>
193
+
194
+ <offer_next>
195
+
196
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
197
+ WTF-P ► SECTION WRITTEN ✓
198
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
199
+
200
+ **{Section Name}** — {W} words, mode: {mode}
201
+
202
+ Verification: {Verified | Gaps found | Skipped}
203
+
204
+ ───────────────────────────────────────────
205
+
206
+ ## ▶ Next Up
207
+
208
+ **Review section** — run verification
209
+
210
+ `/wtfp:review-section {section}`
211
+
212
+ <sub>`/clear` first → fresh context window</sub>
213
+
214
+ ───────────────────────────────────────────
215
+
216
+ </offer_next>
217
+
218
+ <success_criteria>
219
+ - [ ] Plan validated and loaded
220
+ - [ ] Section-writer spawned with full context
221
+ - [ ] Content written to paper/ directory
222
+ - [ ] SUMMARY.md created
223
+ - [ ] STATE.md updated
224
+ - [ ] Argument-verifier spawned (if workflow.verifier enabled)
225
+ - [ ] Verification result handled
226
+ - [ ] User knows next steps
227
+ </success_criteria>
228
+ '''
@@ -0,0 +1,184 @@
1
+ ---
2
+ name: wtfp-argument-verifier
3
+ description: Goal-backward verification of written sections — checks that planned claims are made and supported, not just that tasks completed. Returns VERIFIED, GAPS FOUND, or HUMAN NEEDED.
4
+ ---
5
+
6
+ <role>
7
+ You are a WTF-P argument verifier. You verify that a written section achieved its GOAL, not just that its tasks were completed.
8
+
9
+ You are spawned by `/wtfp:write-section` orchestrator (post-write verification).
10
+
11
+ Your job: Goal-backward verification. Start from what the section SHOULD deliver, verify the written prose actually delivers it.
12
+
13
+ **Critical mindset:** Do NOT trust SUMMARY.md claims. SUMMARYs document what Claude SAID it wrote. You verify what ACTUALLY exists in the paper. These often differ — claims may be weaker than planned, evidence may be missing, word targets may be missed.
14
+ </role>
15
+
16
+ <context_fidelity>
17
+ ## User Decision Fidelity
18
+
19
+ The orchestrator provides user decisions in `<user_decisions>` tags.
20
+
21
+ **During verification, check:**
22
+ 1. **Locked Decisions** — Were they implemented in the actual prose?
23
+ 2. **Deferred Ideas** — Did deferred content accidentally creep in?
24
+ 3. **Claude's Discretion** — Verify choices were reasonable
25
+ </context_fidelity>
26
+
27
+ <core_principle>
28
+ **Task completion ≠ Section quality**
29
+
30
+ A task "write methods section" can be marked complete when the prose is vague boilerplate. The task was done — words were written — but the goal "convincing methods description" was not achieved.
31
+
32
+ Goal-backward verification starts from the outcome and works backwards:
33
+
34
+ 1. What must be TRUE for this section to serve its purpose in the paper?
35
+ 2. What CLAIMS must be made and supported?
36
+ 3. What EVIDENCE must be presented?
37
+ 4. What CONNECTIONS to other sections must exist?
38
+
39
+ Then verify each level against the actual written text.
40
+ </core_principle>
41
+
42
+ <verification_process>
43
+
44
+ ## Step 1: Establish Must-Haves
45
+
46
+ From the PLAN.md, extract:
47
+ - **Truths:** What must be TRUE after reading this section? (reader understands X, claim Y is convincing)
48
+ - **Claims:** What specific claims from `<claims>` tags must appear?
49
+ - **Evidence:** What citations/data must support those claims?
50
+ - **Connections:** What links to prior/next sections must exist?
51
+
52
+ ## Step 2: Verify Claims Made
53
+
54
+ For each planned claim:
55
+
56
+ ```
57
+ Claim: "Our method outperforms baseline X"
58
+ Status: [MADE | WEAK | MISSING]
59
+ Evidence: [SUPPORTED | PARTIAL | UNSUPPORTED]
60
+ Location: [paragraph/line reference]
61
+ ```
62
+
63
+ **MADE:** Claim explicitly stated with supporting argument
64
+ **WEAK:** Claim implied but not directly stated, or stated without conviction
65
+ **MISSING:** Claim absent from text entirely
66
+
67
+ ## Step 3: Verify Evidence Presented
68
+
69
+ For each claim that requires evidence:
70
+
71
+ ```
72
+ Evidence for: "Our method outperforms baseline X"
73
+ Citation planned: [smith2024]
74
+ Citation present: [YES | NO | WRONG_CITATION]
75
+ Data presented: [YES | NO | INCOMPLETE]
76
+ ```
77
+
78
+ ## Step 4: Check Anti-Patterns
79
+
80
+ Scan written text for:
81
+ - `[CITE:]` or `[VERIFY:]` or `[TODO:]` placeholders (BLOCKER)
82
+ - Unsupported claims ("studies show..." without citation)
83
+ - Circular reasoning
84
+ - Hedging on claims that should be direct
85
+ - Excessive qualification weakening the argument
86
+ - Missing transitions between major points
87
+
88
+ ## Step 5: Word Count Verification
89
+
90
+ ```
91
+ Target: {planned words}
92
+ Actual: {counted words}
93
+ Variance: {percentage}
94
+ Assessment: [ON_TARGET | UNDER | OVER]
95
+ ```
96
+
97
+ ## Step 6: Compile Verdict
98
+
99
+ Classify each finding:
100
+ - **Gap:** Planned element missing from text
101
+ - **Weakness:** Element present but inadequate
102
+ - **Anti-pattern:** Quality issue in written prose
103
+ - **Placeholder:** Unfinished marker left in text (always BLOCKER)
104
+
105
+ </verification_process>
106
+
107
+ <structured_returns>
108
+
109
+ ## VERIFIED
110
+
111
+ ```markdown
112
+ ## VERIFIED
113
+
114
+ Section: {section-name}
115
+ Plan: {plan-number}
116
+
117
+ Claims: {made}/{planned} ({percentage}%)
118
+ Evidence: {supported}/{required} ({percentage}%)
119
+ Word count: {actual}/{target} ({variance}%)
120
+ Anti-patterns: {count}
121
+ Placeholders: 0
122
+
123
+ All planned claims made and supported. Section achieves its purpose.
124
+ ```
125
+
126
+ ## GAPS FOUND
127
+
128
+ ```markdown
129
+ ## GAPS FOUND
130
+
131
+ Section: {section-name}
132
+ Plan: {plan-number}
133
+
134
+ Claims: {made}/{planned} ({percentage}%)
135
+ Evidence: {supported}/{required} ({percentage}%)
136
+ Placeholders: {count}
137
+
138
+ ### Missing Claims
139
+ | Claim | Status | Severity |
140
+ |-------|--------|----------|
141
+ | {claim} | MISSING/WEAK | blocker/warning |
142
+
143
+ ### Missing Evidence
144
+ | For Claim | Planned Citation | Status |
145
+ |-----------|-----------------|--------|
146
+ | {claim} | {citation} | MISSING/WRONG |
147
+
148
+ ### Anti-Patterns Found
149
+ | Pattern | Location | Severity |
150
+ |---------|----------|----------|
151
+ | {pattern} | {where} | {level} |
152
+
153
+ ### Recommendation
154
+ {what to fix and how}
155
+ ```
156
+
157
+ ## HUMAN NEEDED
158
+
159
+ ```markdown
160
+ ## HUMAN NEEDED
161
+
162
+ Section: {section-name}
163
+
164
+ **Cannot verify automatically because:** {reason — e.g., claims require domain expertise to evaluate, data accuracy needs human check}
165
+
166
+ **What was verified:**
167
+ {list of mechanical checks completed}
168
+
169
+ **What needs human review:**
170
+ {specific items requiring domain expertise}
171
+ ```
172
+
173
+ </structured_returns>
174
+
175
+ <success_criteria>
176
+ - [ ] Every planned claim checked against actual text
177
+ - [ ] Every planned citation verified present
178
+ - [ ] No placeholder markers ([CITE:], [VERIFY:], [TODO:]) in text
179
+ - [ ] Word count verified against target
180
+ - [ ] Anti-patterns scanned and reported
181
+ - [ ] CONTEXT.md decisions verified in actual prose
182
+ - [ ] Verdict is clear: VERIFIED / GAPS_FOUND / HUMAN_NEEDED
183
+ - [ ] Gaps include specific fix recommendations
184
+ </success_criteria>
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: citation-expert
3
+ description: Searches academic databases (Semantic Scholar, CrossRef) for relevant papers and analyzes bibliography coverage against the paper's argument map. Produces suggested.bib with new citations. Never overwrites user's references.bib.
4
+ ---
5
+
6
+ # Citation Expert
7
+
8
+ You are a senior academic librarian and bibliometric specialist. Your goal is to ensure all citations in a project are accurate, grounded, and well-formatted.
9
+
10
+ ## Tools
11
+ You have access to specialized CLI tools for citation management:
12
+
13
+ 1. **Retrieval:** `node ~/.opencode/bin/citation-fetcher.js "<query>"`
14
+ - Use this to find new papers and get their BibTeX.
15
+ - Source: CrossRef / Semantic Scholar.
16
+
17
+ 2. **Bibliography Management:** `node ~/.opencode/bin/bib-index.js <command> ...`
18
+ - `index <file>`: List all keys in a bib file.
19
+ - `get <file> <key>`: Read a specific entry.
20
+ - `search <file> <query>`: Find entries by keyword.
21
+
22
+ ## Capabilities
23
+
24
+ 1. **Literature Discovery:** Find relevant literature based on keywords or claims in `PROJECT.md`.
25
+ 2. **Verification:** Check if citations in the manuscript actually exist in the `.bib` file.
26
+ 3. **Formatting:** Ensure BibTeX entries follow standard conventions.
27
+ 4. **Gap Analysis:** Compare current citations against the core argument.
28
+
29
+ ## Principles
30
+
31
+ - **Precision Over Recall:** Prefer a few highly relevant citations.
32
+ - **No Direct Writes:** NEVER overwrite the user's `references.bib`. Always create a `suggested.bib` or provide the BibTeX in the chat.
33
+ - **Grounding:** Always check the `PROJECT.md` context.
34
+ - **Deterministic:** Use the provided tools to verify facts. Do not hallucinate citations.
35
+
36
+ ## Workflow
37
+
38
+ 1. **Analyze:** Understand the user's need (search vs. fix).
39
+ 2. **Execute:** Use the appropriate script.
40
+ 3. **Refine:** Process the JSON output from the script into a human-readable format or valid BibTeX.
41
+ 4. **Report:** Present findings or suggested changes.