@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,252 +1,117 @@
1
1
  ---
2
2
  name: design-for-depth
3
- description: Use during coding and software design to keep boundaries, interfaces, ownership, state, dependencies, and failure behavior simple and proportionate.
3
+ description: "Use during coding and software design to keep boundaries, interfaces, ownership, state, dependencies, and failure behavior simple and proportionate."
4
4
  ---
5
5
 
6
6
  # Design For Depth
7
7
 
8
- Reduce coordination by hiding coherent, likely-changing decisions behind small, stable, outcome-level interfaces.
8
+ Hide coherent, likely-changing decisions behind small, stable, outcome-level interfaces. Reduce the knowledge and coordination callers need without changing the accepted outcome.
9
9
 
10
- A **module** is anything with an interface and implementation. A **caller** is anything that uses it. The **interface** is every fact callers must know to use it correctly: operations, inputs, decisions, states, ordering, errors, side effects, dependencies, configuration, timing, and recovery.
10
+ A module is anything with an interface and implementation. Its interface includes every fact a caller needs for correct use: operations, decisions, inputs, state, ordering, effects, errors, dependencies, timing, and recovery. Depth is useful coherent behavior and hidden complexity per unit of caller knowledge—not fewer methods or more responsibilities.
11
11
 
12
- **Depth** is useful coherent behavior and hidden complexity per unit of caller knowledge.
12
+ Use this lens under the current activity. It is not a mandatory phase, architecture owner, permission to refactor, or reason to make a local task larger.
13
13
 
14
- Use this as a compositional lens under the active activity. It is not a mandatory phase, authority source, architecture owner, or reason to refactor.
14
+ ## Start With The Required Outcome
15
15
 
16
- ## Orient Broadly, Deepen Narrowly
16
+ Understand enough material breadth to identify the caller's complete outcome, accepted constraints, current interface, dependencies, canonical state, and relevant success/failure boundary. Do not survey the entire system or settle future variations without a present question.
17
17
 
18
- Use breadth of understanding before depth of intervention.
18
+ Ask:
19
19
 
20
- Before deepening a design, understand only the material breadth:
21
-
22
- - complete caller outcome;
23
- - caller-owned decisions;
24
- - existing interface and dependencies;
25
- - canonical state and visible transitions;
26
- - success, failure, and recovery boundary;
27
- - current constraints and accepted non-goals;
28
- - evidence capable of changing the design route.
29
-
30
- Then deepen only the decision, seam, state boundary, or failure unit whose ownership could materially change the result.
31
-
32
- Do not broaden the task merely to complete the survey. Do not discuss every design topic, inspect every dependency, generate every alternative, or design the whole system.
33
-
34
- ## Start Shallow
35
-
36
- For any coding or design task, ask:
37
-
38
- 1. What complete outcome is changing?
20
+ 1. What outcome is changing?
39
21
  2. What must callers currently know or coordinate?
40
- 3. Does this change add caller knowledge, spread policy, alter dependency direction, or change state or failure ownership?
41
- 4. Would keeping the current boundary make correct use or the next likely change materially harder?
42
-
43
- When the change is local, source-backed, reversible, and leaves the interface, dependencies, state, and failure unit sound:
44
-
45
- - apply this lens silently;
46
- - preserve accepted behavior;
47
- - do not load references;
48
- - do not present architectural alternatives;
49
- - do not widen the task.
50
-
51
- A large mechanical change may need no design escalation. A one-line change may require it when permissions, canonical state, public behavior, compatibility, or consequential failure changes.
52
-
53
- An abstraction is not required merely because code is duplicated, tests are awkward, or another design is imaginable.
54
-
55
- ## Enter Early Or Re-enter From Evidence
56
-
57
- Use this lens early when ownership, interface, state, dependency, or failure decisions could harden into caller contracts before implementation.
58
-
59
- Early design may support:
22
+ 3. Does the change spread policy, state, dependency choices, or lifecycle knowledge?
23
+ 4. Would the current boundary make correct use or the next likely change materially harder?
60
24
 
61
- - discussion;
62
- - a Spec or Plan;
63
- - an API or module boundary;
64
- - a state transition;
65
- - a consequential integration;
66
- - test-seam selection.
25
+ For a local, source-backed, reversible change that leaves these boundaries sound, apply the lens silently and continue. Do not load additional references, generate alternatives, or introduce an abstraction merely because another shape is imaginable.
67
26
 
