@hassangameryt/freeflow 0.7.1 → 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 (122) 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/README.md +28 -23
  6. package/capabilities/cognitive-routing/SKILL.md +94 -311
  7. package/command-surface.json +7 -1
  8. package/gemini-extension.json +1 -1
  9. package/package.json +4 -4
  10. package/pi-extension/dist/cognitive-routing-v2/budget.js +42 -0
  11. package/pi-extension/dist/cognitive-routing-v2/config.js +120 -0
  12. package/pi-extension/dist/cognitive-routing-v2/projection.js +321 -0
  13. package/pi-extension/dist/cognitive-routing-v2/render.js +231 -0
  14. package/pi-extension/dist/cognitive-routing-v2/runtime.js +1585 -0
  15. package/pi-extension/dist/cognitive-routing-v2/schemas.js +107 -0
  16. package/pi-extension/dist/cognitive-routing-v2/state.js +612 -0
  17. package/pi-extension/dist/cognitive-routing-v2/tools.js +91 -0
  18. package/pi-extension/dist/cognitive-routing-v2/types.js +44 -0
  19. package/pi-extension/dist/freeflow-context/tool.js +5 -0
  20. package/pi-extension/dist/index.js +279 -624
  21. package/pi-extension/dist/runtime/runtime-context.js +63 -13
  22. package/pi-extension/dist/session-sources/events.js +195 -0
  23. package/pi-extension/dist/session-sources/read-only-session.js +148 -0
  24. package/pi-extension/dist/session-sources/sources.js +233 -0
  25. package/pi-extension/dist/settings/settings-ui.js +44 -117
  26. package/pi-extension/src/cognitive-routing-v2/budget.ts +42 -0
  27. package/pi-extension/src/cognitive-routing-v2/config.ts +143 -0
  28. package/pi-extension/src/cognitive-routing-v2/projection.ts +365 -0
  29. package/pi-extension/src/cognitive-routing-v2/render.ts +256 -0
  30. package/pi-extension/src/cognitive-routing-v2/runtime.ts +1634 -0
  31. package/pi-extension/src/cognitive-routing-v2/schemas.ts +109 -0
  32. package/pi-extension/src/cognitive-routing-v2/state.ts +622 -0
  33. package/pi-extension/src/cognitive-routing-v2/tools.ts +93 -0
  34. package/pi-extension/src/cognitive-routing-v2/types.ts +222 -0
  35. package/pi-extension/src/freeflow-context/tool.ts +5 -0
  36. package/pi-extension/src/index.ts +285 -674
  37. package/pi-extension/src/runtime/runtime-context.ts +75 -14
  38. package/pi-extension/src/session-sources/events.ts +208 -0
  39. package/pi-extension/src/session-sources/read-only-session.ts +170 -0
  40. package/pi-extension/src/session-sources/sources.ts +263 -0
  41. package/pi-extension/src/settings/settings-ui.ts +54 -131
  42. package/pi-extension/tests/cognitive-routing-v2/communication.test.js +484 -0
  43. package/pi-extension/tests/cognitive-routing-v2/compaction-input.test.js +183 -0
  44. package/pi-extension/tests/cognitive-routing-v2/native.test.js +441 -0
  45. package/pi-extension/tests/cognitive-routing-v2/performance.test.js +87 -0
  46. package/pi-extension/tests/cognitive-routing-v2/persistence.test.js +245 -0
  47. package/pi-extension/tests/cognitive-routing-v2/projection.test.js +241 -0
  48. package/pi-extension/tests/cognitive-routing-v2/recovery.test.js +236 -0
  49. package/pi-extension/tests/cognitive-routing-v2/render.test.js +230 -0
  50. package/pi-extension/tests/cognitive-routing-v2/runtime.test.js +153 -0
  51. package/pi-extension/tests/cognitive-routing-v2/stabilization.test.js +521 -0
  52. package/pi-extension/tests/cognitive-routing-v2/state.test.js +275 -0
  53. package/pi-extension/tests/context-virtualization/extension.test.js +16 -0
  54. package/pi-extension/tests/fixtures/routing-native.js +188 -0
  55. package/pi-extension/tests/integration/mode-free-core.test.js +3 -2
  56. package/pi-extension/tests/integration/pi-extension.test.js +154 -37
  57. package/pi-extension/tests/integration/prompt-architecture.test.js +87 -6
  58. package/pi-extension/tests/integration/unaffected-regressions.test.js +77 -10
  59. package/plugin.json +1 -1
  60. package/runtime/prompts/cognitive-routing.md +4 -5
  61. package/runtime/prompts/core.md +51 -45
  62. package/runtime/prompts/interaction-contract.md +5 -5
  63. package/skills/action-selection/SKILL.md +57 -97
  64. package/skills/design-for-depth/SKILL.md +58 -193
  65. package/skills/design-for-depth/references/implementation-decisions.md +76 -0
  66. package/skills/diagnose-failure/SKILL.md +64 -196
  67. package/skills/discuss/SKILL.md +64 -123
  68. package/skills/discuss/references/discussion-continuity.md +7 -3
  69. package/skills/execute-work/SKILL.md +69 -88
  70. package/skills/execute-work/references/execute-work-edges.md +9 -3
  71. package/skills/handoff/SKILL.md +44 -54
  72. package/skills/handoff/references/handoff-templates.md +15 -6
  73. package/skills/review-artifact/SKILL.md +80 -127
  74. package/skills/review-artifact/references/independent-artifact-reviewer-contract.md +1 -1
  75. package/skills/review-work/SKILL.md +65 -115
  76. package/skills/review-work/references/independent-work-reviewer-contract.md +1 -1
  77. package/skills/simplify-code/SKILL.md +47 -100
  78. package/skills/track-work/SKILL.md +128 -119
  79. package/skills/track-work/references/working-record-format.md +14 -2
  80. package/skills/verify-work/SKILL.md +58 -62
  81. package/skills/verify-work/references/integration-evidence.md +4 -2
  82. package/skills/verify-work/references/test-design.md +89 -0
  83. package/skills/workflow/SKILL.md +73 -119
  84. package/skills/write-plan/SKILL.md +46 -77
  85. package/skills/write-plan/references/plan-shapes.md +5 -5
  86. package/skills/write-spec/SKILL.md +51 -63
  87. package/skills/write-spec/references/artifact-standards.md +2 -2
  88. package/skills/write-spec/references/decision-records.md +3 -2
  89. package/skills/write-spec/references/spec-shapes.md +15 -0
  90. package/pi-extension/dist/cognitive-routing/commands.js +0 -96
  91. package/pi-extension/dist/cognitive-routing/config.js +0 -232
  92. package/pi-extension/dist/cognitive-routing/controller.js +0 -1292
  93. package/pi-extension/dist/cognitive-routing/history.js +0 -451
  94. package/pi-extension/dist/cognitive-routing/host.js +0 -188
  95. package/pi-extension/dist/cognitive-routing/pi-routing-session.js +0 -414
  96. package/pi-extension/dist/cognitive-routing/pi-session-control.js +0 -320
  97. package/pi-extension/dist/cognitive-routing/runtime.js +0 -43
  98. package/pi-extension/dist/cognitive-routing/tool.js +0 -212
  99. package/pi-extension/dist/cognitive-routing/types.js +0 -6
  100. package/pi-extension/src/cognitive-routing/commands.ts +0 -129
  101. package/pi-extension/src/cognitive-routing/config.ts +0 -303
  102. package/pi-extension/src/cognitive-routing/controller.ts +0 -1628
  103. package/pi-extension/src/cognitive-routing/history.ts +0 -650
  104. package/pi-extension/src/cognitive-routing/host.ts +0 -266
  105. package/pi-extension/src/cognitive-routing/pi-routing-session.ts +0 -538
  106. package/pi-extension/src/cognitive-routing/pi-session-control.ts +0 -444
  107. package/pi-extension/src/cognitive-routing/runtime.ts +0 -57
  108. package/pi-extension/src/cognitive-routing/tool.ts +0 -273
  109. package/pi-extension/src/cognitive-routing/types.ts +0 -89
  110. package/pi-extension/tests/cognitive-routing/commands.test.js +0 -134
  111. package/pi-extension/tests/cognitive-routing/controller.test.js +0 -1128
  112. package/pi-extension/tests/cognitive-routing/extension-lifecycle.test.js +0 -1142
  113. package/pi-extension/tests/cognitive-routing/history.test.js +0 -274
  114. package/pi-extension/tests/cognitive-routing/host-identity.test.js +0 -63
  115. package/pi-extension/tests/cognitive-routing/pi-normal-lifecycle.test.js +0 -434
  116. package/pi-extension/tests/cognitive-routing/pi-session-control.test.js +0 -174
  117. package/pi-extension/tests/cognitive-routing/pi-session-history.test.js +0 -91
  118. package/pi-extension/tests/cognitive-routing/profile-resolution.test.js +0 -279
  119. package/pi-extension/tests/cognitive-routing/tool.test.js +0 -230
  120. package/skills/tdd/SKILL.md +0 -143
  121. package/skills/tdd/references/test-design.md +0 -96
  122. /package/pi-extension/tests/{cognitive-routing/host-fixture.js → fixtures/pi-host.js} +0 -0
