@hassangameryt/freeflow 0.6.0 → 0.7.1
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.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +3 -2
- package/.codex-plugin/plugin.json +5 -6
- package/.cursor-plugin/plugin.json +25 -0
- package/README.md +66 -56
- package/capabilities/cognitive-routing/SKILL.md +288 -130
- package/com.github.copilot/hooks/hooks.json +11 -0
- package/command-surface.json +0 -24
- package/gemini-extension.json +5 -0
- package/hooks/adapters/claude-session-start.mjs +16 -0
- package/hooks/adapters/codex-session-start.mjs +16 -0
- package/hooks/adapters/copilot-session-start.mjs +13 -0
- package/hooks/adapters/cursor-session-start.mjs +13 -0
- package/hooks/adapters/gemini-session-start.mjs +15 -0
- package/hooks/claude/hooks.json +18 -0
- package/hooks/codex/hooks.json +18 -0
- package/hooks/cursor/hooks.json +9 -0
- package/hooks/freeflow-runtime-context.mjs +3 -650
- package/hooks/hooks.json +4 -30
- package/hooks/shared/runtime-context.mjs +210 -0
- package/hooks/tests/check-host-adapters.test.mjs +82 -0
- package/hooks/tests/check-runtime-context-hook.sh +140 -320
- package/package.json +20 -4
- package/pi-extension/dist/cognitive-routing/commands.js +3 -3
- package/pi-extension/dist/cognitive-routing/config.js +16 -20
- package/pi-extension/dist/cognitive-routing/controller.js +478 -48
- package/pi-extension/dist/cognitive-routing/history.js +12 -0
- package/pi-extension/dist/cognitive-routing/host.js +74 -12
- package/pi-extension/dist/cognitive-routing/pi-routing-session.js +414 -0
- package/pi-extension/dist/cognitive-routing/pi-session-control.js +320 -0
- package/pi-extension/dist/cognitive-routing/tool.js +1 -0
- package/pi-extension/dist/cognitive-routing/types.js +1 -1
- package/pi-extension/dist/index.js +236 -219
- package/pi-extension/dist/runtime/runtime-context.js +126 -286
- package/pi-extension/dist/settings/settings-ui.js +52 -336
- package/pi-extension/src/cognitive-routing/commands.ts +15 -5
- package/pi-extension/src/cognitive-routing/config.ts +16 -20
- package/pi-extension/src/cognitive-routing/controller.ts +561 -51
- package/pi-extension/src/cognitive-routing/history.ts +12 -0
- package/pi-extension/src/cognitive-routing/host.ts +110 -16
- package/pi-extension/src/cognitive-routing/pi-routing-session.ts +538 -0
- package/pi-extension/src/cognitive-routing/pi-session-control.ts +444 -0
- package/pi-extension/src/cognitive-routing/tool.ts +1 -0
- package/pi-extension/src/cognitive-routing/types.ts +1 -1
- package/pi-extension/src/index.ts +249 -239
- package/pi-extension/src/runtime/runtime-context.ts +129 -305
- package/pi-extension/src/settings/settings-ui.ts +53 -371
- package/pi-extension/tests/cognitive-routing/commands.test.js +1 -1
- package/pi-extension/tests/cognitive-routing/controller.test.js +69 -40
- package/pi-extension/tests/cognitive-routing/extension-lifecycle.test.js +128 -57
- package/pi-extension/tests/cognitive-routing/pi-normal-lifecycle.test.js +434 -0
- package/pi-extension/tests/cognitive-routing/pi-session-control.test.js +174 -0
- package/pi-extension/tests/cognitive-routing/pi-session-history.test.js +91 -0
- package/pi-extension/tests/cognitive-routing/profile-resolution.test.js +47 -4
- package/pi-extension/tests/integration/mode-free-core.test.js +218 -0
- package/pi-extension/tests/integration/pi-extension.test.js +430 -2478
- package/pi-extension/tests/integration/prompt-architecture.test.js +124 -79
- package/pi-extension/tests/integration/unaffected-regressions.test.js +411 -0
- package/plugin.json +33 -0
- package/runtime/prompts/cognitive-routing.md +5 -4
- package/runtime/prompts/conversation-history.md +1 -1
- package/runtime/prompts/core.md +77 -6
- package/runtime/prompts/interaction-contract.md +6 -2
- package/skills/action-selection/SKILL.md +93 -44
- package/skills/action-selection/references/trajectory-stalls.md +71 -0
- package/skills/bypass/SKILL.md +109 -39
- package/skills/commit-work/SKILL.md +94 -55
- package/skills/commit-work/references/git-state-edges.md +94 -0
- package/skills/commit-work/references/simple-push.md +92 -0
- package/skills/commit-work/references/staging-decisions.md +79 -46
- package/skills/decision-gate/SKILL.md +80 -22
- package/skills/design-for-depth/SKILL.md +208 -43
- package/skills/design-for-depth/references/design-pressure-signals.md +108 -240
- package/skills/design-for-depth/references/interface-design-loop.md +77 -97
- package/skills/design-for-depth/references/module-and-dependency-design.md +147 -0
- package/skills/design-for-depth/references/software-design-philosophy.md +127 -173
- package/skills/design-for-depth/references/state-and-failure-boundaries.md +136 -0
- package/skills/diagnose-failure/SKILL.md +198 -52
- package/skills/diagnose-failure/references/diagnostic-loop-catalog.md +19 -5
- package/skills/diagnose-failure/references/flaky-and-performance-diagnosis.md +13 -5
- package/skills/discuss/SKILL.md +118 -76
- package/skills/discuss/references/discussion-continuity.md +84 -32
- package/skills/evaluate-skill/SKILL.md +166 -52
- package/skills/evaluate-skill/references/evaluation-definition-schema.md +2 -2
- package/skills/evaluate-skill/references/evaluation-design.md +56 -30
- package/skills/evaluate-skill/references/execution-and-evidence.md +1 -1
- package/skills/evaluate-skill/references/review-and-revision.md +62 -21
- package/skills/execute-work/SKILL.md +98 -59
- package/skills/execute-work/references/code-practices.md +4 -4
- package/skills/execute-work/references/execute-work-edges.md +42 -22
- package/skills/review-artifact/SKILL.md +132 -71
- package/skills/review-artifact/references/adjudicate-artifact-review.md +101 -0
- package/skills/review-artifact/references/independent-artifact-reviewer-contract.md +52 -41
- package/skills/review-work/SKILL.md +115 -72
- package/skills/review-work/references/adjudicate-work-review.md +97 -0
- package/skills/review-work/references/independent-work-reviewer-contract.md +40 -35
- package/skills/review-work/references/security-risk-lens.md +17 -15
- package/skills/setup-freeflow/SKILL.md +14 -17
- package/skills/setup-freeflow/references/activation-contract.md +24 -30
- package/skills/setup-freeflow/references/host-setup.md +6 -7
- package/skills/simplify-code/SKILL.md +97 -39
- package/skills/simplify-code/references/simplification-patterns.md +1 -1
- package/skills/tdd/SKILL.md +108 -41
- package/skills/tdd/references/test-design.md +1 -1
- package/skills/track-work/SKILL.md +133 -300
- package/skills/track-work/references/working-record-format.md +515 -0
- package/skills/track-work/scripts/lib/document.mjs +713 -0
- package/skills/track-work/scripts/lib/format.mjs +166 -0
- package/skills/track-work/scripts/lib/store.mjs +233 -0
- package/skills/track-work/scripts/lib/transitions.mjs +790 -0
- package/skills/track-work/scripts/lib/views.mjs +27 -430
- package/skills/track-work/scripts/working-record.mjs +292 -98
- package/skills/verify-work/SKILL.md +46 -20
- package/skills/verify-work/references/browser-runtime-evidence.md +1 -1
- package/skills/verify-work/references/integration-evidence.md +1 -7
- package/skills/verify-work/references/performance-evidence.md +1 -1
- package/skills/workflow/SKILL.md +110 -80
- package/skills/workflow/references/domain-skill-composition.md +24 -18
- package/skills/write-skill/SKILL.md +218 -62
- package/skills/write-skill/references/activation-boundaries.md +63 -21
- package/skills/write-skill/references/agent-first-instructions.md +61 -27
- package/skills/write-skill/references/progressive-disclosure.md +91 -41
- package/skills/write-skill/references/skill-dependency-graphs.md +190 -0
- package/runtime/prompts/skills.md +0 -65
- package/skills/mode-contract/SKILL.md +0 -104
- package/skills/track-work/scripts/lib/codec.mjs +0 -570
- package/skills/track-work/scripts/lib/commands.mjs +0 -568
- package/skills/track-work/scripts/lib/contract.mjs +0 -303
- package/skills/track-work/scripts/lib/model.mjs +0 -506
- package/skills/track-work/scripts/lib/operations.mjs +0 -965
- package/skills/track-work/scripts/lib/record-store.mjs +0 -264
- package/skills/track-work/scripts/lib/result.mjs +0 -37
- package/skills/track-work/scripts/lib/rewrites.mjs +0 -740
- package/skills/track-work/scripts/lib/schema.mjs +0 -277
- package/skills/track-work/scripts/lib/source-inventory.mjs +0 -162
- package/skills/track-work/scripts/lib/workspace.mjs +0 -134
|
@@ -1,314 +1,182 @@
|
|
|
1
1
|
# Design Pressure Signals
|
|
2
2
|
|
|
3
|
-
Read this when
|
|
3
|
+
Read this when observed coordination could change the next route and an equivalent design-route classification is not already supported.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Do not count smells. Identify the pressure that changes the next action, or conclude that none does.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Classify The Evidence
|
|
8
8
|
|
|
9
9
|
Ask:
|
|
10
10
|
|
|
11
|
-
1. What
|
|
12
|
-
2. What
|
|
13
|
-
3.
|
|
14
|
-
4. What
|
|
15
|
-
5.
|
|
16
|
-
6.
|
|
11
|
+
1. What caller outcome and interface are affected?
|
|
12
|
+
2. What facts must callers know or coordinate?
|
|
13
|
+
3. Did the current change add to that knowledge?
|
|
14
|
+
4. What policy, dependency, state transition, or failure behavior is spreading?
|
|
15
|
+
5. Is the cause supported?
|
|
16
|
+
6. Can the issue be resolved inside accepted scope and authority?
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Choose the narrowest supported route:
|
|
19
19
|
|
|
20
|
-
- **Continue:**
|
|
21
|
-
- **Local
|
|
22
|
-
- **
|
|
23
|
-
- **
|
|
24
|
-
- **
|
|
25
|
-
- **
|
|
20
|
+
- **Continue:** current boundary remains sound.
|
|
21
|
+
- **Local correction:** defect remains within one module and contract.
|
|
22
|
+
- **Diagnosis:** failure is repeated or unexplained and cause is unsupported.
|
|
23
|
+
- **Spec or Plan revision:** behavior, acceptance, or execution boundary is incomplete.
|
|
24
|
+
- **User decision:** resolving pressure changes a user-owned outcome.
|
|
25
|
+
- **Learning:** evidence cannot distinguish viable boundaries.
|
|
26
|
+
- **Deepening:** supported information-hiding improvement fits accepted scope.
|
|
27
|
+
- **Deferred deepening:** pressure is real but not worth resolving now.
|
|
26
28
|
|
|
27
|
-
##
|
|
29
|
+
## Change Amplification
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
Pressure exists when one policy change requires unrelated edits across callers.
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Examples:
|
|
34
|
-
|
|
35
|
-
- retry policy added to every route;
|
|
36
|
-
- permission check copied into API, UI, and job worker;
|
|
37
|
-
- billing grace-period logic repeated in webhook, email, and dashboard;
|
|
38
|
-
- cache freshness flags threaded through callers.
|
|
39
|
-
|
|
40
|
-
Likely issue: a likely-changing decision is not hidden behind a module.
|
|
41
|
-
|
|
42
|
-
Route:
|
|
43
|
-
|
|
44
|
-
- If behavior or scope is unsettled: Discuss or revise the owning Spec.
|
|
45
|
-
- If behavior is settled but slice spreads edits: plan revision or refactor candidate.
|
|
46
|
-
|
|
47
|
-
### Caller Choreography
|
|
48
|
-
|
|
49
|
-
Signal: callers must perform steps in the right order.
|
|
50
|
-
|
|
51
|
-
Examples:
|
|
33
|
+
Example:
|
|
52
34
|
|
|
53
35
|
```text
|
|
54
|
-
|
|
36
|
+
Changing retry policy requires edits in API routes, workers,
|
|
37
|
+
UI state, and tests.
|
|
55
38
|
```
|
|
56
39
|
|
|
57
|
-
|
|
40
|
+
Name the decision causing the edits. Do not merely move the same choreography into one helper.
|
|
41
|
+
|
|
42
|
+
## Caller Protocol Growth
|
|
58
43
|
|
|
59
|
-
|
|
44
|
+
Pressure exists when callers must perform internal lifecycle steps:
|
|
60
45
|
|
|
61
46
|
```text
|
|
62
|
-
|
|
47
|
+
configure -> open -> retry -> translate error -> clean up -> publish evidence
|
|
63
48
|
```
|
|
64
49
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
### Scattered Policy
|
|
68
|
-
|
|
69
|
-
Signal: product or operational rules appear in many places.
|
|
70
|
-
|
|
71
|
-
Examples:
|
|
72
|
-
|
|
73
|
-
- billing downgrade timing in UI, webhook, worker, and tests;
|
|
74
|
-
- notification fallback rules in every route;
|
|
75
|
-
- authorization rules in frontend and backend separately;
|
|
76
|
-
- migration compatibility gates inside individual callers.
|
|
77
|
-
|
|
78
|
-
Likely issue: policy is not localized.
|
|
79
|
-
|
|
80
|
-
Stop if changing it would alter product, security, privacy, billing, permissions, public API, compatibility, or data-loss behavior.
|
|
81
|
-
|
|
82
|
-
### Test Knows Too Much
|
|
83
|
-
|
|
84
|
-
Signal: tests assert implementation sequencing instead of behavior.
|
|
85
|
-
|
|
86
|
-
Examples:
|
|
87
|
-
|
|
88
|
-
- tests assert `sendEmail` then `logFailure` then `sendSms` in every route;
|
|
89
|
-
- tests mock five helpers to verify one user-visible behavior;
|
|
90
|
-
- tests duplicate retry counts and provider error types;
|
|
91
|
-
- tests need private methods or internal state.
|
|
92
|
-
|
|
93
|
-
Likely issue: the production interface is not the right test seam.
|
|
94
|
-
|
|
95
|
-
Do not automatically add mocks. Ask whether the module interface should own the behavior.
|
|
96
|
-
|
|
97
|
-
### Missing Failure Contract
|
|
98
|
-
|
|
99
|
-
Signal: the happy path is planned, but failure modes, observers, state writes, fail-open/closed/degrade/escalate/retry behavior, recovery, or proof are left to each caller or implementer.
|
|
100
|
-
|
|
101
|
-
Likely issue: failure behavior is part of the interface but has not been designed.
|
|
102
|
-
|
|
103
|
-
Route:
|
|
104
|
-
|
|
105
|
-
- If behavior changes product, security, privacy, billing, permissions, public API, compatibility, or data loss: owner decision.
|
|
106
|
-
- If behavior is within scope but scattered: plan/spec revision or refactor candidate.
|
|
107
|
-
- If proof is missing: verification gap before completion claims.
|
|
108
|
-
|
|
109
|
-
### Caller-Knowledge Growth
|
|
110
|
-
|
|
111
|
-
Signal: each fix adds another flag, state, path, ordering rule, retry instruction, cleanup step, or recovery fact that callers and tests must know.
|
|
112
|
-
|
|
113
|
-
Likely issue: the interface is growing with the implementation instead of hiding it.
|
|
114
|
-
|
|
115
|
-
Route:
|
|
116
|
-
|
|
117
|
-
- stop adding contract detail;
|
|
118
|
-
- inventory caller knowledge;
|
|
119
|
-
- design materially different outcome-level interfaces;
|
|
120
|
-
- use a learning slice if evidence cannot choose between them.
|
|
121
|
-
|
|
122
|
-
### Contract-Surface Explosion
|
|
123
|
-
|
|
124
|
-
Signal: an internal lifecycle becomes a public protocol of attempts, manifests, orphan states, retry links, grade modes, cache identities, or integrity steps.
|
|
125
|
-
|
|
126
|
-
Likely issue: caller-owned outcome and internal protocol have been confused.
|
|
127
|
-
|
|
128
|
-
Ask whether one operation can own the complete success/failure unit and publish diagnostics without exposing recovery choreography.
|
|
129
|
-
|
|
130
|
-
### Tests Legitimize Machinery
|
|
131
|
-
|
|
132
|
-
Signal: test count grows quickly, but most new tests protect states and mechanisms introduced by recent patches rather than accepted behavior.
|
|
50
|
+
Related signals:
|
|
133
51
|
|
|
134
|
-
|
|
52
|
+
- every correction adds another state or flag;
|
|
53
|
+
- recovery steps become ordinary caller behavior;
|
|
54
|
+
- callers depend on paths, filenames, provider errors, or queue names;
|
|
55
|
+
- a complete outcome becomes a public protocol of attempts and temporary states.
|
|
135
56
|
|
|
136
|
-
|
|
57
|
+
Ask whether one operation can own the complete success and failure unit while publishing diagnostics separately.
|
|
137
58
|
|
|
138
|
-
|
|
59
|
+
## Scattered Policy
|
|
139
60
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
Likely issue: the milestone or plan has been invalidated even if each local change remains technically in scope.
|
|
143
|
-
|
|
144
|
-
Return the evidence and options to Workflow: keep, simplify, split, defer, revise the owning Plan or Spec, or stop for owner direction.
|
|
145
|
-
|
|
146
|
-
### Edge-Case Patch Stream
|
|
147
|
-
|
|
148
|
-
Signal: each review pass finds another special case.
|
|
149
|
-
|
|
150
|
-
Examples:
|
|
151
|
-
|
|
152
|
-
- “also handle null phone”; then “also handle email bounce”; then “also handle duplicate invite”; then “also handle retry telemetry.”
|
|
153
|
-
|
|
154
|
-
Likely issue: review is exposing missing behavior ownership, not isolated bugs.
|
|
155
|
-
|
|
156
|
-
Route:
|
|
157
|
-
|
|
158
|
-
- classify findings;
|
|
159
|
-
- respect the review cap;
|
|
160
|
-
- diagnose only when related findings suggest an unclear shared cause in discussion, source truth, the Spec or Plan, module shape, or reviewer context.
|
|
161
|
-
|
|
162
|
-
### Pass-Through Wrapper
|
|
163
|
-
|
|
164
|
-
Signal: a module mostly renames another call.
|
|
61
|
+
Pressure exists when one product or operational decision is encoded in several places.
|
|
165
62
|
|
|
166
63
|
Example:
|
|
167
64
|
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
65
|
+
```text
|
|
66
|
+
billing transition timing appears separately in webhook,
|
|
67
|
+
dashboard, email, and worker behavior.
|
|
172
68
|
```
|
|
173
69
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
Options:
|
|
177
|
-
|
|
178
|
-
- delete it if it hides nothing;
|
|
179
|
-
- deepen it by moving real policy behind it;
|
|
180
|
-
- keep it only when it expresses a stable domain or compatibility interface with a source-backed reason to exist.
|
|
181
|
-
|
|
182
|
-
### Leaky Interface
|
|
183
|
-
|
|
184
|
-
Signal: callers know provider/database/cache internals.
|
|
185
|
-
|
|
186
|
-
Examples:
|
|
187
|
-
|
|
188
|
-
- callers catch Stripe-specific errors;
|
|
189
|
-
- UI code knows database enum transitions;
|
|
190
|
-
- API callers pass cache invalidation flags;
|
|
191
|
-
- tests assert internal queue names.
|
|
192
|
-
|
|
193
|
-
Likely issue: implementation detail leaked through interface.
|
|
70
|
+
Do not centralize behavior until the policy is accepted. When it is user-owned or conflicting, stop for a decision.
|
|
194
71
|
|
|
195
|
-
|
|
72
|
+
## Unowned State Or Failure
|
|
196
73
|
|
|
197
|
-
|
|
74
|
+
Pressure exists when no module owns:
|
|
198
75
|
|
|
199
|
-
|
|
76
|
+
- canonical state and its visibility point;
|
|
77
|
+
- forbidden partial outcomes;
|
|
78
|
+
- retry, degradation, or escalation;
|
|
79
|
+
- cancellation and reconciliation;
|
|
80
|
+
- recovery after partial completion;
|
|
81
|
+
- evidence proving the final state.
|
|
200
82
|
|
|
201
|
-
|
|
83
|
+
Do not design architecture around an invented failure policy.
|
|
202
84
|
|
|
203
|
-
-
|
|
204
|
-
- workflow module owns routing, vaulting, parsing, rendering, and config mutation.
|
|
85
|
+
## Contract-Surface Growth
|
|
205
86
|
|
|
206
|
-
|
|
87
|
+
Pressure exists when each patch adds public:
|
|
207
88
|
|
|
208
|
-
|
|
89
|
+
- flags;
|
|
90
|
+
- temporary states;
|
|
91
|
+
- manifest fields;
|
|
92
|
+
- retry links;
|
|
93
|
+
- recovery instructions;
|
|
94
|
+
- provider-specific errors;
|
|
95
|
+
- cache or integrity controls.
|
|
209
96
|
|
|
210
|
-
|
|
97
|
+
Ask whether callers own those facts or are being forced to understand internal protocol.
|
|
211
98
|
|
|
212
|
-
|
|
99
|
+
## Distorted Tests
|
|
213
100
|
|
|
214
|
-
|
|
101
|
+
Pressure exists when tests:
|
|
215
102
|
|
|
216
|
-
-
|
|
217
|
-
-
|
|
218
|
-
-
|
|
103
|
+
- reproduce caller choreography;
|
|
104
|
+
- mock many helpers to verify one outcome;
|
|
105
|
+
- depend on private lifecycle states;
|
|
106
|
+
- protect machinery introduced by recent patches;
|
|
107
|
+
- prove rejection without checking forbidden writes;
|
|
108
|
+
- make provider mechanics look like domain requirements.
|
|
219
109
|
|
|
220
|
-
|
|
110
|
+
Do not automatically add mocks or test-only seams. First inspect whether the production boundary owns the complete behavior.
|
|
221
111
|
|
|
222
|
-
|
|
112
|
+
An intentional internal test is not a defect merely because it observes internals.
|
|
223
113
|
|
|
224
|
-
|
|
114
|
+
## Edge-Case Patch Streams
|
|
225
115
|
|
|
226
|
-
|
|
116
|
+
Pressure exists when related fixes repeatedly add conditions, states, or caller rules.
|
|
227
117
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
Better:
|
|
231
|
-
|
|
232
|
-
```text
|
|
233
|
-
Tentative: likely need a policy-owning module if retry/fallback rules spread.
|
|
234
|
-
Open: whether provider variation is real in this scope.
|
|
235
|
-
Stop: revisit plan if slice requires touching every caller.
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
## Before / After Examples
|
|
239
|
-
|
|
240
|
-
### Notification Retry
|
|
241
|
-
|
|
242
|
-
Bad direction:
|
|
118
|
+
Example:
|
|
243
119
|
|
|
244
120
|
```text
|
|
245
|
-
|
|
121
|
+
handle missing contact
|
|
122
|
+
-> handle fallback
|
|
123
|
+
-> handle duplicate delivery
|
|
124
|
+
-> handle retry telemetry
|
|
125
|
+
-> expose another state to callers
|
|
246
126
|
```
|
|
247
127
|
|
|
248
|
-
|
|
128
|
+
Do not infer architecture from finding count alone. Diagnose whether the cases share one missing contract, state owner, or failure unit.
|
|
249
129
|
|
|
250
|
-
|
|
251
|
-
- fallback and telemetry are duplicated;
|
|
252
|
-
- tests assert provider sequencing;
|
|
253
|
-
- adding another provider touches every caller.
|
|
130
|
+
## Scope Growth
|
|
254
131
|
|
|
255
|
-
|
|
132
|
+
Pressure exists when a bounded result unexpectedly:
|
|
256
133
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
134
|
+
- requires a subsystem;
|
|
135
|
+
- expands remaining work;
|
|
136
|
+
- pulls deferred capabilities into scope;
|
|
137
|
+
- invalidates earlier evidence;
|
|
138
|
+
- requires unrelated callers to change.
|
|
260
139
|
|
|
261
|
-
|
|
140
|
+
Return the evidence. The correct route may be simplify, split, revise an artifact, learn, defer, or stop.
|
|
262
141
|
|
|
263
|
-
|
|
142
|
+
## Common Interface Mismatches
|
|
264
143
|
|
|
265
|
-
|
|
144
|
+
### Pass-through wrapper
|
|
266
145
|
|
|
267
|
-
|
|
268
|
-
Patch webhook to downgrade immediately, update email text, adjust dashboard copy.
|
|
269
|
-
```
|
|
146
|
+
Renames a call without hiding policy or provider behavior.
|
|
270
147
|
|
|
271
|
-
|
|
148
|
+
Keep only when it preserves a real domain, compatibility, or observation boundary.
|
|
272
149
|
|
|
273
|
-
|
|
274
|
-
- likely source-truth conflict with docs/tests;
|
|
275
|
-
- user-owned billing behavior.
|
|
150
|
+
### Leaky interface
|
|
276
151
|
|
|
277
|
-
|
|
152
|
+
Callers know infrastructure-specific details.
|
|
278
153
|
|
|
279
|
-
|
|
280
|
-
Stop at the decision gate. Decide billing policy first. Then localize policy behind a billing-state transition module if implementation spreads.
|
|
281
|
-
```
|
|
154
|
+
### God module
|
|
282
155
|
|
|
283
|
-
|
|
156
|
+
Unrelated decisions are collected behind one interface.
|
|
284
157
|
|
|
285
|
-
|
|
158
|
+
### Speculative seam
|
|
286
159
|
|
|
287
|
-
|
|
288
|
-
Thread forceRefresh through every caller.
|
|
289
|
-
```
|
|
160
|
+
Indirection exists only for imagined variation.
|
|
290
161
|
|
|
291
|
-
|
|
162
|
+
### Dependency cycle
|
|
292
163
|
|
|
293
|
-
|
|
294
|
-
- tests must set timing flags;
|
|
295
|
-
- source truth may allow caching.
|
|
164
|
+
Modules cannot change independently because their responsibilities point at each other.
|
|
296
165
|
|
|
297
|
-
|
|
166
|
+
### Premature artifact detail
|
|
298
167
|
|
|
299
|
-
|
|
300
|
-
Discuss the expected freshness boundary. If source truth supports it, hide invalidation and freshness rules behind a cache-aware read interface.
|
|
301
|
-
```
|
|
168
|
+
A Spec or Plan freezes classes, factories, tables, or algorithms before evidence supports the boundary.
|
|
302
169
|
|
|
303
170
|
## False Positives
|
|
304
171
|
|
|
305
|
-
Do not
|
|
172
|
+
Do not escalate when:
|
|
306
173
|
|
|
307
|
-
-
|
|
308
|
-
- a one-off script does not need long-term depth;
|
|
309
|
-
- a wrapper exists for public compatibility;
|
|
174
|
+
- stable repetition remains small and local;
|
|
310
175
|
- broad edits are mechanical and source-backed;
|
|
311
|
-
-
|
|
312
|
-
-
|
|
176
|
+
- a one-off script does not need long-term abstraction;
|
|
177
|
+
- a wrapper preserves a real compatibility contract;
|
|
178
|
+
- an isolated condition is wrong but the interface remains sound;
|
|
179
|
+
- an internal test intentionally verifies an internal module;
|
|
180
|
+
- resolving the pressure would exceed the user’s goal without blocking it.
|
|
313
181
|
|
|
314
|
-
|
|
182
|
+
Stop once the route is classified. Return evidence and classification; do not redesign automatically.
|
|
@@ -1,156 +1,136 @@
|
|
|
1
1
|
# Interface Design Loop
|
|
2
2
|
|
|
3
|
-
Read this before comparing materially different interfaces
|
|
3
|
+
Read this before comparing materially different interfaces or settling an important correctness boundary where ownership is consequential.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Use only evidence and criteria capable of distinguishing viable boundaries. Do not emit a full checklist unless the artifact itself requires one.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## 1. Frame The Complete Outcome
|
|
8
|
+
|
|
9
|
+
Orient broadly enough to state:
|
|
8
10
|
|
|
9
11
|
- caller and complete outcome;
|
|
10
12
|
- source-backed behavior and non-goals;
|
|
11
13
|
- decisions the caller genuinely owns;
|
|
12
14
|
- dependencies and current constraints;
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
Do not begin from existing flags, storage paths, or lifecycle states. Those may be symptoms of the current shape.
|
|
15
|
+
- material state and failure boundaries;
|
|
16
|
+
- why the current seam requires attention.
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
Do not begin from existing flags, storage paths, classes, or temporary states. They may be symptoms of the current design.
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
## 2. Define The Failure Unit
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
- slice;
|
|
23
|
-
- comparison;
|
|
24
|
-
- session;
|
|
25
|
-
- published result;
|
|
26
|
-
- another outcome specific to the domain.
|
|
22
|
+
Name the coherent outcome treated as one success, failure, and recovery boundary.
|
|
27
23
|
|
|
28
|
-
Define:
|
|
24
|
+
Define material:
|
|
29
25
|
|
|
30
|
-
- terminal states;
|
|
31
|
-
-
|
|
32
|
-
-
|
|
26
|
+
- terminal states and observers;
|
|
27
|
+
- canonical and diagnostic state;
|
|
28
|
+
- evidence written;
|
|
33
29
|
- forbidden partial outcomes;
|
|
34
|
-
- safe restart
|
|
35
|
-
-
|
|
36
|
-
- whether partial reuse is
|
|
37
|
-
|
|
38
|
-
When authority, integrity, canonical persistence, or proof validity materially affects correctness, also define:
|
|
30
|
+
- safe restart and recovery;
|
|
31
|
+
- required proof;
|
|
32
|
+
- whether partial reuse is required or merely an optimization.
|
|
39
33
|
|
|
40
|
-
|
|
41
|
-
- mutable state and canonical versus diagnostic records;
|
|
42
|
-
- authority or capability binding and replay scope;
|
|
43
|
-
- commit and visibility point;
|
|
44
|
-
- behavior when cancellation, integrity failure, or reconciliation failure occurs after an awaited or committed boundary.
|
|
34
|
+
When correctness materially depends on canonical state, partial effects, atomic visibility, concurrency, cancellation, retries, recovery, reconciliation, or evidence of the final outcome, read [State And Failure Boundaries](state-and-failure-boundaries.md).
|
|
45
35
|
|
|
46
|
-
|
|
36
|
+
## 3. Inventory Material Caller Knowledge
|
|
47
37
|
|
|
48
|
-
|
|
38
|
+
List only facts callers must know and that could affect the boundary:
|
|
49
39
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
roles and ownership
|
|
59
|
-
retries and cleanup
|
|
60
|
-
configuration
|
|
61
|
-
errors and failure semantics
|
|
62
|
-
compatibility and migration
|
|
63
|
-
cost and performance expectations
|
|
64
|
-
recovery
|
|
65
|
-
```
|
|
40
|
+
- operations and inputs;
|
|
41
|
+
- caller-owned decisions;
|
|
42
|
+
- ordering and lifecycle states;
|
|
43
|
+
- configuration and provider details;
|
|
44
|
+
- dependencies;
|
|
45
|
+
- errors and failure semantics;
|
|
46
|
+
- compatibility and migration;
|
|
47
|
+
- recovery, cost, and performance expectations.
|
|
66
48
|
|
|
67
49
|
For each fact ask:
|
|
68
50
|
|
|
69
|
-
- Does the caller own
|
|
70
|
-
- Could the module own it
|
|
51
|
+
- Does the caller own it?
|
|
52
|
+
- Could the module own it?
|
|
71
53
|
- Is it stable enough to expose?
|
|
72
54
|
- Would changing it force surrounding edits?
|
|
73
|
-
- Did a recent fix or review add this knowledge?
|
|
74
|
-
|
|
75
|
-
A growing list is direct evidence of a shallow interface.
|
|
76
55
|
|
|
77
|
-
|
|
56
|
+
The goal is not zero interface knowledge. It is the smallest honest contract.
|
|
78
57
|
|
|
79
|
-
Classify
|
|
58
|
+
## 4. Classify Capability Maturity
|
|
80
59
|
|
|
81
|
-
|
|
82
|
-
- **Safety:** prevents damage, leakage, or runaway work.
|
|
83
|
-
- **Efficiency:** saves time, requests, or money.
|
|
84
|
-
- **Scale:** supports concurrency or volume.
|
|
85
|
-
- **Portability:** supports additional hosts, providers, or environments.
|
|
60
|
+
Separate:
|
|
86
61
|
|
|
87
|
-
|
|
62
|
+
- required trust and safety;
|
|
63
|
+
- accepted efficiency or scale;
|
|
64
|
+
- demonstrated portability;
|
|
65
|
+
- speculative flexibility.
|
|
88
66
|
|
|
89
|
-
|
|
67
|
+
Do not defer required correctness to obtain a simpler-looking interface. Do not promote hypothetical efficiency, scale, or portability into present architecture.
|
|
90
68
|
|
|
91
|
-
|
|
69
|
+
## 5. Produce Alternatives Only When Real
|
|
92
70
|
|
|
93
|
-
|
|
71
|
+
When materially different ownership choices remain viable, design two or three interfaces that change seam placement—not only terminology.
|
|
94
72
|
|
|
95
|
-
|
|
96
|
-
- **Minimal contract:** expose the fewest stable decisions possible.
|
|
97
|
-
- **Common-case:** make the primary caller path trivial while preserving failure honesty.
|
|
98
|
-
- **Real variation:** design around two concrete adapters or environments when variation actually exists.
|
|
73
|
+
For each show:
|
|
99
74
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
1. interface and usage;
|
|
75
|
+
1. ordinary caller usage;
|
|
103
76
|
2. caller-owned decisions;
|
|
104
77
|
3. hidden internal protocol;
|
|
105
|
-
4. failure unit and behavior;
|
|
106
|
-
5. dependency
|
|
107
|
-
6. evidence needed
|
|
108
|
-
7.
|
|
78
|
+
4. failure unit and observable behavior;
|
|
79
|
+
5. dependency and adapter strategy;
|
|
80
|
+
6. evidence needed;
|
|
81
|
+
7. material cost or limitation.
|
|
82
|
+
|
|
83
|
+
When module decomposition, cohesion, dependency direction, cycles, layering, policy-versus-infrastructure ownership, or change propagation materially affects the design, read [Module And Dependency Design](module-and-dependency-design.md).
|
|
109
84
|
|
|
110
|
-
Do not
|
|
85
|
+
Do not manufacture alternatives for a local, reversible, source-backed choice.
|
|
111
86
|
|
|
112
|
-
## 6. Compare
|
|
87
|
+
## 6. Compare On Discriminating Criteria
|
|
113
88
|
|
|
114
|
-
|
|
89
|
+
Use only criteria that could change the recommendation:
|
|
115
90
|
|
|
116
|
-
-
|
|
117
|
-
- locality
|
|
91
|
+
- behavior per interface fact;
|
|
92
|
+
- locality of likely change;
|
|
93
|
+
- cohesion and ownership clarity;
|
|
118
94
|
- correct-use ergonomics;
|
|
119
95
|
- misuse and hidden-decision risk;
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
96
|
+
- dependency direction;
|
|
97
|
+
- failure honesty and recovery;
|
|
98
|
+
- contract stability;
|
|
99
|
+
- test surface;
|
|
123
100
|
- reversibility;
|
|
124
101
|
- maturity fit;
|
|
125
102
|
- implementation and evidence cost.
|
|
126
103
|
|
|
127
|
-
Prefer the
|
|
104
|
+
Prefer the boundary that removes concepts and coordination, not one that centralizes the same protocol behind additional terminology.
|
|
128
105
|
|
|
129
106
|
## 7. Learn Before Freezing
|
|
130
107
|
|
|
131
|
-
|
|
108
|
+
When evidence cannot distinguish viable boundaries, define one bounded learning slice:
|
|
132
109
|
|
|
133
110
|
```text
|
|
134
111
|
Question:
|
|
135
|
-
Competing
|
|
136
|
-
|
|
137
|
-
Evidence
|
|
138
|
-
Time
|
|
112
|
+
Competing boundaries:
|
|
113
|
+
Smallest prototype or observation:
|
|
114
|
+
Evidence required:
|
|
115
|
+
Time or cost boundary:
|
|
139
116
|
Discard-or-promote rule:
|
|
140
117
|
Return condition:
|
|
141
118
|
```
|
|
142
119
|
|
|
143
|
-
The
|
|
120
|
+
The learning slice answers the design question. It does not quietly implement the whole subsystem.
|
|
144
121
|
|
|
145
|
-
## 8. Return
|
|
122
|
+
## 8. Return The Supported Boundary
|
|
146
123
|
|
|
147
|
-
Return
|
|
124
|
+
Return:
|
|
148
125
|
|
|
149
|
-
-
|
|
150
|
-
-
|
|
151
|
-
-
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
126
|
+
- structural evidence;
|
|
127
|
+
- selected boundary and hidden decision;
|
|
128
|
+
- caller-owned contract;
|
|
129
|
+
- module and dependency implications;
|
|
130
|
+
- failure unit and material failure behavior;
|
|
131
|
+
- rejected alternatives and discriminating reason, when alternatives were real;
|
|
132
|
+
- unresolved user-owned decisions;
|
|
133
|
+
- assumptions and required evidence;
|
|
134
|
+
- narrowest next route.
|
|
155
135
|
|
|
156
|
-
|
|
136
|
+
Stop once a boundary is supported or a bounded learning question is identified. Recommendation does not authorize implementation.
|