68
- During implementation, testing, and review, preserve a supported boundary without reopening it merely because this lens remains in context.
27
+ A large mechanical change may need no design escalation. A one-line change may need it when it changes permissions, public behavior, canonical state, or consequential failure semantics.
69
28
 
70
- Re-enter later only when direct evidence shows:
29
+ ## Intervene Where The Decision Can Still Change
71
30
 
72
- - caller coordination growing;
73
- - policy or state spreading;
74
- - repeated patches adding flags or lifecycle knowledge;
75
- - tests reproducing internal choreography;
76
- - dependencies or failures crossing unclear ownership;
77
- - prior boundary assumptions becoming false.
31
+ Use the lens early when interface, ownership, state, or failure choices could harden into caller contracts. It can support discussion, a Spec or Plan, implementation preparation, or selecting a test seam.
78
32
 
79
- When repeated or unexplained failure lacks a supported cause, use [Diagnose Failure](../diagnose-failure/SKILL.md) first. Diagnosis owns causal investigation. This lens consumes supported structural evidence without recreating the diagnosis.
33
+ Before substantial implementation, or before writing its guiding design, read [Implementation Decisions](references/implementation-decisions.md) when unresolved representation, identity, ownership, algorithm, or failure choices could invalidate significant dependent work. Select a supported mechanism or identify the missing observation; leave ordinary mechanics free. The reference helps make those choices explicit and check their realization, not impose a blueprint on every task.
80
34
 
81
- ## Establish The Outcome And Failure Unit
35
+ Once a boundary is supported, do not reopen it merely because the skill remains in context. Re-enter when evidence shows growing caller coordination, scattered policy, exposed internal states, fragile test choreography, unclear dependency/failure ownership, or an invalidated design assumption.
82
36
 
83
- Before choosing classes, services, packages, adapters, or states, name:
37
+ Ordinary bugs, duplication, test awkwardness, finding count, and preference do not establish structural pressure. Use [Diagnose Failure](../diagnose-failure/SKILL.md) first when repeated or unexplained failures lack a supported cause. This lens consumes the structural finding rather than inventing one.
84
38
 
85
- - caller and complete outcome;
86
- - caller-visible success and failure;
87
- - decisions the caller genuinely owns;
88
- - coordination or likely-changing policy the module could hide;
89
- - the **failure unit**: the coherent outcome treated as one success, failure, and recovery boundary.
39
+ ## Bound Success And Failure Proportionately
90
40
 
91
- When the boundary has side effects, can leave partial state, or makes failure materially consequential, establish its **failure contract**:
41
+ Before selecting classes, services, packages, flags, or states, name:
92
42
 
93
- - who observes failure;
94
- - canonical and diagnostic state written;
95
- - forbidden partial outcomes;
96
- - stop, fail-open, fail-closed, degrade, retry, or escalation behavior;
97
- - cancellation and concurrency behavior when relevant;
98
- - safe restart, recovery, and reconciliation;
99
- - evidence required to prove the outcome.
43
+ - the caller and complete accepted outcome;
44
+ - caller-owned decisions and observable success/failure;
45
+ - the likely-changing coordination the module could hide;
46
+ - the failure unit: what must be treated as one coherent success, failure, and recovery boundary.
100
47
 
101
- Failure behavior is part of the interface even when its mechanism remains private.
48
+ Where effects or partial state are consequential, establish the material failure contract: observer, canonical/diagnostic state, forbidden outcomes, stop/degrade/fail/retry behavior, and supported recovery. Include cancellation, concurrency, or reconciliation only where required behavior or observed reachability makes them material.
102
49
 
103
- Depth is not breadth. A deep module owns one coherent decision or failure unit. It does not collect unrelated responsibilities merely to reduce method count.
50
+ Distinguish required correctness and safety from optional stronger guarantees. Do not remove required behavior to make the design smaller, or turn hypothetical lifecycle completeness into a production requirement. A module owning a failure unit does not automatically need durable replay, rollback, universal provenance, or every possible recovery mechanism.
104
51
 
