@hassangameryt/freeflow 0.7.0 → 0.7.2

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 (136) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +2 -1
  3. package/.codex-plugin/plugin.json +2 -2
  4. package/.cursor-plugin/plugin.json +25 -0
  5. package/README.md +57 -26
  6. package/capabilities/cognitive-routing/SKILL.md +94 -311
  7. package/com.github.copilot/hooks/hooks.json +11 -0
  8. package/command-surface.json +7 -1
  9. package/gemini-extension.json +5 -0
  10. package/hooks/adapters/claude-session-start.mjs +16 -0
  11. package/hooks/adapters/codex-session-start.mjs +16 -0
  12. package/hooks/adapters/copilot-session-start.mjs +13 -0
  13. package/hooks/adapters/cursor-session-start.mjs +13 -0
  14. package/hooks/adapters/gemini-session-start.mjs +15 -0
  15. package/hooks/claude/hooks.json +18 -0
  16. package/hooks/codex/hooks.json +18 -0
  17. package/hooks/cursor/hooks.json +9 -0
  18. package/hooks/freeflow-runtime-context.mjs +3 -215
  19. package/hooks/hooks.json +4 -5
  20. package/hooks/shared/runtime-context.mjs +210 -0
  21. package/hooks/tests/check-host-adapters.test.mjs +82 -0
  22. package/hooks/tests/check-runtime-context-hook.sh +34 -3
  23. package/package.json +20 -6
  24. package/pi-extension/dist/cognitive-routing-v2/budget.js +42 -0
  25. package/pi-extension/dist/cognitive-routing-v2/config.js +120 -0
  26. package/pi-extension/dist/cognitive-routing-v2/projection.js +321 -0
  27. package/pi-extension/dist/cognitive-routing-v2/render.js +231 -0
  28. package/pi-extension/dist/cognitive-routing-v2/runtime.js +1585 -0
  29. package/pi-extension/dist/cognitive-routing-v2/schemas.js +107 -0
  30. package/pi-extension/dist/cognitive-routing-v2/state.js +612 -0
  31. package/pi-extension/dist/cognitive-routing-v2/tools.js +91 -0
  32. package/pi-extension/dist/cognitive-routing-v2/types.js +44 -0
  33. package/pi-extension/dist/freeflow-context/tool.js +5 -0
  34. package/pi-extension/dist/index.js +279 -624
  35. package/pi-extension/dist/runtime/runtime-context.js +63 -13
  36. package/pi-extension/dist/session-sources/events.js +195 -0
  37. package/pi-extension/dist/session-sources/read-only-session.js +148 -0
  38. package/pi-extension/dist/session-sources/sources.js +233 -0
  39. package/pi-extension/dist/settings/settings-ui.js +44 -117
  40. package/pi-extension/src/cognitive-routing-v2/budget.ts +42 -0
  41. package/pi-extension/src/cognitive-routing-v2/config.ts +143 -0
  42. package/pi-extension/src/cognitive-routing-v2/projection.ts +365 -0
  43. package/pi-extension/src/cognitive-routing-v2/render.ts +256 -0
  44. package/pi-extension/src/cognitive-routing-v2/runtime.ts +1634 -0
  45. package/pi-extension/src/cognitive-routing-v2/schemas.ts +109 -0
  46. package/pi-extension/src/cognitive-routing-v2/state.ts +622 -0
  47. package/pi-extension/src/cognitive-routing-v2/tools.ts +93 -0
  48. package/pi-extension/src/cognitive-routing-v2/types.ts +222 -0
  49. package/pi-extension/src/freeflow-context/tool.ts +5 -0
  50. package/pi-extension/src/index.ts +285 -674
  51. package/pi-extension/src/runtime/runtime-context.ts +75 -14
  52. package/pi-extension/src/session-sources/events.ts +208 -0
  53. package/pi-extension/src/session-sources/read-only-session.ts +170 -0
  54. package/pi-extension/src/session-sources/sources.ts +263 -0
  55. package/pi-extension/src/settings/settings-ui.ts +54 -131
  56. package/pi-extension/tests/cognitive-routing-v2/communication.test.js +484 -0
  57. package/pi-extension/tests/cognitive-routing-v2/compaction-input.test.js +183 -0
  58. package/pi-extension/tests/cognitive-routing-v2/native.test.js +441 -0
  59. package/pi-extension/tests/cognitive-routing-v2/performance.test.js +87 -0
  60. package/pi-extension/tests/cognitive-routing-v2/persistence.test.js +245 -0
  61. package/pi-extension/tests/cognitive-routing-v2/projection.test.js +241 -0
  62. package/pi-extension/tests/cognitive-routing-v2/recovery.test.js +236 -0
  63. package/pi-extension/tests/cognitive-routing-v2/render.test.js +230 -0
  64. package/pi-extension/tests/cognitive-routing-v2/runtime.test.js +153 -0
  65. package/pi-extension/tests/cognitive-routing-v2/stabilization.test.js +521 -0
  66. package/pi-extension/tests/cognitive-routing-v2/state.test.js +275 -0
  67. package/pi-extension/tests/context-virtualization/extension.test.js +16 -0
  68. package/pi-extension/tests/fixtures/routing-native.js +188 -0
  69. package/pi-extension/tests/integration/mode-free-core.test.js +3 -2
  70. package/pi-extension/tests/integration/pi-extension.test.js +154 -37
  71. package/pi-extension/tests/integration/prompt-architecture.test.js +87 -6
  72. package/pi-extension/tests/integration/unaffected-regressions.test.js +77 -10
  73. package/plugin.json +33 -0
  74. package/runtime/prompts/cognitive-routing.md +4 -5
  75. package/runtime/prompts/core.md +51 -45
  76. package/runtime/prompts/interaction-contract.md +5 -5
  77. package/skills/action-selection/SKILL.md +57 -97
  78. package/skills/design-for-depth/SKILL.md +58 -193
  79. package/skills/design-for-depth/references/implementation-decisions.md +76 -0
  80. package/skills/diagnose-failure/SKILL.md +64 -196
  81. package/skills/discuss/SKILL.md +64 -123
  82. package/skills/discuss/references/discussion-continuity.md +7 -3
  83. package/skills/execute-work/SKILL.md +69 -88
  84. package/skills/execute-work/references/execute-work-edges.md +9 -3
  85. package/skills/handoff/SKILL.md +44 -54
  86. package/skills/handoff/references/handoff-templates.md +15 -6
  87. package/skills/review-artifact/SKILL.md +80 -127
  88. package/skills/review-artifact/references/independent-artifact-reviewer-contract.md +1 -1
  89. package/skills/review-work/SKILL.md +65 -115
  90. package/skills/review-work/references/independent-work-reviewer-contract.md +1 -1
  91. package/skills/simplify-code/SKILL.md +47 -100
  92. package/skills/track-work/SKILL.md +128 -119
  93. package/skills/track-work/references/working-record-format.md +14 -2
  94. package/skills/verify-work/SKILL.md +58 -62
  95. package/skills/verify-work/references/integration-evidence.md +4 -2
  96. package/skills/verify-work/references/test-design.md +89 -0
  97. package/skills/workflow/SKILL.md +73 -119
  98. package/skills/write-plan/SKILL.md +46 -77
  99. package/skills/write-plan/references/plan-shapes.md +5 -5
  100. package/skills/write-spec/SKILL.md +51 -63
  101. package/skills/write-spec/references/artifact-standards.md +2 -2
  102. package/skills/write-spec/references/decision-records.md +3 -2
  103. package/skills/write-spec/references/spec-shapes.md +15 -0
  104. package/pi-extension/dist/cognitive-routing/commands.js +0 -96
  105. package/pi-extension/dist/cognitive-routing/config.js +0 -232
  106. package/pi-extension/dist/cognitive-routing/controller.js +0 -1292
  107. package/pi-extension/dist/cognitive-routing/history.js +0 -451
  108. package/pi-extension/dist/cognitive-routing/host.js +0 -188
  109. package/pi-extension/dist/cognitive-routing/pi-routing-session.js +0 -414
  110. package/pi-extension/dist/cognitive-routing/pi-session-control.js +0 -320
  111. package/pi-extension/dist/cognitive-routing/runtime.js +0 -43
  112. package/pi-extension/dist/cognitive-routing/tool.js +0 -212
  113. package/pi-extension/dist/cognitive-routing/types.js +0 -6
  114. package/pi-extension/src/cognitive-routing/commands.ts +0 -129
  115. package/pi-extension/src/cognitive-routing/config.ts +0 -303
  116. package/pi-extension/src/cognitive-routing/controller.ts +0 -1628
  117. package/pi-extension/src/cognitive-routing/history.ts +0 -650
  118. package/pi-extension/src/cognitive-routing/host.ts +0 -266
  119. package/pi-extension/src/cognitive-routing/pi-routing-session.ts +0 -538
  120. package/pi-extension/src/cognitive-routing/pi-session-control.ts +0 -444
  121. package/pi-extension/src/cognitive-routing/runtime.ts +0 -57
  122. package/pi-extension/src/cognitive-routing/tool.ts +0 -273
  123. package/pi-extension/src/cognitive-routing/types.ts +0 -89
  124. package/pi-extension/tests/cognitive-routing/commands.test.js +0 -134
  125. package/pi-extension/tests/cognitive-routing/controller.test.js +0 -1128
  126. package/pi-extension/tests/cognitive-routing/extension-lifecycle.test.js +0 -1142
  127. package/pi-extension/tests/cognitive-routing/history.test.js +0 -274
  128. package/pi-extension/tests/cognitive-routing/host-identity.test.js +0 -63
  129. package/pi-extension/tests/cognitive-routing/pi-normal-lifecycle.test.js +0 -434
  130. package/pi-extension/tests/cognitive-routing/pi-session-control.test.js +0 -174
  131. package/pi-extension/tests/cognitive-routing/pi-session-history.test.js +0 -91
  132. package/pi-extension/tests/cognitive-routing/profile-resolution.test.js +0 -279
  133. package/pi-extension/tests/cognitive-routing/tool.test.js +0 -230
  134. package/skills/tdd/SKILL.md +0 -143
  135. package/skills/tdd/references/test-design.md +0 -96
  136. /package/pi-extension/tests/{cognitive-routing/host-fixture.js → fixtures/pi-host.js} +0 -0
