@hobin/developer 0.1.7 → 0.1.9

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 (66) hide show
  1. package/README.md +212 -355
  2. package/REFERENCE_ROUTING.md +243 -0
  3. package/extensions/developer.ts +601 -23
  4. package/extensions/machine.ts +45 -0
  5. package/extensions/references/behavior-preserving-structural-change.md +87 -8
  6. package/extensions/skills.ts +330 -52
  7. package/extensions/state.ts +227 -2
  8. package/extensions/tool-policy.ts +87 -0
  9. package/package.json +9 -3
  10. package/skills/abstraction-review/SKILL.md +37 -23
  11. package/skills/abstraction-review/reference-policy.json +66 -0
  12. package/skills/abstraction-review/references/field-card.md +113 -168
  13. package/skills/abstraction-review/references/repair-table.md +66 -80
  14. package/skills/abstraction-review/references/worked-examples.md +79 -256
  15. package/skills/model/SKILL.md +31 -13
  16. package/skills/model/reference-policy.json +96 -0
  17. package/skills/model/references/contract-and-replacement-models.md +112 -0
  18. package/skills/model/references/logic-query-semantics.md +89 -0
  19. package/skills/model/references/planning-models.md +75 -0
  20. package/skills/model/references/problem-modeling.md +143 -276
  21. package/skills/model/references/proof-obligations.md +71 -0
  22. package/skills/model/references/relational-constraint-models.md +110 -0
  23. package/skills/model/references/solver-result-boundaries.md +83 -0
  24. package/skills/model/references/temporal-behavior-models.md +106 -0
  25. package/skills/naming-judgment/SKILL.md +17 -4
  26. package/skills/naming-judgment/reference-policy.json +29 -0
  27. package/skills/naming-judgment/references/domain-naming.md +29 -10
  28. package/skills/schedule/SKILL.md +16 -6
  29. package/skills/schedule/reference-policy.json +29 -0
  30. package/skills/schedule/references/structural-change-timing.md +81 -18
  31. package/skills/signal/SKILL.md +17 -6
  32. package/skills/signal/reference-policy.json +29 -0
  33. package/skills/signal/references/structural-movement.md +87 -14
  34. package/skills/sketch/SKILL.md +38 -42
  35. package/skills/sketch/reference-policy.json +212 -0
  36. package/skills/sketch/references/accumulator-invariants.md +125 -0
  37. package/skills/sketch/references/closure-and-conventional-interfaces.md +87 -0
  38. package/skills/sketch/references/composition-by-wishes.md +69 -0
  39. package/skills/sketch/references/data-driven-design.md +99 -22
  40. package/skills/sketch/references/data-shape-template-catalog.md +58 -19
  41. package/skills/sketch/references/design-levels-and-boundaries.md +133 -0
  42. package/skills/sketch/references/earned-abstraction.md +75 -0
  43. package/skills/sketch/references/generative-recursion.md +122 -0
  44. package/skills/sketch/references/generic-dispatch-systems.md +75 -0
  45. package/skills/sketch/references/language-semantics.md +82 -0
  46. package/skills/sketch/references/meaning-preserving-conversions.md +69 -0
  47. package/skills/sketch/references/process-shape-and-resources.md +157 -0
  48. package/skills/sketch/references/representation-barriers.md +73 -0
  49. package/skills/sketch/references/responsibility-and-collaboration.md +108 -0
  50. package/skills/sketch/references/runtime-and-compilation.md +84 -0
  51. package/skills/sketch/references/selection-and-creation.md +76 -0
  52. package/skills/sketch/references/state-history-and-order.md +126 -0
  53. package/skills/sketch/references/type-transitions.md +54 -0
  54. package/skills/sketch/references/variation-roles.md +59 -0
  55. package/skills/verify/SKILL.md +17 -6
  56. package/skills/verify/reference-policy.json +30 -0
  57. package/skills/verify/references/verifier-selection-and-pass-but-wrong.md +152 -192
  58. package/SOURCES.md +0 -104
  59. package/skills/abstraction-review/references/recipe-cards.md +0 -322
  60. package/skills/model/references/worked-models-and-specialized-techniques.md +0 -218
  61. package/skills/sketch/references/abstraction-barriers-and-closure.md +0 -160
  62. package/skills/sketch/references/abstraction-composition-and-state.md +0 -184
  63. package/skills/sketch/references/composition-generative-recursion-and-accumulators.md +0 -196
  64. package/skills/sketch/references/generic-operations-and-languages.md +0 -134
  65. package/skills/sketch/references/processes-state-and-time.md +0 -171
  66. package/skills/sketch/references/responsibility-and-variation.md +0 -245