105
- Use [Decision Gate](../decision-gate/SKILL.md) when the boundary changes product behavior, public interfaces, compatibility, permissions, security, privacy, billing, data-loss behavior, migration direction, or another user-owned outcome.
52
+ Use [Decision Gate](../decision-gate/SKILL.md) when the proposed boundary changes product behavior, public interfaces, compatibility, permissions, security, privacy, billing, data-loss behavior, migration direction, or another user-owned outcome. Explain concrete consequences and supported alternatives, not only an architectural label.
106
53
 
107
- ## Hide Coordination And Likely-Changing Decisions
54
+ ## Hide Coordination Without Hiding Caller Choices
108
55
 
109
- Prefer interfaces where callers request an outcome and the module owns its internal protocol.
56
+ Prefer operations through which callers request an outcome and the module owns the internal protocol.
110
57
 
111
- Before exposing a flag, path, state, ordering rule, retry, provider detail, timing behavior, dependency choice, or recovery step, ask:
112
-
113
- - Does the caller genuinely own this choice?
114
- - Does exposing it make correct use easier?
115
- - Is it stable enough to become a supported contract?
116
- - Which surrounding edits would occur if it changed?
117
- - Could one outcome-level operation hide it?
58
+ Before exposing a flag, path, state, ordering rule, retry, provider detail, or recovery step, ask whether the caller genuinely owns it, whether it makes correct use easier, and whether it is stable enough to become a supported contract.
118
59
 
119
60
  Keep public:
120
61
 
121
62
  - caller-owned outcomes and decisions;
122
- - stable invariants;
123
- - necessary inputs;
124
- - observable success and failure semantics;
63
+ - necessary inputs and stable invariants;
64
+ - observable success/failure;
125
65
  - information required for correct recovery.
126
66
 
127
- Keep private unless callers genuinely control them:
128
-
129
- - sequencing;
130
- - storage layout;
131
- - provider mechanics;
132
- - retries and cleanup;
133
- - temporary states;
134
- - cache and optimization machinery;
135
- - diagnostic implementation;
136
- - dependency construction.
137
-
138
- A **seam** is a boundary where behavior, dependencies, or observation can change without forcing surrounding edits. An **enabling point** is where an adapter, test implementation, clock, probe, provider, or migration path enters that seam.
139
-
140
- Add a seam for demonstrated variation, a known migration, a required observation boundary, or a dependency that must be controlled in tests—not imagined flexibility.
141
-
142
- ## Recognize Structural Pressure
143
-
144
- Structural pressure is evidence that the current boundary is increasing coordination or hiding no useful decision.
145
-
146
- Pressure may appear as:
147
-
148
- - change amplification across unrelated callers;
149
- - caller lifecycle choreography;
150
- - scattered policy;
151
- - unowned canonical state or failure behavior;
152
- - growing flags, temporary states, retries, or recovery rules;
153
- - tests coupled to machinery rather than accepted behavior;
154
- - infrastructure details leaking into policy;
155
- - edge-case patches revealing one shared contract gap;
156
- - a bounded result unexpectedly requiring a subsystem.
157
-
158
- Ordinary bugs, failed tests, duplicate code, broad mechanical edits, finding count, and personal design preference do not prove structural pressure.
159
-
160
- When observed coordination could change the next route, read [Design Pressure Signals](references/design-pressure-signals.md). Skip it only when an equivalent route classification is already supported.
161
-
162
- When structural pressure is supported but the likely-changing decision or missing information-hiding boundary cannot yet be named, read [Software Design Philosophy](references/software-design-philosophy.md).
163
-
164
- Read the narrowest reference whose condition matches the current question. Read another only if its distinct question remains afterward.
67
+ Keep internal unless callers genuinely control it:
165
68
 
166
- ## Choose The Required Design Depth
69
+ - sequencing, storage layout, dependency construction, and provider mechanics;
70
+ - retries, cleanup, temporary states, caches, and optimization machinery;
71
+ - diagnostic implementation details.
167
72
 
168
- Read [Interface Design Loop](references/interface-design-loop.md) before:
73
+ A seam permits behavior, dependency, or observation changes without coordinated surrounding edits. An enabling point admits the adapter, clock, provider, or probe at that seam. Add one for demonstrated variation, a known migration, a required observer, or a dependency needing control—not imagined flexibility.
169
74
 