@@ -1,123 +1,92 @@
1
1
  ---
2
2
  name: write-plan
3
- description: Use when writing or revising an implementation plan, execution plan, remediation plan, migration plan, or similar ordered plan.
3
+ description: "Use when writing or revising an implementation plan, execution plan, remediation plan, migration plan, or similar ordered plan."
4
4
  ---
5
5
 
6
6
  # Write Plan
7
7
 
8
- Write an ordered execution strategy that is expected to be followed.
8
+ Write a supported ordered strategy for an agreed outcome. Make its dependencies, actions, checks, and invalidation conditions clear without inventing requirements or pretending unknown later work is settled.
9
9
 
10
- A Plan defines intended phases, slices, dependencies, boundaries, and checks. It is not a Spec, progress report, task history, or rolling record.
10
+ A Plan describes intended execution. The Working Record preserves actual work, evolving state, and the next useful action. Neither creates authority by existing.
11
11
 
12
- ## Confirm The Work Is Ready To Plan
12
+ ## Plan Only What Is Understood Enough To Order
13
13
 
14
- Write a Plan when:
14
+ Use a durable Plan when the intended outcome and material decisions are settled, the approach and dependencies can be ordered without guessing, and the strategy needs to survive independently.
15
15
 
16
- - the intended outcome and scope are clear;
17
- - material user decisions and source conflicts are resolved;
18
- - the execution approach is understood well enough to order;
19
- - phases, slices, and dependencies can be stated without guessing;
20
- - expected checks are known or obtainable;
21
- - substantial branching or discovery is not expected.
16
+ Not every task needs one. A small correction can proceed from its request and supported approach. An evolving route with substantial branching belongs in [Track Work](../track-work/SKILL.md) as provisional Slices, not a confident long-form Plan.
22
17
 
