@hobin/developer 0.1.0 → 0.1.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/README.md CHANGED
@@ -140,13 +140,13 @@ or the user may invoke one directly with `/skill:<name>`.
140
140
  | Skill | Helps decide |
141
141
  | --- | --- |
142
142
  | `specify` | Product meaning, scope, invariants, risks, and blocking unknowns |
143
- | `model` | Predicates, cases, rules, forbidden states, transitions, and objectives |
144
- | `sketch` | Data definitions, wished interfaces, representative cases, and checks |
145
- | `signal` | Repetition, difference, structural pressure, and model-code mismatch |
146
- | `naming-judgment` | Stable domain meaning and names that preserve change boundaries |
143
+ | `model` | Logic for Programmers-style condition spaces, guarantees, and verification targets |
144
+ | `sketch` | SICP-style abstraction barriers and HtDP-style data-directed design recipes |
145
+ | `signal` | Flocking-style small structural movement and model-code mismatch |
146
+ | `naming-judgment` | Elements of Clojure-style domain sense and change-preserving names |
147
147
  | `abstraction-review` | Whether a candidate should be kept, revised, split, rejected, or deferred |
148
- | `schedule` | Whether a structural change belongs now, after, or never |
149
- | `verify` | Whether current evidence actually supports an implementation claim |
148
+ | `schedule` | Tidy First-style behavior/structure timing: now, after, or never |
149
+ | `verify` | Verifier selection, evidence relevance, and pass-but-wrong risk |
150
150
  | `visualize` | The smallest visual surface that lowers judgment cost |
151
151
  | `adversarial-eval` | Finite, escalating attempts to falsify a skill or implementation claim |
152
152
 
@@ -154,6 +154,11 @@ Pi's loaded resource metadata is authoritative. If package configuration filters
154
154
  or disables a skill, Developer cannot route to it even if its file exists in the
155
155
  npm package.
156
156
 
157
+ Several skills link to detailed documents under their own `references/`
158
+ directory. Pi loads the `SKILL.md` instructions on demand; the instructions say
159
+ when the additional reference is worth reading and resolve it relative to the
160
+ skill directory. Small, already-settled judgments do not need the extra context.
161
+
157
162
  ## State, branches, and compaction
158
163
 
159
164
  Mode changes are stored as Pi custom session entries. Routes and judgments are
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@hobin/developer",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Adaptive product-development reasoning and evidence for Pi.",
5
5
  "type": "module",
6
- "keywords": ["pi-package", "pi", "developer", "skills"],
6
+ "keywords": [
7
+ "pi-package",
8
+ "pi",
9
+ "developer",
10
+ "skills"
11
+ ],
7
12
  "license": "MIT",
8
13
  "author": {
9
14
  "name": "dev-hobin",
@@ -21,23 +26,32 @@
21
26
  "publishConfig": {
22
27
  "access": "public"
23
28
  },
24
- "files": ["extensions", "skills", "README.md", "LICENSE"],
29
+ "files": [
30
+ "extensions",
31
+ "skills",
32
+ "README.md",
33
+ "LICENSE"
34
+ ],
25
35
  "engines": {
26
36
  "node": ">=22.19.0"
27
37
  },
28
- "scripts": {
29
- "check": "node scripts/check-package.mjs && node --test tests/*.test.ts",
30
- "eval": "node scripts/eval-rpc.mjs",
31
- "eval:json": "node scripts/eval-json.mjs"
32
- },
33
38
  "pi": {
34
- "extensions": ["./extensions/developer.ts"],
35
- "skills": ["./skills"]
39
+ "extensions": [
40
+ "./extensions/developer.ts"
41
+ ],
42
+ "skills": [
43
+ "./skills"
44
+ ]
36
45
  },
37
46
  "peerDependencies": {
38
47
  "@earendil-works/pi-ai": "*",
39
48
  "@earendil-works/pi-coding-agent": "*",
40
49
  "@earendil-works/pi-tui": "*",
41
50
  "typebox": "*"
51
+ },
52
+ "scripts": {
53
+ "check": "node scripts/check-package.mjs && node --test tests/*.test.ts",
54
+ "eval": "node scripts/eval-rpc.mjs",
55
+ "eval:json": "node scripts/eval-json.mjs"
42
56
  }
43
- }
57
+ }
@@ -76,7 +76,7 @@ human-owned.
76
76
  Do not discover structural movement, create the original design surface, decide
77
77
  timing, implement the change, or perform final completion review.
78
78
 
79
- ## References
79
+ ## Reference Routing
80
80
 
81
81
  - Read [the field card](references/field-card.md) for substantial or auditable
82
82
  reviews.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: model
3
- description: "Model the condition space behind a requirement, invariant, bug, policy, workflow, or code behavior using cases, predicates, rules, forbidden states, transitions, objectives, guarantee placement, and verification targets. Use when correctness depends on combinations, absence or default semantics, state, time, or policy interaction."
3
+ description: "Model the condition space behind a requirement, invariant, bug, policy, workflow, or code behavior using cases, predicates, rules, forbidden states, transitions, objectives, guarantee placement, and verification targets. Use when correctness depends on combinations, absence or default semantics, state, time, or policy interaction, including requests to apply Logic for Programmers-style condition modeling."
4
4
  ---
