wtf-p 0.7.3 → 0.8.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 (241) hide show
  1. package/README.md +16 -12
  2. package/bin/commands/install-logic.js +1 -1
  3. package/bin/lib/adapter-compiler.js +175 -56
  4. package/bin/lib/clio-registration.js +127 -36
  5. package/bin/lib/manifest.js +11 -3
  6. package/bin/uninstall.js +3 -2
  7. package/package.json +1 -1
  8. package/protocol/actions/research-gap.json +1 -1
  9. package/protocol/roles/research-synthesizer.md +1 -1
  10. package/protocol/skills/wtfp-plan-section/references/actions.md +1 -1
  11. package/protocol/skills/wtfp-research-literature/references/actions.md +1 -1
  12. package/protocol/skills/wtfp-write-section/references/actions.md +1 -1
  13. package/protocol/workflows/plan-section.md +3 -2
  14. package/protocol/workflows/research-gap.md +2 -2
  15. package/protocol/workflows/write-section.md +1 -1
  16. package/vendors/antigravity/.wtfp-generated.json +18 -14
  17. package/vendors/antigravity/actions/research-gap.json +1 -1
  18. package/vendors/antigravity/agents/wtfp-research-synthesizer.md +1 -1
  19. package/vendors/antigravity/commands/wtfp-plan-section.md +3 -2
  20. package/vendors/antigravity/commands/wtfp-write-section.md +1 -1
  21. package/vendors/antigravity/plugin.json +1 -1
  22. package/vendors/antigravity/roles/research-synthesizer.md +1 -1
  23. package/vendors/antigravity/skills/wtfp-plan-section/references/actions.md +1 -1
  24. package/vendors/antigravity/skills/wtfp-research-literature/references/actions.md +1 -1
  25. package/vendors/antigravity/skills/wtfp-write-section/references/actions.md +1 -1
  26. package/vendors/antigravity/tools/README.md +1 -1
  27. package/vendors/antigravity/tools/package.json +1 -0
  28. package/vendors/antigravity/workflows/plan-section.md +3 -2
  29. package/vendors/antigravity/workflows/research-gap.md +2 -2
  30. package/vendors/antigravity/workflows/write-section.md +1 -1
  31. package/vendors/claude/.claude-plugin/marketplace.json +2 -2
  32. package/vendors/claude/.claude-plugin/plugin.json +1 -1
  33. package/vendors/claude/.wtfp-generated.json +33 -29
  34. package/vendors/claude/actions/research-gap.json +1 -1
  35. package/vendors/claude/agents/wtfp-research-synthesizer.md +1 -1
  36. package/vendors/claude/ai.iowarp.clio/agents/wtfp-research-synthesizer.md +1 -1
  37. package/vendors/claude/ai.iowarp.clio/prompts/wtfp/analyze-bib.md +2 -0
  38. package/vendors/claude/ai.iowarp.clio/prompts/wtfp/check-refs.md +2 -0
  39. package/vendors/claude/ai.iowarp.clio/prompts/wtfp/create-outline.md +2 -0
  40. package/vendors/claude/ai.iowarp.clio/prompts/wtfp/execute-outline.md +2 -0
  41. package/vendors/claude/ai.iowarp.clio/prompts/wtfp/help.md +1 -1
  42. package/vendors/claude/ai.iowarp.clio/prompts/wtfp/plan-section.md +5 -2
  43. package/vendors/claude/ai.iowarp.clio/prompts/wtfp/polish-prose.md +2 -0
  44. package/vendors/claude/ai.iowarp.clio/prompts/wtfp/quick.md +2 -0
  45. package/vendors/claude/ai.iowarp.clio/prompts/wtfp/research-gap.md +8 -2
  46. package/vendors/claude/ai.iowarp.clio/prompts/wtfp/review-section.md +2 -0
  47. package/vendors/claude/ai.iowarp.clio/prompts/wtfp/write-section.md +3 -1
  48. package/vendors/claude/commands/plan-section.md +3 -2
  49. package/vendors/claude/commands/research-gap.md +2 -2
  50. package/vendors/claude/commands/write-section.md +1 -1
  51. package/vendors/claude/plugin.json +1 -1
  52. package/vendors/claude/roles/research-synthesizer.md +1 -1
  53. package/vendors/claude/skills/wtfp-plan-section/references/actions.md +1 -1
  54. package/vendors/claude/skills/wtfp-research-literature/references/actions.md +1 -1
  55. package/vendors/claude/skills/wtfp-write-section/references/actions.md +1 -1
  56. package/vendors/claude/tools/README.md +1 -1
  57. package/vendors/claude/tools/package.json +1 -0
  58. package/vendors/claude/workflows/plan-section.md +3 -2
  59. package/vendors/claude/workflows/research-gap.md +2 -2
  60. package/vendors/claude/workflows/write-section.md +1 -1
  61. package/vendors/clio-extension/.wtfp-generated.json +228 -0
  62. package/vendors/clio-extension/actions/add-todo.json +52 -0
  63. package/vendors/clio-extension/actions/analyze-bib.json +97 -0
  64. package/vendors/clio-extension/actions/audit-milestone.json +63 -0
  65. package/vendors/clio-extension/actions/check-refs.json +80 -0
  66. package/vendors/clio-extension/actions/check-todos.json +52 -0
  67. package/vendors/clio-extension/actions/checkpoint.json +76 -0
  68. package/vendors/clio-extension/actions/contribute.json +57 -0
  69. package/vendors/clio-extension/actions/create-outline.json +84 -0
  70. package/vendors/clio-extension/actions/create-poster.json +54 -0
  71. package/vendors/clio-extension/actions/create-slides.json +54 -0
  72. package/vendors/clio-extension/actions/discuss-section.json +76 -0
  73. package/vendors/clio-extension/actions/execute-outline.json +116 -0
  74. package/vendors/clio-extension/actions/export-latex.json +65 -0
  75. package/vendors/clio-extension/actions/help.json +30 -0
  76. package/vendors/clio-extension/actions/insert-section.json +61 -0
  77. package/vendors/clio-extension/actions/list-assumptions.json +35 -0
  78. package/vendors/clio-extension/actions/map-project.json +71 -0
  79. package/vendors/clio-extension/actions/new-paper.json +70 -0
  80. package/vendors/clio-extension/actions/pause-writing.json +71 -0
  81. package/vendors/clio-extension/actions/plan-milestone-gaps.json +57 -0
  82. package/vendors/clio-extension/actions/plan-revision.json +58 -0
  83. package/vendors/clio-extension/actions/plan-section.json +100 -0
  84. package/vendors/clio-extension/actions/polish-prose.json +69 -0
  85. package/vendors/clio-extension/actions/progress.json +51 -0
  86. package/vendors/clio-extension/actions/quick.json +70 -0
  87. package/vendors/clio-extension/actions/remove-section.json +63 -0
  88. package/vendors/clio-extension/actions/report-bug.json +47 -0
  89. package/vendors/clio-extension/actions/request-feature.json +47 -0
  90. package/vendors/clio-extension/actions/research-gap.json +102 -0
  91. package/vendors/clio-extension/actions/resume-writing.json +65 -0
  92. package/vendors/clio-extension/actions/review-section.json +83 -0
  93. package/vendors/clio-extension/actions/settings.json +47 -0
  94. package/vendors/clio-extension/actions/submit-milestone.json +77 -0
  95. package/vendors/clio-extension/actions/update.json +42 -0
  96. package/vendors/clio-extension/actions/verify-work.json +63 -0
  97. package/vendors/clio-extension/actions/write-section.json +115 -0
  98. package/vendors/clio-extension/clio-coder-extension.yaml +53 -0
  99. package/vendors/clio-extension/compatibility/action-availability.json +295 -0
  100. package/vendors/clio-extension/project/schemas/checkpoint.schema.json +102 -0
  101. package/vendors/clio-extension/project/schemas/common.schema.json +33 -0
  102. package/vendors/clio-extension/project/schemas/config.schema.json +69 -0
  103. package/vendors/clio-extension/project/schemas/decisions.schema.json +31 -0
  104. package/vendors/clio-extension/project/schemas/evidence.schema.json +48 -0
  105. package/vendors/clio-extension/project/schemas/manifest.schema.json +102 -0
  106. package/vendors/clio-extension/project/schemas/outline.schema.json +67 -0
  107. package/vendors/clio-extension/project/schemas/section.schema.json +95 -0
  108. package/vendors/clio-extension/project/schemas/source.schema.json +73 -0
  109. package/vendors/clio-extension/project/schemas/state.schema.json +58 -0
  110. package/vendors/clio-extension/project/schemas/validation.schema.json +74 -0
  111. package/vendors/clio-extension/runtime/extension.test.ts +248 -0
  112. package/vendors/clio-extension/runtime/extension.ts +1321 -0
  113. package/vendors/clio-extension/runtime/json-schema.cjs +304 -0
  114. package/vendors/clio-extension/runtime/package.json +3 -0
  115. package/vendors/clio-extension/runtime/write-guard.json +21 -0
  116. package/vendors/clio-extension/skins/wtfp.json +20 -0
  117. package/vendors/codex/plugins/wtfp/.codex-plugin/plugin.json +1 -1
  118. package/vendors/codex/plugins/wtfp/.wtfp-generated.json +17 -13
  119. package/vendors/codex/plugins/wtfp/actions/research-gap.json +1 -1
  120. package/vendors/codex/plugins/wtfp/agents/wtfp-research-synthesizer.toml +1 -1
  121. package/vendors/codex/plugins/wtfp/plugin.json +1 -1
  122. package/vendors/codex/plugins/wtfp/roles/research-synthesizer.md +1 -1
  123. package/vendors/codex/plugins/wtfp/skills/wtfp-plan-section/references/actions.md +1 -1
  124. package/vendors/codex/plugins/wtfp/skills/wtfp-research-literature/references/actions.md +1 -1
  125. package/vendors/codex/plugins/wtfp/skills/wtfp-write-section/references/actions.md +1 -1
  126. package/vendors/codex/plugins/wtfp/tools/README.md +1 -1
  127. package/vendors/codex/plugins/wtfp/tools/package.json +1 -0
  128. package/vendors/codex/plugins/wtfp/workflows/plan-section.md +3 -2
  129. package/vendors/codex/plugins/wtfp/workflows/research-gap.md +2 -2
  130. package/vendors/codex/plugins/wtfp/workflows/write-section.md +1 -1
  131. package/vendors/copilot/.wtfp-generated.json +14 -14
  132. package/vendors/copilot/marketplace.json +2 -2
  133. package/vendors/copilot/plugins/wtfp/.claude-plugin/plugin.json +1 -1
  134. package/vendors/copilot/plugins/wtfp/.wtfp-generated.json +18 -14
  135. package/vendors/copilot/plugins/wtfp/actions/research-gap.json +1 -1
  136. package/vendors/copilot/plugins/wtfp/agents/wtfp-research-synthesizer.md +1 -1
  137. package/vendors/copilot/plugins/wtfp/commands/wtfp-plan-section.md +3 -2
  138. package/vendors/copilot/plugins/wtfp/commands/wtfp-write-section.md +1 -1
  139. package/vendors/copilot/plugins/wtfp/roles/research-synthesizer.md +1 -1
  140. package/vendors/copilot/plugins/wtfp/skills/wtfp-plan-section/references/actions.md +1 -1
  141. package/vendors/copilot/plugins/wtfp/skills/wtfp-research-literature/references/actions.md +1 -1
  142. package/vendors/copilot/plugins/wtfp/skills/wtfp-write-section/references/actions.md +1 -1
  143. package/vendors/copilot/plugins/wtfp/tools/README.md +1 -1
  144. package/vendors/copilot/plugins/wtfp/tools/package.json +1 -0
  145. package/vendors/copilot/plugins/wtfp/workflows/plan-section.md +3 -2
  146. package/vendors/copilot/plugins/wtfp/workflows/research-gap.md +2 -2
  147. package/vendors/copilot/plugins/wtfp/workflows/write-section.md +1 -1
  148. package/vendors/copilot/project/.github/agents/wtfp-research-synthesizer.agent.md +1 -1
  149. package/vendors/copilot/project/.github/skills/wtfp-plan-section/references/actions.md +1 -1
  150. package/vendors/copilot/project/.github/skills/wtfp-research-literature/references/actions.md +1 -1
  151. package/vendors/copilot/project/.github/skills/wtfp-write-section/references/actions.md +1 -1
  152. package/vendors/copilot/project/.github/wtfp/actions/research-gap.json +1 -1
  153. package/vendors/copilot/project/.github/wtfp/roles/research-synthesizer.md +1 -1
  154. package/vendors/copilot/project/.github/wtfp/skills/wtfp-plan-section/references/actions.md +1 -1
  155. package/vendors/copilot/project/.github/wtfp/skills/wtfp-research-literature/references/actions.md +1 -1
  156. package/vendors/copilot/project/.github/wtfp/skills/wtfp-write-section/references/actions.md +1 -1
  157. package/vendors/copilot/project/.github/wtfp/workflows/plan-section.md +3 -2
  158. package/vendors/copilot/project/.github/wtfp/workflows/research-gap.md +2 -2
  159. package/vendors/copilot/project/.github/wtfp/workflows/write-section.md +1 -1
  160. package/vendors/gemini/.wtfp-generated.json +24 -20
  161. package/vendors/gemini/actions/research-gap.json +1 -1
  162. package/vendors/gemini/agents/wtfp-research-synthesizer.md +1 -1
  163. package/vendors/gemini/commands/wtfp/discuss-section.toml +1 -1
  164. package/vendors/gemini/commands/wtfp/execute-outline.toml +1 -1
  165. package/vendors/gemini/commands/wtfp/insert-section.toml +1 -1
  166. package/vendors/gemini/commands/wtfp/list-assumptions.toml +1 -1
  167. package/vendors/gemini/commands/wtfp/plan-revision.toml +1 -1
  168. package/vendors/gemini/commands/wtfp/plan-section.toml +4 -3
  169. package/vendors/gemini/commands/wtfp/quick.toml +1 -1
  170. package/vendors/gemini/commands/wtfp/write-section.toml +2 -2
  171. package/vendors/gemini/gemini-extension.json +1 -1
  172. package/vendors/gemini/roles/research-synthesizer.md +1 -1
  173. package/vendors/gemini/skills/wtfp-plan-section/references/actions.md +1 -1
  174. package/vendors/gemini/skills/wtfp-research-literature/references/actions.md +1 -1
  175. package/vendors/gemini/skills/wtfp-write-section/references/actions.md +1 -1
  176. package/vendors/gemini/tools/README.md +1 -1
  177. package/vendors/gemini/tools/package.json +1 -0
  178. package/vendors/gemini/workflows/plan-section.md +3 -2
  179. package/vendors/gemini/workflows/research-gap.md +2 -2
  180. package/vendors/gemini/workflows/write-section.md +1 -1
  181. package/vendors/opencode/.wtfp-generated.json +23 -19
  182. package/vendors/opencode/actions/research-gap.json +1 -1
  183. package/vendors/opencode/agents/wtfp/research-synthesizer.md +1 -1
  184. package/vendors/opencode/commands/wtfp/discuss-section.md +1 -1
  185. package/vendors/opencode/commands/wtfp/execute-outline.md +1 -1
  186. package/vendors/opencode/commands/wtfp/insert-section.md +1 -1
  187. package/vendors/opencode/commands/wtfp/list-assumptions.md +1 -1
  188. package/vendors/opencode/commands/wtfp/plan-revision.md +1 -1
  189. package/vendors/opencode/commands/wtfp/plan-section.md +4 -3
  190. package/vendors/opencode/commands/wtfp/quick.md +1 -1
  191. package/vendors/opencode/commands/wtfp/write-section.md +2 -2
  192. package/vendors/opencode/roles/research-synthesizer.md +1 -1
  193. package/vendors/opencode/skills/wtfp-plan-section/references/actions.md +1 -1
  194. package/vendors/opencode/skills/wtfp-research-literature/references/actions.md +1 -1
  195. package/vendors/opencode/skills/wtfp-write-section/references/actions.md +1 -1
  196. package/vendors/opencode/tools/README.md +1 -1
  197. package/vendors/opencode/tools/package.json +1 -0
  198. package/vendors/opencode/workflows/plan-section.md +3 -2
  199. package/vendors/opencode/workflows/research-gap.md +2 -2
  200. package/vendors/opencode/workflows/write-section.md +1 -1
  201. package/vendors/plugin/.wtfp-generated.json +44 -40
  202. package/vendors/plugin/actions/research-gap.json +1 -1
  203. package/vendors/plugin/ai.iowarp.clio/agents/wtfp-research-synthesizer.md +1 -1
  204. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/add-todo.md +6 -12
  205. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/analyze-bib.md +9 -19
  206. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/audit-milestone.md +7 -25
  207. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/check-refs.md +9 -15
  208. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/check-todos.md +9 -13
  209. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/checkpoint.md +7 -27
  210. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/create-outline.md +9 -25
  211. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/discuss-section.md +7 -17
  212. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/execute-outline.md +10 -27
  213. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/help.md +2 -2
  214. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/insert-section.md +7 -13
  215. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/map-project.md +6 -14
  216. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/new-paper.md +7 -17
  217. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/pause-writing.md +6 -18
  218. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/plan-milestone-gaps.md +7 -15
  219. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/plan-section.md +12 -29
  220. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/polish-prose.md +10 -15
  221. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/quick.md +10 -15
  222. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/research-gap.md +15 -23
  223. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/resume-writing.md +7 -23
  224. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/review-section.md +9 -19
  225. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/settings.md +7 -9
  226. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/submit-milestone.md +7 -25
  227. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/verify-work.md +7 -15
  228. package/vendors/plugin/ai.iowarp.clio/prompts/wtfp/write-section.md +11 -29
  229. package/vendors/plugin/compatibility/action-availability.json +16 -1
  230. package/vendors/plugin/plugin.json +7 -7
  231. package/vendors/plugin/roles/research-synthesizer.md +1 -1
  232. package/vendors/plugin/skills/wtfp-plan-section/references/actions.md +1 -1
  233. package/vendors/plugin/skills/wtfp-research-literature/references/actions.md +1 -1
  234. package/vendors/plugin/skills/wtfp-write-section/references/actions.md +1 -1
  235. package/vendors/plugin/tools/README.md +1 -1
  236. package/vendors/plugin/tools/package.json +1 -0
  237. package/vendors/plugin/workflows/plan-section.md +3 -2
  238. package/vendors/plugin/workflows/research-gap.md +2 -2
  239. package/vendors/plugin/workflows/write-section.md +1 -1
  240. /package/vendors/plugin/ai.iowarp.clio/{fleets → playbooks}/wtfp-draft-review.md +0 -0
  241. /package/vendors/plugin/ai.iowarp.clio/{fleets → playbooks}/wtfp-plan-section.md +0 -0
