@hassangameryt/freeflow 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 (276) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.codex-plugin/plugin.json +1 -1
  4. package/.cursor-plugin/plugin.json +1 -1
  5. package/NOTICE +14 -0
  6. package/README.md +26 -31
  7. package/capabilities/cognitive-routing/SKILL.md +106 -161
  8. package/capabilities/cognitive-routing/references/both-mode.md +36 -0
  9. package/capabilities/cognitive-routing/references/executor-mode.md +48 -0
  10. package/capabilities/cognitive-routing/references/helper-mode.md +47 -0
  11. package/capabilities/compaction/SKILL.md +49 -0
  12. package/capabilities/compaction/references/summary-format.md +239 -0
  13. package/command-surface.json +4 -0
  14. package/gemini-extension.json +1 -1
  15. package/hooks/shared/runtime-context.mjs +28 -30
  16. package/licenses/Apache-2.0.txt +55 -0
  17. package/package.json +22 -9
  18. package/pi-extension/README.md +41 -0
  19. package/pi-extension/dist/cognitive-routing/assembler.js +393 -0
  20. package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/config.js +5 -2
  21. package/pi-extension/dist/cognitive-routing/economics.js +45 -0
  22. package/pi-extension/dist/cognitive-routing/event-schema.js +388 -0
  23. package/pi-extension/dist/{session-sources/events.js → cognitive-routing/event-store.js} +103 -40
  24. package/pi-extension/dist/cognitive-routing/gate.js +241 -0
  25. package/pi-extension/dist/cognitive-routing/handlers.js +899 -0
  26. package/pi-extension/dist/cognitive-routing/handoffs.js +350 -0
  27. package/pi-extension/dist/cognitive-routing/model-control.js +467 -0
  28. package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/projection.js +229 -56
  29. package/pi-extension/dist/cognitive-routing/provenance.js +81 -0
  30. package/pi-extension/dist/cognitive-routing/runtime.js +396 -0
  31. package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/schemas.js +43 -7
  32. package/pi-extension/dist/cognitive-routing/session.js +221 -0
  33. package/pi-extension/dist/{session-sources → cognitive-routing}/sources.js +99 -85
  34. package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/state.js +37 -378
  35. package/pi-extension/dist/cognitive-routing/status.js +80 -0
  36. package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/tools.js +12 -12
  37. package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/types.js +5 -11
  38. package/pi-extension/dist/compaction/carry.js +191 -0
  39. package/pi-extension/dist/compaction/config.js +22 -0
  40. package/pi-extension/dist/compaction/controller.js +471 -0
  41. package/pi-extension/dist/compaction/harness.js +77 -0
  42. package/pi-extension/dist/compaction/results.js +158 -0
  43. package/pi-extension/dist/compaction/thresholds.js +35 -0
  44. package/pi-extension/dist/compaction/tool.js +57 -0
  45. package/pi-extension/dist/host/branch.js +13 -0
  46. package/pi-extension/dist/host/canonical.js +12 -0
  47. package/pi-extension/dist/host/catalog.js +77 -0
  48. package/pi-extension/dist/host/config.js +374 -0
  49. package/pi-extension/dist/host/projection-tags.js +60 -0
  50. package/pi-extension/dist/host/prompts.js +82 -0
  51. package/pi-extension/dist/{session-sources → host}/read-only-session.js +112 -1
  52. package/pi-extension/dist/{runtime → host}/request-history.js +121 -39
  53. package/pi-extension/dist/host/runtime-state.js +189 -0
  54. package/pi-extension/dist/{settings/settings-ui.js → host/settings/freeflow-command.js} +620 -410
  55. package/pi-extension/dist/{settings/settings-tui.js → host/settings/settings-view.js} +186 -73
  56. package/pi-extension/dist/host/staging.js +28 -0
  57. package/pi-extension/dist/host/status.js +101 -0
  58. package/pi-extension/dist/index.js +423 -173
  59. package/pi-extension/dist/provider-support/cache/anchor.js +21 -0
  60. package/pi-extension/dist/provider-support/cache/anthropic.js +102 -0
  61. package/pi-extension/dist/provider-support/cache/health.js +73 -0
  62. package/pi-extension/dist/provider-support/cache/index.js +58 -0
  63. package/pi-extension/dist/provider-support/cache/keepalive.js +210 -0
  64. package/pi-extension/dist/provider-support/cache/monitor.js +17 -0
  65. package/pi-extension/dist/provider-support/cache/openai-responses.js +48 -0
  66. package/pi-extension/dist/provider-support/effort.js +13 -0
  67. package/pi-extension/dist/provider-support/index.js +44 -3
  68. package/pi-extension/dist/provider-support/{astra → openai}/adapter.js +46 -29
  69. package/pi-extension/dist/provider-support/{astra → openai}/history.js +10 -8
  70. package/pi-extension/dist/provider-support/{astra → openai}/index.js +8 -4
  71. package/pi-extension/dist/provider-support/{astra → openai}/session-state.js +29 -38
  72. package/pi-extension/dist/provider-support/routes.js +17 -0
  73. package/pi-extension/dist/tool-execution/apply-patch/grammar.js +23 -0
  74. package/pi-extension/dist/tool-execution/apply-patch/match.js +38 -0
  75. package/pi-extension/dist/tool-execution/apply-patch/parser.js +177 -0
  76. package/pi-extension/dist/tool-execution/apply-patch/plan.js +201 -0
  77. package/pi-extension/dist/tool-execution/apply-patch/tool.js +84 -0
  78. package/pi-extension/dist/tool-execution/background.js +238 -0
  79. package/pi-extension/dist/tool-execution/bash-guard.js +23 -0
  80. package/pi-extension/dist/tool-execution/config.js +22 -0
  81. package/pi-extension/dist/tool-execution/edit-messages.js +120 -0
  82. package/pi-extension/dist/tool-execution/file-state.js +138 -0
  83. package/pi-extension/dist/tool-execution/file-tracking.js +143 -0
  84. package/pi-extension/dist/tool-execution/prompt.js +54 -0
  85. package/pi-extension/dist/tool-execution/tools.js +16 -0
  86. package/pi-extension/freeflow/README.md +9 -0
  87. package/plugin.json +1 -1
  88. package/runtime/prompts/cognitive-routing.md +4 -4
  89. package/runtime/prompts/core.md +22 -75
  90. package/runtime/prompts/interaction-contract.md +15 -8
  91. package/runtime/prompts/tool-execution.md +38 -0
  92. package/runtime/prompts/working-method.md +108 -0
  93. package/skills/action-selection/SKILL.md +39 -47
  94. package/skills/action-selection/references/trajectory-stalls.md +2 -0
  95. package/skills/bypass/SKILL.md +2 -2
  96. package/skills/commit-work/SKILL.md +31 -83
  97. package/skills/commit-work/references/git-state-edges.md +1 -1
  98. package/skills/commit-work/references/simple-push.md +2 -0
  99. package/skills/commit-work/references/staging-decisions.md +1 -1
  100. package/skills/decision-gate/SKILL.md +31 -50
  101. package/skills/design-for-depth/SKILL.md +44 -53
  102. package/skills/design-for-depth/references/design-pressure-signals.md +46 -144
  103. package/skills/design-for-depth/references/implementation-decisions.md +1 -1
  104. package/skills/design-for-depth/references/interface-design-loop.md +5 -36
  105. package/skills/design-for-depth/references/module-and-dependency-design.md +2 -32
  106. package/skills/design-for-depth/references/state-and-failure-boundaries.md +2 -13
  107. package/skills/diagnose-failure/SKILL.md +39 -24
  108. package/skills/diagnose-failure/references/diagnostic-loop-catalog.md +2 -0
  109. package/skills/diagnose-failure/references/flaky-and-performance-diagnosis.md +2 -2
  110. package/skills/discuss/SKILL.md +35 -11
  111. package/skills/discuss/references/discussion-continuity.md +7 -27
  112. package/skills/evaluate-skill/SKILL.md +49 -80
  113. package/skills/evaluate-skill/references/evaluation-definition-schema.md +35 -5
  114. package/skills/evaluate-skill/references/evaluation-design.md +14 -14
  115. package/skills/evaluate-skill/references/execution-and-evidence.md +26 -5
  116. package/skills/evaluate-skill/references/review-and-revision.md +3 -1
  117. package/skills/evaluate-skill/scripts/lib/definitions.mjs +49 -8
  118. package/skills/evaluate-skill/scripts/lib/pi.mjs +14 -7
  119. package/skills/evaluate-skill/scripts/lib/review.mjs +196 -0
  120. package/skills/evaluate-skill/scripts/lib/runner.mjs +45 -8
  121. package/skills/evaluate-skill/scripts/lib/sandbox.mjs +2 -0
  122. package/skills/evaluate-skill/scripts/lib/trials.mjs +103 -0
  123. package/skills/evaluate-skill/scripts/lib/view.mjs +67 -1
  124. package/skills/evaluate-skill/scripts/pi-command-tool.mjs +144 -0
  125. package/skills/evaluate-skill/scripts/pi-guard.mjs +30 -13
  126. package/skills/evaluate-skill/scripts/skill-eval.mjs +114 -34
  127. package/skills/execute-work/SKILL.md +41 -9
  128. package/skills/execute-work/references/code-practices.md +2 -0
  129. package/skills/execute-work/references/execute-work-edges.md +11 -1
  130. package/skills/handoff/SKILL.md +1 -1
  131. package/skills/handoff/references/handoff-templates.md +1 -1
  132. package/skills/review-artifact/SKILL.md +42 -41
  133. package/skills/review-artifact/references/adjudicate-artifact-review.md +1 -1
  134. package/skills/review-artifact/references/independent-artifact-reviewer-contract.md +1 -1
  135. package/skills/review-work/SKILL.md +38 -32
  136. package/skills/review-work/references/adjudicate-work-review.md +1 -1
  137. package/skills/review-work/references/independent-work-reviewer-contract.md +1 -1
  138. package/skills/review-work/references/security-risk-lens.md +2 -4
  139. package/skills/setup-freeflow/SKILL.md +3 -1
  140. package/skills/setup-freeflow/references/activation-contract.md +7 -13
  141. package/skills/setup-freeflow/references/host-setup.md +3 -3
  142. package/skills/track-work/SKILL.md +113 -161
  143. package/skills/track-work/references/working-record-format.md +189 -350
  144. package/skills/track-work/scripts/lib/document.mjs +62 -6
  145. package/skills/track-work/scripts/lib/format.mjs +16 -1
  146. package/skills/track-work/scripts/lib/store.mjs +9 -8
  147. package/skills/track-work/scripts/lib/transitions.mjs +79 -4
  148. package/skills/track-work/scripts/working-record.mjs +34 -12
  149. package/skills/verify-work/SKILL.md +29 -20
  150. package/skills/verify-work/references/browser-runtime-evidence.md +1 -5
  151. package/skills/verify-work/references/integration-evidence.md +2 -0
  152. package/skills/verify-work/references/performance-evidence.md +3 -1
  153. package/skills/verify-work/references/test-design.md +3 -1
  154. package/skills/workflow/SKILL.md +65 -21
  155. package/skills/workflow/references/domain-skill-composition.md +5 -3
  156. package/skills/write-docs/SKILL.md +83 -0
  157. package/skills/write-docs/references/documentation-shapes.md +119 -0
  158. package/skills/write-docs/scripts/docs-check.mjs +139 -0
  159. package/skills/write-plan/SKILL.md +40 -40
  160. package/skills/write-plan/references/plan-shapes.md +1 -1
  161. package/skills/write-skill/SKILL.md +107 -147
  162. package/skills/write-skill/references/activation-boundaries.md +2 -0
  163. package/skills/write-skill/references/agent-first-instructions.md +22 -10
  164. package/skills/write-skill/references/progressive-disclosure.md +4 -2
  165. package/skills/write-skill/references/skill-dependency-graphs.md +2 -0
  166. package/skills/write-skill/scripts/lib/similarity.mjs +56 -0
  167. package/skills/write-skill/scripts/skill-author.mjs +18 -2
  168. package/skills/write-spec/SKILL.md +34 -41
  169. package/skills/write-spec/references/artifact-standards.md +1 -1
  170. package/skills/write-spec/references/decision-records.md +2 -0
  171. package/skills/write-spec/references/spec-shapes.md +1 -1
  172. package/capabilities/context-virtualization/SKILL.md +0 -103
  173. package/capabilities/conversation-history/SKILL.md +0 -53
  174. package/hooks/tests/check-host-adapters.test.mjs +0 -82
  175. package/hooks/tests/check-runtime-context-hook.sh +0 -212
  176. package/pi-extension/dist/cognitive-routing-v2/runtime.js +0 -2181
  177. package/pi-extension/dist/context-virtualization/commands.js +0 -89
  178. package/pi-extension/dist/context-virtualization/projector.js +0 -42
  179. package/pi-extension/dist/context-virtualization/runtime.js +0 -378
  180. package/pi-extension/dist/context-virtualization/state.js +0 -57
  181. package/pi-extension/dist/context-virtualization/types.js +0 -10
  182. package/pi-extension/dist/conversation-history/passages.js +0 -66
  183. package/pi-extension/dist/conversation-history/ranking.js +0 -105
  184. package/pi-extension/dist/conversation-history/runtime.js +0 -226
  185. package/pi-extension/dist/conversation-history/search.js +0 -56
  186. package/pi-extension/dist/conversation-history/types.js +0 -1
  187. package/pi-extension/dist/freeflow-context/resolver.js +0 -120
  188. package/pi-extension/dist/freeflow-context/runtime.js +0 -80
  189. package/pi-extension/dist/freeflow-context/source-projector.js +0 -95
  190. package/pi-extension/dist/freeflow-context/tool.js +0 -314
  191. package/pi-extension/dist/freeflow-context/types.js +0 -12
  192. package/pi-extension/dist/freeflow-context/visibility.js +0 -28
  193. package/pi-extension/dist/integrations/mcp-config.js +0 -29
  194. package/pi-extension/dist/runtime/runtime-context.js +0 -754
  195. package/pi-extension/dist/runtime/runtime-identity.js +0 -5
  196. package/pi-extension/dist/session-sources/provenance.js +0 -32
  197. package/pi-extension/dist/ui/text-component.js +0 -57
  198. package/pi-extension/src/cognitive-routing-v2/budget.ts +0 -42
  199. package/pi-extension/src/cognitive-routing-v2/config.ts +0 -173
  200. package/pi-extension/src/cognitive-routing-v2/projection.ts +0 -375
  201. package/pi-extension/src/cognitive-routing-v2/render.ts +0 -277
  202. package/pi-extension/src/cognitive-routing-v2/runtime.ts +0 -2241
  203. package/pi-extension/src/cognitive-routing-v2/schemas.ts +0 -180
  204. package/pi-extension/src/cognitive-routing-v2/state.ts +0 -839
  205. package/pi-extension/src/cognitive-routing-v2/tools.ts +0 -62
  206. package/pi-extension/src/cognitive-routing-v2/types.ts +0 -254
  207. package/pi-extension/src/context-virtualization/commands.ts +0 -111
  208. package/pi-extension/src/context-virtualization/projector.ts +0 -62
  209. package/pi-extension/src/context-virtualization/runtime.ts +0 -428
  210. package/pi-extension/src/context-virtualization/state.ts +0 -79
  211. package/pi-extension/src/context-virtualization/types.ts +0 -92
  212. package/pi-extension/src/conversation-history/passages.ts +0 -81
  213. package/pi-extension/src/conversation-history/ranking.ts +0 -155
  214. package/pi-extension/src/conversation-history/runtime.ts +0 -250
  215. package/pi-extension/src/conversation-history/search.ts +0 -79
  216. package/pi-extension/src/conversation-history/types.ts +0 -31
  217. package/pi-extension/src/freeflow-context/resolver.ts +0 -139
  218. package/pi-extension/src/freeflow-context/runtime.ts +0 -100
  219. package/pi-extension/src/freeflow-context/source-projector.ts +0 -106
  220. package/pi-extension/src/freeflow-context/tool.ts +0 -366
  221. package/pi-extension/src/freeflow-context/types.ts +0 -70
  222. package/pi-extension/src/freeflow-context/visibility.ts +0 -53
  223. package/pi-extension/src/index.ts +0 -390
  224. package/pi-extension/src/integrations/mcp-config.ts +0 -32
  225. package/pi-extension/src/provider-support/astra/adapter.ts +0 -108
  226. package/pi-extension/src/provider-support/astra/history.ts +0 -145
  227. package/pi-extension/src/provider-support/astra/index.ts +0 -12
  228. package/pi-extension/src/provider-support/astra/session-state.ts +0 -113
  229. package/pi-extension/src/provider-support/index.ts +0 -5
  230. package/pi-extension/src/runtime/request-history.ts +0 -243
  231. package/pi-extension/src/runtime/runtime-context.ts +0 -860
  232. package/pi-extension/src/runtime/runtime-identity.ts +0 -8
  233. package/pi-extension/src/session-sources/events.ts +0 -230
  234. package/pi-extension/src/session-sources/provenance.ts +0 -39
  235. package/pi-extension/src/session-sources/read-only-session.ts +0 -170
  236. package/pi-extension/src/session-sources/sources.ts +0 -334
  237. package/pi-extension/src/settings/settings-tui.ts +0 -501
  238. package/pi-extension/src/settings/settings-ui.ts +0 -1652
  239. package/pi-extension/src/ui/text-component.ts +0 -66
  240. package/pi-extension/tests/cache-reuse/history.test.js +0 -117
  241. package/pi-extension/tests/cache-reuse/native.test.js +0 -91
  242. package/pi-extension/tests/cache-reuse/settings.test.js +0 -211
  243. package/pi-extension/tests/cognitive-routing-v2/communication.test.js +0 -577
  244. package/pi-extension/tests/cognitive-routing-v2/compaction-input.test.js +0 -183
  245. package/pi-extension/tests/cognitive-routing-v2/delegation.test.js +0 -557
  246. package/pi-extension/tests/cognitive-routing-v2/native.test.js +0 -474
  247. package/pi-extension/tests/cognitive-routing-v2/performance.test.js +0 -87
  248. package/pi-extension/tests/cognitive-routing-v2/persistence.test.js +0 -300
  249. package/pi-extension/tests/cognitive-routing-v2/projection.test.js +0 -241
  250. package/pi-extension/tests/cognitive-routing-v2/recovery.test.js +0 -1034
  251. package/pi-extension/tests/cognitive-routing-v2/render.test.js +0 -244
  252. package/pi-extension/tests/cognitive-routing-v2/runtime.test.js +0 -423
  253. package/pi-extension/tests/cognitive-routing-v2/stabilization.test.js +0 -521
  254. package/pi-extension/tests/cognitive-routing-v2/state.test.js +0 -586
  255. package/pi-extension/tests/context-virtualization/extension.test.js +0 -775
  256. package/pi-extension/tests/context-virtualization/projector.test.js +0 -110
  257. package/pi-extension/tests/context-virtualization/runtime.test.js +0 -230
  258. package/pi-extension/tests/conversation-history/runtime.test.js +0 -98
  259. package/pi-extension/tests/conversation-history/search.test.js +0 -97
  260. package/pi-extension/tests/fixtures/pi-host.js +0 -4
  261. package/pi-extension/tests/fixtures/routing-native.js +0 -191
  262. package/pi-extension/tests/integration/mode-free-core.test.js +0 -220
  263. package/pi-extension/tests/integration/pi-extension.test.js +0 -1447
  264. package/pi-extension/tests/integration/prompt-architecture.test.js +0 -447
  265. package/pi-extension/tests/integration/unaffected-regressions.test.js +0 -478
  266. package/pi-extension/tests/provider-support/astra-boundaries.test.js +0 -75
  267. package/pi-extension/tests/provider-support/astra.test.js +0 -306
  268. package/pi-extension/tests/provider-support/cli.test.js +0 -92
  269. package/pi-extension/tests/provider-support/native.test.js +0 -183
  270. package/pi-extension/tests/settings/settings-tui.test.js +0 -243
  271. package/pi-extension/tsconfig.json +0 -16
  272. package/runtime/prompts/context-virtualization.md +0 -3
  273. package/runtime/prompts/conversation-history.md +0 -3
  274. package/skills/design-for-depth/references/software-design-philosophy.md +0 -202
  275. /package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/budget.js +0 -0
  276. /package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/render.js +0 -0
