@hassangameryt/freeflow 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +2 -2
  3. package/.codex-plugin/plugin.json +4 -5
  4. package/README.md +39 -55
  5. package/capabilities/cognitive-routing/SKILL.md +288 -130
  6. package/command-surface.json +0 -24
  7. package/hooks/freeflow-runtime-context.mjs +42 -477
  8. package/hooks/hooks.json +1 -26
  9. package/hooks/tests/check-runtime-context-hook.sh +108 -319
  10. package/package.json +4 -2
  11. package/pi-extension/dist/cognitive-routing/commands.js +3 -3
  12. package/pi-extension/dist/cognitive-routing/config.js +16 -20
  13. package/pi-extension/dist/cognitive-routing/controller.js +478 -48
  14. package/pi-extension/dist/cognitive-routing/history.js +12 -0
  15. package/pi-extension/dist/cognitive-routing/host.js +74 -12
  16. package/pi-extension/dist/cognitive-routing/pi-routing-session.js +414 -0
  17. package/pi-extension/dist/cognitive-routing/pi-session-control.js +320 -0
  18. package/pi-extension/dist/cognitive-routing/tool.js +1 -0
  19. package/pi-extension/dist/cognitive-routing/types.js +1 -1
  20. package/pi-extension/dist/index.js +236 -219
  21. package/pi-extension/dist/runtime/runtime-context.js +126 -286
  22. package/pi-extension/dist/settings/settings-ui.js +52 -336
  23. package/pi-extension/src/cognitive-routing/commands.ts +15 -5
  24. package/pi-extension/src/cognitive-routing/config.ts +16 -20
  25. package/pi-extension/src/cognitive-routing/controller.ts +561 -51
  26. package/pi-extension/src/cognitive-routing/history.ts +12 -0
  27. package/pi-extension/src/cognitive-routing/host.ts +110 -16
  28. package/pi-extension/src/cognitive-routing/pi-routing-session.ts +538 -0
  29. package/pi-extension/src/cognitive-routing/pi-session-control.ts +444 -0
  30. package/pi-extension/src/cognitive-routing/tool.ts +1 -0
  31. package/pi-extension/src/cognitive-routing/types.ts +1 -1
  32. package/pi-extension/src/index.ts +249 -239
  33. package/pi-extension/src/runtime/runtime-context.ts +129 -305
  34. package/pi-extension/src/settings/settings-ui.ts +53 -371
  35. package/pi-extension/tests/cognitive-routing/commands.test.js +1 -1
  36. package/pi-extension/tests/cognitive-routing/controller.test.js +69 -40
  37. package/pi-extension/tests/cognitive-routing/extension-lifecycle.test.js +128 -57
  38. package/pi-extension/tests/cognitive-routing/pi-normal-lifecycle.test.js +434 -0
  39. package/pi-extension/tests/cognitive-routing/pi-session-control.test.js +174 -0
  40. package/pi-extension/tests/cognitive-routing/pi-session-history.test.js +91 -0
  41. package/pi-extension/tests/cognitive-routing/profile-resolution.test.js +47 -4
  42. package/pi-extension/tests/integration/mode-free-core.test.js +218 -0
  43. package/pi-extension/tests/integration/pi-extension.test.js +430 -2478
  44. package/pi-extension/tests/integration/prompt-architecture.test.js +124 -79
  45. package/pi-extension/tests/integration/unaffected-regressions.test.js +411 -0
  46. package/runtime/prompts/cognitive-routing.md +5 -4
  47. package/runtime/prompts/conversation-history.md +1 -1
  48. package/runtime/prompts/core.md +77 -6
  49. package/runtime/prompts/interaction-contract.md +6 -2
  50. package/skills/action-selection/SKILL.md +93 -44
  51. package/skills/action-selection/references/trajectory-stalls.md +71 -0
  52. package/skills/bypass/SKILL.md +109 -39
  53. package/skills/commit-work/SKILL.md +94 -55
  54. package/skills/commit-work/references/git-state-edges.md +94 -0
  55. package/skills/commit-work/references/simple-push.md +92 -0
  56. package/skills/commit-work/references/staging-decisions.md +79 -46
  57. package/skills/decision-gate/SKILL.md +80 -22
  58. package/skills/design-for-depth/SKILL.md +208 -43
  59. package/skills/design-for-depth/references/design-pressure-signals.md +108 -240
  60. package/skills/design-for-depth/references/interface-design-loop.md +77 -97
  61. package/skills/design-for-depth/references/module-and-dependency-design.md +147 -0
  62. package/skills/design-for-depth/references/software-design-philosophy.md +127 -173
  63. package/skills/design-for-depth/references/state-and-failure-boundaries.md +136 -0
  64. package/skills/diagnose-failure/SKILL.md +198 -52
  65. package/skills/diagnose-failure/references/diagnostic-loop-catalog.md +19 -5
  66. package/skills/diagnose-failure/references/flaky-and-performance-diagnosis.md +13 -5
  67. package/skills/discuss/SKILL.md +118 -76
  68. package/skills/discuss/references/discussion-continuity.md +84 -32
  69. package/skills/evaluate-skill/SKILL.md +166 -52
  70. package/skills/evaluate-skill/references/evaluation-definition-schema.md +2 -2
  71. package/skills/evaluate-skill/references/evaluation-design.md +56 -30
  72. package/skills/evaluate-skill/references/execution-and-evidence.md +1 -1
  73. package/skills/evaluate-skill/references/review-and-revision.md +62 -21
  74. package/skills/execute-work/SKILL.md +98 -59
  75. package/skills/execute-work/references/code-practices.md +4 -4
  76. package/skills/execute-work/references/execute-work-edges.md +42 -22
  77. package/skills/review-artifact/SKILL.md +132 -71
  78. package/skills/review-artifact/references/adjudicate-artifact-review.md +101 -0
  79. package/skills/review-artifact/references/independent-artifact-reviewer-contract.md +52 -41
  80. package/skills/review-work/SKILL.md +115 -72
  81. package/skills/review-work/references/adjudicate-work-review.md +97 -0
  82. package/skills/review-work/references/independent-work-reviewer-contract.md +40 -35
  83. package/skills/review-work/references/security-risk-lens.md +17 -15
  84. package/skills/setup-freeflow/SKILL.md +14 -17
  85. package/skills/setup-freeflow/references/activation-contract.md +24 -30
  86. package/skills/setup-freeflow/references/host-setup.md +6 -7
  87. package/skills/simplify-code/SKILL.md +97 -39
  88. package/skills/simplify-code/references/simplification-patterns.md +1 -1
  89. package/skills/tdd/SKILL.md +108 -41
  90. package/skills/tdd/references/test-design.md +1 -1
  91. package/skills/track-work/SKILL.md +133 -300
  92. package/skills/track-work/references/working-record-format.md +515 -0
  93. package/skills/track-work/scripts/lib/document.mjs +713 -0
  94. package/skills/track-work/scripts/lib/format.mjs +166 -0
  95. package/skills/track-work/scripts/lib/store.mjs +233 -0
  96. package/skills/track-work/scripts/lib/transitions.mjs +790 -0
  97. package/skills/track-work/scripts/lib/views.mjs +27 -430
  98. package/skills/track-work/scripts/working-record.mjs +292 -98
  99. package/skills/verify-work/SKILL.md +46 -20
  100. package/skills/verify-work/references/browser-runtime-evidence.md +1 -1
  101. package/skills/verify-work/references/integration-evidence.md +1 -7
  102. package/skills/verify-work/references/performance-evidence.md +1 -1
  103. package/skills/workflow/SKILL.md +110 -80
  104. package/skills/workflow/references/domain-skill-composition.md +24 -18
  105. package/skills/write-skill/SKILL.md +218 -62
  106. package/skills/write-skill/references/activation-boundaries.md +63 -21
  107. package/skills/write-skill/references/agent-first-instructions.md +61 -27
  108. package/skills/write-skill/references/progressive-disclosure.md +91 -41
  109. package/skills/write-skill/references/skill-dependency-graphs.md +190 -0
  110. package/runtime/prompts/skills.md +0 -65
  111. package/skills/mode-contract/SKILL.md +0 -104
  112. package/skills/track-work/scripts/lib/codec.mjs +0 -570
  113. package/skills/track-work/scripts/lib/commands.mjs +0 -568
  114. package/skills/track-work/scripts/lib/contract.mjs +0 -303
  115. package/skills/track-work/scripts/lib/model.mjs +0 -506
  116. package/skills/track-work/scripts/lib/operations.mjs +0 -965
  117. package/skills/track-work/scripts/lib/record-store.mjs +0 -264
  118. package/skills/track-work/scripts/lib/result.mjs +0 -37
  119. package/skills/track-work/scripts/lib/rewrites.mjs +0 -740
  120. package/skills/track-work/scripts/lib/schema.mjs +0 -277
  121. package/skills/track-work/scripts/lib/source-inventory.mjs +0 -162
  122. package/skills/track-work/scripts/lib/workspace.mjs +0 -134