23
- If direction or major alternatives remain unsettled, read [Discuss](../discuss/SKILL.md). If one user-owned choice or source conflict blocks planning, read [Decision Gate](../decision-gate/SKILL.md). If a reported failure lacks a supported cause or diagnostic loop, read [Diagnose Failure](../diagnose-failure/SKILL.md) instead of planning a guessed fix.
18
+ Use [Discuss](../discuss/SKILL.md) for unresolved direction or material alternatives, [Decision Gate](../decision-gate/SKILL.md) for a blocking owner choice or source conflict, and [Diagnose Failure](../diagnose-failure/SKILL.md) for a fix whose cause is unsupported. Do not encode the hoped-for answer as a planning assumption.
24
19
 
25
- Use [Track Work](../track-work/SKILL.md) when strategy is still evolving or actual execution, evidence, deviations, and current state need durable memory.
20
+ If the user asks about a Plan, answer rather than write one. If execution of the task is already authorized and a Plan is useful preparation, writing it need not create another approval stop. Preserve any review or user-return boundary actually selected.
26
21
 
27
- If the user asks about a Plan, answer instead of writing or revising one.
22
+ ## Establish The Current Basis
28
23
 
29
- ## Plan From Source
24
+ A separate Spec is not required when the request and accepted understanding are sufficiently clear. Otherwise consume the relevant Spec, issue, design, diagnosis, decision, or requirements, together with current code, tests, policies, ADRs, and external constraints where needed.
30
25
 
31
- A Plan may be written directly from sufficiently clear context; a separate Spec is not required.
26
+ Identify which accepted source version or amendment the Plan implements. A Working Record can locate those sources but cannot override them. Do not use an older experimental or design baseline merely because a prior Plan was reviewed.
32
27
 
33
- Use the sources that establish the intended work:
28
+ Separate:
34
29
 
35
- - explicit user direction and accepted shared understanding;
36
- - a Spec, issue, technical design, diagnosis, requirements, or Working Record when one exists;
37
- - relevant code, tests, policies, ADRs, and established behavior;
38
- - current external sources when an API, platform, or version constrains execution.
30
+ - the required outcome and non-goals;
31
+ - accepted design choices and constraints;
32
+ - the supported implementation approach;
33
+ - assumptions whose failure would invalidate dependent work;
34
+ - unresolved or intentionally deferred work outside this Plan's promise.
39
35
 
40
- When a Spec or decision artifact is linked, preserve its contract rather than silently reinterpreting it. Live evidence overrides stale memory. A Working Record, handoff, review item, or earlier Plan is not authority over contradictory user decisions or source truth.
36
+ An experiment produces evidence, not an automatic requirement. Include its consequences only where selected for this outcome; do not omit consequences the user subsequently accepted.
41
37
 
42
- ## Write The Ordered Strategy
38
+ ## Write The Smallest Useful Strategy
43
39
 
44
- Read [plan shapes](references/plan-shapes.md) and choose the smallest shape that makes the intended execution inspectable.
40
+ Read [Plan Shapes](references/plan-shapes.md) before choosing the artifact shape.
45
41
 
46
- Include, when relevant:
42
+ Include relevant goal, sources, scope, decisions, assumptions, dependencies, ordered coherent outcomes, focused checks, integration, completion conditions, and what would invalidate the strategy. Use exact paths and commands when known and useful; do not invent them to make the Plan look executable.
47
43
 
48
- - goal, source, scope, and non-goals;
49
- - accepted decisions, assumptions, dependencies, and required order;
50
- - phases and slices with coherent, bounded results;
51
- - checks, integration, and final acceptance;
52
- - conditions that would invalidate the Plan.
44
+ Size outcomes for manageable working context, dependencies, uncertainty, and checking. Do not divide mechanically by file, bug count, test, or method. The complete task may require several Slices, but each should have a coherent result and a clear dependency on earlier work where one exists.
53
45
 
54
- Include exact paths, systems, and commands when known and useful. Do not guess them to make the Plan appear complete.
46
+ A validation step may stop the Plan if a bounded assumption fails. If its result is expected to select among materially different strategies, keep dependent work provisional in the Working Record rather than presenting the later sequence as decided.
55
47
 
56
- Each slice should produce a coherent result that can be checked. A validation step may stop the Plan when a known assumption fails. If its result is expected to choose among materially different strategies, use a Working Record learning slice instead of pretending the later Plan is known.
48
+ The Plan is not a context inventory. Specify only the sources and relationships needed to explain or execute its steps, leaving ordinary local choices to the executing agent.
57
49
 
58
- ## Select Useful Checkpoints
50
+ ## Preserve Acceptance And Return Conditions
59
51
 
60
- During execution, every bounded activity is verified and silently self-reviewed before its result is accepted, reused, or claimed complete; do not restate that default unless its evidence boundary is unusual.
52
+ Tie each material outcome and final check to the accepted behavior it serves. Do not let available tests redefine acceptance or claim whole-system completion from a narrow observer.
61
53
 
62
- At meaningful slice, phase, integration, risk, or continuity boundaries, consider independent review, a local commit, a user decision, or a continuity checkpoint. Record only selected checkpoints and their conditions. A slice ending or a fixed count alone does not justify a commit; prefer one when supported work forms a coherent rollback point or the next work may destabilize it.
54
+ Keep the agreed user-facing return condition visible: return a proposed strategy, implement one Slice, finish the described task, or stop at a specified boundary. Internal delegation handbacks and context cycles are not automatic user checkpoints.
63
55
 
64
- Plan acceptance establishes the agreed strategy; it does not by itself authorize execution. When the user clearly approves execution of the Plan, that authority may cover its listed work, checks, reviews, Working Record updates, and local commits. It does not authorize push, integration, migration, deprecation, release, or launch. Planned commits remain conditional on live evidence and [Commit Work](../commit-work/SKILL.md) inspection.
56
+ A Plan must not invent product behavior, compatibility, public interfaces, failure semantics, sensitive policy, migration, scale, retries, recovery, or extension machinery. Do not replace agreed scope with an unapproved MVP or later-version split.
65
57
 