5
5
 
6
6
  # Model
@@ -69,7 +69,7 @@ Keep provisional rules visibly provisional.
69
69
  Do not decide product scope, design the implementation surface, schedule
70
70
  structural work, mutate artifacts, or make the final evidence judgment.
71
71
 
72
- ## References
72
+ ## Reference Routing
73
73
 
74
74
  Read [the problem-modeling reference](references/problem-modeling.md) for
75
75
  policy-heavy, stateful, optimization, safety-critical, or otherwise complex
@@ -18,6 +18,7 @@ task ownership.
18
18
  - Verification Target Derivation
19
19
  - Stop Checks
20
20
  - AI Delegation Boundary
21
+ - Conceptual Lineage
21
22
 
22
23
  ## Core Question
23
24
 
@@ -260,3 +261,14 @@ only a procedure. Provide:
260
261
  - verification: counterexamples, gates, and accepted evidence.
261
262
 
262
263
  AI helpers are not solvers. Their output must still be checked against the model.
264
+
265
+ ## Conceptual Lineage
266
+
267
+ This reference adapts the practical progression in Hillel Wayne's *Logic for
268
+ Programmers*: make predicates and domains explicit, turn implications into
269
+ counterexamples, choose representations that expose the real decision space,
270
+ and place guarantees where they can be checked. It extends that lineage with a
271
+ problem-shape router, explicit guarantee placement, and an AI delegation
272
+ boundary for product-development work.
273
+
274
+ - Logic for Programmers: https://leanpub.com/logic
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: naming-judgment
3
- description: "Review or create code names by separating stable domain meaning from the current implementation. Use when variables, functions, types, modules, components, APIs, fields, or abstractions are generic, misleading, filler-like, implementation-shaped, or carrying multiple product senses."
3
+ description: "Review or create code names by separating stable domain meaning from the current implementation. Use when variables, functions, types, modules, components, APIs, fields, or abstractions are generic, misleading, filler-like, implementation-shaped, or carrying multiple product senses, including requests to apply Elements of Clojure-style naming judgment."
4
4
  ---
5
5
 
6
6
  # Naming Judgment
@@ -71,7 +71,7 @@ Do not implement the rename, promote a new abstraction, invent product meaning,
71
71
  rename external conventions, or replace every short name with a longer one.
72
72
  Reuse does not prove that a generic name is sound.
73
73
 
74
- ## References
74
+ ## Reference Routing
75
75
 
76
76
  Read [the naming reference](references/elements-of-clojure-naming.md) for
77
77
  subtle, disputed, or recurring naming pressure.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: schedule
3
- description: "Decide whether a concrete structural change or reviewed abstraction candidate belongs now, after, or never using invariant pressure, evidence, reversibility, nested-work pressure, and cost of delay. Use when the candidate is concrete and the consequential question is timing."
3
+ description: "Decide whether a concrete structural change or reviewed abstraction candidate belongs now, after, or never using invariant pressure, evidence, reversibility, nested-work pressure, and cost of delay. Use when the candidate is concrete and timing is consequential, including requests to apply Tidy First-style behavior-versus-structure sequencing."
4
4
  ---
5
5
 
6
6
  # Schedule
@@ -18,6 +18,15 @@ When should this candidate be done: now, after, or never?
18
18
  - Current invariant pressure and nested-work pressure
19
19
  - Reversibility, cost of delay, risk if done now, and risk if delayed
20
20
 
21
+ ## Reference Routing
22
+
23
+ Read [the structural change timing reference](references/structural-change-timing.md)
24
+ when a behavior change and structural change compete, when `now` would remove
25
+ meaningful implementation freedom, or when reversibility, nested work, and cost
26
+ of delay point in different directions. Also read it when an `after` decision
27
+ needs an observable reopen condition. A small, reversible candidate whose
28
+ timing follows directly from the current invariant does not need the reference.
29
+
21
30
  ## Output
22
31
 
23
32
  Lead with the user's current risk and cost of delay; keep timing labels secondary.