@@ -1,77 +1,127 @@
1
1
  # Progressive Disclosure
2
2
 
3
- Read this before adding or reorganizing references and scripts.
3
+ Read this before adding or reorganizing references, assets, or scripts.
4
4
 
5
- Make the first-read route understandable, then move only separately owned or conditional depth out of the active body.
5
+ Progressive disclosure should change when content enters context, preserve one canonical owner, or isolate a real lifecycle boundary. Splitting files without one of those benefits adds dependency cost without reducing context.
6
6
 
7
- ## Dependency Direction
7
+ ## Preserve Dependency Direction
8
8
 
9
9
  ```text
10
10
  description
11
11
  -> SKILL.md
12
- -> required or conditional reference or script
12
+ -> required or conditional resource
13
13
  ```
14
14
 
15
- The description routes the first useful skill read. `SKILL.md` establishes the job, normal method, necessary terms, and stop conditions, then explicitly directs any reference read. References do not activate independently, and an introduction inside an unread reference cannot activate itself.
15
+ `SKILL.md` establishes:
16
16
 
17
- Do not hide a definition, rule, or step needed to recognize the normal route in an unannounced reference. That is progressive reconstruction, not disclosure.
17
+ - the job;
18
+ - normal route;
19
+ - necessary terms;
20
+ - stop and return conditions;
21
+ - observable resource read points.
18
22
 