@@ -1,257 +1,125 @@
1
1
  ---
2
2
  name: diagnose-failure
3
- description: Use when a bug, failure, regression, performance problem, or repeated unsuccessful correction lacks a supported cause.
3
+ description: "Use when a bug, failure, regression, performance problem, or repeated unsuccessful correction lacks a supported cause."
4
4
  ---
5
5
 
6
6
  # Diagnose Failure
7
7
 
8
- Establish what is failing and why before selecting a correction.
8
+ Establish what fails and why before selecting a correction. A supported cause distinguishes meaningful alternatives well enough to bound the next action; it does not require impossible certainty.
9
9
 
10
- A **diagnostic loop** is a repeatable observation that can support, contradict, or leave unresolved a hypothesis at the boundary where the failure matters.
10
+ A plausible path, requested patch, reviewer theory, or favorable rerun is not a supported cause. Diagnosis owns the causal question, interpretation, and correction boundary—not authority to run experiments or change production.
11
11
 
12
- A **supported cause** is a causal explanation strong enough to distinguish meaningful alternatives and bound the next action. It does not require impossible certainty.
12
+ ## Enter For An Unsettled Cause
13
13
 
14
- A requested patch, plausible code path, reviewer theory, observation consistent with one hypothesis, or one favorable rerun is not a supported cause.
14
+ Use diagnosis for unexplained bugs, failed checks, regressions, flaky or environmental behavior, contradictory observations, and corrections that repeatedly fail or expose related coordination.
15
15
 
16
- Diagnosis owns the hypothesis, causal interpretation, and correction boundary. It does not authorize active evidence generation or correction.
16
+ Do not investigate an ordinary mistake when fresh evidence already establishes a clear local defect and the accepted remedy. Return that correction to [Workflow](../../skills/workflow/SKILL.md). Finding count or several bugs in one area does not establish a shared structural cause.
17
17
 
18
- ## Enter Only When Cause Is Unsettled
18
+ Keep diagnosis within the same coherent Slice. Use [Track Work](../../skills/track-work/SKILL.md) when continuity requires preserving the hypothesis, discriminating evidence, rejected approaches, blocker, and next useful action. Do not record every trial.
19
19
 
20
- Use diagnosis for:
20
+ ## Establish The Failure, Not The Proposed Fix
21
21
 