@@ -0,0 +1,150 @@
1
+ # Structural Change Timing
2
+
3
+ Use this reference when a concrete refactor or abstraction candidate competes
4
+ with a behavior change, and timing depends on reversibility, optionality,
5
+ invariant pressure, or the cost of delay.
6
+
7
+ ## Contents
8
+
9
+ - Behavior And Structure
10
+ - Timing Vocabulary
11
+ - Decision Procedure
12
+ - Guarantee And Ability Tradeoff
13
+ - Reversibility And Cost Of Delay
14
+ - Nested Work Pressure
15
+ - Reopen Conditions
16
+ - Failure Checks
17
+ - Conceptual Lineage
18
+
19
+ ## Behavior And Structure
20
+
21
+ Separate two kinds of change before deciding timing:
22
+
23
+ - behavior change alters what the system does for a user, caller, or policy;
24
+ - structural change alters how the code is arranged while intending to preserve
25
+ behavior.
26
+
27
+ The same diff may contain both. Split them conceptually even when they are
28
+ committed together. A structural candidate belongs now only when its timing can
29
+ be justified by the current behavior or invariant—not merely by aesthetic
30
+ preference.
31
+
32
+ ## Timing Vocabulary
33
+
34
+ This skill uses three outcomes:
35
+
36
+ - `now`: perform the structural move before or as part of accepted work because
37
+ it protects the invariant, exposes a needed verification point, or unblocks a
38
+ safe implementation;
39
+ - `after`: preserve the option but let accepted behavior proceed first;
40
+ - `never`: reject the candidate for the current scope because it is speculative,
41
+ harmful, or has no evidence-backed pressure.
42
+
43
+ Kent Beck's broader vocabulary sometimes separates `later` from `after`. Here,
44
+ `after` covers both immediate follow-up and evidence-triggered deferral. The
45
+ reopen condition makes the distinction explicit.
46
+
47
+ ## Decision Procedure
48
+
49
+ Ask in order:
50
+
51
+ 1. What is the smallest concrete structural candidate?
52
+ 2. Which current claim, invariant, caller, or implementation step depends on it?
53
+ 3. What evidence shows the candidate is stable enough to act on?
54
+ 4. What guarantee does doing it now provide?
55
+ 5. What implementation freedom or alternate representation would it remove?
56
+ 6. Can a smaller type, contract, test, validation, adapter, or local movement
57
+ provide the same guarantee?
58
+ 7. How reversible is the move if the model changes?
59
+ 8. What cost grows if the move is delayed?
60
+ 9. What nested work does doing it now create?
61
+
62
+ Choose `now` when the accepted work is otherwise blocked, unsafe, or difficult
63
+ to verify for a concrete reason. Choose `after` when the move is plausible and
64
+ reversible but not required. Choose `never` when the pressure is cosmetic,
65
+ unrelated, low-confidence, or contradicted by current evidence.
66
+
67
+ ## Guarantee And Ability Tradeoff
68
+
69
+ Every structure buys a guarantee by removing some ability. Examples:
70
+
71
+ - a narrower type prevents invalid states but rejects flexible inputs;
72
+ - a shared policy centralizes decisions but removes caller variation;
73
+ - an abstraction barrier protects representation but restricts direct access;
74
+ - normalization simplifies consumers but may erase source distinctions;
75
+ - persistent history enables temporal guarantees but adds storage and ordering
76
+ obligations.
77
+
78
+ State both sides. A claimed guarantee is not enough when the lost ability is a
79
+ real product requirement. A claimed flexibility is not enough when it permits a
80
+ modeled forbidden case.
81
+
82
+ ## Reversibility And Cost Of Delay
83
+
84
+ Prefer earlier structural work when delaying it creates irreversible or rapidly
85
+ growing cost:
86
+
87
+ - data is persisted in a representation that will be expensive to migrate;
88
+ - public callers begin depending on an accidental contract;
89
+ - several implementations will duplicate the same invariant-bearing policy;
90
+ - tests are impossible to write at the current boundary;
91
+ - the next accepted step compounds hidden state or ownership.
92
+
93
+ Prefer deferral when the move is cheap to add later, current examples are too
94
+ few, the domain vocabulary is unstable, or the candidate would close several
95
+ valid implementation paths.
96
+
97
+ Do not confuse large effort with irreversibility. A large but isolated movement
98
+ may remain reversible; a one-line public contract can be difficult to undo.
99
+
100
+ ## Nested Work Pressure
101
+
102
+ Structural work often discovers more structural work. Count that pressure:
103
+
104
+ - new public concepts;
105
+ - migrations or compatibility layers;
106
+ - cross-package coordination;
107
+ - new lifecycle or state ownership;
108
+ - additional verification infrastructure;
109
+ - unrelated cleanup required only to make the candidate look complete.
110
+
111
+ Bias toward `after` when the candidate opens a chain of nested work without
112
+ protecting the current invariant. If a small prerequisite is genuinely needed,
113
+ schedule that prerequisite rather than the full idealized architecture.
114
+
115
+ ## Reopen Conditions
116
+
117
+ An `after` decision must state observable evidence that reopens it, such as:
118
+
119
+ - a second caller needs the same contract;
120
+ - another branch repeats the same stable policy;
121
+ - a new requirement reaches the blocked extension point;
122
+ - a performance or migration threshold is crossed;
123
+ - an accepted verifier cannot observe the claim through the current boundary.
124
+
125
+ Do not use calendar time alone unless timing itself changes the risk. A reopen
126
+ condition should be detectable from code, requirements, evidence, or product
127
+ priority.
128
+
129
+ ## Failure Checks
130
+
131
+ The timing judgment is weak when:
132
+
133
+ - the candidate is still only a smell or vague aspiration;
134
+ - `now` means only "the code is messy";
135
+ - `after` has no reopen condition;
136
+ - `never` silently means "not in this task";
137
+ - behavior and structure have not been separated;
138
+ - the guarantee gained is named but the ability lost is ignored;
139
+ - large nested work is hidden inside a small-sounding abstraction;
140
+ - timing substitutes for product prioritization that only a human can decide.
141
+
142
+ ## Conceptual Lineage
143
+
144
+ This reference adapts Kent Beck's distinction between behavior and structure,
145
+ and his timing vocabulary of first, after, later, and never. The package reduces
146
+ the vocabulary to `now`, `after`, and `never` while preserving reversibility,
147
+ optionality, and cost-of-delay reasoning.
148
+
149
+ - Structure and behavior: https://newsletter.kentbeck.com/p/structure-and-behavior
150
+ - First, after, later, never: https://newsletter.kentbeck.com/p/first-after-later-never
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: signal
3
- description: "Inspect requirements, code, diffs, tests, UI states, names, or recent changes for observable structural movement and classify it as absent, horizontal, vertical, or ambiguous. Use when evidence suggests duplication, model-code mismatch, boundary pressure, or an emerging refactoring candidate."
3
+ description: "Inspect requirements, code, diffs, tests, UI states, names, or recent changes for observable structural movement and classify it as absent, horizontal, vertical, or ambiguous. Use when evidence suggests duplication, model-code mismatch, boundary pressure, or an emerging refactoring candidate, including requests for flocking-style small behavior-preserving refactoring."
4
4
  ---
