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
@@ -2,6 +2,8 @@
2
2
  Writing plans execute with Claude as partner. Checkpoints formalize interaction points where human verification or decisions are needed.
3
3
 
4
4
  **Core principle:** Claude assists with writing. Checkpoints are for verification and decisions about content direction.
5
+
6
+ **Visual formatting:** See @ui-brand.md for checkpoint box rendering, status symbols, and stage banners.
5
7
  </overview>
6
8
 
7
9
  <checkpoint_types>
@@ -16,11 +18,32 @@ Writing plans execute with Claude as partner. Checkpoints formalize interaction
16
18
  ```xml
17
19
  <task type="checkpoint:human-verify" gate="blocking">
18
20
  <what-written>[What Claude drafted]</what-written>
19
- <how-to-verify>[What to check - argument, tone, accuracy]</how-to-verify>
20
- <resume-signal>[How to continue - "approved" or describe issues]</resume-signal>
21
+ <how-to-verify>
22
+ [Numbered list of what to check — argument, tone, accuracy]
23
+ </how-to-verify>
24
+ <resume-signal>Type "approved" or describe issues</resume-signal>
21
25
  </task>
22
26
  ```
23
27
 
28
+ **Rendered output:**
29
+ ```
30
+ ════════════════════════════════════════
31
+ CHECKPOINT: human-verify
32
+ ════════════════════════════════════════
33
+ Task {X} of {Y}: {Name}
34
+
35
+ What was written:
36
+ {description of drafted content}
37
+
38
+ How to verify:
39
+ 1. {Check item 1}
40
+ 2. {Check item 2}
41
+ 3. {Check item 3}
42
+
43
+ Type "approved" or describe what to change.
44
+ ════════════════════════════════════════
45
+ ```
46
+
24
47
  **Example:**
25
48
  ```xml
26
49
  <task type="auto" mode="co-author">
@@ -32,7 +55,6 @@ Writing plans execute with Claude as partner. Checkpoints formalize interaction
32
55
  <task type="checkpoint:human-verify" gate="blocking">
33
56
  <what-written>Introduction opening paragraph (~150 words)</what-written>
34
57
  <how-to-verify>
35
- Review and confirm:
36
58
  1. Captures the problem accurately
37
59
  2. Tone matches your voice
38
60
  3. Hook is compelling
@@ -60,6 +82,24 @@ Writing plans execute with Claude as partner. Checkpoints formalize interaction
60
82
  </task>
61
83
  ```
62
84
 
85
+ **Rendered output:**
86
+ ```
87
+ ════════════════════════════════════════
88
+ CHECKPOINT: decision
89
+ ════════════════════════════════════════
90
+ Task {X} of {Y}: {Name}
91
+
92
+ Decision needed:
93
+ {What is being decided}
94
+
95
+ Options:
96
+ [a] {Name} — {pros}; tradeoff: {cons}
97
+ [b] {Name} — {pros}; tradeoff: {cons}
98
+
99
+ Select: a or b
100
+ ════════════════════════════════════════
101
+ ```
102
+
63
103
  **Example:**
64
104
  ```xml
65
105
  <task type="checkpoint:decision" gate="blocking">
@@ -81,6 +121,31 @@ Writing plans execute with Claude as partner. Checkpoints formalize interaction
81
121
 
82
122
  **Do NOT use for:** Writing tasks Claude can draft, formatting, citation formatting.
83
123
 
124
+ **Structure:**
125
+ ```xml
126
+ <task type="checkpoint:human-action" gate="blocking">
127
+ <action>[What is needed from the human]</action>
128
+ <instructions>
129
+ [Specific description of what to provide]
130
+ </instructions>
131
+ <resume-signal>[Format of expected input]</resume-signal>
132
+ </task>
133
+ ```
134
+
135
+ **Rendered output:**
136
+ ```
137
+ ════════════════════════════════════════
138
+ CHECKPOINT: human-action
139
+ ════════════════════════════════════════
140
+ Task {X} of {Y}: {Name}
141
+
142
+ What is needed:
143
+ {Description of what the author must provide}
144
+
145
+ Provide: {expected format}
146
+ ════════════════════════════════════════
147
+ ```
148
+
84
149
  **Example:**
85
150
  ```xml