22
- - an unexplained bug, failed test, regression, or runtime failure;
23
- - flaky, timing-dependent, environmental, or performance behavior;
24
- - contradictory evidence;
25
- - related corrections that keep failing;
26
- - patches that repeatedly expose additional state or coordination;
27
- - review findings whose shared cause remains unsupported.
22
+ Identify only what the investigation needs:
28
23
 
29
- Do not diagnose an ordinary mistake when fresh evidence already establishes one clear local defect and accepted behavior is settled. Return that correction to [Workflow](../../skills/workflow/SKILL.md).
30
-
31
- Review count, finding count, or several bugs in one area do not by themselves prove a shared or structural cause.
32
-
33
- Diagnosis may recur inside one Slice. A new hypothesis or observation does not create a new Slice by itself. When a Working Record exists, use [Track Work](../../skills/track-work/SKILL.md) to preserve the current hypothesis, evidence, blocker, and next distinguishing action.
34
-
35
- ## Establish The Failure Boundary
36
-
37
- Before generating new evidence, identify:
38
-
39
- - the failure claim;
40
24
  - accepted expected behavior and its source;
41
- - observed behavior and existing evidence;
42
- - reported input, state, environment, and reproduction path;
43
- - the strongest boundary currently observed;
44
- - differences between the reported path and available reproduction;
45
- - evidence that already contradicts possible explanations.
46
-
47
- Prefer the reported path, environment, and observer. A nearby failure may suggest a hypothesis but does not establish the reported failure.
25
+ - observed symptom and available counterevidence;
26
+ - relevant input, state, environment, timing, and reported path;
27
+ - the strongest boundary actually observed;
28
+ - any difference between that boundary and the reported failure.
48
29
 
49
- Reduced-fidelity reproduction remains diagnostic evidence only. State what it cannot prove.
30
+ Prefer the reported path and environment. A nearby symptom may suggest a hypothesis but does not reproduce the reported defect. State reduced-fidelity limits explicitly.
50
31
 
51
- Allowed behavior is not reproduction. A cache hit does not prove a stale-read defect when caching is permitted. A possible race in source does not explain a report until timing, traces, state, or accepted behavior connects it.
32
+ Allowed behavior is not a bug: a cache hit does not establish stale-read failure when caching is permitted. A possible race in source is not the cause without evidence connecting its timing and state to the symptom.
52
33
 
53
- ## State Competing Hypotheses
34
+ Use [Decision Gate](../../skills/decision-gate/SKILL.md) when accepted behavior or source truth is unsettled. Do not invent an expectation and then diagnose why the implementation violates it.
54
35
 
55
- State one falsifiable leading hypothesis and only the viable alternatives the next observation must distinguish.
36
+ ## Choose A Distinguishing Observation
56
37
 
57
- For each, identify:
38
+ State a falsifiable leading explanation and only the viable alternatives the next observation must distinguish:
58
39
 
59
40
  ```text
60
41
  Hypothesis:
61
42
  Predicted observation:
62
- Observation that would contradict it:
43
+ What would contradict it:
63
44
  Meaningful alternative:
64
45
  ```
65
46
 
66
- Do not create a hypothesis around the requested patch and then use that hypothesis to prove the patch is necessary.
67
-
68
- When accepted behavior, source truth, or a user-owned choice is unsettled, use [Decision Gate](../../skills/decision-gate/SKILL.md) rather than diagnosing an invented expectation.
69
-
70
- ## Choose One Distinguishing Loop
71
-
72
- Choose the smallest observation whose possible outcomes differ between the meaningful hypotheses at the required boundary.
73
-
74
- When the exact loop is not obvious, or several loop shapes remain plausible, read the [Diagnostic Loop Catalog](references/diagnostic-loop-catalog.md).
75
-
76
- When timing, randomness, environmental variance, concurrency, or resource behavior shapes the failure, also read [Flaky and Performance Diagnosis](references/flaky-and-performance-diagnosis.md) before selecting or running the loop.
77
-
78
- When several tools or observers could execute the same selected loop, or the likely interaction is broad, use [Action Selection](../../skills/action-selection/SKILL.md). It selects the interaction; Diagnose Failure retains the hypothesis and causal question.
79
-
80
- Before an active observation, confirm that the authority envelope covers:
81
-
82
- - the exact path and environment;
83
- - mutation, repetition, instrumentation, and cost;
84
- - evidence collection and sensitive-data handling;
85
- - cleanup, rollback, or recovery.
86
-
87
- Otherwise return the loop's purpose, expected distinguishing evidence, and stop condition to Workflow and wait.
88
-
89
- When no safe useful loop exists, stop with the smallest missing evidence: failing input, command, trace, log window, seed, timestamp, environment, permission, or isolated instrumentation.
90
-
91
- ## Run And Interpret One Iteration
92
-
93
- Run one covered observation and change one distinguishing variable at a time.
94
-
95
- Apply [Verify Work](../../skills/verify-work/SKILL.md) when the observation requires its full claim-and-boundary method. Diagnosis retains ownership of causal inference after verification returns the evidence.
96
-
97
- Keep three results separate.
98
-
99
- ### Check Result
100
-
101
- How did the selected observation's defined assertion execute?
47
+ Choose a repeatable diagnostic loop whose possible results differ between those explanations. Do not build a hypothesis around the requested patch and then treat consistency with it as proof of necessity.
102
48
 
103
- Use Verify Work's check-result semantics:
49
+ Read [Diagnostic Loop Catalog](references/diagnostic-loop-catalog.md) when the exact loop is not obvious or several loop shapes are plausible. Read [Flaky and Performance Diagnosis](references/flaky-and-performance-diagnosis.md) when timing, randomness, environment, concurrency, or resources shape the failure.
104
50
 