@@ -106,21 +106,36 @@ function buildSubjectSystemPrompt(options, declaredContext) {
106
106
  }
107
107
  lines.push("</available_skills>");
108
108
  }
109
- if (declaredContext.length > 0) {
110
- lines.push("", "<declared_context>");
111
- for (const entry of declaredContext) {
112
- lines.push(` <context declared-path="${escapeXml(entry.declaredPath)}">`);
113
- for (const file of entry.files) {
114
- lines.push(` <file path="${escapeXml(file.path)}">\n${file.content}</file>`);
115
- }
116
- lines.push(" </context>");
109
+ if (declaredContext.length > 0) lines.push("", renderDeclaredContext(declaredContext));
110
+ lines.push(`Current working directory: ${options.cwd}`);
111
+ return lines.join("\n");
112
+ }
113
+
114
+ function renderDeclaredContext(declaredContext) {
115
+ const lines = ["<declared_context>"];
116
+ for (const entry of declaredContext) {
117
+ lines.push(` <context declared-path="${escapeXml(entry.declaredPath)}">`);
118
+ for (const file of entry.files) {
119
+ lines.push(` <file path="${escapeXml(file.path)}">\n${file.content}</file>`);
117
120
  }
118
- lines.push("</declared_context>");
121
+ lines.push(" </context>");
119
122
  }
120
- lines.push(`Current working directory: ${options.cwd}`);
123
+ lines.push("</declared_context>");
121
124
  return lines.join("\n");
122
125
  }
123
126
 
127
+ // "isolated" replaces the host prompt with an evaluator-owned one; "host" keeps the host's own prompt
128
+ // (and anything declared extensions compose onto it) so evidence reflects the production prompt.
129
+ function beforeAgentStartHandler(promptMode, declaredContext) {
130
+ if (promptMode === "isolated") {
131
+ return (event) => ({ systemPrompt: buildSubjectSystemPrompt(event.systemPromptOptions, declaredContext) });
132
+ }
133
+ return (event) =>
134
+ declaredContext.length === 0
135
+ ? undefined
136
+ : { systemPrompt: `${event.systemPrompt}\n\n${renderDeclaredContext(declaredContext)}` };
137
+ }
138
+
124
139
  export default function registerSkillEvalGuard(pi) {
125
140
  const allowedRoots = parseStringArray(process.env.SKILL_EVAL_ALLOWED_ROOTS).map((root) => realpathSync(root));
126
141
  const writableRootValue = process.env.SKILL_EVAL_WRITABLE_ROOT;
@@ -128,10 +143,12 @@ export default function registerSkillEvalGuard(pi) {
128
143
  const writableRoot = realpathSync(writableRootValue);
129
144
  const allowedTools = new Set(parseStringArray(process.env.SKILL_EVAL_ALLOWED_TOOLS));
130
145
  const declaredContext = loadDeclaredContext(process.env.SKILL_EVAL_CONTEXT_MANIFEST);
146
+ const promptMode = process.env.SKILL_EVAL_PROMPT_MODE || "isolated";
147
+ if (promptMode !== "isolated" && promptMode !== "host") {
148
+ throw new Error(`SKILL_EVAL_PROMPT_MODE must be isolated or host: ${promptMode}`);
149
+ }
131
150
 
132
- pi.on("before_agent_start", (event) => ({
133
- systemPrompt: buildSubjectSystemPrompt(event.systemPromptOptions, declaredContext),
134
- }));
151
+ pi.on("before_agent_start", beforeAgentStartHandler(promptMode, declaredContext));
135
152
 
136
153
  pi.on("tool_call", (event, ctx) => {
137
154
  if (!allowedTools.has(event.toolName)) {
@@ -1,9 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { runEvaluation } from "./lib/runner.mjs";
4
+ import { reviewResult } from "./lib/review.mjs";
5
+ import { runTrials } from "./lib/trials.mjs";
4
6
  import { renderResult } from "./lib/view.mjs";
5
7
 
6
- const commands = new Set(["run", "view"]);
8
+ const OPTIONS = {
9
+ run: ["--group", "--variant", "--trials", "--max-cost"],
10
+ view: ["--group", "--variant"],
11
+ review: ["--group", "--model", "--thinking"],
12
+ };
7
13
  const argv = process.argv.slice(2);
8
14
  const [command] = argv;
9
15
 
@@ -12,20 +18,30 @@ function printUsage() {
12
18
  `Usage:
13
19
  skill-eval run <suite-or-group-path> [options]
14
20
  skill-eval view <result-id-or-directory> [options]
21
+ skill-eval review <result-id-or-directory> --model <provider/model> [options]
15
22
 
16
23
  Commands:
17
- run Execute selected evaluation groups
18
- view Render selected stored evidence
24
+ run Execute selected evaluation groups
25
+ view Render selected stored evidence or a trial aggregate
26
+ review Record an advisory, variant-blind model answer to each group's review questions
19
27
 
20
28
  Selectors:
21
29
  --group <id-or-position>
22
- --variant <baseline|candidate>
30
+ --variant <baseline|candidate> (run, view)
31
+
32
+ Run options:
33
+ --trials <n> Run n independent complete invocations and record an aggregate
34
+ --max-cost <total> Stop starting subjects once host-reported cost reaches the total
35
+
36
+ Review options:
37
+ --model <provider/model> Required reviewer model
38
+ --thinking <level> Optional reviewer thinking level
23
39
 
24
40
  Paths:
25
41
  Definition paths resolve from the current working directory.
26
42
  Suite group references resolve relative to the suite file.
27
43
  Results are stored under <cwd>/.skill-eval/runs/<result-id>.
28
- view accepts a stored result ID or an explicit result directory.
44
+ view accepts a stored result or aggregate ID or an explicit directory.
29
45
 
30
46
  Selection:
31
47
  No selectors choose every suite group and both variants.
@@ -34,8 +50,8 @@ Selection:
34
50
  Current run support:
35
51
  Description and explicit-body groups with prompt or ordered turns
36
52
  Working-tree or Git-backed ordered skills/context; optional fresh fixture copies
37
- Description tools: read; body tools: read, write, edit, or declared extension tools
38
- Runtime profiles: Pi or PiFlow hosts, ordered immutable extension bundles, environment overrides
53
+ Description tools: read; body tools: read, write, edit, run_command for declared commands, or declared extension tools
54
+ Runtime profiles: Pi hosts, isolated or host system prompt, ordered immutable extension bundles, environment overrides
39
55
  Deterministic reads, paths, changed paths, text, JSON, tool calls, context observations, and factual comparisons
40
56
  Ordered suites run serially and continue after isolated variant, group, or post-processing failures
41
57
  Grade-first views show compact criterion details, usage, and result-relative artifact paths
@@ -51,48 +67,112 @@ function fail(message, exitCode = 2) {
51
67
  function parseOperation(values) {
52
68
  const [target, ...options] = values;
53
69
  if (!target) throw new Error(`skill-eval ${command} requires a target`);
54
- let group = null;
55
- let variant = null;
70
+ const allowed = OPTIONS[command];
71
+ const parsed = { group: null, variant: null, trials: null, maxCost: null, model: null, thinking: null };
72
+ const keys = {
73
+ "--group": "group",
74
+ "--variant": "variant",
75
+ "--trials": "trials",
76
+ "--max-cost": "maxCost",
77
+ "--model": "model",
78
+ "--thinking": "thinking",
79
+ };
56
80
  for (let index = 0; index < options.length; index += 1) {
57
81
  const option = options[index];
58
82
  const value = options[index + 1];
59
- if (option !== "--group" && option !== "--variant") throw new Error(`Unknown option: ${option}`);
83
+ if (!allowed.includes(option)) throw new Error(`Unknown option: ${option}`);
60
84
  if (!value || value.startsWith("--")) throw new Error(`${option} requires a value`);
61
- if (option === "--group") {
62
- if (group !== null) throw new Error("--group may be supplied only once");
63
- group = value;
64
- } else {
65
- if (variant !== null) throw new Error("--variant may be supplied only once");
66
- variant = value;
67
- }
85
+ const key = keys[option];
86
+ if (parsed[key] !== null) throw new Error(`${option} may be supplied only once`);
87
+ parsed[key] = value;
68
88
  index += 1;
69
89
  }
70
- return { target, selectors: { group, variant } };
90
+ let trials = 1;
91
+ if (parsed.trials !== null) {
92
+ trials = Number(parsed.trials);
93
+ if (!/^\d+$/.test(parsed.trials) || trials < 1) throw new Error("--trials must be a positive integer");
94
+ }
95
+ let maxCost = null;
96
+ if (parsed.maxCost !== null) {
97
+ maxCost = Number(parsed.maxCost);
98
+ if (!Number.isFinite(maxCost) || maxCost <= 0) throw new Error("--max-cost must be a positive number");
99
+ }
100
+ if (command === "review" && parsed.model === null) throw new Error("skill-eval review requires --model");
101
+ return {
102
+ target,
103
+ selectors: { group: parsed.group, variant: parsed.variant },
104
+ trials,
105
+ maxCost,
106
+ model: parsed.model,
107
+ thinking: parsed.thinking,
108
+ };
109
+ }
110
+
111
+ async function withCancellation(run) {
112
+ const controller = new AbortController();
113
+ const abort = () => controller.abort();
114
+ process.once("SIGINT", abort);
115
+ process.once("SIGTERM", abort);
116
+ try {
117
+ return await run(controller.signal);
118
+ } finally {
119
+ process.removeListener("SIGINT", abort);
120
+ process.removeListener("SIGTERM", abort);
121
+ }
122
+ }
123
+
124
+ function printResult(result) {
125
+ process.stdout.write(`Result: ${result.id}\nPath: ${result.path}\nState: ${result.state}\n`);
126
+ }
127
+
128
+ async function run(operation) {
129
+ const root = process.cwd();
130
+ await withCancellation(async (signal) => {
131
+ if (operation.trials === 1) {
132
+ const budget = operation.maxCost === null ? null : { maxCost: operation.maxCost, spent: 0, exhausted: false };
133
+ const result = await runEvaluation(operation.target, operation.selectors, { root, signal, budget });
134
+ printResult(result);
135
+ if (result.state !== "complete") process.exitCode = 1;
136
+ return;
137
+ }
138
+ const aggregate = await runTrials(operation.target, operation.selectors, {
139
+ root,
140
+ signal,
141
+ trials: operation.trials,
142
+ maxCost: operation.maxCost,
143
+ onTrial: printResult,
144
+ });
145
+ process.stdout.write(`Aggregate: ${aggregate.id}\nPath: ${aggregate.path}\nState: ${aggregate.state}\n`);
146
+ if (aggregate.state !== "complete") process.exitCode = 1;
147
+ });
148
+ }
149
+
150
+ async function review(operation) {
151
+ const outcome = await withCancellation((signal) =>
152
+ reviewResult(operation.target, operation.selectors, {
153
+ root: process.cwd(),
154
+ signal,
155
+ model: operation.model,
156
+ thinking: operation.thinking,
157
+ }),
158
+ );
159
+ for (const group of outcome.groups) {
160
+ process.stdout.write(`Review ${group.id}: ${group.state}${group.artifact ? ` (${group.artifact})` : ""}\n`);
161
+ }
162
+ if (outcome.groups.some((group) => group.state === "review-error")) process.exitCode = 1;
71
163
  }
72
164
 
73
165
  if (!command || command === "--help" || command === "-h") {
74
166
  printUsage();
75
- } else if (commands.has(command)) {
167
+ } else if (Object.hasOwn(OPTIONS, command)) {
76
168
  try {
77
169
  const operation = parseOperation(argv.slice(1));
78
170
  if (command === "view") {
79
171
  process.stdout.write(await renderResult(operation.target, operation.selectors, { root: process.cwd() }));
172
+ } else if (command === "review") {
173
+ await review(operation);
80
174
  } else {
81
- const controller = new AbortController();
82
- const abort = () => controller.abort();
83
- process.once("SIGINT", abort);
84
- process.once("SIGTERM", abort);
85
- try {
86
- const result = await runEvaluation(operation.target, operation.selectors, {
87
- root: process.cwd(),
88
- signal: controller.signal,
89
- });
90
- process.stdout.write(`Result: ${result.id}\nPath: ${result.path}\nState: ${result.state}\n`);
91
- if (result.state !== "complete") process.exitCode = 1;
92
- } finally {
93
- process.removeListener("SIGINT", abort);
94
- process.removeListener("SIGTERM", abort);
95
- }
175
+ await run(operation);
96
176
  }
97
177
  } catch (error) {
98
178
  fail(error instanceof Error ? error.message : String(error), 1);
@@ -9,8 +9,22 @@ Produce the agreed concrete result through supported preparation, bounded execut
9
9
 
10
10
  Workflow establishes the work agreement and coordinates authority, ownership, and the user-facing return boundary. Execute Work owns implementation preparation and continuation within it. Task memory belongs to Track Work; governing choices remain with the user.
11
11
 
12
+ 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.
13
+
14
+ ## Rules
15
+
16
+ - Stay inside the work agreement. An agreement to return a plan does not cover production edits. Before adopting a new requirement, scope, compatibility, persistence, evidence, or return boundary, return to [Workflow](../workflow/SKILL.md).
17
+ - Never cross a selected checkpoint or separately controlled boundary while it is due and unresolved.
18
+ - Never rewrite tests, Specs, Plans, policies, or acceptance merely to make implementation pass.
19
+ - Return undefined consequential behavior to its owner rather than encode a guess.
20
+ - When a Working Record exists, record the Current Slice through [Track Work](../track-work/SKILL.md) before its first effect.
21
+ - Never promote exploratory code into production, invent acceptance, or claim integration that was not observed.
22
+ - Build the report from inspected resulting files, assertions, and outputs, not from requested changes phrased as accomplishments. Do not add cleanup, documentation, migration, deprecation, commit, push, integration, release, or launch merely because it would be useful.
23
+
12
24
  ## Establish The Execution Basis
13
25
 
26
+ Goal: before any effect, you know which assignment applies, what it requires, and how its result will be checked.
27
+
14
28
  Consume the current request, accepted discussion, governing artifacts, and relevant live state. Establish which assignment and stopping condition currently apply; do not combine older directions with a superseding contract. Resolve material ambiguity before dependent effects. Do not restart discovery because execution was selected.
15
29
 
16
30
  Before production changes, establish:
@@ -20,22 +34,26 @@ Before production changes, establish:
20
34
  - **Evidence:** a check or observation capable of disagreeing with the result.
21
35
  - **Agreement:** covered effects, extent of work, and when to return to the user.
22
36
 
23
- Before effects, check whether a selected checkpoint or separately controlled boundary is already due. Do not cross it while unresolved.
37
+ Before effects, check whether a selected checkpoint or separately controlled boundary is already due.
24
38
 
25
39
  If the agreement is materially unclear, return to [Workflow](../workflow/SKILL.md) before the unsettled execution. A clear request may already establish it; do not ask again merely to perform a ritual.
26
40
 
27
- An agreement to fix a bug can cover investigation before the remedy is known. An agreement to return a plan does not cover production edits. Distinguish evidence gathering from implementation even when both are authorized.
41
+ An agreement to fix a bug can cover investigation before the remedy is known. Distinguish evidence gathering from implementation even when both are authorized.
28
42
 
29
43
  Use [Discuss](../discuss/SKILL.md) when outcome or material approach alternatives need reconsideration, [Decision Gate](../decision-gate/SKILL.md) for one blocking user-owned choice or source conflict, and [Diagnose Failure](../diagnose-failure/SKILL.md) when the cause is unsupported.
30
44
 
31
45
  ## Gather Enough Context For This Unit
32
46
 
33
- Choose the next coherent result, then identify what is missing to implement and check it. Reuse current supported sources; inspect only the live boundaries whose freshness matters.
47
+ Goal: implementation starts from understanding, not from guesses, without researching more than the work needs.
48
+
49
+ Start from the route and context prepared before execution ([Workflow](../workflow/SKILL.md)); gather here only what the route could not predict. Choose the next coherent result, then identify what is missing to implement and check it. Reuse current supported sources; inspect only the live boundaries whose freshness matters.
34
50
 
35
51
  Find the relevant mechanism, callers, contracts, and observing seam before changing them. Do not begin substantial implementation from a guessed API, ownership boundary, or failure cause. Do not read every file or settle every later Slice merely to avoid all uncertainty.
36
52
 
37
53
  Readiness means you can explain what will change, why it should produce the accepted result, and how the result will be checked. It does not require knowing every line or helper in advance. If an unfamiliar fixture or observing stage could invalidate substantial dependent work, establish that observer first through a bounded investigation. Reuse adequate fixtures; do not make a separate prototype mandatory.
38
54
 
55
+ For substantial dependent work, make a compact, usually internal forecast of the known changes that belong together, their supported order, and the earliest observation that could invalidate further work. Keep outcome-dependent steps conditional, and proceed with settled work without replanning after routine tool calls. When material feedback changes the basis, revise only the affected part while preserving the accepted outcome. Skip the forecast for straightforward local work; do not enumerate future tool calls.
56
+
39
57
  Before substantial implementation, read [Design for Depth](../design-for-depth/SKILL.md) and use its Implementation Decisions method when unresolved representation, identity, ownership, algorithm, or failure choices could invalidate significant dependent work. Reuse applicable design decisions already supplied; distinguish required constraints, suggested mechanisms, and local freedom. A reference to a design is not enough when its relevant content is unavailable. Resolve the consequential unknown, not every future coding detail.
40
58
 
41
59
  Use [Action Selection](../action-selection/SKILL.md) when choosing the next source, observer, or effect is uncertain, broad, or repetitive. Stop gathering when the current unit is sufficiently supported. A mechanical read of a known caller or signature can remain inside execution; discovering an invalidated mechanism requires re-entry before dependent edits.
@@ -44,16 +62,20 @@ When specialized guidance is needed, read [Domain Skill Composition](../workflow
44
62
 
45
63
  ## Keep The Unit Coherent
46
64
 
65
+ Goal: each unit of work produces one checkable result with a manageable working set.
66
+
47
67
  A bounded action produces one useful execution or learning result with a checkable claim. It may contain several files, tools, edits, and checks. Do not fragment it by command, file, test, or method change.
48
68
 
49
69
  Choose work that can be understood, executed, checked, and corrected with a manageable working set. Split when dependencies, uncertainty, or distinct outcomes make one attempt unreliable; retain enough understanding of later constraints to avoid an obvious dead end.
50
70
 
51
- When a Working Record exists, use [Track Work](../track-work/SKILL.md) for recovery and write-ahead Current Slice state before Slice execution. Preserve useful provisional remaining work and dependencies through its existing fields. Do not create memory for a short direct result merely because execution began.
71
+ When a Working Record exists, use Track Work for recovery and write-ahead Slice state. Preserve useful provisional remaining work and dependencies through its existing fields. At meaningful boundaries, record results with an identity, such as a commit SHA or document version, in the Slice's Material updates, and add Recovery sources as the work reveals what a resume would need. Do not create memory for a short direct result merely because execution began.
52
72
 
53
73
  Read [Execute Work Edges](references/execute-work-edges.md) when resuming uncertain prior work, changing a Slice boundary, reaching a selected checkpoint, or exposing separately controlled follow-on work.
54
74
 
55
75
  ## Execute Through One Suitable Method
56
76
 
77
+ Goal: the accepted result, produced by the simplest method that fits, with accepted behavior intact.
78
+
57
79
  Implement the supported approach directly when the outcome and mechanism are understood. Unfamiliar work may need preparation first; it does not automatically require a separate prototype or a test-first implementation sequence.
58
80
 
59
81
  Use one primary method at a time:
@@ -63,24 +85,28 @@ Use one primary method at a time:
63
85
  - specialized domain guidance when the environment or risk needs it;
64
86
  - a bounded learning action when an empirical uncertainty must be resolved before production work.
65
87
 
66
- Preserve accepted behavior, failure semantics, repository conventions, and source truth. Do not rewrite tests, Specs, Plans, policies, or acceptance merely to make implementation pass.
88
+ Preserve accepted behavior, failure semantics, repository conventions, and source truth.
67
89
 
68
- Allow local choices of helpers, editing order, and focused checks while the agreed result and effects remain unchanged. Handle edge cases required by accepted behavior, direct evidence, or material safety; return undefined consequential behavior rather than encode a guess.
90
+ Allow local choices of helpers, editing order, and focused checks while the agreed result and effects remain unchanged. Handle edge cases required by accepted behavior, direct evidence, or material safety.
69
91
 
70
92
  For an unfamiliar design boundary that could invalidate later work, establish its first coherent implementation and distinguishing observation before dependent expansion. Compare the actual ownership, identity, ordering, and failure behavior with the selected design—not merely its proposed filenames. Preserve accepted predicates when a sketch proves wrong; stop dependent effects and resolve the affected mechanism through the current owner. Supported local improvements need no automatic handback or separate review.
71
93
 
72
94
  ## Execute A Bounded Learning Action
73
95
 
96
+ Goal: answer the declared question with the least building that can answer it.
97
+
74
98
  Consume the declared question, observer, permitted effects, expected evidence, and return condition. If they are insufficient for safe execution, establish the missing basis through the requesting owner before acting. Do not assume Discuss was previously used or repeat framing that is already adequate.
75
99
 
76
100
  Build and run only what the observation needs. Correct an understood local observer defect within scope. Before adding scaffolding or a dependency, check whether it serves the current observation or implements a future product. Return before materially expanding effects or pursuing a different question.
77
101
 
78
102
  Stop when the question is answered or the observing limit is reached. Report support, contradiction, inconclusive evidence, or unavailable evidence honestly; do not keep polishing the prototype to manufacture a favorable result.
79
103
 
80
- Return evidence, limits, exploratory artifacts, and residual effects to the owner that asked the question, following the agreed artifact disposition. Do not silently promote exploratory code into production, invent acceptance, or claim unobserved integration. The receiving owner assesses what the finding changes and which next action is supported and authorized.
104
+ Return evidence, limits, exploratory artifacts, and residual effects to the owner that asked the question, following the agreed artifact disposition. The receiving owner assesses what the finding changes and which next action is supported and authorized.
81
105
 
82
106
  ## Re-enter When The Basis Changes
83
107
 
108
+ Goal: stop building on a basis that no longer holds, and return only as far as the change requires.
109
+
84
110
  Do not continue merely because implementation has begun.
85
111
 
86
112
  - Clear local defect and supported remedy -> correct within the same action.
@@ -97,6 +123,8 @@ Preserve unaffected changes and contradictory evidence. An optional improvement
97
123
 
98
124
  ## Verify And Self-Review The Result
99
125
 
126
+ Goal: the result is supported by evidence at the boundary where it will be used, and judged suitable before it is accepted.
127
+
100
128
  Check at the boundary where a result will be accepted or used—not after every edit or command.
101
129
 
102
130
  1. Run the covered focused checks through the actual behavior or artifact boundary.
@@ -109,14 +137,18 @@ A green check proves only its exercised assertions; a source read does not prove
109
137
 
110
138
  Independent review is separately selected. A self-review finding does not require a reviewer, and a reviewer suggestion does not authorize another change.
111
139
 
140
+ If the result makes existing documentation say something no longer true, such as a user guide, a subsystem doc, or a folder README, correcting it is part of this work: use [Write Docs](../write-docs/SKILL.md). New documentation still needs a request.
141
+
112
142
  ## Continue Or Return
113
143
 
144
+ Goal: covered work continues without unnecessary stops, and the report describes exactly what exists.
145
+
114
146
  Continue within the Slice while the next action serves the same outcome, remains covered, and can still be checked coherently. A method change, correction, or verification run does not create or close a Slice.
115
147
 
116
148
  When durable memory exists, preserve only material changes to understanding, dependencies, scope, evidence, blockers, and the next useful action. Before context loss, record truthful partial state rather than rushing to completion. Resume only after required reconstruction and relevant live-state reconciliation.
117
149
 
118
150
  Return to Workflow when a distinct Slice is ready, a selected checkpoint is due, the agreement changes, or no useful covered continuation remains. Workflow can select another already-authorized Slice without asking the user again. Internal method returns and delegation handbacks are not the user-facing endpoint.
119
151
 
120
- Stop at the agreed return condition or an uncovered consequential boundary. Do not add cleanup, documentation, migration, deprecation, commit, push, integration, release, or launch merely because it would be useful.
152
+ Stop at the agreed return condition or an uncovered consequential boundary.
121
153
 
122
- Construct the report from inspected resulting files, assertions, and outputs—not requested changes phrased as accomplishments. Distinguish implemented, checked, and still unsupported properties. Account for relevant edits after the checks; do not pair a fresh pass with superseded code or test captures. Reuse applicable evidence and report missing bodies or cases explicitly. A completed action is not automatically a completed Slice, task, or delivery.
154
+ Distinguish implemented, checked, and still unsupported properties. Account for relevant edits after the checks; do not pair a fresh pass with superseded code or test captures. Reuse applicable evidence and report missing bodies or cases explicitly. A completed action is not automatically a completed Slice, task, or delivery.
@@ -2,6 +2,8 @@
2
2
 
3
3
  Read this before a bounded action writes or changes code. Follow the repository's language, style, testing, and documentation conventions before generic advice.
4
4
 
5
+ This reference is judgment: adapt it to the work. Its binding statements restate [Execute Work](../SKILL.md) or Workflow Rules.
6
+
5
7
  ## Make Intent Legible
6
8
 
7
9
  - Use names that express domain meaning rather than implementation trivia.
@@ -2,6 +2,8 @@
2
2
 
3
3
  Read this when execution resumes from uncertain prior state, changes the Slice boundary, reaches a selected checkpoint, or exposes separately controlled follow-on work.
4
4
 
5
+ This reference is judgment: adapt it to the work. Its binding statements restate [Execute Work](../SKILL.md) or Workflow Rules.
6
+
5
7
  The main skill owns the normal bounded-action loop. This reference covers transitions that leave, resume, or constrain that loop.
6
8
 
7
9
  ## Resume Safely
@@ -48,7 +50,15 @@ Stop before dependent work, use the checkpoint’s owner, and return its result
48
50
  - [Handoff](../../handoff/SKILL.md) for selected continuity transfer;
49
51
  - [Finish Branch](../../finish-branch/SKILL.md), [Release Work](../../release-work/SKILL.md), or [Launch Work](../../launch-work/SKILL.md) for their separately authorized boundaries.
50
52
 
51
- When durable memory exists, Track Work preserves the checkpoint’s selection, condition, result, and task effect.
53
+ When durable memory exists, Track Work preserves the checkpoint’s selection, condition, result, and task effect. Its Checkpoint types map to these owners:
54
+
55
+ | Type | Owner |
56
+ | --- | --- |
57
+ | `preserve` | Commit Work |
58
+ | `publish` | Commit Work for a simple push; otherwise Finish Branch or Release Work |
59
+ | `review` | Review Work or Review Artifact |
60
+ | `decision` | Decision Gate |
61
+ | `continuity` | Handoff |
52
62
 
53
63
  Do not create a checkpoint merely because an action or Slice ended. Do not force a stale checkpoint when its condition, evidence, or protected boundary no longer holds; return the discrepancy for a supported cancellation, replacement, deferral, or revision before dependent work.
54
64
 
@@ -65,7 +65,7 @@ If safe transfer would require inventing intent, approval, evidence, status, or
65
65
 
66
66
  Follow current core and capability recovery guidance before task action. A handoff's earlier route or profile description is not current runtime state.
67
67
 
68
- 1. Read the complete Working Record through `view full` when resuming after context loss or into another context. Do not substitute its `resume` view or the handoff's summary. With intact context, follow Track Work's bounded in-session read guidance.
68
+ 1. Read the complete Working Record through `view full` when resuming after context loss or into another context, then the artifacts listed under its `What defines this task` and its Recovery sources. Do not substitute its `resume` view or the handoff's summary. With intact context, follow Track Work's bounded in-session read guidance.
69
69
  2. Reconcile the record and handoff with current user direction, defining sources, and the relevant live environment. Follow supersession and corrections without silently reviving historical decisions.
70
70
  3. Check important completion, verification, review, commit, and artifact-identity claims against their evidence before repeating them. Reuse adequate current evidence; a transfer alone does not require rerunning every check.
71
71
  4. Establish the actual partial state, remaining dependencies, accepted work agreement, current assignment, and next useful action. Resolve contradictory old/new instructions from their sources before acting; do not resume editing when the current unit permits inspection only. Reopen only additional sources whose exact content or freshness changes that action.
@@ -140,7 +140,7 @@ Do not copy full reviewer output when a stable pointer exists. A new context or
140
140
 
141
141
  ## Resume Checklist
142
142
 
143
- - After context loss or transfer into another context, read the complete Working Record through `view full` when one exists. A summary or `resume` projection is not a substitute. Use Track Work's bounded reads for intact-session continuation.
143
+ - After context loss or transfer into another context, read the complete Working Record through `view full` when one exists, then its defining artifacts and Recovery sources. A summary or `resume` projection is not a substitute. Use Track Work's bounded reads for intact-session continuation.
144
144
  - Reconcile the record and handoff with current user direction and relevant live state; reopen named source truth where exact meaning or freshness matters.
145
145
  - Confirm artifact, environment, commit, and configuration identity where claims depend on them.
146
146
  - Check important completion and evidence claims before repeating them; distinguish that a run occurred from whether it applies to the current candidate. Reuse adequate evidence rather than rerun every check merely because a transfer occurred.