86
151
  <task type="checkpoint:human-action" gate="blocking">
@@ -95,23 +160,72 @@ Writing plans execute with Claude as partner. Checkpoints formalize interaction
95
160
 
96
161
  </checkpoint_types>
97
162
 
163
+ <typed_checkpoint_xml>
164
+
165
+ ## Typed Checkpoint XML Format
166
+
167
+ All checkpoints in plan files use this XML structure. The `type` attribute determines rendering and behavior. The `gate` attribute controls blocking behavior.
168
+
169
+ ### Attributes
170
+
171
+ | Attribute | Values | Description |
172
+ |-----------|--------|-------------|
173
+ | `type` | `checkpoint:human-verify`, `checkpoint:decision`, `checkpoint:human-action` | Checkpoint category |
174
+ | `gate` | `blocking` (default), `non-blocking` | Whether execution pauses. Non-blocking checkpoints log for later review. |
175
+
176
+ ### human-verify XML
177
+
178
+ ```xml
179
+ <task type="checkpoint:human-verify" gate="blocking">
180
+ <what-written>[What Claude drafted]</what-written>
181
+ <how-to-verify>
182
+ [Numbered list of what to check]
183
+ </how-to-verify>
184
+ <resume-signal>Type "approved" or describe issues</resume-signal>
185
+ </task>
186
+ ```
187
+
188
+ ### decision XML
189
+
190
+ ```xml
191
+ <task type="checkpoint:decision" gate="blocking">
192
+ <decision>[What's being decided]</decision>
193
+ <context>[Why this matters]</context>
194
+ <options>
195
+ <option id="{id}"><name>[Name]</name><pros>[Benefits]</pros><cons>[Tradeoffs]</cons></option>
196
+ </options>
197
+ <resume-signal>Select: {option-ids}</resume-signal>
198
+ </task>
199
+ ```
200
+
201
+ ### human-action XML
202
+
203
+ ```xml
204
+ <task type="checkpoint:human-action" gate="blocking">
205
+ <action>[What is needed]</action>
206
+ <instructions>[Specific details]</instructions>
207
+ <resume-signal>Provide: {expected format}</resume-signal>
208
+ </task>
209
+ ```
210
+
211
+ </typed_checkpoint_xml>
212
+
98
213
  <execution_protocol>
99
214
 
100
215
  When Claude encounters `type="checkpoint:*"`:
101
216
 
102
217
  1. **Stop immediately** - do not proceed to next task
103
- 2. **Display checkpoint clearly:**
218
+ 2. **Display checkpoint** using the branded box format from @ui-brand.md:
104
219
 
105
220
  ```
106
221
  ════════════════════════════════════════
107
- CHECKPOINT: [Type]
222
+ CHECKPOINT: {type}
108
223
  ════════════════════════════════════════
224
+ Task {X} of {Y}: {Name}
109
225
 
110
- Task [X] of [Y]: [Name]
111
-
112
- [Checkpoint-specific content]
226
+ {Checkpoint-specific content}
113
227
 
114
- [Resume signal instruction]
228
+ {Resume signal instruction}
115
229
  ════════════════════════════════════════
116
230
  ```
117
231
 
@@ -211,3 +325,40 @@ Why bad: "Good" is meaningless. Specify: accuracy, completeness, tone.
211
325
  - When Claude can verify programmatically (word count, structure)
212
326
 
213
327
  </summary>