105
- - **Passed:** the observation executed validly and its assertion held.
106
- - **Failed:** the observation executed validly and its assertion did not hold.
107
- - **Error:** the observer or execution was invalid.
108
- - **Unavailable:** the observation could not be attempted safely or reliably.
51
+ Use [Action Selection](../../skills/action-selection/SKILL.md) when tools, targets, or observers for the selected causal question remain uncertain or broad. Stop reading when adequate context supports the experiment; the objective is not exhaustive understanding of the subsystem.
109
52
 
110
- A target path may intentionally fail while the diagnostic check Passes. An Error or Unavailable observer says nothing about the production cause.
53
+ Before active evidence generation, confirm that the agreement covers the path, environment, repetition, instrumentation, cost, sensitive-data handling, and cleanup or recovery. Covered bug investigation needs no extra permission solely because it is diagnosis. Otherwise return the proposed observation and stop condition to Workflow and wait.
111
54
 
112
- ### Hypothesis Result
55
+ If no safe useful observer is available, report the smallest missing input, trace, environment, permission, or instrumentation rather than patching a guess.
113
56
 
114
- What does the evidence establish about the tested hypothesis?
57
+ ## Interpret One Iteration
115
58
 
116
- - **Supported:** direct evidence establishes the hypothesis at its stated boundary.
117
- - **Contradicted:** evidence shows the hypothesis is false.
118
- - **Inconclusive:** the observation cannot distinguish it from meaningful alternatives.
119
- - **Unavailable:** the required evidence cannot currently be obtained.
59
+ Run one covered observation, changing one distinguishing variable at a time. Use [Verify Work](../../skills/verify-work/SKILL.md) for its claim-and-boundary method when needed. Diagnosis retains ownership of causal inference.
120
60
 
121
- ### Cause Status
61
+ Keep three results separate:
122
62
 
123
- - **Supported:** the evidence establishes a useful causal explanation.
124
- - **Unresolved:** one or more causal links or meaningful alternatives remain open.
63
+ - **Check result:** Passed, Failed, Error, or Unavailable under Verify Work's assertion-relative meanings. Observing an expected target failure can be a Passed check.
64
+ - **Hypothesis result:** Supported, Contradicted, Inconclusive, or Unavailable at the stated observing boundary.
65
+ - **Cause status:** Supported or Unresolved.
125
66
 
126
- A Supported hypothesis does not automatically establish a Supported cause.
67
+ A supported hypothesis need not establish the cause. A useful supported cause connects trigger and state through mechanism to the symptom, predicts the observations, materially weakens viable alternatives, and is sufficient to bound a correction without guessing.
127
68
 
128
- A cause is Supported only when the evidence:
69
+ If only the strongest remaining hypothesis is supported, say so and identify its missing causal link. Do not claim certainty from one consistent observation.
129
70
 
130
- 1. establishes the relevant failure or strongest available observer;
131
- 2. behaves as the causal explanation predicts;
132
- 3. materially weakens meaningful alternatives;
133
- 4. connects trigger and state through mechanism to the observed symptom;
134
- 5. is sufficient to bound a correction or other next action without guessing.
71
+ Route from the result:
135
72
 
136
- If evidence supports only the strongest remaining hypothesis, report it as such and identify the observation that would confirm or refute the missing causal link.
73
+ - Check Error -> repair or replace the observer, not production.
74
+ - Check Unavailable -> return the missing evidence or authority.
75
+ - Hypothesis Contradicted -> preserve the result and revise the explanation.
76
+ - Hypothesis Inconclusive -> choose a sharper observer if one is useful and covered.
77
+ - Hypothesis Supported, cause Unresolved -> test the remaining material link or alternative.
78
+ - Cause Supported -> return the correction boundary.
137
79
 
138
- ## Route From The Iteration
80
+ Stop when the cause is sufficiently supported or no covered observation can materially improve the decision. Do not keep investigating merely because stronger certainty is imaginable.
139
81
 
140
- - **Check Error:** repair or replace the observer; do not change production code.
141
- - **Check Unavailable:** stop with the missing evidence or authority.
142
- - **Hypothesis Contradicted:** preserve the evidence, then refine or replace the hypothesis.
143
- - **Hypothesis Inconclusive:** choose a sharper distinguishing loop.
144
- - **Hypothesis Supported, cause Unresolved:** test the remaining causal link or alternative.
145
- - **Cause Supported:** return the causal explanation and correction boundary to Workflow.
146
- - **Behavior or source conflict:** use Decision Gate.
147
- - **Supported structural pressure:** apply [Design for Depth](../../skills/design-for-depth/SKILL.md) under the current owner.
148
- - **Active harm before cause:** return one bounded containment option to Workflow.
82
+ ## Keep The Investigation Inside The Task
149
83
 
150
- Do not continue because diagnosis started. Stop when no safe observation can materially improve the route.
84
+ Before following another prerequisite, distinguish a limitation of the current observer or approach from a requirement of the accepted outcome. A failed reproduction method is not proof that production needs new infrastructure, stronger guarantees, or a host change.
151
85
 
152
- ## Protect Diagnostic Evidence
86
+ Choose the smallest supported correction preserving accepted behavior. If the remedy changes scope, compatibility, public behavior, failure semantics, or another user-owned boundary, return the concrete consequence and alternatives through Workflow before adopting it.
153
87
 
154
- Treat logs, traces, payloads, screenshots, dumps, production samples, and browser state as potentially sensitive. Minimize and sanitize them. Do not expose credentials, tokens, unrestricted personal data, or private payloads.
155
-
156
- Bound repetition by time, cost, side effects, and environment safety. Do not repeatedly exercise mutating production behavior without explicit authority and an understood recovery boundary.
157
-
158
- Temporary instrumentation must distinguish hypotheses. Keep it isolated and state:
159
-
160
- - what it observes;
161
- - mutation or performance impact;
162
- - cleanup and removal condition;
163
- - whether it remains after diagnosis.
164
-
165
- Preserve contradictory and unfavorable evidence. Do not rerun until it disappears.
166
-
167
- ## Identify The Owning Cause
168
-
169
- Classify only what evidence supports:
88
+ Classify only the owning cause supported by evidence:
170
89
 
