@hassangameryt/freeflow 0.5.0 → 0.7.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 (301) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +2 -2
  3. package/.codex-plugin/plugin.json +4 -5
  4. package/README.md +141 -163
  5. package/capabilities/cognitive-routing/SKILL.md +387 -0
  6. package/capabilities/context-virtualization/SKILL.md +103 -0
  7. package/capabilities/conversation-history/SKILL.md +53 -0
  8. package/command-surface.json +6 -37
  9. package/hooks/freeflow-runtime-context.mjs +50 -541
  10. package/hooks/hooks.json +1 -26
  11. package/hooks/tests/check-runtime-context-hook.sh +114 -308
  12. package/package.json +27 -17
  13. package/pi-extension/dist/cognitive-routing/commands.js +96 -0
  14. package/pi-extension/dist/cognitive-routing/config.js +232 -0
  15. package/pi-extension/dist/cognitive-routing/controller.js +1292 -0
  16. package/pi-extension/dist/cognitive-routing/history.js +451 -0
  17. package/pi-extension/dist/cognitive-routing/host.js +188 -0
  18. package/pi-extension/dist/cognitive-routing/pi-routing-session.js +414 -0
  19. package/pi-extension/dist/cognitive-routing/pi-session-control.js +320 -0
  20. package/pi-extension/dist/cognitive-routing/runtime.js +43 -0
  21. package/pi-extension/dist/cognitive-routing/tool.js +212 -0
  22. package/pi-extension/dist/cognitive-routing/types.js +6 -0
  23. package/pi-extension/dist/context-virtualization/commands.js +89 -0
  24. package/pi-extension/dist/context-virtualization/projector.js +42 -0
  25. package/pi-extension/dist/context-virtualization/runtime.js +356 -0
  26. package/pi-extension/dist/context-virtualization/state.js +57 -0
  27. package/pi-extension/dist/context-virtualization/types.js +10 -0
  28. package/pi-extension/dist/conversation-history/passages.js +66 -0
  29. package/pi-extension/dist/conversation-history/ranking.js +105 -0
  30. package/pi-extension/dist/conversation-history/runtime.js +226 -0
  31. package/pi-extension/dist/conversation-history/search.js +56 -0
  32. package/pi-extension/dist/conversation-history/types.js +1 -0
  33. package/pi-extension/dist/freeflow-context/resolver.js +120 -0
  34. package/pi-extension/dist/freeflow-context/runtime.js +80 -0
  35. package/pi-extension/dist/freeflow-context/source-projector.js +95 -0
  36. package/pi-extension/dist/freeflow-context/tool.js +308 -0
  37. package/pi-extension/dist/freeflow-context/types.js +12 -0
  38. package/pi-extension/dist/freeflow-context/visibility.js +28 -0
  39. package/pi-extension/dist/index.js +564 -129
  40. package/pi-extension/dist/runtime/runtime-context.js +357 -470
  41. package/pi-extension/dist/runtime/runtime-identity.js +5 -0
  42. package/pi-extension/dist/settings/settings-tui.js +78 -0
  43. package/pi-extension/dist/settings/settings-ui.js +572 -826
  44. package/pi-extension/dist/ui/text-component.js +57 -0
  45. package/pi-extension/src/cognitive-routing/commands.ts +129 -0
  46. package/pi-extension/src/cognitive-routing/config.ts +303 -0
  47. package/pi-extension/src/cognitive-routing/controller.ts +1628 -0
  48. package/pi-extension/src/cognitive-routing/history.ts +650 -0
  49. package/pi-extension/src/cognitive-routing/host.ts +266 -0
  50. package/pi-extension/src/cognitive-routing/pi-routing-session.ts +538 -0
  51. package/pi-extension/src/cognitive-routing/pi-session-control.ts +444 -0
  52. package/pi-extension/src/cognitive-routing/runtime.ts +57 -0
  53. package/pi-extension/src/cognitive-routing/tool.ts +273 -0
  54. package/pi-extension/src/cognitive-routing/types.ts +89 -0
  55. package/pi-extension/src/context-virtualization/commands.ts +111 -0
  56. package/pi-extension/src/context-virtualization/projector.ts +62 -0
  57. package/pi-extension/src/context-virtualization/runtime.ts +406 -0
  58. package/pi-extension/src/context-virtualization/state.ts +79 -0
  59. package/pi-extension/src/context-virtualization/types.ts +92 -0
  60. package/pi-extension/src/conversation-history/passages.ts +81 -0
  61. package/pi-extension/src/conversation-history/ranking.ts +155 -0
  62. package/pi-extension/src/conversation-history/runtime.ts +250 -0
  63. package/pi-extension/src/conversation-history/search.ts +79 -0
  64. package/pi-extension/src/conversation-history/types.ts +31 -0
  65. package/pi-extension/src/freeflow-context/resolver.ts +139 -0
  66. package/pi-extension/src/freeflow-context/runtime.ts +100 -0
  67. package/pi-extension/src/freeflow-context/source-projector.ts +106 -0
  68. package/pi-extension/src/freeflow-context/tool.ts +360 -0
  69. package/pi-extension/src/freeflow-context/types.ts +70 -0
  70. package/pi-extension/src/freeflow-context/visibility.ts +53 -0
  71. package/pi-extension/src/index.ts +597 -135
  72. package/pi-extension/src/runtime/runtime-context.ts +373 -491
  73. package/pi-extension/src/runtime/runtime-identity.ts +8 -0
  74. package/pi-extension/src/settings/settings-tui.ts +93 -0
  75. package/pi-extension/src/settings/settings-ui.ts +679 -910
  76. package/pi-extension/src/ui/text-component.ts +66 -0
  77. package/pi-extension/tests/cognitive-routing/commands.test.js +134 -0
  78. package/pi-extension/tests/cognitive-routing/controller.test.js +1128 -0
  79. package/pi-extension/tests/cognitive-routing/extension-lifecycle.test.js +1142 -0
  80. package/pi-extension/tests/cognitive-routing/history.test.js +274 -0
  81. package/pi-extension/tests/cognitive-routing/host-fixture.js +4 -0
  82. package/pi-extension/tests/cognitive-routing/host-identity.test.js +63 -0
  83. package/pi-extension/tests/cognitive-routing/pi-normal-lifecycle.test.js +434 -0
  84. package/pi-extension/tests/cognitive-routing/pi-session-control.test.js +174 -0
  85. package/pi-extension/tests/cognitive-routing/pi-session-history.test.js +91 -0
  86. package/pi-extension/tests/cognitive-routing/profile-resolution.test.js +279 -0
  87. package/pi-extension/tests/cognitive-routing/tool.test.js +230 -0
  88. package/pi-extension/tests/context-virtualization/extension.test.js +749 -0
  89. package/pi-extension/tests/context-virtualization/projector.test.js +110 -0
  90. package/pi-extension/tests/context-virtualization/runtime.test.js +216 -0
  91. package/pi-extension/tests/conversation-history/runtime.test.js +98 -0
  92. package/pi-extension/tests/conversation-history/search.test.js +97 -0
  93. package/pi-extension/tests/integration/mode-free-core.test.js +218 -0
  94. package/pi-extension/tests/integration/pi-extension.test.js +532 -3701
  95. package/pi-extension/tests/integration/prompt-architecture.test.js +350 -0
  96. package/pi-extension/tests/integration/unaffected-regressions.test.js +411 -0
  97. package/runtime/prompts/cognitive-routing.md +10 -0
  98. package/runtime/prompts/context-virtualization.md +3 -0
  99. package/runtime/prompts/conversation-history.md +3 -0
  100. package/runtime/prompts/core.md +84 -0
  101. package/runtime/prompts/interaction-contract.md +11 -0
  102. package/skills/action-selection/SKILL.md +140 -0
  103. package/skills/action-selection/references/trajectory-stalls.md +71 -0
  104. package/skills/bypass/SKILL.md +109 -38
  105. package/skills/commit-work/SKILL.md +94 -55
  106. package/skills/commit-work/references/git-state-edges.md +94 -0
  107. package/skills/commit-work/references/simple-push.md +92 -0
  108. package/skills/commit-work/references/staging-decisions.md +79 -46
  109. package/skills/decision-gate/SKILL.md +80 -22
  110. package/skills/design-for-depth/SKILL.md +206 -60
  111. package/skills/design-for-depth/references/design-pressure-signals.md +108 -240
  112. package/skills/design-for-depth/references/interface-design-loop.md +77 -97
  113. package/skills/design-for-depth/references/module-and-dependency-design.md +147 -0
  114. package/skills/design-for-depth/references/software-design-philosophy.md +128 -174
  115. package/skills/design-for-depth/references/state-and-failure-boundaries.md +136 -0
  116. package/skills/diagnose-failure/SKILL.md +200 -48
  117. package/skills/diagnose-failure/references/diagnostic-loop-catalog.md +18 -6
  118. package/skills/diagnose-failure/references/{flaky-and-performance.md → flaky-and-performance-diagnosis.md} +13 -5
  119. package/skills/discuss/SKILL.md +119 -65
  120. package/skills/discuss/references/discussion-continuity.md +123 -0
  121. package/skills/evaluate-skill/SKILL.md +166 -52
  122. package/skills/evaluate-skill/references/{definition-schema.md → evaluation-definition-schema.md} +43 -3
  123. package/skills/evaluate-skill/references/evaluation-design.md +56 -30
  124. package/skills/evaluate-skill/references/execution-and-evidence.md +8 -3
  125. package/skills/evaluate-skill/references/review-and-revision.md +62 -21
  126. package/skills/evaluate-skill/scripts/lib/definitions.mjs +114 -3
  127. package/skills/evaluate-skill/scripts/lib/grade-interaction.mjs +156 -1
  128. package/skills/evaluate-skill/scripts/lib/grade.mjs +9 -1
  129. package/skills/evaluate-skill/scripts/lib/pi.mjs +147 -32
  130. package/skills/evaluate-skill/scripts/lib/rpc.mjs +4 -4
  131. package/skills/evaluate-skill/scripts/lib/runner.mjs +36 -14
  132. package/skills/evaluate-skill/scripts/lib/sandbox.mjs +92 -0
  133. package/skills/evaluate-skill/scripts/pi-guard.mjs +1 -1
  134. package/skills/evaluate-skill/scripts/pi-observer.mjs +66 -0
  135. package/skills/evaluate-skill/scripts/skill-eval.mjs +6 -5
  136. package/skills/execute-work/SKILL.md +99 -57
  137. package/skills/execute-work/references/code-practices.md +4 -4
  138. package/skills/execute-work/references/execute-work-edges.md +62 -0
  139. package/skills/finish-branch/SKILL.md +2 -2
  140. package/skills/finish-branch/references/integration-options.md +1 -1
  141. package/skills/handoff/SKILL.md +3 -3
  142. package/skills/launch-work/SKILL.md +1 -1
  143. package/skills/launch-work/references/launch-readiness.md +2 -2
  144. package/skills/migration-work/SKILL.md +2 -2
  145. package/skills/migration-work/references/migration-lifecycle.md +1 -1
  146. package/skills/release-work/SKILL.md +1 -1
  147. package/skills/release-work/references/release-evidence.md +1 -1
  148. package/skills/review-artifact/SKILL.md +129 -66
  149. package/skills/review-artifact/references/adjudicate-artifact-review.md +101 -0
  150. package/skills/review-artifact/references/independent-artifact-reviewer-contract.md +159 -0
  151. package/skills/review-work/SKILL.md +113 -68
  152. package/skills/review-work/references/adjudicate-work-review.md +97 -0
  153. package/skills/review-work/references/independent-work-reviewer-contract.md +139 -0
  154. package/skills/review-work/references/security-risk-lens.md +18 -16
  155. package/skills/setup-freeflow/SKILL.md +16 -17
  156. package/skills/setup-freeflow/references/activation-contract.md +24 -30
  157. package/skills/setup-freeflow/references/host-setup.md +6 -7
  158. package/skills/simplify-code/SKILL.md +97 -39
  159. package/skills/simplify-code/references/simplification-patterns.md +1 -1
  160. package/skills/tdd/SKILL.md +100 -53
  161. package/skills/tdd/references/test-design.md +3 -3
  162. package/skills/track-work/SKILL.md +195 -58
  163. package/skills/track-work/references/working-record-format.md +515 -0
  164. package/skills/track-work/scripts/lib/document.mjs +713 -0
  165. package/skills/track-work/scripts/lib/format.mjs +166 -0
  166. package/skills/track-work/scripts/lib/store.mjs +233 -0
  167. package/skills/track-work/scripts/lib/transitions.mjs +790 -0
  168. package/skills/track-work/scripts/lib/views.mjs +40 -0
  169. package/skills/track-work/scripts/working-record.mjs +316 -0
  170. package/skills/verify-work/SKILL.md +57 -19
  171. package/skills/verify-work/references/browser-runtime-evidence.md +2 -2
  172. package/skills/verify-work/references/integration-evidence.md +1 -7
  173. package/skills/verify-work/references/performance-evidence.md +2 -2
  174. package/skills/workflow/SKILL.md +137 -55
  175. package/skills/workflow/references/domain-skill-composition.md +26 -40
  176. package/skills/write-plan/SKILL.md +1 -1
  177. package/skills/write-skill/SKILL.md +218 -61
  178. package/skills/write-skill/references/activation-boundaries.md +63 -21
  179. package/skills/write-skill/references/agent-first-instructions.md +61 -27
  180. package/skills/write-skill/references/progressive-disclosure.md +97 -33
  181. package/skills/write-skill/references/skill-dependency-graphs.md +190 -0
  182. package/capabilities/output-router/SKILL.md +0 -206
  183. package/capabilities/output-router/references/safety-policy.md +0 -40
  184. package/capabilities/output-router/references/setup.md +0 -110
  185. package/pi-extension/dist/output-router/host-producer-identification.js +0 -232
  186. package/pi-extension/dist/output-router/native-safety-net.js +0 -216
  187. package/pi-extension/dist/output-router/observed-tool-routing.js +0 -122
  188. package/pi-extension/dist/output-router/renderers.js +0 -1023
  189. package/pi-extension/dist/output-router/router-tools.js +0 -554
  190. package/pi-extension/dist/output-router/schemas.js +0 -383
  191. package/pi-extension/dist/output-router/status.js +0 -744
  192. package/pi-extension/dist/output-router/utils.js +0 -502
  193. package/pi-extension/src/output-router/host-producer-identification.ts +0 -256
  194. package/pi-extension/src/output-router/native-safety-net.ts +0 -248
  195. package/pi-extension/src/output-router/observed-tool-routing.ts +0 -134
  196. package/pi-extension/src/output-router/renderers.ts +0 -1108
  197. package/pi-extension/src/output-router/router-tools.ts +0 -579
  198. package/pi-extension/src/output-router/schemas.ts +0 -387
  199. package/pi-extension/src/output-router/status.ts +0 -791
  200. package/pi-extension/src/output-router/utils.ts +0 -554
  201. package/pi-extension/tests/output-router/observed-producers.test.js +0 -132
  202. package/pi-extension/tests/output-router/search.test.js +0 -722
  203. package/router/dist/benchmarks/benchmark-harness.d.ts +0 -35
  204. package/router/dist/benchmarks/benchmark-harness.js +0 -92
  205. package/router/dist/benchmarks/benchmarks.d.ts +0 -109
  206. package/router/dist/benchmarks/benchmarks.js +0 -979
  207. package/router/dist/benchmarks/codex-qa-benchmarks.d.ts +0 -95
  208. package/router/dist/benchmarks/codex-qa-benchmarks.js +0 -500
  209. package/router/dist/benchmarks/command-benchmarks.d.ts +0 -143
  210. package/router/dist/benchmarks/command-benchmarks.js +0 -698
  211. package/router/dist/benchmarks/context-mode-normalized-benchmarks.d.ts +0 -82
  212. package/router/dist/benchmarks/context-mode-normalized-benchmarks.js +0 -773
  213. package/router/dist/benchmarks/context-mode-real-deep-benchmark.d.ts +0 -132
  214. package/router/dist/benchmarks/context-mode-real-deep-benchmark.js +0 -1380
  215. package/router/dist/benchmarks/context-saving-baseline.d.ts +0 -60
  216. package/router/dist/benchmarks/context-saving-baseline.js +0 -470
  217. package/router/dist/benchmarks/index-benchmarks.d.ts +0 -103
  218. package/router/dist/benchmarks/index-benchmarks.js +0 -862
  219. package/router/dist/benchmarks/storage-policy-benchmarks.d.ts +0 -101
  220. package/router/dist/benchmarks/storage-policy-benchmarks.js +0 -618
  221. package/router/dist/benchmarks/vault-index-benchmarks.d.ts +0 -56
  222. package/router/dist/benchmarks/vault-index-benchmarks.js +0 -322
  223. package/router/dist/config/config.d.ts +0 -103
  224. package/router/dist/config/config.js +0 -632
  225. package/router/dist/config/router-contract.d.ts +0 -10
  226. package/router/dist/config/router-contract.js +0 -54
  227. package/router/dist/config/schema.d.ts +0 -27
  228. package/router/dist/config/schema.js +0 -648
  229. package/router/dist/config/types.d.ts +0 -573
  230. package/router/dist/config/types.js +0 -41
  231. package/router/dist/evidence/bounded-evidence.d.ts +0 -40
  232. package/router/dist/evidence/bounded-evidence.js +0 -323
  233. package/router/dist/evidence/evidence-range-selector.d.ts +0 -24
  234. package/router/dist/evidence/evidence-range-selector.js +0 -232
  235. package/router/dist/evidence/evidence-search.d.ts +0 -27
  236. package/router/dist/evidence/evidence-search.js +0 -490
  237. package/router/dist/evidence/evidence.d.ts +0 -38
  238. package/router/dist/evidence/evidence.js +0 -200
  239. package/router/dist/evidence/failure-contracts.d.ts +0 -37
  240. package/router/dist/evidence/failure-contracts.js +0 -166
  241. package/router/dist/evidence/line-ranges.d.ts +0 -24
  242. package/router/dist/evidence/line-ranges.js +0 -22
  243. package/router/dist/experiments/local-index.d.ts +0 -64
  244. package/router/dist/experiments/local-index.js +0 -581
  245. package/router/dist/index.d.ts +0 -30
  246. package/router/dist/index.js +0 -32
  247. package/router/dist/local/local-traversal.d.ts +0 -18
  248. package/router/dist/local/local-traversal.js +0 -334
  249. package/router/dist/processing/engine.d.ts +0 -132
  250. package/router/dist/processing/engine.js +0 -533
  251. package/router/dist/processing/reducers.d.ts +0 -280
  252. package/router/dist/processing/reducers.js +0 -1673
  253. package/router/dist/processing/renderers.d.ts +0 -31
  254. package/router/dist/processing/renderers.js +0 -195
  255. package/router/dist/processing/scripts.d.ts +0 -91
  256. package/router/dist/processing/scripts.js +0 -386
  257. package/router/dist/repo/repo-traversal.d.ts +0 -18
  258. package/router/dist/repo/repo-traversal.js +0 -245
  259. package/router/dist/routing/observed-reducers.d.ts +0 -41
  260. package/router/dist/routing/observed-reducers.js +0 -661
  261. package/router/dist/routing/observed-routing.d.ts +0 -26
  262. package/router/dist/routing/observed-routing.js +0 -378
  263. package/router/dist/routing/parsers.d.ts +0 -16
  264. package/router/dist/routing/parsers.js +0 -521
  265. package/router/dist/routing/run-filters.d.ts +0 -60
  266. package/router/dist/routing/run-filters.js +0 -238
  267. package/router/dist/routing/run-reducers.d.ts +0 -49
  268. package/router/dist/routing/run-reducers.js +0 -122
  269. package/router/dist/sandbox/adapter-roots.d.ts +0 -46
  270. package/router/dist/sandbox/adapter-roots.js +0 -66
  271. package/router/dist/sandbox/eryx-python-adapter.d.ts +0 -13
  272. package/router/dist/sandbox/eryx-python-adapter.js +0 -868
  273. package/router/dist/sandbox/jq-wasm-adapter.d.ts +0 -9
  274. package/router/dist/sandbox/jq-wasm-adapter.js +0 -429
  275. package/router/dist/sandbox/quickjs-wasi-adapter.d.ts +0 -13
  276. package/router/dist/sandbox/quickjs-wasi-adapter.js +0 -384
  277. package/router/dist/sandbox/script-sandbox.d.ts +0 -134
  278. package/router/dist/sandbox/script-sandbox.js +0 -337
  279. package/router/dist/setup/script-transform-adapters.d.ts +0 -32
  280. package/router/dist/setup/script-transform-adapters.js +0 -278
  281. package/router/dist/tools/batch.d.ts +0 -33
  282. package/router/dist/tools/batch.js +0 -586
  283. package/router/dist/tools/run.d.ts +0 -62
  284. package/router/dist/tools/run.js +0 -1304
  285. package/router/dist/tools/search.d.ts +0 -66
  286. package/router/dist/tools/search.js +0 -1364
  287. package/router/dist/transform/engine.d.ts +0 -168
  288. package/router/dist/transform/engine.js +0 -2072
  289. package/router/dist/vault/vault-index.d.ts +0 -125
  290. package/router/dist/vault/vault-index.js +0 -416
  291. package/router/dist/vault/vault.d.ts +0 -138
  292. package/router/dist/vault/vault.js +0 -630
  293. package/runtime/interaction-contract.md +0 -16
  294. package/skills/discuss/references/checkpoints.md +0 -66
  295. package/skills/execute-work/references/execution-loop.md +0 -77
  296. package/skills/mode-contract/SKILL.md +0 -104
  297. package/skills/review-artifact/references/reviewer-prompt.md +0 -148
  298. package/skills/review-work/references/reviewer-prompt.md +0 -134
  299. package/skills/track-work/references/working-record-schema.md +0 -378
  300. package/skills/workflow/references/workflow-loop.md +0 -92
  301. /package/skills/handoff/references/{templates.md → handoff-templates.md} +0 -0