66
- ## Keep Plan And Working Record Separate
58
+ Before a new prerequisite becomes a planned obligation, determine whether it serves an accepted requirement or only preserves a particular approach. Resolve consequential alternatives instead of hiding them in confident steps.
67
59
 
68
- The Plan records the intended execution path. The Working Record records actual execution, current slices, evidence, task-local decisions, deviations, and next action.
60
+ ## Select Checkpoints Without Making A Schedule Of Ceremonies
69
61
 
70
- Do not revise the Plan for slice progress, expected evidence, status changes, or reversible local choices. Record those events in the Working Record when one exists.
62
+ Ordinary verification and silent self-review belong to producing each supported result. Do not restate them as independent gates unless a particular evidence boundary needs explanation.
71
63
 
72
- Link accepted behavior, contracts, and architecture rationale from the owning Spec or decision artifact instead of duplicating them in the Plan.
64
+ Include independent review, a local commit, a user decision, or continuity transfer only when selected to protect a concrete dependency, risk, rollback, or delivery boundary. A Slice ending or a fixed count is insufficient.
73
65
 
74
- ## Stop Before Inventing A Path
66
+ Accepting a Plan as a strategy is not permission to execute it. Explicit approval to execute the Plan may cover its listed work, checks, selected reviews, record maintenance, and local commits. It does not imply push, integration, migration, deprecation, release, or launch. Planned commits remain conditional on fresh evidence and [Commit Work](../commit-work/SKILL.md) inspection.
75
67
 
76
- Stop when writing would:
68
+ When an existing agreement already covers the work, preserve that source instead of asking the user to approve the same scope again because it is now written down.
77
69
 
78
- - invent or change requirements, scope, public behavior, compatibility, sensitive policy, failure semantics, or hard-to-reverse design;
79
- - hide unresolved strategy, architecture, dependencies, or owner choices inside confident steps;
80
- - plan a production fix from a guessed cause;
81
- - rewrite tests, docs, policies, or acceptance merely to make the proposed path succeed;
82
- - add speculative abstractions, migration machinery, retries, recovery, scale, or extension points;
83
- - replace agreed scope with an unapproved MVP, v1/v2, roadmap, or later-version split.
70
+ ## Revise Only The Affected Strategy
84
71
 
85
- Route the unresolved issue to its owner rather than writing a Plan that assumes the answer.
72
+ Do not update a Plan for completed steps, ordinary local choices, test counts, or routine status. Record material actual state through Track Work when present.
86
73
 
87
- ## Revise Only From Founded Evidence
74
+ Revise or supersede the affected strategy when accepted intent or supported evidence changes its scope, design, ordering, dependencies, checks, or mechanism. Preserve valid earlier work and rationale. A clerical correction does not reopen the strategy, and reaching a review cap is not evidence that the Plan needs rewriting.
88
75
 
89
- Write Plan also owns deliberate Plan revisions.
76
+ Identify affected upstream and downstream artifacts. Revise only content whose owned meaning changed and whose mutation is authorized. If an upstream contract remains unresolved, mark dependent steps contingent before they are used. Do not repair consistency by silently changing the required outcome.
90
77
 
91
- Correct clerical mistakes directly. Do not revise the Plan for ordinary local choices or expected progress.
78
+ ## Self-Review Before Treating The Plan As Usable
92
79
 
93
- Revise or supersede the affected Plan when supported evidence materially changes its scope, design, architecture, order, dependencies, checks, or execution mechanism. An accepted review item may support revision. Reaching the independent-review cap does not itself justify rewriting the Plan; revise only when diagnosis or evidence shows that the Plan is wrong or insufficient.
80
+ After factual source checks, use [Review Artifact](../review-artifact/SKILL.md) for one silent author self-review of the complete Plan, accepted sources, and intended execution boundary.
94
81
 
95
- Record the reason and execution impact in the Working Record when one exists. Revise a linked Spec or decision artifact only when its owned content changed. Preserve unaffected Plan content and history.
82
+ Check whether the ordered work can achieve the accepted outcome, dependencies are supported, later uncertainty is honest, final checks match acceptance, and selected checkpoints are proportionate. Correct clear covered defects and recheck affected facts and lenses.
96
83
 
97
- ## Self-Check
84
+ Do not automatically dispatch an independent reviewer after writing or revising a Plan. Use Review Artifact's independent route only when separately selected and authorized to protect a concrete boundary. Supply complete sources, dependencies, and limits; adjudicate the returned report before acting on its findings.
98
85
 
99
- Silently review the Plan before routing it onward:
86
+ Neither self-review nor independent review grants user acceptance or execution authority. Conversely, an already-covered execution agreement does not need another approval turn solely because planning produced an artifact.
100
87
 
101
- - Are the intended result, source, and scope clear?
102
- - Can coherent, checkable slices proceed in the stated order?
103
- - Are dependencies, integration, final checks, and invalidation conditions represented?
104
- - Are selected checkpoints useful and proportionate rather than automatic ceremony?
105
- - Did the Plan invent intent, disguise material uncertainty, or absorb rolling task state?
88
+ ## Report And Return
106
89
 
107
- Correct clear local issues directly. Surface only material gaps that prevent the Plan from being executable or fit for review.
90
+ Report the Plan path and intended use, source basis, material assumptions or contingent work, invalidation conditions, selected checkpoints, and actual review/acceptance/execution-authority status.
108
91
 
109
- ## Review The Plan
110
-
111
- After writing or materially revising the Plan, route it to [Review Artifact](../review-artifact/SKILL.md) before treating it as ready for approval and execution.
112
-
113
- Provide the reviewer with the complete Plan, intended use, source truth, linked artifacts, dependencies, selected checkpoints, and known evidence gaps. Review Artifact owns dependency ordering, review items, judgment, adjudication, and the review cycle. Artifact review establishes fitness; the user separately accepts the Plan and grants any scoped execution authority.
114
-
115
- ## Report
116
-
117
- State:
118
-
119
- - Plan path and intended use;
120
- - source context and linked artifacts;
121
- - material assumptions, blockers, or invalidation conditions;
122
- - selected review, commit, user, or continuity checkpoints;
123
- - artifact-review, Plan-acceptance, and execution-authorization status.
92
+ Return the supported strategy to the requesting activity. If the agreement covers implementation, the agent can continue through the normal execution route; if it asks for a Plan first, stop there. Do not begin work outside that agreement or claim an unresolved strategy is ready.
@@ -20,7 +20,7 @@ When no convention exists and future readers need durable identity, begin with a
20
20
  > **Source:** <spec, issue, Working Record, diagnosis, or accepted context>