171
90
  - local implementation defect;
172
91
  - invalid, stale, or inadequate check;
173
- - environment, dependency, data, timing, or configuration cause;
174
- - missing observer or insufficient evidence;
92
+ - environment, dependency, data, timing, or configuration issue;
93
+ - missing observer or evidence;
175
94
  - unsettled behavior or source conflict;
176
- - wrong result, scope, order, or execution strategy;
95
+ - wrong result, scope, order, or strategy;
177
96
  - structural ownership, interface, state, or failure-unit pressure.
178
97
 
179
- Diagnosis determines whether observed pressure is causal.
180
-
181
- Use Design for Depth only after diagnosis establishes structural pressure, or when direct design evidence independently establishes caller coordination, distributed policy, unowned state, interface leakage, or failure-unit pressure. Design for Depth shapes the supported ownership boundary; it does not re-prove the cause.
182
-
183
- If design work exposes an unsupported causal assumption that changes the boundary choice, re-enter diagnosis with that exact assumption and the alternatives it must distinguish.
184
-
185
- ## Contain Harm Without Claiming A Fix
186
-
187
- When immediate harm must be limited before cause is Supported, return one bounded containment option to Workflow.
188
-
189
- Containment must:
98
+ Use [Design for Depth](../../skills/design-for-depth/SKILL.md) when causal or direct design evidence establishes structural pressure. It shapes the boundary without re-proving the cause. If design reveals an unsupported causal premise, return to diagnosis with that exact uncertainty.
190
99
 
191
- - reduce immediate harm;
192
- - remain narrower and more reversible than a guessed correction;
193
- - preserve diagnostic evidence;
194
- - define verification and recovery;
195
- - avoid settling unresolved behavior;
196
- - be reported as mitigation, not resolution.
100
+ ## Protect Evidence And Contain Harm
197
101
 
198
- A requested patch may instead be an authorized learning action. Its result can strengthen or weaken a hypothesis; it does not become selected production behavior automatically.
102
+ Logs, traces, payloads, dumps, screenshots, and browser state may be sensitive. Minimize and sanitize them; do not expose credentials or unnecessary private data. Bound repetitions by time, cost, effects, and environment safety. Preserve unfavorable evidence rather than rerunning until it disappears.
199
103
 
200
- ## Return The Correction Boundary
104
+ Temporary instrumentation must distinguish hypotheses. Keep it isolated and state its observer, mutation/performance impact, removal condition, and whether it remains afterward.
201
105
 
202
- When cause is Supported, return:
106
+ When immediate harm needs containment before diagnosis is settled, return one narrower, reversible mitigation to Workflow. It must preserve evidence, define checking and recovery, and avoid settling undefined behavior. Report mitigation as containment, not resolution.
203
107
 
204
- - failure claim and required boundary;
205
- - diagnostic loop and observation;
206
- - check result and hypothesis result;
207
- - causal chain;
208
- - alternatives weakened and uncertainty remaining;
209
- - owning cause;
210
- - smallest coherent correction boundary;
211
- - minimized regression signal;
212
- - original reported path or strongest available observer.
108
+ A requested experimental patch can generate evidence when authorized as learning. It does not automatically select production behavior or authorize continuing beyond its question.
213
109
 
214
- The evidence supports the route but does not authorize correction.
110
+ ## Return A Supported Correction Boundary
215
111
 
216
- Return an authorized correction to [Execute Work](../../skills/execute-work/SKILL.md). Use [TDD](../../skills/tdd/SKILL.md) when the diagnostic loop supplies a stable failing behavior check. Use [Simplify Code](../../skills/simplify-code/SKILL.md) only when the supported cause shows that obsolete or workaround machinery can be removed without changing accepted behavior. Do not use cleanup in place of correcting the supported failure or while its evidence remains unresolved.
112
+ Return proportionately:
217
113
 
218
- After correction, use Verify Work to check both:
114
+ - failure and accepted expectation at the required boundary;
115
+ - observed diagnostic loop, check result, and hypothesis result;
116
+ - causal chain, alternatives weakened, and remaining uncertainty;
117
+ - owning cause and smallest coherent correction;
118
+ - minimized regression signal and original reported path or strongest available observer;
119
+ - instrumentation, containment, residual effects, and authority limits.
219
120
 
220
- 1. the minimized regression signal;
221
- 2. the original reported path or strongest available observer.
121
+ An already-covered correction can return to [Execute Work](../../skills/execute-work/SKILL.md). Preserve the diagnostic evidence and use suitable regression checks without prescribing a formal test-first sequence. Use [Verify Work](../../skills/verify-work/SKILL.md) to design or classify those checks. Use [Simplify Code](../../skills/simplify-code/SKILL.md) only for an accepted behavior-preserving removal of obsolete or workaround machinery, not as a substitute for the fix.
222
122
 
223
- If correction fails, or exposes related shared-state consequences, re-enter diagnosis before another patch.
224
-
225
- Do not claim fixed when only containment succeeded, a nearby check passed, or the original boundary remains unavailable.
226
-
227
- ## Report Proportionately
228
-
229
- For one unresolved iteration:
230
-
231
- ```text
232
- Failure @ boundary:
233
- Diagnostic loop:
234
- Check result:
235
- Hypothesis result:
236
- Cause status: Unresolved
237
- Next distinguishing evidence:
238
- ```
239
-
240
- For a supported cause, containment, conflicting evidence, or a route handoff:
241
-
242
- ```text
243
- Failure claim:
244
- Required boundary:
245
- Expected / observed:
246
- Diagnostic loop and evidence:
247
- Check result:
248
- Hypothesis result:
249
- Cause status:
250
- Causal explanation or strongest remaining hypothesis:
251
- Alternatives weakened / unresolved:
252
- Containment or instrumentation:
253
- Correction boundary or next evidence:
254
- Post-correction verification:
255
- ```
123
+ After correction, verify the minimized regression signal and the original reported path or strongest available observer. A nearby passing test is insufficient. If the fix fails or reveals related shared-state consequences, re-enter the affected causal question before another patch.
256
124
 