@@ -1,63 +1,127 @@
1
1
  # Progressive Disclosure
2
2
 
3
- Read this before adding or reorganizing references and scripts.
3
+ Read this before adding or reorganizing references, assets, or scripts.
4
4
 
5
- Make the first-read route understandable, then move only separately owned or conditional depth out of the active body.
5
+ Progressive disclosure should change when content enters context, preserve one canonical owner, or isolate a real lifecycle boundary. Splitting files without one of those benefits adds dependency cost without reducing context.
6
6
 
7
- ## Dependency Direction
7
+ ## Preserve Dependency Direction
8
8
 
9
9
  ```text
10
10
  description
11
11
  -> SKILL.md
12
- -> required or conditional reference or script
12
+ -> required or conditional resource
13
13
  ```
14
14
 
15
- The description routes the first useful read. `SKILL.md` establishes the job, normal method, necessary terms, and stop conditions. A required resource must be linked before the body relies on it. A conditional resource may rely on language already established by the body.
15
+ `SKILL.md` establishes:
16
16
 
17
- Do not hide a definition, rule, or step needed to recognize the normal route in an unannounced reference. That is progressive reconstruction, not disclosure.
17
+ - the job;
18
+ - normal route;
19
+ - necessary terms;
20
+ - stop and return conditions;
21
+ - observable resource read points.
18
22
 