328
+
329
+ <gate_integration>
330
+
331
+ ## Gate Integration
332
+
333
+ Checkpoints respect gate settings from `.planning/config.json`. This allows authors to control how much confirmation they want during execution.
334
+
335
+ ### Gate Behavior
336
+
337
+ | Gate Key | Affects | When `false` |
338
+ |----------|---------|-------------|
339
+ | `gates.confirm_write` | `checkpoint:human-verify` during writing | Auto-approved — execution continues without pausing |
340
+ | `gates.confirm_review` | `checkpoint:human-verify` during review | Auto-approved |
341
+ | `gates.confirm_plan` | `checkpoint:human-verify` during planning | Auto-approved |
342
+ | `gates.confirm_outline` | `checkpoint:human-verify` during outlining | Auto-approved |
343
+
344
+ ### Mode Override
345
+
346
+ When `mode: "yolo"`, all non-safety gates are treated as `false`. Checkpoints are auto-approved and execution proceeds without pausing.
347
+
348
+ ### Always-Confirm Checkpoints
349
+
350
+ Some checkpoints are never skipped regardless of gate settings or mode:
351
+
352
+ - **`checkpoint:decision`** — Always pauses. Decisions require human input by definition.
353
+ - **`checkpoint:human-action`** — Always pauses. Agent cannot fabricate human input.
354
+ - **Safety-gated checkpoints** — When `safety.always_confirm_destructive` is `true`, any checkpoint before a destructive operation (deleting content, resetting progress) always pauses.
355
+
356
+ ### Resolution Order
357
+
358
+ 1. Is this a `checkpoint:decision` or `checkpoint:human-action`? → Always pause.
359
+ 2. Is `safety.always_confirm_destructive` relevant? → Always pause.
360
+ 3. Is `mode: "yolo"`? → Auto-approve.
361
+ 4. Is the relevant gate `false`? → Auto-approve.
362
+ 5. Otherwise → Pause and wait for user.
363
+
364
+ </gate_integration>
@@ -0,0 +1,153 @@
1
+ # Context Fidelity
2
+
3
+ CONTEXT.md is the user decision authority. It captures the user's vision for a section from `/wtfp:discuss-section` and flows through the entire pipeline — planning, writing, and verification.
4
+
5
+ ## CONTEXT.md Structure
6
+
7
+ Created by `/wtfp:discuss-section`, stored at `.planning/sections/XX-name/XX-CONTEXT.md`:
8
+
9
+ ```markdown
10
+ ## Vision
11
+ [What the user wants readers to take away]
12
+
13
+ ## Essential
14
+ [Core content that must be present]
15
+
16
+ ## Boundaries
17
+ [What's explicitly out of scope]
18
+
19
+ ## Concerns
20
+ [What they're worried about]
21
+
22
+ ## Decisions
23
+ [Explicit choices the user made during discussion]
24
+
25
+ ## Deferred Ideas
26
+ [Good ideas the user chose to defer]
27
+
28
+ ## Claude's Discretion
29
+ [Areas where Claude can use judgment]
30
+ ```
31
+
32
+ ## Three Decision Categories
33
+
34
+ ### Locked Decisions (from `## Decisions`)
35
+
36
+ User made an explicit choice. MUST be implemented exactly.
37
+
38
+ Examples:
39
+ - "Use chronological structure, not thematic"
40
+ - "Lead with the quantitative results, qualitative second"
41
+ - "Frame as contribution to X, not Y"
42
+
43
+ **Rule**: Every locked decision must map to a task in PLAN.md and appear in written prose.
44
+
45
+ ### Deferred Ideas (from `## Deferred Ideas`)
46
+
47
+ User acknowledged the idea but chose not to include it now. MUST NOT appear.
48
+
49
+ Examples:
50
+ - "Extended comparison with method Z — save for revision"
51
+ - "Additional case study — if reviewers ask"
52
+
53
+ **Rule**: No task, paragraph, or sentence should implement a deferred idea. If a deferred idea is relevant, note it in SUMMARY.md for future consideration.
54
+
55
+ ### Discretion Areas (from `## Claude's Discretion`)
56
+
57
+ User gave Claude freedom to decide. Use judgment.
58
+
59
+ Examples:
60
+ - "Order of subsections within methods"
61
+ - "How much background to provide on technique X"
62
+ - "Citation density in the introduction"
63
+
64
+ **Rule**: Make reasonable choices. Document the choice in SUMMARY.md.
65
+
66
+ ## Loading Pattern
67
+
68
+ All orchestrators load CONTEXT.md early and pass it to every agent:
69
+
70
+ ```bash
71
+ SECTION_DIR=$(ls -d .planning/sections/${SECTION}-* 2>/dev/null | head -1)
72
+ CONTEXT_CONTENT=$(cat "${SECTION_DIR}"/*-CONTEXT.md 2>/dev/null)
73
+ ```
74
+
75
+ Injected into agent prompts as `<user_decisions>` tags:
76
+
77
+ ```
78
+ <user_decisions>
79
+ [CONTEXT_CONTENT inlined here]
80
+ </user_decisions>
81
+ ```
82
+
83
+ **Critical timing**: Store CONTEXT_CONTENT before spawning any agent. Pass to ALL downstream agents in the pipeline.
84
+
85
+ ## Agent Responsibilities
86
+
87
+ ### section-planner
88
+
89
+ Before creating any task:
90
+ 1. Parse locked decisions → create tasks implementing each one
91
+ 2. Parse deferred ideas → verify no task touches them
92
+ 3. Parse discretion areas → handle reasonably
93
+
94
+ Self-check before returning:
95
+ - [ ] Every locked decision has a task implementing it
96
+ - [ ] No task implements a deferred idea
97
+ - [ ] Discretion areas handled reasonably
98
+
99
+ ### plan-checker (Dimension 5: CONTEXT.md Fidelity)
100
+
101
+ Verification:
102
+ - Parse CONTEXT.md decisions
103
+ - For each locked decision, verify a task implements it
104
+ - Scan all tasks for deferred idea references
105
+ - Check discretion areas are handled
106
+
107
+ ### section-writer
108
+
109
+ During execution:
110
+ - Implement locked decisions in actual prose
111
+ - Skip deferred content even if it would improve the section
112
+ - Exercise judgment on discretion areas
113
+ - Track which decisions were implemented for SUMMARY.md
114
+
115
+ ### argument-verifier
116
+
117
+ Post-write check:
118
+ - Were locked decisions implemented in actual prose?
119
+ - Did deferred content accidentally creep in?
120
+ - Were discretion choices reasonable?
121
+
122
+ ## When CONTEXT.md is Missing
123
+
124
+ Not all sections have CONTEXT.md. If missing:
125
+
126
+ - `/wtfp:discuss-section` was skipped (user chose to plan directly)
127
+ - Agents operate without user decision constraints
128
+ - Orchestrator may suggest running discuss-section first but does not require it
129
+
130
+ ## Propagation Map
131
+
132
+ ```
133
+ /wtfp:discuss-section
134
+ → Creates CONTEXT.md
135
+
136
+ /wtfp:plan-section (orchestrator)
137
+ → Loads CONTEXT.md as CONTEXT_CONTENT
138
+ → Passes to section-planner as <user_decisions>
139
+ → Passes to plan-checker for fidelity check (Dimension 5)
140
+
141
+ /wtfp:write-section (orchestrator)
142
+ → Loads CONTEXT.md as CONTEXT_CONTENT
143
+ → Passes to section-writer as <user_decisions>
144
+ → Passes to argument-verifier for fidelity check
145
+
146
+ /wtfp:review-section (orchestrator)
147
+ → Loads CONTEXT.md as CONTEXT_CONTENT
148
+ → Passes to section-reviewer for review against user intent
149
+
150
+ /wtfp:polish-prose (orchestrator)
151
+ → Loads CONTEXT.md as CONTEXT_CONTENT
152
+ → Passes to prose-polisher to preserve user decisions during polish
153
+ ```
@@ -0,0 +1,150 @@
1
+ # Deviation Rules for Writing Agents
2
+
3
+ Rules governing what writing agents can change without asking versus what requires human confirmation. These apply during plan execution when an agent encounters content that needs adjustment beyond the explicit task instructions.
4
+
5
+ Deviations are tracked in SUMMARY.md under "Deviations from Plan".
6
+
7
+ ## Rule 1: Auto-fix (No Confirmation)
8
+
9
+ **Trigger:** Agent encounters a mechanical error that is objectively wrong.
10
+
11
+ **Scope:** Typos, citation formatting errors, markdown formatting issues, reference numbering, broken links, inconsistent heading levels, malformed lists.
12
+
13
+ **Action:** Fix immediately. Do not pause. Do not ask.
14
+
15
+ **Logging:** Add entry to SUMMARY.md deviations list:
16
+ ```
17
+ [Rule 1 - Auto-fix] Fixed {description} in {file}
18
+ ```
19
+
20
+ **Example:**
21
+ Agent is writing the methods section and notices the introduction references "[Smith et al., 2023]" but the citation list has it as "[Smith et al. 2023]" (missing comma). Agent fixes the citation format to match the configured `citation_style` and logs:
22
+ ```
23
+ [Rule 1 - Auto-fix] Fixed missing comma in Smith et al. citation (introduction.md)
24
+ ```
25
+
26
+ **Rationale:** These are errors, not choices. No reasonable author would want to keep them.
27
+
28
+ ## Rule 2: Auto-add (No Confirmation)
29
+
30
+ **Trigger:** Agent identifies a gap in prose flow that can be bridged with a small addition.
31
+
32
+ **Scope:** Transition sentences between paragraphs, topic sentences for paragraphs that lack them, brief connecting phrases between arguments, missing paragraph breaks in wall-of-text blocks.
33
+
34
+ **Action:** Add the missing element. Continue execution.
35
+
36
+ **Logging:** Add entry to SUMMARY.md deviations list:
37
+ ```
38
+ [Rule 2 - Auto-add] Added {description} in {file}
39
+ ```
40
+
41
+ **Example:**
42
+ Agent is drafting the results section and the plan says "Task 3: Write secondary findings". The previous paragraph (Task 2 output) ends abruptly. Agent adds a transition sentence ("Beyond the primary effects, several secondary patterns emerged.") before writing the Task 3 content, and logs:
43
+ ```
44
+ [Rule 2 - Auto-add] Added transition sentence between primary and secondary findings (results.md)
45
+ ```
46
+
47
+ **Rationale:** Prose flow is expected. These additions are small (1-2 sentences), non-argumentative, and improve readability without changing meaning.
48
+
49
+ ## Rule 3: Ask-first (Requires Confirmation)
50
+
51
+ **Trigger:** Agent believes content would benefit from a structural or substantive change.
52
+
53
+ **Scope:** Reordering paragraphs, splitting sections, merging sections, argument reframing, removing content (even redundant content), changing established terminology, altering emphasis or tone, adding new subsections.
54
+
55
+ **Action:** Stop execution. Present the proposed change as a checkpoint. Wait for confirmation before proceeding.
56
+
57
+ **Logging:** If approved and applied, add entry to SUMMARY.md deviations list:
58
+ ```
59
+ [Rule 3 - Ask-first] {description} — approved by author
60
+ ```
61
+ If rejected:
62
+ ```
63
+ [Rule 3 - Ask-first] Proposed {description} — rejected, continued as planned
64
+ ```
65
+
66
+ **Checkpoint format:**
67
+ ```
68
+ ════════════════════════════════════════
69
+ CHECKPOINT: decision
70
+ ════════════════════════════════════════
71
+ Task {X} of {Y}: {Name}
72
+
73
+ Proposed deviation (Rule 3 — structural change):
74
+ {Description of what agent wants to change}
75
+
76
+ Reason:
77
+ {Why this would improve the paper}
78
+
79
+ Impact:
80
+ {What changes if applied}
81
+
82
+ Options:
83
+ [a] Apply the change
84
+ [b] Continue as planned
85
+
86
+ Select: a or b
87
+ ════════════════════════════════════════
88
+ ```
89
+
90
+ **Example:**
91
+ Agent is writing the discussion section and realizes the "limitations" paragraph would read better before "implications" (plan has them in reverse order). Agent pauses:
92
+ ```
93
+ Proposed deviation (Rule 3 — structural change):
94
+ Move limitations paragraph before implications paragraph
95
+
96
+ Reason:
97
+ Addressing limitations first makes the implications argument stronger —
98
+ reader knows the caveats before seeing the claims.
99
+
100
+ Impact:
101
+ Paragraphs 3 and 4 swap order. No content changes.
102
+ ```
103
+
104
+ **Rationale:** Structure and argument framing are authorial choices. The agent may have good reasons, but the author decides.
105
+
106
+ ## Rule 4: Never (Agent Cannot Do)
107
+
108
+ **Trigger:** Agent is tempted to strengthen the paper by adding unsupported content.
109
+
110
+ **Scope:** Adding claims not supported by cited evidence, fabricating citations (inventing author names, titles, DOIs), changing the author's stated position or thesis, inserting data or results not provided by the author, adding acknowledgments or author contributions the author did not specify.
111
+
112
+ **Action:** Do not do it. If the agent identifies a gap where such content is needed, flag it as a TODO for the author.
113
+
114
+ **Logging:** If agent identifies a gap, add a TODO:
115
+ ```
116
+ [Rule 4 - Gap identified] {description} — needs author input
117
+ ```
118
+
119
+ **TODO format in content:**
120
+ ```markdown
121
+ <!-- TODO: [Rule 4] Citation needed for claim about X. Author to provide. -->
122
+ ```
123
+
124
+ **Example:**
125
+ Agent is writing the discussion and the argument would be stronger with a citation supporting the claim "distributed systems show 40% improvement". Agent does not invent a citation. Instead:
126
+ ```markdown
127
+ Distributed systems show significant improvement in throughput
128
+ <!-- TODO: [Rule 4] Citation needed for throughput improvement claim. Author to provide specific reference and percentage. -->
129
+ ```
130
+ And logs:
131
+ ```
132
+ [Rule 4 - Gap identified] Missing citation for throughput improvement claim (discussion.md) — needs author input
133
+ ```
134
+
135
+ **Rationale:** Academic integrity is non-negotiable. Fabricated citations are research misconduct. The author's thesis is their intellectual contribution — agents assist, they do not override.
136
+
137
+ ## Rule Priority
138
+
139
+ When multiple rules could apply:
140
+
141
+ 1. **Rule 4 always wins.** If the fix would require fabricating evidence, it is Rule 4 regardless of how "small" it seems.
142
+ 2. **Rule 3 over Rule 2.** If an addition changes argument structure (not just flow), it is Rule 3.
143
+ 3. **Rule 1 over Rule 2.** If the issue is an error (not a gap), fix it as Rule 1.
144
+
145
+ **Edge cases:**
146
+ - Fixing a citation that exists but is formatted wrong: Rule 1 (formatting error)
147
+ - Adding a citation that does not exist in the bibliography: Rule 4 (fabrication)
148
+ - Adding a topic sentence: Rule 2 (prose flow)
149
+ - Rewriting a topic sentence to change its claim: Rule 3 (substantive change)
150
+ - Fixing a factual error in author-provided content: Rule 3 (the author wrote it intentionally — ask first)
@@ -239,3 +239,83 @@ Each plan produces 3-5 commits (tasks + metadata). Clear, granular, recoverable.
239
239
  - Writing evolution is clear