5
5
 
6
6
  # Signal
@@ -18,6 +18,15 @@ What structural movement is actually visible in the evidence?
18
18
  - Invariant or condition model when available
19
19
  - Known callers when shared helpers, APIs, or boundaries are involved
20
20
 
21
+ ## Reference Routing
22
+
23
+ Read [the flocking and structural movement reference](references/flocking-and-structural-movement.md)
24
+ when duplication, parallel branches, similar tests, repeated UI states,
25
+ conditionals, or a recent refactor need a behavior-preserving next move. Also
26
+ read it when the horizontal/vertical distinction is consequential or the
27
+ available checks may not keep a small movement green. A direct, evidence-backed
28
+ observation with no proposed movement does not need the reference.
29
+
21
30
  ## Output
22
31
 
23
32
  Lead with the observed code or product pressure; keep signal labels secondary.
@@ -0,0 +1,157 @@
1
+ # Flocking And Structural Movement
2
+
3
+ Use this reference when duplication, parallel branches, similar tests, repeated
4
+ UI states, conditionals, or a recent refactor create pressure for structural
5
+ movement and the safest next move is not obvious.
6
+
7
+ ## Contents
8
+
9
+ - Change Pressure
10
+ - The Flocking Cycle
11
+ - Evidence That Keeps The Move Green
12
+ - Horizontal And Vertical Movement
13
+ - Model-Code Mismatch
14
+ - Small-Step Discipline
15
+ - Failure Checks
16
+ - Reporting Shape
17
+ - Conceptual Lineage
18
+
19
+ ## Change Pressure
20
+
21
+ Start with the current requirement or invariant. Ask whether the existing code
22
+ is already open to the change. If it is, similarity alone does not justify a
23
+ refactor. If it is not, locate the smallest part of the code whose present shape
24
+ blocks or obscures the change.
25
+
26
+ Structural movement should answer an observed pressure:
27
+
28
+ - two paths express the same responsibility differently;
29
+ - a stable domain difference is hidden in incidental branching;
30
+ - a default or absence policy is duplicated;
31
+ - a modeled transition is represented as an unrelated current-state check;
32
+ - callers repeat knowledge that should belong behind a boundary;
33
+ - names describe mechanics while the model describes meaning.
34
+
35
+ ## The Flocking Cycle
36
+
37
+ Work with one selected pair at a time:
38
+
39
+ 1. Select the two things most alike.
40
+ 2. State why they are alike: responsibility, vocabulary, transition, failure
41
+ mode, model element, or user-visible outcome.
42
+ 3. Find the smallest meaningful difference between only those two things.
43
+ 4. Choose the simplest behavior-preserving move that removes or exposes that
44
+ difference.
45
+ 5. Run the smallest relevant check.
46
+ 6. Observe the new shape before choosing another pair.
47
+ 7. Delete newly unused code only after the replacement is exercised.
48
+
49
+ Possible small moves include matching an expression or name, aligning a branch,
50
+ introducing a temporary parameter or adapter, moving one responsibility, or
51
+ calling the new shape before deleting the old one.
52
+
53
+ If the proposed move changes behavior, touches many unrelated sites, or creates
54
+ a public concept, it is no longer a routine flocking step. Split it or return a
55
+ vertical/ambiguous candidate for review.
56
+
57
+ ## Evidence That Keeps The Move Green
58
+
59
+ "Behavior preserving" is a claim, not a visual impression. Name the evidence:
60
+
61
+ - focused tests for the affected responsibility;
62
+ - a characterization test for legacy behavior;
63
+ - typecheck, build, or contract evidence for an interface movement;
64
+ - a representative UI or integration check;
65
+ - a diff inspection showing only structural change;
66
+ - an explicit residual when no cheap verifier exists.
67
+
68
+ Lower confidence when evidence cannot distinguish the original and moved
69
+ behavior. Do not use a broad green suite as proof when it never exercises the
70
+ selected difference.
71
+
72
+ ## Horizontal And Vertical Movement
73
+
74
+ Keep movement horizontal when it aligns already-related code inside the current
75
+ abstraction level and leaves no stable new concept behind.
76
+
77
+ Treat movement as vertical only when, after the difference is understood, a
78
+ nameable concept remains:
79
+
80
+ - a policy with its own cases;
81
+ - an invariant-bearing boundary;
82
+ - a responsibility with distinct reasons to change;
83
+ - a conversion or representation barrier;
84
+ - state/history ownership;
85
+ - a caller contract shared across uses.
86
+
87
+ Similarity is not enough. Two pieces may look alike while changing for
88
+ different reasons. Conversely, a vertical concept may first appear as a stable
89
+ difference rather than as duplicated text.
90
+
91
+ For a vertical or ambiguous candidate, state its pressure, contract-shaped
92
+ meaning, hidden detail, invariant risk, concrete evidence, and evidence still
93
+ needed. Do not promote or schedule it here.
94
+
95
+ ## Model-Code Mismatch
96
+
97
+ When a problem model exists, check whether code and model disagree:
98
+
99
+ - a forbidden case remains representable or reachable;
100
+ - a decision space has a missing or conflicting branch;
101
+ - a transition rule sees only the current state and loses history;
102
+ - a caller does not establish a callee precondition;
103
+ - a type admits invalid states without a boundary check;
104
+ - progress or retry behavior is absent from a temporal requirement;
105
+ - a ranking or objective is hidden in incidental ordering;
106
+ - product vocabulary and code vocabulary point to different concepts.
107
+
108
+ A mismatch may justify structural review even without textual duplication.
109
+
110
+ ## Small-Step Discipline
111
+
112
+ Keep each move reversible and locally explainable. After every green move,
113
+ reselect the comparison instead of executing a predetermined refactoring plan.
114
+ The newly aligned code may reveal that the next difference is meaningful and
115
+ should remain.
116
+
117
+ When a move fails its check, revert or repair that move before continuing. Do
118
+ not stack more structural guesses on top of ambiguous evidence.
119
+
120
+ ## Failure Checks
121
+
122
+ The observation is not ready when:
123
+
124
+ - no selected pair is named;
125
+ - "duplicate" is the only similarity basis;
126
+ - the smallest difference is actually several differences;
127
+ - the move has no behavior-preserving evidence;
128
+ - a helper is proposed before its stable concept can be stated;
129
+ - line count or static complexity is treated as the only improvement measure;
130
+ - product scope is expanded during structural observation;
131
+ - timing is decided before a concrete candidate exists.
132
+
133
+ ## Reporting Shape
134
+
135
+ Keep the result auditable:
136
+
137
+ ```text
138
+ Pressure: the requirement, invariant, or mismatch driving observation
139
+ Selected pair: the two most alike artifacts and why
140
+ Smallest difference: one concrete distinction
141
+ Smallest move: one behavior-preserving experiment
142
+ Evidence: the check that keeps the move green
143
+ Classification: no-signal | horizontal | vertical | ambiguous
144
+ Candidate: only for vertical or ambiguous movement
145
+ Missing evidence: what could change the classification
146
+ ```
147
+
148
+ ## Conceptual Lineage
149
+
150
+ This reference adapts the flocking rules and small, behavior-preserving
151
+ refactoring discipline presented by Sandi Metz, Katrina Owen, and TJ Stankus in
152
+ *99 Bottles of OOP*. It extends the comparison with model-code mismatch and
153
+ explicit evidence because the skill must judge real product changes, not only
154
+ remove duplication.
155
+
156
+ - 99 Bottles of OOP: https://sandimetz.com/99bottles
157
+ - JavaScript sample: https://sandimetz.com/99bottles-sample-js
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sketch
3
- description: "Shape an implementable design surface from a requirement, invariant, problem model, existing code, or representative cases using data definitions, templates, wishful top-level design, interfaces, checks, and a small implementation queue. Use when behavior is understood but ownership, boundaries, data flow, or implementation shape remains unresolved."
3
+ description: "Shape an implementable design surface from a requirement, invariant, problem model, existing code, or representative cases using data definitions, templates, wishful top-level design, interfaces, checks, and a small implementation queue. Use when ownership, boundaries, data flow, or implementation shape remains unresolved, including requests to apply SICP-style wishful thinking or abstraction barriers and HtDP-style design recipes."
4
4
  ---
