@hassangameryt/freeflow 0.7.3 → 0.9.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 (426) hide show
  1. package/.agents/plugins/marketplace.json +2 -2
  2. package/.claude-plugin/marketplace.json +1 -1
  3. package/.claude-plugin/plugin.json +2 -2
  4. package/.codex-plugin/plugin.json +3 -3
  5. package/.cursor-plugin/plugin.json +1 -1
  6. package/NOTICE +14 -0
  7. package/README.md +101 -159
  8. package/capabilities/cognitive-routing/SKILL.md +47 -210
  9. package/capabilities/cognitive-routing/references/coordinator.md +163 -0
  10. package/capabilities/cognitive-routing/references/worker.md +38 -0
  11. package/capabilities/compaction/SKILL.md +49 -0
  12. package/capabilities/compaction/references/summary-format.md +250 -0
  13. package/capabilities/messaging/SKILL.md +49 -0
  14. package/capabilities/task-memory/SKILL.md +87 -0
  15. package/command-surface.json +8 -52
  16. package/gemini-extension.json +1 -1
  17. package/hooks/claude/hooks.json +13 -3
  18. package/hooks/codex/hooks.json +2 -1
  19. package/hooks/shared/runtime-context.mjs +73 -83
  20. package/licenses/Apache-2.0.txt +55 -0
  21. package/package.json +42 -12
  22. package/pi-extension/README.md +41 -0
  23. package/pi-extension/dist/ask-user/ask.js +108 -0
  24. package/pi-extension/dist/ask-user/form.js +250 -0
  25. package/pi-extension/dist/ask-user/questions.js +66 -0
  26. package/pi-extension/dist/ask-user/tool.js +124 -0
  27. package/pi-extension/dist/cognitive-routing/assembler.js +417 -0
  28. package/pi-extension/dist/cognitive-routing/bootstrap.js +90 -0
  29. package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/config.js +8 -6
  30. package/pi-extension/dist/cognitive-routing/economics.js +45 -0
  31. package/pi-extension/dist/cognitive-routing/event-schema.js +388 -0
  32. package/pi-extension/dist/{session-sources/events.js → cognitive-routing/event-store.js} +107 -41
  33. package/pi-extension/dist/cognitive-routing/gate.js +256 -0
  34. package/pi-extension/dist/cognitive-routing/handlers.js +901 -0
  35. package/pi-extension/dist/cognitive-routing/handoffs.js +350 -0
  36. package/pi-extension/dist/cognitive-routing/model-control.js +476 -0
  37. package/pi-extension/dist/cognitive-routing/projection.js +520 -0
  38. package/pi-extension/dist/cognitive-routing/provenance.js +83 -0
  39. package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/render.js +15 -15
  40. package/pi-extension/dist/cognitive-routing/runtime.js +398 -0
  41. package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/schemas.js +47 -11
  42. package/pi-extension/dist/cognitive-routing/session.js +223 -0
  43. package/pi-extension/dist/{session-sources → cognitive-routing}/sources.js +126 -87
  44. package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/state.js +55 -386
  45. package/pi-extension/dist/cognitive-routing/status.js +81 -0
  46. package/pi-extension/dist/cognitive-routing/tools.js +74 -0
  47. package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/types.js +14 -11
  48. package/pi-extension/dist/compaction/carry.js +205 -0
  49. package/pi-extension/dist/compaction/config.js +24 -0
  50. package/pi-extension/dist/compaction/controller.js +494 -0
  51. package/pi-extension/dist/compaction/harness.js +93 -0
  52. package/pi-extension/dist/compaction/results.js +159 -0
  53. package/pi-extension/dist/compaction/thresholds.js +35 -0
  54. package/pi-extension/dist/compaction/tool.js +57 -0
  55. package/pi-extension/dist/host/branch.js +13 -0
  56. package/pi-extension/dist/host/canonical.js +12 -0
  57. package/pi-extension/dist/host/catalog.js +62 -0
  58. package/pi-extension/dist/host/config-validation.js +233 -0
  59. package/pi-extension/dist/host/config.js +361 -0
  60. package/pi-extension/dist/host/inbound.js +142 -0
  61. package/pi-extension/dist/host/projection-tags.js +60 -0
  62. package/pi-extension/dist/host/prompts.js +93 -0
  63. package/pi-extension/dist/{session-sources → host}/read-only-session.js +117 -1
  64. package/pi-extension/dist/{runtime → host}/request-history.js +125 -39
  65. package/pi-extension/dist/host/rows.js +25 -0
  66. package/pi-extension/dist/host/runtime-state.js +204 -0
  67. package/pi-extension/dist/host/section-keeper.js +85 -0
  68. package/pi-extension/dist/host/settings/freeflow-command.js +2323 -0
  69. package/pi-extension/dist/{settings/settings-tui.js → host/settings/settings-view.js} +205 -73
  70. package/pi-extension/dist/host/staging.js +28 -0
  71. package/pi-extension/dist/host/status.js +115 -0
  72. package/pi-extension/dist/index.js +1004 -188
  73. package/pi-extension/dist/messaging/config.js +27 -0
  74. package/pi-extension/dist/messaging/messaging.js +398 -0
  75. package/pi-extension/dist/messaging/registry.js +57 -0
  76. package/pi-extension/dist/messaging/render.js +90 -0
  77. package/pi-extension/dist/messaging/tools.js +109 -0
  78. package/pi-extension/dist/messaging/transport.js +101 -0
  79. package/pi-extension/dist/provider-support/cache/anchor.js +21 -0
  80. package/pi-extension/dist/provider-support/cache/anthropic.js +102 -0
  81. package/pi-extension/dist/provider-support/cache/health.js +73 -0
  82. package/pi-extension/dist/provider-support/cache/index.js +58 -0
  83. package/pi-extension/dist/provider-support/cache/keepalive.js +222 -0
  84. package/pi-extension/dist/provider-support/cache/monitor.js +17 -0
  85. package/pi-extension/dist/provider-support/cache/openai-responses.js +48 -0
  86. package/pi-extension/dist/provider-support/effort.js +13 -0
  87. package/pi-extension/dist/provider-support/index.js +44 -3
  88. package/pi-extension/dist/provider-support/{astra → openai}/adapter.js +46 -29
  89. package/pi-extension/dist/provider-support/{astra → openai}/history.js +10 -8
  90. package/pi-extension/dist/provider-support/{astra → openai}/index.js +8 -4
  91. package/pi-extension/dist/provider-support/{astra → openai}/session-state.js +29 -38
  92. package/pi-extension/dist/provider-support/routes.js +17 -0
  93. package/pi-extension/dist/task-memory/config.js +49 -0
  94. package/pi-extension/dist/task-memory/registry.js +119 -0
  95. package/pi-extension/dist/task-memory/render.js +107 -0
  96. package/pi-extension/dist/task-memory/runtime.js +994 -0
  97. package/pi-extension/dist/task-memory/tool.js +233 -0
  98. package/pi-extension/dist/tool-execution/apply-patch/grammar.js +23 -0
  99. package/pi-extension/dist/tool-execution/apply-patch/match.js +38 -0
  100. package/pi-extension/dist/tool-execution/apply-patch/parser.js +177 -0
  101. package/pi-extension/dist/tool-execution/apply-patch/plan.js +201 -0
  102. package/pi-extension/dist/tool-execution/apply-patch/tool.js +84 -0
  103. package/pi-extension/dist/tool-execution/background.js +430 -0
  104. package/pi-extension/dist/tool-execution/bash-guard.js +23 -0
  105. package/pi-extension/dist/tool-execution/config.js +33 -0
  106. package/pi-extension/dist/tool-execution/edit-messages.js +120 -0
  107. package/pi-extension/dist/tool-execution/file-state.js +138 -0
  108. package/pi-extension/dist/tool-execution/file-tracking.js +163 -0
  109. package/pi-extension/dist/tool-execution/guidance-notices.js +124 -0
  110. package/pi-extension/dist/tool-execution/prompt.js +54 -0
  111. package/pi-extension/dist/tool-execution/skill-reads.js +143 -0
  112. package/pi-extension/dist/tool-execution/tools.js +16 -0
  113. package/pi-extension/freeflow/README.md +9 -0
  114. package/runtime/prompts/cognitive-routing.md +4 -4
  115. package/runtime/prompts/core.md +29 -72
  116. package/runtime/prompts/interaction-contract.md +18 -8
  117. package/runtime/prompts/tool-execution.md +25 -0
  118. package/runtime/prompts/working-method.md +25 -0
  119. package/skills/deliver-work/SKILL.md +76 -0
  120. package/skills/deliver-work/references/branch-closeout.md +134 -0
  121. package/skills/deliver-work/references/commit.md +83 -0
  122. package/skills/deliver-work/references/launch.md +94 -0
  123. package/skills/deliver-work/references/release.md +85 -0
  124. package/skills/deliver-work/scripts/commit-state.mjs +139 -0
  125. package/skills/deliver-work/scripts/delivery-state.mjs +107 -0
  126. package/skills/deliver-work/scripts/lib/git-state.mjs +178 -0
  127. package/skills/deliver-work/scripts/push-route.mjs +122 -0
  128. package/skills/deliver-work/scripts/release-preflight.mjs +177 -0
  129. package/skills/discuss-work/SKILL.md +148 -0
  130. package/skills/{discuss → discuss-work}/references/discussion-continuity.md +13 -50
  131. package/skills/discuss-work/references/learning-action.md +36 -0
  132. package/skills/discuss-work/scripts/choices.mjs +101 -0
  133. package/skills/discuss-work/scripts/lib/choices.mjs +159 -0
  134. package/skills/evaluate-behavior/SKILL.md +107 -0
  135. package/skills/evaluate-behavior/references/authoring.md +381 -0
  136. package/skills/evaluate-behavior/references/coding-tasks.md +145 -0
  137. package/skills/evaluate-behavior/references/conversations-pipelines-judges.md +177 -0
  138. package/skills/evaluate-behavior/references/design-and-measurement.md +273 -0
  139. package/skills/evaluate-behavior/references/running-and-evidence.md +245 -0
  140. package/skills/evaluate-behavior/scripts/claude-guard.mjs +76 -0
  141. package/skills/evaluate-behavior/scripts/guard-rules.mjs +309 -0
  142. package/skills/evaluate-behavior/scripts/lib/agreement.mjs +90 -0
  143. package/skills/evaluate-behavior/scripts/lib/arms.mjs +55 -0
  144. package/skills/evaluate-behavior/scripts/lib/budget.mjs +87 -0
  145. package/skills/evaluate-behavior/scripts/lib/build-source.mjs +287 -0
  146. package/skills/evaluate-behavior/scripts/lib/clear.mjs +74 -0
  147. package/skills/evaluate-behavior/scripts/lib/container.mjs +395 -0
  148. package/skills/evaluate-behavior/scripts/lib/decision.mjs +418 -0
  149. package/skills/evaluate-behavior/scripts/lib/definitions.mjs +1072 -0
  150. package/skills/evaluate-behavior/scripts/lib/freeflow.mjs +103 -0
  151. package/skills/evaluate-behavior/scripts/lib/grade-command.mjs +591 -0
  152. package/skills/evaluate-behavior/scripts/lib/grade-comparison.mjs +90 -0
  153. package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/grade-interaction.mjs +19 -18
  154. package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/grade-support.mjs +32 -5
  155. package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/grade-workspace.mjs +28 -12
  156. package/skills/evaluate-behavior/scripts/lib/grade.mjs +101 -0
  157. package/skills/evaluate-behavior/scripts/lib/hooks.mjs +98 -0
  158. package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/confinement.mjs +196 -0
  159. package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/constraints.mjs +111 -0
  160. package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/index.mjs +48 -0
  161. package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/isolation.mjs +74 -0
  162. package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/launch.mjs +123 -0
  163. package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/model-call.mjs +73 -0
  164. package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/recorder.mjs +178 -0
  165. package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/session.mjs +494 -0
  166. package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/skills.mjs +81 -0
  167. package/skills/evaluate-behavior/scripts/lib/hosts/index.mjs +31 -0
  168. package/skills/evaluate-behavior/scripts/lib/hosts/names.mjs +3 -0
  169. package/skills/evaluate-behavior/scripts/lib/hosts/pi/confinement.mjs +173 -0
  170. package/skills/evaluate-behavior/scripts/lib/hosts/pi/host.mjs +148 -0
  171. package/skills/evaluate-behavior/scripts/lib/hosts/pi/index.mjs +70 -0
  172. package/skills/evaluate-behavior/scripts/lib/hosts/pi/isolation.mjs +81 -0
  173. package/skills/evaluate-behavior/scripts/lib/hosts/pi/model-call.mjs +79 -0
  174. package/skills/evaluate-behavior/scripts/lib/hosts/pi/process.mjs +241 -0
  175. package/skills/{evaluate-skill/scripts/lib → evaluate-behavior/scripts/lib/hosts/pi}/rpc.mjs +144 -26
  176. package/skills/evaluate-behavior/scripts/lib/identity.mjs +82 -0
  177. package/skills/evaluate-behavior/scripts/lib/judge.mjs +688 -0
  178. package/skills/evaluate-behavior/scripts/lib/metrics.mjs +332 -0
  179. package/skills/evaluate-behavior/scripts/lib/model-call.mjs +17 -0
  180. package/skills/evaluate-behavior/scripts/lib/participants.mjs +616 -0
  181. package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/process.mjs +22 -0
  182. package/skills/evaluate-behavior/scripts/lib/queue.mjs +54 -0
  183. package/skills/evaluate-behavior/scripts/lib/reference.mjs +343 -0
  184. package/skills/evaluate-behavior/scripts/lib/reuse.mjs +277 -0
  185. package/skills/evaluate-behavior/scripts/lib/review.mjs +933 -0
  186. package/skills/evaluate-behavior/scripts/lib/runner.mjs +732 -0
  187. package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/sandbox.mjs +121 -14
  188. package/skills/evaluate-behavior/scripts/lib/scan-shell.mjs +457 -0
  189. package/skills/evaluate-behavior/scripts/lib/scan.mjs +479 -0
  190. package/skills/evaluate-behavior/scripts/lib/seal.mjs +91 -0
  191. package/skills/evaluate-behavior/scripts/lib/shell.mjs +560 -0
  192. package/skills/evaluate-behavior/scripts/lib/source-override.mjs +64 -0
  193. package/skills/evaluate-behavior/scripts/lib/subject-file.mjs +88 -0
  194. package/skills/{evaluate-skill/scripts/lib/pi.mjs → evaluate-behavior/scripts/lib/subject.mjs} +239 -262
  195. package/skills/evaluate-behavior/scripts/lib/task-copy.mjs +124 -0
  196. package/skills/evaluate-behavior/scripts/lib/trials.mjs +524 -0
  197. package/skills/evaluate-behavior/scripts/lib/validity.mjs +68 -0
  198. package/skills/evaluate-behavior/scripts/lib/view-html.mjs +454 -0
  199. package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/view.mjs +218 -11
  200. package/skills/evaluate-behavior/scripts/pi-command-tool.mjs +159 -0
  201. package/skills/evaluate-behavior/scripts/pi-container-route.mjs +23 -0
  202. package/skills/evaluate-behavior/scripts/pi-guard.mjs +77 -0
  203. package/skills/evaluate-behavior/scripts/pi-login-refresh.mjs +31 -0
  204. package/skills/evaluate-behavior/scripts/skill-eval.mjs +586 -0
  205. package/skills/execute-work/SKILL.md +96 -72
  206. package/skills/execute-work/references/code-practices.md +27 -49
  207. package/skills/execute-work/references/design.md +271 -0
  208. package/skills/execute-work/references/diagnose.md +117 -0
  209. package/skills/execute-work/references/migration.md +108 -0
  210. package/skills/execute-work/references/simplify.md +65 -0
  211. package/skills/execute-work/scripts/self-review.mjs +422 -0
  212. package/skills/execute-work/scripts/touch-map.mjs +290 -0
  213. package/skills/review-work/SKILL.md +94 -64
  214. package/skills/review-work/references/adjudication.md +94 -0
  215. package/skills/review-work/references/artifact.md +198 -0
  216. package/skills/review-work/references/evals-and-judges.md +66 -0
  217. package/skills/review-work/references/work.md +177 -0
  218. package/skills/review-work/scripts/check-brief.mjs +128 -0
  219. package/skills/review-work/scripts/review-packet.mjs +233 -0
  220. package/skills/setup-freeflow/SKILL.md +69 -16
  221. package/skills/track-work/SKILL.md +135 -151
  222. package/skills/track-work/references/handoff.md +190 -0
  223. package/skills/track-work/references/projects.md +51 -0
  224. package/skills/track-work/references/working-record-format.md +201 -344
  225. package/skills/track-work/scripts/lib/document.mjs +79 -19
  226. package/skills/track-work/scripts/lib/format.mjs +18 -1
  227. package/skills/track-work/scripts/lib/recover.mjs +254 -0
  228. package/skills/track-work/scripts/lib/registry.mjs +656 -0
  229. package/skills/track-work/scripts/lib/search.mjs +40 -0
  230. package/skills/track-work/scripts/lib/store.mjs +53 -21
  231. package/skills/track-work/scripts/lib/transitions.mjs +79 -4
  232. package/skills/track-work/scripts/lib/views.mjs +50 -1
  233. package/skills/track-work/scripts/working-record.mjs +263 -22
  234. package/skills/verify-work/SKILL.md +64 -47
  235. package/skills/verify-work/references/feature-map.md +120 -0
  236. package/skills/verify-work/references/runtime-evidence.md +203 -0
  237. package/skills/verify-work/references/test-design.md +27 -6
  238. package/skills/verify-work/scripts/test-changes.mjs +246 -0
  239. package/skills/write-docs/SKILL.md +171 -0
  240. package/skills/write-docs/references/documentation-shapes.md +184 -0
  241. package/skills/write-docs/references/spec-and-plan-shapes.md +308 -0
  242. package/skills/write-docs/scripts/artifact-check.mjs +148 -0
  243. package/skills/write-docs/scripts/docs-check.mjs +229 -0
  244. package/skills/write-docs/scripts/plan-lint.mjs +123 -0
  245. package/skills/write-skill/SKILL.md +165 -165
  246. package/skills/write-skill/references/activation-and-wording.md +143 -0
  247. package/skills/write-skill/references/placement-and-dependencies.md +154 -0
  248. package/skills/write-skill/scripts/lib/compare.mjs +701 -0
  249. package/skills/write-skill/scripts/lib/similarity.mjs +56 -0
  250. package/skills/write-skill/scripts/lib/skill-author.mjs +197 -3
  251. package/skills/write-skill/scripts/skill-author.mjs +67 -8
  252. package/capabilities/context-virtualization/SKILL.md +0 -103
  253. package/capabilities/conversation-history/SKILL.md +0 -53
  254. package/hooks/tests/check-host-adapters.test.mjs +0 -82
  255. package/hooks/tests/check-runtime-context-hook.sh +0 -212
  256. package/pi-extension/dist/cognitive-routing-v2/projection.js +0 -330
  257. package/pi-extension/dist/cognitive-routing-v2/runtime.js +0 -2181
  258. package/pi-extension/dist/cognitive-routing-v2/tools.js +0 -60
  259. package/pi-extension/dist/context-virtualization/commands.js +0 -89
  260. package/pi-extension/dist/context-virtualization/projector.js +0 -42
  261. package/pi-extension/dist/context-virtualization/runtime.js +0 -378
  262. package/pi-extension/dist/context-virtualization/state.js +0 -57
  263. package/pi-extension/dist/context-virtualization/types.js +0 -10
  264. package/pi-extension/dist/conversation-history/passages.js +0 -66
  265. package/pi-extension/dist/conversation-history/ranking.js +0 -105
  266. package/pi-extension/dist/conversation-history/runtime.js +0 -226
  267. package/pi-extension/dist/conversation-history/search.js +0 -56
  268. package/pi-extension/dist/conversation-history/types.js +0 -1
  269. package/pi-extension/dist/freeflow-context/resolver.js +0 -120
  270. package/pi-extension/dist/freeflow-context/runtime.js +0 -80
  271. package/pi-extension/dist/freeflow-context/source-projector.js +0 -95
  272. package/pi-extension/dist/freeflow-context/tool.js +0 -314
  273. package/pi-extension/dist/freeflow-context/types.js +0 -12
  274. package/pi-extension/dist/freeflow-context/visibility.js +0 -28
  275. package/pi-extension/dist/integrations/mcp-config.js +0 -29
  276. package/pi-extension/dist/runtime/runtime-context.js +0 -754
  277. package/pi-extension/dist/runtime/runtime-identity.js +0 -5
  278. package/pi-extension/dist/session-sources/provenance.js +0 -32
  279. package/pi-extension/dist/settings/settings-ui.js +0 -1360
  280. package/pi-extension/dist/ui/text-component.js +0 -57
  281. package/pi-extension/src/cognitive-routing-v2/budget.ts +0 -42
  282. package/pi-extension/src/cognitive-routing-v2/config.ts +0 -173
  283. package/pi-extension/src/cognitive-routing-v2/projection.ts +0 -375
  284. package/pi-extension/src/cognitive-routing-v2/render.ts +0 -277
  285. package/pi-extension/src/cognitive-routing-v2/runtime.ts +0 -2241
  286. package/pi-extension/src/cognitive-routing-v2/schemas.ts +0 -180
  287. package/pi-extension/src/cognitive-routing-v2/state.ts +0 -839
  288. package/pi-extension/src/cognitive-routing-v2/tools.ts +0 -62
  289. package/pi-extension/src/cognitive-routing-v2/types.ts +0 -254
  290. package/pi-extension/src/context-virtualization/commands.ts +0 -111
  291. package/pi-extension/src/context-virtualization/projector.ts +0 -62
  292. package/pi-extension/src/context-virtualization/runtime.ts +0 -428
  293. package/pi-extension/src/context-virtualization/state.ts +0 -79
  294. package/pi-extension/src/context-virtualization/types.ts +0 -92
  295. package/pi-extension/src/conversation-history/passages.ts +0 -81
  296. package/pi-extension/src/conversation-history/ranking.ts +0 -155
  297. package/pi-extension/src/conversation-history/runtime.ts +0 -250
  298. package/pi-extension/src/conversation-history/search.ts +0 -79
  299. package/pi-extension/src/conversation-history/types.ts +0 -31
  300. package/pi-extension/src/freeflow-context/resolver.ts +0 -139
  301. package/pi-extension/src/freeflow-context/runtime.ts +0 -100
  302. package/pi-extension/src/freeflow-context/source-projector.ts +0 -106
  303. package/pi-extension/src/freeflow-context/tool.ts +0 -366
  304. package/pi-extension/src/freeflow-context/types.ts +0 -70
  305. package/pi-extension/src/freeflow-context/visibility.ts +0 -53
  306. package/pi-extension/src/index.ts +0 -390
  307. package/pi-extension/src/integrations/mcp-config.ts +0 -32
  308. package/pi-extension/src/provider-support/astra/adapter.ts +0 -108
  309. package/pi-extension/src/provider-support/astra/history.ts +0 -145
  310. package/pi-extension/src/provider-support/astra/index.ts +0 -12
  311. package/pi-extension/src/provider-support/astra/session-state.ts +0 -113
  312. package/pi-extension/src/provider-support/index.ts +0 -5
  313. package/pi-extension/src/runtime/request-history.ts +0 -243
  314. package/pi-extension/src/runtime/runtime-context.ts +0 -860
  315. package/pi-extension/src/runtime/runtime-identity.ts +0 -8
  316. package/pi-extension/src/session-sources/events.ts +0 -230
  317. package/pi-extension/src/session-sources/provenance.ts +0 -39
  318. package/pi-extension/src/session-sources/read-only-session.ts +0 -170
  319. package/pi-extension/src/session-sources/sources.ts +0 -334
  320. package/pi-extension/src/settings/settings-tui.ts +0 -501
  321. package/pi-extension/src/settings/settings-ui.ts +0 -1652
  322. package/pi-extension/src/ui/text-component.ts +0 -66
  323. package/pi-extension/tests/cache-reuse/history.test.js +0 -117
  324. package/pi-extension/tests/cache-reuse/native.test.js +0 -91
  325. package/pi-extension/tests/cache-reuse/settings.test.js +0 -211
  326. package/pi-extension/tests/cognitive-routing-v2/communication.test.js +0 -577
  327. package/pi-extension/tests/cognitive-routing-v2/compaction-input.test.js +0 -183
  328. package/pi-extension/tests/cognitive-routing-v2/delegation.test.js +0 -557
  329. package/pi-extension/tests/cognitive-routing-v2/native.test.js +0 -474
  330. package/pi-extension/tests/cognitive-routing-v2/performance.test.js +0 -87
  331. package/pi-extension/tests/cognitive-routing-v2/persistence.test.js +0 -300
  332. package/pi-extension/tests/cognitive-routing-v2/projection.test.js +0 -241
  333. package/pi-extension/tests/cognitive-routing-v2/recovery.test.js +0 -1034
  334. package/pi-extension/tests/cognitive-routing-v2/render.test.js +0 -244
  335. package/pi-extension/tests/cognitive-routing-v2/runtime.test.js +0 -423
  336. package/pi-extension/tests/cognitive-routing-v2/stabilization.test.js +0 -521
  337. package/pi-extension/tests/cognitive-routing-v2/state.test.js +0 -586
  338. package/pi-extension/tests/context-virtualization/extension.test.js +0 -775
  339. package/pi-extension/tests/context-virtualization/projector.test.js +0 -110
  340. package/pi-extension/tests/context-virtualization/runtime.test.js +0 -230
  341. package/pi-extension/tests/conversation-history/runtime.test.js +0 -98
  342. package/pi-extension/tests/conversation-history/search.test.js +0 -97
  343. package/pi-extension/tests/fixtures/pi-host.js +0 -4
  344. package/pi-extension/tests/fixtures/routing-native.js +0 -191
  345. package/pi-extension/tests/integration/mode-free-core.test.js +0 -220
  346. package/pi-extension/tests/integration/pi-extension.test.js +0 -1447
  347. package/pi-extension/tests/integration/prompt-architecture.test.js +0 -447
  348. package/pi-extension/tests/integration/unaffected-regressions.test.js +0 -478
  349. package/pi-extension/tests/provider-support/astra-boundaries.test.js +0 -75
  350. package/pi-extension/tests/provider-support/astra.test.js +0 -306
  351. package/pi-extension/tests/provider-support/cli.test.js +0 -92
  352. package/pi-extension/tests/provider-support/native.test.js +0 -183
  353. package/pi-extension/tests/settings/settings-tui.test.js +0 -243
  354. package/pi-extension/tsconfig.json +0 -16
  355. package/plugin.json +0 -33
  356. package/runtime/prompts/context-virtualization.md +0 -3
  357. package/runtime/prompts/conversation-history.md +0 -3
  358. package/skills/action-selection/SKILL.md +0 -100
  359. package/skills/action-selection/references/trajectory-stalls.md +0 -71
  360. package/skills/bypass/SKILL.md +0 -153
  361. package/skills/commit-work/SKILL.md +0 -145
  362. package/skills/commit-work/references/git-state-edges.md +0 -94
  363. package/skills/commit-work/references/simple-push.md +0 -92
  364. package/skills/commit-work/references/staging-decisions.md +0 -106
  365. package/skills/decision-gate/SKILL.md +0 -106
  366. package/skills/design-for-depth/SKILL.md +0 -117
  367. package/skills/design-for-depth/references/design-pressure-signals.md +0 -182
  368. package/skills/design-for-depth/references/implementation-decisions.md +0 -76
  369. package/skills/design-for-depth/references/interface-design-loop.md +0 -136
  370. package/skills/design-for-depth/references/module-and-dependency-design.md +0 -147
  371. package/skills/design-for-depth/references/software-design-philosophy.md +0 -202
  372. package/skills/design-for-depth/references/state-and-failure-boundaries.md +0 -136
  373. package/skills/diagnose-failure/SKILL.md +0 -125
  374. package/skills/diagnose-failure/references/diagnostic-loop-catalog.md +0 -48
  375. package/skills/diagnose-failure/references/flaky-and-performance-diagnosis.md +0 -51
  376. package/skills/discuss/SKILL.md +0 -116
  377. package/skills/evaluate-skill/SKILL.md +0 -219
  378. package/skills/evaluate-skill/references/evaluation-definition-schema.md +0 -385
  379. package/skills/evaluate-skill/references/evaluation-design.md +0 -112
  380. package/skills/evaluate-skill/references/execution-and-evidence.md +0 -90
  381. package/skills/evaluate-skill/references/review-and-revision.md +0 -92
  382. package/skills/evaluate-skill/scripts/lib/definitions.mjs +0 -407
  383. package/skills/evaluate-skill/scripts/lib/grade-comparison.mjs +0 -60
  384. package/skills/evaluate-skill/scripts/lib/grade.mjs +0 -64
  385. package/skills/evaluate-skill/scripts/lib/runner.mjs +0 -368
  386. package/skills/evaluate-skill/scripts/pi-guard.mjs +0 -164
  387. package/skills/evaluate-skill/scripts/skill-eval.mjs +0 -102
  388. package/skills/execute-work/references/execute-work-edges.md +0 -68
  389. package/skills/finish-branch/SKILL.md +0 -117
  390. package/skills/finish-branch/references/integration-options.md +0 -80
  391. package/skills/handoff/SKILL.md +0 -82
  392. package/skills/handoff/references/handoff-templates.md +0 -150
  393. package/skills/launch-work/SKILL.md +0 -116
  394. package/skills/launch-work/references/launch-readiness.md +0 -85
  395. package/skills/migration-work/SKILL.md +0 -115
  396. package/skills/migration-work/references/migration-lifecycle.md +0 -82
  397. package/skills/release-work/SKILL.md +0 -118
  398. package/skills/release-work/references/release-evidence.md +0 -78
  399. package/skills/review-artifact/SKILL.md +0 -142
  400. package/skills/review-artifact/references/adjudicate-artifact-review.md +0 -101
  401. package/skills/review-artifact/references/independent-artifact-reviewer-contract.md +0 -159
  402. package/skills/review-work/references/adjudicate-work-review.md +0 -97
  403. package/skills/review-work/references/independent-work-reviewer-contract.md +0 -139
  404. package/skills/review-work/references/security-risk-lens.md +0 -69
  405. package/skills/setup-freeflow/references/activation-contract.md +0 -109
  406. package/skills/setup-freeflow/references/host-setup.md +0 -67
  407. package/skills/simplify-code/SKILL.md +0 -85
  408. package/skills/simplify-code/references/simplification-patterns.md +0 -70
  409. package/skills/verify-work/references/browser-runtime-evidence.md +0 -55
  410. package/skills/verify-work/references/integration-evidence.md +0 -47
  411. package/skills/verify-work/references/performance-evidence.md +0 -57
  412. package/skills/workflow/SKILL.md +0 -127
  413. package/skills/workflow/references/domain-skill-composition.md +0 -43
  414. package/skills/write-plan/SKILL.md +0 -92
  415. package/skills/write-plan/references/plan-shapes.md +0 -156
  416. package/skills/write-skill/references/activation-boundaries.md +0 -104
  417. package/skills/write-skill/references/agent-first-instructions.md +0 -121
  418. package/skills/write-skill/references/progressive-disclosure.md +0 -127
  419. package/skills/write-skill/references/skill-dependency-graphs.md +0 -190
  420. package/skills/write-spec/SKILL.md +0 -92
  421. package/skills/write-spec/references/artifact-standards.md +0 -86
  422. package/skills/write-spec/references/decision-records.md +0 -78
  423. package/skills/write-spec/references/spec-shapes.md +0 -143
  424. /package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/budget.js +0 -0
  425. /package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/evidence.mjs +0 -0
  426. /package/skills/{evaluate-skill → evaluate-behavior}/scripts/pi-observer.mjs +0 -0
