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,255 @@
1
+ ---
2
+ name: wtfp:plan-milestone-gaps
3
+ description: Create fix plans for gaps found by audit-milestone
4
+ allowed-tools:
5
+ - Read
6
+ - Bash
7
+ - Write
8
+ - AskUserQuestion
9
+ ---
10
+
11
+ <objective>
12
+ Read MILESTONE-AUDIT.md and create targeted fix plans for each gap.
13
+
14
+ Each gap becomes a fix plan in the appropriate section directory.
15
+ Plans follow the standard plan-format.md structure.
16
+ User can execute fix plans with existing writing commands.
17
+ </objective>
18
+
19
+ <process>
20
+
21
+ <step name="validate">
22
+ **Step 1: Validate Audit Exists**
23
+
24
+ ```bash
25
+ [ ! -f .planning/MILESTONE-AUDIT.md ] && echo "ERROR: No MILESTONE-AUDIT.md found. Run /wtfp:audit-milestone first." && exit 1
26
+ ```
27
+
28
+ </step>
29
+
30
+ <step name="banner">
31
+ **Step 2: Display Banner**
32
+
33
+ ```
34
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
35
+ WTF-P ► PLANNING GAP FIXES
36
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
37
+
38
+ Reading MILESTONE-AUDIT.md...
39
+ ```
40
+
41
+ </step>
42
+
43
+ <step name="parse_audit">
44
+ **Step 3: Parse MILESTONE-AUDIT.md**
45
+
46
+ Read `.planning/MILESTONE-AUDIT.md`.
47
+
48
+ Extract all gaps (sections under "## Gaps" with "Status: gap"):
49
+ - Gap name (check name)
50
+ - Finding (what's missing)
51
+ - Affected (sections/claims/files)
52
+ - Recommendation (what to do)
53
+
54
+ If no gaps found (Overall: PASS):
55
+ ```
56
+ No gaps found in audit. Paper is ready for submission.
57
+ Run /wtfp:submit-milestone {version} to archive.
58
+ ```
59
+ Exit early.
60
+
61
+ </step>
62
+
63
+ <step name="classify_gaps">
64
+ **Step 4: Classify Gaps by Fix Type**
65
+
66
+ For each gap, determine fix type:
67
+
68
+ | Gap Type | Fix Type | Action |
69
+ |----------|----------|--------|
70
+ | Section incomplete | section-write | Generate writing plan for incomplete section |
71
+ | Argument not covered | targeted-write | Generate task to address specific claim in relevant section |
72
+ | Word count over | revision-trim | Generate revision task to reduce word count |
73
+ | Word count under | revision-expand | Generate revision task to expand content |
74
+ | Citation undefined | citation-fix | Generate task to add missing citation |
75
+ | Citation uncited | citation-fix | Generate task to cite or remove reference |
76
+ | Section unreviewed | review-route | Route to /wtfp:review-section |
77
+
78
+ </step>
79
+
80
+ <step name="group_gaps">
81
+ **Step 5: Group Related Gaps**
82
+
83
+ Group gaps that affect the same section:
84
+ - Multiple issues in Section 2 -> one fix plan for Section 2
85
+ - Word count + argument issues in same section -> combined plan
86
+
87
+ Create plan groupings:
88
+ ```
89
+ PLAN_1: Section 02 - {word count issue, argument issue}
90
+ PLAN_2: Section 04 - {incomplete}
91
+ PLAN_3: Citations - {undefined citations across multiple sections}
92
+ ```
93
+
94
+ </step>
95
+
96
+ <step name="generate_plans">
97
+ **Step 6: Generate Fix Plans**
98
+
99
+ For each grouped plan, create a fix plan file.
100
+
101
+ **Location:** `.planning/sections/XX-name/{section}-fix-{N}-PLAN.md`
102
+
103
+ **Plan structure (following plan-format.md):**
104
+
105
+ ```markdown
106
+ ---
107
+ section: {section-number}
108
+ plan: fix-{N}
109
+ type: revision
110
+ depends_on: []
111
+ files_modified:
112
+ - {paper content file}
113
+ autonomous: true
114
+ ---
115
+
116
+ <objective>
117
+ Fix {N} gap(s) identified in milestone audit:
118
+ - {gap 1 summary}
119
+ - {gap 2 summary}
120
+
121
+ Purpose: Address audit findings before submission.
122
+ </objective>
123
+
124
+ <context>
125
+ @.planning/MILESTONE-AUDIT.md
126
+ @.planning/sections/XX-name/{relevant summaries}
127
+ @{paper content file}
128
+ </context>
129
+
130
+ <tasks>
131
+
132
+ <task type="auto">
133
+ <name>{fix task name}</name>
134
+ <files>
135
+ {file to modify}
136
+ </files>
137
+ <action>
138
+ {Specific fix instructions based on gap type:}
139
+
140
+ **For section incomplete:**
141
+ Complete the section draft following the outline.
142
+ - Address all planned subsections
143
+ - Meet word target: {X} words
144
+ - Include required citations
145
+
146
+ **For argument not covered:**
147
+ Add content to address claim: "{claim}"
148
+ - Insert in section: {section}
149
+ - Location: {suggested location}
150
+ - Approximate addition: {X} words
151
+
152
+ **For word count over:**
153
+ Reduce word count in {section} by {N} words.
154
+ - Current: {X} words
155
+ - Target: {Y} words
156
+ - Suggested cuts: {areas}
157
+
158
+ **For word count under:**
159
+ Expand content in {section} by {N} words.
160
+ - Current: {X} words
161
+ - Target: {Y} words
162
+ - Suggested expansions: {areas}
163
+
164
+ **For citation undefined:**
165
+ Add citation for: {key}
166
+ - Add to bibliography file
167
+ - Verify citation format matches style guide
168
+
169
+ **For citation uncited:**
170
+ Either cite or remove: {key}
171
+ - If relevant: add citation in appropriate section
172
+ - If not relevant: remove from bibliography
173
+ </action>
174
+ <verify>
175
+ {Verification for fix type:}
176
+
177
+ For section: Word count meets target, all subsections complete.
178
+ For argument: Claim is now addressed in text.
179
+ For word count: Section is within +/- 15% of target.
180
+ For citation: Citation resolves correctly.
181
+ </verify>
182
+ <done>
183
+ {Done criteria: Gap resolved per audit check}
184
+ </done>
185
+ </task>
186
+
187
+ </tasks>
188
+
189
+ <verification>
190
+ - Gap addressed per MILESTONE-AUDIT.md finding
191
+ - No new issues introduced
192
+ </verification>
193
+
194
+ <success_criteria>
195
+ - [ ] {Gap 1} resolved
196
+ - [ ] {Gap 2} resolved
197
+ </success_criteria>
198
+ ```
199
+
200
+ **For unreviewed sections (review-route):**
201
+
202
+ Don't generate a fix plan. Instead, note:
203
+ ```
204
+ Section {X} needs review. Run: /wtfp:review-section {section}
205
+ ```
206
+
207
+ </step>
208
+
209
+ <step name="summary">
210
+ **Step 7: Present Summary**
211
+
212
+ ```
213
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
214
+ WTF-P ► GAP PLANS CREATED ✓
215
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
216
+
217
+ Plans created: {N}
218
+
219
+ | Plan | Section | Gaps Addressed |
220
+ |------|---------|----------------|
221
+ | {path} | {section} | {gap list} |
222
+ | {path} | {section} | {gap list} |
223
+
224
+ {If any review-route gaps:}
225
+ Sections needing review (no plan created):
226
+ - Section {X}: Run `/wtfp:review-section {section}`
227
+
228
+ ───────────────────────────────────────────
229
+
230
+ ## Next Up
231
+
232
+ Execute fix plans:
233
+ `/wtfp:write-section {path-to-fix-plan}`
234
+
235
+ Or fix one at a time:
236
+ Read the plan, then execute tasks manually
237
+
238
+ After all fixes:
239
+ `/wtfp:audit-milestone` - Re-run audit to verify
240
+
241
+ ───────────────────────────────────────────
242
+ ```
243
+
244
+ </step>
245
+
246
+ </process>
247
+
248
+ <success_criteria>
249
+ - [ ] MILESTONE-AUDIT.md parsed successfully
250
+ - [ ] Gaps classified by fix type
251
+ - [ ] Related gaps grouped by section
252
+ - [ ] Fix plans created for each gap group
253
+ - [ ] Plans follow plan-format.md structure
254
+ - [ ] User knows which plans to execute next
255
+ </success_criteria>
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: wtfp:plan-revision
3
- description: Create fix plan from review issues
3
+ description: Create revision plan from review issues
4
4
  argument-hint: "[plan]"
5
5
  allowed-tools:
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: wtfp:plan-section
3
- description: Create detailed writing plan for a section (PLAN.md)
3
+ description: Create detailed writing plan for a section
4
4
  argument-hint: "[section]"
5
5
  allowed-tools:
6
6
  - Read
@@ -8,240 +8,215 @@ allowed-tools:
8
8
  - Write
9
9
  - Glob
10
10
  - Grep
11
+ - Task
11
12
  - AskUserQuestion
12
- - WebFetch
13
- - mcp__context7__*
14
13
  ---
15
14
 
16
- <objective>
17
- Create executable writing plan with context injection and task breakdown.
18
-
19
- Purpose: Break down roadmap sections into concrete, executable PLAN.md files that Claude can execute.
20
- Output: One or more PLAN.md files in the section directory (.planning/sections/XX-name/{section}-{plan}-PLAN.md)
21
- </objective>
22
-
23
15
  <execution_context>
24
- @~/.claude/write-the-f-paper/workflows/plan-section.md
25
- @~/.claude/write-the-f-paper/templates/phase-prompt.md
26
16
  @~/.claude/write-the-f-paper/references/plan-format.md
27
17
  @~/.claude/write-the-f-paper/references/length-estimation.md
28
- @~/.claude/write-the-f-paper/references/checkpoints.md
29
18
  </execution_context>
30
19
 
20
+ <objective>
21
+ Create executable writing plan with context injection and task breakdown.
22
+
23
+ **Orchestrator role:** Parse arguments, validate section, load context, resolve model profile, spawn section-planner agent, optionally verify plans with plan-checker, iterate until plans pass, present results.
24
+
25
+ **Why subagents:** Planning and verification burn context fast. Fresh agents get peak quality. User sees flow between agents in main context.
26
+ </objective>
27
+
31
28
  <context>
32
29
  Section number: $ARGUMENTS (optional - auto-detects next unplanned section if not provided)
30
+ </context>
33
31
 
34
- **Load project state first:**
35
- @.planning/STATE.md
32
+ <process>
36
33
 
37
- **Load roadmap:**
38
- @.planning/ROADMAP.md
34
+ ## 1. Validate Environment and Resolve Model Profile
39
35
 
40
- **Load structure documents:**
41
- @.planning/structure/argument-map.md
42
- @.planning/structure/outline.md
43
- @.planning/structure/narrative-arc.md
36
+ ```bash
37
+ ls .planning/ 2>/dev/null
38
+ ```
44
39
 
45
- **Load section context if exists (created by /wtfp:discuss-section):**
46
- Check for and read `.planning/sections/XX-name/{section}-CONTEXT.md` - contains vision and decisions from section discussion.
40
+ **If not found:** Error - user should run `/wtfp:new-paper` first.
47
41
 
48
- **Load sources if exists:**
49
- Check for `.planning/sources/` and load relevant documents based on section needs.
50
- </context>
42
+ **Resolve model profile:**
51
43
 
52
- <process>
44
+ ```bash
45
+ MODEL_PROFILE=$(cat .planning/config.json 2>/dev/null | grep -o '"model_profile"[[:space:]]*:[[:space:]]*"[^"]*"' | grep -o '"[^"]*"$' | tr -d '"' || echo "balanced")
46
+ ```
53
47
 
54
- <step name="verify">
55
- 1. Check .planning/ directory exists (error if not - user should run /wtfp:new-paper)
56
- 2. If section number provided via $ARGUMENTS, validate it exists in roadmap
57
- 3. If no section number, detect next unplanned section from roadmap
58
- </step>
59
-
60
- <step name="load_context">
61
- **Load all relevant context:**
62
-
63
- - Read PROJECT.md for paper vision and core argument
64
- - Read ROADMAP.md for section goal and dependencies
65
- - Read argument-map.md for claims relevant to this section
66
- - Read outline.md for word budget and structure
67
- - Read any prior SUMMARY.md files for context from completed sections
68
- - Check for CONTEXT.md in section directory
69
- - Check for RESEARCH.md in section directory
70
- </step>
71
-
72
- <step name="writing_mode">
73
- **Determine writing mode for this section:**
74
-
75
- Based on section type and user preference, select mode:
76
-
77
- | Section Type | Recommended Mode |
78
- |--------------|------------------|
79
- | Abstract | Reviewer (user writes, Claude critiques) |
80
- | Introduction | Co-Author (Claude drafts, user refines) |
81
- | Methods | Co-Author (often procedural) |
82
- | Results | Scaffold (Claude outlines, user writes) |
83
- | Discussion | Reviewer (requires judgment) |
84
- | Conclusion | Reviewer (synthesis) |
85
-
86
- Use AskUserQuestion:
87
- - header: "Writing Mode"
88
- - question: "How should Claude help with [section name]?"
89
- - options:
90
- - "Co-Author" — Claude drafts, you refine
91
- - "Scaffold" — Claude outlines, you fill in
92
- - "Reviewer" — You write, Claude critiques
93
-
94
- </step>
95
-
96
- <step name="break_into_tasks">
97
- **Break section into writing tasks:**
98
-
99
- Consider:
100
- - Word target for section
101
- - Logical subsections or paragraphs
102
- - Arguments that need to be made
103
- - Evidence that needs to be presented
104
- - Citations that need to be woven in
105
-
106
- For a typical section (500-1000 words):
107
- - Task 1: Opening hook + context setup
108
- - Task 2: Main argument development
109
- - Task 3: Evidence and support
110
- - Task 4: Transition to next section
111
-
112
- Keep tasks atomic (one paragraph cluster or argument each).
113
- </step>
114
-
115
- <step name="create_plan">
116
- **Create PLAN.md:**
117
-
118
- ```markdown
119
- ---
120
- section: XX-name
121
- plan: YY
122
- mode: [co-author/scaffold/reviewer]
123
- word_target: [X]
124
- ---
48
+ **Model lookup table:**
125
49
 
126
- <objective>
127
- [What this plan accomplishes - 1-2 sentences]
50
+ | Agent | quality | balanced | budget |
51
+ |-------|---------|----------|--------|
52
+ | section-planner | opus | opus | sonnet |
53
+ | plan-checker | sonnet | sonnet | haiku |
128
54
 
129
- Purpose: [What the reader will understand after this section]
130
- Output: [Word count] words of [section type] covering [topics]
131
- </objective>
55
+ **Resolve gate flag:**
56
+ ```bash
57
+ # Gate: confirm_plan — skip confirmation if false
58
+ GATE_CONFIRM_PLAN=$(cat .planning/config.json 2>/dev/null | grep -o '"confirm_plan"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "true")
59
+ ```
132
60
 
133
- <execution_context>
134
- @~/.claude/write-the-f-paper/workflows/execute-section.md
135
- @~/.claude/write-the-f-paper/templates/summary.md
136
- </execution_context>
61
+ ## 1b. Git Branch Setup
137
62
 
138
- <context>
139
- @.planning/PROJECT.md
140
- @.planning/ROADMAP.md
141
- @.planning/structure/argument-map.md
142
- @.planning/sources/literature.md (if relevant)
143
- @.planning/sections/[prior-section]/[prior]-SUMMARY.md (if exists)
144
- </context>
63
+ ```bash
64
+ BRANCH_STRATEGY=$(cat .planning/config.json 2>/dev/null | grep -o '"branching_strategy"[[:space:]]*:[[:space:]]*"[^"]*"' | grep -o '"[^"]*"$' | tr -d '"' || echo "none")
65
+ ```
145
66
 
146
- <tasks>
147
-
148
- <task type="auto" mode="[co-author/scaffold/reviewer]">
149
- <name>[Task name - what's being written]</name>
150
- <target>[Word count for this task]</target>
151
- <action>
152
- [Specific writing instructions]
153
- - Key points to make: [list]
154
- - Tone: [academic/persuasive/explanatory]
155
- - Citations needed: [yes/no, which]
156
- - Connect to: [prior/next section]
157
- </action>
158
- <verify>
159
- - [ ] Advances core argument
160
- - [ ] Word count within range
161
- - [ ] Flows from previous content
162
- </verify>
163
- <done>
164
- [X] words written covering [topic], ready for [next task/review]
165
- </done>
166
- </task>
167
-
168
- <task type="auto" mode="[mode]">
169
- [... additional tasks ...]
170
- </task>
171
-
172
- </tasks>
173
-
174
- <verification>
175
- - [ ] Total word count: [target] ± 10%
176
- - [ ] All key arguments from argument-map addressed
177
- - [ ] Citations included where claims made
178
- - [ ] Logical flow maintained
179
- - [ ] Connects to prior section (if not first)
180
- - [ ] Sets up next section (if not last)
181
- </verification>
67
+ **If branching_strategy = "section":**
182
68
 
183
- <success_criteria>
184
- - [ ] Section draft complete
185
- - [ ] Word target met
186
- - [ ] Core argument advanced
187
- - [ ] Ready for review or next section
188
- </success_criteria>
69
+ 1. Read section_branch_template from config (default: `wtfp/section-{section}-{slug}`)
70
+ 2. Replace `{section}` with zero-padded section number (e.g., `01`, `02`)
71
+ 3. Replace `{slug}` with slugified section name (lowercase, hyphens)
72
+ 4. Store current branch as base branch for later merge:
73
+ ```bash
74
+ BASE_BRANCH=$(git branch --show-current 2>/dev/null || echo "main")
75
+ echo "$BASE_BRANCH" > .planning/.section_base_branch
76
+ ```
77
+ 5. Create and checkout section branch:
78
+ ```bash
79
+ SECTION_BRANCH_TEMPLATE=$(cat .planning/config.json 2>/dev/null | grep -o '"section_branch_template"[[:space:]]*:[[:space:]]*"[^"]*"' | grep -o '"[^"]*"$' | tr -d '"' || echo "wtfp/section-{section}-{slug}")
80
+ BRANCH_NAME=$(echo "$SECTION_BRANCH_TEMPLATE" | sed "s/{section}/${SECTION_NUM}/" | sed "s/{slug}/${SECTION_SLUG}/")
81
+ git checkout -b "$BRANCH_NAME"
82
+ ```
83
+ 6. Log: "Created section branch: $BRANCH_NAME"
84
+
85
+ **If branching_strategy = "none" or "submission":** No branch action in plan-section.
86
+
87
+ ## 2. Parse and Normalize Arguments
88
+
89
+ Extract section number from $ARGUMENTS. If no section number, detect next unplanned section from roadmap.
90
+
91
+ ```bash
92
+ ls .planning/sections/*/ 2>/dev/null | head -10
93
+ ```
94
+
95
+ ## 3. Validate Section
96
+
97
+ ```bash
98
+ grep -A5 "Section" .planning/ROADMAP.md 2>/dev/null
99
+ ```
100
+
101
+ Extract section number, name, description.
189
102
 
190
- <output>
191
- - Written section content (in paper/ directory or inline)
192
- - SUMMARY.md documenting what was written
193
- - Updated STATE.md with progress
194
- </output>
103
+ ## 4. Ensure Section Directory and Load CONTEXT.md
104
+
105
+ ```bash
106
+ SECTION_DIR=$(ls -d .planning/sections/${SECTION}-* 2>/dev/null | head -1)
107
+ CONTEXT_CONTENT=$(cat "${SECTION_DIR}"/*-CONTEXT.md 2>/dev/null)
195
108
  ```
196
109
 
197
- </step>
110
+ **CRITICAL:** Store CONTEXT_CONTENT now. Pass to ALL downstream agents.
111
+
112
+ ## 5. Read Context Files
198
113
 
199
- <step name="commit">
200
114
  ```bash
201
- git add .planning/sections/XX-name/XX-YY-PLAN.md
202
- git commit -m "$(cat <<'EOF'
203
- plan(XX-YY): [section name] writing plan
115
+ STATE_CONTENT=$(cat .planning/STATE.md)
116
+ ROADMAP_CONTENT=$(cat .planning/ROADMAP.md)
117
+ PROJECT_CONTENT=$(cat .planning/PROJECT.md)
118
+ ARGMAP_CONTENT=$(cat .planning/structure/argument-map.md 2>/dev/null)
119
+ OUTLINE_CONTENT=$(cat .planning/structure/outline.md 2>/dev/null)
120
+ RESEARCH_CONTENT=$(cat "${SECTION_DIR}"/*-RESEARCH.md 2>/dev/null)
121
+ PRIOR_SUMMARIES=$(cat .planning/sections/*/SUMMARY.md 2>/dev/null | head -200)
122
+ ```
123
+
124
+ If RESEARCH.md missing for a literature-heavy section, suggest `/wtfp:research-gap` first.
125
+
126
+ ## 6. Gate Check: Confirm Before Planning
127
+
128
+ **If GATE_CONFIRM_PLAN is "true" (default):**
129
+ Present section context summary to user via AskUserQuestion and wait for confirmation before proceeding.
130
+
131
+ **If GATE_CONFIRM_PLAN is "false":**
132
+ Skip confirmation and proceed directly to planning.
204
133
 
205
- [One-liner objective]
134
+ ## 7. Spawn wtfp-section-planner Agent
206
135
 
207
- Tasks: [N], Target: [X] words, Mode: [mode]
208
- EOF
209
- )"
210
136
  ```
211
- </step>
137
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
138
+ WTF-P ► PLANNING SECTION {X}
139
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
140
+ ```
212
141
 
213
- <step name="done">
214
- **Present completion:**
142
+ Fill prompt with inlined content and spawn:
215
143
 
216
144
  ```
217
- Plan created:
145
+ Task(
146
+ prompt="First, read ~/.claude/agents/wtfp/section-planner.md for your role and instructions.\n\n" + filled_planning_prompt,
147
+ subagent_type="general-purpose",
148
+ model="{planner_model}",
149
+ description="Plan Section {X}"
150
+ )
151
+ ```
218
152
 
219
- - Plan: .planning/sections/XX-name/XX-YY-PLAN.md
220
- - Tasks: [N]
221
- - Word target: [X]
222
- - Mode: [co-author/scaffold/reviewer]
153
+ Planning prompt includes: `<planning_context>` with STATE, ROADMAP, PROJECT, argument-map, outline, RESEARCH, prior summaries. `<user_decisions>` with CONTEXT_CONTENT. `<output>` with target directory path.
223
154
 
224
- ---
155
+ ## 8. Handle Planner Return
225
156
 
226
- ## ▶ Next Up
157
+ **`## PLANNING COMPLETE`:** Display plan count, proceed to verification check.
227
158
 
228
- **[Section Name]** — execute writing plan
159
+ **`## CHECKPOINT REACHED`:** Present to user, get response.
229
160
 
230
- `/wtfp:write-section .planning/sections/XX-name/XX-YY-PLAN.md`
161
+ **`## PLANNING INCONCLUSIVE`:** Show what was attempted, offer options.
231
162
 
232
- <sub>`/clear` first → fresh context window</sub>
163
+ ## 8. Plan-Check-Revise Loop (if enabled)
233
164
 
234
- ---
165
+ ```bash
166
+ WORKFLOW_PLAN_CHECK=$(cat .planning/config.json 2>/dev/null | grep -o '"plan_check"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "true")
235
167
  ```
236
168
 
237
- </step>
169
+ **If plan_check is true:**
170
+
171
+ Read plans for checker:
172
+ ```bash
173
+ PLANS_CONTENT=$(cat "${SECTION_DIR}"/*-PLAN.md 2>/dev/null)
174
+ ```
175
+
176
+ Spawn `wtfp-plan-checker` with plans + ROADMAP + argument-map + CONTEXT.
177
+
178
+ **If VERIFICATION PASSED:** Proceed to done.
179
+
180
+ **If ISSUES FOUND and iteration < 3:** Spawn planner in revision mode with issues. Re-check. Increment iteration.
181
+
182
+ **If iteration >= 3:** Present remaining issues to user with options: force proceed, provide guidance, abandon.
183
+
184
+ ## 9. Present Final Status
238
185
 
239
186
  </process>
240
187
 
188
+ <offer_next>
189
+
190
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
191
+ WTF-P ► SECTION {X} PLANNED ✓
192
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
193
+
194
+ **Section {X}: {Name}** — {N} plan(s), {W} words target
195
+
196
+ Verification: {Passed | Passed with override | Skipped}
197
+
198
+ ───────────────────────────────────────────
199
+
200
+ ## ▶ Next Up
201
+
202
+ **Execute writing** — run the plan
203
+
204
+ `/wtfp:write-section .planning/sections/XX-name/XX-YY-PLAN.md`
205
+
206
+ <sub>`/clear` first → fresh context window</sub>
207
+
208
+ ───────────────────────────────────────────
209
+
210
+ </offer_next>
211
+
241
212
  <success_criteria>
242
- - One or more PLAN.md files created in .planning/sections/XX-name/
243
- - Each plan has: objective, execution_context, context, tasks, verification, success_criteria, output
244
- - Tasks are specific enough for Claude to execute
245
- - Writing mode selected appropriately for section type
246
- - User knows next steps (execute plan or review/adjust)
213
+ - [ ] .planning/ directory validated
214
+ - [ ] Section validated against roadmap
215
+ - [ ] CONTEXT.md loaded early and passed to ALL agents
216
+ - [ ] RESEARCH.md auto-loaded if exists
217
+ - [ ] Section-planner spawned with full context
218
+ - [ ] Plans created (PLANNING COMPLETE or CHECKPOINT handled)
219
+ - [ ] Plan-checker spawned (if workflow.plan_check enabled)
220
+ - [ ] Verification passed OR user override OR max iterations
221
+ - [ ] User knows next steps
247
222
  </success_criteria>