@hassangameryt/freeflow 0.7.3 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.codex-plugin/plugin.json +1 -1
  4. package/.cursor-plugin/plugin.json +1 -1
  5. package/NOTICE +14 -0
  6. package/README.md +26 -31
  7. package/capabilities/cognitive-routing/SKILL.md +106 -161
  8. package/capabilities/cognitive-routing/references/both-mode.md +36 -0
  9. package/capabilities/cognitive-routing/references/executor-mode.md +48 -0
  10. package/capabilities/cognitive-routing/references/helper-mode.md +47 -0
  11. package/capabilities/compaction/SKILL.md +49 -0
  12. package/capabilities/compaction/references/summary-format.md +239 -0
  13. package/command-surface.json +4 -0
  14. package/gemini-extension.json +1 -1
  15. package/hooks/shared/runtime-context.mjs +28 -30
  16. package/licenses/Apache-2.0.txt +55 -0
  17. package/package.json +22 -9
  18. package/pi-extension/README.md +41 -0
  19. package/pi-extension/dist/cognitive-routing/assembler.js +393 -0
  20. package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/config.js +5 -2
  21. package/pi-extension/dist/cognitive-routing/economics.js +45 -0
  22. package/pi-extension/dist/cognitive-routing/event-schema.js +388 -0
  23. package/pi-extension/dist/{session-sources/events.js → cognitive-routing/event-store.js} +103 -40
  24. package/pi-extension/dist/cognitive-routing/gate.js +241 -0
  25. package/pi-extension/dist/cognitive-routing/handlers.js +899 -0
  26. package/pi-extension/dist/cognitive-routing/handoffs.js +350 -0
  27. package/pi-extension/dist/cognitive-routing/model-control.js +467 -0
  28. package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/projection.js +229 -56
  29. package/pi-extension/dist/cognitive-routing/provenance.js +81 -0
  30. package/pi-extension/dist/cognitive-routing/runtime.js +396 -0
  31. package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/schemas.js +43 -7
  32. package/pi-extension/dist/cognitive-routing/session.js +221 -0
  33. package/pi-extension/dist/{session-sources → cognitive-routing}/sources.js +99 -85
  34. package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/state.js +37 -378
  35. package/pi-extension/dist/cognitive-routing/status.js +80 -0
  36. package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/tools.js +12 -12
  37. package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/types.js +5 -11
  38. package/pi-extension/dist/compaction/carry.js +191 -0
  39. package/pi-extension/dist/compaction/config.js +22 -0
  40. package/pi-extension/dist/compaction/controller.js +471 -0
  41. package/pi-extension/dist/compaction/harness.js +77 -0
  42. package/pi-extension/dist/compaction/results.js +158 -0
  43. package/pi-extension/dist/compaction/thresholds.js +35 -0
  44. package/pi-extension/dist/compaction/tool.js +57 -0
  45. package/pi-extension/dist/host/branch.js +13 -0
  46. package/pi-extension/dist/host/canonical.js +12 -0
  47. package/pi-extension/dist/host/catalog.js +77 -0
  48. package/pi-extension/dist/host/config.js +374 -0
  49. package/pi-extension/dist/host/projection-tags.js +60 -0
  50. package/pi-extension/dist/host/prompts.js +82 -0
  51. package/pi-extension/dist/{session-sources → host}/read-only-session.js +112 -1
  52. package/pi-extension/dist/{runtime → host}/request-history.js +121 -39
  53. package/pi-extension/dist/host/runtime-state.js +189 -0
  54. package/pi-extension/dist/{settings/settings-ui.js → host/settings/freeflow-command.js} +620 -410
  55. package/pi-extension/dist/{settings/settings-tui.js → host/settings/settings-view.js} +186 -73
  56. package/pi-extension/dist/host/staging.js +28 -0
  57. package/pi-extension/dist/host/status.js +101 -0
  58. package/pi-extension/dist/index.js +423 -173
  59. package/pi-extension/dist/provider-support/cache/anchor.js +21 -0
  60. package/pi-extension/dist/provider-support/cache/anthropic.js +102 -0
  61. package/pi-extension/dist/provider-support/cache/health.js +73 -0
  62. package/pi-extension/dist/provider-support/cache/index.js +58 -0
  63. package/pi-extension/dist/provider-support/cache/keepalive.js +210 -0
  64. package/pi-extension/dist/provider-support/cache/monitor.js +17 -0
  65. package/pi-extension/dist/provider-support/cache/openai-responses.js +48 -0
  66. package/pi-extension/dist/provider-support/effort.js +13 -0
  67. package/pi-extension/dist/provider-support/index.js +44 -3
  68. package/pi-extension/dist/provider-support/{astra → openai}/adapter.js +46 -29
  69. package/pi-extension/dist/provider-support/{astra → openai}/history.js +10 -8
  70. package/pi-extension/dist/provider-support/{astra → openai}/index.js +8 -4
  71. package/pi-extension/dist/provider-support/{astra → openai}/session-state.js +29 -38
  72. package/pi-extension/dist/provider-support/routes.js +17 -0
  73. package/pi-extension/dist/tool-execution/apply-patch/grammar.js +23 -0
  74. package/pi-extension/dist/tool-execution/apply-patch/match.js +38 -0
  75. package/pi-extension/dist/tool-execution/apply-patch/parser.js +177 -0
  76. package/pi-extension/dist/tool-execution/apply-patch/plan.js +201 -0
  77. package/pi-extension/dist/tool-execution/apply-patch/tool.js +84 -0
  78. package/pi-extension/dist/tool-execution/background.js +238 -0
  79. package/pi-extension/dist/tool-execution/bash-guard.js +23 -0
  80. package/pi-extension/dist/tool-execution/config.js +22 -0
  81. package/pi-extension/dist/tool-execution/edit-messages.js +120 -0
  82. package/pi-extension/dist/tool-execution/file-state.js +138 -0
  83. package/pi-extension/dist/tool-execution/file-tracking.js +143 -0
  84. package/pi-extension/dist/tool-execution/prompt.js +54 -0
  85. package/pi-extension/dist/tool-execution/tools.js +16 -0
  86. package/pi-extension/freeflow/README.md +9 -0
  87. package/plugin.json +1 -1
  88. package/runtime/prompts/cognitive-routing.md +4 -4
  89. package/runtime/prompts/core.md +22 -75
  90. package/runtime/prompts/interaction-contract.md +15 -8
  91. package/runtime/prompts/tool-execution.md +38 -0
  92. package/runtime/prompts/working-method.md +108 -0
  93. package/skills/action-selection/SKILL.md +39 -47
  94. package/skills/action-selection/references/trajectory-stalls.md +2 -0
  95. package/skills/bypass/SKILL.md +2 -2
  96. package/skills/commit-work/SKILL.md +31 -83
  97. package/skills/commit-work/references/git-state-edges.md +1 -1
  98. package/skills/commit-work/references/simple-push.md +2 -0
  99. package/skills/commit-work/references/staging-decisions.md +1 -1
  100. package/skills/decision-gate/SKILL.md +31 -50
  101. package/skills/design-for-depth/SKILL.md +44 -53
  102. package/skills/design-for-depth/references/design-pressure-signals.md +46 -144
  103. package/skills/design-for-depth/references/implementation-decisions.md +1 -1
  104. package/skills/design-for-depth/references/interface-design-loop.md +5 -36
  105. package/skills/design-for-depth/references/module-and-dependency-design.md +2 -32
  106. package/skills/design-for-depth/references/state-and-failure-boundaries.md +2 -13
  107. package/skills/diagnose-failure/SKILL.md +39 -24
  108. package/skills/diagnose-failure/references/diagnostic-loop-catalog.md +2 -0
  109. package/skills/diagnose-failure/references/flaky-and-performance-diagnosis.md +2 -2
  110. package/skills/discuss/SKILL.md +35 -11
  111. package/skills/discuss/references/discussion-continuity.md +7 -27
  112. package/skills/evaluate-skill/SKILL.md +49 -80
  113. package/skills/evaluate-skill/references/evaluation-definition-schema.md +35 -5
  114. package/skills/evaluate-skill/references/evaluation-design.md +14 -14
  115. package/skills/evaluate-skill/references/execution-and-evidence.md +26 -5
  116. package/skills/evaluate-skill/references/review-and-revision.md +3 -1
  117. package/skills/evaluate-skill/scripts/lib/definitions.mjs +49 -8
  118. package/skills/evaluate-skill/scripts/lib/pi.mjs +14 -7
  119. package/skills/evaluate-skill/scripts/lib/review.mjs +196 -0
  120. package/skills/evaluate-skill/scripts/lib/runner.mjs +45 -8
  121. package/skills/evaluate-skill/scripts/lib/sandbox.mjs +2 -0
  122. package/skills/evaluate-skill/scripts/lib/trials.mjs +103 -0
  123. package/skills/evaluate-skill/scripts/lib/view.mjs +67 -1
  124. package/skills/evaluate-skill/scripts/pi-command-tool.mjs +144 -0
  125. package/skills/evaluate-skill/scripts/pi-guard.mjs +30 -13
  126. package/skills/evaluate-skill/scripts/skill-eval.mjs +114 -34
  127. package/skills/execute-work/SKILL.md +41 -9
  128. package/skills/execute-work/references/code-practices.md +2 -0
  129. package/skills/execute-work/references/execute-work-edges.md +11 -1
  130. package/skills/handoff/SKILL.md +1 -1
  131. package/skills/handoff/references/handoff-templates.md +1 -1
  132. package/skills/review-artifact/SKILL.md +42 -41
  133. package/skills/review-artifact/references/adjudicate-artifact-review.md +1 -1
  134. package/skills/review-artifact/references/independent-artifact-reviewer-contract.md +1 -1
  135. package/skills/review-work/SKILL.md +38 -32
  136. package/skills/review-work/references/adjudicate-work-review.md +1 -1
  137. package/skills/review-work/references/independent-work-reviewer-contract.md +1 -1
  138. package/skills/review-work/references/security-risk-lens.md +2 -4
  139. package/skills/setup-freeflow/SKILL.md +3 -1
  140. package/skills/setup-freeflow/references/activation-contract.md +7 -13
  141. package/skills/setup-freeflow/references/host-setup.md +3 -3
  142. package/skills/track-work/SKILL.md +113 -161
  143. package/skills/track-work/references/working-record-format.md +189 -350
  144. package/skills/track-work/scripts/lib/document.mjs +62 -6
  145. package/skills/track-work/scripts/lib/format.mjs +16 -1
  146. package/skills/track-work/scripts/lib/store.mjs +9 -8
  147. package/skills/track-work/scripts/lib/transitions.mjs +79 -4
  148. package/skills/track-work/scripts/working-record.mjs +34 -12
  149. package/skills/verify-work/SKILL.md +29 -20
  150. package/skills/verify-work/references/browser-runtime-evidence.md +1 -5
  151. package/skills/verify-work/references/integration-evidence.md +2 -0
  152. package/skills/verify-work/references/performance-evidence.md +3 -1
  153. package/skills/verify-work/references/test-design.md +3 -1
  154. package/skills/workflow/SKILL.md +65 -21
  155. package/skills/workflow/references/domain-skill-composition.md +5 -3
  156. package/skills/write-docs/SKILL.md +83 -0
  157. package/skills/write-docs/references/documentation-shapes.md +119 -0
  158. package/skills/write-docs/scripts/docs-check.mjs +139 -0
  159. package/skills/write-plan/SKILL.md +40 -40
  160. package/skills/write-plan/references/plan-shapes.md +1 -1
  161. package/skills/write-skill/SKILL.md +107 -147
  162. package/skills/write-skill/references/activation-boundaries.md +2 -0
  163. package/skills/write-skill/references/agent-first-instructions.md +22 -10
  164. package/skills/write-skill/references/progressive-disclosure.md +4 -2
  165. package/skills/write-skill/references/skill-dependency-graphs.md +2 -0
  166. package/skills/write-skill/scripts/lib/similarity.mjs +56 -0
  167. package/skills/write-skill/scripts/skill-author.mjs +18 -2
  168. package/skills/write-spec/SKILL.md +34 -41
  169. package/skills/write-spec/references/artifact-standards.md +1 -1
  170. package/skills/write-spec/references/decision-records.md +2 -0
  171. package/skills/write-spec/references/spec-shapes.md +1 -1
  172. package/capabilities/context-virtualization/SKILL.md +0 -103
  173. package/capabilities/conversation-history/SKILL.md +0 -53
  174. package/hooks/tests/check-host-adapters.test.mjs +0 -82
  175. package/hooks/tests/check-runtime-context-hook.sh +0 -212
  176. package/pi-extension/dist/cognitive-routing-v2/runtime.js +0 -2181
  177. package/pi-extension/dist/context-virtualization/commands.js +0 -89
  178. package/pi-extension/dist/context-virtualization/projector.js +0 -42
  179. package/pi-extension/dist/context-virtualization/runtime.js +0 -378
  180. package/pi-extension/dist/context-virtualization/state.js +0 -57
  181. package/pi-extension/dist/context-virtualization/types.js +0 -10
  182. package/pi-extension/dist/conversation-history/passages.js +0 -66
  183. package/pi-extension/dist/conversation-history/ranking.js +0 -105
  184. package/pi-extension/dist/conversation-history/runtime.js +0 -226
  185. package/pi-extension/dist/conversation-history/search.js +0 -56
  186. package/pi-extension/dist/conversation-history/types.js +0 -1
  187. package/pi-extension/dist/freeflow-context/resolver.js +0 -120
  188. package/pi-extension/dist/freeflow-context/runtime.js +0 -80
  189. package/pi-extension/dist/freeflow-context/source-projector.js +0 -95
  190. package/pi-extension/dist/freeflow-context/tool.js +0 -314
  191. package/pi-extension/dist/freeflow-context/types.js +0 -12
  192. package/pi-extension/dist/freeflow-context/visibility.js +0 -28
  193. package/pi-extension/dist/integrations/mcp-config.js +0 -29
  194. package/pi-extension/dist/runtime/runtime-context.js +0 -754
  195. package/pi-extension/dist/runtime/runtime-identity.js +0 -5
  196. package/pi-extension/dist/session-sources/provenance.js +0 -32
  197. package/pi-extension/dist/ui/text-component.js +0 -57
  198. package/pi-extension/src/cognitive-routing-v2/budget.ts +0 -42
  199. package/pi-extension/src/cognitive-routing-v2/config.ts +0 -173
  200. package/pi-extension/src/cognitive-routing-v2/projection.ts +0 -375
  201. package/pi-extension/src/cognitive-routing-v2/render.ts +0 -277
  202. package/pi-extension/src/cognitive-routing-v2/runtime.ts +0 -2241
  203. package/pi-extension/src/cognitive-routing-v2/schemas.ts +0 -180
  204. package/pi-extension/src/cognitive-routing-v2/state.ts +0 -839
  205. package/pi-extension/src/cognitive-routing-v2/tools.ts +0 -62
  206. package/pi-extension/src/cognitive-routing-v2/types.ts +0 -254
  207. package/pi-extension/src/context-virtualization/commands.ts +0 -111
  208. package/pi-extension/src/context-virtualization/projector.ts +0 -62
  209. package/pi-extension/src/context-virtualization/runtime.ts +0 -428
  210. package/pi-extension/src/context-virtualization/state.ts +0 -79
  211. package/pi-extension/src/context-virtualization/types.ts +0 -92
  212. package/pi-extension/src/conversation-history/passages.ts +0 -81
  213. package/pi-extension/src/conversation-history/ranking.ts +0 -155
  214. package/pi-extension/src/conversation-history/runtime.ts +0 -250
  215. package/pi-extension/src/conversation-history/search.ts +0 -79
  216. package/pi-extension/src/conversation-history/types.ts +0 -31
  217. package/pi-extension/src/freeflow-context/resolver.ts +0 -139
  218. package/pi-extension/src/freeflow-context/runtime.ts +0 -100
  219. package/pi-extension/src/freeflow-context/source-projector.ts +0 -106
  220. package/pi-extension/src/freeflow-context/tool.ts +0 -366
  221. package/pi-extension/src/freeflow-context/types.ts +0 -70
  222. package/pi-extension/src/freeflow-context/visibility.ts +0 -53
  223. package/pi-extension/src/index.ts +0 -390
  224. package/pi-extension/src/integrations/mcp-config.ts +0 -32
  225. package/pi-extension/src/provider-support/astra/adapter.ts +0 -108
  226. package/pi-extension/src/provider-support/astra/history.ts +0 -145
  227. package/pi-extension/src/provider-support/astra/index.ts +0 -12
  228. package/pi-extension/src/provider-support/astra/session-state.ts +0 -113
  229. package/pi-extension/src/provider-support/index.ts +0 -5
  230. package/pi-extension/src/runtime/request-history.ts +0 -243
  231. package/pi-extension/src/runtime/runtime-context.ts +0 -860
  232. package/pi-extension/src/runtime/runtime-identity.ts +0 -8
  233. package/pi-extension/src/session-sources/events.ts +0 -230
  234. package/pi-extension/src/session-sources/provenance.ts +0 -39
  235. package/pi-extension/src/session-sources/read-only-session.ts +0 -170
  236. package/pi-extension/src/session-sources/sources.ts +0 -334
  237. package/pi-extension/src/settings/settings-tui.ts +0 -501
  238. package/pi-extension/src/settings/settings-ui.ts +0 -1652
  239. package/pi-extension/src/ui/text-component.ts +0 -66
  240. package/pi-extension/tests/cache-reuse/history.test.js +0 -117
  241. package/pi-extension/tests/cache-reuse/native.test.js +0 -91
  242. package/pi-extension/tests/cache-reuse/settings.test.js +0 -211
  243. package/pi-extension/tests/cognitive-routing-v2/communication.test.js +0 -577
  244. package/pi-extension/tests/cognitive-routing-v2/compaction-input.test.js +0 -183
  245. package/pi-extension/tests/cognitive-routing-v2/delegation.test.js +0 -557
  246. package/pi-extension/tests/cognitive-routing-v2/native.test.js +0 -474
  247. package/pi-extension/tests/cognitive-routing-v2/performance.test.js +0 -87
  248. package/pi-extension/tests/cognitive-routing-v2/persistence.test.js +0 -300
  249. package/pi-extension/tests/cognitive-routing-v2/projection.test.js +0 -241
  250. package/pi-extension/tests/cognitive-routing-v2/recovery.test.js +0 -1034
  251. package/pi-extension/tests/cognitive-routing-v2/render.test.js +0 -244
  252. package/pi-extension/tests/cognitive-routing-v2/runtime.test.js +0 -423
  253. package/pi-extension/tests/cognitive-routing-v2/stabilization.test.js +0 -521
  254. package/pi-extension/tests/cognitive-routing-v2/state.test.js +0 -586
  255. package/pi-extension/tests/context-virtualization/extension.test.js +0 -775
  256. package/pi-extension/tests/context-virtualization/projector.test.js +0 -110
  257. package/pi-extension/tests/context-virtualization/runtime.test.js +0 -230
  258. package/pi-extension/tests/conversation-history/runtime.test.js +0 -98
  259. package/pi-extension/tests/conversation-history/search.test.js +0 -97
  260. package/pi-extension/tests/fixtures/pi-host.js +0 -4
  261. package/pi-extension/tests/fixtures/routing-native.js +0 -191
  262. package/pi-extension/tests/integration/mode-free-core.test.js +0 -220
  263. package/pi-extension/tests/integration/pi-extension.test.js +0 -1447
  264. package/pi-extension/tests/integration/prompt-architecture.test.js +0 -447
  265. package/pi-extension/tests/integration/unaffected-regressions.test.js +0 -478
  266. package/pi-extension/tests/provider-support/astra-boundaries.test.js +0 -75
  267. package/pi-extension/tests/provider-support/astra.test.js +0 -306
  268. package/pi-extension/tests/provider-support/cli.test.js +0 -92
  269. package/pi-extension/tests/provider-support/native.test.js +0 -183
  270. package/pi-extension/tests/settings/settings-tui.test.js +0 -243
  271. package/pi-extension/tsconfig.json +0 -16
  272. package/runtime/prompts/context-virtualization.md +0 -3
  273. package/runtime/prompts/conversation-history.md +0 -3
  274. package/skills/design-for-depth/references/software-design-philosophy.md +0 -202
  275. /package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/budget.js +0 -0
  276. /package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/render.js +0 -0