257
- Omit fields that do not apply. Stop when the supported route, missing evidence, containment boundary, or unresolved decision is explicit.
125
+ Stop with the supported correction, missing evidence, containment boundary, or unresolved decision explicit. Do not claim fixed when only mitigation succeeded or the reported boundary remains unverified.
@@ -1,175 +1,116 @@
1
1
  ---
2
2
  name: discuss
3
- description: "Use when the user is exploring, challenging, or revisiting what to build or how to proceed, or when assumptions, alternatives, or new evidence leave the next sound action materially uncertain."
3
+ description: "Use when exploring, clarifying, or revisiting what to accomplish or how to approach it, especially when user collaboration, alternatives, assumptions, or new evidence could change the next action."
4
4
  ---
5
5
 
6
6
  # Discuss
7
7
 
8
- Build enough shared understanding to choose the next sound action.
8
+ Build enough shared understanding to choose the next sound action. Discussion can establish both what to accomplish and how to approach it; it need not end at requirements or continue until every implementation detail is known.
9
9
 
10
- Discuss owns exploration, alternatives, assumptions, and direction. It may shape recommendations, proposed work, and checkpoints. It does not authorize active evidence generation, mutation, delivery, or a user-owned decision.
10
+ Discuss owns exploration, alternatives, assumptions, and direction. It does not turn conversation, a recommendation, or a recorded proposal into execution authority.
11
11
 
12
- ## Enter Or Exit Cleanly
12
+ ## Start From The User's Intent
13
13
 
14
- Use Discuss when:
14
+ Respond to the substance before steering the process.
15
15
 
16
- - the outcome, boundary, approach, or acceptance remains materially open;
17
- - several meaningful paths remain viable;
18
- - an assumption or earlier direction needs reconsideration;
19
- - new evidence makes the next route uncertain.
16
+ A request to discuss keeps the user involved as understanding develops. Gather relevant existing facts when needed, explain what they imply, and return at the next meaningful question or supported conclusion. Do not treat convergence as permission to implement.
20
17
 
21
- Do not turn every interaction into a discussion phase. If the user asks a direct factual question, provides a clear bounded request, or gives feedback that does not reopen direction, answer or return the request to Workflow.
18
+ A direct action request may already settle the outcome and delegate approach selection. Do not force a discussion phase when existing evidence can resolve the remaining facts and reversible local choices. Return clear covered work to [Workflow](../workflow/SKILL.md).
22
19
 
23
- When one known user-owned choice or source conflict blocks progress, use [Decision Gate](../decision-gate/SKILL.md). When a failure lacks a supported cause or keeps recurring, use [Diagnose Failure](../diagnose-failure/SKILL.md).
20
+ Use [Decision Gate](../decision-gate/SKILL.md) for one known blocking user-owned choice or source conflict. Use [Diagnose Failure](../diagnose-failure/SKILL.md) when a reported or recurring failure needs a supported cause rather than broader option discussion.
24
21
 
25
- ## Discuss Like A Collaborator
22
+ ## Separate Outcome From Approach
26
23
 
27
- Respond to the user’s substance before steering the conversation.
24
+ Identify which understanding is missing:
28
25
 
29
- Carry your share of the thinking:
30
-
31
- - interpret what the current evidence and intent imply;
32
- - expose consequential assumptions and tradeoffs;
33
- - challenge claims when evidence or engineering judgment warrants it;
34
- - recommend a direction when one is better supported;
35
- - revise your position plainly when new reasoning or evidence changes it.
36
-
37
- Ask only questions whose answers could materially change the route and which available evidence cannot answer. Ask the user about intent, priorities, constraints, and tradeoffs they own. Do not make the user answer factual questions that existing sources can resolve.
38
-
39
- Keep one consequential uncertainty in focus. Do not conduct a questionnaire, manufacture alternatives, repeat accepted context, or continue arguing for a rejected path without new evidence.
40
-
41
- ## Follow The Discussion Loop
42
-
43
- ```text
44
- Orient from what remains true
45
- -> respond to the current substance
46
- -> focus the uncertainty that could change the route
47
- -> inspect facts, ask about intent, or compare meaningful paths
48
- -> determine what is now supported
49
- -> continue discussion
50
- -> learn through bounded action
51
- -> decide continuity
52
- -> route the supported result
53
- ```
54
-
55
- Use this as a feedback loop, not a user-facing checklist.
56
-
57
- ## Orient Without Restarting
26
+ - **What:** the problem or opportunity, desired result, accepted behavior, constraints, non-goals, and what would count as success.
27
+ - **How:** the mechanism, dependencies, affected boundaries, tradeoffs, and evidence needed to produce that result in the actual environment.
58
28
 
59
- Identify only what the next decision needs:
29
+ These questions can be answered together. Reuse what remains supported instead of running two compulsory discovery passes. A detailed request may settle what while leaving how open; an investigation may reveal that the initial problem description was wrong.
60
30
 
61
- - the goal and current direction;
62
- - supported facts and explicit decisions;
63
- - tentative assumptions or viable alternatives;
64
- - open questions capable of changing the route;
65
- - evidence that still matters.
31
+ Keep supported facts and explicit decisions distinct from hypotheses, proposed mechanisms, and unresolved choices. Do not turn an assistant recommendation into a requirement because it is repeated or recorded.
66
32
 