170
- - comparing materially different interfaces;
171
- - selecting consequential ownership;
172
- - freezing an important correctness boundary;
173
- - choosing among real seam placements.
75
+ Do not centralize unrelated responsibilities merely to reduce interface count or scatter an old protocol into callers while claiming an abstraction was removed.
174
76
 
175
- Read [State And Failure Boundaries](references/state-and-failure-boundaries.md) when correctness materially depends on:
77
+ ## Load Only The Depth The Question Needs
176
78
 
177
- - canonical state;
178
- - partial effects;
179
- - atomic visibility;
180
- - concurrency or cancellation;
181
- - idempotency and retries;
182
- - recovery or reconciliation;
183
- - failure evidence.
79
+ Read [Design Pressure Signals](references/design-pressure-signals.md) when observed coordination could change the route, unless an equivalent classification is already supported.
184
80
 
185
- Read [Module And Dependency Design](references/module-and-dependency-design.md) when the question materially concerns:
81
+ Read [Software Design Philosophy](references/software-design-philosophy.md) when structural pressure is supported but the likely-changing decision or missing information-hiding boundary cannot yet be named.
186
82
 
187
- - module decomposition;
188
- - cohesion and conceptual integrity;
189
- - dependency direction;
190
- - cycles or layering;
191
- - policy versus infrastructure;
192
- - shared ownership;
193
- - ports and adapters.
83
+ Read [Interface Design Loop](references/interface-design-loop.md) before comparing materially different interfaces, choosing consequential ownership, freezing an important correctness boundary, or choosing among real seam placements.
194
84
 
195
- Several references may apply to one consequential boundary. Read them one at a time and only while each distinct condition remains.
85
+ Read [State And Failure Boundaries](references/state-and-failure-boundaries.md) when correctness materially depends on canonical state, partial effects, atomic visibility, concurrency, cancellation, retries, idempotency, recovery, reconciliation, or failure evidence.
196
86
 
197
- ## Test Through The Intended Interface
87
+ Read [Module And Dependency Design](references/module-and-dependency-design.md) for decomposition, cohesion, dependency direction, cycles, layering, shared ownership, policy versus infrastructure, or ports/adapters.
198
88
 
199
- The intended interface is the normal behavior and test surface.
89
+ Read references one at a time while each distinct question remains. Do not convert their checklists into obligations unrelated to the accepted result.
200
90
 
201
- Question the design before adding test machinery when callers or tests must:
91
+ ## Learn Without Building The Future System
202
92
 
203
- - bypass the intended interface;
204
- - reproduce lifecycle choreography;
205
- - mock many internals to verify one outcome;
206
- - depend on private temporary states;
207
- - know dependency construction callers should not own.
93
+ When existing evidence cannot distinguish viable boundaries, frame a bounded prototype or observation through the current owner: question, alternatives, adequate observer, permitted effects, evidence, return condition, and disposition.
208
94
 
209
- Do not redesign merely because an internal test observes internals. The problem is external callers requiring knowledge the module should hide.
95
+ The experiment must answer the design question. If its next prerequisite is actually future production infrastructure, reassess before building it. One failed extension or matching technique is not proof that every in-scope approach is impossible.
210
96
 
211
- Architecture-bearing tests should protect:
97
+ Return a supported boundary or an explicit limitation. Working exploratory code is evidence, not automatic production architecture. Promotion requires deliberate selection and authority, and a negative answer does not require another increasingly broad prototype.
212
98
 
213
- - accepted behavior;
214
- - visible failure;
215
- - state invariants;
216
- - forbidden partial outcomes;
217
- - settled recovery behavior;
218
- - a real dependency or observation seam.
99
+ ## Check Through The Intended Interface
219
100
 
220
- Tests that protect only accidental machinery do not justify that machinery.
101
+ The intended interface should normally be the behavior and test surface. Question test machinery when callers or tests must bypass it, coordinate private lifecycle steps, replace many internals, or know dependency construction the module should own.
221
102
 
