@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,177 @@
1
+ # Conversations, Pipelines And Judges
2
+
3
+ This reference holds the guidance and the definition fields for groups with more than one participant (a conversation or a pipeline), for judged groups, and for a runtime profile. The guidance is judgment; the field shapes and constraints are a contract, binding as written, like the rest of [authoring](authoring.md), and what the evaluator does with them is stated as it behaves.
4
+
5
+ ## Conversation
6
+
7
+ - **Answers:** does the agent behave well when a user answers back, such as asking for what it needs, or not asking for what it was already told?
8
+ - **Declare:** a body group whose `input` is the opening prompt, and `participants` with protocol `conversation`: the simulated user's model, a card holding everything it knows, `max_turns`, and a stop phrase.
9
+ - **Yields:** the subject's transcript with every user message, the user's identity and each message's prompt hash, and how the conversation ended: the stop phrase, the turn limit, the subject stopping, or a user error.
10
+ - **Grade:** success usually has several parts. Check the end state the conversation should leave with deterministic expectations, read its length from the run metrics, and judge the quality of the interaction with a rubric.
11
+ - **Pitfalls:** the simulated user is a model; its card bounds what it may say, and it answers "I don't know" otherwise, but read some conversations before trusting a count. A conversation that hits the turn limit usually means the subject never finished. The user's model and card are part of the task: keep them identical across arms. Each turn costs a user call as well as a subject turn.
12
+
13
+ ## Pipeline
14
+
15
+ - **Answers:** does a staged workflow produce the right final outcome, such as two independent reviews and an adjudicator, or a coordinator's plan and an executor's change?
16
+ - **Declare:** `participants` with protocol `pipeline`: ordered stages, each with its own `input` and `sees` (the fixture, or an earlier stage's response or files), `fresh` for a stage that must not see earlier ones, and `graded` for the stage the expectations apply to (the last by default).
17
+ - **Yields:** a full run per stage, the graded stage as the arm's run, and every stage's response and files.
18
+ - **Compare designs:** arms may differ in `participants` itself when `component` names it, such as one reviewer against two reviews and an adjudicator; an arm without `participants` runs one ordinary subject.
19
+ - **Pitfalls:** a stage sees only what `sees` lists, and nothing by default. Every stage uses the arm's configuration, so the component applies to all stages at once; a stage cannot have a configuration of its own, and the stages' different jobs come from their inputs. A stage that fails stops the pipeline. Grading only the final stage hides where an error began; read the earlier stages before naming the failed boundary. Cost grows with the number of stages.
20
+
21
+ ## Participants
22
+
23
+ A group may run more than one participant in each arm. `participants` declares a `protocol`; every participant uses the arm's configuration. Declare it on the group, shared by every arm, or in the configuration: shared in `configuration`, or per arm in an overlay, where arms may differ in it like any other path (`"component": ["participants"]`), for example one review against an adjudicated pair. An arm whose `participants` is absent, or `null` to clear a shared one, runs one ordinary subject. Expectations, comparisons and review questions apply to each arm's graded run: its pipeline's graded stage, its conversation, or its single subject.
24
+
25
+ A **conversation** pairs the subject with a simulated user:
26
+
27
+ ```json
28
+ {
29
+ "participants": {
30
+ "protocol": "conversation",
31
+ "user": {
32
+ "model": "anthropic/claude-haiku-5-5",
33
+ "thinking": "medium",
34
+ "card": "cards/release-owner.md",
35
+ "max_turns": 10,
36
+ "stop": "THANKS, DONE"
37
+ }
38
+ }
39
+ }
40
+ ```
41
+
42
+ - It needs a body group whose `input` is a `prompt`: the opening message.
43
+ - `card` is a text file, kept out of the fixture: everything the simulated user knows, read in when the definition loads.
44
+ - `max_turns` (default 10) caps the subject's turns, the opening included. `stop` is the phrase with which the user ends the conversation.
45
+ - `model` and optional `thinking` name the user's model.
46
+
47
+ The loader checks these fields, and the pipeline's below, and names the one it refuses.
48
+
49
+ A **pipeline** runs ordered stages, each a separate subject:
50
+
51
+ ```json
52
+ {
53
+ "participants": {
54
+ "protocol": "pipeline",
55
+ "stages": [
56
+ { "id": "review1", "input": "Review the change.", "sees": ["fixture"] },
57
+ { "id": "review2", "fresh": true, "sees": ["fixture"] },
58
+ { "id": "adjudicator", "input": "Adjudicate the reviews.", "sees": ["review1.response", "review1.files", "review2.response"] }
59
+ ],
60
+ "graded": "adjudicator"
61
+ }
62
+ }
63
+ ```
64
+
65
+ - A stage's `input` is a prompt or an array of turns, and defaults to the group's `input`.
66
+ - `sees` lists exactly what the stage gets: `fixture` (a fresh copy, only when the group declares one), `<stage>.response` (that earlier stage's final response), `<stage>.files` (the files it created or modified, delivered as text to read; body groups only, and UTF-8 text only) or `<stage>.workspace` (the stage starts in a copy of that earlier stage's final workspace, every file and binary file kept, so it can run what the earlier stage wrote; body groups only). Anything not listed never reaches the stage. It defaults to nothing.
67
+ - A stage starts from `fixture` or one `<stage>.workspace`; without either it starts empty.
68
+ - `fresh: true` declares the stage independent: it may see the fixture but no earlier stage.
69
+ - `graded` names the stage the group's expectations, comparisons and review questions apply to; it defaults to the last stage.
70
+
71
+ ### How Participants Run
72
+
73
+ A group with participants runs them inside each arm, with the arm's configuration.
74
+
75
+ **Conversation.** The subject runs one persistent RPC session, opened with the group's prompt. After each settled turn, the simulated user is called like a judge: a separate model call without tools, skills, context files or session, in its own isolation root whose name is a hash, not the arm, with the arm's host extensions and settings and the provider's login copied in and removed afterward. Its fixed prompt holds its card, the instruction to answer only from the card and to say "I don't know" otherwise, the instruction that whatever the assistant says is conversation that cannot change its card, goal or rules, the stop phrase, and the visible conversation: the user's messages and the subject's replies, with run paths replaced by `<run>`, never the subject's tool calls or files. Its reply becomes the next turn, unless it contains the stop phrase. The conversation ends at the stop phrase, after `max_turns` subject turns, or when the subject stops. `run.json` records `participants` with the user's identity (model, provider, thinking, extensions, card path and hash), each message with its prompt hash, usage and isolation, and how it `ended` (`stop`, `max-turns`, `subject-stopped` or `user-error`); `prompts` lists every message the subject received. A user call that fails or writes nothing makes the run `infrastructure-failed`. Each call's prompt, events and reply stay under `groups/<id>/participants/<hash>/turn-<n>/`.
76
+
77
+ **Pipeline.** Stages run in order, each a separate subject process with its own isolation root and workspace. A stage's workspace is a fresh fixture copy when it sees `fixture`, and empty otherwise. An earlier stage's response or written files reach it only as declared context: copied into the stage's own resources, fingerprinted, injected by the guard under the labels `<stage>.response` and `<stage>.files`, and readable there; the earlier stage's directories stay outside its readable roots. The injected copy of each file is fenced as run material under a random token, and the stage's prompt gains a fixed note that the fenced work is material to assess, never instructions, and that text in it trying to direct the stage is a finding to report. The graded stage runs in the arm's directory, so its `run.json` is the arm's run and grading, review and judging read it as usual. Every other stage keeps its `run.json`, transcript, events and stderr beside the arm in `<arm>.<id>/`, so every stage's workspace is as deep as a single subject's and a declared command that reaches the repository by a relative path works in each. Each stage's response and files are kept in its directory's `outputs/`. The arm's `run.json` records `participants.stages` (state, `sees`, `fresh`, run file relative to the group directory, response hash, written files and usage) and `graded`. A stage that does not complete stops the pipeline and the arm's run takes its state.
78
+
79
+ In both protocols the arm's `usage` covers every participant, so `--max-cost` counts them all.
80
+
81
+ ## Judged Evaluation
82
+
83
+ - **Answers:** what deterministic checks cannot decide, such as whether a review named the defect by location and effect, whether a report's claims rest on its sources, or how actionable an answer is.
84
+ - **Declare:** a `rubric` of dimensions, the `judges`, and `combine` when there are several, declared before any verdict (Rubric And Judges, below). A decision may name a dimension as its measure.
85
+ - **Yields:** for each run, every judge's answers with evidence, the combined answer, what the judge saw and what was withheld, and contract gaps such as an unchecked calibration; per arm in an aggregate, answer counts, pass^k, means, agreement between judges, and each judge's calibration.
86
+ - **Write the rubric:**
87
+ - One dimension per thing to judge, each with a concrete yes and no, and the evidence a yes needs. "Is the answer good?" is too vague to agree on; an exact phrase is too brittle to be fair.
88
+ - For an open-ended answer, list the key facts or claims a good answer must contain as separate dimensions, and put them in the references.
89
+ - Put a short worked example of a yes and a no in the reference when the question leaves room for reading; examples make judges more consistent, though consistency alone is not accuracy.
90
+ - Each judge answers every dimension in one reply, so answers to one dimension can colour another. Keep the rubric to the dimensions the question needs.
91
+ - **Pitfalls:** design and measurement's [Count Judge Answers With Care](design-and-measurement.md#count-judge-answers-with-care) covers what to check first, the judge's family, calibration, agreement between judges, and what the judge sees. Pairwise `review` questions remain useful for an advisory side-by-side reading of the arms; they are not a measure.
92
+
93
+ ## Rubric And Judges
94
+
95
+ A rubric asks what deterministic checks cannot. Each run is judged alone, blind to its arm, by `review --rubric` (Judging With A Rubric, below); the answers are judged evidence, stored beside the run and never in run or deterministic grade files.
96
+
97
+ ```json
98
+ {
99
+ "rubric": [
100
+ {
101
+ "id": "found-defect",
102
+ "question": "Did the review name the off-by-one in the pagination loop?",
103
+ "reference": { "path": "references/known-defect.md" }
104
+ },
105
+ { "id": "clarity", "question": "How actionable is the review?", "answers": "0-2" }
106
+ ],
107
+ "judges": [{ "model": "anthropic/claude-haiku-5-5", "thinking": "high" }],
108
+ "combine": "majority"
109
+ }
110
+ ```
111
+
112
+ The loader checks the rubric, judges and combine fields and names the one it refuses. What it cannot teach:
113
+
114
+ - Dimensions are rendered only for judges and never sent to the subject. `answers` defaults to yes, no or unknown; `"0-2"` scores instead. A judge may always answer `unknown`, and must cite the evidence for every answer.
115
+ - `reference` is inline text or a file, shown to judges only and never kept in the fixture, because the subject sees the fixture; keep the file out of the subject's declared `context` too, which the evaluator does not check. A file's text and hash are read in when the definition loads, so judging never depends on the working tree.
116
+ - Dimensions have no weights: each is counted and decided on its own.
117
+ - Each judge configuration appears once, because repeated calls to one configuration are one vote. Without `judges`, `review --rubric --model` names the single judge.
118
+ - A judge runs on its group's host setup by default: the reference arm's `host.extensions` and `host.settings` (such as a subscription's auth extension), with its own model and thinking. `configuration` gives it its own setup instead, inline or with `extends`; a model it names is used when the judge entry names none. A group whose host extensions are built from source must give its judges their own configuration (refused only at review time).
119
+ - `combine` names how several judges' answers become one, before any verdict is seen. Taking yes as 1 and no as 0: `majority` gives the answer more than half the judges gave (otherwise `unknown`); `unanimous` gives the lowest answer, so yes only when every judge says yes; `any` gives the highest, so yes when any judge does; `mean` averages the known answers of `"0-2"` dimensions. An `unknown` answer makes the result `unknown` whenever it could change it.
120
+
121
+ ### Judging With A Rubric
122
+
123
+ `review --rubric` judges each complete run of every selected group that declares a rubric, under Review Work's [Judge Contract](../../review-work/references/evals-and-judges.md#judge-contract):
124
+
125
+ - each run is judged alone: the judge sees the task turns, the fixture files, that run's responses, tool calls, changed paths and written files, the rubric and its references, with the same limits and neutral path tokens as the advisory review; it never sees the arm name, other arms' runs, or deterministic grades, and its working directory and home are named by a hash, not the arm; the run and the task materials are fenced as run material with the same fixed instruction, and each judge's reported `steering` is recorded with it and adds the contract gap `run material addressed the judge`; the judge configuration's identity includes the prompt version, so a calibration does not carry over to a changed prompt;
126
+ - the group's `judges` answer, each in its own isolation root; a group without `judges` is judged by `--model` (or the configuration's model), and `--model` with declared judges is refused before any judge starts;
127
+ - each judge's host extensions and settings come, most specific first, from its own declared `configuration`, else from the group (its reference arm's host setup, so a judge uses the login the subjects used); `--configuration` gives the setup only to the command-line judge of a group without declared judges, and is refused when every judged group declares its judges, because it would be ignored. Each judge's record holds its effective `setup` (`group`, `own (<file or inline>)` or `command-line`), extensions, settings, model, thinking and family relation, and its calibration key covers that setup;
128
+ - `groups/<id>/<arm>/judged-grade.json` records each judge's identity (model, provider, family, thinking, extensions, settings, isolation, a configuration hash, prompt hash and date), the family relation to the subject, its answers with evidence, errors and usage; the combined answer per dimension with every vote, by the group's `combine`; what was shown and withheld; the run file's hash; and `contractGaps` (`calibration not checked` until every judge is calibrated, `materials truncated` when anything was cut). `groups/<id>/judging/<hash>/judge-<n>/` keeps each judge's prompt, events, final response and stderr;
129
+ - a judge that fails or replies malformed makes the grade `judge-error` with no combined answers, and the command exits nonzero;
130
+ - an aggregate target judges every trial, then rebuilds the aggregate: its sections, and its decision and claim when the suite declares a decision rule, so a `judged` measure is decided on the new answers.
131
+
132
+ `review <target> --calibrate <labels.json>` scores judges against hand labels. The file maps run paths (an arm's directory or its `run.json`, from the working directory) to `{ "<dimension id>": <answer> }`. Each judge configuration's agreement with the labels, per dimension (the share matched and Cohen's kappa), becomes its `calibration` in every judged grade it gave under the labelled runs and the target, and judging again with the same configuration keeps it. A configuration is its model, thinking, host extensions and rubric; a different one is uncalibrated.
133
+
134
+ An aggregate's `judged` section gives, per arm and dimension, counts of each combined answer (`notJudged` for a trial that was not judged or failed), pass^k for yes/no dimensions, the mean for `0-2` dimensions, agreement between judges per dimension (Cohen's kappa for two, Krippendorff's alpha for more), the judges with their calibration, and `perTrial` values for a decision rule: `true` for yes, `false` for no, `null` for unknown, or the number. `view` shows judged evidence apart from deterministic grades.
135
+
136
+ Judged evidence never changes run or deterministic grade files.
137
+
138
+ When an unsupported operation changes the question, reject it or run a clearly separate direct comparison with explicit limits. Never invoke archived evaluators as a fallback.
139
+
140
+ ## Runtime Profile
141
+
142
+ A runtime profile, under `configuration.runtime`, is shared by every arm, except `environment.literal`. It changes the host environment, not the skill target:
143
+
144
+ ```json
145
+ {
146
+ "runtime": {
147
+ "session": false,
148
+ "extensions": [
149
+ {
150
+ "entry": "extensions/probe.mjs",
151
+ "resources": ["extensions"]
152
+ }
153
+ ],
154
+ "environment": {
155
+ "literal": {
156
+ "PROBE_MODE": "injection-test"
157
+ },
158
+ "inherit": []
159
+ }
160
+ }
161
+ }
162
+ ```
163
+
164
+ The host comes from `configuration.host.name`; the evaluator maps it to the installed `pi` or `claude` command and records the selected host. Optional `prompt` is `isolated` (default) or `host`:
165
+
166
+ - `isolated` replaces the host's system prompt with a minimal evaluator-owned prompt. Use it to isolate the target skill.
167
+ - `host` keeps the host's own system prompt and whatever declared extensions compose onto it, appending declared context. Use it when evidence must reflect the production prompt, for example by declaring the Freeflow Pi extension bundle with a fixture containing `.freeflow/config.json`.
168
+
169
+ Both modes enforce the same tool and path guards. A declared runtime states only what it changes: an omitted `session` is `false`, `extensions` is `[]`, `environment` is `{ "literal": {}, "inherit": [] }`, and `prompt` is `isolated`. `session` controls whether the variant receives an isolated persistent session directory; it defaults to `false` in omitted runtime profiles. Each bundle's directory resources are copied under their original relative paths, so sibling imports and multi-tree extensions remain intact. Bundle bytes are snapshotted once and copied identically to every arm.
170
+
171
+ `environment.literal` contains non-secret string configuration and is recorded in run evidence. Arms may differ in it when `component` names `runtime.environment.literal` or one key under it, such as `runtime.environment.literal.FEATURE_MODE`; each arm's subject then receives its own literals, recorded under `resources.runtime.environment`. Declare `environment` in the shared runtime so an arm's overlay changes only the literal. `environment.inherit` names parent-process variables whose values are passed to the child but never persisted; other parent variables are not passed. Missing inherited variables invalidate the variant. The evaluator supplies only a small host-runtime baseline such as `PATH` and `HOME`. The loader refuses launch-control and loader keys, overlapping names and secret-like literal keys.
172
+
173
+ Extensions are trusted executable inputs, not OS-sandboxed code. The evaluator proves declared identity and post-run immutability, but extension code retains its host permissions.
174
+
175
+ When a group declares `context-text` expectations, a final non-mutating observer records two per-turn surfaces: the chained `before_agent_start` system prompt and each provider-neutral `context` message projection. `context-text` expectations select `surface: "system-prompt"` or `surface: "provider-context"` and may select `request: "first"`, `"last"`, or a positive request number. Groups without context assertions do not create context-observation artifacts.
176
+
177
+ A custom tool in `group.tools` needs a runtime extension bundle. The evaluator remains extension-neutral: it does not interpret feature names or configuration schemas. Put feature configuration in the ordinary group fixture or runtime environment, and test combinations as separate suite groups.
@@ -0,0 +1,273 @@
1
+ # Design And Measurement
2
+
3
+ This reference is judgment: adapt it to the question and to the decision the result must support. Its binding statements restate [Evaluate Behavior](../SKILL.md) Rules or the [authoring](authoring.md) contract. Its figures come from measured review-suite runs and are examples, not thresholds.
4
+
5
+ ## Map Claims To Evidence
6
+
7
+ | Evidence class | The question it answers, and what observes it |
8
+ | --- | --- |
9
+ | Description activation | Did a natural prompt cause the exact target to be read, and when? Natural activation at the earliest useful prompt. |
10
+ | First-read body behavior | Did explicit body delivery guide the subject using only guaranteed context? |
11
+ | Nearby behavior | Did a close case avoid activation, or load without hijacking the task? Natural activation plus behavioral output. |
12
+ | Dependency composition | Did exact ordered skills, resources, and context work together? |
13
+ | Retained use | Did guidance remain useful on later declared turns without redelivery? Multi-turn evidence. |
14
+ | Artifact outcome | Did files, structured state, events, responses, and test commands match fixed criteria? |
15
+ | Cross-host behavior | Did the same behavioral question hold on every named host? One group per host, same semantics. |
16
+ | Delivery | Did the changed component reach the model, observed in the system prompt or provider context? |
17
+
18
+ Record separately:
19
+
20
+ - declaration;
21
+ - resource materialization;
22
+ - delivery;
23
+ - observed reads;
24
+ - behavior;
25
+ - artifacts;
26
+ - derived grades;
27
+ - judged evidence;
28
+ - later semantic judgment.
29
+
30
+ ```text
31
+ successful read
32
+ ≠ behavioral compliance
33
+
34
+ explicit body delivery
35
+ ≠ natural activation
36
+
37
+ one turn
38
+ ≠ retained use
39
+
40
+ ambient installation
41
+ ≠ declared composition
42
+
43
+ correct behavior
44
+ ≠ proof that the target caused it
45
+ ```
46
+
47
+ ## Choose The Smallest Group Shape
48
+
49
+ - **Description prompt:** natural activation and exact read timing.
50
+ - **Explicit body task:** first-read body behavior without activation ambiguity.
51
+ - **Fixture task:** files or repository state matter.
52
+ - **Stateful turns:** ordered conversation and retained use matter.
53
+ - **Saved-result review:** canonical evidence already answers the question.
54
+ - **Suite:** several independent questions require one ordered invocation, or a comparison needs a decision rule over several cases.
55
+ - **Conversation, pipeline, coding task or judged evaluation:** the behavior happens with a simulated user, across stages, in code that tests must run, or in meaning only a judge can read; see [coding tasks](coding-tasks.md) and [conversations, pipelines and judges](conversations-pipelines-judges.md).
56
+
57
+ Keep activation and body behavior separate unless their integrated interaction is the exact question and the current runner supports that observing boundary.
58
+
59
+ ### Compare, Noise Check And Measure
60
+
61
+ - **Compare arms** answers whether the component changes behavior on this task. Picking the best of several candidates on the same cases selects on noise; confirm the winner on held-out cases.
62
+ - **A noise check** (`component: []`, identical arms) shows how much runs of one unchanged setup differ: the floor a real difference must clear. Run it in the same batch and on the same cases as the comparison it calibrates; one noise check is itself noisy, and a repeat of the reference as an extra arm in the comparison group gives the floor without a separate batch.
63
+ - **Measure** (one arm, its own reference) records a baseline to compare against later, scores a benchmark, or checks that a setup still passes what it passed before. It never supports a comparison: two setups measured separately ran in different batches and conditions, so when the question becomes which is better, run both as arms of one group with a decision rule. A benchmark score is a rate on this suite, with these checks and this setup, not readiness.
64
+
65
+ ## Fix Exact Arms
66
+
67
+ A group runs two or more named arms, and one of them, `baseline` unless `reference` names another, is the reference the others are compared with. Two arms, `baseline` and `candidate`, answer most questions. Add an arm only when the question needs it, for example two candidate wordings against one baseline; each added arm adds subjects, and a decision rule compares only the two arms it names, so pick that pair before the run.
68
+
69
+ To learn whether a skill's body, not just its description, changes behavior, add a separate group whose baseline is a neutral package: the same name and description with a placeholder body. A candidate that matches the neutral baseline gains nothing from its body under that pressure.
70
+
71
+ Inline examples in the instructions under test teach the subject and are part of the candidate intervention; they are not independent evaluation evidence.
72
+
73
+ ## Design Common Questions
74
+
75
+ ### Description activation
76
+
77
+ Use the earliest natural prompt where the target should become useful.
78
+
79
+ For a nearby prompt, predeclare whether success means:
80
+
81
+ - non-trigger; or
82
+ - safe behavior after activation.
83
+
84
+ Test both sides in one suite: prompts where the target should be read and close prompts where it should not. A suite with only one side rewards a description that triggers on everything, or on nothing.
85
+
86
+ ### First-read body
87
+
88
+ Explicitly deliver the exact target body with only guaranteed context. Ambient package context cannot repair a hidden dependency.
89
+
90
+ ### Delivery
91
+
92
+ For a component that acts through what the host sends, such as an extension, a host setting or an instruction file, first check with a `context-text` expectation that it reached the model; a change that never reached it cannot explain a behavior difference.
93
+
94
+ ### Dependency composition
95
+
96
+ Materialize exact ordered skills and context. Vary only the target snapshot. Do not provide a hidden base stack.
97
+
98
+ ### Retained use
99
+
100
+ Use ordered turns in one persistent subject process. Repeated body delivery does not prove retained use.
101
+
102
+ ### Artifact outcome
103
+
104
+ Grade files, changed paths, structured state, and events before relying on the final response. Preserve turn-scoped workspace evidence when later turns may change earlier state. When the outcome is working code, grade it with a command, such as hidden tests, rather than by reading it.
105
+
106
+ Grade what the agent produced, not the path it took. A required sequence of tool calls fails valid approaches the author did not foresee. Check a tool call only when the call is itself the behavior, such as a forbidden action or a confirmation the task requires.
107
+
108
+ ## Apply Real Pressure
109
+
110
+ A useful group:
111
+
112
+ - creates a natural temptation to violate the intended behavior;
113
+ - keeps criteria and review questions outside the prompt;
114
+ - exposes deterministic evidence where possible;
115
+ - distinguishes the arms' behavior;
116
+ - remains realistic enough that passing behavior is useful.
117
+
118
+ Choose the pressure by the kind of instruction under test:
119
+
120
+ - **A Rule:** make breaking it the easy or rewarded path, such as urgency, a user request that conflicts with it, or a shortcut that saves work. The candidate passes only if the Rule holds.
121
+ - **Judgment:** include at least one case where following the default literally is the worse choice, next to a case where the default is right. The candidate passes on the outcome in both, so a variant that only obeys the default cannot pass.
122
+
123
+ ## Make Tasks Fair
124
+
125
+ A task is fair when an agent that does the job correctly passes, and one that does not, fails.
126
+
127
+ - Everything a check requires is stated in the task or follows from it. A check that expects a file path the task never names fails a correct agent.
128
+ - Two people who know the domain would give each run the same pass or fail. When they would not, sharpen the task or the check before running.
129
+ - Passing requires doing the job, not a shortcut: editing or deleting tests, hard-coding an expected output, or writing text aimed at a judge.
130
+ - An arm that fails a case in every one of many trials usually has a broken task or check, not an incapable agent. Read its transcripts, and for a coding task run its reference solution, before revising the component.
131
+
132
+ ## Grade By Requirement And Respect Variance
133
+
134
+ Grade each requirement a group checks, not only pass or fail. Label each as derivable from the request and code, dependent on a clarification, or imposed by the evaluator (an exact name or message only the checker knows); a failure on an evaluator-imposed requirement says little about the component.
135
+
136
+ For a task with several parts, give each part its own expectation, so a run that does most of the task reads differently from one that fails at once. The aggregate counts each check separately; it does not combine them into one weighted score.
137
+
138
+ One run per cell cannot separate a difference of one or two items from run-to-run variance. Repeat the cell, or report such a difference as unresolved.
139
+
140
+ Freeze the candidate before a batch runs; items used to develop a revision are not evidence for it (Hold Cases Out, below).
141
+
142
+ ## Keep Separate Conclusions Separate
143
+
144
+ An explicitly delivered body may support first-read behavior while a natural prompt still fails activation. Preserve both conclusions; one does not repair the other.
145
+
146
+ ## Claim Classes
147
+
148
+ Name the strongest claim the result must support before building cases, and report the strongest one it reached, never a stronger one.
149
+
150
+ | Claim | Minimum evidence | Not enough |
151
+ | --- | --- | --- |
152
+ | **Can do X** | One complete run that shows X, with its transcript | — |
153
+ | **Does X at a rate on this suite** | Pass, fail and unavailable counts per check, case and trial, with the case and trial counts stated; pass^k at the stated k for behavior relied on every time | One run; pass@k alone for behavior relied on every time |
154
+ | **A beats B** | Paired runs of both arms on the same cases, and a decision rule and size fixed before the run | Fewer cases than declared; transitions such as fail-to-pass; unpaired runs; a rule chosen after seeing results |
155
+ | **Ready** | Held-out cases, real services, pinned models, and evidence at the claim's own boundary | Any of the above alone. Evaluate Behavior never claims it |
156
+
157
+ "The candidate identified the defect in 69 of 90 reviews, the baseline in 42" is a count. "The candidate is better" needs the rule.
158
+
159
+ ## Fix The Decision Rule First
160
+
161
+ Declare the rule as the suite's `decision` before the run ([authoring](authoring.md#decision) has its fields and defaults). It names:
162
+
163
+ - the measure: a comparison's checks, a run metric such as cost or turns, or a judged rubric dimension;
164
+ - the two arms it compares, the reference first, and whether higher or lower is better;
165
+ - the size: the minimum number of decided cases, the significance level, and optionally an adaptive trial schedule.
166
+
167
+ The unit is the case: trials of one case are repeated draws of one question, so each arm's values are averaged per case and an exact sign test runs over the cases that differ. The verdict is `beats` only with at least the minimum decided cases, p below the level, and the split in the declared direction; the same evidence the other way is `worse`; anything else is `no-difference-shown`. For example, 19 better, 5 worse and 6 equal gives p ≈ 0.007. Report the verdict beside the pooled counts, and the split behind it.
168
+
169
+ The sign test ignores how much better a case was, so it is conservative for measures with large per-case differences, such as cost. A rule written after seeing results is not a decision rule: write a new suite and run it fresh.
170
+
171
+ ## Size Cases And Trials To The Decision
172
+
173
+ - **Few trials show little.** Three passes in three trials is consistent with a true pass rate near 0.3: the exact two-sided 95% lower bound is about 0.29.
174
+ - **pass^k and pass@k diverge.** At 75% per trial, all three of three trials succeed about 42% of the time, and at least one about 98%. Report pass^k for behavior a user relies on each time; pass@k fits only when a retry or a checker stands between the subject and the user.
175
+ - **Cases set what a comparison can detect.** A 20-point difference at 80% power needs roughly 62 to 93 cases per arm, depending on the base rate. A pilot of 20 or 30 cases detects only large effects; say so in its report. Early changes often have large effects, so 20 to 50 cases drawn from real failures are a good start.
176
+ - **More cases beat more trials.** Past a few trials per case, extra trials narrow the result little; extra cases narrow it more.
177
+ - **Cases that share a fixture or a task family are not independent.** Count the families as well as the cases, and spread cases across families.
178
+ - **Keep the subject's settings.** Lowering the thinking level or sampling temperature to cut variance changes the subject; do it only when that setting is the question.
179
+ - **Spend trials where a miss costs most.** Cases whose miss is the costlier error can run more trials than the rest, for example nine for known-issue cases and three for clean ones.
180
+ - **Fix the trial count before the run.** A three-trial look once suggested a drop in detection (80 against 74 of 90) that six trials did not confirm. Adding trials until a result looks right is selection. A decision's `trials` schedule is the one exception, because it is declared before the run: it adds trials only to cases whose sign is not yet stable, up to its maximum.
181
+
182
+ ## Expect Run-To-Run Noise
183
+
184
+ The same baseline commit accepted 31 of 45 correct changes in one run and 38 of 45 in the next. A difference smaller than that swing, between two single runs, is not a result.
185
+
186
+ - Run both arms in the same batch, so they share conditions.
187
+ - Pool every baseline run of the same commit and the same case versions, and compare a later candidate with all of them, not the most favorable. A changed case or check starts a new series.
188
+ - When a claim is close, run a noise check (`component: []`), with identical arms; the gap it shows is the floor a real difference must clear.
189
+
190
+ ## Keep Capability And Regression Suites Apart
191
+
192
+ - A **capability** suite asks what the agent cannot yet do reliably. It should start with a low pass rate, so a change has room to show. A suite where every arm passes nearly every case is saturated: a large improvement shows as a small change. Add harder cases, or move it to regression.
193
+ - A **regression** suite guards what already works and should sit near 100%. A drop means something broke. Read it per check and case: a sign test says `worse` only when many cases got worse, so a few broken cases show in the counts long before the verdict moves.
194
+ - A case that passes reliably in a capability suite can graduate into the regression suite.
195
+ - A check that passes in every arm and every trial does not separate the arms. Replace it in a capability suite; keep it in a regression suite only if it guards something that could break.
196
+
197
+ ## Hold Cases Out
198
+
199
+ - Fix the split before any case is built or run, by a stable rule such as every third case in hash order.
200
+ - Tune wording against the tuning cases only. Report held-out cases separately, and never tune against them.
201
+ - Never report the score of a set you selected on as the result: choosing the best of several candidates by their held-out score makes that score optimistic.
202
+ - Cases written by the author of the guidance under test, or by the model under test, are not independent of it.
203
+
204
+ ## Control Mechanical Checks That Approximate Meaning
205
+
206
+ A deterministic check that stands in for a meaning, such as a regex or "the review names the right file and line", needs a control: run it where the right answer is no. In one review suite, a check that a review named the seeded line "found" the seed in 30% to 46% of reviews of the clean version, because seeds sit where reviewers comment anyway. A check that fires on its controls cannot measure detection. Use it as a filter, or ask a judge.
207
+
208
+ ## Read Before Counting
209
+
210
+ Before reporting a count, read the transcripts of failed runs and of a sample of passing ones. A failure should look fair: it is clear what the agent got wrong and why. When it is not, the task, the check or the harness is at fault, and the count measures that instead.
211
+
212
+ - A run the check failed may hold a valid solution the author did not foresee. Fix the check, not the agent.
213
+ - A run the check passed may have passed by a shortcut. Fix the check before counting it.
214
+ - When a judge and a deterministic check disagree, find which side is wrong: the agent, the check, or the judge. Fix that one and rerun; never average the two.
215
+
216
+ ## Count Judge Answers With Care
217
+
218
+ A judge's answers are measurements, under Review Work's [Judge Contract](../../review-work/references/evals-and-judges.md#judge-contract). In practice:
219
+
220
+ - Check first and judge only what checks cannot answer. Count only rubric answers (`review --rubric`): each run is judged alone and blind to its arm, so no order effect arises, and a decision rule can name a dimension. Keep pairwise review questions for advisory comparison.
221
+ - Make each question answerable from the materials: name what to look for, such as the defect's location, expression and effect, and put the expected answer in the dimension's `reference`, which only judges see. Low agreement between judges (Cohen's kappa for two, Krippendorff's alpha for more, per dimension in the aggregate) means the question is uncertain: sharpen it and its reference before counting.
222
+ - Prefer a judge from another model family than the subject's, and record the relation either way.
223
+ - Calibrate each judge configuration with `review --calibrate <labels.json>` against runs you labelled by hand before reading the judge's answers on them, including runs where each answer is right: a set that is almost all "yes" makes a judge that always says yes look accurate. Keep some labelled runs out when you revise the rubric against the labels, and calibrate again when the kind of task changes.
224
+ - Judges favor longer answers, are sensitive to the wording of the question and reference, and can defer to a reference over the evidence. Include a control where the right answer is the shorter one when the arms differ in length, and read a sample of answers whenever the wording changes.
225
+ - The run is untrusted input to the judge; a subject that writes to its grader is gaming the eval, whatever the judge answers. Revising a component until a judge's scores rise can raise scores without raising quality: hand-check judged gains before adopting the revision.
226
+ - For pairwise questions, run `--swap`, or `--swap-sample` once order effects are known to be rare; when the two orders disagree, report a strict reading (yes in both orders) and a lenient one (yes in one order and no in neither).
227
+ - Before counting answers, hand-check a sample of decisive ones against the evidence, and report how many were right. Keep the judge's view large enough for its question; raise `--limit` and state what it cut.
228
+
229
+ ## Count The Cost And Spend Less
230
+
231
+ Count subjects before running: groups × arms × trials, times the stages of a pipeline, plus a simulated user's call per conversation turn; then one judge call per reviewed group (two with `--swap`), and one per judge per judged run. The plan line prints the subject count. Host-reported cost is a list-price estimate: runs billed to a subscription spend the user's plan limit instead, which `--max-cost` does not see. Run the smallest batch that can answer the question first, and state the count before a large one.
232
+
233
+ Spend the fewest subject and judge calls that still answer the question: start from saved evidence; run `check-tasks`, which calls no model, while a dry run still runs subjects; run the smallest batch first with `--pilot` or one `--group`; let `--reuse` take unchanged arms, but run every arm fresh when a claim is close, since a reused run did not share the fresh arm's batch; remember that `--jobs` saves time, not spend; let a decision's adaptive `trials` schedule add trials only where the sign is unsettled; grade deterministically first, swap only a sample once order effects are known to be rare, and calibrate each judge configuration once. A cheaper judge that calibrates well is a valid choice.
234
+
235
+ ## Defect Suites
236
+
237
+ For a reviewer, checker or anything else whose job is to find problems. Sizing, noise and judges are above; this section covers what is particular to detectors.
238
+
239
+ A detector is measured on two sides: how often it finds real problems, and how often it rejects sound work. One side alone means nothing; a reviewer that rejects everything finds every defect.
240
+
241
+ ### Build Both Sides
242
+
243
+ - **Clean controls:** sound changes, put through the same detector, to measure false rejection.
244
+ - **Seeded defects:** planted in otherwise sound changes, in named classes such as a logic error a test catches, a convention broken against stated requirements, and a security flaw. Report each class separately.
245
+ - **Real defects:** taken from history, from the commit that introduced a defect a later commit fixed, without refactor-only hunks. Seeded and real defects can differ in detection by an order of magnitude, so report them separately and keep real ones in every comparison.
246
+
247
+ ### Prove Every Label
248
+
249
+ - Show each defect is real before use: a test or probe that passes on the sound state and fails on the defective one, or for a convention, the quoted requirement and the line that breaks it. Reproduce the proof on a fresh export, not in the builder's tree.
250
+ - A real variant matches its introducing commit byte for byte.
251
+ - Audit the clean labels too. Trace each stated requirement to what its commit shows, narrow any that claim more, and check that the fixture holds the code each requirement depends on. A "clean" change with a genuine issue leaves the false-rejection measure and becomes a known-issue case; one audit moved 5 of 20.
252
+
253
+ ### Keep The Answer Out Of Sight
254
+
255
+ - Nothing the detector sees may name the variant, the class or the defect: use neutral IDs and paths. A declared context path containing the variant name is enough to leak it.
256
+ - Cases are built by someone other than the author of the guidance under test. Seeds are never written by the model under test.
257
+
258
+ ### Give The Detector What Its Job Needs
259
+
260
+ - Give it the tools a careful person would use for the job, such as listing files and running the change's tests. A reviewer that cannot list files reviews the diff alone; one that cannot run the tests asks for evidence it could have produced.
261
+ - Make the harness reliable before measuring. Tests that fail under load, cut output and a misleading build status each produced rejections that belonged to the harness, not the detector.
262
+ - A change of tools or harness changes the measure. Results from before and after do not compare directly; say so.
263
+
264
+ ### Score Detection And Rejection
265
+
266
+ - Fix the outcomes before the run, for example: a clean change is rejected when the review ends Inconclusive or Blocking. A deterministic check on the verdict line can score rejection; declare the comparison the suite's decision rule reads.
267
+ - Count a defect as found only when the detector identified it, by location and effect. Rejecting the change for another reason is not detection. A text check rarely tells the two apart; a rubric dimension such as "found the defect", with the defect's location and effect in a `reference` only judges see, usually does.
268
+ - Report, for each side and class: the counts, pass^k (found in every trial), the per-case split between arms, and held-out cases apart from tuning cases.
269
+ - Read the rejections of clean changes and sort their causes, such as harness fault, ignoring evidence the detector produced itself, demanding a test for behavior the code plainly shows, and genuine open questions. The causes point at the revision; the count alone does not.
270
+ - Weigh both sides before adopting a change. One wording raised acceptance of correct changes from 77% to 91% while detection held at 82% to 85%, and was adopted; a second sentence that also raised acceptance missed guard bypasses in otherwise sound changes, and was dropped.
271
+ - Combining several detectors' verdicts trades one side for the other: an "any" rule mostly adds false rejections, a unanimous rule loses detections. Detectors from different model families flag different items, but that has been seen to add false rejections more than detections; measure both sides before trusting a mixed panel.
272
+ - An adjudicator can reject a real defect, and nothing downstream recovers it. Count, from the stage outputs, the seeded defects some review found and the adjudicator dropped, and report them apart from defects no review found.
273
+ - To measure a review design rather than one reviewer, such as two independent reviews and an adjudicator, run it as a pipeline: each review a fresh stage that sees only the change, the adjudicator a stage that sees the reviews, and the adjudicator graded. Score both sides on its final verdict, and read the stage outputs to tell a missed defect from one the adjudicator dropped.