5
5
 
6
6
  # Sketch
@@ -18,6 +18,16 @@ What design surface makes this intent implementable?
18
18
  - Representative normal, boundary, forbidden, and product-meaning cases
19
19
  - Constraints and verification targets
20
20
 
21
+ ## Reference Routing
22
+
23
+ Read [the design recipe and abstraction barriers reference](references/design-recipe-and-abstraction-barriers.md)
24
+ when data shape, traversal, representation, ownership, or wished interfaces
25
+ carry consequential design judgment. Also read it when a proposed sketch is
26
+ mostly a file-edit plan, when representative cases do not shape the template,
27
+ or when an abstraction barrier needs a concrete stop check. A small local design
28
+ whose purpose, cases, data flow, and first implementation item are already clear
29
+ does not need the reference.
30
+
21
31
  ## Output
22
32
 
23
33
  Lead with the user's product language; keep design labels secondary.
@@ -0,0 +1,169 @@
1
+ # Design Recipe And Abstraction Barriers
2
+
3
+ Use this reference when a sketch must do more than name files or helpers: the
4
+ data shape, ownership, traversal, representation boundary, or wished interfaces
5
+ must carry part of the design judgment.
6
+
7
+ ## Contents
8
+
9
+ - Design Pressure
10
+ - Data Definitions And Templates
11
+ - Wishful Top-Level Design
12
+ - Wished Interfaces As Barriers
13
+ - Representative Cases And Checks
14
+ - Deferred Abstractions
15
+ - Failure Checks
16
+ - Compact Example
17
+ - Conceptual Lineage
18
+
19
+ ## Design Pressure
20
+
21
+ A useful sketch preserves a chain of reasoning:
22
+
23
+ ```text
24
+ accepted intent
25
+ -> purpose
26
+ -> data or state definitions
27
+ -> representative cases
28
+ -> data-shaped template
29
+ -> wishful top level
30
+ -> wished interfaces and checks
31
+ -> smallest implementation item
32
+ ```
33
+
34
+ Do not start with a file list. A file list records placement after the design is
35
+ known; it does not explain why the design has that shape.
36
+
37
+ ## Data Definitions And Templates
38
+
39
+ A data definition does more than repeat a type name. State:
40
+
41
+ - what domain information the data represents;
42
+ - which values are valid members;
43
+ - which values are excluded or impossible;
44
+ - which variants, lifecycle states, or ownership boundaries matter;
45
+ - which fields are available at each branch or traversal point.
46
+
47
+ Derive the template from that definition. The template should expose the
48
+ structural inventory an implementation must handle:
49
+
50
+ - one branch for each meaningfully different variant;
51
+ - selectors or fields available in each branch;
52
+ - recursive or collection traversal positions;
53
+ - state transitions and the old/new values they require;
54
+ - ownership handoffs and conversion boundaries.
55
+
56
+ Merging two branches is allowed only when the accepted intent treats them the
57
+ same. Omitting a branch requires an explicit reason, such as an upstream
58
+ guarantee that makes the state unreachable.
59
+
60
+ The template is not final code. It is the smallest skeleton that makes missing
61
+ cases, hidden state, and accidental representation choices visible.
62
+
63
+ ## Wishful Top-Level Design
64
+
65
+ Write the top-level operation as if the right lower-level operations already
66
+ existed. Use the vocabulary of the product contract and problem model rather
67
+ than storage, framework, DOM, transport, or mutation mechanics.
68
+
69
+ Wishful top-level design should reveal:
70
+
71
+ - the order of domain operations;
72
+ - which decisions belong at the top level;
73
+ - which details callers should not need to know;
74
+ - which missing concepts need names and contracts;
75
+ - where evidence can check the result.
76
+
77
+ Do not invent a helper only to shorten code. A wished operation earns a name
78
+ when its purpose and caller-facing assumption can be stated without describing
79
+ its body.
80
+
81
+ ## Wished Interfaces As Barriers
82
+
83
+ Treat each wished interface as a proposed abstraction barrier. Record:
84
+
85
+ - purpose: what callers obtain or may assume;
86
+ - input and output shape;
87
+ - contract: preconditions, postconditions, and meaningful failure;
88
+ - owner: the component or layer responsible for the guarantee;
89
+ - hidden detail: representation or mechanism callers must not depend on;
90
+ - stop check: the smallest evidence that would falsify the contract.
91
+
92
+ An interface is too weak when callers still inspect the hidden representation.
93
+ It is too broad when unrelated policy or lifecycle decisions are bundled behind
94
+ one name. It is speculative when no representative case needs the boundary.
95
+
96
+ ## Representative Cases And Checks
97
+
98
+ Choose cases before implementation shape hardens. Include only cases that
99
+ distinguish meaningful behavior:
100
+
101
+ - a normal case;
102
+ - each relevant data variant;
103
+ - a boundary or absence/default case;
104
+ - a forbidden or impossible case;
105
+ - a product-meaning case that a mechanically plausible implementation could
106
+ get wrong.
107
+
108
+ Map cases to evidence. Unit examples are not always enough: a type, contract,
109
+ property check, runtime validation, state-transition check, UI inspection, or
110
+ human acceptance may carry the guarantee more directly.
111
+
112
+ ## Deferred Abstractions
113
+
114
+ Separate three things:
115
+
116
+ 1. design artifacts needed to understand the current change;
117
+ 2. implementation items needed to make the accepted behavior real;
118
+ 3. abstraction candidates that the sketch noticed but current evidence has not
119
+ earned.
120
+
121
+ For each deferred candidate, state the pressure that would reopen it. Do not
122
+ promote it merely because the wished top level uses a convenient name.
123
+
124
+ ## Failure Checks
125
+
126
+ A sketch is too shallow when:
127
+
128
+ - it can be reduced to "edit these files" without losing information;
129
+ - the data definition is a type name with no valid/excluded members;
130
+ - the template does not mirror the important variants or traversal shape;
131
+ - wished helpers expose no caller contract or hidden detail;
132
+ - the top level speaks in framework or storage vocabulary;
133
+ - examples all follow the happy path;
134
+ - checks prove execution but not the accepted meaning;
135
+ - deferred ideas silently enter the implementation queue.
136
+
137
+ Return to product clarification or modeling when the purpose, valid members, or
138
+ case outcomes cannot be stated without guessing.
139
+
140
+ ## Compact Example
141
+
142
+ For a form-to-domain conversion, do not begin with `add mapper.ts`.
143
+
144
+ ```text
145
+ Purpose: convert editable form state into valid schedule content.
146
+ Data variants: one-time | recurring; optional end date; local date/time input.
147
+ Cases: one-time, recurring without end, recurring with end, invalid interval.
148
+ Template: branch by schedule kind, normalize shared time fields, validate the
149
+ variant, construct domain content.
150
+ Wishful top level: validate(form) -> normalize(form) -> makeScheduleContent(...)
151
+ Barrier: makeScheduleContent hides the domain representation and rejects
152
+ impossible combinations.
153
+ Checks: one table row per meaningful variant and forbidden combination.
154
+ ```
155
+
156
+ The concrete functions may change after repository inspection. The design
157
+ pressure should remain stable.
158
+
159
+ ## Conceptual Lineage
160
+
161
+ This reference adapts procedural abstraction, data abstraction, wishful
162
+ thinking, and abstraction barriers from Abelson and Sussman's *Structure and
163
+ Interpretation of Computer Programs*, together with the data-directed design
164
+ recipe from Felleisen, Findler, Flatt, and Krishnamurthi's *How to Design
165
+ Programs*. It uses those ideas as design judgment, not as a mandatory phase
166
+ sequence.
167
+
168
+ - SICP: https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/book.html
169
+ - HtDP: https://htdp.org/2026-5-28/Book/index.html
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: verify
3
- description: "Judge what claims are supported by code, tests, diffs, command results, UI states, implementation reports, invariants, or problem models. Use when completion, correctness, coverage, or pass-but-wrong risk depends on mapping current evidence to a concrete claim."
3
+ description: "Judge what claims are supported by code, tests, diffs, command results, UI states, implementation reports, invariants, or problem models. Use when completion, correctness, verifier selection, coverage, source compatibility, structural degradation, or pass-but-wrong risk depends on mapping current evidence to a concrete claim."
4
4
  ---