67
- Keep these distinctions available:
33
+ When reopening discussion, name what changed and preserve unaffected understanding. A new local obstacle does not reopen the whole task.
68
34
 
69
- - **Settled:** supported fact or explicit decision.
70
- - **Tentative:** live hypothesis or provisional direction.
71
- - **Open:** unresolved and capable of changing the next action.
35
+ ## Gather Context To Answer A Question
72
36
 
73
- Use those labels in the response only when they make a transition or summary clearer. Do not turn every discussion turn into a status report.
37
+ Before inspecting the environment, identify the missing fact and how its answer could change the discussion. Check whether current evidence already supplies it.
74
38
 
75
- When discussion reopens after implementation, feedback, verification, review, or failure, preserve what still holds and revisit only the affected assumption, decision, or direction.
39
+ Use [Action Selection](../action-selection/SKILL.md) for uncertain or broad inspection. Prefer a focused source, caller, contract, or observation over a repository survey. Read more only when the result leaves a material question unresolved.
76
40
 
77
- When a Working Record exists, read [Track Work](../track-work/SKILL.md) before any record operation. Recover the relevant current state, reconcile it with current user direction and live evidence, and return to the question that actually changed. Memory does not override contradictory evidence or current intent.
41
+ Existing code, tests, documentation, policies, artifacts, repository state, supplied material, and current primary sources may settle factual questions. Inspect them rather than asking the user to supply facts available to the agent. Source inspection cannot establish unobserved runtime behavior.
78
42
 
79
- ## Resolve What Conversation Can Resolve
43
+ Stop gathering when sufficient evidence supports the next decision. Do not collect every later dependency, reconstruct exhausted history, or prepare an exact implementation plan while the outcome is still open.
80
44
 
81
- Inspect existing code, tests, documentation, policies, artifacts, repository state, supplied material, or current primary sources when they can answer a factual question without exercising target behavior or changing state.
45
+ ## Collaborate And Recommend Proportionately
82
46
 
83
- When several observations could answer the same question, or the likely inspection is broad, use [Action Selection](../action-selection/SKILL.md) to choose the smallest discriminating observation.
47
+ Carry your share of the thinking:
84
48
 
85
- When materially different paths remain viable:
49
+ - explain what the evidence and intent imply;
50
+ - challenge unsupported claims and consequential assumptions;
51
+ - compare only materially different paths that could realistically be chosen;
52
+ - state what each sacrifices and the assumptions it needs;
53
+ - recommend the best-supported direction and what would change it;
54
+ - revise your position when evidence changes.
86
55
 
87
- 1. compare only the paths that could realistically be chosen;
88
- 2. state what each optimizes and what it sacrifices;
89
- 3. identify the assumptions on which each path depends;
90
- 4. recommend the best-supported direction;
91
- 5. state what evidence or changed priority would alter that recommendation.
56
+ Ask about priorities, behavior, constraints, and tradeoffs the user owns. Keep one consequential uncertainty in focus; do not conduct a questionnaire or manufacture alternatives for ordinary choices.
92
57
 
93
- When architecture, interfaces, ownership, state, or failure behavior shapes the direction, use [Design for Depth](../design-for-depth/SKILL.md) as a lens.
58
+ Before recommending a new obligation, distinguish a requirement from a limitation of the current approach. Explain consequences in user terms: "requires changing and distributing a patched host," not merely "needs a provenance interface." Include a simpler in-scope alternative when one is supported. Do not weaken required behavior to make an approach look simpler.
94
59
 
95
- Converge when the next sound action no longer depends on unresolved direction. Do not continue discussion merely because more detail could be explored.
60
+ Use [Design for Depth](../design-for-depth/SKILL.md) when ownership, interfaces, state, dependencies, or failure behavior materially shape the choice. A lens is not a reason to design a broader system.
96
61
 
97
- ## Learn Through Bounded Action
62
+ ## Frame And Assess A Learning Action
98
63
 
99
- Do not keep reasoning about an empirical uncertainty when a small, reversible experiment can discriminate between the remaining hypotheses.
64
+ Use an experiment or prototype when existing evidence cannot settle a material question and exercising behavior can distinguish the remaining answers. A separate prototype should isolate the uncertainty more safely or economically than changing production; unfamiliarity alone does not require one.
100
65
 
101
- Use a Learning action when:
66
+ If the work is an accepted useful outcome regardless of what it teaches, treat it as Delivery or Deepening rather than disguise implementation as Learning. Incidental learning does not change its authority or acceptance boundary.
102
67
 
103
- - accepted evidence and passive inspection cannot answer a material question;
104
- - exercising behavior, building a prototype, testing an assumption, or writing disposable code can answer it;
105
- - the expected information can change the direction;
106
- - the action can be bounded by evidence and a stop condition.
68
+ Frame the action before proposing execution:
107
69
 
108
- Propose:
70
+ - the question and its consequence for the accepted outcome or approach;
71
+ - plausible answers and the observation that would distinguish them;
72
+ - the smallest adequate prototype or observer;
73
+ - permitted effects, environment, and production exclusion;
74
+ - expected evidence and return conditions: question answered, observing limit reached, or further work requiring a different question or expanded scope;
75
+ - what would justify discarding, revising, or proposing promotion.
109
76
 
110
- ```text
111
- Question or hypothesis:
112
- Smallest discriminating action:
113
- Reversible effects and production boundary:
114
- Expected evidence:
115
- Stop and return when:
116
- Discard, revise, or propose promotion when:
117
- ```
77
+ Add a time or cost boundary when repetition or setup could grow; do not demand an exact token prediction. If no adequate observer is available within scope, state the limitation rather than inventing a proof.
118
78
 
