@thebassclef/lite 0.1.0 → 0.1.3

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 (163) hide show
  1. package/dist/cli.cjs +40 -6
  2. package/dist/cli.js +40 -6
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.js +1 -1
  6. package/package.json +1 -1
  7. package/substrate/.bassclef/lite-manifest.json +999 -92
  8. package/substrate/.claude/hooks/longrun-prep-compounding-axis-check.sh +492 -0
  9. package/substrate/.claude/hooks/longrun-prep-compounding-sequence-check.sh +492 -0
  10. package/substrate/.claude/hooks/pre-commit-gate.sh +1 -2
  11. package/substrate/.claude/hooks/turn-prose-kiss-check.sh +30 -1
  12. package/substrate/.claude/luminaries/glenford-myers.md +230 -0
  13. package/substrate/.claude/luminaries/hunt-thomas.md +115 -0
  14. package/substrate/.claude/luminaries/hyrum-wright.md +94 -0
  15. package/substrate/.claude/luminaries/michael-feathers.md +2 -2
  16. package/substrate/.claude/luminaries/tony-hoare.md +170 -0
  17. package/substrate/.claude/luminaries/vaughn-vernon.md +50 -0
  18. package/substrate/.claude/luminaries/w-edwards-deming.md +158 -0
  19. package/substrate/.claude/rules/accessor-library-discipline.md +138 -0
  20. package/substrate/.claude/rules/adr-discipline.md +120 -0
  21. package/substrate/.claude/rules/api-conventions.md +125 -0
  22. package/substrate/.claude/rules/bootstrap-pair-discipline.md +141 -0
  23. package/substrate/.claude/rules/cold-adopter-harness-discipline.md +129 -0
  24. package/substrate/.claude/rules/compounding-axis-fresh-analysis.md +188 -0
  25. package/substrate/.claude/rules/compounding-sequence-fresh-analysis.md +188 -0
  26. package/substrate/.claude/rules/defensive-bash.md +68 -0
  27. package/substrate/.claude/rules/deferred-actions.md +233 -0
  28. package/substrate/.claude/rules/github-issue-flash-tweet.md +156 -0
  29. package/substrate/.claude/rules/hook-wire-on-author.md +103 -0
  30. package/substrate/.claude/rules/iteration-bet-brief-completeness.md +54 -0
  31. package/substrate/.claude/rules/lite-manifest-schema-change-discipline.md +3 -3
  32. package/substrate/.claude/rules/longrun-prep-plan-doc-compression.md +89 -0
  33. package/substrate/.claude/rules/loop-discipline.md +81 -0
  34. package/substrate/.claude/rules/manual-prod-approval.md +100 -0
  35. package/substrate/.claude/rules/marker-enrichment-discipline.md +99 -0
  36. package/substrate/.claude/rules/mobile-ephemeral-session.md +109 -0
  37. package/substrate/.claude/rules/new-dependency-check.md +51 -0
  38. package/substrate/.claude/rules/option-label-discipline.md +108 -0
  39. package/substrate/.claude/rules/pattern-annotation.md +100 -0
  40. package/substrate/.claude/rules/plain-english-discipline.md +11 -9
  41. package/substrate/.claude/rules/plan-enumeration-needs-value-props.md +211 -0
  42. package/substrate/.claude/rules/pr-title-shape.md +161 -0
  43. package/substrate/.claude/rules/prototype-workflow.md +65 -0
  44. package/substrate/.claude/rules/reserved-skill-names.md +123 -0
  45. package/substrate/.claude/rules/schema-management.md +49 -0
  46. package/substrate/.claude/rules/security.md +37 -0
  47. package/substrate/.claude/rules/skill-composition-declarations.md +124 -0
  48. package/substrate/.claude/rules/skill-description-clarity.md +247 -0
  49. package/substrate/.claude/rules/skill-procedure-step-list.md +137 -0
  50. package/substrate/.claude/rules/stuck-signal-diagnostic.md +140 -0
  51. package/substrate/.claude/rules/substrate-config-schema.md +98 -0
  52. package/substrate/.claude/rules/test-list-discipline.md +175 -0
  53. package/substrate/.claude/rules/test-sufficiency.md +210 -0
  54. package/substrate/.claude/rules/testing-tier-config.md +145 -0
  55. package/substrate/.claude/rules/testing.md +38 -0
  56. package/substrate/.claude/rules/turn-estimate-grounding.md +134 -0
  57. package/substrate/.claude/rules/visual-hierarchy.md +437 -0
  58. package/substrate/.claude/rules/we-dont-break-adopters.md +126 -0
  59. package/substrate/.claude/rules/wu-sequencing-compounds.md +145 -0
  60. package/substrate/.claude/skills/build/SKILL.md +1 -1
  61. package/substrate/.claude/skills/chronicle/SKILL.md +55 -0
  62. package/substrate/.claude/skills/clean-artifacts/SKILL.md +249 -0
  63. package/substrate/.claude/skills/decompose/SKILL.md +1 -1
  64. package/substrate/.claude/skills/diagnose/SKILL.md +1 -1
  65. package/substrate/.claude/skills/feynman/SKILL.md +90 -0
  66. package/substrate/.claude/skills/howdoi/SKILL.md +1 -1
  67. package/substrate/.claude/skills/ia-model/SKILL.md +1 -1
  68. package/substrate/.claude/skills/interaction-design/SKILL.md +1 -1
  69. package/substrate/.claude/skills/interpret-input/SKILL.md +8 -8
  70. package/substrate/.claude/skills/journal/SKILL.md +209 -0
  71. package/substrate/.claude/skills/kiss/SKILL.md +1 -1
  72. package/substrate/.claude/skills/launch/SKILL.md +14 -23
  73. package/substrate/.claude/skills/lean-canvas/SKILL.md +1 -1
  74. package/substrate/.claude/skills/longrun/SKILL.md +45 -8
  75. package/substrate/.claude/skills/luminary/SKILL.md +1 -1
  76. package/substrate/.claude/skills/ogilvy-writing-audit/SKILL.md +1 -1
  77. package/substrate/.claude/skills/onboard-repo/SKILL.md +143 -709
  78. package/substrate/.claude/skills/pattern-review/SKILL.md +1 -1
  79. package/substrate/.claude/skills/personas/SKILL.md +5 -5
  80. package/substrate/.claude/skills/promote/SKILL.md +1 -1
  81. package/substrate/.claude/skills/requirement/SKILL.md +1 -1
  82. package/substrate/.claude/skills/retro/SKILL.md +1 -1
  83. package/substrate/.claude/skills/riff/SKILL.md +1 -1
  84. package/substrate/.claude/skills/roadmap-reconcile/SKILL.md +1 -1
  85. package/substrate/.claude/skills/session-end/SKILL.md +1 -1
  86. package/substrate/.claude/skills/session-log/SKILL.md +3 -3
  87. package/substrate/.claude/skills/skills/SKILL.md +1 -1
  88. package/substrate/.claude/skills/spec/SKILL.md +1 -1
  89. package/substrate/.claude/skills/sprint/SKILL.md +1 -1
  90. package/substrate/.claude/skills/stage/SKILL.md +1 -1
  91. package/substrate/.claude/skills/state-a-problem/SKILL.md +1 -1
  92. package/substrate/.claude/skills/temperance/SKILL.md +1 -1
  93. package/substrate/.claude/skills/use-case/SKILL.md +1 -1
  94. package/substrate/.claude/skills/user-stories/SKILL.md +1 -1
  95. package/substrate/.claude/skills/value-prop/SKILL.md +1 -1
  96. package/substrate/.claude/skills/verify/SKILL.md +1 -1
  97. package/substrate/.claude/skills/visual-review/SKILL.md +503 -0
  98. package/substrate/.claude/skills/whats-the-plan/SKILL.md +202 -0
  99. package/substrate/.claude/skills/whereami/SKILL.md +2 -2
  100. package/substrate/CONTRIBUTING.md +1 -1
  101. package/substrate/README.md +5 -5
  102. package/substrate/lib/prose-scan-boundary.sh +171 -0
  103. package/substrate/lib/tier-check.sh +50 -1
  104. package/substrate/lib/tier-dependency-audit.sh +159 -4
  105. package/substrate/presence/install/bassclef-sync.template.sh +1 -1
  106. package/substrate/scripts/generate-lite-manifest.sh +21 -5
  107. package/substrate/standards/adr-template.md +86 -0
  108. package/substrate/standards/api-conventions/nextjs.md +84 -0
  109. package/substrate/standards/artifact-composition.md +209 -0
  110. package/substrate/standards/bash-hook-safety.md +246 -0
  111. package/substrate/standards/branch-stacking.md +408 -0
  112. package/substrate/standards/code-safety-principles.md +176 -0
  113. package/substrate/standards/composer-prerequisites.md +155 -0
  114. package/substrate/standards/dependency-discipline/cargo.md +39 -0
  115. package/substrate/standards/dependency-discipline/gem.md +43 -0
  116. package/substrate/standards/dependency-discipline/go-mod.md +41 -0
  117. package/substrate/standards/dependency-discipline/npm.md +42 -0
  118. package/substrate/standards/dependency-discipline/pip.md +42 -0
  119. package/substrate/standards/deployment-topology/ec2-tailscale.md +225 -0
  120. package/substrate/standards/deployment-topology.md +69 -0
  121. package/substrate/standards/docs-sync-allowlist.md +4 -4
  122. package/substrate/standards/domain-and-dns.md +145 -0
  123. package/substrate/standards/frontend-stack.md +67 -0
  124. package/substrate/standards/frontmatter-schema.md +154 -0
  125. package/substrate/standards/hook-injection-discipline.md +202 -0
  126. package/substrate/standards/hook-install-class.md +215 -0
  127. package/substrate/standards/input-handler-interface.md +152 -0
  128. package/substrate/standards/lite-manifest-schema-changes.md +60 -0
  129. package/substrate/standards/luminary-matching.md +105 -0
  130. package/substrate/standards/migration-discipline/active-record.md +50 -0
  131. package/substrate/standards/migration-discipline/alembic.md +43 -0
  132. package/substrate/standards/migration-discipline/gorm.md +50 -0
  133. package/substrate/standards/migration-discipline/prisma.md +53 -0
  134. package/substrate/standards/migration-discipline/sqlalchemy.md +51 -0
  135. package/substrate/standards/mobile-ephemeral-session.md +167 -0
  136. package/substrate/standards/model-routing-discipline.md +160 -0
  137. package/substrate/standards/persona-schema.md +229 -0
  138. package/substrate/standards/pluggable-luminaries.md +323 -0
  139. package/substrate/standards/pr-body-discipline.md +115 -0
  140. package/substrate/standards/preview-state-schema.md +189 -0
  141. package/substrate/standards/reserved-skill-names.md +120 -0
  142. package/substrate/standards/scannable-multi-option-output.md +261 -0
  143. package/substrate/standards/sdlc-gates/typescript.md +57 -0
  144. package/substrate/standards/session-board.md +256 -0
  145. package/substrate/standards/state-spine-contract.md +255 -0
  146. package/substrate/standards/steering-hints/kiss-words.md +11 -0
  147. package/substrate/standards/substrate-config-schema.md +267 -0
  148. package/substrate/standards/tier-dependency-analysis.md +1 -1
  149. package/substrate/standards/tier-tag-schema.md +1 -1
  150. package/substrate/standards/two-layer-config.md +99 -0
  151. package/substrate/standards/use-case-format.md +292 -0
  152. package/substrate/standards/user-story-invest.md +268 -0
  153. package/substrate/standards/velocity-and-appetite.md +229 -0
  154. package/substrate/standards/voice-input-pattern.md +119 -0
  155. package/substrate/standards/worktree-management.md +211 -0
  156. package/substrate/templates/chronicle-template.md +75 -0
  157. package/substrate/templates/memory-proposal-template.md +77 -0
  158. package/substrate/templates/persona-template.md +200 -0
  159. package/substrate/templates/pr-faq.md +45 -0
  160. package/substrate/templates/secret-rotation-template.md +162 -0
  161. package/substrate/templates/spec-template.md +131 -0
  162. package/substrate/templates/use-case-template.md +194 -0
  163. package/substrate/templates/user-story-template.md +107 -0