5
5
 
6
6
  # Verify
@@ -18,6 +18,15 @@ What claims does the available evidence support?
18
18
  - Invariant, model, accepted decisions, and verification targets when available
19
19
  - Relevant counterexamples and source provenance
20
20
 
21
+ ## Reference Routing
22
+
23
+ Read [the verifier selection and pass-but-wrong reference](references/verifier-selection-and-pass-but-wrong.md)
24
+ when several claims need different evidence, a passing command may not exercise
25
+ the accepted meaning, source compatibility matters, or behavior can pass while
26
+ structure degrades. Also read it before a consequential completion claim whose
27
+ verifier relevance or residual risk is unclear. A narrow claim with direct,
28
+ relevant evidence does not need the reference.
29
+
21
30
  ## Output
22
31
 
23
32
  Lead with the user's claim and observed evidence; keep verification labels secondary.
@@ -0,0 +1,169 @@
1
+ # Verifier Selection And Pass-But-Wrong Risk
2
+
3
+ Use this reference when a completion claim depends on several kinds of evidence,
4
+ a passing check may not exercise the claim, or structural correctness matters in
5
+ addition to visible behavior.
6
+
7
+ ## Contents
8
+
9
+ - Claim Before Check
10
+ - Evidence Map
11
+ - Verifier Ladder
12
+ - Execution Versus Relevance
13
+ - Pass-But-Wrong Search
14
+ - Structural Degradation
15
+ - Feedback Classification
16
+ - Residual Risk And Stop Checks
17
+ - Compact Example
18
+
19
+ ## Claim Before Check
20
+
21
+ State the claim before selecting a verifier. "Tests pass" is an observation;
22
+ "the conversion rejects every impossible schedule variant" is a claim.
23
+
24
+ Split broad completion statements into independently checkable claims:
25
+
26
+ - product behavior;
27
+ - forbidden and boundary cases;
28
+ - type or API contract;
29
+ - transition and history behavior;
30
+ - compatibility with the requested source or version;
31
+ - representation or abstraction boundary;
32
+ - operational property such as performance, ordering, or idempotency.
33
+
34
+ If a claim cannot be stated, return to specification or modeling rather than
35
+ choosing a convenient command.
36
+
37
+ ## Evidence Map
38
+
39
+ For each claim record:
40
+
41
+ ```text
42
+ Claim: the narrow statement under review
43
+ Verifier: command, inspection, fixture, or human acceptance
44
+ Observation: what actually happened
45
+ Relevance: why the observation bears on the claim
46
+ Counterexample coverage: meaningful wrong shapes exercised or omitted
47
+ Residual: uncertainty that remains
48
+ ```
49
+
50
+ Evidence may be direct, supporting, weak, contradicted, unavailable, or
51
+ human-owned. Do not merge unavailable evidence with passing evidence.
52
+
53
+ ## Verifier Ladder
54
+
55
+ Prefer the cheapest verifier that can actually falsify the claim:
56
+
57
+ | Verifier | Best fit |
58
+ | --- | --- |
59
+ | static inspection or focused diff | locality, wiring, ownership, stale code, representation boundary |
60
+ | typecheck, lint, build, manifest check | syntax, imports, compile-time contracts, packaging |
61
+ | focused example test | one concrete behavior or regression |
62
+ | table or parameterized test | finite meaningful cases and boundaries |
63
+ | property or metamorphic check | many examples share a stable rule |
64
+ | integration or UI check | composition, rendering, persistence, external boundaries |
65
+ | state-transition or concurrency fixture | history, ordering, retry, stale events, idempotency |
66
+ | performance or resource measurement | runtime shape is part of the claim |
67
+ | model, solver, or exhaustive check | small critical rule space justifies exhaustive reasoning |
68
+ | human acceptance | the remaining question is policy, meaning, or visual judgment |
69
+
70
+ Use a stronger verifier when a weaker one can pass under a plausible wrong
71
+ implementation. Use a weaker verifier when it is the only practical evidence,
72
+ but narrow the claim and record the residual.
73
+
74
+ ## Execution Versus Relevance
75
+
76
+ A verifier execution proves only that the verifier ran and produced an
77
+ observation. Check relevance separately:
78
+
79
+ - Did the fixture reach the changed branch?
80
+ - Did assertions inspect the product meaning or only absence of an exception?
81
+ - Did the build use the source and version requested by the user?
82
+ - Did a UI snapshot expose interaction and state changes or only initial pixels?
83
+ - Did a broad suite include the new boundary case?
84
+ - Did the manual inspection examine the actual generated artifact?
85
+
86
+ A green but irrelevant verifier creates a `verifier-gap`; it does not support
87
+ the broader claim.
88
+
89
+ ## Pass-But-Wrong Search
90
+
91
+ For every consequential claim, imagine at least one implementation that passes
92
+ current checks while violating the intended meaning. Look for:
93
+
94
+ - missing branches whose fixtures never occur;
95
+ - fallback/default behavior that silently selects product policy;
96
+ - assertions that accept both the intended and an unintended value;
97
+ - mocks that bypass the real boundary;
98
+ - tests coupled to the implementation rather than the contract;
99
+ - source/version mismatch;
100
+ - current-state checks that miss invalid transitions;
101
+ - correct result with wrong ordering, mutation, sharing, or complexity;
102
+ - public API compatibility tested without real consumers.
103
+
104
+ When a plausible shape remains cheap to test, add the smallest distinguishing
105
+ fixture. Otherwise record it as residual risk instead of broadening the claim.
106
+
107
+ ## Structural Degradation
108
+
109
+ Behavior may pass while the change weakens the code's ability to preserve the
110
+ same guarantee. Inspect for:
111
+
112
+ - duplicated invariant or absence/default policy;
113
+ - representation details leaking through a caller contract;
114
+ - generic abstraction without stable examples or a nameable purpose;
115
+ - hidden state, history, ordering, or ownership;
116
+ - vocabulary drifting away from the accepted model;
117
+ - a local fix that makes the next accepted requirement harder or unsafe;
118
+ - tests passing only because they mirror the new implementation.
119
+
120
+ Structural degradation is evidence for structural observation or abstraction
121
+ review. It does not automatically require refactoring now.
122
+
123
+ ## Feedback Classification
124
+
125
+ Use a small, stable taxonomy:
126
+
127
+ - `pass`: the evidence supports the narrow claim;
128
+ - `implementation-fail`: relevant evidence contradicts the accepted claim;
129
+ - `model-or-spec-fail`: evidence shows the accepted meaning or case model is
130
+ wrong or incomplete;
131
+ - `verifier-gap`: the check is missing or irrelevant to the claim;
132
+ - `blocked-environment`: the required source or environment was not exercised;
133
+ - `pass-but-wrong-risk`: current evidence passes while a plausible wrong shape
134
+ remains;
135
+ - `structural-degradation`: behavior passes but structure weakens a relevant
136
+ boundary or guarantee.
137
+
138
+ Classification describes the observation. The caller decides whether to
139
+ repair, remodel, add evidence, ask a human, accept residual risk, or continue.
140
+
141
+ ## Residual Risk And Stop Checks
142
+
143
+ Verification is complete enough when:
144
+
145
+ - every stated claim is supported, narrowed, or explicitly unverified;
146
+ - each important forbidden or boundary case has evidence or a residual;
147
+ - actual source and version match the requested target;
148
+ - plausible pass-but-wrong shapes were attempted or recorded;
149
+ - structural claims have more than behavioral evidence when needed;
150
+ - human-owned acceptance is distinguished from mechanical checks;
151
+ - another verifier would cost more than the information it is expected to add.
152
+
153
+ Do not claim total correctness from a finite evidence set. State the strongest
154
+ claim justified now.
155
+
156
+ ## Compact Example
157
+
158
+ ```text
159
+ Claim: recurring schedules without an end date remain valid.
160
+ Verifier: focused table test with one-time, recurring-open, recurring-bounded,
161
+ and invalid-interval rows.
162
+ Observation: all rows produce the expected domain result.
163
+ Relevance: each semantic variant crosses the new conversion boundary.
164
+ Pass-but-wrong search: a mapper could still ignore timezone normalization.
165
+ Residual: timezone behavior remains unverified and is not included in the
166
+ supported claim.
167
+ ```
168
+
169
+ The correct result is a narrower supported claim, not an unqualified "done."