@@ -0,0 +1,243 @@
1
+ # Reference Routing Contract
2
+
3
+ This document defines how `@hobin/developer` decides which packaged references
4
+ an active skill judgment must load and apply.
5
+
6
+ ## Decision
7
+
8
+ `primary` and `companion` are not intrinsic properties of a reference file.
9
+ They are too coarse for the package because the same document can be sufficient
10
+ for one question and only one part of a larger derivation for another.
11
+
12
+ The routing unit is instead:
13
+
14
+ ```text
15
+ skill core judgment
16
+ -> one observable unresolved subquestion
17
+ -> one named skill-method step to refine
18
+ -> policy route ID and co-required reference set
19
+ -> one inspectable artifact and stop condition
20
+ -> separation/handoff boundary
21
+ -> reference_basis evidence
22
+ ```
23
+
24
+ Every path listed by one selected route is equally required for that route.
25
+ Requiredness does not imply a global rank. Reading sequence is a separate,
26
+ route-local property: `read_order: listed` is used only when a later document
27
+ assumes the earlier document's method, vocabulary, or invariant; `any` is used
28
+ when no such dependency exists. A singleton set is valid. Several routes may be
29
+ selected when they answer distinct unresolved questions; the runtime checks the
30
+ union of their reference sets without imposing cross-route order.
31
+
32
+ ## Judgment Integration Rules
33
+
34
+ A reference is a conditional extension of a skill judgment, not a source summary
35
+ or topic shelf. Its operational body must be understandable without its source,
36
+ refine one declared method step, produce the route artifact, and stop at the same
37
+ skill boundary. Runtime `Source Trace` uses ordinary bibliographic book,
38
+ edition, chapter, and section citations. Exact URLs/anchors, reading sequence,
39
+ source-local examples, defects, and edition verification belong in source audits
40
+ unless they are the concept itself.
41
+
42
+ Every source-derived insight must serve one of five roles:
43
+
44
+ ```text
45
+ recognize a trigger
46
+ make a consequential distinction
47
+ constrain artifact derivation
48
+ supply a falsifier or stop
49
+ force a separation/handoff
50
+ ```
51
+
52
+ If it serves none, it does not belong in an active runtime reference. If it is
53
+ always required for the skill's judgment, move it into `SKILL.md`. If it changes
54
+ the core question, output, owner, or stop, separate it into another route or
55
+ skill rather than asking the model to synthesize unrelated material at runtime.
56
+
57
+ Create separate routes when triggers can be observed independently and resulting
58
+ artifacts answer different questions. Treat these as strong separation signals:
59
+
60
+ - different core question;
61
+ - independently observable trigger;
62
+ - independently useful output artifact;
63
+ - different falsifier or stop condition;
64
+ - different owner or downstream handoff;
65
+ - either judgment can complete without the other.
66
+
67
+ Two or more signals normally require separation. For example, composition,
68
+ generative recursion, and accumulator design share a broad recursion context but
69
+ have independent triggers, artifacts, correctness obligations, and stops; they
70
+ must not remain one OR-shaped route.
71
+
72
+ Put several references in one route when the claimed artifact cannot be derived
73
+ honestly from only one of them. Examples include:
74
+
75
+ - the base data recipe plus the recursive template catalog;
76
+ - the level-of-language method plus a representation-barrier construction;
77
+ - the modeling method plus a complete specialized calibration;
78
+ - an abstraction review field card plus the selected construction or repair
79
+ procedure.
80
+
81
+ Use `read_order: listed` only when reversing the order would make the later
82
+ reference incomplete or misleading—for example, a template catalog explicitly
83
+ extends the six-artifact data recipe. Use `read_order: any` when every member can
84
+ be understood independently even though all are needed for the final artifact.
85
+ This sequence decision must come from document assumptions, not prestige,
86
+ length, or book order.
87
+
88
+ Use one reference in a route when that document independently supplies the
89
+ needed method and stop check. Do not create hierarchy for hierarchy's sake. If
90
+ several references are interchangeable ways to satisfy one obligation, model an
91
+ explicit alternative selection mode in a future policy version rather than
92
+ mislabeling them co-required; the current corpus contains no such route.
93
+
94
+ Use no reference route when a skill has no packaged references. For a
95
+ reference-bearing skill, use the declared exemption only when no route trigger
96
+ applies and the required concrete evidence shows that the compact method is
97
+ sufficient.
98
+
99
+ Do not encode:
100
+
101
+ - book prestige or chapter order;
102
+ - a universal beginner-to-advanced progression;
103
+ - a broad reference that must always be read merely because another file links
104
+ to it;
105
+ - duplicate broad and narrow routes for the same unresolved question;
106
+ - optional reading disguised as a hard dependency.
107
+
108
+ ## `SKILL.md` Responsibility
109
+
110
+ `SKILL.md` remains the executive method, not merely a description or routing
111
+ table. It owns:
112
+
113
+ - Pi discovery metadata and capability boundary;
114
+ - the core question and accepted inputs;
115
+ - always-on method and invariants;
116
+ - inspectable output shape;
117
+ - completion, missing-evidence, and not-applicable behavior;
118
+ - what the skill must not absorb from neighboring capabilities.
119
+
120
+ `reference-policy.json` is the sole route-specific authority. It owns the
121
+ narrower question, trigger classification, skill-method integration point,
122
+ co-required reference set, application artifacts, stop, separation boundary, and
123
+ exemption evidence. `references/*.md` owns the deeper source-independent
124
+ derivation and bounded calibration. Repository-only source audits own source
125
+ sequence, comparison, defects, edition fidelity, and provenance history; they
126
+ are maintainer evidence and are excluded from the published package.
127
+
128
+ Keeping those roles separate avoids two failure modes: hiding trigger recognition
129
+ inside a long reference, and maintaining conflicting route tables in `SKILL.md`
130
+ and JSON.
131
+
132
+ ## Policy Schema
133
+
134
+ Each reference-bearing skill declares:
135
+
136
+ ```json
137
+ {
138
+ "version": 2,
139
+ "routes": [
140
+ {
141
+ "id": "stable-route-id",
142
+ "question": "One narrower judgment question",
143
+ "trigger": "Observable condition that makes the route relevant",
144
+ "method_step": "Exact skill judgment step this route refines",
145
+ "references": [
146
+ "references/one.md",
147
+ "references/two.md"
148
+ ],
149
+ "read_order": "listed",
150
+ "artifacts": [
151
+ "inspectable result proving the method was applied"
152
+ ],
153
+ "stop": "Observable condition that completes this route",
154
+ "separate_when": "Condition requiring another route or skill handoff"
155
+ }
156
+ ],
157
+ "exemption": {
158
+ "when": "Condition under which no route applies",
159
+ "evidence": [
160
+ "concrete fact required to justify that exemption"
161
+ ]
162
+ }
163
+ }
164
+ ```
165
+
166
+ Policy validation requires unique route IDs; non-empty questions, triggers,
167
+ method steps, artifacts, stops, and separation boundaries; direct skill-relative
168
+ reference paths; explicit `listed` or `any` order for every multi-reference
169
+ route; and coverage of every packaged reference owned by the skill. Singleton
170
+ routes default to `any`.
171
+
172
+ ## Runtime Contract
173
+
174
+ 1. `developer_route_question` loads and hashes the policy and exposes every
175
+ route's narrower question, trigger, method step, reference set, artifact,
176
+ stop, separation boundary, and exemption criteria.
177
+ 2. `developer_load_reference` receives `reference_route`, `path`, and observable
178
+ trigger evidence. The path must belong to that route.
179
+ 3. Loading any path selects that policy route. A `listed` route enforces its
180
+ declared sequence; an `any` route does not. Before judgment, every path in
181
+ every selected route must have loaded successfully. One load may satisfy
182
+ overlapping route sets. A shared path is loaded once; select another
183
+ overlapping route through one of its not-yet-loaded paths and provide one
184
+ `reference_basis` entry per distinct path.
185
+ 4. The branch records policy route IDs, path, content SHA-256, Source Trace, and
186
+ selection reason.
187
+ 5. A judgment must provide one `reference_basis` entry for every loaded path,
188
+ naming the trigger, applied rule, and resulting artifact.
189
+ 6. `reference_exemption` is valid only when no reference was loaded and no policy
190
+ trigger applies.
191
+
192
+ This runtime gate proves route selection, integration-point exposure, and
193
+ claimed application. It does not prove the synthesis is semantically good; live
194
+ evaluations still check route relevance, artifact quality, stop satisfaction,
195
+ separation behavior, and pass-but-wrong cases.
196
+
197
+ ## Package Coverage
198
+
199
+ | Skill | Policy routes | Shape |
200
+ | --- | --- | --- |
201
+ | `abstraction-review` | `candidate-contract-review`, `failed-candidate-check`, `candidate-calibration` | review, failure localization, or promise-based calibration; no shadow construction |
202
+ | `model` | `condition-space`, `contract-replacement`, `relational-constraints`, `temporal-behavior`, `proof-obligation`, `solver-result-boundary`, `logic-query-semantics`, `planning-model` | one model artifact per uncertainty and stop condition |
203
+ | `sketch` | `data-driven-design`, `data-shape-template`, `composition-by-wishes`, `earned-abstraction`, `generative-recursion`, `accumulator-invariant`, `design-levels`, `representation-barrier`, `closure-interface`, `process-resources`, `state-history-order`, `generic-dispatch`, `meaning-preserving-conversion`, `language-semantics`, `runtime-compilation`, `responsibility-collaboration`, `variation-role`, `type-transition`, `selection-creation` | one implementable design question per route, with route-local common kernels only where required |
204
+ | `signal` | `behavior-preserving-movement` | singleton |
205
+ | `schedule` | `structural-timing-tradeoff` | singleton |
206
+ | `naming-judgment` | `domain-sense-boundary` | singleton |
207
+ | `verify` | `claim-evidence-gap` | singleton |
208
+ | `specify` | none | no packaged reference |
209
+ | `visualize` | none | no packaged reference |
210
+ | `adversarial-eval` | none | no packaged reference |
211
+
212
+ The implementation execution profile under `extensions/references/` is selected
213
+ by `execution_profile`, not by skill reference routing, and remains a separate
214
+ contract.
215
+
216
+ ## Evaluation Contract
217
+
218
+ Deterministic checks validate policy shape, reference coverage, runtime route
219
+ membership, route-set completeness, provenance recording, and one-to-one loaded
220
+ path/basis coverage.
221
+
222
+ Live fixtures additionally declare expected policy route IDs and expected paths.
223
+ They must reject at least these pass-but-wrong shapes:
224
+
225
+ - reading a relevant path under an unrelated route;
226
+ - ignoring a selected route's evidence-backed listed read order;
227
+ - loading only part of a selected route set;
228
+ - loading all paths but omitting application evidence;
229
+ - producing the right final answer without refining the route's declared method
230
+ step or producing its derivation artifact;
231
+ - satisfying topic keywords while missing the route stop condition;
232
+ - absorbing work named by `separate_when` instead of handing it off;
233
+ - selecting every broad route and over-designing a local question;
234
+ - claiming exemption while an observable route trigger is present.
235
+
236
+ ## Source-Fidelity Gate
237
+
238
+ Original PDF or book review binds each derived rule to an exact edition, chapter
239
+ or section, and page range. Cross-source integration is a second gate: after
240
+ fidelity repair, reorganize insights by source-independent judgment role, record
241
+ moves and splits in an integration audit, and recheck that no source limitation
242
+ was erased. Historical post-repair hashes attest the audited snapshot; a later
243
+ integration audit must attest the current synthesized document set.