@@ -0,0 +1,290 @@
1
+ #!/usr/bin/env node
2
+ // Answers "what does this change touch?" with capped, labelled query results, so the consequences of a change are in
3
+ // front of the agent before its first edit: entry points, readers of the state, writers (where old data comes from),
4
+ // scheduled or concurrent code, the tests that cover it, and the developer docs that cover each touched file. Each
5
+ // block gives its count, the first results, and what it did not search. It is a query, not a verdict: the agent writes
6
+ // a decision next to each result (Execute Work, "Find What The Change Touches").
7
+ // Usage: touch-map.mjs (--symbol <name> | --file <path>)... [--root <repository>] [--cap <n>] [--json]
8
+ // Searches files Git tracks and untracked files it does not ignore. Developer docs come from Write Docs'
9
+ // docs-check.mjs --covering; when no document has a Covers line, a capped search of the docs folder stands in.
10
+ // Exit code 0 when it reports (even nothing), 2 on a usage or Git error.
11
+ import { execFileSync, spawnSync } from "node:child_process";
12
+ import { existsSync, readFileSync } from "node:fs";
13
+ import { basename, dirname, extname, join, relative, resolve } from "node:path";
14
+ import { fileURLToPath } from "node:url";
15
+ import { parseArgs } from "node:util";
16
+
17
+ const USAGE = "Usage: touch-map.mjs (--symbol <name> | --file <path>)... [--root <repository>] [--cap <n>] [--json]";
18
+ const DOCS_CHECK = resolve(dirname(fileURLToPath(import.meta.url)), "../../write-docs/scripts/docs-check.mjs");
19
+
20
+ function fail(message) {
21
+ console.error(message);
22
+ process.exit(2);
23
+ }
24
+
25
+ let values;
26
+ try {
27
+ ({ values } = parseArgs({
28
+ options: {
29
+ symbol: { type: "string", multiple: true, default: [] },
30
+ file: { type: "string", multiple: true, default: [] },
31
+ root: { type: "string" },
32
+ cap: { type: "string", default: "20" },
33
+ json: { type: "boolean", default: false },
34
+ },
35
+ }));
36
+ } catch (error) {
37
+ fail(`${error.message}\n${USAGE}`);
38
+ }
39
+ if (!values.symbol.length && !values.file.length) fail(USAGE);
40
+ const cap = Number(values.cap);
41
+ if (!Number.isInteger(cap) || cap < 1) fail(`--cap must be a positive whole number\n${USAGE}`);
42
+
43
+ const git = (cwd, args) =>
44
+ execFileSync("git", args, { cwd, encoding: "utf8", maxBuffer: 256 * 1024 * 1024, stdio: ["ignore", "pipe", "pipe"] });
45
+ let root;
46
+ try {
47
+ root = resolve(git(resolve(values.root ?? "."), ["rev-parse", "--show-toplevel"]).trim());
48
+ } catch {
49
+ fail("not inside a Git repository");
50
+ }
51
+
52
+ // Test files by the common layouts Verify Work's test-changes.mjs lists; enough to tell a test hit from a code hit.
53
+ const TEST_PATH =
54
+ /(^|\/)(tests?|__tests__|spec|e2e|Tests)\/|\.(test|spec)\.[cm]?[jt]sx?$|_test\.(go|py|dart|exs)$|(^|\/)test_[^/]*\.py$|_spec\.rb$|(Test|Tests)\.(java|kt|cs|swift|php)$/;
55
+ const DOC_PATH = /\.(md|mdx|rst|adoc|txt)$/i;
56
+ const isTest = (path) => TEST_PATH.test(path);
57
+ const isDoc = (path) => DOC_PATH.test(path);
58
+
59
+ // Fixed-string git grep over tracked and untracked (not ignored) files; returns [{ path, line, text }]. Callers refine
60
+ // with JavaScript expressions, which behave the same on every platform's Git.
61
+ function grep(text, { word = false, paths = [] } = {}) {
62
+ const args = ["grep", "-n", "-I", "-F", "--no-color", "--untracked", "-e", text];
63
+ if (word) args.splice(1, 0, "-w");
64
+ if (paths.length) args.push("--", ...paths);
65
+ const result = spawnSync("git", args, { cwd: root, encoding: "utf8", maxBuffer: 256 * 1024 * 1024 });
66
+ if (result.status !== 0 && result.status !== 1) fail(`git grep failed: ${result.stderr.trim()}`);
67
+ return (result.stdout ?? "")
68
+ .split("\n")
69
+ .filter(Boolean)
70
+ .map((raw) => {
71
+ const match = /^(.*?):(\d+):(.*)$/.exec(raw);
72
+ return match ? { path: match[1], line: Number(match[2]), text: match[3].trim().slice(0, 200) } : null;
73
+ })
74
+ .filter(Boolean);
75
+ }
76
+
77
+ const block = (label, hits, notSearched) => ({
78
+ label,
79
+ count: hits.length,
80
+ results: hits.slice(0, cap).map((hit) => `${hit.path}:${hit.line}: ${hit.text}`),
81
+ cut: Math.max(0, hits.length - cap),
82
+ notSearched,
83
+ });
84
+ const escape = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
85
+ // Explicit scheduling and concurrency primitives, not every async function, so the block stays readable.
86
+ const SCHEDULED =
87
+ /\b(setTimeout|setInterval|setImmediate|queueMicrotask|requestAnimationFrame|cron|schedule(r|d)?\s*\(|new Worker|worker_threads|Promise\.(all|allSettled|race|any)|go func|goroutine|threading\.|Thread\(|asyncio\.(gather|create_task|wait)|concurrent\.futures|ThreadPool|ExecutorService|tokio::spawn|spawn\(|[Mm]utex|[Ss]emaphore|\.lock\(|withLock|debounce|throttle|retry\(|\.on\(\s*['"`]|addEventListener|setImmediate)/;
88
+
89
+ // Lines in the given files that schedule work or run it concurrently.
90
+ function scheduledIn(files) {
91
+ const hits = [];
92
+ for (const path of files) {
93
+ let text;
94
+ try {
95
+ text = readFileSync(join(root, path), "utf8");
96
+ } catch {
97
+ continue;
98
+ }
99
+ text.split("\n").forEach((line, index) => {
100
+ if (SCHEDULED.test(line)) hits.push({ path, line: index + 1, text: line.trim().slice(0, 200) });
101
+ });
102
+ }
103
+ return hits;
104
+ }
105
+
106
+ function symbolMap(symbol) {
107
+ const pattern = escape(symbol);
108
+ const hits = grep(symbol, { word: true }).filter((hit) => !isDoc(hit.path));
109
+ const definition = new RegExp(
110
+ `\\b(function\\*?|class|def|const|let|var|interface|type|enum|struct|trait|func|fn|module|export\\s+(default\\s+)?)\\s+${pattern}\\b|^\\s*(async\\s+)?${pattern}\\s*\\([^)]*\\)\\s*\\{`,
111
+ );
112
+ const write = new RegExp(
113
+ `(\\b|\\.)${pattern}\\s*(\\+\\+|--|[-+*/|&]?=(?!=))|\\b(set|write|save|store|put|insert|update|upsert|persist|delete|remove|assign)\\w*\\s*\\(\\s*['"\`]?${pattern}\\b|\\b${pattern}\\b\\s*:(?!:)|\\b(INSERT|UPDATE|DELETE)\\b.*\\b${pattern}\\b`,
114
+ "i",
115
+ );
116
+ const call = new RegExp(`\\b${pattern}\\s*\\(|\\bnew\\s+${pattern}\\b|['"\`/]${pattern}['"\`]`);
117
+ const code = hits.filter((hit) => !isTest(hit.path));
118
+ const definitions = code.filter((hit) => definition.test(hit.text));
119
+ const writers = code.filter((hit) => !definition.test(hit.text) && write.test(hit.text));
120
+ const entry = code.filter((hit) => !definition.test(hit.text) && !writers.includes(hit) && call.test(hit.text));
121
+ const readers = code.filter((hit) => !definitions.includes(hit) && !writers.includes(hit) && !entry.includes(hit));
122
+ const files = [...new Set(code.map((hit) => hit.path))];
123
+ const scheduled = scheduledIn(files.filter((path) => !isTest(path)));
124
+ const tests = hits.filter((hit) => isTest(hit.path));
125
+ const defined = [...new Set(definitions.map((hit) => hit.path))];
126
+ return {
127
+ target: symbol,
128
+ kind: "symbol",
129
+ definedIn: definitions.slice(0, cap).map((hit) => `${hit.path}:${hit.line}`),
130
+ blocks: [
131
+ block("entry points (calls, constructions, string references)", entry, [
132
+ "names built at run time, reflection and dynamic dispatch",
133
+ "other repositories, generated or ignored files",
134
+ ]),
135
+ block("readers of the state", readers, ["aliases and destructured or renamed copies", "serialized forms"]),
136
+ block("writers (where old data comes from)", writers, [
137
+ "data already stored by earlier versions: databases, files, caches, user settings",
138
+ "writes through an alias or a generic setter",
139
+ ]),
140
+ block("scheduled or concurrent code in the files that use it", scheduled, [
141
+ "callers in other files that run it concurrently",
142
+ "external schedulers (cron tables, CI, hosts)",
143
+ ]),
144
+ block("covering tests", tests, ["tests that reach it only indirectly", "test files outside the common layouts"]),
145
+ ],
146
+ touchedFiles: defined,
147
+ };
148
+ }
149
+
150
+ function fileMap(input) {
151
+ const path = relative(root, resolve(input)).split("\\").join("/");
152
+ if (path.startsWith("..")) fail(`outside the repository: ${input}`);
153
+ const stem = basename(path, extname(path));
154
+ const name = basename(path);
155
+ // Importers and other references: lines naming the file by its path or its stem in an import-like statement.
156
+ const named = new RegExp(`(^|[^A-Za-z0-9_.-])${escape(stem)}(\\.[A-Za-z0-9]+)?(['"\`)\\s:,;]|$)`);
157
+ const references = grep(stem).filter((hit) => hit.path !== path && !isDoc(hit.path) && named.test(hit.text));
158
+ const imports = references.filter((hit) =>
159
+ /\b(import|require|from|include|source|load|use|mod)\b|\bnode\b|\bpython\b|"(bin|main|exports|scripts)"/.test(
160
+ hit.text,
161
+ ),
162
+ );
163
+ const other = references.filter((hit) => !imports.includes(hit) && !isTest(hit.path));
164
+ const exists = existsSync(join(root, path));
165
+ const scheduled = exists ? scheduledIn([path]) : [];
166
+ const tests = references.filter((hit) => isTest(hit.path));
167
+ return {
168
+ target: path,
169
+ kind: "file",
170
+ exists,
171
+ blocks: [
172
+ block(
173
+ "entry points (importers, commands, manifests)",
174
+ imports.filter((hit) => !isTest(hit.path)),
175
+ ["dynamic imports with built paths", "registration by convention (routes, plugins found by folder)"],
176
+ ),
177
+ block("other references by name", other, [`mentions spelled other than ${name} or ${stem}`]),
178
+ block("scheduled or concurrent code in the file", scheduled, ["callers that run it concurrently"]),
179
+ block("covering tests", tests, ["tests that reach it only through other modules"]),
180
+ ],
181
+ touchedFiles: [path],
182
+ };
183
+ }
184
+
185
+ const maps = [...values.symbol.map(symbolMap), ...values.file.map(fileMap)];
186
+
187
+ // Developer docs covering every touched file, from docs-check --covering; a capped docs search when no doc has Covers.
188
+ const touched = [...new Set(maps.flatMap((map) => map.touchedFiles))];
189
+ let docs = { source: "none", paths: [], notSearched: [] };
190
+ if (touched.length && existsSync(DOCS_CHECK)) {
191
+ const run = spawnSync(
192
+ process.execPath,
193
+ [DOCS_CHECK, ...touched.flatMap((path) => ["--covering", path]), "--root", root, "--json"],
194
+ { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 },
195
+ );
196
+ if (run.status === 0) {
197
+ const found = JSON.parse(run.stdout);
198
+ const withCovers = found.documents - found.withoutCovers.length;
199
+ // Title and one line: the doc's first heading, and the section and line that name the file.
200
+ const describe = (docPath, target) => {
201
+ let text = "";
202
+ try {
203
+ text = readFileSync(join(root, docPath), "utf8");
204
+ } catch {
205
+ return { heading: null, line: null };
206
+ }
207
+ const lines = text.split("\n");
208
+ const title = lines.find((line) => /^#\s/.test(line))?.replace(/^#\s+/, "") ?? null;
209
+ const index = lines.findIndex((line, at) => at > 6 && (line.includes(target) || line.includes(basename(target))));
210
+ let section = title;
211
+ for (let at = index; at >= 0; at -= 1)
212
+ if (/^#{2,4}\s/.test(lines[at])) {
213
+ section = lines[at].replace(/^#+\s+/, "");
214
+ break;
215
+ }
216
+ const first =
217
+ index >= 0
218
+ ? lines[index]
219
+ : (lines.find((line, at) => at > 0 && line.trim() && !/^[#>]/.test(line.trim())) ?? "");
220
+ return { heading: section, line: first.trim().slice(0, 200) };
221
+ };
222
+ if (withCovers > 0)
223
+ docs = {
224
+ source: "docs-check --covering",
225
+ searched: found.searched,
226
+ paths: found.paths.map((entry) => ({
227
+ path: entry.path,
228
+ documents: entry.documents.map((doc) => ({
229
+ path: doc.path,
230
+ ...describe(doc.path, entry.path),
231
+ verifiedAt: doc.verifiedAt,
232
+ state: doc.state,
233
+ changedSince: doc.changed.length,
234
+ })),
235
+ })),
236
+ notSearched: [
237
+ `${found.withoutCovers.length} of ${found.documents} documents have no Covers line, so no lookup finds them`,
238
+ "user docs and READMEs outside the docs index",
239
+ ],
240
+ };
241
+ else {
242
+ const folder = found.searched[0] ?? "";
243
+ docs = {
244
+ source: `capped search of ${folder || "the docs folder"} (no document has a Covers line)`,
245
+ searched: found.searched,
246
+ paths: touched.map((path) => {
247
+ const hits = grep(basename(path), { paths: folder ? [folder] : [] }).filter((hit) => isDoc(hit.path));
248
+ return {
249
+ path,
250
+ documents: hits
251
+ .slice(0, cap)
252
+ .map((hit) => ({ path: hit.path, heading: null, line: `${hit.line}: ${hit.text}` })),
253
+ cut: Math.max(0, hits.length - cap),
254
+ };
255
+ }),
256
+ notSearched: ["docs that describe the code without naming the file", "staleness: no Verified at to compare"],
257
+ };
258
+ }
259
+ } else
260
+ docs = {
261
+ source: "unavailable",
262
+ paths: [],
263
+ notSearched: [`docs-check: ${(run.stderr || run.stdout).trim().split("\n")[0]}`],
264
+ };
265
+ }
266
+
267
+ const report = { command: "touch-map", root, cap, maps, docs };
268
+ if (values.json) console.log(JSON.stringify(report, null, 2));
269
+ else {
270
+ for (const map of maps) {
271
+ console.log(`=== ${map.kind} ${map.target}${map.kind === "file" && !map.exists ? " (does not exist yet)" : ""}`);
272
+ if (map.definedIn) console.log(`defined at: ${map.definedIn.join(", ") || "no definition found"}`);
273
+ for (const each of map.blocks) {
274
+ console.log(`--- ${each.label}: ${each.count}${each.cut ? ` (first ${cap} shown)` : ""}`);
275
+ for (const result of each.results) console.log(` ${result}`);
276
+ console.log(` not searched: ${each.notSearched.join("; ")}`);
277
+ }
278
+ }
279
+ console.log(`--- developer docs (${docs.source})`);
280
+ for (const entry of docs.paths) {
281
+ console.log(` ${entry.path}`);
282
+ if (!entry.documents.length) console.log(" no covering document");
283
+ for (const doc of entry.documents)
284
+ console.log(
285
+ ` ${doc.path}${doc.heading ? ` § ${doc.heading}` : ""}${doc.state ? ` (verified at ${doc.verifiedAt ?? "none"}: ${doc.state}${doc.changedSince ? `, ${doc.changedSince} covered file(s) changed since` : ""})` : ""}${doc.line ? `\n ${doc.line}` : ""}`,
286
+ );
287
+ }
288
+ if (docs.notSearched.length) console.log(` not searched: ${docs.notSearched.join("; ")}`);
289
+ console.log("Write your decision next to each result: it changes too, or its users keep exactly what they get now.");
290
+ }
@@ -1,121 +1,151 @@
1
1
  ---
2
2
  name: review-work
3
- description: "Use when judging implementation or integrated work through self-review or independent review, or when adjudicating a returned independent review report."
3
+ description: "Use whenever finished work or a document is judged fit to use: reviewing code, a diff, a commit or a pull request; checking your own change before reporting it done; reviewing a spec, plan, design, ADR, handoff, skill, final report, status note or Working Record; reviewing changes to authentication, permissions, secrets, untrusted input or other security boundaries; reviewing an eval case, suite, grader or rubric before paying for its runs; preparing, dispatching or skipping an independent review; choosing a model as judge or relying on its verdict; and weighing a review report that came back."
4
4
  ---
5
5
 
6
6
  # Review Work
7
7
 
8
- Judge whether the actual work satisfies the accepted outcome, remains proportionate, and has enough evidence for a named boundary.
8
+ Judge whether the actual work satisfies the accepted outcome, remains proportionate, and has enough evidence for a named boundary; or whether a complete artifact faithfully represents accepted intent and is sufficient for its named use. An artifact's internal consistency is not enough if it consistently describes the wrong outcome or an obsolete baseline.
9
9
 
10
- [Verify Work](../../skills/verify-work/SKILL.md) establishes what observations prove. Review judges their sufficiency and the resulting work; it does not replace verification, choose user-owned behavior, or authorize corrections.
10
+ [Verify Work](../../skills/verify-work/SKILL.md) establishes what observations prove. Review judges their sufficiency and the resulting work or artifact; it does not replace verification, create evidence, choose user-owned behavior, settle owner decisions, or authorize corrections or revisions.
11
11
 
12
- ## Choose The Review Role
12
+ Review has three roles:
13
13
 
14
- - **Self-review:** the producer checks its own supported result before accepting or reusing it. This is the normal required route.
14
+ - **Self-review:** the producer or author checks its own supported result or artifact before accepting, reusing, or using it. This is the normal required route.
15
15
  - **Independent review:** a separately selected reviewer judges a state it did not produce, from a separate context.
16
16
  - **Adjudication:** the receiving agent checks a returned independent report and decides what its findings establish.
17
17
 
18
- An independent reviewer reports and stops. It does not adjudicate its own findings or become the fixing agent. Switching models or loading this skill does not create independence.
18
+ The **Rules** below are binding; if one cannot be met, stop and say why. Everything else is **judgment**: follow its stated goal, and adapt when a different choice serves that goal better.
19
19
 
20
- Independent review is not automatic after implementation or self-review. Select it through Workflow only when requested or justified and authorized to protect a concrete risk, dependency, integration, or delivery boundary. A review budget permits no dispatch by itself.
20
+ ## Routes
21
21
 
22
- ## Establish What The Review Protects
22
+ Read the reference for what is under review before reviewing it; each names what to establish first, the sources that govern, and the lenses that can change the judgment for that kind.
23
23
 
24
- Identify the exact code, diff, commit, or integrated state; its accepted outcome, non-goals, relevant requirements and amendments; the future action being protected; and the verification evidence and gaps.
24
+ | Situation | Go to |
25
+ | --- | --- |
26
+ | Work: code, a diff, a commit, an implementation, or integrated state | [Work Review](references/work.md) |
27
+ | Work that changes trust boundaries, authentication, authorization, permissions, untrusted input, secrets, sensitive data, security-relevant dependencies or external integrations, code-execution boundaries, or failure behavior with security consequences | Work Review's [Security Risk Lens](references/work.md#security-risk-lens) as well |
28
+ | An artifact that will guide later work: a Spec, Plan, design, decision record, ADR, handoff, or skill | [Artifact Review](references/artifact.md) |
29
+ | An account of work already done: a final report to the user, a status or results note, or a Working Record | [Artifact Review](references/artifact.md), with its [Reports And Records](references/artifact.md#reports-and-records) |
30
+ | An eval case, suite, fixture, grader, or rubric that will be run to measure behavior, before spending on its runs | [Eval Definition Review](references/evals-and-judges.md#eval-definition-review) |
31
+ | A hand-over: dispatching, proposing, or skipping an independent review of the work | The Review Gate, below |
32
+ | Preparing or performing an independent review | Independent Review in [Work Review](references/work.md#independent-review) for work; in [Artifact Review](references/artifact.md#independent-review) for anything else |
33
+ | Writing or dispatching an independent reviewer's brief | Prefill it with [review-packet](scripts/review-packet.mjs) and check it with [check-brief](scripts/check-brief.mjs), as Perform A Selected Independent Review says |
34
+ | A model's verdict on another agent's output will be used as evidence: an independent reviewer, an eval's advisory reviewer, or a grading judge | The [Judge Contract](references/evals-and-judges.md#judge-contract), before selecting the judge or using its verdict |
35
+ | An independent review's report has returned | [Adjudicate A Returned Review](references/adjudication.md), before acting on it |
25
36
 
26
- Inspect the actual state and governing sources—not just the producer's summary or explanation. A detailed execution contract can itself have been mistaken. Check the user outcome before judging compliance with the suggested implementation steps.
37
+ ## Rules
27
38
 
28
- Before reviewing changes to trust boundaries, authentication, authorization, permissions, untrusted input, secrets, sensitive data, security-relevant dependencies, code execution, or security-sensitive failure behavior, read [Security Risk Lens](references/security-risk-lens.md).
39
+ - Independent review is never automatic after implementation, after self-review, or after writing or revising a Spec or Plan. Select it only when requested, or justified and authorized, to protect a concrete risk, dependency, integration, delivery, or intended-use boundary. At a hand-over, the user's review mode `always`, or `auto` when the Review Gate below fires, authorizes it; under `off`, propose it and wait for a yes. A review budget permits no dispatch by itself, and switching models or compute profiles, or loading this skill, does not create independence: it needs a separately selected reviewer in a separate context. A reviewer from another model family is not required: it changes what gets flagged but has not been shown to find more real defects. Record the reviewer as the Judge Contract says.
40
+ - An independent reviewer reports and stops: no edits, no owner decisions, no choosing among materially different remedies or revisions, no adjudication, no further dispatch, and no continuing until Pass. It runs only what its brief's `May run` line names: by default the project's declared checks (tests, build, typecheck, the feature map's drive steps), in its own copy, with no edits, network calls, or paid runs; another check only when the brief names it with its expected evidence and stop condition. Otherwise it reports Needs evidence.
41
+ - Findings are evidence, not commands or authority to correct or revise. Derive the judgment from your dispositions rather than adopting the reviewer's verdict or conclusion. Actual correction of work belongs to [Execute Work](../../skills/execute-work/SKILL.md) under covered authority; actual revision of an artifact returns to the artifact's owning skill.
42
+ - Never lower acceptance or change tests, Specs, policies, or source truth to obtain Pass. Never settle a user decision or revise upstream intent, accepted content, or owner decisions merely to make an artifact consistent or to obtain Pass. Never repeat a review merely to obtain Pass.
43
+ - Never request Review 4. Renaming scope or intended use, changing reviewers, or making a local correction or revision does not reset the review budget.
44
+ - Never present a review judgment or an artifact's fitness as acceptance, implementation, or execution authority.
29
45
 
30
- Use [Action Selection](../../skills/action-selection/SKILL.md) for uncertain or broad inspection. An obvious diff or source read does not need another selection exercise.
46
+ ## Before Any Review
31
47
 
32
- ## Apply The Same Technical Kernel
48
+ The project's Review Rules (or `REVIEW.md`), read from the base branch, feed the kind's classes and lenses, never a new class.
33
49
 
34
- Use lenses that can change the boundary judgment:
35
-
36
- - **Alignment:** required behavior and accepted amendments are implemented without omission or invented obligations.
37
- - **Correctness and integration:** reachable paths, affected callers, and components work together without regressions.
38
- - **Failure and risk:** material errors, recovery, permissions, data, and compatibility are handled as required.
39
- - **Evidence:** claims are supported at their required observing boundaries, not merely by green summaries.
40
- - **Design and minimality:** complexity and coordination serve requirements or demonstrated needs rather than optional stronger guarantees.
41
- - **Maintainability:** behavior and failure paths remain understandable and changeable.
42
-
43
- Do not assume more implementation is better. Check both missing accepted work and unnecessary additions. A prototype result is not production acceptance, and a test protecting a mechanism does not make that mechanism required.
44
-
45
- If the implementation follows an artifact whose baseline conflicts with a later accepted change, expose that source mismatch. Do not choose whichever source makes the work pass or treat every unselected experiment as a production obligation.
50
+ Before a model reviews anything, run the deterministic checks that apply and could fail on their own, such as the project's checks, a validator, a docs check, or a definition loader. Give their results to the reviewer as evidence. A model review does not replace a check that can fail mechanically.
46
51
 
47
52
  ## Classify Before Calling Something A Defect
48
53
 
54
+ Goal: every reported item is supported and names the right kind of problem.
55
+
49
56
  Ask in order:
50
57
 
51
- 1. Is the relevant behavior or source truth settled? If not, report a **Question** when it affects the boundary.
52
- 2. Are reachability and material consequence supported? If not, report **Needs evidence**, not a hypothetical defect.
53
- 3. Does this boundary require correction? If it cannot safely be crossed, report a **Blocking Issue**. If correction is required but safely deferrable, report a **Non-blocking Issue**.
54
- 4. Is it merely useful beyond this boundary? Omit it by default, or identify an **Improvement** when materially relevant or explicitly requested.
58
+ 1. Is the relevant behavior or source truth settled (for an artifact, also the content and any owner choice its intended use depends on)? If not, report a **Question** when it affects the boundary or intended use.
59
+ 2. Are reachability, the load-bearing claim, and the material consequence supported by available evidence? If not, report **Needs evidence**, not a hypothetical defect.
60
+ 3. Does this boundary or intended use require correction or revision? If it cannot safely be crossed, report a **Blocking Issue**. If correction or revision is required but safely deferrable, report a **Non-blocking Issue**.
61
+ 4. Is it merely useful beyond this boundary or use? Omit it by default, or identify an **Improvement** when materially relevant or explicitly requested.
55
62
 
56
- An Issue needs an exact location or path, violated requirement or invariant, supporting evidence, and concrete consequence. A Blocking Issue must explain why the protected boundary cannot be crossed.
63
+ A defect the change did not introduce is **Pre-existing**: report it for the user with the evidence that it predates the change, never as Blocking.
57
64
 
58
- Needs evidence must identify the claim, required observer, existing evidence and limit, why the gap matters, and the smallest observation that could disagree. First establish that the stronger claim is required; missing proof of an optional guarantee does not automatically justify more work. Check whether supplied observations apply to the reviewed candidate and whether material assertion changes preserved the required property. A missing or stale result is not itself a code defect; recover evidence or establish the observer before prescribing a fix.
65
+ An Issue needs an exact location, path, or dependency; the violated requirement, invariant, source, or artifact responsibility; supporting evidence; and a concrete consequence. Name the defect's class and every other place in the reviewed state where it occurs, not one instance. A Blocking Issue must explain why the protected boundary cannot be crossed or the intended use cannot proceed, and name the correction constraints or the owning activity to re-enter. Recommend a specific correction or revision only when source intent, evidence, and dependency consequences support it rather than merely make it plausible.
59
66
 
60
- Do not turn preferences, imagined edge cases, intentional deferrals, or hypothetical completeness into Issues. Finding no material issue is valid.
67
+ Needs evidence identifies the load-bearing claim, required observer, existing evidence and its limit, why the gap matters, and the smallest observation that could disagree. First establish that the stronger claim is required; missing proof of an optional guarantee does not justify more work, and an optional stronger claim may be qualified rather than expanding the task. Check whether supplied observations apply to the reviewed candidate and whether material assertion changes preserved the required property. For an artifact, check which source or check state a reported pass examined and whether later changes reduced acceptance or invalidated it; a newer report cannot repair that mismatch. A missing or stale result is not itself a code defect: recover evidence or establish the observer before prescribing a fix. When you can recover it yourself, by running a check you are authorized to run or by reading the code, do so and judge from what you observed: a check the author skipped and you have since run is not Needs evidence.
68
+
69
+ Do not turn preferences, wording or presentation, imagined or exhaustive edge cases, intentional deferrals, or hypothetical completeness into Issues. Finding no material issue is valid.
61
70
 
62
71
  ## Self-Review And Re-enter Narrowly
63
72
 
64
- Apply the kernel silently after evidence initially supports the produced result. Do not create formal review items, a numbered review cycle, or an independent-review judgment for self-review.
73
+ Goal: catch real defects in your own result without turning review into an open-ended editing or rewriting loop.
65
74
 
66
- For one clear covered defect, return to the producer, correct it, re-verify the affected boundary, and repeat only affected review lenses once. Do not restart every check or add a reviewer because a local correction occurred.
75
+ Apply the kind's lenses silently once evidence initially supports the produced result or the artifact's load-bearing facts; do not create formal review items, a numbered review cycle, or an independent-review judgment for self-review. For work, also run Work Review's decision and test-integrity checks.
67
76
 
68
- When the outcome remains settled but the approach is invalidated, return for implementation preparation. Use [Diagnose Failure](../../skills/diagnose-failure/SKILL.md) for unclear or repeatedly failing causes, and [Decision Gate](../../skills/decision-gate/SKILL.md) for unsettled accepted behavior or a user-owned choice. Return coordination or scope changes to [Workflow](../../skills/workflow/SKILL.md).
77
+ For one clear covered defect (for an artifact, one whose revision basis is settled), return to the producing or authoring activity, correct or revise it, reconcile an artifact's affected dependencies within authority, re-verify the affected boundary or factual claims, and repeat only the affected lenses once (for an artifact, source alignment as well). Do not restart every check or add a reviewer because a local correction occurred. Route anything else as below.
69
78
 
70
- Stop self-review when the supported state is accepted or a material issue has a clear next route. Optional polish is not permission to continue editing.
79
+ Stop self-review when the supported state is accepted, the artifact is fit for its agreed use, or a material issue has a clear next route. Optional polish is not permission to continue editing, and self-review is not a reason to add independent review.
71
80
 
72
- ## Perform A Selected Independent Review
81
+ ## Route A Problem To Its Owner
73
82
 
74
- Before preparing or performing it, read [Independent Work Reviewer Contract](references/independent-work-reviewer-contract.md).
83
+ When a problem is not one clear covered defect, in self-review or adjudication, send it by what changed:
75
84
 
76
- Use supplied and available evidence. Do not run a missing active check unless review authority covers that exact check; otherwise report Needs evidence. A covered active check uses Verify Work's check-result and claim-result semantics without changing review ownership.
85
+ - the outcome remains settled but the implementation approach is invalidated: back to implementation preparation in Execute Work;
86
+ - an unclear, unsupported, or repeated cause: Execute Work's [diagnose](../../skills/execute-work/references/diagnose.md);
87
+ - changed direction or strategy, unsettled behavior or content, materially different remedies or revisions, a user-owned choice, a scope change, or a source conflict: [Discuss Work](../../skills/discuss-work/SKILL.md);
88
+ - missing factual support: the named claim to Verify Work;
89
+ - a correction, revision, or dependency update the current authority does not cover: propose the bounded change once and wait.
77
90
 
78
- Inspect and report without edits, choosing among materially different remedies, adjudication, another review dispatch, or continuing until Pass. Recommend a specific correction only when supported rather than merely plausible.
91
+ ## The Review Gate
79
92
 
80
- The independent judgment is:
93
+ Goal: at a hand-over, the work gets the independent review its risk calls for, as the user's review mode says.
81
94
 
82
- - **Blocking:** at least one Blocking Issue.
83
- - **Inconclusive:** no Blocking Issue, but a material Question or Needs evidence prevents judgment.
84
- - **Non-blocking:** only Non-blocking Issues remain.
85
- - **Pass:** no Issues or material unresolved items remain.
95
+ A **hand-over** is the end of the agreed work, when it goes back to the user to accept: before [Deliver Work](../../skills/deliver-work/SKILL.md) merges or opens a pull request for it, or before the final report when nothing is delivered. Self-review of an intermediate result, such as one Slice or a small local fix, needs no gate.
86
96
 
87
- Improvements do not change the judgment or authorize implementation. Every judgment ends the review.
97
+ The user sets a review mode, and optionally a reviewer model, as `"review": { "mode": ..., "model": ... }` in `.freeflow/local.json` (personal) or `.freeflow/config.json` (shared). The Runtime State shows a `Review:` line when one is set; with none, the mode is `auto`.
88
98
 
89
- ## Adjudicate The Returned Report
99
+ - `auto`: the triggers below decide. When one fires, dispatch an independent review; the trigger and the mode are its authorization. When none fires, self-review is enough.
100
+ - `off`: never dispatch on your own. When a trigger would fire, propose an independent review to the user with the trigger and its estimated cost, and run it only after their yes.
101
+ - `always`: dispatch an independent review at every hand-over.
90
102
 
91
- Read [Adjudicate Work Review](references/adjudicate-work-review.md) before adjudicating.
103
+ A user's explicit request for an independent review authorizes it in any mode.
92
104
 
93
- Check each material finding against the actual reviewed state, sources, and evidence:
105
+ The gate fires when the change touches:
94
106
 
95
- - **Accepted:** supported and applicable.
96
- - **Rejected:** unsupported, stale, already resolved, duplicate, preference-only, out of scope, or based on a source misread.
97
- - **Open:** evidence or a decision is missing.
107
+ - security, authentication, authorization, or secrets;
108
+ - possible data loss, or a migration of stored data;
109
+ - CI or release files;
110
+ - a public interface: anything users or other code depend on, such as CLI flags, config keys, exported APIs, and skill names and descriptions;
111
+ - a path the project's Review Rules mark sensitive;
112
+ - anything the work agreement names for review.
98
113
 
99
- Derive the overall judgment from those dispositions; do not separately accept the reviewer's verdict. Findings are evidence, not commands or correction authority.
114
+ Judge from the diff against the base, not from how the task was described. A trigger that fires is enough; a small diff does not cancel it.
100
115
 
101
- Pass permits proceeding at the reviewed boundary. Non-blocking permits proceeding with explicit deferrals. Inconclusive requires the missing evidence or decision. Blocking prevents crossing the boundary and returns the smallest supported correction or reconsideration to its owner.
116
+ Use the user's reviewer model when set. Otherwise use the cheapest model capable of the review: the `standard` tier. When a security, authentication, authorization, or secrets trigger fires, use a stronger model: the `security` tier. The estimated cost names the reviewer model and roughly what one review of a change this size costs on it.
117
+
118
+ When the task has a Working Record, record the gate as one `Review gate` Material update through [Track Work](../../skills/track-work/SKILL.md), in the shape its [format reference](../../skills/track-work/references/working-record-format.md) defines; its tier is `standard`, `security`, or `none` when the result is `skipped`. Without a record, state the same in the hand-over report.
119
+
120
+ ## Perform A Selected Independent Review
102
121
 
103
- When correction is ready, state the supported problem, remedy, rationale, verification boundary, authority, and whether independent follow-up is still warranted. Actual correction belongs to [Execute Work](../../skills/execute-work/SKILL.md), not the independent reviewer.
122
+ Goal: a separate context judges the state from the evidence and reports once.
123
+
124
+ The reviewer did not produce the reviewed state. Give it, or point it to, the work product or the complete artifact, source truth, dependencies, and evidence needed to judge it directly, never only the producer's summary, reasoning, claimed result, or change description. Brief a reviewer of work with pointers to where its inputs live, not pasted copies, and run [check-brief](scripts/check-brief.mjs) on the brief before dispatching, as Work Review's Independent Review says; [review-packet](scripts/review-packet.mjs) prefills that brief from the task folder, names the gate triggers the diff shows and the round budget, and runs check-brief; brief a reviewer of anything else with Artifact Review's prompt. When the task has a task directory, save the brief as `scratch/reviews/R<n>-brief.md` there and the returned report as `R<n>-report.md` beside it, where `<n>` is the review number. Delete nothing there without the user's yes.
125
+
126
+ Use supplied and available evidence; a covered active check uses Verify Work's check-result and claim-result semantics without changing review ownership.
127
+
128
+ The independent judgment is:
129
+
130
+ - **Blocking:** at least one Blocking Issue.
131
+ - **Inconclusive:** no Blocking Issue, but a material Question or Needs evidence prevents judgment.
132
+ - **Non-blocking:** only Non-blocking Issues remain.
133
+ - **Pass:** no Issues or material unresolved items remain.
134
+
135
+ Improvements and Pre-existing items do not change the judgment or authorize implementation or revision. Every judgment ends the review.
104
136
 
105
137
  ## Bound Independent Review
106
138
 
107
- Keep the existing budget for the same state and boundary:
139
+ Goal: independent judgment is spent where it changes the outcome.
108
140
 
109
- - **Review 1:** first selected independent review, broad by default.
110
- - **Review 2:** separately selected focused follow-up when corrections, affected interactions, new evidence, or remaining risk still require independent judgment.
111
- - **Review 3:** exceptional, separately authorized, and final; use only after the cause and correction boundary are understood.
141
+ For the same reviewed state and boundary or intended use:
112
142
 
113
- A fix does not automatically require another review. If Review 2 remains Blocking, diagnose a repeated, extending, or unclear cause; return an unrelated clear local defect to its owner when diagnosis would add no information. Do not automatically fix and dispatch Review 3.
143
+ - **Review 1:** first selected independent review, broad by default.
144
+ - **Review 2:** separately selected focused follow-up when corrections or revisions, affected interactions or dependencies, new evidence, or remaining risk still require independent judgment.
145
+ - **Review 3:** exceptional, separately authorized, and final; only after the cause, revision basis, and correction or dependency boundary are understood.
114
146
 
115
- Do not request Review 4. Renaming scope, changing reviewers, or making a local correction does not reset the budget. Workflow may establish a new cycle only for a materially new reviewed state and boundary. Self-review does not consume this budget.
147
+ A fix or revision does not automatically require another review. If Review 2 remains Blocking, adjudicate it before acting again; then diagnose a repeated, extending, invalidating, or unclear cause, and return an unrelated clear local defect to its owner when diagnosis would add no information, rather than fix and dispatch Review 3 automatically. If Review 3 remains Blocking, rethink the approach rather than correct it again: route the blocker to diagnose, or to Discuss Work when the approach itself is in question. Start a new cycle only for a materially new reviewed state and boundary or intended use. Self-review does not consume this budget.
116
148
 
117
149
  ## Stop At The Selected Result
118
150
 
119
- Self-review ends with acceptance or a routed issue. Independent review ends with its report. Adjudication ends with dispositions and an explicit next route.
120
-
121
- Do not review until Pass, lower acceptance to obtain it, or turn optional improvement into unfinished work. Preserve the agreed user-facing return boundary and any unresolved limits.
151
+ Self-review ends with acceptance, supported fitness, or a routed issue. Independent review ends with its report. Adjudication ends with dispositions and an explicit next route. Do not turn optional improvement into unfinished work; preserve the agreed user-facing return boundary and any unresolved limits.