119
- A learning proposal does not authorize execution. Before returning it to Workflow, decide whether its context needs durable preservation. Workflow confirms authority and routes covered work through [Track Work](../track-work/SKILL.md) when needed and then [Execute Work](../execute-work/SKILL.md).
79
+ Return the framed action to Workflow for authority and, when needed, [Track Work](../track-work/SKILL.md) preservation, then [Execute Work](../execute-work/SKILL.md) for execution. Existing authority may already cover the experiment; its name does not create another approval gate.
120
80
 
121
- Return the result to Discuss. Treat prototypes, tests, benchmarks, sketches, and working behavior as evidence—not automatic approval of their design or promotion into production.
81
+ Assess returned evidence against the original question. Negative or inconclusive evidence is a valid result; one failed technique does not prove every alternative impossible. If a new prerequisite is reported, distinguish a limitation of the observer or chosen approach from a requirement of the intended outcome before recommending more work.
122
82
 
123
- If the work remains valuable as an accepted outcome regardless of what it teaches, propose a Delivery or Deepening result instead of disguising it as Learning.
83
+ Revise only the affected understanding. Preserve the consequence for the task, remaining uncertainty, and exploratory-artifact disposition when continuity matters. A successful demonstration is not production acceptance; promotion must be deliberately selected and its effects authorized. Stop assessment when the supported next direction or unresolved decision is clear.
124
84
 
125
- ## Decide Continuity Before Leaving
85
+ ## Preserve A Useful Route When Needed
126
86
 
127
- Before discussion hands off a supported direction, ask:
87
+ When the likely work becomes clear enough, propose coherent outcomes and their dependencies. Keep near-term work concrete and later work directional. A rough route need not wait for a formal Plan; its order may change as evidence arrives.
128
88
 
129
- > Would losing the current understanding, decisions, evidence, proposals, or next action risk later misalignment?
89
+ Ask whether losing the current understanding, decisions, evidence, proposals, or next action would risk misalignment. If not, keep it in conversation.
130
90
 
131
- If no, keep the state in conversation.
132
-
133
- If yes, read [Discussion Continuity](references/discussion-continuity.md) before choosing or preserving the durable destination. When a Working Record is appropriate:
91
+ If continuity matters, read [Discussion Continuity](references/discussion-continuity.md), then Track Work before record operations. Preserve the state that made memory necessary, not an empty shell or transcript. Keep the outcome separate from the current approach and retain material uncertainty instead of describing proposals as settled work.
134
92
 
135
93
  ```text
136
- Discuss
137
- -> material supported state
138
- -> Track Work update
139
- -> Discuss
140
- -> Workflow
94
+ Discuss establishes supported meaning
95
+ -> Track Work preserves material state
96
+ -> Discuss continues or returns the direction to Workflow
141
97
  ```
142
98
 
143
- Discuss decides what the state means and whether it needs continuity. Track Work owns the Working Record and its lifecycle. A record update does not end discussion, authorize work, select a proposal, or change the owning route.
144
-
145
- Do not create a Working Record for a short disposable exchange or one clear direct result merely because discussion occurred. Reconsider the decision if a small task develops durable decisions, several outcomes, repeated feedback, checkpoints, or context-loss risk.
146
-
147
- ## Shape Checkpoints Sparingly
148
-
149
- Recommend a user decision, independent review, local commit, or continuity checkpoint only when crossing that boundary unresolved could materially endanger dependent work.
150
-
151
- Discussion may propose a checkpoint. Workflow selects it. Track Work preserves it when durable memory is needed. A recommendation or recorded checkpoint does not authorize the action it describes.
152
-
153
- ## Return Supported Direction
99
+ The record does not select work or grant authority. Propose independent review, a local commit, a user decision, or a continuity checkpoint only when it protects a material boundary; Workflow selects it.
154
100
 
155
- Return to [Workflow](../workflow/SKILL.md) with the concepts the next route needs:
101
+ ## Converge And Return
156
102
 
157
- - current shared understanding;
158
- - settled and tentative direction;
159
- - open questions that still change the route;
160
- - recommended next action or bounded proposal;
161
- - continuity decision;
162
- - authority state and selected checkpoint, when any.
103
+ End the current discussion when the next sound action no longer depends on unresolved direction, or when a bounded learning action, missing user decision, wait, or stop is clear. Do not continue merely because more detail could be explored.
163
104
 
164
- Use natural prose unless structured state materially improves continuity.
105
+ When the user requests execution, return to Workflow to establish its outcome, scope, and user-facing return condition. If the user delegates the remaining investigation and implementation, do not require them to finish planning it.
165
106
 
166
- Route narrowly:
107
+ Return only what the next route needs: supported understanding, tentative approach, material open questions, relevant evidence, recommended or accepted next action, continuity, and authority state.
167
108
 
168
- - one user-owned choice or source conflict -> Decision Gate;
169
- - unexplained or repeated failure -> Diagnose Failure;
170
- - stable accepted content -> [Write Spec](../write-spec/SKILL.md);
171
- - stable ordered strategy -> [Write Plan](../write-plan/SKILL.md);
172
- - covered bounded work -> Workflow and Execute Work;
173
- - no action needed -> answer or stop.
109
+ - Stable accepted content needing a durable source -> [Write Spec](../write-spec/SKILL.md).
110
+ - A supported ordered strategy needing a durable artifact -> [Write Plan](../write-plan/SKILL.md).
111
+ - Covered concrete work -> Workflow and Execute Work.
112
+ - One blocking owner choice -> Decision Gate.
113
+ - Unsupported failure cause -> Diagnose Failure.
114
+ - No action needed -> answer or stop.
174
115
 
175
- If work is recommended but not authorized, state the exact proposal and wait.
116
+ Neither an artifact nor a planning milestone is mandatory. Stop recommending or preserving once the agreed discussion result is supported; do not begin implementation without the execution agreement.