21
21
  ```
22
22
 
23
- Use one current status. Follow the repository or owner's vocabulary; useful states may include `Draft`, `Reviewed`, `Ready`, `Superseded`, and `Abandoned`. Writing or reviewing a Plan does not by itself make it `Ready`.
23
+ Use one current status. Follow the repository or owner's vocabulary; useful states may include `Draft`, `Reviewed`, `Ready`, `Superseded`, and `Abandoned`. Writing or reviewing a Plan does not by itself make it `Ready`. State whether any recorded review was author self-review or selected independent review; neither implies user acceptance or execution authority.
24
24
 
25
25
  Add dates, supersession links, or approvers only when useful and reliable.
26
26
 
@@ -39,7 +39,7 @@ Dependencies:
39
39
  Required order:
40
40
  ```
41
41
 
42
- Link accepted behavior, architecture, and decisions instead of copying their rationale. Do not hide unsettled design or owner choices as assumptions. If an assumption could choose among materially different strategies, resolve it before treating the Plan as executable.
42
+ Link accepted behavior, architecture, and decisions instead of copying their rationale. Identify the governing source version and relevant accepted amendments when they affect execution. Do not hide unsettled design or owner choices as assumptions. If an assumption could choose among materially different strategies, resolve it before treating the Plan as executable. Experimental findings become planned obligations only when selected for the accepted outcome; a previously reviewed baseline does not excuse omitting a later accepted change.
43
43
 
44
44
  ## Choose The Execution Shape
45
45
 
@@ -106,7 +106,7 @@ A slice is a coherent result, not a file list. Mention files, modules, or system
106
106
 
107
107
  Consider checkpoints at meaningful slice, phase, integration, risk, and continuity boundaries. Record only useful additions; normal verification and silent self-review need no repeated fields.
108
108
 
109
- A selected local commit names its coherent outcome and conditions, not merely “commit after this slice.” Plan approval authorizes listed local commits subject to live evidence and Commit Work inspection, but not push, integration, migration, deprecation, release, or launch. Record actual results and commit identities in the Working Record.
109
+ A selected local commit names its coherent outcome and conditions, not merely “commit after this slice.” Approval to execute the Plan may authorize listed local commits subject to live evidence and Commit Work inspection; approval of its strategy alone does not. Neither implies push, integration, migration, deprecation, release, or launch. Record actual results and commit identities in the Working Record.
110
110
 
111
111
  ## Adapt For The Work Type
112
112
 
@@ -151,6 +151,6 @@ These conditions stop or revise the affected Plan. They are not alternate branch
151
151
 
152
152
  A local implementation detail, expected result, or completed slice does not revise the Plan.
153
153
 
154
- For a founded material change, update only the affected strategy and dependencies, record why it changed, preserve prior rationale, and update linked artifacts only when their content changed.
154
+ For a founded material change, update only the affected strategy and dependencies, record why it changed, and preserve prior rationale. Update linked artifacts only when their owned content changed and revision is authorized; otherwise mark dependent work contingent and return the missing decision or revision.
155
155
 
156
- Use a superseding Plan when editing in place would obscure what was originally reviewed. Route a materially revised or superseding Plan through artifact review again.
156
+ Use a superseding Plan when editing in place would obscure the earlier accepted strategy or reviewed state. Apply author self-review through Review Artifact to a materially revised or superseding Plan. Independent review is separately selected and authorized when it protects a concrete boundary, not required merely because the Plan changed.
@@ -1,104 +1,92 @@
1
1
  ---
2
2
  name: write-spec
3
- description: Use when writing or revising a spec, PRD, issue, API contract, technical design, migration contract, decision artifact, or similar durable document.
3
+ description: "Use when writing or revising a spec, PRD, issue, API contract, technical design, migration contract, decision artifact, or similar durable document."
4
4
  ---
5
5
 
6
6
  # Write Spec
7
7
 
8
- Turn clear intent and source evidence into a durable artifact that later work can rely on.
8
+ Turn accepted intent and source evidence into a durable artifact that later work can use without inheriting invented requirements or losing accepted changes.
9
9
 
10
- A spec may be broad, deep, or both. Its shape follows its intended use. It is not a transcript, implementation plan, Working Record, or polished substitute for an unresolved decision.
10
+ A Spec describes content, behavior, constraints, and uncertainty for its intended use. It is not an implementation sequence, Working Record, transcript, or permission grant. Useful technical depth is welcome; hypothetical completeness is not required.
11
11
 
12
- ## Identify The Artifact
12
+ ## Establish The Artifact's Job
13
13
 
14
- Before writing, establish:
14
+ Identify the artifact type, intended reader or future action, accepted scope, destination, and unresolved questions it must preserve.
15
15
 
16
- - artifact type and intended use;
17
- - audience or future action it must support;
18
- - accepted intent, scope, and source context;
19
- - destination and repository convention;
20
- - unresolved questions that belong in the artifact.
16
+ Answer questions about a Spec without editing it unless revision is requested. Use [Discuss](../discuss/SKILL.md) when direction or alternatives remain materially open, and [Decision Gate](../decision-gate/SKILL.md) for one blocking owner choice or source conflict. Do not repeat discussion that already settled the artifact's purpose.
21
17
 
22
- If the user is asking about an artifact, answer instead of writing one. If direction or alternatives still need shared understanding, read [Discuss](../discuss/SKILL.md). If one user-owned choice or source conflict blocks writing, read [Decision Gate](../decision-gate/SKILL.md).
18
+ An agreement to draft a proposal permits proposed design, clearly labelled. It does not make that design accepted behavior. An agreement to implement accepted work may include documenting its supported contract; do not manufacture another user approval merely because a document was produced.
23
19
 