19
- ## State The Read Point
23
+ A reference cannot activate itself. Do not hide the rule needed to recognize a reference inside that reference.
20
24
 
21
- Use one of three explicit read points:
25
+ That is progressive reconstruction, not disclosure.
22
26
 
23
- - **Entry-required:** read before following the skill's normal route.
24
- - **Activity-required:** read before performing a named activity on the normal route.
25
- - **Conditional:** read only when an observable branch occurs.
27
+ ## Classify The Read Point
26
28
 
27
- Entry-required and activity-required resources are required references. Conditional resources are conditional references. The word “when” does not determine the class: “When designing a test, read Test Design” is activity-required because test design is normal TDD work.
29
+ ### Entry-required
28
30
 
29
- Do not call a required read recommended or optional. If skipping it preserves correct normal execution, it is not required. Avoid “read when unclear” when the reference teaches how to recognize or make the underlying decision; either make the read activity-required or keep enough recognition guidance in `SKILL.md`.
31
+ Read before the skill can follow or reject its normal route.
30
32
 
31
- The body instruction and reference introduction must describe the same read point. An introduction may explain purpose, but must not narrow or widen the condition established by `SKILL.md`.
33
+ Entry-required references are exceptional. Use one only when separation provides independent value, such as:
32
34
 
33
- ## Add A Required Reference When
35
+ - canonical reuse across packages;
36
+ - separate ownership or lifecycle;
37
+ - generated schemas or contracts;
38
+ - compatibility or host constraints;
39
+ - independently versioned external policy.
34
40
 
35
- - normal execution genuinely needs separately owned depth;
36
- - the body can identify and require the read before using that depth;
37
- - keeping the material inline would obscure the skill’s controlling rules;
38
- - the dependency is delivered and validated with the skill package.
41
+ If every useful activation reads the resource and it has no separate ownership or lifecycle value, inline it even when `SKILL.md` becomes substantially longer.
39
42
 
40
- Required does not mean implicit or merely recommended. The body must command the read at entry or before the named normal activity and must not act as if unread content were already known.
43
+ ### Activity-required
41
44
 
42
- ## Add A Conditional Reference When
45
+ Read before performing one named normal activity.
43
46
 