@@ -5,9 +5,9 @@ const path = require('path');
5
5
  const { createTargetGuard, resolveOwnedPath, sha256Buffer } = require('./ownership');
6
6
 
7
7
  // Clio owns integrity, provenance, drift and enable/disable for an installed
8
- // plugin. WTF-P owns two much smaller things: the exact bytes it publishes
9
- // (its v2 receipt) and the guarantee that the tree handed to Clio is the
10
- // generated bundle and nothing else.
8
+ // plugin or extension. WTF-P owns two much smaller things: the exact bytes it
9
+ // publishes (its v2 receipt) and the guarantee that each tree handed to Clio
10
+ // is the generated package and nothing else.
11
11
  function treeFiles(root) {
12
12
  const files = new Map();
13
13
  function visit(directory) {
@@ -37,10 +37,11 @@ function scopeOptions(targetDir, options) {
37
37
  return { ...options, cwd, scope: project ? 'project' : 'user' };
38
38
  }
39
39
 
40
- function generatedBundle(root) {
40
+ function generatedBundle(root, target = 'portable-plugin') {
41
41
  const inventoryPath = path.join(root, '.wtfp-generated.json');
42
+ if (!fs.existsSync(inventoryPath)) return null;
42
43
  const inventory = JSON.parse(fs.readFileSync(inventoryPath, 'utf8'));
43
- if (inventory.schema !== 'wtfp.generated-adapter/v1' || inventory.target !== 'portable-plugin') {
44
+ if (inventory.schema !== 'wtfp.generated-adapter/v1' || inventory.target !== target) {
44
45
  return null;
45
46
  }
46
47
  const expected = new Map(inventory.files.map(file => [file.path, file.sha256]));
@@ -108,42 +109,110 @@ function installedListEntry(stdout, targetDir, native, scope) {
108
109
  return matches[0];
109
110
  }
110
111
 
111
- // Registration is what WTF-P is responsible for. Whether the operator has the
112
- // plugin switched on is Clio's state and their decision, so it is reported,
112
+ function installedExtensionEntry(stdout, targetDir, native, scope) {
113
+ const listing = JSON.parse(stdout);
114
+ if (!listing || !Array.isArray(listing.extensions)) {
115
+ throw new Error('Clio extensions list did not return an extensions array');
116
+ }
117
+ for (const entry of listing.extensions) {
118
+ if (!installedRecord(entry)) throw new Error('Clio extensions list returned a malformed installed extension');
119
+ }
120
+ const matches = listing.extensions.filter(entry => entry.id === native.id && entry.scope === scope &&
121
+ sameRoot(entry.rootPath, path.join(targetDir, native.source)));
122
+ if (matches.length > 1) throw new Error('Clio extensions list returned duplicate installed extension identities');
123
+ return matches[0];
124
+ }
125
+
126
+ // The two Clio packages WTF-P installs, plugin first. Each is its own Clio
127
+ // install with its own lifecycle command, generated inventory and checks.
128
+ function clioPackages(native) {
129
+ const plugin = {
130
+ noun: 'plugin', command: 'library', id: native.id, source: native.source, inventory: 'portable-plugin',
131
+ deferral: 'Clio activation requires an intact generated bundle without extra or modified files',
132
+ list: () => ['library', 'list', '--kind', 'plugin', '--json'],
133
+ listed: (stdout, targetDir, scope) => installedListEntry(stdout, targetDir, native, scope),
134
+ // `inspect` returns the installed record for the explicitly selected scope.
135
+ verify: scope => ['library', 'inspect', native.id, `--${scope}`, '--json'],
136
+ verified: (stdout, targetDir, scope) => verifiedEntry(stdout, targetDir, native, scope)
137
+ };
138
+ if (!native.extension) return [plugin];
139
+ const extension = native.extension;
140
+ const listed = (stdout, targetDir, scope) => installedExtensionEntry(stdout, targetDir, extension, scope);
141
+ return [plugin, {
142
+ noun: 'extension', command: 'extensions', id: extension.id, source: extension.source, inventory: 'clio-extension',
143
+ deferral: 'Clio extension activation requires an intact generated extension without extra or modified files',
144
+ list: scope => ['extensions', 'list', `--${scope}`, '--json'],
145
+ listed,
146
+ verify: scope => ['extensions', 'list', `--${scope}`, '--json'],
147
+ verified: listed
148
+ }];
149
+ }
150
+
151
+ // Registration is what WTF-P is responsible for. Whether the operator has a
152
+ // package switched on is Clio's state and their decision, so it is reported,
113
153
  // never asserted and never changed.
114
154
  function registered(entry) {
115
155
  return Boolean(entry) && entry.valid === true &&
116
156
  Array.isArray(entry.diagnostics) && entry.diagnostics.length === 0;
117
157
  }
118
158
 
119
- function disabledNotice(native, scope) {
120
- return `Clio reports ${native.id} as installed but disabled. WTF-P does not change that preference; run clio-coder library enable ${native.id} --${scope} to switch it back on.`;
159
+ function disabledNotice(pkg, scope) {
160
+ return `Clio reports ${pkg.id} as installed but disabled. WTF-P does not change that preference; run clio-coder ${pkg.command} enable ${pkg.id} --${scope} to switch it back on.`;
121
161
  }
122
162
 
163
+ // Install the plugin, then the extension. A failure in the second compensates
164
+ // the first, and the returned compensator undoes both in reverse order.
123
165
  function activateClio(targetDir, native, suppliedOptions) {
124
166
  const options = scopeOptions(targetDir, suppliedOptions);
167
+ const activated = [];
168
+ try {
169
+ for (const pkg of clioPackages(native)) {
170
+ const result = activatePackage(targetDir, pkg, options);
171
+ activated.push(result);
172
+ if (result.status !== 'registered') break;
173
+ }
174
+ } catch (error) {
175
+ const failures = activated.reverse().flatMap(result => typeof result.rollback === 'function' ? result.rollback() : []);
176
+ if (failures.length) error.nativeRollbackFailures = [...(error.nativeRollbackFailures || []), ...failures];
177
+ throw error;
178
+ }
179
+ if (activated.length === 1) return activated[0];
180
+ const last = activated[activated.length - 1];
181
+ const notices = activated.map(result => result.notice).filter(Boolean);
182
+ return {
183
+ status: last.status, executable: 'clio-coder',
184
+ ...(last.reason ? { reason: last.reason } : {}),
185
+ results: activated.flatMap(result => result.results),
186
+ ...(notices.length ? { notice: notices.join(' ') } : {}),
187
+ rollback() {
188
+ return [...activated].reverse().flatMap(result => typeof result.rollback === 'function' ? result.rollback() : []);
189
+ },
190
+ commit() {
191
+ const warnings = activated.map(result => typeof result.commit === 'function' ? result.commit() : undefined).filter(Boolean);
192
+ return warnings.length ? warnings.join('; ') : undefined;
193
+ }
194
+ };
195
+ }
196
+
197
+ function activatePackage(targetDir, pkg, options) {
125
198
  const { execute, environment } = options;
126
199
  const guard = createTargetGuard(targetDir);
127
- const root = resolveOwnedPath(targetDir, native.source, guard);
200
+ const root = resolveOwnedPath(targetDir, pkg.source, guard);
128
201
  const publishedFiles = treeFiles(root);
129
- const expected = generatedBundle(root);
202
+ const expected = generatedBundle(root, pkg.inventory);
130
203
  if (!expected || !sameTree(expected, publishedFiles)) {
131
- return {
132
- status: 'deferred',
133
- reason: 'Clio activation requires an intact generated bundle without extra or modified files',
134
- results: []
135
- };
204
+ return { status: 'deferred', reason: pkg.deferral, results: [] };
136
205
  }
137
206
 
138
207
  const results = [];
139
- const priorList = execute('clio-coder', ['library', 'list', '--kind', 'plugin', '--json'], environment, options);
208
+ const priorList = execute('clio-coder', pkg.list(options.scope), environment, options);
140
209
  if (priorList.status === 'unavailable') return { status: 'unavailable', executable: 'clio-coder', results };
141
210
  results.push(priorList);
142
- const priorEntry = installedListEntry(priorList.stdout, targetDir, native, options.scope);
211
+ const priorEntry = pkg.listed(priorList.stdout, targetDir, options.scope);
143
212
  if (registered(priorEntry)) {
144
213
  return {
145
214
  status: 'registered', executable: 'clio-coder', results,
146
- ...(priorEntry.enabled === false ? { notice: disabledNotice(native, options.scope) } : {})
215
+ ...(priorEntry.enabled === false ? { notice: disabledNotice(pkg, options.scope) } : {})
147
216
  };
148
217
  }
149
218
 
@@ -152,7 +221,7 @@ function activateClio(targetDir, native, suppliedOptions) {
152
221
  // until the receipt is durable lets a failed registration put the previous
153
222
  // installation back before the file transaction rolls it back.
154
223
  const staging = fs.mkdtempSync(path.join(path.dirname(root), '.wtfp-staged-'));
155
- const source = path.join(staging, 'wtfp');
224
+ const source = path.join(staging, pkg.id);
156
225
  fs.renameSync(root, source);
157
226
  let finished = false;
158
227
 
@@ -163,15 +232,15 @@ function activateClio(targetDir, native, suppliedOptions) {
163
232
  if (!sameTree(publishedFiles, treeFiles(root))) {
164
233
  throw new Error('Clio content changed concurrently; recovery tree preserved');
165
234
  }
166
- const removal = execute('clio-coder', ['library', 'remove', native.id, `--${options.scope}`, '--json'], environment,
235
+ const removal = execute('clio-coder', [pkg.command, 'remove', pkg.id, `--${options.scope}`, '--json'], environment,
167
236
  { ...options, allowAlreadyAbsent: true });
168
237
  results.push(removal);
169
238
  if (removal.status === 'unavailable') throw new Error('Clio became unavailable during rollback');
170
239
  }
171
240
  if (fs.existsSync(root)) throw new Error('Clio rollback did not remove the replacement');
172
- const after = execute('clio-coder', ['library', 'list', '--kind', 'plugin', '--json'], environment, options);
241
+ const after = execute('clio-coder', pkg.list(options.scope), environment, options);
173
242
  results.push(after);
174
- if (after.status === 'unavailable' || installedListEntry(after.stdout, targetDir, native, options.scope)) {
243
+ if (after.status === 'unavailable' || pkg.listed(after.stdout, targetDir, options.scope)) {
175
244
  throw new Error('Clio rollback did not clear the replacement registration');
176
245
  }
177
246
  fs.renameSync(source, root);
@@ -184,22 +253,22 @@ function activateClio(targetDir, native, suppliedOptions) {
184
253
  }
185
254
 
186
255
  try {
187
- const installation = execute('clio-coder', ['library', 'install', source, `--${options.scope}`, '--json'], environment, options);
256
+ const installation = execute('clio-coder', [pkg.command, 'install', source, `--${options.scope}`, '--json'], environment, options);
188
257
  results.push(installation);
189
258
  if (installation.status === 'unavailable') throw new Error('Clio became unavailable during installation');
190
- const inspected = execute('clio-coder', ['library', 'inspect', native.id, `--${options.scope}`, '--json'], environment, options);
259
+ const inspected = execute('clio-coder', pkg.verify(options.scope), environment, options);
191
260
  results.push(inspected);
192
261
  if (inspected.status === 'unavailable') throw new Error('Clio became unavailable during verification');
193
- const entry = verifiedEntry(inspected.stdout, targetDir, native, options.scope);
262
+ const entry = pkg.verified(inspected.stdout, targetDir, options.scope);
194
263
  if (!registered(entry) || !sameTree(publishedFiles, treeFiles(root))) {
195
- throw new Error('Clio did not report the exact WTF-P plugin as installed and valid with zero diagnostics');
264
+ throw new Error(`Clio did not report the exact WTF-P ${pkg.noun} as installed and valid with zero diagnostics`);
196
265
  }
197
266
  if (priorEntry && priorEntry.enabled !== entry.enabled) {
198
- throw new Error('Clio installation changed the existing WTF-P enabled preference');
267
+ throw new Error(`Clio installation changed the existing WTF-P ${pkg.noun} enabled preference`);
199
268
  }
200
269
  return {
201
270
  status: 'registered', executable: 'clio-coder', results, rollback,
202
- ...(entry.enabled === false ? { notice: disabledNotice(native, options.scope) } : {}),
271
+ ...(entry.enabled === false ? { notice: disabledNotice(pkg, options.scope) } : {}),
203
272
  commit() {
204
273
  // Only the private held copy is removed; Clio owns its installed tree.
205
274
  finished = true;
@@ -217,27 +286,49 @@ function activateClio(targetDir, native, suppliedOptions) {
217
286
  }
218
287
  }
219
288
 
289
+ // Remove the extension, then the plugin, each only when the receipt proves it.
290
+ // `ownedFiles` maps receipt paths below the target to their published hashes.
220
291
  function deactivateClio(targetDir, native, suppliedOptions) {
221
292
  const options = scopeOptions(targetDir, suppliedOptions);
293
+ const removed = [];
294
+ for (const pkg of clioPackages(native).reverse()) {
295
+ const prefix = `${pkg.source}/`;
296
+ const ownedFiles = options.ownedFiles && new Map([...options.ownedFiles]
297
+ .filter(([file]) => file.startsWith(prefix))
298
+ .map(([file, hash]) => [file.slice(prefix.length), hash]));
299
+ const result = deactivatePackage(targetDir, pkg, { ...options, ownedFiles });
300
+ if (result.status === 'unavailable') return result;
301
+ removed.push(result);
302
+ }
303
+ if (removed.length === 1) return removed[0];
304
+ const deferred = removed.find(result => result.status === 'deferred');
305
+ const results = removed.flatMap(result => result.results);
306
+ if (deferred) return { status: 'deferred', reason: deferred.reason, results };
307
+ return removed.some(result => result.status === 'unregistered')
308
+ ? { status: 'unregistered', executable: 'clio-coder', results }
309
+ : { status: 'not-required', results };
310
+ }
311
+
312
+ function deactivatePackage(targetDir, pkg, options) {
222
313
  const { execute, environment } = options;
223
314
  const guard = createTargetGuard(targetDir);
224
- const listing = execute('clio-coder', ['library', 'list', '--kind', 'plugin', '--json'], environment, options);
315
+ const listing = execute('clio-coder', pkg.list(options.scope), environment, options);
225
316
  if (listing.status === 'unavailable') return { status: 'unavailable', executable: 'clio-coder', results: [] };
226
- if (!installedListEntry(listing.stdout, targetDir, native, options.scope)) {
317
+ if (!pkg.listed(listing.stdout, targetDir, options.scope)) {
227
318
  return { status: 'not-required', results: [listing] };
228
319
  }
229
320
 
230
321
  // Native removal is recursive. Run it only when the receipt proves that every
231
322
  // file below the installed root is one WTF-P published and nobody changed.
232
- const root = resolveOwnedPath(targetDir, native.source, guard);
323
+ const root = resolveOwnedPath(targetDir, pkg.source, guard);
233
324
  const ownedFiles = options.ownedFiles;
234
325
  if (!ownedFiles || !sameTree(treeFiles(root), ownedFiles)) {
235
- return { status: 'deferred', reason: 'Clio native removal would include unowned or modified plugin files', results: [listing] };
326
+ return { status: 'deferred', reason: `Clio native removal would include unowned or modified ${pkg.noun} files`, results: [listing] };
236
327
  }
237
- const result = execute('clio-coder', ['library', 'remove', native.id, `--${options.scope}`, '--json'], environment, options);
328
+ const result = execute('clio-coder', [pkg.command, 'remove', pkg.id, `--${options.scope}`, '--json'], environment, options);
238
329
  if (result.status === 'unavailable') return { status: 'unavailable', executable: 'clio-coder', results: [listing] };
239
- const after = execute('clio-coder', ['library', 'list', '--kind', 'plugin', '--json'], environment, options);
240
- if (after.status === 'unavailable' || fs.existsSync(root) || installedListEntry(after.stdout, targetDir, native, options.scope)) {
330
+ const after = execute('clio-coder', pkg.list(options.scope), environment, options);
331
+ if (after.status === 'unavailable' || fs.existsSync(root) || pkg.listed(after.stdout, targetDir, options.scope)) {
241
332
  throw new Error('Clio removal did not clear WTF-P content and registration');
242
333
  }
243
334
  return { status: 'unregistered', executable: 'clio-coder', results: [listing, result, after] };
@@ -67,8 +67,9 @@ const MANIFEST = {
67
67
  source: 'marketplaces/wtfp'
68
68
  }
69
69
  },
70
- // Clio consumes the canonical Agent Plugins bundle through its own plugin
71
- // lifecycle. There is no second WTF-P packaging for this host.
70
+ // Clio consumes the canonical Agent Plugins bundle through its plugin
71
+ // lifecycle and the desk through its extension lifecycle: two packages, two
72
+ // Clio installs, one WTF-P receipt.
72
73
  clio: {
73
74
  name: 'Clio Coder',
74
75
  configDirEnv: 'CLIO_CODER_CONFIG_DIR',
@@ -80,6 +81,12 @@ const MANIFEST = {
80
81
  src: path.join(ROOT, 'vendors', 'plugin'),
81
82
  dest: 'plugins/wtfp',
82
83
  type: 'dir'
84
+ },
85
+ {
86
+ id: 'extension',
87
+ src: path.join(ROOT, 'vendors', 'clio-extension'),
88
+ dest: 'extensions/wtfp',
89
+ type: 'dir'
83
90
  }
84
91
  ],
85
92
  discovery: {
@@ -89,7 +96,8 @@ const MANIFEST = {
89
96
  native: {
90
97
  kind: 'clio-plugin',
91
98
  id: 'wtfp',
92
- source: 'plugins/wtfp'
99
+ source: 'plugins/wtfp',
100
+ extension: { id: 'wtfp', source: 'extensions/wtfp' }
93
101
  }
94
102
  },
95
103
  codex: {
package/bin/uninstall.js CHANGED
@@ -780,9 +780,10 @@ async function uninstall(runtime, options, out) {
780
780
  vendorConfig.native,
781
781
  { ...(vendorKey === 'clio' && plan.receipt.scope === 'project'
782
782
  ? { scope: 'project', cwd: path.dirname(targetDir) } : {}),
783
+ // Receipt paths below the target; Clio checks each package root against them.
783
784
  ownedFiles: new Map(plan.items
784
- .filter(item => item.path.startsWith(`${vendorConfig.native.source}/`) && item.state === 'unchanged')
785
- .map(item => [item.path.slice(vendorConfig.native.source.length + 1), item.entry.sha256])) }
785
+ .filter(item => item.state === 'unchanged')
786
+ .map(item => [item.path, item.entry.sha256])) }
786
787
  );
787
788
  if (nativeRemoval.status === 'unavailable' && !options.hasQuiet) {
788
789
  out.warn(`${nativeRemoval.executable} is unavailable; removing the WTF-P-owned staging files without changing the client's native registry.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wtf-p",
3
- "version": "0.7.3",
3
+ "version": "0.8.0",
4
4
  "description": "Portable, evidence-grounded academic writing workflows (papers, proposals, posters, presentations) for Clio Coder, Claude Code, Codex, GitHub Copilot CLI, OpenCode, Antigravity CLI, and Gemini CLI.",
5
5
  "bin": {
6
6
  "wtfp": "bin/install.js",
@@ -96,7 +96,7 @@
96
96
  },
97
97
  {
98
98
  "id": "user.gate",
99
- "scope": "the external providers, bounded query set, and research scope and depth"
99
+ "scope": "unapproved or paid external providers and bounded query set, plus author-owned research scope and depth decisions"
100
100
  }
101
101
  ]
102
102
  }
@@ -42,7 +42,7 @@ Investigate the literature needed to plan and write a specific section well. The
42
42
  ## Boundaries
43
43
 
44
44
  - This is a `mutation-report` role. It may write only the research and suggestion artifacts authorized by the invoking action.
45
- - When external literature search is approved, `citation-search` may run with `--backend=cite-nexus` and an explicit `--providers` list after the gate. Returned results stay candidates, and this role never performs a bibliography write.
45
+ - An operator-configured, trusted read-only CiteNexus MCP connection may search bounded public scholarly metadata without a second per-query gate. In an explicitly selected full-auto host session for this research action, `citation-search --backend=cite-nexus` may also search `crossref`, `datacite`, `europe_pmc`, or `arxiv` without another gate. Other providers or modes require explicit network approval naming providers and query bounds. Honor offline flags and host refusals. Returned results stay candidates, and this role never performs a bibliography write.
46
46
  - Never fabricate a citation, identifier, quotation, metadata field, source conclusion, or claim of exhaustive coverage.
47
47
  - Never overwrite an existing `project://sources/{source}` record. Additions remain provisional until identity and provenance are verified by an authorized action.
48
48
  - Do not explore alternatives that author decisions explicitly deferred or rejected.
@@ -46,7 +46,7 @@ Contract: [protocol/actions/plan-section.json](../../../actions/plan-section.jso
46
46
  2. Read the complete planning context before decomposing work: manifest, config, state, decisions, outline, section record, context, research, source/evidence records, relevant prior summaries, and the bounded `project://validations/*` collection.
47
47
  3. Before any specialist dispatch, filter the validation records to candidates whose `subject_uri` is exactly `project://structure/outline` and whose `action_id` is exactly `create-outline`. A candidate is current only when `executed_at >= outline.updated_at`. Because the v1 validation schema carries no outline revision or content hash, disclose that this timestamp test is a conservative freshness proxy.
48
48
  4. Require exactly one current candidate and require its `status` to be `passed`. Separately verify that the current outline and target section are consistent with all current locked and deferred author choices: honor locked choices and do not treat deferred choices as resolved. A missing, stale, ambiguous, or non-passing candidate, or a decision contradiction, blocks all specialist dispatch and every plan, section, state, or validation write. Only a recovery checkpoint may be proposed on this blocked path, and it may be written only after a complete record preview and explicit author approval.
49
- 5. If the section is literature-heavy and research obligations remain empty, offer `research-gap`; do not manufacture citations to keep planning moving.
49
+ 5. If the section is literature-heavy, require a section-specific research artifact and resolvable source/evidence records for its planned claims before dispatch or approval. Run `research-gap` with the configured CiteNexus backend when available; if coverage remains insufficient, record a research checkpoint and stop. Search candidates alone are not verified citations. Do not manufacture citations to keep planning moving.
50
50
  6. Summarize the section goal, claims, evidence, manuscript artifact, dependencies, and open decisions at `config.gates.confirm_plan`.
51
51
  7. After the prerequisites pass, require `section-planner` in a bounded delegated pass to create one or more immutable Markdown `project://sections/{section}/plans/{plan}` artifacts. Each plan must declare:
52
52
  - stable section and plan identifiers;
@@ -14,7 +14,7 @@ Contract: [protocol/actions/research-gap.json](../../../actions/research-gap.jso
14
14
  - `standard`: run a focused, reproducible search across the most relevant categories;
15
15
  - `deep`: map foundational, recent, competing, gap-defining, and methodological work, including important disagreements and intellectual lineage.
16
16
  5. Form search questions and inclusion criteria before searching. Record databases or corpora, query strings, date, filters, and stopping rule.
17
- 6. Search authoritative scholarly sources only after disclosing and receiving approval for the external providers and bounded query set. When using the bundled dispatcher, `citation-search` may run with `--backend=cite-nexus` and an explicit `--providers` list after this gate. Returned results stay candidates, and this action performs no bibliography write. Deduplicate candidates by persistent identifier, then normalized title.
17
+ 6. Search authoritative scholarly sources with bounded queries. Two routes need no second per-query author gate: a host connection the operator already configured and authorized for read-only public scholarly metadata search, or the bundled CiteNexus dispatcher in a host session explicitly set to full-auto for this research action when every selected provider is a free, no-key public index (`crossref`, `datacite`, `europe_pmc`, or `arxiv`). Record provider IDs, query strings, date, and result limits in the research artifact. Do not send unpublished manuscript text, private notes, or credentials as search terms. Outside those routes, first disclose the providers and bounded query set and obtain explicit author approval. The dispatcher runs only `citation-search --backend=cite-nexus` with an explicit `--providers` list; honor an operator-set offline flag or any host refusal. Returned results stay candidates, and this action performs no bibliography write. Deduplicate candidates by persistent identifier, then normalized title.
18
18
  7. Verify each retained source from its primary record or publication. Create a `project://sources/{source}` record with title, creators, year, source kind, identifiers, citation key, status, provenance, inspection depth, and verification time.
19
19
  8. Read enough of each source to distinguish its actual claim, method, population, result, and limitation. Do not cite an abstract-only impression as full-paper evidence.
20
20
  9. Create `project://evidence/{evidence}` separately for each retained claim-level interpretation, with relation, locator, limitations, confidence, and inspection depth. Synthesize by question rather than listing papers; identify consensus, disagreement, methodological differences, missing evidence, and defensible positioning.
@@ -8,7 +8,7 @@ Contract: [protocol/actions/write-section.json](../../../actions/write-section.j
8
8
 
9
9
  1. Require an exact `project://sections/{section}/plans/{plan}` artifact linked from `project://sections/{section}` and verify its declared inputs, outputs, dependencies, validation, and approval state.
10
10
  2. If a corresponding summary or manuscript output exists, show the overwrite or merge impact and require explicit re-execution approval.
11
- 3. Read the plan, `project://manifest`, `project://state`, `project://decisions`, `project://structure/outline`, section context and research, relevant source/evidence records, and enough neighboring prose to maintain continuity.
11
+ 3. Read the plan, `project://manifest`, `project://state`, `project://decisions`, `project://structure/outline`, section context and research, relevant source/evidence records, and enough neighboring prose to maintain continuity. For a literature-heavy section, require research and verified source/evidence coverage of the plan's factual claims before drafting. Route missing coverage through `research-gap` and a checkpoint; do not substitute model memory or search candidates for source records.
12
12
  4. Present the plan objective, output path, target words, evidence obligations, and checkpoints at the configured writing gate.
13
13
  5. Execute tasks in order against the exact `project://paper/{artifact}` output. For each task:
14
14
  - establish the paragraph or subsection's rhetorical job;
@@ -24,8 +24,9 @@ Manuscript prose and supporting context, research, plan, review, summary, handof
24
24
  1. Resolve one section record, load its linked context, research, evidence, decisions, and outline constraints, and enumerate the bounded `project://validations/*` collection before any specialist dispatch.
25
25
  2. Filter those records to candidates whose `subject_uri` is exactly `project://structure/outline` and whose `action_id` is exactly `create-outline`. A candidate is current only when `executed_at >= outline.updated_at`. Because the v1 validation schema carries no outline revision or content hash, disclose that this timestamp test is a conservative freshness proxy.
26
26
  3. Require exactly one current candidate and require its `status` to be `passed`. Separately verify that the current outline and target section are consistent with all current locked and deferred author choices: honor locked choices and do not treat deferred choices as resolved. A missing, stale, ambiguous, or non-passing candidate, or a decision contradiction, blocks all specialist dispatch and every plan, section, state, or validation write. Only a recovery checkpoint may be proposed on this blocked path, and it may be written only after a complete record preview and explicit author approval.
27
- 4. Only after those prerequisites pass, delegate a bounded plan to `section-planner`, then require a fresh `plan-checker` pass over claim coverage, dependencies, file scope, citations, and decision fidelity.
28
- 5. At confirm_plan, preview the plan and validation; on approval link the plan, update section status to planned, and reconcile state. Create a checkpoint for unresolved judgment instead of bypassing the required checker.
27
+ 4. For a literature-heavy section, first require a section-specific research artifact plus resolvable source/evidence records that cover the planned claims. If they are absent or insufficient, run `research-gap` with the configured CiteNexus backend when available, verify candidate metadata against the returned records, and stop planning with an explicit research checkpoint if evidence remains insufficient. Never invent citations or treat search candidates as verified sources.
28
+ 5. Only after those prerequisites pass, delegate a bounded plan to `section-planner`, then require a fresh `plan-checker` pass over claim coverage, dependencies, file scope, citations, and decision fidelity. Dispatch the exact WTF-P specialist roles; generic coder and verifier roles do not satisfy this workflow.
29
+ 6. At confirm_plan, preview the plan and validation; on approval link the plan, update section status to planned, and reconcile state. Create a checkpoint for unresolved judgment instead of bypassing the required checker.
29
30
 
30
31
  ## Safety and completion
31
32
 
@@ -22,7 +22,7 @@ Manuscript prose and supporting context, research, plan, review, summary, handof
22
22
  ## Procedure
23
23
 
24
24
  1. Resolve the research question and section scope against locked/deferred decisions; agree on depth and source constraints.
25
- 2. Search declared scholarly services only after the gate names the providers and bounded query set. When using the bundled dispatcher, `citation-search` may run with `--backend=cite-nexus` and an explicit `--providers` list after this gate. Returned results stay candidates, and this action performs no bibliography write. Verify source identity and inspection depth, and separate source records from claim-level evidence.
25
+ 2. Prefer an operator-configured, trusted read-only CiteNexus MCP connection for bounded public metadata searches when the host has already authorized it. In an explicitly selected full-auto host session for this research action, the bundled CiteNexus dispatcher may also search the free no-key public indexes `crossref`, `datacite`, `europe_pmc`, and `arxiv` without a second per-query author gate; use only selected relevant indexes with an explicit `--providers` list. Record provider IDs, queries, date, and result limits; never send unpublished manuscript text or private notes as search terms. For any other route, first obtain explicit author approval naming the providers and bounded query set. Results remain candidates and this action performs no bibliography write. Verify source identity and inspection depth, and separate source records from claim-level evidence.
26
26
  3. Synthesize supported, conflicting, and missing evidence into a Markdown research artifact; link new records and disclose limitations.
27
27
 
28
28
  ## Bundled tool execution
@@ -33,7 +33,7 @@ The declared `tool.execute` effect authorises exactly one command, run from the
33
33
  node protocol://tools/wtfp-tool.js [--offline] <command> [arguments]
34
34
  ```
35
35
 
36
- Run it with `list` first to read the declared commands, their arguments, their bounds, and the effects each one applies; `protocol://tools/README.md` carries the same table. A command whose effects include `network.*` performs outbound requests. Until network use has been approved for this run, pass `--offline` (or set `WTFP_TOOL_OFFLINE=1`), which makes the dispatcher refuse those commands instead of relying on prose restraint. Never execute another module in this package, never pass a logical `project://` or `wtfp://` URI as a shell argument, and treat every returned record as candidate evidence until it is verified and written to a source or evidence record.
36
+ Run it with `list` first to read the declared commands, their arguments, their bounds, and the effects each one applies; `protocol://tools/README.md` carries the same table. A command whose effects include `network.*` performs outbound requests. Pass `--offline` (or set `WTFP_TOOL_OFFLINE=1`) until the provider/query gate is approved, except for this action's explicit full-auto public-index route. On that route omit `--offline` only for `citation-search --backend=cite-nexus` with bounded queries and `--providers` drawn from `crossref,datacite,europe_pmc,arxiv`; never override an operator-set offline flag or a host refusal. Never execute another module in this package, never pass a logical `project://` or `wtfp://` URI as a shell argument, and treat every returned record as candidate evidence until it is verified and written to a source or evidence record.
37
37
 
38
38
  ## Safety and completion
39
39
 
@@ -22,7 +22,7 @@ Manuscript prose and supporting context, research, plan, review, summary, handof
22
22
  ## Procedure
23
23
 
24
24
  1. Require one approved plan and resolve all linked context, research, source/evidence records, decisions, prior summary, existing target, and necessary neighboring prose before choosing create or update.
25
- 2. Draft only the declared manuscript artifact; cite only resolvable sources, preserve author constraints, and stop at blocking decisions.
25
+ 2. Before drafting a literature-heavy section, verify that its linked research artifact and source/evidence records cover the plan's factual claims. If coverage is missing, use the declared research workflow and pause at a checkpoint until verified records exist. Draft only the declared manuscript artifact; cite only resolvable sources, preserve author constraints, and stop at blocking decisions. A plausible bibliography entry, search candidate, or model memory is not a verified citation.
26
26
  3. Read the persisted manuscript text back and calculate its actual body word count with one deterministic method; never copy a worker self-report, plan target, or summary count into project records. Validate the persisted draft against its plan and word budget.
27
27
  4. Create or update the required Markdown summary with that measured count, then read back both manuscript and summary. Missing, empty, or inconsistent output is a failed completion condition, not permission to link a path that does not exist.
28
28
  5. Persist the validation, synchronize the manuscript URI in `manifest.artifacts.manuscripts`, and reconcile section/state records only after manuscript, summary, and validation readback succeeds. If blocked, create the declared checkpoint and stop; do not commit or merge automatically.
@@ -2,7 +2,7 @@
2
2
  "schema": "wtfp.generated-adapter/v1",
3
3
  "generatorVersion": 5,
4
4
  "target": "antigravity",
5
- "sourceHash": "dac5b9dd1327d76dd4f80be73efcb4b9ccc4afc0e740103b33b7bdd34fc3da63",
5
+ "sourceHash": "c2e93ea50f26a53402f100fe9157834a3841748eebd8cc212648cd615738278d",
6
6
  "files": [
7
7
  {
8
8
  "path": "actions/add-todo.json",
@@ -118,7 +118,7 @@
118
118
  },
119
119
  {
120
120
  "path": "actions/research-gap.json",
121
- "sha256": "80659531e18fb60dd46620c8b35aa27ce0f966c467f0d3073ae8c6519084153e"
121
+ "sha256": "0c26fa663f1d2526cbefcc9750b0a176ddf1ca538a46585a1de48c763fbb1a13"
122
122
  },
123
123
  {
124
124
  "path": "actions/resume-writing.json",
@@ -178,7 +178,7 @@
178
178
  },
179
179
  {
180
180
  "path": "agents/wtfp-research-synthesizer.md",
181
- "sha256": "2adec7aab0cad7e9cc66312b14f8ee8824d269ad499319ad47094cfe4936f04a"
181
+ "sha256": "e50c44188d1f655268c35044760a1a314d8d7bf9ece2e9595778c1560b779114"
182
182
  },
183
183
  {
184
184
  "path": "agents/wtfp-section-planner.md",
@@ -286,7 +286,7 @@
286
286
  },
287
287
  {
288
288
  "path": "commands/wtfp-plan-section.md",
289
- "sha256": "919ba047726a4c454329c054c415613a1aefdf904ddca13f0bc56426ec6798ae"
289
+ "sha256": "f36084563180ac559b8e5ff792565a8db6ea9a7c2031bd06ad57ad54f0be94ba"
290
290
  },
291
291
  {
292
292
  "path": "commands/wtfp-polish-prose.md",
@@ -342,7 +342,7 @@
342
342
  },
343
343
  {
344
344
  "path": "commands/wtfp-write-section.md",
345
- "sha256": "82dae8583d3d300e64e68157b10c13ef9b8ba37d9c7bf947770cefe76874ef21"
345
+ "sha256": "100af3ef4be44fe3981023ec5f46bd7a8a3c5a956bb2ec50835ef3a823047275"
346
346
  },
347
347
  {
348
348
  "path": "compatibility/action-availability.json",
@@ -362,7 +362,7 @@
362
362
  },
363
363
  {
364
364
  "path": "plugin.json",
365
- "sha256": "c6260cf5a7455c7c684661ad8704fc7a37c7034ee99b9c34a3d6c2c5bffd82cd"
365
+ "sha256": "9898153f5524eeea64715c41f2c6fe68f90a312e7f2c2ed08485a448da5ff989"
366
366
  },
367
367
  {
368
368
  "path": "project/README.md",
@@ -486,7 +486,7 @@
486
486
  },
487
487
  {
488
488
  "path": "roles/research-synthesizer.md",
489
- "sha256": "011feaa1fdb967c267713f4fa4b0c45b27e66a62f71d1f24c4f44360442aef57"
489
+ "sha256": "7aa6922f5f819918374b1a87dbda5c12fa6d424be64fc13b4019c380e011306c"
490
490
  },
491
491
  {
492
492
  "path": "roles/section-planner.md",
@@ -558,7 +558,7 @@
558
558
  },
559
559
  {
560
560
  "path": "skills/wtfp-plan-section/references/actions.md",
561
- "sha256": "5732b2faf9640e6663f1342ebce264a877f813570765c847216ff0e40b8ba6e6"
561
+ "sha256": "11d5d27f450857d9a2cd2e06184ba66b4d581e56f6530bd97c82404c8eb06e99"
562
562
  },
563
563
  {
564
564
  "path": "skills/wtfp-plan-section/SKILL.md",
@@ -570,7 +570,7 @@
570
570
  },
571
571
  {
572
572
  "path": "skills/wtfp-research-literature/references/actions.md",
573
- "sha256": "83cb1dbc27563a02bb35fbb995fe54d37e5afe523821b5cb5b6c3baf2fa72d50"
573
+ "sha256": "7d2137fa9638782444d88cccf7161ee3afbb5ce9c95bd85fcad57e61b8265d79"
574
574
  },
575
575
  {
576
576
  "path": "skills/wtfp-research-literature/SKILL.md",
@@ -606,7 +606,7 @@
606
606
  },
607
607
  {
608
608
  "path": "skills/wtfp-write-section/references/actions.md",
609
- "sha256": "367b9144ce76b4e6116d9a2566c02070e80bbb57325a43bf5aa22447e6cb83f5"
609
+ "sha256": "1fe6f8d50a1abd7a0b338772560317404942874ddd67be458ca24182ea20f7a4"
610
610
  },
611
611
  {
612
612
  "path": "skills/wtfp-write-section/SKILL.md",
@@ -664,9 +664,13 @@
664
664
  "path": "tools/citation/semantic-scholar.js",
665
665
  "sha256": "df4c1f3d69a28e06dd5285ba46c116bb2731aa940e16b9438c822846f38646f5"
666
666
  },
667
+ {
668
+ "path": "tools/package.json",
669
+ "sha256": "dbf8353f77358bc12169b7bb7301e1978d5b503e002ee927229a8993672818fc"
670
+ },
667
671
  {
668
672
  "path": "tools/README.md",
669
- "sha256": "997889703a61599a3d6267b1ddbd571ac354b55e7fe3a9dc2ebbf00b6c6d2106"
673
+ "sha256": "eb99d2ef30209b409e8c0dbfccaabdf301b6bc50f17013cd8fa381c3c1d69ae2"
670
674
  },
671
675
  {
672
676
  "path": "tools/support/cite-nexus-client.js",
@@ -762,7 +766,7 @@
762
766
  },
763
767
  {
764
768
  "path": "workflows/plan-section.md",
765
- "sha256": "02311226aa784dea4a6a5219ef59fcea6c904f92566318e3327aa4e883228446"
769
+ "sha256": "831c20c8afd147a8ba149a46f54591b6f07732983ee916a56c66701c8c701aa2"
766
770
  },
767
771
  {
768
772
  "path": "workflows/polish-prose.md",
@@ -790,7 +794,7 @@
790
794
  },
791
795
  {
792
796
  "path": "workflows/research-gap.md",
793
- "sha256": "a1736edb7e739708a92e5ef11c2d7c7a87fe8e6e4d6586e8ce9b1db3ae5bb428"
797
+ "sha256": "02ffe236ba7de12e4b3abbac308c0e1cfc409147147d509616b95baec3fef012"
794
798
  },
795
799
  {
796
800
  "path": "workflows/resume-writing.md",
@@ -818,7 +822,7 @@
818
822
  },
819
823
  {
820
824
  "path": "workflows/write-section.md",
821
- "sha256": "cfb3a0f9c61830d62cebdf8be5dacd17cef996d99cbab1df18267313ca05aacc"
825
+ "sha256": "5a2f0efcd11d7f41d941f54b80798ad481773820907fee68bea47f28b7af7bc3"
822
826
  }
823
827
  ]
824
828
  }
@@ -96,7 +96,7 @@
96
96
  },
97
97
  {
98
98
  "id": "user.gate",
99
- "scope": "the external providers, bounded query set, and research scope and depth"
99
+ "scope": "unapproved or paid external providers and bounded query set, plus author-owned research scope and depth decisions"
100
100
  }
101
101
  ]
102
102
  }
@@ -48,7 +48,7 @@ Investigate the literature needed to plan and write a specific section well. The
48
48
  ## Boundaries
49
49
 
50
50
  - This is a `mutation-report` role. It may write only the research and suggestion artifacts authorized by the invoking action.
51
- - When external literature search is approved, `citation-search` may run with `--backend=cite-nexus` and an explicit `--providers` list after the gate. Returned results stay candidates, and this role never performs a bibliography write.
51
+ - An operator-configured, trusted read-only CiteNexus MCP connection may search bounded public scholarly metadata without a second per-query gate. In an explicitly selected full-auto host session for this research action, `citation-search --backend=cite-nexus` may also search `crossref`, `datacite`, `europe_pmc`, or `arxiv` without another gate. Other providers or modes require explicit network approval naming providers and query bounds. Honor offline flags and host refusals. Returned results stay candidates, and this role never performs a bibliography write.
52
52
  - Never fabricate a citation, identifier, quotation, metadata field, source conclusion, or claim of exhaustive coverage.
53
53
  - Never overwrite an existing `project://sources/{source}` record. Additions remain provisional until identity and provenance are verified by an authorized action.
54
54
  - Do not explore alternatives that author decisions explicitly deferred or rejected.
@@ -32,8 +32,9 @@ Manuscript prose and supporting context, research, plan, review, summary, handof
32
32
  1. Resolve one section record, load its linked context, research, evidence, decisions, and outline constraints, and enumerate the bounded `project://validations/*` collection before any specialist dispatch.
33
33
  2. Filter those records to candidates whose `subject_uri` is exactly `project://structure/outline` and whose `action_id` is exactly `create-outline`. A candidate is current only when `executed_at >= outline.updated_at`. Because the v1 validation schema carries no outline revision or content hash, disclose that this timestamp test is a conservative freshness proxy.
34
34
  3. Require exactly one current candidate and require its `status` to be `passed`. Separately verify that the current outline and target section are consistent with all current locked and deferred author choices: honor locked choices and do not treat deferred choices as resolved. A missing, stale, ambiguous, or non-passing candidate, or a decision contradiction, blocks all specialist dispatch and every plan, section, state, or validation write. Only a recovery checkpoint may be proposed on this blocked path, and it may be written only after a complete record preview and explicit author approval.
35
- 4. Only after those prerequisites pass, delegate a bounded plan to `section-planner`, then require a fresh `plan-checker` pass over claim coverage, dependencies, file scope, citations, and decision fidelity.
36
- 5. At confirm_plan, preview the plan and validation; on approval link the plan, update section status to planned, and reconcile state. Create a checkpoint for unresolved judgment instead of bypassing the required checker.
35
+ 4. For a literature-heavy section, first require a section-specific research artifact plus resolvable source/evidence records that cover the planned claims. If they are absent or insufficient, run `research-gap` with the configured CiteNexus backend when available, verify candidate metadata against the returned records, and stop planning with an explicit research checkpoint if evidence remains insufficient. Never invent citations or treat search candidates as verified sources.
36
+ 5. Only after those prerequisites pass, delegate a bounded plan to `section-planner`, then require a fresh `plan-checker` pass over claim coverage, dependencies, file scope, citations, and decision fidelity. Dispatch the exact WTF-P specialist roles; generic coder and verifier roles do not satisfy this workflow.
37
+ 6. At confirm_plan, preview the plan and validation; on approval link the plan, update section status to planned, and reconcile state. Create a checkpoint for unresolved judgment instead of bypassing the required checker.
37
38
 
38
39
  ## Safety and completion
39
40
 
@@ -30,7 +30,7 @@ Manuscript prose and supporting context, research, plan, review, summary, handof
30
30
  ## Procedure
31
31
 
32
32
  1. Require one approved plan and resolve all linked context, research, source/evidence records, decisions, prior summary, existing target, and necessary neighboring prose before choosing create or update.
33
- 2. Draft only the declared manuscript artifact; cite only resolvable sources, preserve author constraints, and stop at blocking decisions.
33
+ 2. Before drafting a literature-heavy section, verify that its linked research artifact and source/evidence records cover the plan's factual claims. If coverage is missing, use the declared research workflow and pause at a checkpoint until verified records exist. Draft only the declared manuscript artifact; cite only resolvable sources, preserve author constraints, and stop at blocking decisions. A plausible bibliography entry, search candidate, or model memory is not a verified citation.
34
34
  3. Read the persisted manuscript text back and calculate its actual body word count with one deterministic method; never copy a worker self-report, plan target, or summary count into project records. Validate the persisted draft against its plan and word budget.
35
35
  4. Create or update the required Markdown summary with that measured count, then read back both manuscript and summary. Missing, empty, or inconsistent output is a failed completion condition, not permission to link a path that does not exist.
36
36
  5. Persist the validation, synchronize the manuscript URI in `manifest.artifacts.manuscripts`, and reconcile section/state records only after manuscript, summary, and validation readback succeeds. If blocked, create the declared checkpoint and stop; do not commit or merge automatically.