24
- Do not repeat discussion that already settled the artifact's intent.
20
+ ## Establish The Current Source Basis
25
21
 
26
- ## Write From Source
22
+ Use the sources that actually determine the artifact:
27
23
 
28
- Inspect the sources that define the artifact:
24
+ - current user direction and accepted discussion, including later amendments;
25
+ - existing Specs, issues, decisions, and contracts being revised or consumed;
26
+ - relevant live code, tests, policy, ADRs, and established behavior;
27
+ - current primary sources when an external version or interface constrains the result;
28
+ - [Track Work](../track-work/SKILL.md) for task memory when a record exists.
29
29
 
30
- - explicit user decisions and current shared understanding;
31
- - [Track Work](../track-work/SKILL.md), which owns the living Working Record for current state, slices, task-local decisions, and evidence, when one exists;
32
- - relevant code, tests, requirements, policies, ADRs, and established behavior;
33
- - existing artifacts that this one revises or depends on;
34
- - current primary sources when an external contract or version matters.
30
+ A record or implementation summary cannot override contradictory current intent or accepted source truth. Distinguish what was requested, what was proposed, what was accepted, and what an observation actually established.
35
31
 
36
- Use a Working Record as task memory, not authority over contradictory user decisions or live evidence. Distinguish accepted facts and decisions from hypotheses, proposals, and unresolved questions.
32
+ Preserve enough source identity to recover the basis of a consequential statement. For an approval such as "proceed," retain the proposal and response together when their scope matters. Authorization to investigate or draft an option is not acceptance of undisclosed production consequences.
37
33
 
38
- Do not infer goals or requirements from adjacent repository details merely because they are available.
34
+ Do not infer requirements from nearby code, existing tests, or available machinery merely because those sources exist. A test can faithfully protect an unnecessary mechanism.
39
35
 
40
- ## Shape The Artifact By Its Job
36
+ ## Write Only What The Intended Use Needs
41
37
 
42
- Read [spec shapes](references/spec-shapes.md) and use only the sections that help the artifact perform its intended job. Read [artifact standards](references/artifact-standards.md) when choosing a durable destination, identity, status, or revision shape. Read [decision records](references/decision-records.md) when the artifact records a durable decision.
38
+ Read [Spec Shapes](references/spec-shapes.md) before choosing the structure. Read [Artifact Standards](references/artifact-standards.md) when choosing destination, identity, status, source trail, or revision shape. Read [Decision Records](references/decision-records.md) when the artifact primarily preserves a decision and rationale.
43
39
 
44
- Include, when relevant:
40
+ Include relevant purpose, scope, non-goals, accepted behavior, constraints, interfaces, consequential failure semantics, acceptance, and evidence. Explain architecture and ownership deeply where the intended use requires it; do not remove necessary detail just to shorten the document.
45
41
 
46
- - purpose, context, scope, and accepted content;
47
- - behavior, design, interfaces, constraints, and consequential failure semantics required by the artifact;
48
- - acceptance and suitable evidence;
49
- - accepted decisions, clearly marked uncertainty, and source references.
42
+ When writing an implementation-guiding design whose unresolved representation, identity, ownership, algorithm, or failure choices could invalidate significant dependent work, read [Design for Depth](../design-for-depth/SKILL.md) and use its Implementation Decisions method. Preserve the selected choices and rationale, distinguishing fixed constraints from illustrative sketches and local freedom. Existing supported decisions need no fresh design exercise; open choices must remain visible rather than being filled with invented mechanics.
50
43
 
51
- A technical design may go deeply into architecture, interfaces, ownership, state, and failure behavior. Do not remove useful depth merely to keep the artifact short.
44
+ Keep distinguishable:
52
45
 
53
- Do not turn the artifact into ordered execution phases, task status, slice history, or a volatile file inventory. Ordered execution belongs in a Plan; living task state belongs in the Working Record.
46
+ - required behavior and accepted decisions;
47
+ - supported facts and their evidence limits;
48
+ - proposed implementation mechanisms;
49
+ - tentative assumptions and open questions;
50
+ - intentional deferrals and superseded direction.
54
51
 
55
- ## Stop Before Inventing Intent
52
+ Use the repository's vocabulary rather than inventing a new status schema. Place a consequential uncertainty where the reader makes the affected decision, not in a distant caveat after confident requirements.
56
53
 
57
- Stop when writing would:
54
+ Keep ordered execution in a Plan and live progress in the Working Record. Link shared rationale rather than copying it into several independently maintained sources.
58
55
 
59
- - invent or silently change product behavior, scope, requirements, public interfaces, compatibility, sensitive policy, failure semantics, or hard-to-reverse design;
60
- - override code, tests, docs, policies, ADRs, or established behavior without resolving the conflict;
61
- - present a tentative proposal or assumption as accepted;
62
- - hide an owner decision behind `TBD`, polished prose, or an unmarked open question;
63
- - reduce agreed scope into MVP, v1/v2, roadmap, or later-version framing without approval;
64
- - create a destination or artifact convention whose authority or durability matters without resolving it.
56
+ ## Do Not Promote An Approach Into A Requirement
65
57
 
66
- Ask only for the decision that prevents the artifact from serving its intended use. Otherwise represent uncertainty honestly and continue.
58
+ Before adding an obligation, identify its accepted source or why it is necessary for the stated outcome. A limitation of one implementation technique does not establish a need for stronger guarantees, host changes, new persistence, retries, or a subsystem.
67
59
 
68
- ## Revise Deliberately
60
+ When a consequential choice remains, present its concrete effect and supported alternatives through its owner. Do not settle it through normative prose, an unexplained assumption, or a polished placeholder.
69
61
 
70
- When revising an artifact:
62
+ Stop the affected writing when it would silently change behavior, scope, public interfaces, compatibility, sensitive policy, failure semantics, or hard-to-reverse design. Do not rewrite source truth to suit implementation, or reduce agreed scope into an unapproved MVP, roadmap, or later-version split.
71
63
 
72
- - preserve accepted content that still holds;
73
- - update only what new intent or evidence changed;
74
- - keep superseded decisions and material rationale recoverable through the owning decision record, change history, or version control.
64
+ Open questions need not stop unrelated content. A proposal can be fit for discussion while remaining unfit to authorize or guide production implementation; state that boundary clearly.
75
65
 
