@thebassclef/lite 1.0.4 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/dist/cli.cjs +298 -55
  2. package/dist/cli.js +298 -55
  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/agents/architect.md +70 -0
  7. package/dist/lite/.claude/agents/builder.md +114 -0
  8. package/dist/lite/.claude/agents/designer.md +156 -0
  9. package/dist/lite/.claude/agents/reviewer.md +88 -0
  10. package/dist/lite/.claude/hooks/bassclef-sync.sh +85 -27
  11. package/dist/lite/.claude/hooks/longrun-prep-compounding-axis-check.sh +492 -0
  12. package/dist/lite/.claude/hooks/longrun-prep-render-check.sh +236 -0
  13. package/dist/lite/.claude/hooks/persona-name-scrub-check.sh +105 -0
  14. package/dist/lite/.claude/hooks/skill-step-list-check.sh +171 -0
  15. package/dist/lite/.claude/luminaries/alan-cooper.md +170 -0
  16. package/dist/lite/.claude/luminaries/alistair-cockburn.md +140 -0
  17. package/dist/lite/.claude/luminaries/amazon-pr-faq.md +34 -0
  18. package/dist/lite/.claude/luminaries/andreas-zeller.md +74 -0
  19. package/dist/lite/.claude/luminaries/ash-maurya.md +121 -0
  20. package/dist/lite/.claude/luminaries/bill-buxton.md +210 -0
  21. package/dist/lite/.claude/luminaries/charles-sanders-peirce.md +150 -0
  22. package/dist/lite/.claude/luminaries/david-ogilvy.md +192 -0
  23. package/dist/lite/.claude/luminaries/don-norman.md +173 -0
  24. package/dist/lite/.claude/luminaries/edward-tufte.md +179 -0
  25. package/dist/lite/.claude/luminaries/eric-evans.md +160 -0
  26. package/dist/lite/.claude/luminaries/frederick-brooks.md +50 -0
  27. package/dist/lite/.claude/luminaries/gang-of-four.md +157 -0
  28. package/dist/lite/.claude/luminaries/glenford-myers.md +230 -0
  29. package/dist/lite/.claude/luminaries/hunt-thomas.md +115 -0
  30. package/dist/lite/.claude/luminaries/hyrum-wright.md +94 -0
  31. package/dist/lite/.claude/luminaries/jason-fried-dhh.md +46 -0
  32. package/dist/lite/.claude/luminaries/jesse-james-garrett.md +154 -0
  33. package/dist/lite/.claude/luminaries/john-ousterhout.md +94 -0
  34. package/dist/lite/.claude/luminaries/karl-popper.md +132 -0
  35. package/dist/lite/.claude/luminaries/kent-beck.md +168 -0
  36. package/dist/lite/.claude/luminaries/linus-torvalds.md +218 -0
  37. package/dist/lite/.claude/luminaries/martin-fowler.md +164 -0
  38. package/dist/lite/.claude/luminaries/michael-feathers.md +125 -0
  39. package/dist/lite/.claude/luminaries/michael-nygard.md +118 -0
  40. package/dist/lite/.claude/luminaries/robert-c-martin.md +164 -0
  41. package/dist/lite/.claude/luminaries/saltzer-schroeder.md +194 -0
  42. package/dist/lite/.claude/luminaries/sophia-prater.md +193 -0
  43. package/dist/lite/.claude/luminaries/stephen-toulmin.md +131 -0
  44. package/dist/lite/.claude/luminaries/tony-hoare.md +170 -0
  45. package/dist/lite/.claude/luminaries/vaughn-vernon.md +50 -0
  46. package/dist/lite/.claude/luminaries/w-edwards-deming.md +158 -0
  47. package/dist/lite/.claude/rules/accessor-library-discipline.md +110 -0
  48. package/dist/lite/.claude/rules/adr-discipline.md +96 -0
  49. package/dist/lite/.claude/rules/api-conventions.md +115 -0
  50. package/dist/lite/.claude/rules/artifact-ingestion.md +137 -0
  51. package/dist/lite/.claude/rules/assert-only-after-verify.md +111 -0
  52. package/dist/lite/.claude/rules/blocked-items.md +139 -0
  53. package/dist/lite/.claude/rules/bootstrap-pair-discipline.md +106 -0
  54. package/dist/lite/.claude/rules/branching.md +28 -0
  55. package/dist/lite/.claude/rules/cold-adopter-harness-discipline.md +93 -0
  56. package/dist/lite/.claude/rules/commit-conventions.md +22 -0
  57. package/dist/lite/.claude/rules/compounding-axis-fresh-analysis.md +173 -0
  58. package/dist/lite/.claude/rules/compounding-sequence-fresh-analysis.md +173 -0
  59. package/dist/lite/.claude/rules/context-engineering.md +155 -0
  60. package/dist/lite/.claude/rules/context-management.md +85 -0
  61. package/dist/lite/.claude/rules/defensive-bash.md +52 -0
  62. package/dist/lite/.claude/rules/deferred-actions.md +233 -0
  63. package/dist/lite/.claude/rules/destructive-operations.md +69 -0
  64. package/dist/lite/.claude/rules/diagnosis.md +38 -0
  65. package/dist/lite/.claude/rules/github-issue-flash-tweet.md +114 -0
  66. package/dist/lite/.claude/rules/guardrails.md +73 -0
  67. package/dist/lite/.claude/rules/hook-wire-on-author.md +77 -0
  68. package/dist/lite/.claude/rules/identifier-leak-prevention.md +73 -0
  69. package/dist/lite/.claude/rules/iteration-bet-brief-completeness.md +43 -0
  70. package/dist/lite/.claude/rules/lite-manifest-schema-change-discipline.md +79 -0
  71. package/dist/lite/.claude/rules/longrun-prep-plan-doc-compression.md +77 -0
  72. package/dist/lite/.claude/rules/loop-discipline.md +71 -0
  73. package/dist/lite/.claude/rules/manual-prod-approval.md +100 -0
  74. package/dist/lite/.claude/rules/marker-enrichment-discipline.md +72 -0
  75. package/dist/lite/.claude/rules/mobile-ephemeral-session.md +109 -0
  76. package/dist/lite/.claude/rules/new-dependency-check.md +44 -0
  77. package/dist/lite/.claude/rules/oo-ad-entry-point.md +95 -0
  78. package/dist/lite/.claude/rules/operator-facing-prose.md +177 -0
  79. package/dist/lite/.claude/rules/option-label-discipline.md +82 -0
  80. package/dist/lite/.claude/rules/pattern-annotation.md +83 -0
  81. package/dist/lite/.claude/rules/persona-name-leak-scrub.md +90 -0
  82. package/dist/lite/.claude/rules/plain-english-discipline.md +132 -0
  83. package/dist/lite/.claude/rules/plan-enumeration-needs-value-props.md +177 -0
  84. package/dist/lite/.claude/rules/pr-body-shape.md +195 -0
  85. package/dist/lite/.claude/rules/pr-strategy.md +142 -0
  86. package/dist/lite/.claude/rules/pr-title-shape.md +90 -0
  87. package/dist/lite/.claude/rules/prototype-workflow.md +53 -0
  88. package/dist/lite/.claude/rules/reserved-skill-names.md +103 -0
  89. package/dist/lite/.claude/rules/schema-management.md +42 -0
  90. package/dist/lite/.claude/rules/sdlc-gates.md +149 -0
  91. package/dist/lite/.claude/rules/security.md +37 -0
  92. package/dist/lite/.claude/rules/session-artifacts.md +236 -0
  93. package/dist/lite/.claude/rules/skill-composition-declarations.md +105 -0
  94. package/dist/lite/.claude/rules/skill-description-clarity.md +196 -0
  95. package/dist/lite/.claude/rules/skill-procedure-step-list.md +119 -0
  96. package/dist/lite/.claude/rules/sprint-prep-preset-picker.md +76 -0
  97. package/dist/lite/.claude/rules/state-schema-validation.md +156 -0
  98. package/dist/lite/.claude/rules/stuck-signal-diagnostic.md +111 -0
  99. package/dist/lite/.claude/rules/substrate-config-schema.md +85 -0
  100. package/dist/lite/.claude/rules/test-list-discipline.md +129 -0
  101. package/dist/lite/.claude/rules/test-sufficiency.md +186 -0
  102. package/dist/lite/.claude/rules/testing-tier-config.md +125 -0
  103. package/dist/lite/.claude/rules/testing.md +38 -0
  104. package/dist/lite/.claude/rules/turn-estimate-grounding.md +82 -0
  105. package/dist/lite/.claude/rules/visual-hierarchy.md +427 -0
  106. package/dist/lite/.claude/rules/we-dont-break-adopters.md +103 -0
  107. package/dist/lite/.claude/rules/whereami-load-bearing.md +184 -0
  108. package/dist/lite/.claude/rules/writing-craft-discipline.md +72 -0
  109. package/dist/lite/.claude/rules/wu-sequencing-compounds.md +119 -0
  110. package/dist/lite/.claude/skills/build/SKILL.md +640 -0
  111. package/dist/lite/.claude/skills/chronicle/SKILL.md +55 -0
  112. package/dist/lite/.claude/skills/clean-artifacts/SKILL.md +249 -0
  113. package/dist/lite/.claude/skills/decompose/SKILL.md +280 -0
  114. package/dist/lite/.claude/skills/diagnose/SKILL.md +297 -0
  115. package/dist/lite/.claude/skills/feynman/SKILL.md +90 -0
  116. package/dist/lite/.claude/skills/howdoi/SKILL.md +105 -0
  117. package/dist/lite/.claude/skills/ia-model/SKILL.md +108 -0
  118. package/dist/lite/.claude/skills/interaction-design/SKILL.md +112 -0
  119. package/dist/lite/.claude/skills/interpret-input/SKILL.md +180 -0
  120. package/dist/lite/.claude/skills/journal/SKILL.md +209 -0
  121. package/dist/lite/.claude/skills/kiss/SKILL.md +449 -0
  122. package/dist/lite/.claude/skills/launch/SKILL.md +915 -0
  123. package/dist/lite/.claude/skills/lean-canvas/SKILL.md +332 -0
  124. package/dist/lite/.claude/skills/longrun/SKILL.md +512 -0
  125. package/dist/lite/.claude/skills/luminary/SKILL.md +481 -0
  126. package/dist/lite/.claude/skills/ogilvy-writing-audit/SKILL.md +177 -0
  127. package/dist/lite/.claude/skills/onboard-repo/SKILL.md +1640 -0
  128. package/dist/lite/.claude/skills/pattern-review/SKILL.md +99 -0
  129. package/dist/lite/.claude/skills/personas/SKILL.md +207 -0
  130. package/dist/lite/.claude/skills/promote/SKILL.md +283 -0
  131. package/dist/lite/.claude/skills/requirement/SKILL.md +98 -0
  132. package/dist/lite/.claude/skills/retro/SKILL.md +117 -0
  133. package/dist/lite/.claude/skills/riff/SKILL.md +114 -0
  134. package/dist/lite/.claude/skills/roadmap-reconcile/SKILL.md +163 -0
  135. package/dist/lite/.claude/skills/session-end/SKILL.md +309 -0
  136. package/dist/lite/.claude/skills/session-log/SKILL.md +299 -0
  137. package/dist/lite/.claude/skills/skills/SKILL.md +228 -0
  138. package/dist/lite/.claude/skills/spec/SKILL.md +105 -0
  139. package/dist/lite/.claude/skills/sprint/SKILL.md +418 -0
  140. package/dist/lite/.claude/skills/stage/SKILL.md +384 -0
  141. package/dist/lite/.claude/skills/state-a-problem/SKILL.md +185 -0
  142. package/dist/lite/.claude/skills/temperance/SKILL.md +108 -0
  143. package/dist/lite/.claude/skills/use-case/SKILL.md +417 -0
  144. package/dist/lite/.claude/skills/user-stories/SKILL.md +268 -0
  145. package/dist/lite/.claude/skills/value-prop/SKILL.md +251 -0
  146. package/dist/lite/.claude/skills/verify/SKILL.md +160 -0
  147. package/dist/lite/.claude/skills/visual-review/SKILL.md +503 -0
  148. package/dist/lite/.claude/skills/whats-the-plan/SKILL.md +202 -0
  149. package/dist/lite/.claude/skills/whereami/SKILL.md +307 -0
  150. package/dist/lite/AGENTS.md +79 -0
  151. package/dist/lite/CLAUDE-lite.md +85 -0
  152. package/dist/lite/CODE_OF_CONDUCT.md +28 -0
  153. package/dist/lite/CONTRIBUTING.md +177 -0
  154. package/dist/lite/README.md +173 -0
  155. package/dist/lite/SECURITY.md +19 -0
  156. package/dist/lite/architecture/decisions/ADR-029-release-pipeline.md +79 -0
  157. package/dist/lite/architecture/decisions/ADR-031-non-breaking-changes-adopter-discipline.md +139 -0
  158. package/dist/lite/architecture/decisions/ADR-032-adopter-sync-dispatcher-architecture.md +192 -0
  159. package/dist/lite/architecture/decisions/ADR-039-release-tagging-scheme.md +145 -0
  160. package/dist/lite/architecture/decisions/ADR-040-planning-skill-vocabulary-and-lite-profile.md +155 -0
  161. package/dist/lite/architecture/decisions/ADR-044-unified-skill-body-template.md +162 -0
  162. package/dist/lite/lib/clean-artifacts-sweep.sh +112 -0
  163. package/dist/lite/lib/code-comment-discipline.sh +144 -0
  164. package/dist/lite/lib/composer-preflight.sh +459 -0
  165. package/dist/lite/lib/deferred-actions.sh +146 -0
  166. package/dist/lite/lib/hook-header-parser.sh +61 -0
  167. package/dist/lite/lib/hook-heartbeat.sh +152 -0
  168. package/dist/lite/lib/hook-inject.sh +255 -0
  169. package/dist/lite/lib/hook-installer.sh +195 -0
  170. package/dist/lite/lib/luminary-pick.sh +96 -0
  171. package/dist/lite/lib/output-discipline.sh +143 -0
  172. package/dist/lite/lib/prose-scan-boundary.sh +171 -0
  173. package/dist/lite/lib/rewrite-check.sh +214 -0
  174. package/dist/lite/lib/session-rescue.sh +151 -0
  175. package/dist/lite/lib/source-graph-walker.sh +277 -0
  176. package/dist/lite/lib/state.sh +1372 -0
  177. package/dist/lite/lib/telemetry.sh +205 -0
  178. package/dist/lite/lib/tier-check.sh +187 -0
  179. package/dist/lite/lib/tier-dependency-audit.sh +1088 -0
  180. package/dist/lite/presence/install/bassclef-hook-connect.sh +178 -0
  181. package/dist/lite/presence/install/bassclef-sync.dispatcher.template.sh +841 -0
  182. package/dist/lite/presence/install/bassclef-sync.template.sh +2278 -0
  183. package/dist/lite/presence/install/schedule-auto-save.cron.sh +88 -0
  184. package/dist/lite/presence/install/schedule-auto-save.taskscheduler.md +122 -0
  185. package/dist/lite/scripts/aggregate-telemetry.sh +217 -0
  186. package/dist/lite/scripts/analyze-tier-dependencies.sh +239 -0
  187. package/dist/lite/scripts/generate-lite-manifest.sh +505 -0
  188. package/dist/lite/scripts/generate-tier-manifest.sh +28 -0
  189. package/dist/lite/scripts/intent-drift-check.sh +456 -0
  190. package/dist/lite/scripts/lite-manifest-drift-check.sh +146 -0
  191. package/dist/lite/scripts/render-lite-manifest-doc.sh +150 -0
  192. package/dist/lite/standards/adr-template.md +86 -0
  193. package/dist/lite/standards/api-conventions/nextjs.md +84 -0
  194. package/dist/lite/standards/artifact-composition.md +209 -0
  195. package/dist/lite/standards/bash-hook-safety.md +246 -0
  196. package/dist/lite/standards/bassclef-configs-schema.md +232 -0
  197. package/dist/lite/standards/bassclef-evolution.md +143 -0
  198. package/dist/lite/standards/bassclef-internal-jargon.md +244 -0
  199. package/dist/lite/standards/bassclef-managed-sentinel.md +96 -0
  200. package/dist/lite/standards/bassclef-source-config.md +228 -0
  201. package/dist/lite/standards/branch-stacking.md +408 -0
  202. package/dist/lite/standards/code-safety-principles.md +176 -0
  203. package/dist/lite/standards/composer-prerequisites.md +155 -0
  204. package/dist/lite/standards/deferred-actions-schema.md +204 -0
  205. package/dist/lite/standards/dependency-discipline/cargo.md +39 -0
  206. package/dist/lite/standards/dependency-discipline/gem.md +43 -0
  207. package/dist/lite/standards/dependency-discipline/go-mod.md +41 -0
  208. package/dist/lite/standards/dependency-discipline/npm.md +42 -0
  209. package/dist/lite/standards/dependency-discipline/pip.md +42 -0
  210. package/dist/lite/standards/deployment-topology/ec2-tailscale.md +225 -0
  211. package/dist/lite/standards/deployment-topology.md +69 -0
  212. package/dist/lite/standards/docs-sync-allowlist.md +76 -0
  213. package/dist/lite/standards/domain-and-dns.md +145 -0
  214. package/dist/lite/standards/frontend-stack.md +67 -0
  215. package/dist/lite/standards/frontmatter-schema.md +154 -0
  216. package/dist/lite/standards/graceful-exit.md +227 -0
  217. package/dist/lite/standards/hook-idempotency.md +102 -0
  218. package/dist/lite/standards/hook-injection-discipline.md +202 -0
  219. package/dist/lite/standards/hook-install-class.md +215 -0
  220. package/dist/lite/standards/input-handler-interface.md +152 -0
  221. package/dist/lite/standards/lite-manifest-schema-changes.md +180 -0
  222. package/dist/lite/standards/lite-manifest.json +2797 -0
  223. package/dist/lite/standards/luminary-matching.md +105 -0
  224. package/dist/lite/standards/luminary-problem-patterns.md +481 -0
  225. package/dist/lite/standards/migration-discipline/active-record.md +50 -0
  226. package/dist/lite/standards/migration-discipline/alembic.md +43 -0
  227. package/dist/lite/standards/migration-discipline/gorm.md +50 -0
  228. package/dist/lite/standards/migration-discipline/prisma.md +53 -0
  229. package/dist/lite/standards/migration-discipline/sqlalchemy.md +51 -0
  230. package/dist/lite/standards/mobile-ephemeral-session.md +167 -0
  231. package/dist/lite/standards/model-routing-discipline.md +160 -0
  232. package/dist/lite/standards/ogilvy-writing-rules.md +225 -0
  233. package/dist/lite/standards/opener-discipline.md +96 -0
  234. package/dist/lite/standards/operator-facing-prose-discipline.md +201 -0
  235. package/dist/lite/standards/persona-schema.md +229 -0
  236. package/dist/lite/standards/pluggable-luminaries.md +323 -0
  237. package/dist/lite/standards/pr-body-discipline.md +115 -0
  238. package/dist/lite/standards/preview-state-schema.md +189 -0
  239. package/dist/lite/standards/project-directory-layout.md +276 -0
  240. package/dist/lite/standards/release-tagging.md +137 -0
  241. package/dist/lite/standards/reserved-skill-names.md +120 -0
  242. package/dist/lite/standards/scannable-multi-option-output.md +265 -0
  243. package/dist/lite/standards/sdlc-compliance.md +286 -0
  244. package/dist/lite/standards/sdlc-gates/typescript.md +57 -0
  245. package/dist/lite/standards/secrets-lifecycle.md +210 -0
  246. package/dist/lite/standards/security-scanner-adapter.md +145 -0
  247. package/dist/lite/standards/session-board.md +256 -0
  248. package/dist/lite/standards/skill-output-discipline.md +121 -0
  249. package/dist/lite/standards/state-spine-contract.md +255 -0
  250. package/dist/lite/standards/state-spine.md +511 -0
  251. package/dist/lite/standards/steering-hints/kiss-words.md +11 -0
  252. package/dist/lite/standards/substrate-config-schema.md +267 -0
  253. package/dist/lite/standards/tech-stack-config.md +109 -0
  254. package/dist/lite/standards/tier-dependency-analysis.md +167 -0
  255. package/dist/lite/standards/tier-runtime-deps/lite.md +57 -0
  256. package/dist/lite/standards/tier-tag-schema.md +155 -0
  257. package/dist/lite/standards/two-layer-config.md +99 -0
  258. package/dist/lite/standards/use-case-format.md +292 -0
  259. package/dist/lite/standards/user-story-invest.md +268 -0
  260. package/dist/lite/standards/velocity-and-appetite.md +229 -0
  261. package/dist/lite/standards/voice-input-pattern.md +119 -0
  262. package/dist/lite/standards/whereami-schema.md +301 -0
  263. package/dist/lite/standards/worktree-management.md +211 -0
  264. package/dist/lite/standards/writing-guide.md +213 -0
  265. package/dist/lite/templates/chronicle-template.md +75 -0
  266. package/dist/lite/templates/deferred-action-template.md +45 -0
  267. package/dist/lite/templates/memory-proposal-template.md +77 -0
  268. package/dist/lite/templates/persona-template.md +200 -0
  269. package/dist/lite/templates/pr-faq.md +45 -0
  270. package/dist/lite/templates/secret-rotation-template.md +162 -0
  271. package/dist/lite/templates/spec-template.md +131 -0
  272. package/dist/lite/templates/use-case-template.md +194 -0
  273. package/dist/lite/templates/user-story-template.md +107 -0
  274. package/dist/lite/templates/whereami-template.md +101 -0
  275. package/package.json +12 -5
