@thebassclef/lite 1.1.0 → 1.2.0-alpha.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.
Files changed (135) hide show
  1. package/dist/cli.cjs +258 -63
  2. package/dist/cli.js +258 -63
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.js +1 -1
  6. package/dist/lite/.claude/bassclef-configs.jsonc +56 -0
  7. package/dist/lite/.claude/bassclef-orientation.md +120 -0
  8. package/dist/lite/.claude/hooks/adr-discipline-check.sh +132 -0
  9. package/dist/lite/.claude/hooks/atomic-pr-check.sh +169 -0
  10. package/dist/lite/.claude/hooks/auto-save-idle.sh +51 -0
  11. package/dist/lite/.claude/hooks/bassclef-sync.sh +51 -13
  12. package/dist/lite/.claude/hooks/bet-doc-gate.sh +283 -0
  13. package/dist/lite/.claude/hooks/bug-diagnosis.sh +64 -0
  14. package/dist/lite/.claude/hooks/destructive-command-guard.sh +136 -0
  15. package/dist/lite/.claude/hooks/file-rename-discipline-check.sh +147 -0
  16. package/dist/lite/.claude/hooks/hook-classifier-canary.sh +158 -0
  17. package/dist/lite/.claude/hooks/kiss-default-check.sh +129 -0
  18. package/dist/lite/.claude/hooks/multi-tenancy-check.sh +83 -0
  19. package/dist/lite/.claude/hooks/oo-ad-entry-point-check.sh +216 -0
  20. package/dist/lite/.claude/hooks/operator-private-path-check.sh +203 -0
  21. package/dist/lite/.claude/hooks/pattern-annotation-validate.sh +142 -0
  22. package/dist/lite/.claude/hooks/plain-english-steering.sh +15 -1
  23. package/dist/lite/.claude/hooks/post-write-trace.sh +66 -0
  24. package/dist/lite/.claude/hooks/pr-body-scrub-check.sh +446 -0
  25. package/dist/lite/.claude/hooks/pre-commit-identifier-leak-scrub.sh +137 -0
  26. package/dist/lite/.claude/hooks/pre-gh-pr-body-scrub.sh +192 -0
  27. package/dist/lite/.claude/hooks/pre-gh-pr-title-scrub.sh +172 -0
  28. package/dist/lite/.claude/hooks/role-entry-gate.sh +115 -0
  29. package/dist/lite/.claude/hooks/save-state.sh +268 -0
  30. package/dist/lite/.claude/hooks/session-reflection.d/08-settings-drift.sh +8 -1
  31. package/dist/lite/.claude/hooks/session-reflection.d/10-abrupt-stop-recovery.sh +52 -0
  32. package/dist/lite/.claude/hooks/session-reflection.d/55-orientation-gate.sh +40 -4
  33. package/dist/lite/.claude/hooks/session-reflection.d/80-hook-heartbeat-check.sh +12 -5
  34. package/dist/lite/.claude/hooks/session-reflection.d/81-hook-manifest-staleness.sh +18 -2
  35. package/dist/lite/.claude/hooks/session-reflection.d/91-npm-version-drift.sh +54 -0
  36. package/dist/lite/.claude/hooks/session-reflection.d/tests/10-abrupt-stop-recovery.test.sh +95 -0
  37. package/dist/lite/.claude/hooks/session-reflection.sh +62 -15
  38. package/dist/lite/.claude/hooks/tool-failure-diagnosis.sh +50 -0
  39. package/dist/lite/.claude/luminaries/andrej-karpathy.md +165 -0
  40. package/dist/lite/.claude/luminaries/dave-gray.md +155 -0
  41. package/dist/lite/.claude/luminaries/gary-klein.md +166 -0
  42. package/dist/lite/.claude/luminaries/kaoru-ishikawa.md +162 -0
  43. package/dist/lite/.claude/luminaries/lean-product-canvas.md +33 -0
  44. package/dist/lite/.claude/luminaries/luke-wroblewski.md +224 -0
  45. package/dist/lite/.claude/luminaries/ryan-singer.md +113 -0
  46. package/dist/lite/.claude/luminaries/steve-krug.md +168 -0
  47. package/dist/lite/.claude/luminaries/tony-ulwick.md +134 -0
  48. package/dist/lite/.claude/rules/arc-level-orientation-before-leaf.md +60 -0
  49. package/dist/lite/.claude/rules/architect-review-discipline.md +71 -0
  50. package/dist/lite/.claude/rules/auto-fix-criteria.md +126 -0
  51. package/dist/lite/.claude/rules/bassclef-hook-drift-blocker.md +144 -0
  52. package/dist/lite/.claude/rules/bassclef-models-discovery.md +107 -0
  53. package/dist/lite/.claude/rules/bassclef-workflow-parity.md +104 -0
  54. package/dist/lite/.claude/rules/cost-governance.md +154 -0
  55. package/dist/lite/.claude/rules/file-rename-discipline.md +95 -0
  56. package/dist/lite/.claude/rules/mechanism-fidelity.md +88 -0
  57. package/dist/lite/.claude/rules/prototype-production-coupling.md +125 -0
  58. package/dist/lite/.claude/rules/quick-fix-criteria.md +90 -0
  59. package/dist/lite/.claude/rules/session-artifacts.md +30 -0
  60. package/dist/lite/.claude/rules/sibling-smoke-after-substrate-change.md +107 -0
  61. package/dist/lite/.claude/rules/substrate-as-system.md +67 -0
  62. package/dist/lite/.claude/rules/usability.md +22 -0
  63. package/dist/lite/.claude/settings.json +20 -0
  64. package/dist/lite/.claude/skills/agent-research-spawn/SKILL.md +100 -0
  65. package/dist/lite/.claude/skills/architect-review/SKILL.md +201 -0
  66. package/dist/lite/.claude/skills/auto-fix/SKILL.md +297 -0
  67. package/dist/lite/.claude/skills/autonomous/SKILL.md +300 -0
  68. package/dist/lite/.claude/skills/bind-subdomain/SKILL.md +232 -0
  69. package/dist/lite/.claude/skills/canvas/SKILL.md +41 -0
  70. package/dist/lite/.claude/skills/deploy-prod/SKILL.md +106 -0
  71. package/dist/lite/.claude/skills/docs-sync/SKILL.md +188 -0
  72. package/dist/lite/.claude/skills/eisenhower/SKILL.md +273 -0
  73. package/dist/lite/.claude/skills/empathy-map/SKILL.md +168 -0
  74. package/dist/lite/.claude/skills/frontend-design/SKILL.md +53 -0
  75. package/dist/lite/.claude/skills/interview-me/SKILL.md +171 -0
  76. package/dist/lite/.claude/skills/journal-export/SKILL.md +293 -0
  77. package/dist/lite/.claude/skills/jtbd-tasks/SKILL.md +203 -0
  78. package/dist/lite/.claude/skills/objectory-decompose/SKILL.md +256 -0
  79. package/dist/lite/.claude/skills/pick-luminaries/SKILL.md +100 -0
  80. package/dist/lite/.claude/skills/pre-mortem/SKILL.md +180 -0
  81. package/dist/lite/.claude/skills/prototype-gallery/SKILL.md +264 -0
  82. package/dist/lite/.claude/skills/provision-deploy-host/SKILL.md +257 -0
  83. package/dist/lite/.claude/skills/quick-fix/SKILL.md +273 -0
  84. package/dist/lite/.claude/skills/release/SKILL.md +311 -0
  85. package/dist/lite/.claude/skills/release-notes/SKILL.md +202 -0
  86. package/dist/lite/.claude/skills/rfc/SKILL.md +222 -0
  87. package/dist/lite/.claude/skills/riff-prototypes/SKILL.md +637 -0
  88. package/dist/lite/.claude/skills/secrets-bootstrap/SKILL.md +209 -0
  89. package/dist/lite/.claude/skills/skill/SKILL.md +304 -0
  90. package/dist/lite/.claude/skills/smoke-test/SKILL.md +100 -0
  91. package/dist/lite/.claude/skills/state/SKILL.md +204 -0
  92. package/dist/lite/.claude/skills/substrate-check/SKILL.md +218 -0
  93. package/dist/lite/.claude/skills/synthetic-user/SKILL.md +381 -0
  94. package/dist/lite/.claude/skills/task-scenarios/SKILL.md +105 -0
  95. package/dist/lite/.claude/skills/tier-dependency-audit/SKILL.md +139 -0
  96. package/dist/lite/.claude/skills/ux-migration/SKILL.md +424 -0
  97. package/dist/lite/.claude/skills/value-prop-canvas/SKILL.md +297 -0
  98. package/dist/lite/README.md +5 -1
  99. package/dist/lite/gitignore +6 -0
  100. package/dist/lite/lib/bassclef-dir-resolver.sh +85 -0
  101. package/dist/lite/lib/clone-failure-classifier.sh +59 -0
  102. package/dist/lite/lib/fixture-builder.sh +190 -0
  103. package/dist/lite/lib/fresh-install-check.sh +49 -0
  104. package/dist/lite/lib/hook-heartbeat.sh +0 -1
  105. package/dist/lite/lib/mechanism-fidelity.sh +569 -0
  106. package/dist/lite/lib/npm-version-check.sh +112 -0
  107. package/dist/lite/lib/preview-state.sh +229 -0
  108. package/dist/lite/lib/session-rescue.sh +0 -1
  109. package/dist/lite/scripts/generate-lite-manifest.sh +145 -4
  110. package/dist/lite/scripts/lite-manifest-drift-check.sh +5 -1
  111. package/dist/lite/standards/architect-review-discipline.md +222 -0
  112. package/dist/lite/standards/bassclef-platform.md +249 -0
  113. package/dist/lite/standards/bassclef-test-repos.md +97 -0
  114. package/dist/lite/standards/bassclef-wiring-manifest.json +25 -1
  115. package/dist/lite/standards/cold-adopter-harness.md +205 -0
  116. package/dist/lite/standards/data-management.md +135 -0
  117. package/dist/lite/standards/frontend-stack/nextjs-prisma.md +124 -0
  118. package/dist/lite/standards/lite-manifest-schema-changes.md +27 -0
  119. package/dist/lite/standards/lite-manifest.json +1456 -14
  120. package/dist/lite/standards/mechanism-fidelity.md +205 -0
  121. package/dist/lite/standards/operator-private-discipline.md +200 -0
  122. package/dist/lite/standards/operator-to-public-flow.md +195 -0
  123. package/dist/lite/standards/prototype-gallery.md +251 -0
  124. package/dist/lite/standards/pseudonym-key-schema.md +109 -0
  125. package/dist/lite/standards/sibling-validation-checklist.md +181 -0
  126. package/dist/lite/standards/slack-notifications.md +161 -0
  127. package/dist/lite/standards/synthetic-user-testing.md +173 -0
  128. package/dist/lite/standards/vendor-bindings.md +165 -0
  129. package/dist/lite/standards/vendor-plugins/frontend-design.md +66 -0
  130. package/dist/lite/standards/vpc-fit-validation.md +167 -0
  131. package/dist/lite/templates/gallery-yml.md +113 -0
  132. package/dist/lite/templates/product-canvas.md +169 -0
  133. package/dist/lite/templates/value-prop-canvas.md +180 -0
  134. package/package.json +12 -5
  135. /package/dist/lite/{whereami.md → docs/whereami.md} +0 -0