44
- - the material is needed only for a distinct branch of work;
45
- - loading it every time would obscure higher-priority behavior;
46
- - the active body can name an observable condition for reading it;
47
- - the reference has one clear job and does not restate the full skill or Workflow.
47
+ The skill may first:
48
48
 
49
- The condition must be observable before the read. Keep compact examples that teach the normal boundary in `SKILL.md`. Move a larger example set only when it serves a conditional branch and would obscure the normal route.
49
+ - exit;
50
+ - defer;
51
+ - choose another route;
52
+ - determine that the activity does not apply.
53
+
54
+ Activity-required references provide real loading value even when the activity is common.
55
+
56
+ ### Conditional
57
+
58
+ Read only when an observable branch occurs.
59
+
60
+ The body must teach the agent enough to recognize the branch before loading the reference.
61
+
62
+ Do not use “when unclear” if the reference contains the method for recognizing the underlying condition.
63
+
64
+ ## Keep The Normal Route Contiguous
65
+
66
+ Start with one `SKILL.md`.
67
+
68
+ Keep inline:
69
+
70
+ - the first-read job;
71
+ - normal route;
72
+ - controlling definitions;
73
+ - rules needed to select resources;
74
+ - stop and return behavior.
75
+
76
+ Move depth only when keeping it inline would obscure the normal route and the read point is executable.
77
+
78
+ Do not split a file to satisfy a line count.
79
+
80
+ ## Add A Reference When
81
+
82
+ - one named normal activity needs separately owned depth;
83
+ - one observable conditional branch needs depth;
84
+ - one canonical resource is shared without duplication;
85
+ - one resource has a real independent lifecycle;
86
+ - the body can name and require the read before use.
87
+
88
+ The body instruction and reference introduction must state the same read condition.
89
+
90
+ Required means necessary. Do not call a required reference recommended or optional.
91
+
92
+ If skipping the reference preserves correct execution, either make its concrete optional value explicit or remove it.
50
93
 
51
94
  ## Add A Script When
52
95
 
53
- - the skill owns a deterministic feature or repeated operation;
54
- - retyping it is error-prone, unsafe, or materially wasteful;
55
- - its interface and failure behavior can be tested.
96
+ - the skill owns a deterministic repeated operation;
97
+ - model-generated execution would be error-prone, unsafe, or materially wasteful;
98
+ - the interface and failure behavior can be tested;
99
+ - the script’s output has a clear evidence boundary.
56
100
 
57
- A script does not require an earlier failure. Do not script ordinary shell commands merely to look complete.
101
+ Do not script ordinary commands merely to make the package appear complete.
58
102
 
59
103
  ## Link At The Decision Point
60
104
 
61
- A resource link should tell the agent when it becomes useful:
105
+ Link every agent-facing reference, asset, package dependency, and executable entrypoint from `SKILL.md` at the first useful choice.
106
+
107
+ Avoid vague resource lists such as:
108
+
109
+ > See references for more information.
62
110
 
63
- > Read the integration-evidence reference when the claim depends on host dispatch or an installed artifact.
111
+ Prefer:
64
112
 
65
- Avoid vague resource lists such as “See references for more information.”
113
+ > Read Test Design before designing or materially changing the behavior check.
66
114
 
67
- ## Resource Test
115
+ ## Apply The Resource Test
68
116
 
69
- For every extra file, answer:
117
+ For every extra file, ask:
70
118
 
71
- 1. What normal dependency or conditional branch requires it?
72
- 2. When can the agent recognize that read or run condition?
73
- 3. What prior language does the resource assume, and where is it established?
74
- 4. Why cannot the active body or a direct command do the job clearly?
75
- 5. How will the resource be validated and kept consistent?
119
+ 1. What activity, conditional branch, shared ownership, or lifecycle requires it?
120
+ 2. When can the agent recognize the read or run condition?
121
+ 3. What prior language does it assume?
122
+ 4. Where is that language guaranteed?
123
+ 5. What context or ownership value does separation provide?
124
+ 6. Why is inline content worse?
125
+ 7. How will links, containment, and behavior be verified?
76
126
 