19
- ## Add A Required Reference When
23
+ A reference cannot activate itself. Do not hide the rule needed to recognize a reference inside that reference.
20
24
 
21
- - normal execution genuinely needs separately owned depth;
22
- - the body can identify and require the read before using that depth;
23
- - keeping the material inline would obscure the skill’s controlling rules;
24
- - the dependency is delivered and validated with the skill package.
25
+ That is progressive reconstruction, not disclosure.
25
26
 
26
- Required does not mean implicit. The body must say when to read the resource and must not act as if unread content were already known.
27
+ ## Classify The Read Point
27
28
 
28
- ## Add A Conditional Reference When
29
+ ### Entry-required
29
30
 
30
- - the material is needed only for a distinct branch of work;
31
- - loading it every time would obscure higher-priority behavior;
32
- - the active body can name an observable condition for reading it;
33
- - the reference has one clear job and does not restate the full skill or Workflow.
31
+ Read before the skill can follow or reject its normal route.
34
32
 
35
- Keep compact examples that teach the normal boundary in `SKILL.md`. Move a larger example set only when it serves a conditional branch and would obscure the normal route.
33
+ Entry-required references are exceptional. Use one only when separation provides independent value, such as:
34
+
35
+ - canonical reuse across packages;
36
+ - separate ownership or lifecycle;
37
+ - generated schemas or contracts;
38
+ - compatibility or host constraints;
39
+ - independently versioned external policy.
40
+
41
+ If every useful activation reads the resource and it has no separate ownership or lifecycle value, inline it even when `SKILL.md` becomes substantially longer.
42
+
43
+ ### Activity-required
44
+
45
+ Read before performing one named normal activity.
46
+
47
+ The skill may first:
48
+
49
+ - exit;
50
+ - defer;
51
+ - choose another route;
52
+ - determine that the activity does not apply.
53
+
54
+ Activity-required references provide real loading value even when the activity is common.
55
+
56
+ ### Conditional
57
+
58
+ Read only when an observable branch occurs.
59
+
60
+ The body must teach the agent enough to recognize the branch before loading the reference.
61
+
62
+ Do not use “when unclear” if the reference contains the method for recognizing the underlying condition.
63
+
64
+ ## Keep The Normal Route Contiguous
65
+
66
+ Start with one `SKILL.md`.
67
+
68
+ Keep inline:
69
+
70
+ - the first-read job;
71
+ - normal route;
72
+ - controlling definitions;
73
+ - rules needed to select resources;
74
+ - stop and return behavior.
75
+
76
+ Move depth only when keeping it inline would obscure the normal route and the read point is executable.
77
+
78
+ Do not split a file to satisfy a line count.
79
+
80
+ ## Add A Reference When
81
+
82
+ - one named normal activity needs separately owned depth;
83
+ - one observable conditional branch needs depth;
84
+ - one canonical resource is shared without duplication;
85
+ - one resource has a real independent lifecycle;
86
+ - the body can name and require the read before use.
87
+
88
+ The body instruction and reference introduction must state the same read condition.
89
+
90
+ Required means necessary. Do not call a required reference recommended or optional.
91
+
92
+ If skipping the reference preserves correct execution, either make its concrete optional value explicit or remove it.
36
93
 
