@thebassclef/lite 0.0.1 → 0.1.0

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 (182) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +85 -4
  3. package/dist/cli.cjs +1610 -0
  4. package/dist/cli.js +1587 -0
  5. package/dist/index.cjs +4 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +4 -0
  8. package/package.json +51 -3
  9. package/substrate/.bassclef/lite-manifest.json +1794 -0
  10. package/substrate/.claude/agents/architect.md +70 -0
  11. package/substrate/.claude/agents/builder.md +114 -0
  12. package/substrate/.claude/agents/designer.md +156 -0
  13. package/substrate/.claude/agents/reviewer.md +88 -0
  14. package/substrate/.claude/hooks/artifact-ingestion-gate.sh +357 -0
  15. package/substrate/.claude/hooks/assert-verify-steering.sh +77 -0
  16. package/substrate/.claude/hooks/bassclef-source-config-validate.sh +215 -0
  17. package/substrate/.claude/hooks/bassclef-sync.sh +634 -0
  18. package/substrate/.claude/hooks/compound-noun-scrub.sh +292 -0
  19. package/substrate/.claude/hooks/kiss-expansion-inject.sh +69 -0
  20. package/substrate/.claude/hooks/plain-english-steering.sh +156 -0
  21. package/substrate/.claude/hooks/post-skill-friction-check.sh +177 -0
  22. package/substrate/.claude/hooks/post-skill-telemetry.sh +62 -0
  23. package/substrate/.claude/hooks/pre-build-gate.sh +511 -0
  24. package/substrate/.claude/hooks/pre-commit-gate.sh +452 -0
  25. package/substrate/.claude/hooks/session-end.sh +433 -0
  26. package/substrate/.claude/hooks/session-reflection.sh +303 -0
  27. package/substrate/.claude/hooks/skill-body-grade-gate.sh +219 -0
  28. package/substrate/.claude/hooks/skill-body-intent-drift.sh +107 -0
  29. package/substrate/.claude/hooks/skill-step-list-check.sh +171 -0
  30. package/substrate/.claude/hooks/state-validate.sh +271 -0
  31. package/substrate/.claude/hooks/substrate-clarity-gate.sh +1110 -0
  32. package/substrate/.claude/hooks/temperance-gate.sh +147 -0
  33. package/substrate/.claude/hooks/testing-tier-enforce.sh +233 -0
  34. package/substrate/.claude/hooks/turn-prose-grade-measure.sh +219 -0
  35. package/substrate/.claude/hooks/turn-prose-kiss-check.sh +434 -0
  36. package/substrate/.claude/hooks/vocabulary-migration-check.sh +171 -0
  37. package/substrate/.claude/hooks/whereami-utc-gate.sh +142 -0
  38. package/substrate/.claude/luminaries/alan-cooper.md +170 -0
  39. package/substrate/.claude/luminaries/alistair-cockburn.md +140 -0
  40. package/substrate/.claude/luminaries/amazon-pr-faq.md +34 -0
  41. package/substrate/.claude/luminaries/ash-maurya.md +121 -0
  42. package/substrate/.claude/luminaries/bill-buxton.md +210 -0
  43. package/substrate/.claude/luminaries/charles-sanders-peirce.md +150 -0
  44. package/substrate/.claude/luminaries/david-ogilvy.md +192 -0
  45. package/substrate/.claude/luminaries/don-norman.md +173 -0
  46. package/substrate/.claude/luminaries/edward-tufte.md +179 -0
  47. package/substrate/.claude/luminaries/eric-evans.md +160 -0
  48. package/substrate/.claude/luminaries/frederick-brooks.md +50 -0
  49. package/substrate/.claude/luminaries/gang-of-four.md +157 -0
  50. package/substrate/.claude/luminaries/jason-fried-dhh.md +46 -0
  51. package/substrate/.claude/luminaries/jesse-james-garrett.md +154 -0
  52. package/substrate/.claude/luminaries/john-ousterhout.md +94 -0
  53. package/substrate/.claude/luminaries/karl-popper.md +132 -0
  54. package/substrate/.claude/luminaries/kent-beck.md +168 -0
  55. package/substrate/.claude/luminaries/linus-torvalds.md +218 -0
  56. package/substrate/.claude/luminaries/martin-fowler.md +164 -0
  57. package/substrate/.claude/luminaries/michael-feathers.md +125 -0
  58. package/substrate/.claude/luminaries/michael-nygard.md +118 -0
  59. package/substrate/.claude/luminaries/robert-c-martin.md +164 -0
  60. package/substrate/.claude/luminaries/saltzer-schroeder.md +194 -0
  61. package/substrate/.claude/luminaries/sophia-prater.md +193 -0
  62. package/substrate/.claude/luminaries/stephen-toulmin.md +131 -0
  63. package/substrate/.claude/rules/artifact-ingestion.md +179 -0
  64. package/substrate/.claude/rules/assert-only-after-verify.md +137 -0
  65. package/substrate/.claude/rules/blocked-items.md +146 -0
  66. package/substrate/.claude/rules/branching.md +28 -0
  67. package/substrate/.claude/rules/commit-conventions.md +22 -0
  68. package/substrate/.claude/rules/context-engineering.md +202 -0
  69. package/substrate/.claude/rules/context-management.md +85 -0
  70. package/substrate/.claude/rules/destructive-operations.md +69 -0
  71. package/substrate/.claude/rules/diagnosis.md +38 -0
  72. package/substrate/.claude/rules/guardrails.md +73 -0
  73. package/substrate/.claude/rules/identifier-leak-prevention.md +104 -0
  74. package/substrate/.claude/rules/lite-manifest-schema-change-discipline.md +98 -0
  75. package/substrate/.claude/rules/oo-ad-entry-point.md +117 -0
  76. package/substrate/.claude/rules/operator-facing-prose.md +196 -0
  77. package/substrate/.claude/rules/plain-english-discipline.md +154 -0
  78. package/substrate/.claude/rules/pr-body-shape.md +317 -0
  79. package/substrate/.claude/rules/pr-strategy.md +167 -0
  80. package/substrate/.claude/rules/sdlc-gates.md +149 -0
  81. package/substrate/.claude/rules/session-artifacts.md +236 -0
  82. package/substrate/.claude/rules/state-schema-validation.md +162 -0
  83. package/substrate/.claude/rules/whereami-load-bearing.md +202 -0
  84. package/substrate/.claude/rules/writing-craft-discipline.md +92 -0
  85. package/substrate/.claude/skills/build/SKILL.md +640 -0
  86. package/substrate/.claude/skills/decompose/SKILL.md +280 -0
  87. package/substrate/.claude/skills/diagnose/SKILL.md +297 -0
  88. package/substrate/.claude/skills/howdoi/SKILL.md +105 -0
  89. package/substrate/.claude/skills/ia-model/SKILL.md +108 -0
  90. package/substrate/.claude/skills/interaction-design/SKILL.md +112 -0
  91. package/substrate/.claude/skills/interpret-input/SKILL.md +180 -0
  92. package/substrate/.claude/skills/kiss/SKILL.md +449 -0
  93. package/substrate/.claude/skills/launch/SKILL.md +924 -0
  94. package/substrate/.claude/skills/lean-canvas/SKILL.md +332 -0
  95. package/substrate/.claude/skills/longrun/SKILL.md +426 -0
  96. package/substrate/.claude/skills/luminary/SKILL.md +481 -0
  97. package/substrate/.claude/skills/ogilvy-writing-audit/SKILL.md +177 -0
  98. package/substrate/.claude/skills/onboard-repo/SKILL.md +2190 -0
  99. package/substrate/.claude/skills/pattern-review/SKILL.md +99 -0
  100. package/substrate/.claude/skills/personas/SKILL.md +207 -0
  101. package/substrate/.claude/skills/promote/SKILL.md +283 -0
  102. package/substrate/.claude/skills/requirement/SKILL.md +98 -0
  103. package/substrate/.claude/skills/retro/SKILL.md +117 -0
  104. package/substrate/.claude/skills/riff/SKILL.md +114 -0
  105. package/substrate/.claude/skills/roadmap-reconcile/SKILL.md +163 -0
  106. package/substrate/.claude/skills/session-end/SKILL.md +309 -0
  107. package/substrate/.claude/skills/session-log/SKILL.md +299 -0
  108. package/substrate/.claude/skills/skills/SKILL.md +228 -0
  109. package/substrate/.claude/skills/spec/SKILL.md +105 -0
  110. package/substrate/.claude/skills/sprint/SKILL.md +392 -0
  111. package/substrate/.claude/skills/stage/SKILL.md +384 -0
  112. package/substrate/.claude/skills/state-a-problem/SKILL.md +185 -0
  113. package/substrate/.claude/skills/temperance/SKILL.md +108 -0
  114. package/substrate/.claude/skills/use-case/SKILL.md +417 -0
  115. package/substrate/.claude/skills/user-stories/SKILL.md +268 -0
  116. package/substrate/.claude/skills/value-prop/SKILL.md +251 -0
  117. package/substrate/.claude/skills/verify/SKILL.md +160 -0
  118. package/substrate/.claude/skills/whereami/SKILL.md +307 -0
  119. package/substrate/AGENTS.md +79 -0
  120. package/substrate/CLAUDE-lite.md +85 -0
  121. package/substrate/CODE_OF_CONDUCT.md +28 -0
  122. package/substrate/CONTRIBUTING.md +177 -0
  123. package/substrate/README.md +173 -0
  124. package/substrate/SECURITY.md +19 -0
  125. package/substrate/architecture/decisions/ADR-029-release-pipeline.md +79 -0
  126. package/substrate/architecture/decisions/ADR-031-non-breaking-changes-adopter-discipline.md +139 -0
  127. package/substrate/architecture/decisions/ADR-032-adopter-sync-dispatcher-architecture.md +192 -0
  128. package/substrate/architecture/decisions/ADR-039-release-tagging-scheme.md +145 -0
  129. package/substrate/architecture/decisions/ADR-040-planning-skill-vocabulary-and-lite-profile.md +155 -0
  130. package/substrate/architecture/decisions/ADR-044-unified-skill-body-template.md +162 -0
  131. package/substrate/lib/clean-artifacts-sweep.sh +112 -0
  132. package/substrate/lib/code-comment-discipline.sh +144 -0
  133. package/substrate/lib/composer-preflight.sh +459 -0
  134. package/substrate/lib/hook-inject.sh +255 -0
  135. package/substrate/lib/luminary-pick.sh +96 -0
  136. package/substrate/lib/output-discipline.sh +143 -0
  137. package/substrate/lib/rewrite-check.sh +214 -0
  138. package/substrate/lib/state.sh +1372 -0
  139. package/substrate/lib/telemetry.sh +205 -0
  140. package/substrate/lib/tier-check.sh +138 -0
  141. package/substrate/lib/tier-dependency-audit.sh +933 -0
  142. package/substrate/presence/install/bassclef-hook-connect.sh +178 -0
  143. package/substrate/presence/install/bassclef-sync.dispatcher.template.sh +841 -0
  144. package/substrate/presence/install/bassclef-sync.template.sh +2076 -0
  145. package/substrate/presence/install/schedule-auto-save.cron.sh +88 -0
  146. package/substrate/presence/install/schedule-auto-save.taskscheduler.md +122 -0
  147. package/substrate/scripts/aggregate-telemetry.sh +217 -0
  148. package/substrate/scripts/analyze-tier-dependencies.sh +239 -0
  149. package/substrate/scripts/generate-lite-manifest.sh +489 -0
  150. package/substrate/scripts/generate-tier-manifest.sh +28 -0
  151. package/substrate/scripts/intent-drift-check.sh +456 -0
  152. package/substrate/scripts/lite-manifest-drift-check.sh +146 -0
  153. package/substrate/scripts/render-lite-manifest-doc.sh +150 -0
  154. package/substrate/standards/bassclef-configs-schema.md +232 -0
  155. package/substrate/standards/bassclef-evolution.md +143 -0
  156. package/substrate/standards/bassclef-internal-jargon.md +244 -0
  157. package/substrate/standards/bassclef-managed-sentinel.md +96 -0
  158. package/substrate/standards/bassclef-source-config.md +228 -0
  159. package/substrate/standards/deferred-actions-schema.md +204 -0
  160. package/substrate/standards/docs-sync-allowlist.md +76 -0
  161. package/substrate/standards/graceful-exit.md +227 -0
  162. package/substrate/standards/hook-idempotency.md +102 -0
  163. package/substrate/standards/lite-manifest-schema-changes.md +75 -0
  164. package/substrate/standards/luminary-problem-patterns.md +481 -0
  165. package/substrate/standards/ogilvy-writing-rules.md +225 -0
  166. package/substrate/standards/opener-discipline.md +96 -0
  167. package/substrate/standards/operator-facing-prose-discipline.md +201 -0
  168. package/substrate/standards/project-directory-layout.md +276 -0
  169. package/substrate/standards/release-tagging.md +137 -0
  170. package/substrate/standards/sdlc-compliance.md +286 -0
  171. package/substrate/standards/secrets-lifecycle.md +210 -0
  172. package/substrate/standards/security-scanner-adapter.md +145 -0
  173. package/substrate/standards/skill-output-discipline.md +90 -0
  174. package/substrate/standards/state-spine.md +511 -0
  175. package/substrate/standards/tech-stack-config.md +109 -0
  176. package/substrate/standards/tier-dependency-analysis.md +167 -0
  177. package/substrate/standards/tier-runtime-deps/lite.md +57 -0
  178. package/substrate/standards/tier-tag-schema.md +155 -0
  179. package/substrate/standards/whereami-schema.md +301 -0
  180. package/substrate/standards/writing-guide.md +213 -0
  181. package/substrate/templates/deferred-action-template.md +45 -0
  182. package/substrate/templates/whereami-template.md +101 -0