@@ -0,0 +1,126 @@
1
+ ---
2
+ tier: lite
3
+ description: /auto-fix is the autonomous fix workflow for non-trivial narrow bugs.
4
+ ---
5
+
6
+ # Auto-Fix Entry Criteria + Blast-Radius Floor
7
+
8
+ `/auto-fix` is the autonomous fix workflow for non-trivial narrow bugs.
9
+ Entry is gated by STRICT criteria AND a hard blast-radius floor.
10
+ This rule codifies them.
11
+
12
+ ## Entry criteria (ALL must hold)
13
+
14
+ 1. **Narrow scope** — one concern, statable in one sentence
15
+ 2. **Named code area** — operator supplies a file/module/route path
16
+ 3. **NOT in blast-radius floor** (see below) — hard floor, no override
17
+ 4. **Builder agent available** — `.claude/agents/Builder.md` configured
18
+ 5. **Clear acceptance criteria** — one sentence, measurable
19
+
20
+ Any failure → escalate to manual /diagnose or /quick-fix (if trivial).
21
+
22
+ ## Blast-radius floor (HARD — NO OVERRIDE)
23
+
24
+ These paths ALWAYS force the manual lane, regardless of other criteria
25
+ and regardless of how narrow the proposed fix is. There is no
26
+ `SKIP_BLAST_RADIUS` env var. Autonomous fixes here produce silent
27
+ failures affecting every user / every request / the whole deploy
28
+ pipeline — the blast radius justifies always asking a human.
29
+
30
+ - **Auth code**: `src/lib/auth/**`, `src/app/api/auth/**`,
31
+ `src/middleware.ts` where auth logic lives
32
+ - **Schema**: `prisma/schema.prisma`, `prisma/migrations/**`
33
+ - **Security primitives**: `src/lib/security/**`, crypto, signing,
34
+ token handling
35
+ - **Tenant isolation**: any tenant-scoped query, tenant context
36
+ resolution, tenant-bound middleware
37
+ - **Middleware** (any `middleware.ts` file): system-wide effect
38
+ disqualifies autonomous writing
39
+ - **Production infrastructure**: `.github/workflows/deploy*.yml`,
40
+ prod env-var config, CDN/DNS config, database seed data
41
+
42
+ Rationale: the floor isn't "stuff that's hard." It's "stuff where
43
+ silent wrong answers compound." An agent writing wrong auth code
44
+ looks fine locally, passes /verify, ships, and compromises every
45
+ session. Hard floor is the only shape that survives that failure
46
+ mode.
47
+
48
+ ## Override path
49
+
50
+ There is none for blast-radius. That's the point.
51
+
52
+ For the entry-criteria (narrow scope / named area / Builder-available /
53
+ acceptance criteria), there is also no override — softening any of
54
+ those means the skill is being used for cases it wasn't designed for.
55
+ Escalate to manual lane.
56
+
57
+ ## Audit discipline
58
+
59
+ Every /auto-fix commit carries `[auto-fix]` footer. Monthly audit:
60
+
61
+ ```bash
62
+ FIX=$(git log --all --since='30 days ago' --grep='^fix:' --oneline | wc -l)
63
+ AF=$(git log --all --since='30 days ago' --grep='\[auto-fix\]' --oneline | wc -l)
64
+
65
+ echo "Auto-fix ratio: $AF / $FIX"
66
+ ```
67
+
68
+ Target: ≤25% of fix branches use /auto-fix. Higher = either Builder
69
+ is being dispatched where manual judgment was needed, or defect mix
70
+ is systematically narrow (upstream architectural issue worth
71
+ surfacing).
72
+
73
+ ## What "narrow" means (operational definition)
74
+
75
+ A scope is narrow if ALL hold:
76
+
77
+ - The defect affects one callsite or one code path (not cross-cutting)
78
+ - The fix is ≤50 lines (more than /quick-fix's 10, less than a feature)
79
+ - No new interfaces, abstractions, or decorators
80
+ - No schema changes
81
+ - Tests for the fix can be written without refactoring existing tests
82
+
83
+ If any of these fail, the scope is not narrow enough for /auto-fix.
84
+ Either use /decompose + normal Construction, or split the defect.
85
+
86
+ ## Operator responsibilities
87
+
88
+ Operator still does:
89
+
90
+ - Supplies the code area path (criterion 2)
91
+ - Reviews the PR (operator merge is final gate)
92
+ - Decides whether to merge
93
+
94
+ Operator does NOT do:
95
+
96
+ - Write the fix (Builder does)
97
+ - Run /diagnose (Orchestrator invokes it)
98
+ - Run /verify (Builder runs it)
99
+
100
+ ## Enforcement
101
+
102
+ - Skill: `.claude/skills/auto-fix/SKILL.md` requires explicit entry-
103
+ criteria output + blast-radius floor confirmation as Step 1
104
+ - Methodology: agent self-checks the floor before every edit; silence
105
+ is not confirmation
106
+ - PR review: operator MUST confirm floor compliance in review before
107
+ merging (checkbox in PR description)
108
+ - Future: pre-commit hook could grep staged paths against the floor
109
+ list and emit BLOCKED: blast-radius on match. Not required for v1;
110
+ methodology + PR checkbox is sufficient.
111
+
112
+ ## Relationship
113
+
114
+ - `.claude/skills/auto-fix/SKILL.md` — skill that cites this rule
115
+ - `.claude/skills/diagnose/SKILL.md` — full ceremony always runs
116
+ - `.claude/rules/quick-fix-criteria.md` — sibling for trivial lane
117
+ - `.claude/rules/guardrails.md` — "deploy prod without approval" floor
118
+ aligns with this floor
119
+ - `blocked-items.md` — escalation paths are not optional
120
+
121
+ ## When this rule retires
122
+
123
+ It doesn't. The blast-radius floor is load-bearing forever. If the
124
+ floor needs to change, it's an ADR discussion, not a rule edit.
125
+
126
+ Closes bassclef #152 (paired with skill).
@@ -0,0 +1,144 @@
1
+ ---
2
+ tier: lite
3
+ description: "The bassclef-sync.sh SessionStart hook emits a 🛑 BLOCKED block when the consumer repo's hook version differs from bassclef's current template version."
4
+ ---
5
+
6
+ # Bassclef Hook Drift — Session Block
7
+
8
+ The `bassclef-sync.sh` SessionStart hook emits a `🛑 BLOCKED` block
9
+ when the consumer repo's hook version differs from bassclef's
10
+ current template version. Drift means a `bassclef-template-sync` PR
11
+ is open in the consumer repo and has not been merged.
12
+
13
+ When this block appears in session-start output, the agent MUST NOT
14
+ proceed with substantive work until the operator has merged the
15
+ pending PR OR explicitly overridden the block.
16
+
17
+ ## Protocol on detection
18
+
19
+ When session-start output contains the `BLOCKED: bassclef hook drift`
20
+ block, the agent MUST:
21
+
22
+ 1. **Surface the block to the operator** verbatim — same 🛑
23
+ emojis, same horizontal rule, same PR link, same resume command.
24
+ The operator should see exactly what the hook emitted.
25
+ 2. **Refuse substantive work** until drift is cleared. "Substantive"
26
+ means: code edits, agent spawns, destructive operations, external
27
+ calls. Read-only inspection (Read, Glob, Grep) is fine — the
28
+ operator may need it to understand what's pending.
29
+ 3. **Offer the two paths forward**:
30
+ - **Merge path** (preferred): operator merges the pending PR,
31
+ then tells the agent "merged" (or equivalent)
32
+ - **Override path**: operator explicitly says "proceed anyway"
33
+ (or equivalent), accepting the stale-hook risk
34
+
35
+ ## After operator merges the PR
36
+
37
+ On "merged" signal, run the resume sequence the hook printed:
38
+
39
+ ```bash
40
+ cd "$CWD" && git pull origin main && \
41
+ echo '{"cwd":"'"$CWD"'"}' | bash .claude/hooks/bassclef-sync.sh
42
+ ```
43
+
44
+ `$CWD` is the consumer repo root from the original block message.
45
+
46
+ Re-reads the hook from disk, re-runs the SessionStart logic, emits
47
+ a fresh summary. If the merged PR did what it claimed, the new
48
+ summary shows no drift — session is unblocked.
49
+
50
+ If drift still detected after re-run, something is off:
51
+ - Merge may have been to wrong branch
52
+ - Template version header may not have been bumped in the PR
53
+ - Surface this as a secondary failure, don't retry silently
54
+
55
+ ## After operator overrides
56
+
57
+ On "proceed anyway" signal, the agent proceeds with substantive work
58
+ but **carries the override forward in session context** — include
59
+ a one-line reminder in any non-trivial artifact ("produced under
60
+ stale-hook override, merge PR N before next session") so the operator
61
+ remembers to clean up before future sessions.
62
+
63
+ ## What counts as override phrasing
64
+
65
+ Only explicit operator statements count:
66
+ - "proceed anyway"
67
+ - "override"
68
+ - "I'll merge later"
69
+ - "skip drift check"
70
+ - "go" alone is NOT an override — may just be unrelated work instruction
71
+ - Silence or ambiguity = still blocked
72
+
73
+ ## What counts as "merged" confirmation
74
+
75
+ - "merged" / "merged it" / "done" after the block surfaced
76
+ - Operator posts a merged-PR link or screenshot
77
+ - Agent's own MCP check finds the PR in `closed` state with non-null
78
+ `merged_at` (optional enhancement; not required for v1)
79
+
80
+ ## Relationship to other rules
81
+
82
+ - `.claude/rules/blocked-items.md` — general "BLOCKED: means resolve
83
+ or explicitly defer" protocol; this rule is a specific instance
84
+ - `.claude/rules/mobile-ephemeral-session.md` — ephemeral mobile
85
+ sessions are where this rule has the highest value (drift most
86
+ likely because mobile sandbox hook is vendored, not live)
87
+ - `.claude/rules/sdlc-gates.md` — observed failures fire
88
+ temperance → diagnose; drift is a gate, not a failure, so it runs
89
+ before the failure chain
90
+ - `ADR-014-substrate-sync-strategy.md` — architectural context
91
+
92
+ ## URL rotation PRs are NOT covered by this rule
93
+
94
+ This rule fires on **template** drift (version header mismatch),
95
+ NOT on URL rotation PRs. URL rotation does not change hook semantics;
96
+ the current URL in `.bassclef-url` on main is still valid for its
97
+ TTL window. Blocking mobile sessions on routine URL rotation would
98
+ defeat the S3 distribution model's purpose.
99
+
100
+ Only the `bassclef-template-sync` workflow triggers drift.
101
+
102
+ ## Complementary: workflow-staleness hook (bassclef-side, WU-9d)
103
+
104
+ This rule catches drift in **consumer repos** (template version mismatch
105
+ between consumer's vendored hook and bassclef's current template).
106
+ The complementary signal lives on **bassclef itself**:
107
+ `.claude/hooks/session-reflection.d/80-workflow-staleness.sh` queries
108
+ bassclef-side distribution workflows and BLOCKs bassclef sessions
109
+ when any monitored workflow has failed >24h without recovery.
110
+
111
+ **Workflows monitored** (current):
112
+
113
+ - `bassclef-s3-publish.yml` — S3 tarball + URL refresh (retiring under
114
+ bassclef#446 LR8.5 WU-2 once consumers migrate from `.bassclef-url`
115
+ to `.bassclef-source.json`)
116
+
117
+ **Retired** (no longer monitored):
118
+
119
+ - `bassclef-template-sync.yml` — retired 2026-05-03 (PR #445). Auto-
120
+ PR-based template propagation replaced by the thin-pointer architecture
121
+ (consumer's dispatcher hook reads `.bassclef-source.json` and fetches
122
+ bassclef's current template at every session-start; no vendoring,
123
+ no drift class for thin-pointer consumers).
124
+
125
+ The hook + this rule together close the silent-failure loop that
126
+ surfaced 2026-04-26-2026-04-27 when bassclef-template-sync.yml
127
+ failed on two consecutive runs without operator notice. With template-
128
+ sync retired, that specific failure mode is structurally impossible —
129
+ the workflow no longer exists. The hook still monitors remaining
130
+ distribution workflows (and any future ones) on the same pattern.
131
+
132
+ | Layer | Hook | What it catches |
133
+ |---|---|---|
134
+ | Consumer repo | `bassclef-sync.sh` (this rule) | Vendored hook out of date with bassclef's current template version (vendored-snapshot consumers only; thin-pointer consumers opt out structurally) |
135
+ | Bassclef repo | `80-workflow-staleness.sh` | Distribution workflow failed >24h ago |
136
+
137
+ When the bassclef-side hook fires, the consumer-side rule may still
138
+ be quiet (because no new template version has been published yet —
139
+ that's exactly the failure the workflow was trying to ship). Reading
140
+ both signals together gives the full picture.
141
+
142
+ Override path (workflow-staleness hook): `SKIP_WORKFLOW_STALENESS=1`
143
+ or `WORKFLOW_STALENESS_HOURS=N` per-session env. Same trace-logging
144
+ discipline as other bassclef hooks.
@@ -0,0 +1,107 @@
1
+ ---
2
+ tier: lite
3
+ description: "This rule tells consumer-repo agents where bassclef's models live."
4
+ ---
5
+
6
+ # Bassclef Models Discovery
7
+
8
+ This rule tells consumer-repo agents where bassclef's models live. Bassclef's design + architecture + decomposition docs stay in bassclef's repo (not vendored into consumers). Agents reading this rule navigate to bassclef when they need a model — by local sibling, by remote browse, or by GitHub URL.
9
+
10
+ ## When this rule fires
11
+
12
+ Any consumer-repo session where the agent needs to:
13
+ - Understand a bassclef concept (Consumer, Sibling, Harness, GitState, Hook, AutoSave, etc.)
14
+ - Cite a bassclef ADR in a substrate change
15
+ - Read bassclef's interaction model when fixing a binding defect
16
+ - Reference the object-model catalog
17
+ - Find a design discovery or earned-wisdom principle
18
+
19
+ Most consumer-repo work doesn't need bassclef's models. This rule activates when it does.
20
+
21
+ ## Where bassclef's models live
22
+
23
+ Single discovery surface in bassclef: `design/models-index.md`. It catalogs the Tier 1 source-of-truth models with paths + last-updated dates + diagram-status.
24
+
25
+ Direct GitHub URL: `https://github.com/sunj-labs/bassclef/blob/main/design/models-index.md`
26
+
27
+ From the index, navigate to specific models:
28
+
29
+ | If you need | Read |
30
+ |---|---|
31
+ | App-domain noun catalog (User, Agent, Tool, Deal, ...) | `design/object-model.md` |
32
+ | Runtime-interaction model (Consumer, Sibling, Harness, ...) | `docs/decompositions/bassclef-interaction-model.md` (also rendered via ADR-018) |
33
+ | What bassclef persists across sessions | `standards/state-spine.md` |
34
+ | Trust zone flow (runtime security sequence) | `design/trust-zone-flow.md` |
35
+ | Core Five engineering principles | `design/engineering-principles.md` |
36
+ | Bassclef-as-context-engineering framing | `design/bassclef-as-context-engineering.md` |
37
+ | Architecture decisions (ADRs) | `architecture/decisions/` (numbered ADR-NNN files) |
38
+ | Earned-wisdom discoveries | `design/discoveries/` (with README index) |
39
+ | Vendor bindings + portability | `standards/vendor-bindings.md` |
40
+
41
+ All paths are relative to bassclef's repo root.
42
+
43
+ ## How to navigate
44
+
45
+ Three access patterns, in order of preference:
46
+
47
+ ### 1. Local sibling (fastest)
48
+
49
+ If the operator has bassclef checked out at `~/src/sunj-labs/bassclef` (typical sunj-labs workstation layout), navigate directly:
50
+
51
+ ```bash
52
+ cat ~/src/sunj-labs/bassclef/design/models-index.md
53
+ ```
54
+
55
+ This works offline. Beware staleness — local sibling may not be current; see bassclef#576 for the drift class. To verify freshness:
56
+
57
+ ```bash
58
+ cd ~/src/sunj-labs/bassclef && git fetch origin main && git log -1 origin/main --format='%H %s'
59
+ ```
60
+
61
+ ### 2. gh CLI (current; GitHub-Locked)
62
+
63
+ If on a developer machine with `gh` installed + authenticated:
64
+
65
+ ```bash
66
+ gh repo view sunj-labs/bassclef --json url
67
+ gh api repos/sunj-labs/bassclef/contents/design/models-index.md --jq '.content' | base64 -d
68
+ ```
69
+
70
+ This always reads bassclef's current `main`. Network-dependent.
71
+
72
+ ### 3. Browser
73
+
74
+ Open `https://github.com/sunj-labs/bassclef/blob/main/design/models-index.md`. Works for human operators. Agents typically prefer paths 1 or 2.
75
+
76
+ ## What this rule does NOT do
77
+
78
+ - Does NOT vendor bassclef's models into the consumer repo. Models stay in bassclef; consumers reference + navigate as needed.
79
+ - Does NOT auto-fetch bassclef's models at consumer session-start. Fetching happens on-demand when the agent decides it needs a model.
80
+ - Does NOT cache bassclef's models in the consumer. Each lookup is fresh (or as-fresh-as-the-access-pattern-allows).
81
+
82
+ ## Vendor binding posture
83
+
84
+ Per `standards/vendor-bindings.md`:
85
+
86
+ - **This rule itself**: Agent-Agnostic. Works on any git provider — the rule's text contains URLs + paths; consumer agents navigate via whatever's available (local sibling, gh / az repos / glab / browser).
87
+ - **Path 2 (`gh` CLI)**: GitHub-Locked. ADO consumers substitute `az repos`; GitLab consumers substitute `glab`; etc. The rule body should be read as a pattern, not a strict gh-only instruction.
88
+
89
+ ## What this enables
90
+
91
+ A consumer-repo agent debugging a bassclef-related defect can:
92
+
93
+ 1. Read this rule at session-start (auto-loaded via bassclef-sync's `additionalDirectories` wiring)
94
+ 2. Recognize "I need bassclef's interaction model"
95
+ 3. Navigate via local sibling or gh CLI
96
+ 4. Read `design/models-index.md`
97
+ 5. Navigate from there to the specific model
98
+
99
+ Without this rule, step 1 doesn't happen — the consumer agent has no signal that bassclef even has an index, much less where it lives.
100
+
101
+ ## Operator-why
102
+
103
+ Per `design/discoveries/README.md` schema — operator-why anchoring:
104
+
105
+ > Single-operator + family + day job + mobile-dispatchable. The operator cannot afford to manually tell each consumer-repo agent "go look at bassclef's models." A rule that propagates via bassclef-sync to every consumer means each consumer's agent has the signal at session-start, automatically, with no operator-per-session cost.
106
+
107
+ The discipline is propagation, not vendoring. Vendoring grows the consumer's filesystem with bassclef's design library + introduces snapshot drift. This rule keeps content in bassclef, distributes the pointer.
@@ -0,0 +1,104 @@
1
+ ---
2
+ tier: lite
3
+ description: When modifying any file matching .github/workflows/bassclef-*.yml, grep the other files in the same directory for the pattern you just changed.
4
+ ---
5
+
6
+ # Bassclef Workflow Parity
7
+
8
+ When modifying any file matching `.github/workflows/bassclef-*.yml`,
9
+ grep the other files in the same directory for the pattern you just
10
+ changed. If a sibling has the same shape, update it in the same PR.
11
+
12
+ This rule exists because we've shipped the asymmetry twice in six
13
+ days. Both times the fix was one or two lines in the sibling. Both
14
+ times the cost was a second PR, a session retrospective, and operator
15
+ trust in the propagation path.
16
+
17
+ ## What triggers the rule
18
+
19
+ Any edit (Edit/Write tool) to a file matching:
20
+
21
+ ```
22
+ .github/workflows/bassclef-s3-publish.yml
23
+ ```
24
+
25
+ (Today that's the only one. `bassclef-template-sync.yml` retired
26
+ 2026-05-03 in PR #445 — the thin-pointer architecture replaced auto-PR-
27
+ based template propagation. `bassclef-s3-publish.yml` retires under
28
+ bassclef#446 LR8.5 WU-2 once every consumer migrates from
29
+ `.bassclef-url` to `.bassclef-source.json`. After that, this rule
30
+ sits dormant until a future `bassclef-*.yml` workflow ships.)
31
+
32
+ ## What the rule requires
33
+
34
+ Before the PR merges, the agent MUST:
35
+
36
+ 1. Glob `.github/workflows/bassclef-*.yml` — enumerate all siblings.
37
+ 2. For each pattern being changed in the PR (matrix shape, Slack
38
+ message format, env var handling, etc.), grep the siblings for
39
+ that pattern.
40
+ 3. If a sibling has the pattern and it's not being updated in this
41
+ PR, either:
42
+ - Include it in this PR (preferred — one change, one shape)
43
+ - Explicitly defer it: open a follow-up issue NOW, note it in the
44
+ PR description, and state why the sibling deferral is safe
45
+
46
+ Silence about the sibling is not deferral.
47
+
48
+ ## What satisfies the rule
49
+
50
+ A "Sibling parity" block in the PR description enumerating:
51
+
52
+ ```
53
+ ## Sibling parity
54
+
55
+ Checked `.github/workflows/bassclef-*.yml`:
56
+ - `bassclef-s3-publish.yml` — [touched in this PR / unchanged because X]
57
+ - `bassclef-template-sync.yml` — [touched in this PR / unchanged because X]
58
+ ```
59
+
60
+ Or, if no siblings have the pattern: "Sibling parity: pattern is
61
+ unique to this file (confirmed via grep)."
62
+
63
+ ## Concrete patterns to check
64
+
65
+ From the two incidents to date — these are the patterns most likely
66
+ to live in more than one file:
67
+
68
+ | Pattern | Example | Lives in |
69
+ |---------|---------|----------|
70
+ | `matrix.consumer` list | 5-consumer list for fan-out | both workflows |
71
+ | Slack message composition | jq `--arg` vs string-interpolation | both workflows |
72
+ | Slack emoji convention | 🤖 auto / 🙋 human | both workflows |
73
+ | GitHub Actions env / secret names | `SLACK_WEBHOOK`, `BASSCLEF_CONSUMER_WRITE_TOKEN` | both workflows |
74
+ | Workflow trigger shape | `workflow_dispatch` inputs, cron schedule | may diverge legitimately |
75
+ | Timeout / retry behavior | per-job defaults | usually shared |
76
+
77
+ ## Relationship to other rules
78
+
79
+ - `artifact-ingestion.md` — reads artifacts before producing; this
80
+ rule extends the discipline to "reads siblings before committing"
81
+ - `commit-conventions.md` — PR titles and descriptions carry the
82
+ parity block
83
+ - `sdlc-gates.md` — post-build gate; parity check is a pre-merge
84
+ checklist item
85
+
86
+ ## Enforcement
87
+
88
+ Methodology-level today. If this rule fires a third time and the
89
+ grep-before-merge discipline fails, upgrade to a pre-commit or
90
+ pre-merge hook that:
91
+
92
+ 1. Detects files changed matching `.github/workflows/bassclef-*.yml`
93
+ 2. Runs `grep -l` for key patterns across siblings
94
+ 3. BLOCKS unless PR description contains a "Sibling parity" block
95
+
96
+ Until then, the rule stands on the agent's discipline. Read siblings
97
+ before closing the PR.
98
+
99
+ ## Override path
100
+
101
+ `SKIP_BASSCLEF_PARITY=1 <tool-call>` — logged to trace. Use only
102
+ when the pattern being changed is genuinely unique to one workflow
103
+ (e.g., a schedule change that applies to publish but not
104
+ template-sync).
@@ -0,0 +1,154 @@
1
+ ---
2
+ tier: lite
3
+ globs: ["*"]
4
+ description: Cost governance — budget enforcement from substrate.config.md manifest
5
+ ---
6
+
7
+ # Cost Governance
8
+
9
+ Budget and model routing are defined in the project's `substrate.config.md`.
10
+ This rule applies in ALL configurations (operator-gated, orchestrator-gated,
11
+ sequential, parallel).
12
+
13
+ ## Budget behavior (Orchestrator enforces in orchestrator-gated mode)
14
+
15
+ | Event | Action |
16
+ |---|---|
17
+ | Session start | Read session_ceiling and iteration_ceiling from manifest. If iteration_ceiling missing, ask operator. |
18
+ | 75% of iteration ceiling | Surface status: spend to date, remaining, work completed vs scope. Continue unless operator says stop. |
19
+ | Iteration ceiling hit | Pause. Report state. Propose descoped continuation that fits remaining budget. INSTEAD of silent hard-stop: surface the ceiling hit + 2-3 descope options to operator. |
20
+ | Session ceiling approached | Warn operator. Complete current atomic unit of work. Do not start a new iteration. |
21
+ | Replenish floor hit | Surface. Recommend deferring remaining iterations to next session. |
22
+
23
+ ## Cost tracking (all levels)
24
+
25
+ Track cost at phase boundaries. The system reports proactively.
26
+
27
+ INSTEAD of waiting for the operator to ask "what did this cost?":
28
+ emit a one-line cost summary at every phase boundary (turn count +
29
+ duration + scope completed) automatically.
30
+
31
+ ### At phase start (estimate)
32
+
33
+ Before activating agents for a phase, estimate:
34
+ - Number of subagent spawns planned (0 for sequential mode)
35
+ - Estimated turns per agent based on phase and scope
36
+ - Total estimated phase cost (burst + Pro plan time)
37
+ - Remaining budget after this phase
38
+
39
+ ### At phase end (actuals)
40
+
41
+ After a phase completes, report in whereami.md:
42
+
43
+ ```markdown
44
+ ## Cost tracking
45
+ | Phase | Agents | Turns | Burst cost | Duration | Notes |
46
+ |-------|--------|-------|-----------|----------|-------|
47
+ | Inception | Shaper, PM | 12 | $0 | 8m | Sequential — no burst |
48
+ | Elaboration | Architect, Designer | 18 | $0 | 14m | Sequential |
49
+ | Construction | Builder, Reviewer | 35 | $0 | 25m | 3 branches |
50
+ | **Total** | | **65** | **$0** | **47m** | |
51
+
52
+ Budget: $0 ceiling / $0 spent / on track
53
+ ```
54
+
55
+ ### At session end
56
+
57
+ Include in the chronicle:
58
+ - Total turns used
59
+ - Total duration (approximate)
60
+ - Cost per artifact produced (turns / artifacts)
61
+ - Budget utilization (% of ceiling used, or "sequential — $0 burst")
62
+ - Scope completed vs planned
63
+
64
+ ### Sequential mode
65
+
66
+ Burst cost is $0 but Pro plan time still matters. Track:
67
+ - Turn count per phase
68
+ - Duration per phase (approximate)
69
+ - These help calibrate future time budget estimates
70
+
71
+ ### Where to get cost data
72
+
73
+ - Turn count: count conversation turns per phase
74
+ - Duration: note timestamps at phase boundaries
75
+ - Burst cost: relevant only in parallel mode (subagent spawns)
76
+ - If exact data isn't available, estimate and note the method
77
+
78
+ ## Sequential-mode cost messaging (#113)
79
+
80
+ When the session is sequential (operator-gated OR orchestrator-gated),
81
+ burst cost is $0. Pro plan time still consumes, but there is no
82
+ per-turn API burst charge. Agents MUST NOT report dollar figures
83
+ like "$30 / 100 turns" for sequential work — it materially overstates
84
+ spend and pushes scope decisions smaller than needed.
85
+
86
+ Correct framings for sequential mode:
87
+
88
+ - "Sequential — $0 burst, ~N turns, ~M minutes"
89
+ - "Budget: $0 ceiling / $0 spent (sequential) / on track"
90
+ - "Full goal is $0 burst / 100 turns budgeted"
91
+
92
+ INSTEAD of dollar figures in sequential reports: use turn count +
93
+ duration. Dollar figures apply ONLY when parallel execution is active
94
+ (subagent spawns) or when the session uses a paid-API service with
95
+ disclosed unit cost (see `iteration-bet.md` §Paid-API costs).
96
+
97
+ ## Operator-gated sessions
98
+
99
+ Cost tracking is advisory, not enforced. The rules below still apply:
100
+ - No unbounded loops (retry forever, poll indefinitely)
101
+ - No recursive agent spawning without depth limits
102
+ - Prefer single-pass solutions over iterative refinement loops
103
+ - If a task is taking 3x longer than expected: stop, diagnose, escalate
104
+ - At session end, note approximate scope of work in the chronicle
105
+
106
+ ## Model routing
107
+
108
+ Defined per-agent in manifest. Default routing:
109
+
110
+ | Agent | Model | Rationale |
111
+ |---|---|---|
112
+ | Orchestrator | haiku | Routing — no deep reasoning needed |
113
+ | Shaper | opus (Inception only) | Problem framing is highest-leverage thinking. Revert to sonnet after. |
114
+ | PM | sonnet | Viability hypotheses require judgment |
115
+ | Creative Director | sonnet | Brief and token work — nuanced but not architecturally complex |
116
+ | Architect | sonnet | ADRs and C4 require real reasoning |
117
+ | Designer | sonnet | UX judgment |
118
+ | Builder | sonnet | Code quality matters; haiku produces more rework |
119
+ | Reviewer | haiku | Checklist evaluation — mechanical |
120
+ | Deployer | haiku | Pipeline execution — deterministic |
121
+ | Closer | haiku | Gate checklist — administrative |
122
+
123
+ Opus escalation: Shaper may request Opus outside Inception if problem framing is genuinely novel and high-stakes. Orchestrator logs escalation and cost delta. Operator notified.
124
+
125
+ ## Rate limit awareness (parallel mode)
126
+
127
+ Parallel worktree agents multiply API request rate against the same account
128
+ quota. Rate limits are per-account, not per-session — 3 parallel agents
129
+ consume 3x the RPM/TPM.
130
+
131
+ | Risk | Mitigation |
132
+ |------|-----------|
133
+ | 429 errors from concurrent agents | Stagger agent starts by 30s |
134
+ | Context window bloat per agent | Send only relevant files, not full repo |
135
+ | Cascading retries amplify pressure | On 429: INSTEAD of immediate retry, wait Retry-After header value |
136
+ | Account-level quota exhaustion | Max 2 concurrent agents for most tiers |
137
+
138
+ If rate limits persist after 3 retries, switch to sequential mode.
139
+ See `standards/worktree-management.md` for full parallel operations protocol.
140
+
141
+ ## Hook enforcement
142
+
143
+ The pre-build-gate hook (`pre-build-gate.sh`) enforces budget at runtime:
144
+
145
+ - Tracks edit count per session as a proxy for turns consumed
146
+ - At 75% of turn limit: surfaces a budget status line
147
+ - At 100% of turn limit: surfaces a hard warning to pause and report
148
+
149
+ The hook reads the turn limit from the active iteration goal. If no bet
150
+ exists, budget tracking is advisory only (no warnings).
151
+
152
+ This is a lightweight enforcement layer. The Orchestrator (at standard/full
153
+ level) has additional budget responsibilities defined in the budget
154
+ behavior table above.