@@ -0,0 +1,50 @@
1
+ ---
2
+ tier: lite
3
+ description: The GORM (Go ORM) sibling of .claude/rules/schema-management.md.
4
+ ---
5
+
6
+ # GORM — migration discipline
7
+
8
+ The GORM (Go ORM) sibling of `.claude/rules/schema-management.md`. Loads when adopter's `tech_stack.orm` is `gorm`.
9
+
10
+ ## Non-negotiable rule
11
+
12
+ **NEVER use `db.AutoMigrate()` in production.** AutoMigrate is a development convenience — in production, it silently makes additive schema changes without an audit trail and refuses to drop columns or constraints, leaving stale columns forever.
13
+
14
+ Use an explicit migration tool — `golang-migrate`, `goose`, `atlas`, or `bun`'s migration layer.
15
+
16
+ ## Workflow (with `golang-migrate`)
17
+
18
+ 1. Edit the GORM model in `models/` (struct tags carry the schema intent)
19
+ 2. Author the migration: `migrate create -ext sql -dir db/migrations -seq descriptive_name`
20
+ 3. Populate `up.sql` and `down.sql` by hand — GORM doesn't generate SQL for you
21
+ 4. Apply locally: `migrate -path db/migrations -database "$DB_URL" up`
22
+ 5. Commit both the model change AND the migration files
23
+ 6. On deploy, CI runs `migrate -path db/migrations -database "$PROD_DB_URL" up`
24
+
25
+ ## After DB reset
26
+
27
+ 1. Re-run all pending migrations: `migrate up`
28
+ 2. Run seed scripts if any
29
+
30
+ ## After merging a branch with schema changes
31
+
32
+ 1. `migrate up` — apply pending migrations
33
+ 2. Restart the Go binary — GORM model definitions are compiled in; rebuild + restart
34
+ 3. Run integration tests against the new schema
35
+
36
+ ## Drift check
37
+
38
+ `migrate version` reports the currently applied version. Compare against the highest numeric revision in `db/migrations/` directory. If they diverge, run `migrate up` before further work.
39
+
40
+ ## Common pitfalls
41
+
42
+ - **GORM struct tags drifting from migration SQL** — GORM does not enforce them; the migration SQL is source of truth for the DB shape
43
+ - **Postgres enum changes** — Postgres enums are quirky; `golang-migrate` requires custom SQL for ALTER TYPE ... ADD VALUE
44
+ - **Forgetting `down.sql`** — rollback path is mandatory; an empty down.sql is a footgun
45
+
46
+ ## Sources
47
+
48
+ - golang-migrate docs (https://github.com/golang-migrate/migrate)
49
+ - GORM docs (https://gorm.io)
50
+ - Go-ecosystem discipline ported from Prisma shape.
@@ -0,0 +1,53 @@
1
+ ---
2
+ tier: lite
3
+ description: The Prisma sibling of .claude/rules/schema-management.md.
4
+ ---
5
+
6
+ # Prisma — migration discipline
7
+
8
+ The Prisma sibling of `.claude/rules/schema-management.md`. Loads when adopter's `tech_stack.orm` is `prisma`. Preserves the operator's existing Prisma discipline verbatim.
9
+
10
+ ## Non-negotiable rule
11
+
12
+ **NEVER use `prisma db push`. Always use `prisma migrate dev`.**
13
+
14
+ `db push` applies changes without creating migration files — this causes schema drift where prod and local databases diverge silently. When the local DB is reset, unmigrated changes are lost, breaking functionality.
15
+
16
+ ## Workflow
17
+
18
+ 1. Edit `prisma/schema.prisma`
19
+ 2. Run `npx prisma migrate dev --name descriptive_name`
20
+ 3. This creates a migration file AND applies it locally
21
+ 4. Commit the migration file with the schema change
22
+ 5. On deploy, CI runs `npx prisma migrate deploy`
23
+
24
+ ## After DB reset
25
+
26
+ - `npx prisma generate` — regenerate client
27
+ - Run any seed scripts
28
+ - Test auth by signing in
29
+
30
+ ## After merging a branch with schema changes (MUST — not optional)
31
+
32
+ 1. `npx prisma generate` — regenerate client from new schema
33
+ 2. Restart dev server — cached Prisma client won't pick up new models
34
+ 3. If DB was reset: run seed scripts for new entities
35
+ 4. Verify: new model is accessible via `prisma.[model].findMany()`
36
+ 5. If the merge includes new entities: seed test data (factories, not hardcoded — see `standards/data-management.md`)
37
+
38
+ This is a **MUST gate**. Skipping `prisma generate` after a schema merge causes runtime crashes: `Cannot read properties of undefined (reading 'findMany')`. The Prisma client literally does not know the model exists.
39
+
40
+ ## Drift check
41
+
42
+ The session-start hook checks for schema drift. If detected, create the missing migration before writing code.
43
+
44
+ ```bash
45
+ npx prisma migrate status
46
+ ```
47
+
48
+ A non-zero exit indicates pending migrations that have not been applied locally — drift signal.
49
+
50
+ ## Sources
51
+
52
+ - This sibling is verbatim of the prior `.claude/rules/schema-management.md` content. Path A split (bassclef#1133 WU-5) preserves operator's discipline for the Prisma case.
53
+ - POA (sole Prisma consumer in the sunj-labs portfolio as of 2026-06-18) reads this sibling unchanged.
@@ -0,0 +1,51 @@
1
+ ---
2
+ tier: lite
3
+ description: The SQLAlchemy sibling of .claude/rules/schema-management.md.
4
+ ---
5
+
6
+ # SQLAlchemy + Alembic — migration discipline
7
+
8
+ The SQLAlchemy sibling of `.claude/rules/schema-management.md`. Loads when adopter's `tech_stack.orm` is `sqlalchemy`. For standalone Alembic (non-SQLAlchemy use), see `alembic.md`.
9
+
10
+ ## Non-negotiable rule
11
+
12
+ **NEVER edit production schema directly via `Base.metadata.create_all()` or DB-side DDL.** SQLAlchemy's autogenerate is the migration source; bypassing it ships drift.
13
+
14
+ ## Workflow (Alembic via SQLAlchemy autogen)
15
+
16
+ 1. Edit the SQLAlchemy model in `models.py` (or wherever the adopter keeps declarative bases)
17
+ 2. Generate the migration: `alembic revision --autogenerate -m "descriptive_name"`
18
+ 3. **Review the generated migration before committing** — autogen misses many cases:
19
+ - Server-side defaults (`server_default=`) are detected only with explicit `compare_server_default=True` in env.py
20
+ - Enum changes need manual handling on Postgres
21
+ - Index renames are usually drop+create (data loss risk)
22
+ - Custom types (JSONB, ARRAY) need explicit handling
23
+ 4. Apply locally: `alembic upgrade head`
24
+ 5. Commit the migration file with the model change
25
+ 6. On deploy, CI runs `alembic upgrade head` against prod
26
+
27
+ ## After merging a branch with schema changes (MUST — not optional)
28
+
29
+ 1. `alembic upgrade head` — apply pending migrations locally
30
+ 2. Restart dev server — SQLAlchemy ORM models reload from source, but DB session connections may cache stale schema metadata
31
+ 3. If DB was reset: re-run seed / fixture scripts
32
+
33
+ ## Drift check
34
+
35
+ ```bash
36
+ alembic current
37
+ alembic history --indicate-current
38
+ ```
39
+
40
+ If `alembic check` (Alembic 1.9+) reports model-vs-DB divergence, generate the missing migration.
41
+
42
+ ## Common pitfalls
43
+
44
+ - **Autogen comparing on outdated metadata** — make sure `target_metadata = Base.metadata` in `env.py` reflects the latest import path
45
+ - **Multiple heads** after parallel branches — resolve via `alembic merge` before further development
46
+ - **`alembic stamp head`** is a footgun — only use it when you know the DB is already at that state; otherwise you skip migrations silently
47
+
48
+ ## Sources
49
+
50
+ - Alembic docs (https://alembic.sqlalchemy.org/en/latest/)
51
+ - SQLAlchemy migration discipline ports the operator's Prisma rule shape to the Python ecosystem.
@@ -0,0 +1,167 @@
1
+ ---
2
+ tier: lite
3
+ description: Autonomous sessions running in ephemeral environments — claude.ai/code mobile sandbox, CI runners executing agentic work, temporary dev containers — have different state-continuity constraints than desktop sessions.
4
+ ---
5
+
6
+ # Mobile / Ephemeral Session Standard
7
+
8
+ Autonomous sessions running in ephemeral environments — claude.ai/code
9
+ mobile sandbox, CI runners executing agentic work, temporary dev
10
+ containers — have different state-continuity constraints than desktop
11
+ sessions. This standard defines what must be true for ephemeral
12
+ sessions to produce reviewable, recoverable work.
13
+
14
+ ## The core constraint
15
+
16
+ Ephemeral sandbox state is destroyed when the session ends. Any
17
+ artifact not committed AND pushed before exit is lost.
18
+
19
+ This is different from desktop: desktop auto-save commits locally and
20
+ pushes "when convenient." Ephemeral has no "later" — exit is terminal.
21
+
22
+ ## Detection
23
+
24
+ **Primary (required for certainty)**: operator sets `CLAUDE_EPHEMERAL=1`
25
+ as the first command in the session. No heuristics beat explicit
26
+ opt-in.
27
+
28
+ **Fallback heuristics** (if operator doesn't set the flag):
29
+ - `pwd` doesn't start with `/Users/`
30
+ - `hostname` doesn't match known machines
31
+ - `$HOME` isn't the operator's real home
32
+ - Tailscale CLI not installed at `/Applications/Tailscale.app/Contents/MacOS/Tailscale`
33
+ - Fresh-clone reflog (very short history)
34
+
35
+ ≥2 heuristics firing → treat as ephemeral with surfaced warning.
36
+ Single heuristic → surface but don't switch modes automatically.
37
+
38
+ **Refine over time**: after the first few mobile sessions, update
39
+ these heuristics based on actual claude.ai/code sandbox environment.
40
+
41
+ ## Rules (MUST)
42
+
43
+ ### 1. All session artifacts round-trip through git
44
+
45
+ Chronicles, handoff docs, state files, diagnosis output, decomposition
46
+ artifacts — everything MUST be committed AND pushed before the session
47
+ naturally or unnaturally ends. Auto-save hooks in ephemeral mode must
48
+ `git push` after every commit, not batch-push at exit.
49
+
50
+ ### 2. No filesystem-only markers
51
+
52
+ Desktop hooks use `/tmp/claude-verify-[branch]` and similar markers.
53
+ These are lost on sandbox death. Every filesystem marker MUST have a
54
+ git-tracked equivalent that the hook also writes and reads. When
55
+ running in ephemeral mode, the git-tracked form is authoritative.
56
+
57
+ | Desktop | Ephemeral-compatible |
58
+ |---------|---------------------|
59
+ | `/tmp/claude-verify-[branch]` | `state/markers/verify/[branch]` (git-tracked, committed by /verify) |
60
+ | Session lock at `.claude/SESSION_LOCK` | Same, but with ISO timestamp + TTL — stale locks auto-clear with ≥30min age |
61
+ | Iteration state in `.claude/iteration-state` | Committed to repo, not gitignored |
62
+ | Agent memory at `~/.claude/projects/...` | Either: (a) commit a memory export to `memory/` in repo, OR (b) accept per-session memory loss, rely on chronicles as context substitute |
63
+
64
+ ### 3. Auto-save pushes every commit
65
+
66
+ Hook must:
67
+ - Detect ephemeral mode (env var, hostname pattern, or explicit flag)
68
+ - After each auto-save commit, invoke `git push origin HEAD` with
69
+ reasonable backoff on failure
70
+ - Coalesce commits within the last 10 min to avoid thrashing git
71
+ history
72
+ - If push fails (network, auth, conflict): retry once, then log
73
+ failure visibly — operator sees it in session output
74
+
75
+ ### 4. Session-lock TTL + ephemeral-safe
76
+
77
+ Session locks must be:
78
+ - Timestamp-bearing (ISO 8601 in UTC)
79
+ - Stale-clearable (locks ≥30 min old are cleared with an announcement)
80
+ - Git-committed if ephemeral (lives in the repo so other sessions
81
+ can see it)
82
+
83
+ Stale-lock clearing rule: agent reads lock file, checks timestamp, if
84
+ age > TTL, clears lock and announces in session output. No polling;
85
+ one-shot check at session start.
86
+
87
+ ### 5. No credential-bearing tools in ephemeral
88
+
89
+ Ephemeral sessions MUST NOT carry long-lived credentials:
90
+ - No SSH keys for prod/staging boxes
91
+ - No AWS access keys
92
+ - No Tailscale auth tokens
93
+ - No long-lived PATs (use fine-grained PATs with short TTL or
94
+ GitHub App installation tokens only)
95
+
96
+ Agents in ephemeral sessions work at the git layer — clone, branch,
97
+ commit, push, open PR. Deploy work happens in CI after PR merge,
98
+ never from the ephemeral sandbox directly.
99
+
100
+ ### 6. Session-end rigor is absolute
101
+
102
+ Ephemeral sessions MUST invoke `/session-end` explicitly before exit.
103
+ Stop hook may not fire; operator may close the tab; sandbox may time
104
+ out. Relying on shutdown hooks is the failure mode. Explicit
105
+ session-end at natural stopping points is the rule.
106
+
107
+ Session-end in ephemeral mode:
108
+ 1. Write chronicle (commit + push)
109
+ 2. Update whereami if changed (commit + push)
110
+ 3. Write any LinkedIn drafts (commit + push)
111
+ 4. Confirm working tree clean
112
+ 5. Confirm HEAD matches origin
113
+ 6. Exit only after verification
114
+
115
+ ## Rules (SHOULD)
116
+
117
+ ### 7. Recent-chronicle read at session start
118
+
119
+ If project memory isn't available (no MCP memory server, no memory
120
+ repo), read the last 2-3 chronicles at session start as context
121
+ substitute. Substantial enough to recover current iteration state,
122
+ open threads, and recent decisions.
123
+
124
+ ### 8. Conservative auto-mode in ephemeral
125
+
126
+ Ephemeral sessions default to operator-gated even if orchestrator-
127
+ gated was requested. The ephemeral constraint adds risk that deserves
128
+ confirmation at decision points. Override with explicit
129
+ `orchestrator-gated --ephemeral-ok` flag.
130
+
131
+ ### 9. Recipe for "hello world" mobile session
132
+
133
+ First mobile session on any repo should be trivial: chronicle edit,
134
+ doc fix, skill tweak, README update. Not a feature build. Validates
135
+ the end-to-end loop (auth → clone → edit → commit → push → PR)
136
+ before testing anything complex.
137
+
138
+ ## Rationale
139
+
140
+ Mobile autonomous is valuable because it compresses the feedback
141
+ loop for idea-to-artifact work (operator has an insight on phone;
142
+ captures it via agent; agent produces artifact; operator reviews on
143
+ desktop). The tax is state continuity — easy to lose work to
144
+ sandbox death.
145
+
146
+ The rules here make state continuity a build-time property of the
147
+ substrate, not a run-time discipline the operator has to remember.
148
+ Every hook, every skill, every rule that already exists keeps working
149
+ as long as it respects these constraints.
150
+
151
+ ## Relationship to other standards
152
+
153
+ - `standards/substrate-config-schema.md` — no secrets in
154
+ substrate.config.md (already required); ephemeral just makes
155
+ this more critical
156
+ - `standards/deployment-topology.md` — deploy work happens in CI
157
+ post-PR, never from ephemeral session
158
+ - `.claude/rules/blocked-items.md` — BLOCKED: protocol continues to
159
+ work in ephemeral; silence is not deferral in either mode
160
+
161
+ ## Enforcement
162
+
163
+ Hook layer enforces what it can (auto-save push, marker git-tracking,
164
+ session lock TTL). Agent behavior enforces the rest (explicit
165
+ session-end, no credential tools, conservative auto-mode).
166
+ Self-test skill could validate hook configuration when run in
167
+ ephemeral mode.
@@ -0,0 +1,160 @@
1
+ ---
2
+ tier: lite
3
+ description: - ADR-021 — anchor catalog selection (cameo engine model context, now operator-internal) - bassclef#853 Sub-bet 16 + Sub-bet 19 — model routing substrate primitive - bassclef#944 — Voyage matcher excision (operator-internal pinning moved to…
4
+ ---
5
+
6
+ # Model routing discipline
7
+
8
+ ## Sources read
9
+
10
+ - ADR-021 — anchor catalog selection (cameo engine model context, now operator-internal)
11
+ - bassclef#853 Sub-bet 16 + Sub-bet 19 — model routing substrate primitive
12
+ - bassclef#944 — Voyage matcher excision (operator-internal pinning moved to bassclef-upstream)
13
+ - `.claude/agents/*.md` existing tier declarations (Opus / Sonnet / Haiku across 13 agents)
14
+ - Operator spec: provider-agnostic routing supporting 10+ providers
15
+
16
+ ## What this is
17
+
18
+ Model routing is how bassclef's agents, skills, and subagents pick which LLM to call at dispatch time. The substrate names four capability tiers — `cheap-fast`, `balanced`, `capable`, `embedding`. Each provider maps its concrete models to those tiers in `config/model-routing.yaml`.
19
+
20
+ Agents declare a tier in frontmatter. Skills can override per invocation. The substrate resolves the concrete model at dispatch time from the active provider + tier mapping.
21
+
22
+ ## Why this exists
23
+
24
+ Three problems the old shape didn't solve:
25
+
26
+ 1. Agent frontmatter pinned vendor-specific model IDs (`claude-opus-4-6`, `claude-sonnet-4-6`, `claude-haiku-4-5`). Switching providers meant editing every agent file.
27
+ 2. Adopters using OpenAI, Gemini, Bedrock, etc. couldn't reuse bassclef's agent definitions without rewriting model declarations.
28
+ 3. Per-skill or per-call model selection had no clean override path. Operator env vars worked but weren't documented.
29
+
30
+ This primitive fixes all three: agents declare a tier, not a vendor. Adopters edit `config/model-routing.yaml` to pick their provider. Per-invocation overrides cascade through a clear precedence stack.
31
+
32
+ ## The four capability tiers
33
+
34
+ | Tier | When to use |
35
+ |---|---|
36
+ | **cheap-fast** | High-frequency, low-complexity, structured output. Checklist eval, file navigation, simple extraction, automation, runbook execution. |
37
+ | **balanced** | Default for most agents. Code edits, planning, analysis, design, strategic reasoning. |
38
+ | **capable** | High-complexity reasoning, architectural decisions, problem framing, synthesis across many docs. |
39
+ | **embedding** | Vector embeddings for retrieval (semantic search, anchor matching). Not a chat model. |
40
+
41
+ Tiers describe capability, not vendor. The same tier maps to different concrete models per provider.
42
+
43
+ ### Tiers are vocabulary, not benchmark
44
+
45
+ The four tier names describe **intent**, not measured cross-provider equivalence. A `capable` model on one provider is not strictly equal to a `capable` model on another — output quality, latency, cost, and context window all vary. The tier abstraction picks the right shape of model for a workload; adopters validate the concrete mapping against their own workloads before pinning a provider.
46
+
47
+ INSTEAD of treating tiers as benchmark guarantees: read them as design intent. "Use capable" means "this work needs the strongest reasoning the provider ships." Whether that's Claude Opus, GPT-o1, Gemini 2.0 Pro, or Mistral Large 2 depends on the provider's roadmap — and on what the adopter measures against their own jobs.
48
+
49
+ This framing prevents the cross-provider semantic-equivalence misread: tiers are a coordination mechanism, not a quality contract.
50
+
51
+ ## How to declare
52
+
53
+ ### In an agent definition
54
+
55
+ ```yaml
56
+ ---
57
+ name: Closer
58
+ model_tier: cheap-fast
59
+ description: Administrative gate evaluation; checklists; retros.
60
+ ---
61
+ ```
62
+
63
+ ### In a skill (optional per-call override)
64
+
65
+ ```yaml
66
+ ---
67
+ name: example-skill
68
+ model_tier: capable # overrides invoking agent's tier
69
+ ---
70
+ ```
71
+
72
+ ### In substrate.config.md (per-repo provider default)
73
+
74
+ ```markdown
75
+ ## Model routing
76
+
77
+ # Default provider for this repo. Tier-to-model mapping comes from
78
+ # bassclef's config/model-routing.yaml unless overridden here.
79
+ model_provider: anthropic
80
+ ```
81
+
82
+ ## Override precedence
83
+
84
+ When resolving a model at dispatch, the substrate walks this stack from highest to lowest priority:
85
+
86
+ | Priority | Source | Notes |
87
+ |---|---|---|
88
+ | 1 | `CLAUDE_MODEL_OVERRIDE` env var | Direct vendor model ID; bypasses tier resolution |
89
+ | 2 | Per-invocation flag (skill arg) | `--model gpt-4o` style override |
90
+ | 3 | Skill-level `model_tier:` declaration | Skill frontmatter |
91
+ | 4 | Agent-level `model_tier:` declaration | Agent frontmatter |
92
+ | 5 | Per-repo `model_provider:` in substrate.config.md | Repo default; pairs with tier above |
93
+ | 6 | Substrate default in `config/model-routing.yaml` | `default_provider:` field |
94
+
95
+ INSTEAD of hardcoding vendor model IDs in agent definitions: declare a tier; let the resolution stack pick the concrete model. The override path stays open at every layer for genuine reasons (vendor pinning, per-call experimentation, operator emergency override).
96
+
97
+ ## How adopters extend
98
+
99
+ Adopters use any LLM provider — Anthropic, OpenAI, Google Gemini, AWS Bedrock, Azure OpenAI, Mistral, Cohere, DeepSeek, xAI, local LLaMA, or any future provider.
100
+
101
+ To add a new provider:
102
+
103
+ 1. Edit `config/model-routing.yaml`. Add a provider block under `providers:` with tier mappings.
104
+ 2. Set `default_provider:` to the new provider (or leave the default and set per-repo).
105
+ 3. The agents work unchanged.
106
+
107
+ No agent edits. No skill edits. The tier abstraction does the work.
108
+
109
+ ## What the substrate ships
110
+
111
+ `config/model-routing.yaml` ships defaults for ten providers:
112
+
113
+ - **Anthropic** — Claude family (Opus 4.7, Sonnet 4.6, Haiku 4.5)
114
+ - **OpenAI** — GPT family
115
+ - **Google Gemini** — Gemini family
116
+ - **AWS Bedrock** — Bedrock-hosted Anthropic models
117
+ - **Azure OpenAI** — Azure-hosted GPT
118
+ - **Mistral** — Mistral family
119
+ - **Cohere** — Command family + embed models
120
+ - **DeepSeek** — DeepSeek-V3 / DeepSeek-Coder
121
+ - **xAI** — Grok family
122
+ - **local-llama** — Self-hosted Llama 3
123
+
124
+ The defaults are starting points. Operator can pin specific versions, swap models within a tier, or add new providers via config edit.
125
+
126
+ ## How adopter-internal primitives reference this
127
+
128
+ Operator-internal pinning decisions (anchor catalog model choices, embedding-vendor selection) stay in `bassclef-upstream/docs/operator-private/adrs/` per Tier 1 substrate. The pins reference this routing primitive: operator-internal substrate calls `state_routing_resolve(tier='embedding', purpose='<purpose>')` which reads the operator-internal config to pick the concrete embedding model.
129
+
130
+ Adopters don't need the operator-internal pinning decisions. The substrate primitive gives them the tier abstraction; their config picks the concrete model.
131
+
132
+ ## What this primitive does NOT do
133
+
134
+ - Does not choose a tier for you. Agent definitions declare the tier.
135
+ - Does not call the LLM. The harness does that with the resolved model ID.
136
+ - Does not handle rate limits, retries, or fallbacks. Those are runtime concerns (separate primitive — see bassclef#853 Sub-bet 20 parallel-dispatch ceiling).
137
+ - Does not move secrets. Provider API keys live in `substrate.secrets.md` per `standards/secrets-lifecycle.md`. This primitive only routes between providers; the secrets layer authenticates each call.
138
+
139
+ ## Composes with
140
+
141
+ - ADR-021 — anchor catalog selection (operator-internal; references this primitive)
142
+ - ADR-023 — dependency-aware pre-flight dispatch (Sub-bet 13)
143
+ - ADR-025 — atomic write-claim (Sub-bet 9)
144
+ - bassclef#853 Sub-bet 17 — subagent isolation (different concern; both fire pre-dispatch)
145
+ - bassclef#853 Sub-bet 18 — session marker handoff (different concern; both fire pre-dispatch)
146
+ - bassclef#853 Sub-bet 20 — parallel-dispatch ceiling (caps concurrent agents per plan capacity)
147
+ - `standards/vendor-bindings.md` — this primitive is the SENTINEL_bassclef_answer to "how do we stay portable across LLM vendors"
148
+ - `standards/secrets-lifecycle.md` — provider API keys live there
149
+
150
+ ## Override path
151
+
152
+ `SKIP_MODEL_ROUTING=1 <command>` — bypasses tier resolution entirely. Logged via trace-helper. Use only when debugging a routing bug or when a one-off vendor model is needed for a specific call that isn't worth a permanent config entry.
153
+
154
+ ## Retirement condition
155
+
156
+ This primitive retires only if the harness ships a built-in tier abstraction that supersedes it. Until then, this discipline holds across all bassclef-substrate agents + skills + subagents.
157
+
158
+ ## Closes
159
+
160
+ bassclef#853 Sub-bet 16 (model routing substrate primitive) + Sub-bet 19 (provider-agnostic extension across 10+ providers).