37
94
  ## Add A Script When
38
95
 
39
- - the skill owns a deterministic feature or repeated operation;
40
- - retyping it is error-prone, unsafe, or materially wasteful;
41
- - its interface and failure behavior can be tested.
96
+ - the skill owns a deterministic repeated operation;
97
+ - model-generated execution would be error-prone, unsafe, or materially wasteful;
98
+ - the interface and failure behavior can be tested;
99
+ - the script’s output has a clear evidence boundary.
42
100
 
43
- A script does not require an earlier failure. Do not script ordinary shell commands merely to look complete.
101
+ Do not script ordinary commands merely to make the package appear complete.
44
102
 
45
103
  ## Link At The Decision Point
46
104
 
47
- A resource link should tell the agent when it becomes useful:
105
+ Link every agent-facing reference, asset, package dependency, and executable entrypoint from `SKILL.md` at the first useful choice.
106
+
107
+ Avoid vague resource lists such as:
108
+
109
+ > See references for more information.
48
110
 
49
- > Read the integration-evidence reference when the claim depends on host dispatch or an installed artifact.
111
+ Prefer:
50
112
 
51
- Avoid vague resource lists such as “See references for more information.”
113
+ > Read Test Design before designing or materially changing the behavior check.
52
114
 
53
- ## Resource Test
115
+ ## Apply The Resource Test
54
116
 