240
240
 
241
241
  </commit_strategy_rationale>
242
+
243
+ <branching_strategies>
244
+
245
+ ## Branching Strategies
246
+
247
+ Controlled by `git.branching_strategy` in `.planning/config.json`. Three strategies available.
248
+
249
+ ### Strategy: "none" (default)
250
+
251
+ **When to use:** Solo writing, simple papers, no parallel section work.
252
+
253
+ **Behavior:** All commits go to the current branch. No branch creation, no merging.
254
+
255
+ **Branch lifecycle:** None. Work happens wherever `git branch` points.
256
+
257
+ **Merge behavior:** N/A.
258
+
259
+ This is the simplest option. Good for most academic writing workflows where one person writes sequentially.
260
+
261
+ ### Strategy: "section"
262
+
263
+ **When to use:** Papers with independent sections that benefit from parallel work, or when you want clean per-section history.
264
+
265
+ **Behavior:** Each section gets its own branch created from the current branch when `plan-section` starts.
266
+
267
+ **Branch name:** From `git.section_branch_template` (default: `wtfp/section-{section}-{slug}`).
268
+ - `{section}` = section number (e.g., `01`, `02`)
269
+ - `{slug}` = slugified section name (e.g., `introduction`, `related-work`)
270
+ - Example: `wtfp/section-02-related-work`
271
+
272
+ **Branch lifecycle:**
273
+ 1. `plan-section` creates branch: `git checkout -b wtfp/section-{section}-{slug}`
274
+ 2. All writing tasks for that section commit to the section branch
275
+ 3. `review-section` runs on the section branch
276
+ 4. After review passes, branch is merged back to the base branch
277
+ 5. Branch is deleted after successful merge
278
+
279
+ **Merge behavior:**
280
+ - If `git.squash_on_merge` is `false`: merge commit preserves per-task history
281
+ - If `git.squash_on_merge` is `true`: squash merge collapses all section commits into one
282
+
283
+ **Parallel work:** Multiple section branches can exist simultaneously. Different sections can be planned and written in parallel (when `parallelization.enabled` is `true`).
284
+
285
+ ### Strategy: "submission"
286
+
287
+ **When to use:** Papers with clear submission deadlines (conference deadlines, journal revisions), or when you want milestone-based history.
288
+
289
+ **Behavior:** Milestone branches created by `submit-milestone` for each submission target.
290
+
291
+ **Branch name:** From `git.submission_branch_template` (default: `wtfp/{milestone}-{slug}`).
292
+ - `{milestone}` = milestone name (e.g., `draft-1`, `camera-ready`, `revision-2`)
293
+ - `{slug}` = slugified paper title (e.g., `distributed-consensus`)
294
+ - Example: `wtfp/camera-ready-distributed-consensus`
295
+
296
+ **Branch lifecycle:**
297
+ 1. `submit-milestone` creates branch from current state
298
+ 2. Final polishing and formatting commits go to the milestone branch
299
+ 3. Submission checklist verification runs on the branch
300
+ 4. Branch is tagged on completion: `wtfp/submitted/{milestone}-{date}`
301
+ 5. Branch is merged back to the base branch
302
+
303
+ **Merge behavior:**
304
+ - If `git.squash_on_merge` is `false`: merge commit preserves milestone history
305
+ - If `git.squash_on_merge` is `true`: squash merge collapses milestone into one commit
306
+
307
+ **Tags:** Each completed milestone is tagged for easy reference:
308
+ ```
309
+ wtfp/submitted/draft-1-2024-03-15
310
+ wtfp/submitted/camera-ready-2024-06-01
311
+ ```
312
+
313
+ ### Squash on Merge
314
+
315
+ Controlled by `git.squash_on_merge` (default: `false`).
316
+
317
+ **When `false` (default):** Per-task commit history is preserved on merge. The full writing evolution is visible in `git log`. Recommended for most workflows — granular history aids future Claude sessions and revision tracking.
318
+
319
+ **When `true`:** All commits from a section/milestone branch are squashed into a single commit on merge. Produces a cleaner `git log` but loses per-task granularity. Use when the final state matters more than the writing process.
320
+
321
+ </branching_strategies>