@@ -0,0 +1,146 @@
1
+ ---
2
+ tier: lite
3
+ description: "Session-start hook output may contain lines prefixed with BLOCKED:."
4
+ ---
5
+
6
+ # Blocked Items — Mandatory Resolution
7
+
8
+ Session-start hook output may contain lines prefixed with `BLOCKED:`.
9
+ These are not suggestions. They are mandatory scope.
10
+
11
+ ## Protocol
12
+
13
+ 1. **Before proposing any new work**, scan session-start output for
14
+ `BLOCKED:` lines.
15
+ 2. Each blocked item MUST be either:
16
+ - **Resolved** in this session (run the command, write the artifact), OR
17
+ - **Explicitly deferred** by the operator ("skip metrics this session")
18
+ 3. If the operator says nothing about blocked items, the default is
19
+ **resolve them**. Silence is not deferral.
20
+ 4. Propose blocked items as the FIRST items in your session plan.
21
+ New iteration work comes AFTER blocked items, not instead of them.
22
+
23
+ ## What counts as resolution
24
+
25
+ - `BLOCKED: release-notes` → run /release-notes, commit the output
26
+ - `BLOCKED: metrics` → run the metrics script, commit the output
27
+ - `BLOCKED: chronicle` → write the missing chronicle, commit
28
+ - `BLOCKED: architect-review` → run /architect-review
29
+
30
+ ## What counts as explicit deferral
31
+
32
+ The operator must say one of:
33
+ - "skip [item]" / "defer [item]" / "not this session"
34
+ - Acknowledging the item exists is NOT deferral
35
+ - "okay" or "got it" is NOT deferral — it means resolve it
36
+
37
+ ## Friction during chained dispatches (bassclef#400)
38
+
39
+ The `post-skill-friction-check.sh` hook fires on PostToolUse Skill for
40
+ major composer skills (/stage (formerly /preview), /launch (formerly /preview-build), /build, /shape full,
41
+ /longrun, /decompose, /spec, /architect-review, /interpret-input, etc.).
42
+ It classifies output:
43
+
44
+ - **Unambiguous friction** (`deferred to Phase X`, `stub return`,
45
+ `Error:`, `not yet implemented`) → log + recommend `/promote
46
+ substrate-defect` inline. Don't defer to closeout; file at the
47
+ boundary.
48
+ - **Borderline friction** (`Lorem ipsum`, `XXX`, `FIXME`, partial
49
+ output) → log only; operator triages on return.
50
+ - **No friction** → silent.
51
+
52
+ The friction log lives at `docs/session-friction-log.md`. Operators
53
+ returning from unattended runs read the log first; promote what's
54
+ worth promoting.
55
+
56
+ Per-skill opt-out: add `disable_friction_check: true` to skill
57
+ frontmatter (rare; for skills whose stub returns are intended).
58
+ Per-call override: `SKIP_FRICTION_CHECK=1 <command>` (logged).
59
+
60
+ ## When resolution reveals a substrate defect
61
+
62
+ Sometimes resolving a BLOCKED item surfaces the real cause: the hook's
63
+ detection path is wrong, a state file rotted, a marker format changed,
64
+ or the compliance calculation reads a location the writer stopped
65
+ using. The nominal work was done; the signal kept firing because the
66
+ mechanism is broken.
67
+
68
+ When this happens, resolution MUST include firing `/promote` with the
69
+ `substrate-defect` classifier. Fix the local instance AND promote the
70
+ mechanism fix — otherwise every consumer repo keeps hitting the same
71
+ broken hook.
72
+
73
+ ### Trigger (any of)
74
+
75
+ 1. **Stuck signal resolved** — the signal was stuck per
76
+ `stuck-signal-diagnostic.md`, mechanism-read found a defect, defect
77
+ is now fixed. `/promote` fires automatically on this path.
78
+ 2. **Hook false-positive** — the banner fired even though the
79
+ underlying work was already done, and the fix was editing the hook,
80
+ not doing the work.
81
+ 3. **Counter miscount** — the number in the banner was wrong
82
+ (off-by-one, wrong window, stale cache), and the fix was editing
83
+ the counting mechanism.
84
+ 4. **Marker location rot** — a gate marker was written to a path the
85
+ reader no longer checks (e.g., `/tmp` sandbox teardown), and the
86
+ fix was dual-writing or relocating the marker.
87
+
88
+ ### Protocol
89
+
90
+ 1. **Resolve the local instance.** Land the substrate edit (hook fix,
91
+ rule update, path correction) in the current branch.
92
+ 2. **Fire `/promote`** — use the substrate-defect template in
93
+ `promote/SKILL.md`. The /promote issue cites:
94
+ - Signal observed (banner text + chronicle dates showing the loop)
95
+ - Mechanism file read (path + what was wrong)
96
+ - Fix applied (PR or commit ref)
97
+ - Propagation requirement (which consumer repos inherit; what
98
+ breaks if they don't pick up the fix)
99
+ 3. **Classify** as `agent-self-proposed` + `substrate-defect` (see
100
+ `promote/SKILL.md` label table). These don't need operator prompt —
101
+ agent-discovered defects file automatically because the trigger
102
+ condition (stuck signal + mechanism fix) is unambiguous.
103
+ 4. **Cite in the session's chronicle** with explicit "substrate defect
104
+ promoted: #NNN" line so retrospectives can audit the promotion
105
+ path worked.
106
+
107
+ ### Why mandatory (not MUST-try)
108
+
109
+ `bassclef-evolution.md` already describes /promote as the promotion
110
+ path. The gap being closed: when an agent finds a substrate defect
111
+ mid-session and fixes only the local instance, the decision to
112
+ promote becomes "nice to have" and rots. Three sessions in April 2026
113
+ fixed local substrate drift without firing /promote; the same drift
114
+ resurfaced in consumer repos two weeks later (POA inherited broken
115
+ hook paths).
116
+
117
+ Making /promote mandatory on the `resolution-revealed-defect` branch
118
+ removes the decision. The agent doesn't choose whether to promote;
119
+ the trigger fires it.
120
+
121
+ ### What doesn't trigger /promote
122
+
123
+ - BLOCKED items resolved by doing the nominal work (running
124
+ `/release-notes`, writing the chronicle) — the mechanism was fine,
125
+ the work just wasn't done. No defect to promote.
126
+ - Operator-overridden deferrals — the operator chose to skip; no
127
+ mechanism analysis happened.
128
+ - One-off bugs in the agent's session (typo in commit message,
129
+ missed file) — those aren't substrate.
130
+
131
+ The trigger is specifically "mechanism was broken, mechanism got
132
+ fixed" — not "work was slow, work got faster."
133
+
134
+ ## Why this rule exists
135
+
136
+ Agents consistently acknowledge hook warnings and then skip them.
137
+ Three instances in 6 weeks: DORA metrics, metrics dashboard, release
138
+ notes. The hook detects the problem correctly — the agent chooses to
139
+ ignore it. This rule removes that choice.
140
+
141
+ ## Infrastructure note
142
+
143
+ This is a methodology rule, not a hook. It works regardless of whether
144
+ enforcement comes from bash hooks, Managed Agents outcome preconditions,
145
+ or any other infrastructure. The hook produces the signal; this rule
146
+ defines the response.
@@ -0,0 +1,28 @@
1
+ ---
2
+ tier: lite
3
+ globs: ["*"]
4
+ description: Trunk-based development — branch naming and flow
5
+ ---
6
+
7
+ Model: trunk-based development (solo variant). `main` is always deployable.
8
+
9
+ Branch naming:
10
+ - `feature/ISSUE-NNN-short-description`
11
+ - `fix/ISSUE-NNN-short-description`
12
+ - `spike/ISSUE-NNN-short-description`
13
+
14
+ Every branch ties to a GitHub Issue. No branch without an issue.
15
+
16
+ Flow: issue → branch from main → work → PR → CI passes → squash merge → delete branch
17
+
18
+ Rules:
19
+ - Broken main = drop everything
20
+ - No branches older than 5 days — break it up
21
+ - Force push on feature branches is fine, never on main
22
+ - Semantic versioning tags for releases: v0.1.0, v0.2.0
23
+
24
+ Multi-branch work (autonomous/multi-step sessions):
25
+ - See `standards/branch-stacking.md` for stacked atomic branches
26
+ - Stack manifest declares branches, dependencies, parallel-safety
27
+ - Naming: `feature/ISSUE-NNN-stack-N-short-description`
28
+ - Each branch is independently reviewable and revertable
@@ -0,0 +1,22 @@
1
+ ---
2
+ tier: lite
3
+ globs: ["*"]
4
+ description: Commit message format — Conventional Commits
5
+ ---
6
+
7
+ Format: `<type>: <description>`
8
+
9
+ Types: feat, fix, docs, refactor, test, ci, chore, security
10
+
11
+ Rules:
12
+ - Imperative mood, lowercase, no period, max 72 chars
13
+ - Body: explain WHY not what — the diff shows what
14
+ - Footer: `Closes #NNN` or `Ref #NNN`
15
+ - PR titles become squash commit messages — make them clean
16
+ - One commit per PR on main (squash merge)
17
+
18
+ ## Forbidden prefixes
19
+
20
+ Don't use `substrate-defect:` as a prefix. INSTEAD: use `fix:` per the type list above. Substrate bugs are bugs — the bassclef-internal `substrate-defect:` prefix duplicates the conventional `fix:` category without adding signal. See bassclef#1241 § "Wordlist amendment from 2026-06-19 dispatch session" for the decision.
21
+
22
+ Don't invent one-off prefixes outside the 8 types listed above. INSTEAD: request additions via `/promote bassclef-evolution` so the type list grows by amendment rather than drift.
@@ -0,0 +1,202 @@
1
+ ---
2
+ tier: lite
3
+ description: The single most leverage-y discipline in bassclef.
4
+ ---
5
+
6
+ # Context Engineering
7
+
8
+ The single most leverage-y discipline in bassclef.
9
+
10
+ When you write a skill, rule, hook, luminary, or agent definition, you
11
+ are writing instructions for a model that has specific epistemic
12
+ constraints. The model can only act on information physically present
13
+ in its current context window. Cross-session memory, knowledge of
14
+ past generations, imagined norms, and unstated operator intent are
15
+ NOT accessible.
16
+
17
+ Every instruction must be actionable from information the agent has
18
+ in this conversation. If the instruction depends on information the
19
+ model can't see, it is a no-op at best, a footgun at worst.
20
+
21
+ ## Sources read
22
+
23
+ Four anchors. Read them; this rule is the bassclef-substrate
24
+ distillation, not a substitute.
25
+
26
+ - **Andrej Karpathy — context engineering** ([X post, June 2025](https://x.com/karpathy/status/1937902205765607626)). The CPU/RAM mental model: "LLM is the CPU, context window is RAM." Reframes prompts as filling a finite working-memory buffer.
27
+ - **Simon Willison — stateless tool framing** ([Mastodon thread](https://fedi.simonwillison.net/@simon/114757992443676572)). Endorsed and popularized "context engineering"; recurring theme in his blog: every conversation starts cold, training-cutoff dates are load-bearing, the model knows what it knows only via what's in the prompt.
28
+ - **Anthropic — Effective context engineering for AI agents** ([anthropic.com/engineering](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents)). The model vendor's own articulation. Covers context window management, persistence patterns, tool design for agents. The **INSTEAD-block** specificity pattern is one application: every "DON'T do X" instruction needs a paired "INSTEAD do Y" the model can verify in its current context.
29
+
30
+ For the broader 30-year canon of influences across distributed systems, methodology, strategy canvases, JTBD, use-case design, TDD, and rapid prototyping that bassclef embeds, see [`docs/philosophy.md`](../../docs/philosophy.md).
31
+
32
+ ## What the model has access to
33
+
34
+ - Current conversation history (this session only)
35
+ - Files in working directory (only when explicitly Read)
36
+ - Tool results (when tools fire and return)
37
+ - System prompt + loaded rules (whatever the harness injects, including the contents of `.claude/rules/` via `additionalDirectories`)
38
+ - Memory directory (only if memory file is read this conversation)
39
+
40
+ ## What the model does NOT have access to
41
+
42
+ - Previous conversations (unless that conversation's chronicle is loaded)
43
+ - Prior generations of the same prompt (unless surfaced as text in current context)
44
+ - What other agents are doing in parallel sessions (without state-spine reads)
45
+ - Imagined "norms" or "averages" — the model can't compare against itself
46
+ - Operator intent beyond what's been typed in this conversation
47
+ - Prior commits / git log (without an explicit `git log` tool call)
48
+ - Time / date awareness (the harness must surface today's date)
49
+
50
+ ## The INSTEAD-block pattern
51
+
52
+ The rule's mechanical output, derived from Anthropic's context-engineering
53
+ treatment. Every "NEVER" / "DON'T" / "AVOID" instruction is paired with an
54
+ actionable substitute the model can verify in its current context.
55
+
56
+ **Anti-pattern (unactionable):**
57
+
58
+ ```
59
+ NEVER converge on common choices across generations.
60
+ ```
61
+
62
+ → Claude can't see other generations. Instruction has no in-context
63
+ referent. No-op.
64
+
65
+ **INSTEAD-block (actionable):**
66
+
67
+ ```
68
+ INSTEAD: For each generation, deliberately commit to one bold
69
+ direction from this list: [bold/saturated, moody/restrained,
70
+ high-contrast/minimal, lo-fi/zine, handcrafted]. Pick a different
71
+ direction than the obvious default for the input.
72
+ ```
73
+
74
+ → Model has the list in current context. Can pick. Actionable.
75
+
76
+ **Format for bassclef instructions:**
77
+
78
+ When writing a skill/rule/luminary, every "NEVER" / "DON'T" / "AVOID"
79
+ gets paired:
80
+
81
+ ```
82
+ NEVER do X.
83
+ INSTEAD: <specific in-context action that produces the desired outcome>.
84
+ ```
85
+
86
+ If you can't write the INSTEAD substitute, the original NEVER was
87
+ unactionable — rewrite the whole instruction.
88
+
89
+ ## How bassclef operationalizes context engineering
90
+
91
+ This is what bassclef IS. Every load-bearing component exists
92
+ because the model is stateless. Map:
93
+
94
+ | Stateless problem | Bassclef's answer |
95
+ |---|---|
96
+ | Agent forgets prior conversations | Chronicles (narrative log; written at session-end, read at session-start) |
97
+ | Agent forgets project state | whereami (point-in-time snapshot; MUST-read at session start) |
98
+ | Agent forgets goal scope | Iteration-bets (scope contract; MUST-read at iteration start) |
99
+ | Parallel agents share no memory | State spine v0 (`lib/state.sh` accessors over JSON-on-git; flock-protected) |
100
+ | Agent can't see prior generations | Champion-challenger pattern (alternative variants surfaced in same context) |
101
+ | Gate evidence rots between sessions | Markers (`state/markers/` files; agent reads them, doesn't remember firing) |
102
+ | Operator preferences drift | Memory system (`memory/` files; MEMORY.md index loaded each conversation) |
103
+ | Recent decisions get lost | "Sources read" block (every artifact MUST cite what was Read) |
104
+ | Compaction kills context | Survival kit (explicit re-read paths after compaction per `context-management.md`) |
105
+ | Composer drifts from components | Section-heading contracts (bassclef#367 — pinned exact strings) |
106
+ | Builder drifts from intent | Iteration-bet-brief-completeness rule (every artifact in handoff brief) |
107
+
108
+ Without statelessness as the constraint, none of these would exist.
109
+ That's not a feature — it's the substrate's purpose.
110
+
111
+ ## How to apply this rule
112
+
113
+ ### When writing a skill
114
+
115
+ Ask, for every instruction:
116
+ 1. Does this reference information the model has in current context?
117
+ 2. If it references state that needs to be loaded — am I telling the model HOW to load it (Read X, run Y)?
118
+ 3. If it has a "DON'T" — is there an INSTEAD-block?
119
+ 4. Does it assume the model remembers something? If yes, am I providing the memory file path or instructing a Read?
120
+
121
+ ### When writing a rule
122
+
123
+ Same checks plus:
124
+ - Will this rule be loaded automatically (`additionalDirectories`)? If yes, the model has the rule body in context every conversation.
125
+ - Or is it referenced by file path? If yes, I must explicitly tell the agent to Read it.
126
+
127
+ ### When writing a luminary
128
+
129
+ The luminary file becomes context if invoked via `/luminary <slug>` or referenced in a skill that Reads it. Every "channel this luminary's discipline" instruction must produce concrete in-context actions, not aspirational adjectives.
130
+
131
+ ### When writing a hook
132
+
133
+ Hooks fire at specific events and inject text into the agent's
134
+ session output. The injected text IS context the model now has.
135
+ Don't tell the model "remember this for next time."
136
+ INSTEAD: write to a state file the next session reads.
137
+
138
+ ## What this rule does NOT cover
139
+
140
+ - Cognitive-science research on "Theory of Mind in LLMs" (Kosinski, Bos et al.). That research tests whether LLMs *model human minds* — opposite direction from this rule. Cite this rule as "context engineering" (industry standard term) when discussing externally.
141
+ - Tool design for agents (Anthropic's doc covers this in depth)
142
+ - Memory systems beyond what bassclef implements
143
+
144
+ ## Common violations to grep for
145
+
146
+ - `"don't repeat"` / `"don't drift"` / `"avoid converging"` — without INSTEAD substitutes
147
+ - `"remember to"` / `"keep in mind"` — model has no persistence; you mean "Read X first" or "check Y"
148
+ - `"based on prior sessions"` — the model can't see them; you must instruct chronicle Reads
149
+ - `"the way you usually do"` — there is no usually; pin the specific pattern
150
+ - `"use your judgment"` — what context does the model judge against? Specify or remove
151
+
152
+ If `git grep -niE 'don.?t|never|avoid|remember to|keep in mind' .claude/skills .claude/rules .claude/luminaries` surfaces matches, audit each for INSTEAD-block discipline.
153
+
154
+ ## Relationship to other rules
155
+
156
+ - `artifact-ingestion.md` — concrete instance of context engineering (Read before producing)
157
+ - `iteration-bet-brief-completeness.md` — concrete instance (every artifact in brief, because receiver has no other state)
158
+ - `mobile-ephemeral-session.md` — context engineering under the most extreme stateless conditions
159
+ - `context-management.md` — operational guidance for context-window budgeting (companion at the runtime layer)
160
+ - `bassclef#357` (autonomous-run flash + kiss) — output-side discipline; this rule is the input-side discipline
161
+ - `bassclef#367` (section-heading standardization) — concrete instance of "if the parser greps for X, X must be in the producer's output")
162
+ - `bassclef#382` (substrate-clarity-gate hook) — mechanical enforcement of skill-description clarity + rule/luminary INSTEAD-block discipline; closes the methodology+mechanism gap (rules prescribe; hook fires at PreToolUse Edit|Write)
163
+
164
+ ## Why this rule is the highest-leverage rule we have
165
+
166
+ Most rules govern WHAT the agent should do (gates, checks, ceremonies). This rule governs HOW WE WRITE every other artifact. Meta-rule.
167
+
168
+ Every future skill, rule, luminary, hook, and agent definition we add
169
+ or modify is improved by this lens. Every existing artifact we audit
170
+ against this lens is a candidate for cleanup.
171
+
172
+ That's the leverage: one rule, applied retroactively + prospectively
173
+ to the entire substrate.
174
+
175
+ ## Audit cadence
176
+
177
+ - **Every new artifact** must pass the INSTEAD-block check before merge (PR-time gate, methodology-level)
178
+ - **Quarterly substrate audit** — sample 10 artifacts at random, score against this rule, file findings
179
+ - **Every `/promote`** — the promoting session checks the candidate against this rule before filing the issue
180
+
181
+ ## What this rule will NOT fix
182
+
183
+ - Genuinely smart-but-vague creative direction ("make it beautiful") — context engineering catches *unactionable* instructions; whether the actionable substitute is *good* is a separate quality question handled by luminary-driven design + visual-review
184
+ - Hook bugs (mechanical) — context engineering is methodology; hooks are mechanical enforcement
185
+ - Operator-side ambiguity — if the operator's request is unclear, no amount of model-context discipline fixes it; that's a clarification gate
186
+
187
+ ## Override
188
+
189
+ There is no override. Context engineering is the model's actual
190
+ constraint, not a discipline we choose to follow. Violating it
191
+ produces drift (silent or noisy), not "exceptional cases."
192
+
193
+ If a rule or skill seems to require a context-engineering violation,
194
+ the rule or skill is wrong. Rewrite.
195
+
196
+ ## Closes
197
+
198
+ Filed in iteration-bet 2026-05-01-context-engineering-foundations
199
+ (WU-1). First load-bearing application: WU-2 (Anthropic-frontend-
200
+ design luminary written with INSTEAD discipline) + WU-5 (skill-
201
+ description-clarity rule embeds the same pattern at the
202
+ description-surface).
@@ -0,0 +1,85 @@
1
+ ---
2
+ tier: lite
3
+ globs: ["*"]
4
+ description: Context window management — thresholds, compaction strategy, survival kit
5
+ ---
6
+
7
+ # Context Management
8
+
9
+ Long sessions will hit context limits. This is expected, not a failure.
10
+ Manage proactively.
11
+
12
+ INSTEAD of waiting for compaction to surprise you: checkpoint at 70%
13
+ context (commit work, write whereami, let compaction run). Re-read the
14
+ survival kit after compaction.
15
+
16
+ ## Thresholds
17
+
18
+ | Context level | Action |
19
+ |--------------|--------|
20
+ | 0–50% | Normal operation. Read files freely. |
21
+ | 50–70% | Be selective. INSTEAD of full file reads: use Glob/Grep with bounded result sets. Skip re-reading files already in current context. |
22
+ | 70% | **Checkpoint now.** Commit all work. Write whereami. The system will auto-compact prior messages. After compaction, re-read the survival kit. |
23
+ | 80%+ | **Atomic tasks only.** Complete current task, commit, re-read survival kit. Do not start multi-file changes. |
24
+ | 90% | **Finish and stop.** Complete the current atomic unit, commit, update whereami. Write chronicle if at a phase boundary. |
25
+
26
+ ## Survival kit (re-read after ANY compaction)
27
+
28
+ The survival kit mirrors what `iteration-bet-brief-completeness.md`
29
+ requires in a Builder/Designer/Architect handoff brief — same artifact
30
+ list, one source of truth. Post-compaction re-read is functionally
31
+ identical to a fresh role handoff: the agent needs the same context to
32
+ continue the goal correctly.
33
+
34
+ **Always re-read:**
35
+
36
+ 1. **Iteration bet** — scope, phase, time budget, acceptance criteria, references block
37
+ 2. **Phase-state** — where we are, what's done, what's next
38
+ 3. **MUST gates** — sdlc-gates rule + choreography Section 9
39
+ 4. **Current agent definition** — role-specific obligations (if multi-agent)
40
+
41
+ **Re-read when the goal's References cite them (per scope):**
42
+
43
+ 5. **Canvas** — upstream thesis; re-read when spec is thin or scope is
44
+ product-facing
45
+ 6. **Current spec or decomposition artifact** — what's being built; the
46
+ `/decompose` output carries cross-cutting-concern resolution
47
+ (interfaces, decorators) that must survive compaction or the
48
+ Langfuse-inside-HaikuImputer anti-pattern reproduces
49
+ 7. **Prototypes** — every prototype path the goal cites; losing these
50
+ reproduces the cramped-UI-rebuild failure mode
51
+ 8. **Pinned ADRs** — architecture constraints the goal calls governing
52
+ 9. **Luminary map** — primary pair + extended pairs for surfaces in scope
53
+ 10. **Branch stack manifest** — if in Construction with stacked branches
54
+ 11. **Risk register (active iteration)** — so mitigations aren't re-forgotten
55
+
56
+ What you do NOT need to re-read: the 24 bassclef rules, standards in
57
+ `standards/`, and agent choreography. Those inherit via
58
+ `additionalDirectories` and are injected fresh each turn — compaction
59
+ does not drop them.
60
+
61
+ If you can't recall what you're building, what gates apply, or which
62
+ prototypes/ADRs/luminaries govern the work, you've lost critical
63
+ context. Re-read before continuing.
64
+
65
+ ## Anti-patterns
66
+
67
+ - **Don't read entire large files** when you only need a section.
68
+ INSTEAD: use Read with offset/limit, or grep for the section header first.
69
+ - **Don't re-read files** already in the conversation.
70
+ INSTEAD: check whether the file content is already in your context window.
71
+ - **Don't expand search results** you don't need.
72
+ INSTEAD: use head_limit on Grep to cap the result set.
73
+ - **Don't keep retrying** failed approaches — each retry consumes context.
74
+ INSTEAD: diagnose first (Is/Is Not + Five Whys), then fix.
75
+
76
+ ## Sequential mode specifics
77
+
78
+ In sequential autonomous mode, one session plays all roles. Context
79
+ pressure is highest during Construction after Inception and Elaboration
80
+ have consumed context. At each role transition:
81
+
82
+ 1. Commit all artifacts from the current role
83
+ 2. The handoff artifact IS the context for the next role
84
+ 3. Let compaction run
85
+ 4. Re-read survival kit + next agent definition
@@ -0,0 +1,69 @@
1
+ ---
2
+ tier: lite
3
+ description: The destructive-command-guard hook catches known patterns mechanically.
4
+ ---
5
+
6
+ # Destructive Operations — Agent Self-Assessment
7
+
8
+ The destructive-command-guard hook catches known patterns mechanically.
9
+ This rule is the primary gate — your judgment catches what grep cannot.
10
+
11
+ ## Before ANY command that modifies state outside the working directory
12
+
13
+ Pause and ask three questions:
14
+
15
+ 1. **ROOT CAUSE** — What specific problem requires this action?
16
+ Not "it's broken." What exactly is wrong? Can you name the error?
17
+
18
+ 2. **SIMPLER FIX** — Is there a targeted alternative that avoids destruction?
19
+ The simplest fix is almost never the most destructive one.
20
+
21
+ 3. **RECOVERY** — If this goes wrong, can you undo it?
22
+
23
+ ## What counts as "outside the working directory"
24
+
25
+ - **Databases**: any SQL command, Prisma operation, Redis command, Mongo operation
26
+ - **Containers**: Docker, Kubernetes, compose operations that modify state
27
+ - **Cloud infra**: AWS, GCP, Azure, Terraform, Pulumi operations
28
+ - **Package registries**: npm publish, unpublish, deprecate
29
+ - **Caches**: Redis FLUSHALL, CDN invalidation, build cache clearing
30
+ - **Services**: process kills, daemon restarts, cron modifications
31
+ - **Auth/secrets**: key rotation, token revocation, permission changes
32
+ - **DNS/networking**: record changes, firewall rules, proxy config
33
+
34
+ ## The hook catches these mechanically
35
+
36
+ Destructive verbs: reset, drop, delete, destroy, purge, prune, wipe,
37
+ clean, truncate, flush, drain, evict, overwrite, revert, rollback,
38
+ format, erase, clear, demolish, discard, abort, terminate, revoke,
39
+ invalidate, expire, uninstall, deregister, detach
40
+
41
+ Force flags: --force, --hard, -f, -rf, --yes, --no-verify
42
+
43
+ Amplifiers: CASCADE, --all, --volumes, -r, --recursive, system
44
+
45
+ ## You catch what the hook cannot
46
+
47
+ The hook is grep. It doesn't understand semantics. These are destructive
48
+ but won't trigger the hook:
49
+
50
+ - `redis-cli FLUSHALL` — "FLUSHALL" is now caught, but `redis-cli SET key ""` (overwriting data) is not
51
+ - `kubectl apply -f destroy-everything.yaml` — "apply" is not destructive, the file is
52
+ - `curl -X DELETE https://api.example.com/users` — HTTP DELETE is semantic
53
+ - `psql -c "UPDATE users SET role = 'admin'"` — UPDATE isn't a destructive verb but this is dangerous
54
+ - `echo "" > important-config.yaml` — echo and redirect, not a destructive verb
55
+ - Piping data to a command that overwrites: `cat /dev/null > database.db`
56
+ - Any SDK/API call that modifies production state
57
+
58
+ **Your responsibility**: if the command modifies state that can't be
59
+ trivially recreated, pause and answer the three questions. Don't wait
60
+ for the hook. The hook is the safety net. You are the primary gate.
61
+
62
+ ## Severity guide
63
+
64
+ | Signal | Action |
65
+ |--------|--------|
66
+ | Modifies local dev data | Pause, assess, proceed if justified |
67
+ | Modifies shared/staging state | Pause, assess, confirm with operator |
68
+ | Modifies production state | **STOP. Always require explicit human approval.** |
69
+ | Irreversible at any level | Pause, verify backup exists, confirm with operator |
@@ -0,0 +1,38 @@
1
+ ---
2
+ tier: lite
3
+ globs: ["*"]
4
+ description: Three-step diagnosis before writing any fix
5
+ ---
6
+
7
+ When a failure's cause is not immediately obvious, run diagnosis BEFORE writing any fix.
8
+
9
+ Step 0 — Reproduce (RED anchor):
10
+ State the minimum repro command / URL / action that triggers the failure.
11
+ State observed vs expected. State environment. State reproducibility
12
+ (every time / intermittent / unable).
13
+
14
+ Without a repro, "I fixed it" has no counterpart "here's the thing it's not
15
+ doing anymore." The repro is the surface every subsequent step operates on.
16
+
17
+ Step 1 — Is/Is Not (2 min):
18
+ Fill the table. What specific thing fails? What similar thing works?
19
+ This constrains the hypothesis space before touching code.
20
+
21
+ Step 2 — Five Whys:
22
+ Trace to something changeable that prevents the CLASS of failure, not just this instance.
23
+ A timeout is a symptom. Missing observability is a root cause.
24
+
25
+ Step 3 — Hypothesis + Test:
26
+ One sentence hypothesis. Minimum falsifiable check (a test, a log, a query).
27
+
28
+ Output: diagnosis comment on the ticket BEFORE opening a fix PR.
29
+
30
+ Skip criteria (all steps):
31
+
32
+ Skip full diagnosis ONLY when cause is immediately obvious and reproducible:
33
+ typo, missing env var, off-by-one. In these cases the repro is implicit in
34
+ the code change itself; state "Step 0 skipped — [reason]" in output.
35
+ Silence is not skip.
36
+
37
+ When in doubt, run it. Step 0 repro is cheap; the "unable to reproduce"
38
+ escalation is itself valuable signal.
@@ -0,0 +1,73 @@
1
+ ---
2
+ tier: lite
3
+ globs: ["*"]
4
+ description: Agent guardrails — behavior boundaries, escalation rules, capability ceilings for autonomous operation
5
+ ---
6
+
7
+ # Agent Guardrails
8
+
9
+ Formal behavior boundaries for autonomous agents. These are hard constraints,
10
+ not guidelines.
11
+
12
+ ## What agents must NEVER do
13
+ - Push to main without PR review
14
+ - Delete data in production databases
15
+ - Deploy to production without human approval — even in orchestrator-gated mode. This is the hardest guardrail. No exceptions.
16
+ - Deploy to any environment not configured in substrate.config.md deploy_targets
17
+ - Modify auth/security middleware without human approval
18
+ - Expand scope beyond the declared time budget
19
+ - Skip a hard gate (Inception → Elaboration → Construction → Transition)
20
+ - Self-report gate compliance without evidence artifacts
21
+ - Override another agent's decision authority (e.g., Builder overriding Architect on ADRs)
22
+ - Send external communications (emails, Slack, webhooks) without human approval
23
+ - Modify CI/CD pipeline configuration without human approval
24
+ - Create or delete GitHub repos, branches on main, or release tags
25
+
26
+ ## What agents must ALWAYS do
27
+ - Save state before ending (commit, push, LAST_SAVE)
28
+ - Write a chronicle entry at session end
29
+ - Run /temperance before non-trivial implementation
30
+ - Run /verify after each task before committing
31
+ - Flag ambiguity rather than proceeding with assumptions
32
+ - Produce a substrate artifact at every handoff
33
+ - Reference the iteration goal when starting work
34
+ - Check the risk register at iteration start
35
+
36
+ ## Escalation rules
37
+ - Builder → Architect for ADR questions
38
+ - Builder → PM for scope questions
39
+ - Builder → Designer for UX questions
40
+ - Any agent → Orchestrator for sequencing disputes
41
+ - Any agent → Human for: scope expansion, security changes, external communications, budget overruns
42
+
43
+ ## Capability ceilings by role
44
+ - Reviewer: read-only. Cannot modify code.
45
+ - Shaper: cannot implement or deploy.
46
+ - PM: cannot implement or architect.
47
+ - Designer: cannot implement. Validates only.
48
+ - Creative Director: cannot implement. Directs only.
49
+ - Architect: cannot implement in Construction. Designs only.
50
+ - Builder: cannot override ADRs. Implements within constraints.
51
+ - Deployer: cannot write application code. Ships only.
52
+ - Closer: cannot build. Documents and closes only.
53
+ - Orchestrator: cannot override any role's decision authority. Coordinates only.
54
+
55
+ ## Graceful exit conditions
56
+
57
+ See `standards/graceful-exit.md` for the full exit protocol, checkpoint format,
58
+ checkpoint triggers, and recovery procedure.
59
+
60
+ Summary of conditions (full protocol in the standard):
61
+ - Time budget exhausted → save state, write checkpoint, report progress, end
62
+ - Budget limit reached → save state, write checkpoint, report, end
63
+ - Ambiguity unresolvable without human → save state, write checkpoint, escalate, end
64
+ - Blocked by external dependency → save state, log blocker in checkpoint, end
65
+ - Error after 3 diagnosis attempts → save state, write checkpoint, escalate, end
66
+ - User interrupts → save state immediately, write checkpoint
67
+ - Context pressure ≥ 70% → write checkpoint, let compaction run, re-read survival kit
68
+
69
+ ## Agent identity in artifacts
70
+ - Every commit by an autonomous agent includes the agent role in the message
71
+ - Every PR created by an agent is labeled with the agent role
72
+ - Chronicle entries note which agent(s) were active
73
+ - This enables audit: who did what, with what authority