@@ -0,0 +1,47 @@
1
+ # Helper Mode
2
+
3
+ Judgment for placing work when Runtime State shows `Delegation: helper`. The core skill's Rules still apply.
4
+
5
+ Helper mode is for the best output quality. Coordinator implements; Helper takes everything that does not need Coordinator-level reasoning. There is no Executor to invoke or simulate.
6
+
7
+ ## Delegate By Default
8
+
9
+ Goal: Coordinator's premium compute goes to the work that needs it, and nothing else.
10
+
11
+ Default: delegate a step unless it needs Coordinator-level reasoning. Keep that category narrow:
12
+
13
+ - governing decisions and design;
14
+ - substantive implementation, meaning changes whose behavior or failure needs engineering ownership;
15
+ - the conversation with the user.
16
+
17
+ Helper takes the rest: gathering sources and skills, investigating bounded questions, preparing authorized setup, running existing checks and validations, separate record maintenance, and straightforward settled changes that are local, reversible, and easy to check. Helper can reason, compare evidence, spot contradictions, and choose local mechanics; it is not limited to copying facts.
18
+
19
+ The failure to prevent is under-delegation: classifying every step as Coordinator-level, so Coordinator does all the gathering, checking, and bookkeeping itself and the mode saves nothing.
20
+
21
+ ## Do Not Split What Belongs Together
22
+
23
+ Goal: handoffs save more than they cost.
24
+
25
+ Keep a tightly coupled edit, check, and interpret loop with Coordinator. Moving each check to Helper adds a contract, a ramp-up, and a return, and forces Helper to rebuild the context Coordinator already holds.
26
+
27
+ Hand off results that stand on their own:
28
+
29
+ | Situation | Placement |
30
+ | --- | --- |
31
+ | Before implementing, the sources, callers, and conventions for the planned change need gathering. | Helper gathers; Coordinator implements from the result. |
32
+ | Mid-implementation, Coordinator wants to know which acceptance requirements the candidate meets, which lack a check, and which test edits changed coverage. | Helper runs a read-only cross-check against the Slice's acceptance requirements and returns without patching. |
33
+ | After a feature lands, several record entries, a validation run, and a formatting pass are due. | Helper, as one assignment. |
34
+ | Coordinator just ran a failing test and knows the fix. | Coordinator fixes and reruns; no handoff. |
35
+ | One line of the Working Record needs updating in the middle of Coordinator's own work. | Coordinator updates it; a handoff would cost more than the edit. |
36
+
37
+ If Helper reaches substantive work outside its assignment, it returns findings and partial state, and Coordinator takes the next decision.
38
+
39
+ ## Route Preparation
40
+
41
+ Helper gathers; Coordinator implements. Gathered evidence must reach Coordinator: with projection on, Helper selects it at return; with projection off, Coordinator sees Helper's work in ordinary history. Coordinator forms the execution forecast itself.
42
+
43
+ ## Coordinator's Own Production
44
+
45
+ Coordinator's direct implementation passes through no handoff, and handoffs are part of how routing keeps long work on course. Rely on Execute Work's forecast and on Workflow's check before each continuation: does the next change meet a requirement, repair a demonstrated defect, or only add an optional guarantee? Do not invent assignments for your own work to recreate that boundary, and use no ACT_BOUNDED; direct production is what this mode is for.
46
+
47
+ Coordinator may update the Working Record directly as part of its own work. When closing a Slice, fold the writeback into Helper work already going out, or do it directly when it is one small update.
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: "compaction"
3
+ description: "Use when Freeflow says compaction is due or the user asks to compact: prepare what the conversation needs to continue, then compact with freeflow_compact."
4
+ ---
5
+
6
+ # Compaction
7
+
8
+ Compaction replaces the conversation with what you write, and starts a new cycle: the stretch of conversation until the next compaction. The next cycle starts from your summary, the Working Record and what it points to, the carried context, and the lines Freeflow adds itself; everything else leaves your context, this skill included. Most drift after compaction comes from a summary that lost something the next step needed.
9
+
10
+ The summary works like a Working Record ([Track Work](../../skills/track-work/SKILL.md)) for one cycle. Ask Track Work's question: if context were lost now, what would the next context need that it could not recover from the Working Record, its defining artifacts, the workspace, or the carried context? Write that, and nothing more. Concise is not lossy: keep a detail when removing it could change the next action.
11
+
12
+ ## Rules
13
+
14
+ The Rules are binding; if one cannot be met, stop and say why. The rest of this skill is judgment: follow its goal, and adapt when a different choice serves it better.
15
+
16
+ - With a Working Record, update it first (Track Work, "Prepare For A Context Boundary"), then write the summary, so the two agree. Name the record's path in the summary: Freeflow never names one, and recovery starts from it.
17
+ - Compaction is a context boundary, not a Slice transition or a Checkpoint. Do not rush, close, or pause a Slice to compact, claim an unfinished check passed, or guess the outcome of a running operation.
18
+ - Never write a requested, reported, or expected result as observed. Name every partial or uncommitted change, unverified result, running command, and obligation still waiting on its trigger.
19
+ - Keep exact: paths, identifiers, commands, error text, numbers, and the user's words wherever wording matters. Never paraphrase a decision or a constraint.
20
+ - Material that exists only in the conversation, such as a pasted file or a long message, leaves with it. With a Working Record, save it under the task's `sources/` and point to it; without one, quote what matters in the summary.
21
+ - Under Cognitive Routing with projection, the Coordinator does not compact: its view leaves out what workers did. Delegate an assignment whose contract says to compact with `freeflow_compact` and then return with `freeflow_return`, plus any other work it covers: after compacting, the worker sees the contract again but not its own `freeflow_compact` call. A worker's summary covers the whole session: the user's requests, the Coordinator's decisions, and the state of other work.
22
+
23
+ ## When to compact
24
+
25
+ Goal: compact where stopping loses nothing that is not written down. That is a safe point: a finished step whose result you know, such as a check you ran and read, a complete set of edits, or a written report. Halfway through an edit set, with a command still running, or partway through a batch of reads you need together is not one.
26
+
27
+ - At Freeflow's first notice ("compaction is due soon"): if you are at a safe point, compact now. If your work ends within a step or two, with a final answer or a worker's return, finish it instead. Otherwise finish the current step, start nothing large, then compact.
28
+ - At "compact now", or when the user asks: the end of your current step is the safe point. If the step cannot end soon, write its partial state into the record or summary and compact. Under Cognitive Routing a worker compacts before returning: the Coordinator and the next assignment continue the same history, so a return does not stop its growth.
29
+
30
+ ## The summary
31
+
32
+ The previous cycle's summary is at the top of your context. Fold what still holds into the new one; drop what is done or no longer matters. Write state, not a story: what is true now, not the order things happened in. Leave out what the Working Record holds and what Freeflow states itself: the cycle, the routing profile, running background commands, and the files read and changed.
33
+
34
+ Read [Summary Format](references/summary-format.md) before writing, and use the shape that matches the work:
35
+
36
+ - **With a Working Record**, the record holds the task. The record-backed shape (`Task`, `Now`, `In flight`, `Next steps`) lets a fresh context continue the current step correctly on its own; the record lets it continue the task.
37
+ - **Without one**, the summary is the record for this cycle, in the record-shaped shape: the record's own headings.
38
+
39
+ Compaction never creates a record; whether a task needs one is decided at its start or when facts change its scope.
40
+
41
+ The limit is about 8,000 tokens. Most summaries need far less. If `freeflow_compact` refuses the call, fix what it names and call it again.
42
+
43
+ ## What to carry
44
+
45
+ The notice gives the budget. Freeflow carries the newest results of your work in progress itself (under Cognitive Routing, those of your current assignment; otherwise, those of this cycle), filling whatever budget your picks leave, and lists the rest by ref. Pick only what that misses and the next step needs in full: older output you are working from (by routing ref, such as `ctx:1a2b3c4d`, when Cognitive Routing is on; otherwise by the id in the notice's list) and files you are changing (line ranges for large files), which are read fresh at compaction. Leave out what is cheap to re-read or already in the summary or record. The user's latest messages are carried for you. When the notice says context reuse is off, pick nothing.
46
+
47
+ ## After compaction
48
+
49
+ This skill leaves your context with the rest of the conversation. Freeflow's recovery message, right after the carried context, says how to recover; follow it.
@@ -0,0 +1,239 @@
1
+ # Compaction Summary Format
2
+
3
+ Read this before writing a compaction summary. The [compaction skill](../SKILL.md) owns what is worth keeping; this reference owns the exact shape of the summary passed to `freeflow_compact`, and is binding as written.
4
+
5
+ ## Two shapes
6
+
7
+ The shape depends on one fact: whether the work has a Working Record.
8
+
9
+ | Work has a Working Record | Shape | Why |
10
+ | --- | --- | --- |
11
+ | Yes | **Record-backed**: `Task`, `Now`, `In flight`, `Next steps` | The record already holds the task. The summary holds only what sits below the record's granularity. |
12
+ | No | **Record-shaped**: the record's headings | The summary is the only task memory for the next cycle, so it uses the record's structure. |
13
+
14
+ Compaction never creates a record. Whether a task needs one is decided at its start or when facts change its scope.
15
+
16
+ ## Field syntax
17
+
18
+ - Each heading is a level-two heading (`## Now`), in the order given, every heading present.
19
+ - Write `(none)` under a heading with nothing to say.
20
+ - Bullets, one fact per bullet. Keep a bullet short unless removing detail could change the next action.
21
+ - Exact values go in backticks: paths, identifiers, commands, error text, numbers.
22
+ - Quote the user's words in quotation marks when wording matters.
23
+ - Mark status inline when it is not settled: `(tentative)`, `(unverified)`, `(superseded by …)`.
24
+ - No narrative: write what is true now, not the order things happened in.
25
+ - About 8,000 tokens at most. Most summaries need far less.
26
+
27
+ Before calling `freeflow_compact`, check the summary as a whole: would a fresh context reading only it (and, when there is one, the record) choose the same next step you would? If not, add what it would need.
28
+
29
+ ## Record-backed shape
30
+
31
+ The summary must let a fresh context continue the **current step** correctly on its own; the record lets it continue the **task**. Write the summary right after updating the record (Track Work, "Prepare For A Context Boundary"), so the two agree. If they ever disagree, the record and live state win.
32
+
33
+ ```markdown
34
+ ## Task
35
+ - Record: `<path to record.md>` — recover it first
36
+ - Goal: <one line>
37
+ - Slice: <S-NNN> "<title>", <state>
38
+ - Governing now: <only the decisions, constraints, and authority the next steps depend on>
39
+
40
+ ## Now
41
+ - <the step in progress and exactly how far it got: done, half-done, and where the half-done part is>
42
+
43
+ ## In flight
44
+ - Observed: <result> — <exact evidence>
45
+ - Hypothesis: <what is being tested> (unverified)
46
+ - Dropped: <approach> — <why it failed>
47
+ - Pending: <what is running or waiting> — <what it waits on>
48
+
49
+ ## Next steps
50
+ 1. <the immediate concrete, checkable step>
51
+ 2. <...>
52
+ ```
53
+
54
+ | Section | Holds | Leaves out | Check |
55
+ | --- | --- | --- | --- |
56
+ | Task | `Record:` the Working Record's path, which Freeflow does not state; `Goal:` in one line; `Slice:` with ID, title, and state; `Governing now:` only the decisions, constraints, and authority the next steps depend on, quoting the user where wording matters. | Settled facts, decisions, and boundaries the next steps do not touch; they stay in the record. | Could the next steps break a rule that is not listed here? |
57
+ | Now | The step in progress and exactly how far it got. | The history of earlier steps. | Could someone point to the exact spot to resume? |
58
+ | In flight | Typed bullets: `Observed:` a result with its exact evidence; `Hypothesis:` what is being tested, marked unverified; `Dropped:` an approach and why it failed; `Pending:` what is running or waiting, and on what. | Anything the record or Freeflow's own lines already hold. | Would losing this bullet make the next context repeat work or a mistake? |
59
+ | Next steps | Ordered, concrete, checkable steps: the immediate ones. | The task's longer route; that is the record's Future Work. | Can a fresh context do step 1 right now? |
60
+
61
+ ## Record-shaped shape
62
+
63
+ Each heading means exactly what it means in the Working Record format ([Working Record Format](../../../skills/track-work/references/working-record-format.md)). `Current work` stands in for the Current Slice: in-progress work, partial or uncommitted effects, unverified results, running commands, and obligations with their trigger, using the same `Observed:`, `Dropped:`, and `Pending:` labels where they fit. `Recovery sources` names only what the next cycle must read again: what you carry is read at compaction and arrives with the summary, so leave it out.
64
+
65
+ ```markdown
66
+ ## Goal
67
+ - <the outcome the user wants>
68
+
69
+ ## What defines this task
70
+ - <pointer to a spec, plan, issue, or brief, and what it establishes>
71
+
72
+ ## Settled
73
+ - <fact or accepted understanding>
74
+ - <decision the user made> — <reason>
75
+
76
+ ## Tentative
77
+ - <hypothesis or provisional approach>
78
+
79
+ ## Open
80
+ - <unresolved question, including questions waiting on the user>
81
+
82
+ ## Boundaries
83
+ - <what the user authorized>; <what still needs asking>; <scope limits and stop conditions>
84
+
85
+ ## Current direction
86
+ - <the remaining approach and why>
87
+
88
+ ## Current work
89
+ - <in progress; partial or uncommitted effects; unverified results; running commands>
90
+ - <obligation> — when <trigger>
91
+
92
+ ## Recovery sources
93
+ - <pointer> — <what it establishes, why to re-read it>
94
+
95
+ ## Next useful action
96
+ - <one action a fresh context can take>
97
+ ```
98
+
99
+ ## What the next cycle sees
100
+
101
+ Freeflow builds the new cycle from four pieces. The agent writes only the first part of the first piece.
102
+
103
+ 1. **The summary**, wrapped by Pi as a user message: `The conversation history before this point was compacted into the following summary: <summary>…</summary>`. Inside: the agent's summary, then `## Freeflow state at compaction`, which Freeflow writes.
104
+ 2. **The carried context:** the user's latest messages verbatim, then the carried files (read at compaction) and tool results, with files and read results numbered by file line.
105
+ 3. **The recovery message.**
106
+ 4. **Freeflow's Runtime State**, as on every request.
107
+
108
+ ## Example: record-backed
109
+
110
+ The task has a record at `.freeflow/tasks/task-014-http-retry/record.md`. Its Current Slice is "Add retry with backoff to the HTTP client", and its Next useful action is "Make the 429 test pass, then run the client suite".
111
+
112
+ What the agent passes as `summary`:
113
+
114
+ ```markdown
115
+ ## Task
116
+ - Record: `.freeflow/tasks/task-014-http-retry/record.md` — recover it first
117
+ - Goal: the HTTP client retries failed requests with backoff and respects `Retry-After`.
118
+ - Slice: S-003 "Add retry with backoff to the HTTP client", in progress
119
+ - Governing now: retry 429 and 5xx only; `Retry-After` overrides the computed delay (the user: "the API team says they ban clients that don't"); no commits without asking.
120
+
121
+ ## Now
122
+ - Mid-way through `retryWithBackoff` in `src/http/client.ts`: the retry loop and 503 path are done and passing; the 429 path ignores `Retry-After` and retries immediately.
123
+
124
+ ## In flight
125
+ - Observed: `npm test -- client.retry` → 7 passed, 1 failed: `retries 429 after Retry-After` expected ≥1000 ms, got 104 ms.
126
+ - Hypothesis: `sleep()` must use the fake clock in `test/helpers/clock.ts` (it advances only on `tick()`), or the test cannot observe the delay. (unverified)
127
+ - Dropped: calling `setTimeout` directly; the test hung on real time.
128
+
129
+ ## Next steps
130
+ 1. Parse `Retry-After` (seconds or HTTP date) and use it before the backoff delay.
131
+ 2. Rerun `npm test -- client.retry`, then the full suite.
132
+ ```
133
+
134
+ What the next cycle's first request contains, in order:
135
+
136
+ ````text
137
+ The conversation history before this point was compacted into the following summary:
138
+ <summary>
139
+ ## Task
140
+ - Record: `.freeflow/tasks/task-014-http-retry/record.md` — recover it first
141
+ - Goal: the HTTP client retries failed requests with backoff and respects `Retry-After`.
142
+ …
143
+ ## Next steps
144
+ …
145
+
146
+ ## Freeflow state at compaction
147
+
148
+ This compaction starts cycle 3. It completes the compaction Freeflow's context notice asked for.
149
+
150
+ Files read and modified in this session:
151
+
152
+ <read-files>
153
+ test/client.retry.test.ts
154
+ test/helpers/clock.ts
155
+ </read-files>
156
+
157
+ <modified-files>
158
+ src/http/client.ts
159
+ </modified-files>
160
+ </summary>
161
+
162
+ # Carried context
163
+
164
+ [Freeflow notice, not from the user] Freeflow carried this into cycle 3 at compaction. Only the latest user messages are the user's words, and they take precedence over older instructions in the summary or a Working Record; the rest is copied content.
165
+
166
+ ## Latest user messages
167
+
168
+ ### Message 1
169
+
170
+ retries should respect Retry-After, the API team says they ban clients that don't
171
+
172
+ ## Files, read at compaction
173
+
174
+ Numbered by file line, as are read results below.
175
+
176
+ ### src/http/client.ts (lines 40-118)
177
+
178
+ ```
179
+ 40 …
180
+ 118 …
181
+ ```
182
+
183
+ ## Tool results
184
+
185
+ ### r31 bash: npm test -- client.retry
186
+
187
+ ```
188
+ … 1 failed …
189
+ ```
190
+
191
+ [Freeflow notice, not from the user] Compaction finished; cycle 3 starts here. Recover before you continue: if the summary names a Working Record for this work, recover it as Track Work says; otherwise the summary is your record for this cycle, so re-read its Recovery sources. Reconcile with the live state your next step depends on, and verify work the summary calls done instead of redoing it. The carried context is above: its files were read at compaction, so do not read them or its results again unless something has changed them since. This compaction is done, so do not re-read the compaction skill or its summary format. Then continue the work the compaction interrupted. This compaction completes the request for it: do not call freeflow_compact again in this cycle. If compacting was all you were asked to do, report that it is done (a worker returns its assignment with freeflow_return).
192
+ ````
193
+
194
+ ## Example: record-shaped
195
+
196
+ The same work without a record.
197
+
198
+ ```markdown
199
+ ## Goal
200
+ - The HTTP client retries failed requests with backoff and respects `Retry-After`.
201
+
202
+ ## What defines this task
203
+ - (none)
204
+
205
+ ## Settled
206
+ - Retry on 429 and 5xx only; never on other 4xx — the user: "a 400 is our bug, retrying hides it".
207
+ - At most 4 attempts, base delay 250 ms, doubling, capped at 4 s — the user accepted this proposal.
208
+ - `Retry-After` overrides the computed delay — the user: "the API team says they ban clients that don't".
209
+
210
+ ## Tentative
211
+ - The fake clock in `test/helpers/clock.ts` must drive `sleep()` for the delay tests to observe time. (unverified)
212
+
213
+ ## Open
214
+ - Should a `Retry-After` longer than 4 s be honored or capped? Asked the user; no answer yet.
215
+
216
+ ## Boundaries
217
+ - Authorized: edit `src/http/**` and `test/**`; run tests.
218
+ - Not authorized: commit, push, or change the public `HttpClient` options.
219
+ - Stop and ask if the fix needs a new dependency.
220
+
221
+ ## Current direction
222
+ - Finish the 429 path in `retryWithBackoff`, then run the full client suite.
223
+
224
+ ## Current work
225
+ - `src/http/client.ts`: retry loop and 5xx path done and passing; 429 path in progress, uncommitted.
226
+ - Observed: `npm test -- client.retry` → 7 passed, 1 failed: `retries 429 after Retry-After` expected ≥1000 ms, got 104 ms.
227
+ - Dropped: calling `setTimeout` directly; the test hung on real time.
228
+ - Run `npm test` (full suite) — when the retry tests pass.
229
+
230
+ ## Recovery sources
231
+ - `src/http/client.ts` lines 40–118 — the retry loop being changed.
232
+ - `test/client.retry.test.ts` — the expected delays per status.
233
+ - `test/helpers/clock.ts` — how the fake clock advances.
234
+
235
+ ## Next useful action
236
+ - Parse `Retry-After` (seconds or HTTP date) and use it before the backoff delay; rerun `npm test -- client.retry`.
237
+ ```
238
+
239
+ The next cycle receives it the same way, with the same recovery message. The summary names no record, so the summary is the record for this cycle.
@@ -30,6 +30,10 @@
30
30
  "command": "/write-plan",
31
31
  "skill": "write-plan"
32
32
  },
33
+ {
34
+ "command": "/write-docs",
35
+ "skill": "write-docs"
36
+ },
33
37
  {
34
38
  "command": "/execute-work",
35
39
  "skill": "execute-work"
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "freeflow",
3
- "version": "0.7.3",
3
+ "version": "0.8.0",
4
4
  "description": "Feedback-based control system for coding agents."
5
5
  }
@@ -66,31 +66,27 @@ function isRecord(value) {
66
66
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
67
67
  }
68
68
 
69
+ function removedContextConfigError(value, filePath) {
70
+ const removedKeys = ["contextVirtualization", "conversationHistory"].filter((key) => Object.hasOwn(value, key));
71
+ return removedKeys.length > 0
72
+ ? `Removed Freeflow context setting(s) in ${filePath}: ${removedKeys.join(", ")}. Delete those keys before using Freeflow.`
73
+ : null;
74
+ }
75
+
69
76
  function validateCoreConfigFields(value) {
70
77
  if (Object.hasOwn(value, "enabled") && typeof value.enabled !== "boolean") {
71
78
  return "enabled must be a boolean";
72
79
  }
73
- if (Object.hasOwn(value, "contextVirtualization") && typeof value.contextVirtualization !== "boolean") {
74
- return "contextVirtualization must be a boolean";
75
- }
76
- if (Object.hasOwn(value, "conversationHistory") && typeof value.conversationHistory !== "boolean") {
77
- return "conversationHistory must be a boolean";
78
- }
79
80
  return null;
80
81
  }
81
82
 
82
83
  function isValidSetupConfig(value) {
83
84
  if (!isRecord(value)) return "repository config must be a JSON object";
84
85
 
85
- const allowedKeys = new Set([
86
- "enabled",
87
- "contextVirtualization",
88
- "conversationHistory",
89
- "outputRouter",
90
- "observedRouting",
91
- "scriptTransform",
92
- "cognitiveRouting",
93
- ]);
86
+ const removedContextError = removedContextConfigError(value, ".freeflow/config.json");
87
+ if (removedContextError) return removedContextError;
88
+
89
+ const allowedKeys = new Set(["enabled", "outputRouter", "observedRouting", "scriptTransform", "cognitiveRouting"]);
94
90
  if (!Object.keys(value).every((key) => allowedKeys.has(key))) {
95
91
  return "repository config contains unsupported top-level keys";
96
92
  }
@@ -107,13 +103,10 @@ function isValidSetupConfig(value) {
107
103
  function isValidLocalConfig(value) {
108
104
  if (!isRecord(value)) return "local config must be a JSON object";
109
105
 
110
- const allowedKeys = new Set([
111
- "enabled",
112
- "processing",
113
- "cognitiveRouting",
114
- "contextVirtualization",
115
- "conversationHistory",
116
- ]);
106
+ const removedContextError = removedContextConfigError(value, ".freeflow/local.json");
107
+ if (removedContextError) return removedContextError;
108
+
109
+ const allowedKeys = new Set(["enabled", "processing", "cognitiveRouting"]);
117
110
  if (!Object.keys(value).every((key) => allowedKeys.has(key))) {
118
111
  return "local config contains unsupported top-level keys";
119
112
  }
@@ -127,11 +120,7 @@ function resolveLayeredValue(repository, local, key, fallback) {
127
120
  }
128
121
 
129
122
  function resolveCoreConfig(repository, local) {
130
- return {
131
- enabled: resolveLayeredValue(repository, local, "enabled", true),
132
- contextVirtualization: resolveLayeredValue(repository, local, "contextVirtualization", false),
133
- conversationHistory: resolveLayeredValue(repository, local, "conversationHistory", false),
134
- };
123
+ return { enabled: resolveLayeredValue(repository, local, "enabled", true) };
135
124
  }
136
125
 
137
126
  export function readConfig(root) {
@@ -151,8 +140,6 @@ export function readConfig(root) {
151
140
  localValid,
152
141
  error: repository.valid ? local.error : repository.error,
153
142
  enabled,
154
- contextVirtualizationEnabled: enabled && core.contextVirtualization,
155
- conversationHistoryEnabled: enabled && core.conversationHistory,
156
143
  };
157
144
  }
158
145
 
@@ -173,7 +160,18 @@ function runtimeStateContext() {
173
160
 
174
161
  export function renderRuntimeContext(root) {
175
162
  const config = readConfig(root);
176
- if (!config.valid || !config.enabled) return "";
163
+ if (!config.valid) {
164
+ if (config.error?.startsWith("Removed Freeflow context setting(s) in ")) {
165
+ return [
166
+ "# Freeflow Configuration Error",
167
+ "",
168
+ `Freeflow is inactive. ${config.error}`,
169
+ "Remove the named key(s), then restart the session.",
170
+ ].join("\n");
171
+ }
172
+ return "";
173
+ }
174
+ if (!config.enabled) return "";
177
175
 
178
176
  const { corePrompt, interactionContract } = loadRuntimeContext();
179
177
  return [corePrompt, interactionContract, runtimeStateContext()].filter(Boolean).join("\n\n");
@@ -0,0 +1,55 @@
1
+ Apache License
2
+
3
+ Version 2.0, January 2004
4
+
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
16
+
17
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
18
+
19
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
20
+
21
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
22
+
23
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
24
+
25
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
26
+
27
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
28
+
29
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
30
+
31
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
32
+
33
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
34
+
35
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
36
+
37
+ You must give any other recipients of the Work or Derivative Works a copy of this License; and
38
+
39
+ You must cause any modified files to carry prominent notices stating that You changed the files; and
40
+
41
+ You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
42
+
43
+ If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44
+
45
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46
+
47
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48
+
49
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50
+
51
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52
+
53
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
54
+
55
+ END OF TERMS AND CONDITIONS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hassangameryt/freeflow",
3
- "version": "0.7.3",
3
+ "version": "0.8.0",
4
4
  "description": "Feedback-based control system for coding agents.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -22,7 +22,7 @@
22
22
  "build:pi-extension": "node -e \"require('node:fs').rmSync('pi-extension/dist', { recursive: true, force: true })\" && tsc -p pi-extension/tsconfig.json && npm run format:pi-extension-dist",
23
23
  "build": "npm run build:pi-extension",
24
24
  "typecheck": "tsc -p pi-extension/tsconfig.json --noEmit",
25
- "check": "npm run typecheck && npm run check:source && npm run check:host-manifests && npm run check:changelog && npm run check:release-workflow && npm run check:docs && npm run format:check && npm run check:release-version && npm run check:commands && npm run check:activation && npm run check:runtime && npm run check:package",
25
+ "check": "npm run typecheck && npm run check:source && npm run check:host-manifests && npm run check:changelog && npm run check:release-workflow && npm run check:docs && npm run format:check && npm run check:release-version && npm run check:commands && npm run check:activation && npm run check:runtime && npm run check:package && npm run check:eval-coverage",
26
26
  "check:source": "node scripts/validation/check-source-files.mjs",
27
27
  "check:host-manifests": "node scripts/validation/check-host-manifests.mjs",
28
28
  "check:changelog": "node scripts/validation/check-changelog.mjs --structure",
@@ -33,7 +33,9 @@
33
33
  "check:activation": "scripts/validation/check-activation-contract.sh",
34
34
  "check:runtime": "hooks/tests/check-runtime-context-hook.sh",
35
35
  "check:package": "node scripts/validation/check-package.mjs",
36
+ "check:eval-coverage": "node scripts/validation/check-eval-coverage.mjs",
36
37
  "check:release-metadata": "scripts/validation/validate-release-metadata.sh --mode prepublish",
38
+ "perf:request": "node scripts/perf/request-overhead.mjs",
37
39
  "test:pi-extension": "npm run build && node --test $(find pi-extension/tests -name '*.test.js' | sort)",
38
40
  "test:host-manifests": "node --test scripts/validation/check-host-manifests.test.mjs hooks/tests/check-host-adapters.test.mjs",
39
41
  "test:skill-author": "node --test $(find .skill-eval/write-skill/tests -name '*.test.mjs' | sort)",
@@ -44,6 +46,7 @@
44
46
  "test:changelog": "node --test scripts/validation/check-changelog.test.mjs",
45
47
  "test:release-workflow": "node --test scripts/validation/check-release-workflow.test.mjs",
46
48
  "test:docs": "node --test scripts/validation/check-docs.test.mjs",
49
+ "test:eval-coverage": "node --test scripts/validation/check-eval-coverage.test.mjs",
47
50
  "release:prepare": "node scripts/release.mjs",
48
51
  "release:notes": "node scripts/release-notes.mjs",
49
52
  "snapshot:refresh": "node scripts/freeflow-snapshot.mjs"
@@ -87,24 +90,34 @@
87
90
  ".cursor-plugin/**",
88
91
  "com.github.copilot/**",
89
92
  "LICENSE",
93
+ "NOTICE",
94
+ "licenses/**",
90
95
  "README.md",
91
96
  "assets/**",
92
97
  "capabilities/**",
93
98
  "runtime/**",
94
99
  "command-surface.json",
95
- "hooks/**",
96
- "pi-extension/**",
100
+ "hooks/adapters/**",
101
+ "hooks/claude/hooks.json",
102
+ "hooks/codex/hooks.json",
103
+ "hooks/cursor/hooks.json",
104
+ "hooks/freeflow-runtime-context.mjs",
105
+ "hooks/hooks.json",
106
+ "hooks/shared/runtime-context.mjs",
107
+ "pi-extension/freeflow/**",
108
+ "pi-extension/dist/**",
97
109
  "skills/**"
98
110
  ],
99
111
  "peerDependencies": {
100
- "@earendil-works/pi-coding-agent": "*",
101
- "@earendil-works/pi-tui": "*"
112
+ "@earendil-works/pi-coding-agent": ">=0.99.1",
113
+ "@earendil-works/pi-tui": ">=0.99.1"
102
114
  },
103
115
  "devDependencies": {
104
- "@earendil-works/pi-coding-agent": "0.85.1",
105
- "@earendil-works/pi-tui": "0.85.1",
116
+ "@earendil-works/pi-coding-agent": "1.0.1",
117
+ "@earendil-works/pi-tui": "1.0.1",
106
118
  "@types/node": "^22.15.30",
107
119
  "prettier": "3.9.5",
108
120
  "typescript": "^5.8.3"
109
- }
121
+ },
122
+ "dependencies": {}
110
123
  }
@@ -0,0 +1,41 @@
1
+ # Freeflow Pi Extension
2
+
3
+ The Pi integration of Freeflow. Pi loads it as an extension and it adds Freeflow's runtime context, Cognitive Routing, Tool Execution, provider prompt-cache support, the `/freeflow` command, and Freeflow's skill commands.
4
+
5
+ Supported hosts: Pi `>=0.99.1` (developed and tested against the version pinned in the root `package.json`). The other hosts Freeflow supports load skills and hooks only; this directory is Pi-specific.
6
+
7
+ ## Layout
8
+
9
+ | Path | What it is |
10
+ |---|---|
11
+ | [`src/`](src/README.md) | TypeScript source. Edit here. |
12
+ | `dist/` | Compiled JavaScript built from `src/`. Committed and shipped in the npm package; never edit by hand. |
13
+ | [`freeflow/`](freeflow/README.md) | The entry point Pi loads (`package.json` → `pi.extensions`). Re-exports `dist/index.js`. |
14
+ | [`tests/`](tests/README.md) | Node test suites, run against `dist/`. |
15
+ | `tsconfig.json` | Compiles `src/` into `dist/`. |
16
+
17
+ ## Build and test
18
+
19
+ Run from the repository root:
20
+
21
+ ```bash
22
+ npm run build # src/ → dist/, then formats dist/
23
+ npm run typecheck # type errors only, no output
24
+ npm run test:pi-extension # builds, then runs every tests/**/*.test.js
25
+ npm run check # the full deterministic gate used in CI
26
+ ```
27
+
28
+ Commit `dist/` together with the `src/` change that produced it. Pi development uses a committed snapshot of the repository, not this working tree (see `AGENTS.md`, "Development Snapshot Boundary").
29
+
30
+ ## Rules that apply everywhere here
31
+
32
+ - **Performance.** Keep per-request and per-turn work small and independent of session length; keep `tests/integration/request-path-budget.test.js` passing. See [Performance](../dev-docs/guides/performance.md).
33
+ - **Prompt cache.** Never change content a provider already cached, keep the Freeflow system section and tool definitions fixed, and append new content at the end. Every request-assembly change needs a test in which a later request starts with the earlier one. See [Prompt cache rules](../dev-docs/guides/prompt-cache.md).
34
+ - **Host source.** Work from a pinned upstream Pi checkout, not installed or cached docs (`AGENTS.md`, "External Host Source Provenance").
35
+ - **Pi imports.** Pi provides `@earendil-works/pi-coding-agent` and `@earendil-works/pi-tui` to extensions at runtime. They are peer dependencies, never bundled.
36
+
37
+ ## Further reading
38
+
39
+ - [Pi integration](../plugin-docs/integrations/pi.md)
40
+ - [Architecture](../dev-docs/README.md) and [Prompt architecture](../dev-docs/subsystems/prompt-assembly.md)
41
+ - [Cognitive Routing](../plugin-docs/capabilities/cognitive-routing.md) and [Tool Execution](../plugin-docs/capabilities/tool-execution.md)