76
- Do not rewrite history or synchronize unaffected artifacts. A clerical correction does not reopen settled intent; a material revision changes the artifact's review boundary and may affect its dependencies.
66
+ ## Reconcile Material Changes
77
67
 
78
- ## Self-Check
68
+ Preserve accepted content that still holds. Change only what new intent or evidence affects, and keep consequential prior rationale recoverable through the owning decision record, change history, or version control.
79
69
 
80
- Silently review the artifact before routing it onward:
70
+ When an accepted amendment or learning result changes the contract, identify the affected downstream Plan, acceptance check, or implementation assumption. Reconcile those dependencies when authorized; otherwise mark them contingent and return the needed revision before dependent use. Do not synchronize unrelated artifacts.
81
71
 
82
- - Does it perform its stated job?
83
- - Does it agree with accepted intent and source evidence?
84
- - Can a future reader distinguish required, tentative, open, deferred, and superseded information?
85
- - Is it broad and deep enough for its intended use without taking over another artifact's job?
86
- - Are consequential claims, failure behavior, and acceptance supported or explicitly unresolved?
87
- - Did writing introduce any decision the user did not make?
72
+ Experimental learning does not automatically enter the production contract. Distinguish findings deliberately selected for implementation from observations retained as evidence or deferred possibilities. Conversely, do not keep using an older baseline after the user accepted a relevant change.
88
73
 
89
- Correct clear local issues directly. Surface only unresolved material issues that prevent the artifact from being fit for use.
74
+ Do not rewrite historical decisions as though they always contained the new choice. Follow repository policy for historical records and supersession.
90
75
 
91
- ## Review The Artifact
76
+ ## Self-Review Once Before Use
92
77
 
93
- After writing or materially revising the artifact, route it to [Review Artifact](../review-artifact/SKILL.md) before treating it as fit for its intended use.
78
+ After checking source-backed factual claims, use [Review Artifact](../review-artifact/SKILL.md) for silent author self-review of the complete resulting artifact and its intended use.
94
79
 
95
- Provide the reviewer with the complete artifact, its intended use, source truth, dependencies, and known evidence gaps. Review Artifact owns review items, judgment, adjudication, and the review cycle.
80
+ Check that it preserves accepted intent and amendments, separates requirements from proposals, has sufficient evidence and acceptance conditions, and keeps affected dependencies coherent. Correct clear covered defects, then recheck affected facts and review lenses. Return unresolved owner decisions instead of making the document internally consistent by inventing an answer.
96
81
 
97
- ## Report
82
+ This is the author's ordinary self-review, not another mandatory review cycle. Do not dispatch an independent reviewer merely because a Spec was written or materially revised.
98
83
 
99
- State:
84
+ Independent review applies only when selected and authorized to protect a concrete boundary. Supply the complete artifact, source basis, dependencies, and evidence limits through Review Artifact's independent route. Its report ends the review; findings require adjudication before revision or use.
100
85
 
101
- - artifact path, type, and intended use;
102
- - source context used;
103
- - material unresolved questions or blocked decisions;
104
- - artifact-review status.
86
+ Review establishes fitness, not user acceptance or execution authority. Respect an explicitly selected approval checkpoint, but do not create one for every artifact by default.
87
+
88
+ ## Report And Stop
89
+
90
+ Report the artifact path, type, intended use, source basis, material unresolved or contingent content, and actual review/acceptance status. Do not label author self-review as independent review or use an approval status without its source.
91
+
92
+ Stop when the authorized artifact is fit for its stated use or its blocking decision/evidence limit is explicit. Return to the requesting activity; writing a Spec does not begin implementation or authorize another outcome.
@@ -49,7 +49,7 @@ Draft | Reviewed | Approved | Rejected | Superseded
49
49
 
50
50
  The appropriate statuses depend on the artifact type. An issue, policy, ADR, and API contract need not share one lifecycle.
51
51
 
52
- Status communicates artifact state; it does not replace review evidence or user authority.
52
+ Status communicates artifact state; it does not replace review evidence or user authority. Distinguish author self-review from selected independent review when reporting review status. Writing a Spec or Plan does not automatically select an independent reviewer.
53
53
 
54
54
  ## Preserve Sources Without Copying Them
55
55
 
@@ -66,7 +66,7 @@ session:<session-id>/turn:<turn-id>
66
66
 
67
67
  Use identifiers that actually exist. Prefer links and concise quotations over copied inventories, logs, diffs, or transcripts.
68
68
 
69
- A source trail should let a future reader recover why the artifact says what it says. It does not require preserving every conversation turn.
69
+ A source trail should let a future reader recover why the artifact says what it says. For consequential choices, preserve the relevant proposal, disclosed consequences, and acceptance source rather than an isolated “proceed” or an agent's approval summary. Distinguish accepted amendments from unselected experimental findings. This does not require preserving every conversation turn.
70
70
 
71
71
  ## Revise Without Rewriting History
72
72
 
@@ -56,7 +56,7 @@ Use the repository's ADR or decision format when one exists. Otherwise adapt thi
56
56
  <Evidence, conditions, or later decision that would reopen or replace it.>