222
- Exploratory code can produce design evidence. It does not become production architecture without deliberate selection, authorized implementation, and verification at the required boundary.
103
+ An internal test inspecting internals is not itself a design defect. The concern is callers requiring knowledge the module should hide, or a fixture manufacturing the behavior it claims to observe.
223
104
 
224
- ## Return The Narrowest Supported Route
105
+ Architecture-bearing checks should protect accepted behavior, visible failures, required state invariants, forbidden partial outcomes, settled recovery, and real dependency or observation seams. Tests that protect accidental machinery do not justify keeping that machinery.
225
106
 
226
- Return a changed ownership, scope, authority, or route boundary through [Workflow](../workflow/SKILL.md). Otherwise return to the active activity with:
107
+ Test order is not a design criterion. Choose boundaries for the actual caller and supported variation, not to satisfy a formal implementation sequence.
227
108
 
228
- - structural evidence;
229
- - affected caller outcome;
230
- - interface, module, dependency, state, and failure unit involved;
231
- - likely-changing or currently unowned decision;
232
- - materially different alternatives only when real;
233
- - recommendation and assumptions;
234
- - unresolved user-owned decisions;
235
- - evidence still required;
236
- - narrowest route.
109
+ ## Return The Smallest Supported Change
237
110
 
238
- Possible routes include:
111
+ Return to [Workflow](../workflow/SKILL.md) when ownership, scope, authority, or the route changes. Otherwise return to the current activity with the structural evidence, affected outcome, boundary, likely-changing decision, assumptions, and remaining evidence or user-owned choice.
239
112
 
240
- - continue with the current boundary;
241
- - make a local correction;
242
- - diagnose an unsupported cause;
243
- - revise a Spec or Plan;
244
- - use [Simplify Code](../simplify-code/SKILL.md) for behavior-preserving reduction;
245
- - run a bounded learning slice;
246
- - propose bounded deepening;
247
- - defer supported design pressure;
248
- - stop for owner direction.
113
+ Compare alternatives only when real. Recommend the simplest supported boundary that preserves required behavior; explain the principal cost and what would invalidate the recommendation.
249
114
 
250
- A design recommendation does not authorize implementation.
115
+ Possible results include keeping the existing design, a local correction, diagnosis, an artifact revision, a bounded learning action, an accepted deepening, explicit deferral, or a stop for owner direction. Use [Simplify Code](../simplify-code/SKILL.md) when the selected result is behavior-preserving reduction.
251
116
 