77
- If those answers are weak, remove the resource.
127
+ If separation changes neither loading nor ownership, inline the content or remove it.
@@ -0,0 +1,190 @@
1
+ # Skill Dependency Graphs
2
+
3
+ Read this when creating or revising multiple related skills, shared terminology, cross-skill links, capability activation, direct or routed entry paths, or context-loss recovery.
4
+
5
+ A multi-skill system is a stateful, partially loaded prompt graph. It is not a mandatory sequence.
6
+
7
+ ## Identify The Edge Types
8
+
9
+ Do not treat every link as execution.
10
+
11
+ ### Activation edge
12
+
13
+ Causes a skill to be read or made effective:
14
+
15
+ ```text
16
+ natural prompt -> description -> skill
17
+ always-loaded system cue -> recovery skill
18
+ capability cue -> capability skill
19
+ ```
20
+
21
+ ### Owner route
22
+
23
+ Changes which activity controls the current bounded result.
24
+
25
+ A plain-text return may express control flow without creating a Markdown package dependency.
26
+
27
+ ### Composition edge
28
+
29
+ Adds a method, lens, reviewer contract, or domain guide without changing the current owner.
30
+
31
+ ### Reference edge
32
+
33
+ Loads activity-required or conditional depth inside a package.
34
+
35
+ ### Environment-interaction edge
36
+
37
+ Temporarily selects one observation or effect and returns to the same current owner.
38
+
39
+ ### Persistence edge
40
+
41
+ Earlier skill guidance remains in context and may affect later behavior without another read.
42
+
43
+ ### Recovery edge
44
+
45
+ Reintroduces required guidance after context loss through an always-loaded upstream cue.
46
+
47
+ ## Enumerate Every Valid Entry Path
48
+
49
+ For each skill, identify:
50
+
51
+ - natural description activation;
52
+ - orchestrator or lifecycle routes;
53
+ - sibling routes;
54
+ - direct user commands;
55
+ - capability cues;
56
+ - context-loss recovery;
57
+ - host-specific activation;
58
+ - artifact or checkpoint routes.
59
+
60
+ Do not optimize only for the most common path.
61
+
62
+ A skill may rely only on context guaranteed across every valid activation path.
63
+
64
+ If a skill can activate directly, it cannot depend on vocabulary introduced only by a commonly preceding skill.
65
+
66
+ If a skill can activate through an independent recovery cue, it cannot assume that an earlier discussion or planning skill was read first.
67
+
68
+ ## Place Terminology Upstream
69
+
70
+ For every shared term:
71
+
72
+ 1. list all consumers;
73
+ 2. list every valid path to those consumers;
74
+ 3. find the nearest upstream context guaranteed on all paths;
75
+ 4. define the term there;
76
+ 5. keep specialized detail with its owning skill.
77
+
78
+ Place shared vocabulary in the nearest always-available context only when independently activated consumers require it.
79
+
80
+ Keep local terms local when other skills should route to the owner rather than implement its method.
81
+
82
+ Do not duplicate full definitions merely to compensate for a broken activation graph.
83
+
84
+ ## Prevent Self-Activation
85
+
86
+ An unread skill cannot require its own first read.
87
+
88
+ Critical activation must come from:
89
+
90
+ - guaranteed base or system guidance;
91
+ - a skill description;
92
+ - an already-loaded owner;
93
+ - an effective capability cue;
94
+ - another declared upstream path.
95
+
96
+ References follow the same rule: the body must name the read condition before using reference content.
97
+
98
+ ## Check Direct And Routed Paths
99
+
100
+ For every related skill, test:
101
+
102
+ ```text
103
+ direct natural activation
104
+ routed activation from expected parent
105
+ nearby safe-read activation
106
+ retained use after another skill loads
107
+ recovery after context loss
108
+ ```
109
+
110
+ A path that works only because another skill happened to be read is not valid dependency composition.
111
+
112
+ ## Check Redundancy And Inconsistency
113
+
114
+ Across all changed skills, inspect:
115
+
116
+ - duplicate canonical definitions;
117
+ - divergent wording for the same invariant;
118
+ - early commands contradicted by later caveats;
119
+ - two skills claiming the same current ownership;
120
+ - methods or lenses accidentally becoming owners;
121
+ - links with no activation, route, composition, or reference job;
122
+ - terms used before guaranteed definition;
123
+ - body and reference read-condition mismatch;
124
+ - stale recovery cues;
125
+ - direct routes bypassing required context;
126
+ - retained instructions hijacking later owners.
127
+
128
+ Distinguish semantic duplication from intentional local guards.
129
+
130
+ ## Repeat Across Skills Deliberately
131
+
132
+ Repeat a compact invariant when a distinct activation path or decision point requires local protection.
133
+
134
+ Keep:
135
+
136
+ ```text
137
+ canonical owner
138
+ -> complete definition or method
139
+
140
+ consumer
141
+ -> compact local guard
142
+ -> route to canonical owner when needed
143
+ ```
144
+
145
+ Do not copy complete sections across skills. Repetition should preserve meaning without creating competing ownership.
146
+
147
+ ## Keep Routing And Terminology Graphs Distinct
148
+
149
+ Terminology and dependency order should normally flow from guaranteed upstream context toward consumers.
150
+
151
+ Runtime routing may be cyclic:
152
+
153
+ ```text
154
+ For example:
155
+ clarification -> task memory -> clarification
156
+ execution -> verification -> review -> execution
157
+ ```
158
+
159
+ A cyclic routing graph does not justify cyclic terminology dependencies.
160
+
161
+ ## Validate Facts And Evaluate Behavior
162
+
163
+ Deterministic checks can establish:
164
+
165
+ - links;
166
+ - containment;
167
+ - dependency cycles;
168
+ - resource inventory;
169
+ - routing-map parity;
170
+ - exact duplicate text.
171
+
172
+ They cannot establish:
173
+
174
+ - correct activation;
175
+ - safe retained influence;
176
+ - semantic consistency;
177
+ - useful repetition;
178
+ - behavior preservation;
179
+ - readiness.
180
+
181
+ Evaluate the exact graph claim:
182
+
183
+ - activation;
184
+ - first-read body behavior;
185
+ - dependency composition;
186
+ - retained use;
187
+ - recovery;
188
+ - artifact outcome.
189
+
190
+ Do not require a graph artifact for every small skill edit. Use this method when several nodes, paths, terms, or owners change together.
@@ -1,65 +0,0 @@
1
- ## Shared Terms
2
-
3
- - **Authority envelope:** the requested outcome, permitted effects, evidence boundary, and stop condition established by valid current authority.
4
- - **Owner:** the one activity or skill responsible for the current bounded activity. Methods, tools, reviewers, and domain guidance do not take ownership automatically.
5
- - **Bounded activity:** one coherent unit of discussion, preservation, work, evidence, or judgment that can be assessed as one result.
6
- - **Slice:** one coherent outcome that can be executed and checked as a unit. It may span several bounded activities and methods. Track Work gives it durable identity when task memory is needed.
7
- - **Evidence boundary:** the strongest claim the current observer can directly support.
8
- - **Self-review:** after initial evidence supports a bounded result, the producing agent silently checks it once for alignment, suitability, and unnecessary complexity before accepting or reusing it. Self-review is not independent review.
9
- - **Independent review:** separately selected judgment from a context that did not produce the reviewed state. It reports without editing and does not authorize correction.
10
- - **Checkpoint:** a deliberately selected decision, review, preservation, or delivery boundary that must be resolved before dependent work continues. A pause or bounded activity ending is not automatically a checkpoint.
11
- - **Re-entry:** return only to the narrowest owner whose responsibility changed, preserving valid work, decisions, and evidence.
12
- - **Supported Exit:** an evidence-supported answer, wait, pause, handoff, deferment, stop, controlled boundary, or completion.
13
-
14
- ## Three Nested Loops
15
-
16
- One user-facing **Interaction Lifecycle** runs from Entry to Supported Exit:
17
-
18
- ```text
19
- [Entry]
20
- -> [Feedback Loop when needed]
21
- -> [Supported Exit]
22
- ```
23
-
24
- A later user turn or route-changing evidence begins another lifecycle.
25
-
26
- For each bounded activity, the **Feedback Loop** is:
27
-
28
- ```text
29
- Orient
30
- -> choose one owner
31
- -> use the owner
32
- -> gather or produce evidence
33
- -> determine what the result proves
34
- -> self-review the supported result
35
- -> continue, correct, re-enter, ask, defer, stop, or exit
36
- ```
37
-
38
- When the owner must touch the environment, the **Environment Interaction Loop** is:
39
-
40
- ```text
41
- Need evidence or a covered effect
42
- -> select and bound one action
43
- -> choose the tool
44
- -> execute once
45
- -> observe
46
- -> identify what changed
47
- -> reconcile observation residency when available
48
- -> return to the owner
49
- ```
50
-
51
- The Environment Interaction Loop may run zero or more times inside one Feedback Loop. It never changes the owner or authority by itself.
52
-
53
- ## Workflow Cue
54
-
55
- Workflow owns authority, one active owner, evidence-driven re-entry, and Supported Exit. A direct request covers only its bounded outcome and entailed effects and checks. Before uncovered active evidence, mutation, delivery, or another separately controlled action, state the purpose, action, expected result, and stop condition; ask once and wait. Mode, skills, memory, reviews, and new evidence do not grant authority.
56
-
57
- After context loss, rebuild the decision surface from current user direction, bounded task memory, and live evidence. If a Working Record exists, read Track Work before any record operation; use its `resume` view and current schema before mutation, even when another skill owns the surrounding work. If Workflow is unread, read it before consequential work or owner selection. Summaries and records preserve context but do not prove live state or create authority.
58
-
59
- ## Action Selection Cue
60
-
61
- Before an uncertain, broad, or repeated environment interaction, use Action Selection to choose and bound one useful action. Return its observation and state change to the current owner. An obvious mechanical and directly verifiable action takes the fast path without manufactured alternatives.
62
-
63
- ## Supported Exit
64
-
65
- Reach a Supported Exit only when fresh evidence supports the accepted outcome, required self-review and selected checkpoints are resolved, task memory and required artifacts are accurate, and no material contradiction, source conflict, or user-owned decision remains hidden. Report the outcome, evidence, limits, and current route.
@@ -1,104 +0,0 @@
1
- ---
2
- name: mode-contract
3
- description: Use when choosing, changing, or explaining how Freeflow mode applies to current work.
4
- ---
5
-
6
- # Mode Contract
7
-
8
- Apply the effective Freeflow mode without inferring a different mode from the task. Freeflow has exactly three mode values: `conversation`, `workflow`, and `strict-workflow`.
9
-
10
- A mode changes how work proceeds; it does not authorize work, widen the current authority envelope, resolve a user-owned decision, or override live evidence.
11
-
12
- ## Establish The Active Mode
13
-
14
- A mode is active only when the host reports that Freeflow Skills are effective. Keep the supplied layers distinct:
15
-
16
- - **Repository default:** the shared `defaultMode` from `.freeflow/config.json`.
17
- - **Personal default override:** an optional per-checkout `defaultMode` from `.freeflow/local.json`.
18
- - **Session override:** an optional temporary mode managed by the host.
19
- - **Resolved mode:** session override, otherwise personal default override, otherwise repository or built-in default.
20
- - **Effective mode:** the resolved mode only while Skills are active; otherwise no Freeflow mode is effective.
21
-
22
- If runtime reports that modes are inactive, preserve the resolved mode as dormant state without applying it. If effective-mode evidence is missing, do not guess or activate a fallback. Read [Setup Freeflow](../setup-freeflow/SKILL.md) when the user wants to configure, enable, or repair Freeflow.
23
-
24
- Task shape does not change mode. A question during Workflow stays in Workflow; an implementation request during Conversation stays in Conversation until the user changes mode.
25
-
26
- ## Follow The Effective Mode
27
-
28
- ### Conversation
29
-
30
- Answer, discuss, critique, explore, and inspect existing evidence or sources without exercising target behavior or intentionally changing task state.
31
-
32
- Conversation permits passive observation only for task work. Active evidence generation and mutation or delivery require `workflow` or `strict-workflow` plus authority. If the user requests one, explain the mode boundary and ask them to switch through the host's mode control before proceeding.
33
-
34
- Ask only what the answer needs. Conversation mode does not require workflow artifacts, checkpoints, plans, specs, or independent review.
35
-
36
- ### Workflow
37
-
38
- Use the adaptive [Workflow](../workflow/SKILL.md) for active evidence generation and consequential or mutating work. Inspect or ask when ambiguity changes the next action, create durable artifacts only when they preserve needed state or decisions, and verify claims against fresh evidence.
39
-
40
- Workflow mode does not itself authorize a slice or require every lifecycle phase.
41
-
42
- ### Strict Workflow
43
-
44
- Use the same adaptive Workflow with stronger decision, evidence, and checkpoint pressure at high-risk or hard-to-reverse boundaries.
45
-
46
- Apply that pressure when work materially affects security, privacy, billing, data loss, migrations, public interfaces, compatibility, deployment, or architecture. Use [Decision Gate](../decision-gate/SKILL.md) for choices or source conflicts that belong to the user in every mutating mode. Gather evidence for the relevant risk surface before crossing the boundary or claiming success.
47
-
48
- Select artifacts, checkpoints, verification, and independent review when they reduce material risk. Do not add them automatically merely because Strict Workflow is active.
49
-
50
- Strict Workflow does not grant authority, bypass safety, or turn every implementation detail into a user decision.
51
-
52
- ## Change Mode Deliberately
53
-
54
- The user owns mode changes. Recommend `strict-workflow` when risk warrants it, but continue under the effective mode unless the user changes it or another workflow boundary blocks progress.
55
-
56
- A task type, risk classification, direct skill call, or workflow route does not switch mode. Invoking an execution skill during Conversation still does not authorize mutation.
57
-
58
- Use host-managed session control so the change takes effect before the model acts. A clear natural-language instruction may use the same control. Questions, examples, hypotheses, and tentative language do not change mode.
59
-
60
- ```text
61
- Switch to conversation mode. -> session override
62
- Use strict-workflow for this session. -> session override
63
- Should we switch to strict-workflow? -> answer or discuss; no override
64
- Suppose the mode were conversation. -> discussion; no override
65
- ```
66
-
67
- Host-native controls are:
68
-
69
- ```text
70
- Pi:
71
- /freeflow mode conversation
72
- /freeflow mode workflow
73
- /freeflow mode strict-workflow
74
- /freeflow mode reset
75
-
76
- Claude:
77
- /freeflow:mode-contract <conversation|workflow|strict-workflow|reset>
78
-
79
- Codex:
80
- $mode-contract <conversation|workflow|strict-workflow|reset>
81
- ```
82
-
83
- Claude and Codex persist their override in plugin-owned session state keyed by the host session identifier. Pi persists it in branch-aware Pi session state. The override survives ordinary turns and supported resume, clear, and compact boundaries for that session; `reset` clears it and returns to the configured default. A new session starts from configured state.
84
-
85
- Treat only runtime-reported effective state as proof that the control succeeded. If the host reports missing session identity, unavailable writable plugin state, disabled Skills, or another failure, say that mode did not change. Do not compensate by editing a configured default.
86
-
87
- Mention mode only when the user asks, configuration is being discussed, or it changes the next action.
88
-
89
- ## Change Defaults Separately
90
-
91
- A persistent default change is not a session-mode change. Determine which configured layer the user means before editing:
92
-
93
- - explicit **personal** or **local** default targets `.freeflow/local.json`;
94
- - explicit **shared**, **repository**, or **team** default targets `.freeflow/config.json`;
95
- - an unqualified “change the default mode” request leaves that scope user-owned—ask one direct local-versus-repository question and wait;
96
- - “global” is not a defined Freeflow layer—ask whether the user means this checkout's personal default or the shared repository default.
97
-
98
- Do not infer the target from which file already exists or from the current mode. Preserve unrelated settings in the selected layer.
99
-
100
- In Pi, `/freeflow settings` edits personal overrides and `/freeflow settings repo` edits shared defaults. In another host, an agent may update only the explicitly selected valid configuration layer. Session controls never modify either file.
101
-
102
- For agent-performed config edits, obey the effective mode when one exists. Conversation remains read-only. When no mode is effective because Freeflow is unconfigured, inactive, blocked by invalid config, or Skills are dormant, an explicit configuration or [Setup Freeflow](../setup-freeflow/SKILL.md) request governs the selected change; any dormant resolved mode is neither authority nor prohibition. User-operated host controls change their own state before the model continues.
103
-
104
- A current session override remains effective until reset even when a configured default changes. If repository config is missing or invalid, route to Setup Freeflow; a personal override cannot activate Freeflow. If local config is invalid, report the blocking layer and repair or remove it only with authorization. Do not silently overwrite either source. Use Decision Gate when the requested default conflicts with established source truth or accepted direction.