@@ -0,0 +1,50 @@
1
+ ---
2
+ tier: lite
3
+ name: Vaughn Vernon
4
+ slug: vaughn-vernon
5
+ claimed_by: [architect]
6
+ referenced_by_skills: [decompose, architect-review]
7
+ primary_domain: architecture
8
+ depth: stub
9
+ description: "\"DDD is implementable. Here's how.\""
10
+ ---
11
+
12
+ # Vaughn Vernon
13
+
14
+ ## Signature
15
+
16
+ *"DDD is implementable. Here's how."*
17
+
18
+ Author of **Implementing Domain-Driven Design** (the "red book") and
19
+ **Domain-Driven Design Distilled**. The canonical operational voice for
20
+ DDD — where Evans provides the philosophy, Vernon provides the code.
21
+
22
+ ## Core methods
23
+
24
+ - **Bounded Context Canvas** — Structured workshop output that defines a
25
+ bounded context's purpose, strategic classification, domain roles,
26
+ ubiquitous language, and inbound/outbound communication.
27
+ - **Context mapping patterns** — Partnership, Shared Kernel,
28
+ Customer/Supplier, Conformist, Anticorruption Layer, Open Host Service,
29
+ Published Language, Separate Ways, Big Ball of Mud. Vocabulary for how
30
+ bounded contexts relate.
31
+ - **Aggregate design rules** — Small aggregates; reference other
32
+ aggregates by ID only; update one aggregate per transaction; use
33
+ eventual consistency between aggregates.
34
+ - **Event Storming (via Alberto Brandolini)** — Vernon popularized this
35
+ modeling method as the pragmatic entry point to DDD for teams new to it.
36
+
37
+ ## Sources
38
+
39
+ - *Implementing Domain-Driven Design* — Vernon, Addison-Wesley (2013)
40
+ - *Domain-Driven Design Distilled* — Vernon, Addison-Wesley (2016)
41
+ - *Strategic Monoliths and Microservices* — Vernon, Jaskuła (2021)
42
+ - kalele.io — Vernon's consultancy and ongoing DDD content
43
+
44
+ ## Related luminaries
45
+
46
+ - **Eric Evans** — Vernon operationalizes Evans; pair them always.
47
+ - **Alistair Cockburn** — Hexagonal Architecture pairs naturally with
48
+ bounded contexts; aggregates live inside hexagons.
49
+ - **Gregor Hohpe** — EIP's anticorruption-layer aligns with Vernon's
50
+ context mapping.
@@ -0,0 +1,158 @@
1
+ ---
2
+ tier: lite
3
+ name: W. Edwards Deming
4
+ slug: w-edwards-deming
5
+ claimed_by: [builder, architect, closer, shaper]
6
+ primary_domain: engineering
7
+ depth: full
8
+ description: "\"A bad system will beat a good person every time.\""
9
+ ---
10
+
11
+ # W. Edwards Deming
12
+
13
+ ## Signature
14
+
15
+ *"A bad system will beat a good person every time."*
16
+
17
+ W. Edwards Deming (1900–1993) was a statistician who taught Japanese
18
+ industry to read the system, not the person, when results disappoint.
19
+ His finding from decades of plant data: roughly **94% of variation in
20
+ outcomes traces to the system**, and roughly **6% traces to people**.
21
+ The implication was strict — every time results land badly and the
22
+ default reaction is "the person should have been more careful," the
23
+ default is wrong 94% of the time. Deming's full discipline ran from the
24
+ ground up: a cycle for improvement (**PDSA / PDCA**), a framing for
25
+ what management owed the system (**14 Points**), and a system view
26
+ called the **System of Profound Knowledge** that tied it all together.
27
+
28
+ ## Core methods
29
+
30
+ - **PDCA / PDSA cycle (Plan-Do-Check-Act, later Plan-Do-Study-Act)** —
31
+ the discipline of substrate improvement. Plan a change. Do it small
32
+ first. Study what actually happened. Act on the finding (standardize
33
+ or revise). Loop. Use when the change is non-trivial AND the team is
34
+ about to ship without a structured way to learn from the result.
35
+ - **14 Points for Management** — the duties of leadership in a system
36
+ that produces variation. Headline points: drive out fear; break down
37
+ barriers between departments; cease dependence on inspection (build
38
+ quality in); institute leadership; remove arbitrary numerical quotas.
39
+ Read the full 14 when shaping team structure or substrate-discipline
40
+ rules — many bassclef rules are 14-Points applied to agents.
41
+ - **System of Profound Knowledge** — four lenses applied together:
42
+ appreciation for a system (the whole, not the parts); theory of
43
+ variation (special vs common causes); theory of knowledge (no
44
+ knowledge without prediction); psychology (people respond to
45
+ systems). Use when the question is "what kind of fix is this" —
46
+ process-level, structural, learning, or human.
47
+ - **Common cause vs special cause** — variation has two flavors. Common
48
+ cause is built into the system (every run produces it). Special
49
+ cause is a specific event (a one-time trigger). The diagnosis path is
50
+ different for each. Use when picking remediation: common cause needs
51
+ a system change; special cause needs a single intervention.
52
+
53
+ ## When to channel this luminary
54
+
55
+ Channel Deming whenever the default explanation reaches for
56
+ operator-forgetfulness, agent-laziness, adopter-skill-gaps, or any
57
+ "person should have been more careful" framing. Deming forces the
58
+ question: is the system designed to make the right behavior easy? If
59
+ not, the system is the defect.
60
+
61
+ Also channel when shaping a hardening pass. The four lenses of the
62
+ System of Profound Knowledge are the architect-review lenses Deming
63
+ would apply in order. Specifically:
64
+
65
+ - Appreciation for a system → C4 Context + Container diagrams; see the
66
+ whole substrate before zooming into hooks
67
+ - Theory of variation → distinguish substrate-wide failure classes
68
+ (common cause) from one-off PR breakage (special cause)
69
+ - Theory of knowledge → every hardening proposal predicts an outcome;
70
+ no prediction means no learning when the result lands
71
+ - Psychology → adopters respond to substrate friction; reduce the
72
+ friction rather than asking adopters to push through it
73
+
74
+ ## Stack translation
75
+
76
+ Bassclef's hooks, rules, validators, and skills are the **system**
77
+ Deming describes. Operators and Claude Code agents are the **people**.
78
+ When a defect surfaces:
79
+
80
+ - If the same defect surfaces across three sessions, that is common
81
+ cause — patch the system (hook, validator, rule)
82
+ - If the defect is a one-time slip (a typo, a missed paste), that is
83
+ special cause — fix the instance; do not change the substrate
84
+ - If the defect surfaces because the discipline is methodology-only
85
+ (no mechanical gate), the system is the defect — escalate to hook
86
+
87
+ PDCA maps onto substrate evolution: a /promote ticket is the **Plan**.
88
+ Shipping the rule + hook is the **Do**. Watching for stuck-signal
89
+ diagnostics across the next month is the **Study**. Closing or revising
90
+ the rule based on usage data is the **Act**. Bassclef's
91
+ `stuck-signal-diagnostic.md` rule is Deming's Study phase made
92
+ mechanical.
93
+
94
+ ## Anti-patterns it prevents
95
+
96
+ - **Operator-forgetfulness framing** — When a SessionStart hook fires
97
+ on a missing field, the first instinct can be "the operator forgot
98
+ to add it." Deming asks: is the hook design such that the field is
99
+ obvious? Is the bootstrap row shipped with the validator? If the
100
+ answer to either is no, the system is the defect — not the operator.
101
+ - **Inspection-as-quality** — When a substrate gate fires repeatedly
102
+ and the answer is "more vigilance," that is inspection-instead-of-
103
+ quality-built-in. Deming Point #3: cease dependence on inspection.
104
+ Instead, build the validation INTO the surface that produces the
105
+ artifact (template that includes the required field; schema
106
+ validation at write time; pre-commit gate that emits the missing
107
+ row).
108
+ - **Quota-driven scope-cutting** — When a session's appetite framing
109
+ drives toward (a) narrow fix because (c) full audit feels too big,
110
+ Deming Point #11 fires: remove arbitrary numerical quotas. Appetite
111
+ is a budget for shape-picking, not a quota for cause-categorization.
112
+ Run fishbone first; THEN pick the scope that fits the cause.
113
+
114
+ ## Worked example
115
+
116
+ 2026-06-24 chronicle reads: "Operator-side rot has structural cause,
117
+ not operator forgetfulness." That single sentence is Deming applied.
118
+ The 51-hour-stale `~/.claude/hooks/bassclef-sync.sh` did not happen
119
+ because the operator forgot to update; it happened because the cp-list
120
+ in §3 of the sync script omitted the script itself — the hook could
121
+ not update itself. ADR-034 closed the gap with the two-stage rocket
122
+ pattern — a SYSTEM change, not a person change.
123
+
124
+ The four 2026-06-24 substrate defects all share the same Deming class:
125
+
126
+ | Defect | System fix shipped | If Deming had been ignored |
127
+ |---|---|---|
128
+ | Operator-side rot | ADR-034 two-stage bootstrap | Tell operator to remember to sync |
129
+ | 32 unwired hooks | #319 + #320 audit | Tell agent to remember to wire |
130
+ | /kiss skip on PRs | bassclef#915 → hook | Tell agent to remember /kiss |
131
+ | Public-scripts origin | #320 audit + WU-2 C4 Container | Tell operator to remember |
132
+
133
+ The right-column reactions are the 6% framing. The left-column fixes
134
+ are the 94% framing. Bassclef ships the 94% reactions by default; this
135
+ luminary names the discipline.
136
+
137
+ ## Sources
138
+
139
+ - *Out of the Crisis* — Deming (1986)
140
+ - *The New Economics for Industry, Government, Education* — Deming (1993)
141
+ - *Statistical Quality Control* — Deming (1939)
142
+
143
+ ## Related luminaries
144
+
145
+ - **Walter Shewhart** — Deming's mentor; originator of PDCA (then
146
+ PDSA). Bassclef does not yet ship a Shewhart entry; the discipline
147
+ comes through Deming.
148
+ - **Kaoru Ishikawa** — fishbone categorizes; PDCA improves. Use
149
+ Ishikawa to see the categories; use Deming to run the improvement
150
+ cycle.
151
+ - **Taiichi Ohno** — Five Whys traces one chain; Deming asks whether
152
+ the chain is common-cause or special-cause variation.
153
+ - **Linus Torvalds** — "we do not break userspace" is Deming Point #1
154
+ (constancy of purpose) applied to kernel stability. Bassclef's
155
+ adopter-respect rule is the same shape.
156
+ - **John Ousterhout** — deep modules hide complexity; Deming would
157
+ call this designing the system so the surface is easy to use
158
+ correctly.
@@ -0,0 +1,138 @@
1
+ ---
2
+ tier: lite
3
+ description: State spine consumers (skills, hooks, rules, scripts) MUST go through the typed accessor library lib/state.sh to read or write bassclef state.
4
+ ---
5
+
6
+ # Accessor Library Discipline
7
+
8
+ State spine consumers (skills, hooks, rules, scripts) MUST go through
9
+ the typed accessor library `lib/state.sh` to read or write bassclef
10
+ state. Direct filesystem access (cat, jq, awk, grep over JSON state
11
+ files) is forbidden when an accessor exists.
12
+
13
+ This rule is the Adapter discipline that preserves cxdb portability —
14
+ exit criterion 1 of the 7 in canvas v4 §"Adapter discipline":
15
+
16
+ > **Accessor library is the ONLY consumer of cxdb APIs.** No skill,
17
+ > hook, rule, or script invokes cxdb directly. All access goes through
18
+ > `lib/state.sh`.
19
+
20
+ Same principle applied at v0 (where the storage backend IS the
21
+ filesystem): no consumer reaches around the accessor to the raw files.
22
+
23
+ ## Why this rule exists
24
+
25
+ When cxdb adoption ships (bassclef#300), the implementation of
26
+ `lib/state.sh` swaps from JSON-on-git to cxdb's Turn DAG + Blob CAS.
27
+ **This swap is invisible to consumers IF and ONLY IF every consumer
28
+ goes through the accessor.** Any consumer that reads
29
+ `docs/whereami.json` directly today will need editing tomorrow.
30
+
31
+ Beyond cxdb portability, this rule also enforces:
32
+
33
+ - **Replay-determinism** — accessors carry the "derive from history,
34
+ never cache" rule per canvas v4 SWF mining. Bypassing the accessor
35
+ bypasses the discipline (this is what produced bassclef#296
36
+ compliance-counter floor-lift).
37
+ - **Schema validation** — accessors that mutate (add/set/update_status)
38
+ invoke the validator before writing. Direct file writes skip this
39
+ gate.
40
+ - **Single-source consistency** — if Whereami's storage shape changes
41
+ (e.g., schema field rename), only `lib/state.sh` needs updating.
42
+
43
+ ## What this rule forbids
44
+
45
+ In any skill, hook, rule, or script:
46
+
47
+ - `cat docs/whereami.json` → use `state_whereami_get`
48
+ - `jq '.field' docs/whereami.json` → use `state_whereami_get | jq '.field'`
49
+ - `find state/markers -name '*.json' | wc -l` → use `state_marker_count`
50
+ - `awk '/gates_fired:/' chronicle/*.md` → use `state_chronicle_gate_evidence`
51
+ - `ls docs/deferred-actions/*.md | grep -v completed` → use `state_deferred_action_pending`
52
+ - `cat docs/iteration-bets/<slug>.md | yq frontmatter` → use `state_iteration_bet_get`
53
+
54
+ In general: any pattern that reaches into a state file (JSON or
55
+ markdown frontmatter) is the violation. Read the contract at
56
+ `standards/state-spine-contract.md` for the bassclef accessor surface.
57
+
58
+ ## What this rule allows
59
+
60
+ - **Reading the accessor library itself** — `source lib/state.sh` and
61
+ call its functions. That's the entire point.
62
+ - **Reading non-state markdown content** — body sections of Shape B
63
+ entities (the narrative parts, not the YAML frontmatter) can be
64
+ read directly. Example: `awk '/## Procedure/,/^## /' docs/iteration-bets/<slug>.md`
65
+ to extract the Procedure section is fine; that's narrative content,
66
+ not state.
67
+ - **Reading non-spine files** — `cat .claude/skills/<skill>/SKILL.md`,
68
+ `cat README.md`, etc. State spine entities are enumerated in
69
+ `standards/state-spine.md`; other files aren't governed.
70
+ - **Direct JSON writes during one-shot migrations** (e.g., WU-4
71
+ migration script). Migration scripts are explicitly out-of-band —
72
+ they bootstrap state into the spine from prior shapes.
73
+
74
+ ## What about new accessors that don't exist yet?
75
+
76
+ If a consumer needs an accessor not yet in `lib/state.sh`:
77
+
78
+ 1. **Check if a generic verb suffices** — `state_<entity>_get`,
79
+ `state_<entity>_list`, `state_<entity>_count` cover most reads.
80
+ 2. **If a special-purpose accessor is needed**, propose it to the
81
+ contract first (`standards/state-spine-contract.md` §"Special-purpose
82
+ accessors"), then implement in `lib/state.sh`, then consume.
83
+ 3. **Do NOT bypass with direct file access** "just for now." That's
84
+ the path that produced bassclef#296.
85
+
86
+ The cost of adding a new accessor is small (~5-10 lines + tests). The
87
+ cost of accumulating ad-hoc bypass patterns is large and compounds
88
+ (every consumer needs a fix when the storage backend changes).
89
+
90
+ ## Enforcement
91
+
92
+ ### Methodology level
93
+
94
+ This rule loads into every session via `additionalDirectories`. Agents
95
+ self-check against it before reading or writing state. Code review
96
+ flags any direct state-file access in PRs.
97
+
98
+ ### Mechanical level (paired with WU-3)
99
+
100
+ The `state-validate.sh` PreToolUse hook (WU-3) detects direct writes
101
+ to state files and BLOCKs unless the change is going through an
102
+ accessor. Read-side enforcement is harder to mechanize but the
103
+ write-side gate covers the most damaging case.
104
+
105
+ ### Future mechanical level (post-v0)
106
+
107
+ A pre-commit hook could grep for forbidden patterns (`cat docs/whereami.json`,
108
+ `jq.*docs/whereami.json`, etc.) in staged changes and BLOCK unless an
109
+ override comment is present. Defer to v1 once empirical violation rate
110
+ is observable.
111
+
112
+ ## Override
113
+
114
+ `SKIP_ACCESSOR_DISCIPLINE=1 <command>` — logged to trace per existing
115
+ bassclef hook idiom. Use only for genuinely-not-yet-covered cases
116
+ where adding the accessor is in flight; not as a habitual workaround.
117
+
118
+ ## Relationship to other rules + standards
119
+
120
+ - `standards/state-spine.md` — entity catalog + storage shapes
121
+ - `standards/state-spine-contract.md` — the accessor surface this rule
122
+ enforces consumption through
123
+ - `lib/state.sh` — the implementation
124
+ - `.claude/rules/state-schema-validation.md` (paired with WU-3) —
125
+ write-time validation; the accessor's `add`/`set`/`update_status`
126
+ methods invoke this validator before writing
127
+ - canvas v4 §"Adapter discipline" — the source of this discipline; one
128
+ of 7 exit criteria for cxdb portability
129
+ - bassclef#296 — the compliance-counter floor-lift incident that
130
+ motivates pure-derivation discipline (this rule + replay-determinism)
131
+
132
+ ## Retirement condition
133
+
134
+ This rule retires only if the accessor library itself retires (very
135
+ unlikely — the library is the substrate primitive other state work
136
+ builds on). If a future architectural shift moves accessors elsewhere
137
+ (e.g., into per-entity files like `lib/state/whereami.sh`), this rule
138
+ amends to point at the new location; the discipline persists.
@@ -0,0 +1,120 @@
1
+ ---
2
+ tier: lite
3
+ description: "Every load-bearing architectural decision MUST be recorded as an ADR (Architecture Decision Record) per Michael Nygard's lifecycle: proposed → accepted → deprecated → superseded."
4
+ ---
5
+
6
+ # ADR Discipline
7
+
8
+ Every load-bearing architectural decision MUST be recorded as an ADR (Architecture Decision Record) per Michael Nygard's lifecycle: `proposed` → `accepted` → `deprecated` → `superseded`.
9
+
10
+ ADR discipline lives at the rule layer (this file) plus the mechanical layer (`.claude/hooks/adr-discipline-check.sh` — PreToolUse hook on architectural-decision paths). Both load-bearing for adopter architecture quality.
11
+
12
+ ## Why this rule exists
13
+
14
+ ADR discipline previously lived only in the Architect agent persona. Sequential-mode adopter sessions skip Architect role entirely; architectural decisions ship without records.
15
+
16
+ INSTEAD: this rule mechanizes ADR discipline at the decision boundary via PreToolUse hook. The hook fires regardless of which agent role is active.
17
+
18
+ Eugene-supplements `apps/web` made 4+ architectural decisions (Postgres over SQLite, Server Actions over Express, Prisma over Drizzle, single-app over monorepo) with zero ADRs. The cost compounds: future maintainers can't reconstruct why; future architectural decisions can't be measured against the original rationale; deprecation requires re-deriving the decision context months later.
19
+
20
+ ## When this rule fires
21
+
22
+ Any session writing or editing a file matching architectural-decision shape:
23
+
24
+ - `prisma/schema.prisma` or per-ORM schema equivalent (schema-change)
25
+ - `docker-compose*.yml` or `docker-compose*.yaml` (deployment-topology-change)
26
+ - `src/middleware.ts` or per-stack middleware equivalent (middleware-change)
27
+ - `*/alembic/versions/*.py` / `*/db/migrate/*.rb` / `*/migrations/*.go` (schema-migration)
28
+ - `package.json` / `pyproject.toml` / `Gemfile` / `go.mod` / `Cargo.toml` on Write only (dependency-manifest-change)
29
+
30
+ When match fires, the hook checks for an ADR marker at `state/markers/adr/<decision-slug>-*.md`. The marker is required — generic ADRs in `docs/adrs/` or `architecture/decisions/` are not sufficient because they may be unrelated to the current decision class. When the marker is absent, the hook BLOCKs with template + writeup prompt.
31
+
32
+ ## Load-bearing definition
33
+
34
+ A decision is load-bearing when:
35
+
36
+ - It establishes an invariant future decisions must respect
37
+ - Reversing it would require substantial migration work (>1 day operator time)
38
+ - Multiple parts of the codebase depend on it
39
+ - It crosses a bounded context boundary (per Evans DDD)
40
+ - It changes a cross-cutting concern (auth, logging, multi-tenancy, observability stack)
41
+
42
+ Non-load-bearing (skip ADR):
43
+
44
+ - Bug fixes within existing patterns
45
+ - Component-level library choices (icon library, date-picker)
46
+ - Cosmetic refactors (renames, file reorganizations without behavior change)
47
+ - Test additions
48
+ - Documentation edits
49
+
50
+ When in doubt, write the ADR. Ten-minute cost; high-value record.
51
+
52
+ ## ADR format
53
+
54
+ Use `standards/adr-template.md`. Required sections:
55
+
56
+ - Frontmatter: id, title, status, date, supersedes, superseded_by
57
+ - Context — what motivated the decision
58
+ - Decision — the choice + rationale
59
+ - Status — proposed / accepted / deprecated / superseded
60
+ - Consequences — what becomes easier / harder / enables / blocks
61
+ - References — related ADRs, external sources, source incidents
62
+
63
+ ## Marker convention
64
+
65
+ After writing the ADR, touch the marker:
66
+
67
+ ```bash
68
+ mkdir -p state/markers/adr
69
+ touch state/markers/adr/<decision-slug>-ADR-NNN.md
70
+ ```
71
+
72
+ The marker is the audit trail: the hook reads it; reviewers can grep for it; chronicle Gate Evidence sections can cite it.
73
+
74
+ ## Override path
75
+
76
+ `SKIP_ADR_CHECK=1 <command>` — logged via trace-helper. Use rarely:
77
+
78
+ - Trivial revert of a previously-decided architectural change (the revert is reversing the prior decision per its `superseded_by` field)
79
+ - Emergency rescue when the hook itself misclassifies (file substrate-defect)
80
+ - One-shot migration script that touches many architectural files (operator has reviewed externally)
81
+ - Bulk dependency-manifest regen where every dep was already declared in a prior ADR
82
+
83
+ INSTEAD of overriding for routine work: write the ADR. The ten-minute cost is one of the cheapest substrate disciplines to follow.
84
+
85
+ ## Tech-stack-aware composition
86
+
87
+ ADR discipline is stack-agnostic. The same template applies across stacks. Per-stack ADR examples may ship as siblings under `standards/adr-examples/<stack>.md` over time, with the discipline itself staying the same across stacks.
88
+
89
+ ## What the rule does NOT cover
90
+
91
+ - ADR review process (operator + Architect agent collaboration)
92
+ - ADR retirement (status change to `deprecated` or `superseded`; the file stays in place)
93
+ - Cross-project ADR sharing (bassclef's ADRs and adopter's ADRs stay in separate directories)
94
+ - ADR templates for non-software architecture (deployment-process ADRs, team-structure ADRs — out of scope for this rule)
95
+
96
+ INSTEAD: each of the above lives in a sibling rule or template if it becomes relevant.
97
+
98
+ ## Composition with other rules
99
+
100
+ - `.claude/rules/testing-tier-config.md` — Tier 0 strict-TDD on hook + tests (this hook + its test file land Tier 0)
101
+ - `.claude/rules/blocked-items.md` — BLOCK protocol the hook fires
102
+ - `.claude/rules/oo-ad-entry-point.md` — `/decompose` evidence is sister discipline at Construction boundary
103
+ - `.claude/rules/schema-management.md` — schema-change ADR aligns with migration-discipline
104
+ - `standards/adr-template.md` — the template the rule references
105
+
106
+ ## Refs
107
+
108
+ - bassclef#1149 — this rule's filing ticket (T17 of cold-adopter promote drop)
109
+ - bassclef#1134 — ARCH-T1 grandparent (adopter inheritance umbrella)
110
+ - bet 2026-06-20e — WU-11 ships this rule + template + hook
111
+ - `.claude/hooks/adr-discipline-check.sh` — the mechanical implementation
112
+ - `.claude/hooks/tests/adr-discipline-check.test.sh` — Tier 0 test coverage
113
+ - `standards/adr-template.md` — the ADR template
114
+ - `@luminary michael-nygard` — anchor for ADR lifecycle (Cognitect, 2011)
115
+
116
+ ## Retirement condition
117
+
118
+ This rule retires only if ADRs themselves cease to be a bassclef architecture-record format. The mechanical layer (hook) may evolve to detect more decision shapes; the methodology of recording load-bearing decisions persists.
119
+
120
+ Closes adopter architecture-record gap surfaced by Eugene-supplements 2026-06.
@@ -0,0 +1,125 @@
1
+ ---
2
+ tier: lite
3
+ description: Universal API design principles — REST conventions, response shapes, status codes, auth, validation. Stack-specific globs + helpers live in per-stack siblings under standards/api-conventions/.
4
+ ---
5
+
6
+ # API Conventions
7
+
8
+ Universal API design principles for any HTTP API surface. Stack-specific instantiations (Next.js App Router, FastAPI, Rails, Express, Go) live in per-stack siblings under `standards/api-conventions/`. The loader (future ticket) reads adopter's `tech_stack.frontend` + `tech_stack.backend` from `.claude/bassclef-configs.jsonc` and loads the matching sibling.
9
+
10
+ When no sibling exists for the adopter's stack, the universal principles below still apply.
11
+
12
+ ## Universal principles
13
+
14
+ These hold regardless of stack.
15
+
16
+ ### Route naming
17
+
18
+ - RESTful: `/api/[resource]` for collections, `/api/[resource]/[id]` for items
19
+ - Nested resources: `/api/[parent]/[parentId]/[child]`
20
+ - Actions (non-CRUD): `/api/[resource]/[id]/[action]` (e.g., `/api/deals/123/archive`)
21
+ - Lowercase, hyphenated: `/api/deal-pipeline`, not `/api/dealPipeline`
22
+
23
+ ### Response shapes
24
+
25
+ Standard wrapper for successful single-item responses:
26
+
27
+ ```json
28
+ {
29
+ "data": { ... },
30
+ "meta": { "timestamp": "2026-04-05T10:00:00Z" }
31
+ }
32
+ ```
33
+
34
+ Standard wrapper for successful collection responses:
35
+
36
+ ```json
37
+ {
38
+ "data": [ ... ],
39
+ "meta": {
40
+ "total": 42,
41
+ "page": 1,
42
+ "pageSize": 20,
43
+ "timestamp": "2026-04-05T10:00:00Z"
44
+ }
45
+ }
46
+ ```
47
+
48
+ Standard error shape:
49
+
50
+ ```json
51
+ {
52
+ "error": {
53
+ "code": "VALIDATION_ERROR",
54
+ "message": "Human-readable description",
55
+ "details": [ ... ]
56
+ }
57
+ }
58
+ ```
59
+
60
+ ### HTTP status codes
61
+
62
+ | Code | When |
63
+ |------|------|
64
+ | 200 | Success (GET, PUT, PATCH) |
65
+ | 201 | Created (POST) |
66
+ | 204 | No content (DELETE) |
67
+ | 400 | Validation error, bad input |
68
+ | 401 | Not authenticated |
69
+ | 403 | Authenticated but not authorized |
70
+ | 404 | Resource not found |
71
+ | 409 | Conflict (duplicate, stale update) |
72
+ | 500 | Unexpected server error |
73
+
74
+ ### Pagination
75
+
76
+ Default: cursor-based for lists > 20 items. Offset-based acceptable for admin/internal endpoints.
77
+
78
+ ```
79
+ GET /api/deals?cursor=abc123&pageSize=20
80
+ → { data: [...], meta: { nextCursor: "def456", hasMore: true } }
81
+ ```
82
+
83
+ ### Auth
84
+
85
+ - Every route that modifies data requires auth — no exceptions
86
+ - Read routes may be public if explicitly marked (e.g., `// PUBLIC: [reason]` comment)
87
+ - Auth check happens at the route boundary, not inside handlers
88
+ - Tenant context resolved at the route boundary, passed through to queries
89
+
90
+ ### Validation
91
+
92
+ - Validate all input at the route handler boundary
93
+ - Use a schema-validation library (Zod, Pydantic, JSON Schema, etc.) for request body validation
94
+ - Never trust client-provided IDs for authorization decisions
95
+ - Use parameterized queries to prevent injection (every ORM has its own mechanism)
96
+
97
+ ## Per-stack siblings
98
+
99
+ Per ARCH-T0 #1133 Path A — stack-specific instantiations live in their own files. Loader reads adopter's `tech_stack` from `.claude/bassclef-configs.jsonc`.
100
+
101
+ | Adopter's `tech_stack.frontend` | Sibling loaded |
102
+ |---|---|
103
+ | `nextjs` | `standards/api-conventions/nextjs.md` |
104
+ | `fastapi` | `standards/api-conventions/fastapi.md` *(future — file `/promote` to author)* |
105
+ | `rails` | `standards/api-conventions/rails.md` *(future)* |
106
+ | `express` | `standards/api-conventions/express.md` *(future)* |
107
+ | `none` or unset | universal principles only |
108
+
109
+ When the matching sibling does not exist, the universal principles above apply; sibling-specific guidance is skipped until the operator declares the stack and a sibling ships.
110
+
111
+ ## Path A treatment
112
+
113
+ This rule shipped under ARCH-T0 #1133 Path A — additive, no content removed. Existing Next.js App Router specifics (formerly in this file) moved to `standards/api-conventions/nextjs.md`. Adopters following the rule pre-split keep working: the universal principles match what was already documented; the Next.js specifics are still discoverable via the sibling.
114
+
115
+ Loader infrastructure that reads sibling per `tech_stack` is a future ticket. Until it ships, the cross-reference table above is the discovery path.
116
+
117
+ ## Refs
118
+
119
+ - ARCH-T0 #1133 — operator-stack-leakage audit + remediation (parent)
120
+ - ARCH-T1 #1134 — Bassclef-as-Platform full adopter inheritance (grandparent)
121
+ - bassclef#1309 — this sub-ticket (api-conventions Path A)
122
+ - bassclef#1150 T18 — sister Path A (migration-discipline)
123
+ - `.claude/rules/schema-management.md` — precedent rule for Path A additive shape
124
+ - `.claude/rules/new-dependency-check.md` — sister precedent
125
+ - `standards/api-conventions/nextjs.md` — Next.js App Router sibling