252
- Freeze a supported boundary instead of pursuing architectural completeness. Retain the decision, not perpetual design activity.
117
+ Freeze a sufficiently supported boundary instead of pursuing architectural completeness. A recommendation is not implementation authority, and a new dependency must earn its place through the accepted outcome or demonstrated need.
@@ -0,0 +1,76 @@
1
+ # Implementation Decisions
2
+
3
+ Read this before substantial implementation, or before writing its guiding design, when unresolved representation, identity, ownership, algorithm, or failure choices could invalidate significant dependent work. Skip it for a supported local change whose remaining mechanics do not alter those boundaries.
4
+
5
+ Use this method under Design for Depth and the current activity. It does not create another planning phase, document requirement, approval gate, or compute role.
6
+
7
+ ## Identify What Implementation Would Still Have To Invent
8
+
9
+ Start from the accepted outcome, relevant source evidence, and existing design. Ask:
10
+
11
+ > Which remaining choices could change correctness, complexity, failure behavior, or force substantial dependent work to be redone?
12
+
13
+ Name the actual question, not a generic demand for more design. For example, deciding which occurrence identifies a source matters more than choosing Map versus array; deciding what survives a failed transfer matters more than choosing a retry helper.
14
+
15
+ For each consequential unknown, choose one route:
16
+
17
+ - **Evidence supports a mechanism:** select it and explain why it fits.
18
+ - **An environmental fact is missing:** identify the observation that distinguishes the alternatives before dependent implementation.
19
+ - **A user-owned boundary is unsettled:** return that choice through the current owner.
20
+ - **Only ordinary mechanics remain:** leave them to implementation and continue.
21
+
22
+ Do not invent APIs, future files, or stronger guarantees to complete the design. Nor should the user have to choose implementation syntax: explain user-owned consequences and resolve supported engineering details within the agreement.
23
+
24
+ ## Choose The Representation And Mechanism
25
+
26
+ Develop only the decisions that answer the current question. Reuse supported design rather than filling every category:
27
+
28
+ | Decision | Make explicit when material |
29
+ | --- | --- |
30
+ | Representation and identity | Domain objects and independent lifetimes; what counts as the same occurrence; what must remain distinct |
31
+ | State and ownership | Authoritative facts, derived caches, transition owner, and permitted mutations |
32
+ | Algorithm and cost | Essential steps; collection keys and relationships; update/invalidation rules; work repeated as input grows |
33
+ | Effects and failure | Required ordering; what is accepted or visible at each boundary; what survives failure and what may be retried |
34
+ | Modules and dependencies | Who hides each decision; which callers consume the result; dependencies or coordination that must not spread |
35
+ | Evidence | Observable required behavior and a plausible wrong implementation the check must reject |
36
+
37
+ Use Design for Depth's interface, state/failure, and module references when their named questions need resolution; do not repeat their full methods here. Compare materially different approaches only when they remain viable. Prefer eliminating unnecessary coordination to hiding the same protocol behind another helper.
38
+
39
+ ## Preserve The Decision, Not A Complete Patch
40
+
41
+ Communicate enough for another implementer, or your later context, to retain the chosen approach:
42
+
43
+ - the decision and its source basis;
44
+ - why it fits and the invariant it protects;
45
+ - the essential mechanism, including a small type or control-flow sketch when useful;
46
+ - the counterexample and distinguishing observer;
47
+ - required constraints versus suggested mechanics and local freedom;
48
+ - the evidence or condition that would invalidate the choice.
49
+
50
+ Use a paragraph, example, or compact table. Do not prescribe every loop or helper, or reproduce the whole program in prose. Naming a data structure without its keys, meaning, and maintenance rules is not useful algorithmic direction.
51
+
52
+ Keep durable decisions in the owning technical design; keep execution order in the Plan and changed understanding in task memory. A current assignment should carry the applicable decisions and relevant source section, not another complete copy of every artifact. A path or hash does not establish that its contents are available to the implementer.
53
+
54
+ ## Check Realization Before Dependent Expansion
55
+
56
+ When an unfamiliar boundary could invalidate substantial later work, choose the first coherent implementation path that can disagree with the design. It may span several files and a failure case. A skeleton, happy-path result, or green summary alone may not exercise the decision.
57
+
58
+ Assess the actual implementation and observation: which important choices were realized, omitted, contradicted, or replaced with a supported reason? Check ownership, identity, ordering, and the observer—not fidelity to suggested filenames or helper syntax.
59
+
60
+ A precise sketch can be wrong. Preserve accepted behavior, stop dependent effects when the mechanism is invalidated, and resolve the affected choice through the current owner. Supported local corrections need no design restart. Once the boundary is established, reuse it rather than repeating this assessment after every edit.
61
+
62
+ ## Examples
63
+
64
+ ### Identity And Indexing
65
+
66
+ Weak direction: "Use a Map and avoid repeated scans."
67
+
68
+ Useful direction: "Keep native occurrence IDs as source identity. Equal bodies may identify several candidates; do not merge their occurrences. Let the source owner maintain the result-to-exchange relationship. Update appended sources and rebuild affected indexes after ancestry replacement. Check repeated equal bodies, late attribution, and a branch change; measure the repeated preparation path rather than only an isolated lookup. Helper layout is local. Reconsider the index if the source does not provide the assumed stable identity."
69
+
70
+ ### Acknowledgment And Retry
71
+
72
+ Weak direction: "Make persistence idempotent and robust."
73
+
74
+ Useful direction: "The append owner distinguishes observed acknowledgment from an uncertain attempt. An equal entry in memory does not resolve an earlier failure. Validate before mutation; publish accepted state only at the supported acknowledgment boundary. Test append advancing memory then failing, followed by the identical operation: uncertainty must remain until supported reconciliation. Also test an acknowledged duplicate so the implementation does not reject every retry. Do not infer filesystem durability from readback. Reconsider the mechanism if the actual host boundary differs."
75
+
76
+ Stop when the next implementation has a supported approach and intentional local freedom, or its blocking question is explicit. Do not pursue a complete blueprint for later work whose premises remain unsettled.