57
57
  ```
58
58
 
59
- State proposals as proposals. Do not write an assumption, reviewer suggestion, or agent preference as an accepted decision.
59
+ State proposals as proposals. Do not write an assumption, reviewer suggestion, or agent preference as an accepted decision. For a consequential choice, identify the presented option, disclosed consequences, and acceptance source. Approval to investigate or draft an option does not establish acceptance of its eventual production requirements.
60
60
 
61
61
  ## Preserve Authority And History
62
62
 
@@ -67,7 +67,8 @@ When a decision changes:
67
67
  - preserve the old record as `Superseded` rather than rewriting it to match the present;
68
68
  - create or identify the replacement decision;
69
69
  - link both directions;
70
- - update owning specs, plans, or policies whose current content depends on it;
70
+ - identify owning specs, plans, or policies whose current content depends on it and revise them when authorized;
71
+ - mark dependent work contingent when a required decision or source revision remains unresolved;
71
72
  - preserve the evidence that justified the change.
72
73
 
73
74
  Live evidence may show that implementation violates a decision or that the decision is no longer viable. Use Decision Gate when resolving that conflict requires user authority.
@@ -73,6 +73,21 @@ Possible sections:
73
73
 
74
74
  A technical design may contain implementation detail when that detail defines the accepted design. Ordered phases and execution slices still belong in a Plan.
75
75
 
76
+ ### Implementation Decisions
77
+
78
+ Include this subsection when consequential engineering choices must survive implementation handoffs or context loss. For selecting those choices, use [Design for Depth](../../design-for-depth/SKILL.md); this shape preserves their result rather than duplicating the design method.
79
+
80
+ Capture only what the intended implementation needs:
81
+
82
+ - selected representation, identity, state owners, and module responsibilities;
83
+ - essential algorithm, effect ordering, update/invalidation, and failure behavior;
84
+ - source basis, rationale, and invariants;
85
+ - a plausible wrong implementation and the observer that distinguishes it;
86
+ - required constraints, suggested mechanics, and implementer freedom;
87
+ - unresolved assumptions and conditions requiring reconsideration.
88
+
89
+ A compact type or control-flow sketch is useful when it removes consequential ambiguity. Mark illustrative code as such; it is not the behavioral oracle. Keep the applicable revision recoverable and update only decisions affected by new evidence. Do not require this subsection for a product-only artifact or an already clear local change.
90
+
76
91
  ## API, Protocol, Or Interface Contract
77
92
 
78
93
  Use for a public or internal interface that callers will depend on.
@@ -1,96 +0,0 @@
1
- const PROFILE_VALUES = ["standard", "reasoning", "auto"];
2
- const HISTORY_VALUES = ["history", "history active", "history anomalies"];
3
- export function cognitiveRoutingProfileCompletions(prefix) {
4
- const query = prefix ?? "";
5
- return [...PROFILE_VALUES, ...HISTORY_VALUES]
6
- .filter((value) => value.startsWith(query))
7
- .map((value) => ({
8
- value,
9
- label: value,
10
- description:
11
- value === "auto"
12
- ? "Release the manual hold and use the Reasoning profile"
13
- : value === "history"
14
- ? "Show Cognitive Routing transition history"
15
- : value === "history active"
16
- ? "Show current-branch Cognitive Routing history"
17
- : value === "history anomalies"
18
- ? "Show Cognitive Routing history anomalies"
19
- : `Hold ${value} profile manually`,
20
- }));
21
- }
22
- function historyOptions(value) {
23
- if (value === "history") return {};
24
- if (value === "history active") return { scope: "active-branch" };
25
- if (value === "history anomalies") return { anomaliesOnly: true };
26
- return undefined;
27
- }
28
- function formatHistory(result) {
29
- const lines = [
30
- `Cognitive Routing history: ${result.current.profile} · ${result.current.control}`,
31
- `Events: ${result.events.length}; unresolved=${result.summary.unresolvedCount}; anomalies=${result.summary.anomalyCount}`,
32
- ];
33
- if (result.summary.latestSemanticEventId) lines.push(`Latest semantic: ${result.summary.latestSemanticEventId}`);
34
- if (result.summary.latestCompletedEventId) lines.push(`Latest completed: ${result.summary.latestCompletedEventId}`);
35
- for (const event of result.events) {
36
- const transition = event.from && event.to ? ` ${event.from} → ${event.to}` : "";
37
- lines.push(
38
- `${event.jsonlPosition}: ${event.outcome} · ${event.classification}${transition} · changed=${event.changed} · ${event.id}`,
39
- );
40
- }
41
- return lines.join("\n");
42
- }
43
- export async function handleCognitiveRoutingProfileCommand(args, ctx, controller) {
44
- const input = (args ?? "").trim().toLowerCase();
45
- const [action, ...rest] = input.split(/\s+/);
46
- if (action !== "profile") return false;
47
- const value = rest.join(" ");
48
- const historyView = historyOptions(value);
49
- if (historyView) {
50
- const result = ctx.history
51
- ? await ctx.history(historyView)
52
- : controller?.history
53
- ? await controller.history(historyView)
54
- : undefined;
55
- if (result) {
56
- ctx.ui?.notify?.(formatHistory(result), "info");
57
- } else {
58
- ctx.ui?.notify?.("Cognitive Routing history is unavailable for this session.", "warning");
59
- }
60
- return true;
61
- }
62
- if (!PROFILE_VALUES.includes(value)) {
63
- ctx.ui?.notify?.(
64
- "Usage: /freeflow profile standard, /freeflow profile reasoning, /freeflow profile auto, or /freeflow profile history [active|anomalies]",
65
- "warning",
66
- );
67
- return true;
68
- }
69
- if (typeof ctx.isIdle === "function" && !ctx.isIdle()) {
70
- ctx.ui?.notify?.("Freeflow settings and profile changes are available only while Pi is idle.", "warning");
71
- return true;
72
- }
73
- if (!controller) {
74
- ctx.ui?.notify?.(
75
- "Cognitive Routing is unavailable for this session. It may be disabled, unsupported by the Pi host, or suppressed by an explicit startup model selection.",
76
- "warning",
77
- );
78
- return true;
79
- }
80
- if (value === "auto") {
81
- const result = await controller.setAutomaticControl();
82
- if (result.status === "automatic") {
83
- ctx.ui?.notify?.("Cognitive Routing manual hold released; automatic Reasoning control is active.", "info");
84
- } else {
85
- ctx.ui?.notify?.(`Cognitive Routing could not release the manual hold: ${result.reason}.`, "warning");
86
- }
87
- return true;
88
- }
89
- const result = await controller.setManualProfile(value);
90
- if (result.status === "active") {
91
- ctx.ui?.notify?.(`Cognitive Routing manual hold set to ${result.profile}.`, "info");
92
- } else {
93
- ctx.ui?.notify?.(`Cognitive Routing could not set the manual profile: ${result.reason}.`, "warning");
94
- }
95
- return true;
96
- }