55
- For every extra file, answer:
117
+ For every extra file, ask:
56
118
 
57
- 1. What normal dependency or conditional branch requires it?
58
- 2. When can the agent recognize that read or run condition?
59
- 3. What prior language does the resource assume, and where is it established?
60
- 4. Why cannot the active body or a direct command do the job clearly?
61
- 5. How will the resource be validated and kept consistent?
119
+ 1. What activity, conditional branch, shared ownership, or lifecycle requires it?
120
+ 2. When can the agent recognize the read or run condition?
121
+ 3. What prior language does it assume?
122
+ 4. Where is that language guaranteed?
123
+ 5. What context or ownership value does separation provide?
124
+ 6. Why is inline content worse?
125
+ 7. How will links, containment, and behavior be verified?
62
126
 
63
- If those answers are weak, remove the resource.
127
+ If separation changes neither loading nor ownership, inline the content or remove it.
@@ -0,0 +1,190 @@
1
+ # Skill Dependency Graphs
2
+
3
+ Read this when creating or revising multiple related skills, shared terminology, cross-skill links, capability activation, direct or routed entry paths, or context-loss recovery.
4
+
5
+ A multi-skill system is a stateful, partially loaded prompt graph. It is not a mandatory sequence.
6
+
7
+ ## Identify The Edge Types
8
+
9
+ Do not treat every link as execution.
10
+
11
+ ### Activation edge
12
+
13
+ Causes a skill to be read or made effective:
14
+
15
+ ```text
16
+ natural prompt -> description -> skill
17
+ always-loaded system cue -> recovery skill
18
+ capability cue -> capability skill
19
+ ```
20
+
21
+ ### Owner route
22
+
23
+ Changes which activity controls the current bounded result.
24
+
25
+ A plain-text return may express control flow without creating a Markdown package dependency.
26
+
27
+ ### Composition edge
28
+
29
+ Adds a method, lens, reviewer contract, or domain guide without changing the current owner.
30
+
31
+ ### Reference edge
32
+
33
+ Loads activity-required or conditional depth inside a package.
34
+
35
+ ### Environment-interaction edge
36
+
37
+ Temporarily selects one observation or effect and returns to the same current owner.
38
+
39
+ ### Persistence edge
40
+
41
+ Earlier skill guidance remains in context and may affect later behavior without another read.
42
+
43
+ ### Recovery edge
44
+
45
+ Reintroduces required guidance after context loss through an always-loaded upstream cue.
46
+
47
+ ## Enumerate Every Valid Entry Path
48
+
49
+ For each skill, identify:
50
+
51
+ - natural description activation;
52
+ - orchestrator or lifecycle routes;
53
+ - sibling routes;
54
+ - direct user commands;
55
+ - capability cues;
56
+ - context-loss recovery;
57
+ - host-specific activation;
58
+ - artifact or checkpoint routes.
59
+
60
+ Do not optimize only for the most common path.
61
+
62
+ A skill may rely only on context guaranteed across every valid activation path.
63
+
64
+ If a skill can activate directly, it cannot depend on vocabulary introduced only by a commonly preceding skill.
65
+
66
+ If a skill can activate through an independent recovery cue, it cannot assume that an earlier discussion or planning skill was read first.
67
+
68
+ ## Place Terminology Upstream
69
+
70
+ For every shared term:
71
+
72
+ 1. list all consumers;
73
+ 2. list every valid path to those consumers;
74
+ 3. find the nearest upstream context guaranteed on all paths;
75
+ 4. define the term there;
76
+ 5. keep specialized detail with its owning skill.
77
+
78
+ Place shared vocabulary in the nearest always-available context only when independently activated consumers require it.
79
+
80
+ Keep local terms local when other skills should route to the owner rather than implement its method.
81
+
82
+ Do not duplicate full definitions merely to compensate for a broken activation graph.
83
+
84
+ ## Prevent Self-Activation
85
+
86
+ An unread skill cannot require its own first read.
87
+
88
+ Critical activation must come from:
89
+
90
+ - guaranteed base or system guidance;
91
+ - a skill description;
92
+ - an already-loaded owner;
93
+ - an effective capability cue;
94
+ - another declared upstream path.
95
+
96
+ References follow the same rule: the body must name the read condition before using reference content.
97
+
98
+ ## Check Direct And Routed Paths
99
+
100
+ For every related skill, test:
101
+
102
+ ```text
103
+ direct natural activation
104
+ routed activation from expected parent
105
+ nearby safe-read activation
106
+ retained use after another skill loads
107
+ recovery after context loss
108
+ ```
109
+
110
+ A path that works only because another skill happened to be read is not valid dependency composition.
111
+
112
+ ## Check Redundancy And Inconsistency
113
+
114
+ Across all changed skills, inspect:
115
+
116
+ - duplicate canonical definitions;
117
+ - divergent wording for the same invariant;
118
+ - early commands contradicted by later caveats;
119
+ - two skills claiming the same current ownership;
120
+ - methods or lenses accidentally becoming owners;
121
+ - links with no activation, route, composition, or reference job;
122
+ - terms used before guaranteed definition;
123
+ - body and reference read-condition mismatch;
124
+ - stale recovery cues;
125
+ - direct routes bypassing required context;
126
+ - retained instructions hijacking later owners.
127
+
128
+ Distinguish semantic duplication from intentional local guards.
129
+
130
+ ## Repeat Across Skills Deliberately
131
+
132
+ Repeat a compact invariant when a distinct activation path or decision point requires local protection.
133
+
134
+ Keep:
135
+
136
+ ```text
137
+ canonical owner
138
+ -> complete definition or method
139
+
140
+ consumer
141
+ -> compact local guard
142
+ -> route to canonical owner when needed
143
+ ```
144
+
145
+ Do not copy complete sections across skills. Repetition should preserve meaning without creating competing ownership.
146
+
147
+ ## Keep Routing And Terminology Graphs Distinct
148
+
149
+ Terminology and dependency order should normally flow from guaranteed upstream context toward consumers.
150
+
151
+ Runtime routing may be cyclic:
152
+
153
+ ```text
154
+ For example:
155
+ clarification -> task memory -> clarification
156
+ execution -> verification -> review -> execution
157
+ ```
158
+
159
+ A cyclic routing graph does not justify cyclic terminology dependencies.
160
+
161
+ ## Validate Facts And Evaluate Behavior
162
+
163
+ Deterministic checks can establish:
164
+
165
+ - links;
166
+ - containment;
167
+ - dependency cycles;
168
+ - resource inventory;
169
+ - routing-map parity;
170
+ - exact duplicate text.
171
+
172
+ They cannot establish:
173
+
174
+ - correct activation;
175
+ - safe retained influence;
176
+ - semantic consistency;
177
+ - useful repetition;
178
+ - behavior preservation;
179
+ - readiness.
180
+
181
+ Evaluate the exact graph claim:
182
+
183
+ - activation;
184
+ - first-read body behavior;
185
+ - dependency composition;
186
+ - retained use;
187
+ - recovery;
188
+ - artifact outcome.
189
+
190
+ Do not require a graph artifact for every small skill edit. Use this method when several nodes, paths, terms, or owners change together.
@@ -1,206 +0,0 @@
1
- ---
2
- name: output-router
3
- description: Use after the Workflow, Decision Gate, or Discuss route is clear when choosing between native tools and Freeflow routed tools, retrieving repo/local/vault evidence, transforming bounded evidence, handling unknown-size or broad output, running likely-large/noisy commands, recovering vaulted output, tuning outputRouter/observedRouting/scriptTransform after setup, or handling optional native read/bash safety-net routing.
4
- ---
5
-
6
- # Output Router
7
-
8
- Choose how evidence moves into context.
9
-
10
- Freeflow tools are the safe first choice for unknown-size, exploratory, repo-wide, generated/log-adjacent, structured, or likely noisy output, including broad `rg`/`find`/`git`/help/docs scans. Native tools stay direct for known-small, exact, intentionally raw, or mutating work. A post-hoc cap such as `head`, `sed -n`, `tail`, or `wc` does not make a broad producer known-small.
11
-
12
- Output Router does not classify the task. Workflow, Decision Gate, or Discuss decides whether to answer, ask, explore, plan, or stop. Output Router starts after that route is clear.
13
-
14
- ## First Decision
15
-
16
- Ask what kind of data you need:
17
-
18
- - Existing repo, explicit local, or vault data: use `freeflow_search`.
19
- - New command or script-produced output: use `freeflow_run`.
20
- - Several independent Freeflow operations: use `freeflow_batch`.
21
- - Config/status/vault/script-adapter facts: use `freeflow_status`.
22
- - Enabled MCP/web/fetch/code-search output: call the host tool directly; Pi observed routing runs after the host result when configured.
23
- - Known whole file, intentionally exact shell behavior, cmux/Pi control probes, explicit fallback after a routed-source limitation, or edits: use native `read`, `bash`, `edit`, or `write`.
24
-
25
- When unsure how much output will return, use Freeflow first. Bound the producer before using native tools; do not rely on trimming the output after a broad command runs.
26
-
27
- ## `freeflow_search`: Existing Data
28
-
29
- Use `freeflow_search` for repo files, explicit external local files, and vaulted output that already exists.
30
-
31
- Actions:
32
-
33
- - `locate`: find likely paths/output ids first. Use before reading when you only need candidates.
34
- - `query`: return the best focused evidence packets for a search question.
35
- - `get`: user gave exact-ish text/code/snippet or asks “where is this?” Find the best match and return source coordinates plus matched content.
36
- - `retrieve`: you already know the path/outputId and line range. Return those exact lines. Do not use this as search.
37
- - `expand`: widen a previous evidence packet.
38
- - `explain`: explain a previous routed decision or vault output/recoverability.
39
- - `transform`: compute facts or deterministic subsets from repo/local/vault/file/output data.
40
-
41
- Use `source.kind="repo"` for the current checkout. Use `source.kind="local"` for external local docs/files with an explicit absolute `root` and optional relative `path`; do not put local roots in shared config. Use `source.kind="vault"` for previous Freeflow outputs.
42
-
43
- Vault search patterns:
44
-
45
- - Unknown output id: `source.kind="vault"` without `outputId`, plus `query` and optional `filters`.
46
- - Known output id and unknown line: `action="query"` or `get` with `source.outputId`.
47
- - Known output id and known line range: `action="retrieve"` with `lineRange`.
48
- - Metadata-only result: use `action="explain"`; do not claim raw recovery.
49
-
50
- Use `preserve="full"` only when exact fidelity matters. It still means exact-under-caps, not unlimited context injection.
51
-
52
- ## `freeflow_search action=transform`: Processing Existing Data
53
-
54
- Use transform when raw data is too large/structured and you need computed facts.
55
-
56
- Good transform cases:
57
-
58
- - logs: status counts, error rates, slow examples,
59
- - JSON/CSV: counts, groupings, top values, extracted fields,
60
- - test/build/typecheck output already in the vault,
61
- - MCP/web/fetch/code-search payloads already routed into the vault,
62
- - deterministic regex filtering, match counts, grouping, dedupe, topN, URL/citation extraction, line/size stats.
63
-
64
- Prefer deterministic operations when enough:
65
-
66
- - `regexFilter`, `countMatches`, `jsonExtract`, `groupByRegex`, `dedupe`, `topN`, `extractUrls`, `extractCitations`, `lineStats`, `sizeStats`.
67
-
68
- Use scripts only when deterministic operations cannot express the fact:
69
-
70
- - `operation.kind="script"` runs a sandboxed transform over vault sources.
71
- - `script` without `operation` runs the processing-engine script path over repo/local/vault sources.
72
- - Sandboxed scripts require `scriptTransform.enabled=true` and a proof-backed adapter.
73
- - Raw script code is not persisted; metadata stores hashes/labels/limits.
74
- - No sandboxed script path may silently fall back to host shell execution.
75
-
76
- Unsafe unsandboxed processing is local-only, explicit per call, and only through the processing script policy. It must say `unsafe/unsandboxed`. Never put that opt-in in shared config.
77
-
78
- ## `freeflow_run`: New Output
79
-
80
- Use `freeflow_run` when the producer creates new output and routed evidence is enough.
81
-
82
- Base producers are mutually exclusive:
83
-
84
- - `command`: shell command through the host-approved runner.
85
- - `script`: sandboxed code-as-producer with no repo/home/env/network/vault access.
86
-
87
- Use `command` for:
88
-
89
- - tests, builds, lint, typecheck, CI-like checks,
90
- - broad shell search with unknown output size,
91
- - commands likely to print logs, JSON, status, or diagnostics,
92
- - commands whose exact raw output may need recovery.
93
-
94
- Use `script` for:
95
-
96
- - generating data with code when no repo/home/env/network access is needed,
97
- - safe code-as-producer execution through the same sandbox engine as transforms,
98
- - stdout/stderr capture that should route like command output.
99
-
100
- Do not use `freeflow_run script` when the code needs repo files, environment variables, network, package imports, or host filesystem access. Use a host command intentionally, or transform an explicitly captured source.
101
-
102
- Run modifiers:
103
-
104
- - `goal`: tell the router why the run exists, e.g. `verification`, `diagnosis`, `build`, `log analysis`.
105
- - `filters`: deterministic line filtering over captured stdout/stderr/combined.
106
- - `scriptFilter`: sandboxed script over already captured stdout/stderr/combined. It never reruns the base producer.
107
- - `preserve="full"`: request exact output under caps with vault recovery over cap.
108
-
109
- Run storage:
110
-
111
- - Default `hybrid-dedupe` stores exact output when exactness-sensitive and metadata-only for small non-sensitive successes.
112
- - Failures, verification/test/build/typecheck/diagnosis output, `preserve="full"`, filters, script filters, reducers, script producers, and large/noisy output are exactness-sensitive.
113
- - Exact duplicates may store current metadata pointing to a previous exact `outputId`.
114
- - Plain metadata-only records get rerun guidance, not exact recovery claims.
115
-
116
- ## `freeflow_batch`: Independent Freeflow Work
117
-
118
- Use `freeflow_batch` when several Freeflow-owned `run` or `search` steps can happen independently.
119
-
120
- Good batch cases:
121
-
122
- - run several bounded searches in parallel,
123
- - run independent checks and ask `queries[]` to extract facts from child evidence,
124
- - gather multiple repo/local/vault facts without injecting every child result.
125
-
126
- Do not use batch for:
127
-
128
- - sequenced workflows,
129
- - arbitrary external tool orchestration,
130
- - mutating work,
131
- - steps where one child needs another child’s output.
132
-
133
- Child outputs remain in `details.result.steps`; exact child run output remains recoverable by child `outputId`.
134
-
135
- ## Native Tools
136
-
137
- Use native tools when direct behavior is the point:
138
-
139
- - `read`: known whole file or exact direct file content is intended.
140
- - `bash`: expected-small exact shell behavior, host access, cmux/Pi control probes, or bounded producer behavior is intentionally needed.
141
- - `edit` / `write`: mutations.
142
-
143
- Native `bash`/`read` remain valid for known-small exact checks, cmux/Pi control probes, exact file reads, or explicit fallback after a routed-source limitation; name the limitation and keep the fallback narrow.
144
-
145
- Do not run broad native commands just to see what comes back. `head`, `sed -n`, `tail`, `wc`, or similar output caps bound visible text, not producer scope or relevance. Likely-large native commands include repo-wide `rg`, `grep -R`, `find`, package scans, generated-artifact scans, docs/help scans, logs, broad `git diff/log`, full tests/builds/lints/typechecks, and one-off scripts with unknown output size.
146
-
147
- If native read/bash safety net is enabled, large/noisy native output may be replaced with labeled Freeflow-routed output. It must include an `outputId` and recovery instructions. If safety-net routing fails, native output passes through with a warning.
148
-
149
- ## Observed Routing
150
-
151
- For enabled Pi MCP/web/fetch/code-search producers, call the host tool directly. Freeflow observes the completed result after host execution.
152
-
153
- Observed routing:
154
-
155
- - is off by default,
156
- - is explicit per producer/server,
157
- - does not grant permissions or block host tools,
158
- - can persist exact output, metadata-only, or nothing depending on config,
159
- - fails open with original host output if routing fails.
160
-
161
- Mutating MCP/tool calls still require normal workflow/interview judgment before the host call. Observed routing is not permission approval.
162
-
163
- ## Hard Rules
164
-
165
- - Do not pretend routed output is native output.
166
- - Do not silently shorten native output.
167
- - Capture raw output before transforming it.
168
- - Keep raw source recovery separate from transformed/reduced output recovery.
169
- - Treat `preserve="full"` as exact fidelity under caps, not unlimited context injection.
170
- - Preserve exact failure and verification evidence lines.
171
- - Keep `toolStatus`, `execution.status`, and `routing.status` separate.
172
- - Metadata-only records must never claim exact raw recovery.
173
- - Freeflow mode changes guidance strength only. It must not enable `postToolRouting`.
174
- - Do not write removed `capture` or `providers` config.
175
- - Do not offer `redacted`; it is future-only.
176
-
177
- ## Recovery Pattern
178
-
179
- For routed run/native/observed/transform output, recover exact text with:
180
-
181
- ```json
182
- {
183
- "action": "retrieve",
184
- "source": { "kind": "vault", "outputId": "ffout_...", "stream": "stdout|stderr|combined|raw" },
185
- "lineRange": { "start": 1, "end": 20 },
186
- "preserve": "full"
187
- }
188
- ```
189
-
190
- When line numbers are unknown, use `query` or `get` first. Use `expand` when a returned evidence packet is too narrow. Use `explain` when recoverability is unclear.
191
-
192
- ## Config
193
-
194
- Use `freeflow_status` to inspect effective config, vault writability/index state, script adapters, observed routing, and migration recommendations.
195
-
196
- Use Pi's `/output-router enable` or repository settings surface for initial enablement. Read [setup guidance](references/setup.md) before repairing capability config or changing optional routing features. After valid setup, Output Router owns explicit operational tuning requested through its capability surface.
197
-
198
- Persist operational config only after an explicit tuning request or a previously accepted setup branch:
199
-
200
- - `outputRouter`: `enabled`, `profile`, `postToolRouting`, `storagePolicy`, thresholds, vault root/retention, generated paths, noisy command hints.
201
- - `outputRouter.observedRouting`: explicit MCP servers and web/fetch/codeSearch producer persistence.
202
- - `outputRouter.scriptTransform`: enabled flag, languages, sandbox/network/limits/raw-script persistence.
203
-
204
- Minimal setup stays only `defaultMode`. Missing optional sections mean built-in defaults.
205
-
206
- Read [the safety policy](references/safety-policy.md) before changing routing policy, reviewing router behavior, or handling exactness-sensitive output.
@@ -1,40 +0,0 @@
1
- # Output Router Safety Policy
2
-
3
- Reference-only policy for exactness-sensitive output routing. Pi runtime context does not load this whole file by default; the active `output-router` skill carries the compact rules. Read this file before changing routing policy, reviewing router behavior, or handling a new exactness-sensitive output class.
4
-
5
- ## Main Rule
6
-
7
- Do not silently summarize, compress, or replace exactness-sensitive output.
8
-
9
- Exactness-sensitive output includes:
10
-
11
- - user-requested exact/full output,
12
- - small native outputs where direct output is expected,
13
- - verification output needed for completion claims,
14
- - failure evidence needed for diagnosis,
15
- - source-truth conflict evidence,
16
- - security, privacy, billing, data-loss, permissions, or public API evidence,
17
- - failed, timed-out, or cancelled run output,
18
- - script-producer output,
19
- - filtered, script-filtered, reduced, or transformed output where raw source matters,
20
- - anything marked `preserve: full`.
21
-
22
- ## Required Behavior
23
-
24
- - Capture raw evidence before transformation whenever output is routed.
25
- - Label every transformed native or observed result as Freeflow-routed output.
26
- - Include an `outputId` and exact recovery instructions when exact recovery exists.
27
- - Preserve exact failure and verification evidence lines; do not paraphrase them.
28
- - Pass small native outputs through unchanged unless explicit config and thresholds route them.
29
- - For huge exactness-sensitive output, use vaulting and exact chunk retrieval instead of lossy summarization.
30
- - If post-tool native safety-net routing fails, fail open: return the native output unchanged when possible and include a warning.
31
- - Keep raw source recovery separate from transformed/reduced output recovery.
32
- - Metadata-only records must never claim exact raw recovery. Duplicate metadata may point to a prior exact `outputId`; plain metadata-only records get rerun or explanation guidance.
33
-
34
- ## Non-Goals
35
-
36
- - This policy does not enable post-tool routing by itself.
37
- - This policy does not authorize model-assisted summarization inside the router runtime.
38
- - This policy does not authorize unsandboxed script execution.
39
- - This policy does not require Pi runtime context to inject the full reference every turn.
40
- - This policy does not replace host permissions, sandboxing, approvals, or workflow/decision gates.