@thebassclef/lite 0.1.3 → 1.0.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.
- package/dist/cli.cjs +216 -137
- package/dist/cli.js +218 -139
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lite/.bassclef-source.json +10 -0
- package/dist/lite/.claude/settings.json +212 -0
- package/dist/lite/CLAUDE.md +41 -0
- package/dist/lite/gitignore +58 -0
- package/dist/lite/standards/bassclef-wiring-manifest.json +497 -0
- package/dist/lite/whereami.md +24 -0
- package/package.json +8 -2
- package/substrate/.bassclef/lite-manifest.json +0 -2701
- package/substrate/.claude/agents/architect.md +0 -70
- package/substrate/.claude/agents/builder.md +0 -114
- package/substrate/.claude/agents/designer.md +0 -156
- package/substrate/.claude/agents/reviewer.md +0 -88
- package/substrate/.claude/hooks/artifact-ingestion-gate.sh +0 -357
- package/substrate/.claude/hooks/assert-verify-steering.sh +0 -77
- package/substrate/.claude/hooks/bassclef-source-config-validate.sh +0 -215
- package/substrate/.claude/hooks/bassclef-sync.sh +0 -634
- package/substrate/.claude/hooks/compound-noun-scrub.sh +0 -292
- package/substrate/.claude/hooks/kiss-expansion-inject.sh +0 -69
- package/substrate/.claude/hooks/longrun-prep-compounding-axis-check.sh +0 -492
- package/substrate/.claude/hooks/longrun-prep-compounding-sequence-check.sh +0 -492
- package/substrate/.claude/hooks/plain-english-steering.sh +0 -156
- package/substrate/.claude/hooks/post-skill-friction-check.sh +0 -177
- package/substrate/.claude/hooks/post-skill-telemetry.sh +0 -62
- package/substrate/.claude/hooks/pre-build-gate.sh +0 -511
- package/substrate/.claude/hooks/pre-commit-gate.sh +0 -451
- package/substrate/.claude/hooks/session-end.sh +0 -433
- package/substrate/.claude/hooks/session-reflection.sh +0 -303
- package/substrate/.claude/hooks/skill-body-grade-gate.sh +0 -219
- package/substrate/.claude/hooks/skill-body-intent-drift.sh +0 -107
- package/substrate/.claude/hooks/skill-step-list-check.sh +0 -171
- package/substrate/.claude/hooks/state-validate.sh +0 -271
- package/substrate/.claude/hooks/substrate-clarity-gate.sh +0 -1110
- package/substrate/.claude/hooks/temperance-gate.sh +0 -147
- package/substrate/.claude/hooks/testing-tier-enforce.sh +0 -233
- package/substrate/.claude/hooks/turn-prose-grade-measure.sh +0 -219
- package/substrate/.claude/hooks/turn-prose-kiss-check.sh +0 -463
- package/substrate/.claude/hooks/vocabulary-migration-check.sh +0 -171
- package/substrate/.claude/hooks/whereami-utc-gate.sh +0 -142
- package/substrate/.claude/luminaries/alan-cooper.md +0 -170
- package/substrate/.claude/luminaries/alistair-cockburn.md +0 -140
- package/substrate/.claude/luminaries/amazon-pr-faq.md +0 -34
- package/substrate/.claude/luminaries/ash-maurya.md +0 -121
- package/substrate/.claude/luminaries/bill-buxton.md +0 -210
- package/substrate/.claude/luminaries/charles-sanders-peirce.md +0 -150
- package/substrate/.claude/luminaries/david-ogilvy.md +0 -192
- package/substrate/.claude/luminaries/don-norman.md +0 -173
- package/substrate/.claude/luminaries/edward-tufte.md +0 -179
- package/substrate/.claude/luminaries/eric-evans.md +0 -160
- package/substrate/.claude/luminaries/frederick-brooks.md +0 -50
- package/substrate/.claude/luminaries/gang-of-four.md +0 -157
- package/substrate/.claude/luminaries/glenford-myers.md +0 -230
- package/substrate/.claude/luminaries/hunt-thomas.md +0 -115
- package/substrate/.claude/luminaries/hyrum-wright.md +0 -94
- package/substrate/.claude/luminaries/jason-fried-dhh.md +0 -46
- package/substrate/.claude/luminaries/jesse-james-garrett.md +0 -154
- package/substrate/.claude/luminaries/john-ousterhout.md +0 -94
- package/substrate/.claude/luminaries/karl-popper.md +0 -132
- package/substrate/.claude/luminaries/kent-beck.md +0 -168
- package/substrate/.claude/luminaries/linus-torvalds.md +0 -218
- package/substrate/.claude/luminaries/martin-fowler.md +0 -164
- package/substrate/.claude/luminaries/michael-feathers.md +0 -125
- package/substrate/.claude/luminaries/michael-nygard.md +0 -118
- package/substrate/.claude/luminaries/robert-c-martin.md +0 -164
- package/substrate/.claude/luminaries/saltzer-schroeder.md +0 -194
- package/substrate/.claude/luminaries/sophia-prater.md +0 -193
- package/substrate/.claude/luminaries/stephen-toulmin.md +0 -131
- package/substrate/.claude/luminaries/tony-hoare.md +0 -170
- package/substrate/.claude/luminaries/vaughn-vernon.md +0 -50
- package/substrate/.claude/luminaries/w-edwards-deming.md +0 -158
- package/substrate/.claude/rules/accessor-library-discipline.md +0 -138
- package/substrate/.claude/rules/adr-discipline.md +0 -120
- package/substrate/.claude/rules/api-conventions.md +0 -125
- package/substrate/.claude/rules/artifact-ingestion.md +0 -179
- package/substrate/.claude/rules/assert-only-after-verify.md +0 -137
- package/substrate/.claude/rules/blocked-items.md +0 -146
- package/substrate/.claude/rules/bootstrap-pair-discipline.md +0 -141
- package/substrate/.claude/rules/branching.md +0 -28
- package/substrate/.claude/rules/cold-adopter-harness-discipline.md +0 -129
- package/substrate/.claude/rules/commit-conventions.md +0 -22
- package/substrate/.claude/rules/compounding-axis-fresh-analysis.md +0 -188
- package/substrate/.claude/rules/compounding-sequence-fresh-analysis.md +0 -188
- package/substrate/.claude/rules/context-engineering.md +0 -202
- package/substrate/.claude/rules/context-management.md +0 -85
- package/substrate/.claude/rules/defensive-bash.md +0 -68
- package/substrate/.claude/rules/deferred-actions.md +0 -233
- package/substrate/.claude/rules/destructive-operations.md +0 -69
- package/substrate/.claude/rules/diagnosis.md +0 -38
- package/substrate/.claude/rules/github-issue-flash-tweet.md +0 -156
- package/substrate/.claude/rules/guardrails.md +0 -73
- package/substrate/.claude/rules/hook-wire-on-author.md +0 -103
- package/substrate/.claude/rules/identifier-leak-prevention.md +0 -104
- package/substrate/.claude/rules/iteration-bet-brief-completeness.md +0 -54
- package/substrate/.claude/rules/lite-manifest-schema-change-discipline.md +0 -98
- package/substrate/.claude/rules/longrun-prep-plan-doc-compression.md +0 -89
- package/substrate/.claude/rules/loop-discipline.md +0 -81
- package/substrate/.claude/rules/manual-prod-approval.md +0 -100
- package/substrate/.claude/rules/marker-enrichment-discipline.md +0 -99
- package/substrate/.claude/rules/mobile-ephemeral-session.md +0 -109
- package/substrate/.claude/rules/new-dependency-check.md +0 -51
- package/substrate/.claude/rules/oo-ad-entry-point.md +0 -117
- package/substrate/.claude/rules/operator-facing-prose.md +0 -196
- package/substrate/.claude/rules/option-label-discipline.md +0 -108
- package/substrate/.claude/rules/pattern-annotation.md +0 -100
- package/substrate/.claude/rules/plain-english-discipline.md +0 -156
- package/substrate/.claude/rules/plan-enumeration-needs-value-props.md +0 -211
- package/substrate/.claude/rules/pr-body-shape.md +0 -317
- package/substrate/.claude/rules/pr-strategy.md +0 -167
- package/substrate/.claude/rules/pr-title-shape.md +0 -161
- package/substrate/.claude/rules/prototype-workflow.md +0 -65
- package/substrate/.claude/rules/reserved-skill-names.md +0 -123
- package/substrate/.claude/rules/schema-management.md +0 -49
- package/substrate/.claude/rules/sdlc-gates.md +0 -149
- package/substrate/.claude/rules/security.md +0 -37
- package/substrate/.claude/rules/session-artifacts.md +0 -236
- package/substrate/.claude/rules/skill-composition-declarations.md +0 -124
- package/substrate/.claude/rules/skill-description-clarity.md +0 -247
- package/substrate/.claude/rules/skill-procedure-step-list.md +0 -137
- package/substrate/.claude/rules/state-schema-validation.md +0 -162
- package/substrate/.claude/rules/stuck-signal-diagnostic.md +0 -140
- package/substrate/.claude/rules/substrate-config-schema.md +0 -98
- package/substrate/.claude/rules/test-list-discipline.md +0 -175
- package/substrate/.claude/rules/test-sufficiency.md +0 -210
- package/substrate/.claude/rules/testing-tier-config.md +0 -145
- package/substrate/.claude/rules/testing.md +0 -38
- package/substrate/.claude/rules/turn-estimate-grounding.md +0 -134
- package/substrate/.claude/rules/visual-hierarchy.md +0 -437
- package/substrate/.claude/rules/we-dont-break-adopters.md +0 -126
- package/substrate/.claude/rules/whereami-load-bearing.md +0 -202
- package/substrate/.claude/rules/writing-craft-discipline.md +0 -92
- package/substrate/.claude/rules/wu-sequencing-compounds.md +0 -145
- package/substrate/.claude/skills/build/SKILL.md +0 -640
- package/substrate/.claude/skills/chronicle/SKILL.md +0 -55
- package/substrate/.claude/skills/clean-artifacts/SKILL.md +0 -249
- package/substrate/.claude/skills/decompose/SKILL.md +0 -280
- package/substrate/.claude/skills/diagnose/SKILL.md +0 -297
- package/substrate/.claude/skills/feynman/SKILL.md +0 -90
- package/substrate/.claude/skills/howdoi/SKILL.md +0 -105
- package/substrate/.claude/skills/ia-model/SKILL.md +0 -108
- package/substrate/.claude/skills/interaction-design/SKILL.md +0 -112
- package/substrate/.claude/skills/interpret-input/SKILL.md +0 -180
- package/substrate/.claude/skills/journal/SKILL.md +0 -209
- package/substrate/.claude/skills/kiss/SKILL.md +0 -449
- package/substrate/.claude/skills/launch/SKILL.md +0 -915
- package/substrate/.claude/skills/lean-canvas/SKILL.md +0 -332
- package/substrate/.claude/skills/longrun/SKILL.md +0 -463
- package/substrate/.claude/skills/luminary/SKILL.md +0 -481
- package/substrate/.claude/skills/ogilvy-writing-audit/SKILL.md +0 -177
- package/substrate/.claude/skills/onboard-repo/SKILL.md +0 -1624
- package/substrate/.claude/skills/pattern-review/SKILL.md +0 -99
- package/substrate/.claude/skills/personas/SKILL.md +0 -207
- package/substrate/.claude/skills/promote/SKILL.md +0 -283
- package/substrate/.claude/skills/requirement/SKILL.md +0 -98
- package/substrate/.claude/skills/retro/SKILL.md +0 -117
- package/substrate/.claude/skills/riff/SKILL.md +0 -114
- package/substrate/.claude/skills/roadmap-reconcile/SKILL.md +0 -163
- package/substrate/.claude/skills/session-end/SKILL.md +0 -309
- package/substrate/.claude/skills/session-log/SKILL.md +0 -299
- package/substrate/.claude/skills/skills/SKILL.md +0 -228
- package/substrate/.claude/skills/spec/SKILL.md +0 -105
- package/substrate/.claude/skills/sprint/SKILL.md +0 -392
- package/substrate/.claude/skills/stage/SKILL.md +0 -384
- package/substrate/.claude/skills/state-a-problem/SKILL.md +0 -185
- package/substrate/.claude/skills/temperance/SKILL.md +0 -108
- package/substrate/.claude/skills/use-case/SKILL.md +0 -417
- package/substrate/.claude/skills/user-stories/SKILL.md +0 -268
- package/substrate/.claude/skills/value-prop/SKILL.md +0 -251
- package/substrate/.claude/skills/verify/SKILL.md +0 -160
- package/substrate/.claude/skills/visual-review/SKILL.md +0 -503
- package/substrate/.claude/skills/whats-the-plan/SKILL.md +0 -202
- package/substrate/.claude/skills/whereami/SKILL.md +0 -307
- package/substrate/AGENTS.md +0 -79
- package/substrate/CLAUDE-lite.md +0 -85
- package/substrate/CODE_OF_CONDUCT.md +0 -28
- package/substrate/CONTRIBUTING.md +0 -177
- package/substrate/README.md +0 -173
- package/substrate/SECURITY.md +0 -19
- package/substrate/architecture/decisions/ADR-029-release-pipeline.md +0 -79
- package/substrate/architecture/decisions/ADR-031-non-breaking-changes-adopter-discipline.md +0 -139
- package/substrate/architecture/decisions/ADR-032-adopter-sync-dispatcher-architecture.md +0 -192
- package/substrate/architecture/decisions/ADR-039-release-tagging-scheme.md +0 -145
- package/substrate/architecture/decisions/ADR-040-planning-skill-vocabulary-and-lite-profile.md +0 -155
- package/substrate/architecture/decisions/ADR-044-unified-skill-body-template.md +0 -162
- package/substrate/lib/clean-artifacts-sweep.sh +0 -112
- package/substrate/lib/code-comment-discipline.sh +0 -144
- package/substrate/lib/composer-preflight.sh +0 -459
- package/substrate/lib/hook-inject.sh +0 -255
- package/substrate/lib/luminary-pick.sh +0 -96
- package/substrate/lib/output-discipline.sh +0 -143
- package/substrate/lib/prose-scan-boundary.sh +0 -171
- package/substrate/lib/rewrite-check.sh +0 -214
- package/substrate/lib/state.sh +0 -1372
- package/substrate/lib/telemetry.sh +0 -205
- package/substrate/lib/tier-check.sh +0 -187
- package/substrate/lib/tier-dependency-audit.sh +0 -1088
- package/substrate/presence/install/bassclef-hook-connect.sh +0 -178
- package/substrate/presence/install/bassclef-sync.dispatcher.template.sh +0 -841
- package/substrate/presence/install/bassclef-sync.template.sh +0 -2076
- package/substrate/presence/install/schedule-auto-save.cron.sh +0 -88
- package/substrate/presence/install/schedule-auto-save.taskscheduler.md +0 -122
- package/substrate/scripts/aggregate-telemetry.sh +0 -217
- package/substrate/scripts/analyze-tier-dependencies.sh +0 -239
- package/substrate/scripts/generate-lite-manifest.sh +0 -505
- package/substrate/scripts/generate-tier-manifest.sh +0 -28
- package/substrate/scripts/intent-drift-check.sh +0 -456
- package/substrate/scripts/lite-manifest-drift-check.sh +0 -146
- package/substrate/scripts/render-lite-manifest-doc.sh +0 -150
- package/substrate/standards/adr-template.md +0 -86
- package/substrate/standards/api-conventions/nextjs.md +0 -84
- package/substrate/standards/artifact-composition.md +0 -209
- package/substrate/standards/bash-hook-safety.md +0 -246
- package/substrate/standards/bassclef-configs-schema.md +0 -232
- package/substrate/standards/bassclef-evolution.md +0 -143
- package/substrate/standards/bassclef-internal-jargon.md +0 -244
- package/substrate/standards/bassclef-managed-sentinel.md +0 -96
- package/substrate/standards/bassclef-source-config.md +0 -228
- package/substrate/standards/branch-stacking.md +0 -408
- package/substrate/standards/code-safety-principles.md +0 -176
- package/substrate/standards/composer-prerequisites.md +0 -155
- package/substrate/standards/deferred-actions-schema.md +0 -204
- package/substrate/standards/dependency-discipline/cargo.md +0 -39
- package/substrate/standards/dependency-discipline/gem.md +0 -43
- package/substrate/standards/dependency-discipline/go-mod.md +0 -41
- package/substrate/standards/dependency-discipline/npm.md +0 -42
- package/substrate/standards/dependency-discipline/pip.md +0 -42
- package/substrate/standards/deployment-topology/ec2-tailscale.md +0 -225
- package/substrate/standards/deployment-topology.md +0 -69
- package/substrate/standards/docs-sync-allowlist.md +0 -76
- package/substrate/standards/domain-and-dns.md +0 -145
- package/substrate/standards/frontend-stack.md +0 -67
- package/substrate/standards/frontmatter-schema.md +0 -154
- package/substrate/standards/graceful-exit.md +0 -227
- package/substrate/standards/hook-idempotency.md +0 -102
- package/substrate/standards/hook-injection-discipline.md +0 -202
- package/substrate/standards/hook-install-class.md +0 -215
- package/substrate/standards/input-handler-interface.md +0 -152
- package/substrate/standards/lite-manifest-schema-changes.md +0 -135
- package/substrate/standards/luminary-matching.md +0 -105
- package/substrate/standards/luminary-problem-patterns.md +0 -481
- package/substrate/standards/migration-discipline/active-record.md +0 -50
- package/substrate/standards/migration-discipline/alembic.md +0 -43
- package/substrate/standards/migration-discipline/gorm.md +0 -50
- package/substrate/standards/migration-discipline/prisma.md +0 -53
- package/substrate/standards/migration-discipline/sqlalchemy.md +0 -51
- package/substrate/standards/mobile-ephemeral-session.md +0 -167
- package/substrate/standards/model-routing-discipline.md +0 -160
- package/substrate/standards/ogilvy-writing-rules.md +0 -225
- package/substrate/standards/opener-discipline.md +0 -96
- package/substrate/standards/operator-facing-prose-discipline.md +0 -201
- package/substrate/standards/persona-schema.md +0 -229
- package/substrate/standards/pluggable-luminaries.md +0 -323
- package/substrate/standards/pr-body-discipline.md +0 -115
- package/substrate/standards/preview-state-schema.md +0 -189
- package/substrate/standards/project-directory-layout.md +0 -276
- package/substrate/standards/release-tagging.md +0 -137
- package/substrate/standards/reserved-skill-names.md +0 -120
- package/substrate/standards/scannable-multi-option-output.md +0 -261
- package/substrate/standards/sdlc-compliance.md +0 -286
- package/substrate/standards/sdlc-gates/typescript.md +0 -57
- package/substrate/standards/secrets-lifecycle.md +0 -210
- package/substrate/standards/security-scanner-adapter.md +0 -145
- package/substrate/standards/session-board.md +0 -256
- package/substrate/standards/skill-output-discipline.md +0 -90
- package/substrate/standards/state-spine-contract.md +0 -255
- package/substrate/standards/state-spine.md +0 -511
- package/substrate/standards/steering-hints/kiss-words.md +0 -11
- package/substrate/standards/substrate-config-schema.md +0 -267
- package/substrate/standards/tech-stack-config.md +0 -109
- package/substrate/standards/tier-dependency-analysis.md +0 -167
- package/substrate/standards/tier-runtime-deps/lite.md +0 -57
- package/substrate/standards/tier-tag-schema.md +0 -155
- package/substrate/standards/two-layer-config.md +0 -99
- package/substrate/standards/use-case-format.md +0 -292
- package/substrate/standards/user-story-invest.md +0 -268
- package/substrate/standards/velocity-and-appetite.md +0 -229
- package/substrate/standards/voice-input-pattern.md +0 -119
- package/substrate/standards/whereami-schema.md +0 -301
- package/substrate/standards/worktree-management.md +0 -211
- package/substrate/standards/writing-guide.md +0 -213
- package/substrate/templates/chronicle-template.md +0 -75
- package/substrate/templates/deferred-action-template.md +0 -45
- package/substrate/templates/memory-proposal-template.md +0 -77
- package/substrate/templates/persona-template.md +0 -200
- package/substrate/templates/pr-faq.md +0 -45
- package/substrate/templates/secret-rotation-template.md +0 -162
- package/substrate/templates/spec-template.md +0 -131
- package/substrate/templates/use-case-template.md +0 -194
- package/substrate/templates/user-story-template.md +0 -107
- package/substrate/templates/whereami-template.md +0 -101
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
tier: lite
|
|
3
|
-
description: Stacked atomic branches are the default for any iteration with N≥2 issues.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Branch Stacking Standard
|
|
7
|
-
|
|
8
|
-
## Default for multi-issue iterations
|
|
9
|
-
|
|
10
|
-
**Stacked atomic branches are the default** for any iteration with N≥2
|
|
11
|
-
issues. One branch per issue, one PR per branch, each independently
|
|
12
|
-
reviewable and revertable. The `bundle` flag at `/autonomous start`
|
|
13
|
-
overrides this; see `.claude/rules/pr-strategy.md` for when bundling is
|
|
14
|
-
acceptable.
|
|
15
|
-
|
|
16
|
-
This is codified — the boot sequence does not ask "stacked or bundled?"
|
|
17
|
-
per session.
|
|
18
|
-
|
|
19
|
-
## When to use
|
|
20
|
-
|
|
21
|
-
Autonomous or multi-step sessions where work spans multiple logical units
|
|
22
|
-
that should be independently reviewable and revertable. This extends the
|
|
23
|
-
trunk-based model in `.claude/rules/branching.md` for multi-branch work.
|
|
24
|
-
|
|
25
|
-
Use this standard when:
|
|
26
|
-
- An agent (or agents) will produce more than one PR in a session
|
|
27
|
-
- Work has a natural decomposition into independent or sequenced units
|
|
28
|
-
- You want the ability to accept some branches and reject others
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## Core principle
|
|
33
|
-
|
|
34
|
-
**Each branch = one intent.** A branch does one thing: "Add the data model"
|
|
35
|
-
or "Build the list view" — not "Add data model and list view and API routes."
|
|
36
|
-
|
|
37
|
-
If you can't describe a branch's intent in one sentence, split it.
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
## Stack manifest
|
|
42
|
-
|
|
43
|
-
Before building, the agent writes a manifest declaring the planned stack.
|
|
44
|
-
This is the iteration's work breakdown and the Orchestrator's routing map.
|
|
45
|
-
|
|
46
|
-
**Location**: `docs/branch-stacks/YYYY-MM-DD-slug.md` in the working repo.
|
|
47
|
-
|
|
48
|
-
### Format
|
|
49
|
-
|
|
50
|
-
```markdown
|
|
51
|
-
# Branch Stack: [name]
|
|
52
|
-
|
|
53
|
-
**Issue**: #NNN
|
|
54
|
-
**Iteration goal**: [path to iteration goal]
|
|
55
|
-
**Execution mode**: sequential | parallel | mixed
|
|
56
|
-
**Date**: YYYY-MM-DD
|
|
57
|
-
|
|
58
|
-
## Branches
|
|
59
|
-
|
|
60
|
-
| # | Branch | Intent | Depends on | Parallel-safe |
|
|
61
|
-
|---|--------|--------|-----------|---------------|
|
|
62
|
-
| 1 | feature/NNN-stack-1-data-model | CRM schema + migration | none | yes |
|
|
63
|
-
| 2 | feature/NNN-stack-2-api-routes | CRUD API for entities | stack-1 | no |
|
|
64
|
-
| 3 | feature/NNN-stack-3-list-view | List page UI | stack-1 | yes |
|
|
65
|
-
| 4 | feature/NNN-stack-4-detail-view | Detail page UI | stack-3 | no |
|
|
66
|
-
|
|
67
|
-
## Parallel groups
|
|
68
|
-
|
|
69
|
-
- Group A (no dependencies): stack-1
|
|
70
|
-
- Group B (after stack-1 merged): stack-2, stack-3 (parallel)
|
|
71
|
-
- Group C (after stack-3 merged): stack-4
|
|
72
|
-
|
|
73
|
-
## Acceptance criteria per branch
|
|
74
|
-
|
|
75
|
-
### stack-1: data-model
|
|
76
|
-
- [ ] Prisma schema with migration file
|
|
77
|
-
- [ ] prisma generate succeeds
|
|
78
|
-
- [ ] Seed script if needed
|
|
79
|
-
|
|
80
|
-
### stack-2: api-routes
|
|
81
|
-
- [ ] CRUD endpoints with tests
|
|
82
|
-
- [ ] Auth middleware applied
|
|
83
|
-
|
|
84
|
-
[... etc]
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## Execution modes
|
|
90
|
-
|
|
91
|
-
### Sequential (supervised sessions)
|
|
92
|
-
|
|
93
|
-
One agent, one branch at a time. Human checkpoint between branches.
|
|
94
|
-
|
|
95
|
-
```
|
|
96
|
-
Agent builds stack-1
|
|
97
|
-
→ PR opened → human reviews → approved → merge to main
|
|
98
|
-
Agent builds stack-2
|
|
99
|
-
→ PR opened → human reviews → approved → merge to main
|
|
100
|
-
[...]
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
**Branch base**: Each branch is based on `main` (after the previous branch
|
|
104
|
-
is merged). This means each branch includes the accumulated work of prior
|
|
105
|
-
branches but is independently reviewable as a PR.
|
|
106
|
-
|
|
107
|
-
**Human checkpoint**: After each branch, the agent opens a PR and stops.
|
|
108
|
-
Human reviews. Approved → merge → agent proceeds. Rejected → agent adjusts
|
|
109
|
-
or the branch is discarded.
|
|
110
|
-
|
|
111
|
-
### Parallel (Cherny's worktree model)
|
|
112
|
-
|
|
113
|
-
Multiple agents in git worktrees (`claude -w`), each on its own branch,
|
|
114
|
-
building simultaneously. No dirty tree conflicts — each worktree is an
|
|
115
|
-
isolated copy of the repo.
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
Orchestrator reads stack manifest
|
|
119
|
-
→ Independent branches fan out to parallel worktree agents
|
|
120
|
-
→ Dependent branches queue behind prerequisites
|
|
121
|
-
|
|
122
|
-
Agent A (worktree 1): stack-2-api-routes
|
|
123
|
-
Agent B (worktree 2): stack-3-list-view
|
|
124
|
-
[building simultaneously, no conflicts]
|
|
125
|
-
|
|
126
|
-
Each agent opens its own PR when done
|
|
127
|
-
Human reviews PRs after session (or Reviewer agent evaluates)
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
**Branch base for parallel work**: Independent branches base off `main`.
|
|
131
|
-
When a branch depends on another (stack-4 depends on stack-3), it bases
|
|
132
|
-
off the dependency branch. The manifest makes this explicit.
|
|
133
|
-
|
|
134
|
-
**Worktree lifecycle**:
|
|
135
|
-
- Created by Orchestrator (or human) when fanning out parallel work
|
|
136
|
-
- Each worktree gets one branch, one agent
|
|
137
|
-
- On completion: agent opens PR, worktree is available for cleanup
|
|
138
|
-
- Merged worktrees: deleted automatically after merge
|
|
139
|
-
- Abandoned worktrees (no commits after 2 hours): flagged for cleanup
|
|
140
|
-
- Worktree cleanup command: `git worktree prune`
|
|
141
|
-
|
|
142
|
-
**Conflict detection**: If two parallel agents modify the same file,
|
|
143
|
-
the Orchestrator flags this to the human. Do not attempt auto-resolution —
|
|
144
|
-
file-level conflicts in parallel branches indicate a decomposition problem
|
|
145
|
-
(the branches weren't truly independent). Fix the manifest, not the merge.
|
|
146
|
-
|
|
147
|
-
### Mixed (common in practice)
|
|
148
|
-
|
|
149
|
-
Some branches are independent (parallelize), some are dependent (sequence).
|
|
150
|
-
The manifest's dependency graph determines which is which.
|
|
151
|
-
|
|
152
|
-
```
|
|
153
|
-
Group A: stack-1 (alone, must complete first)
|
|
154
|
-
Group B: stack-2 + stack-3 (parallel, both depend on stack-1)
|
|
155
|
-
Group C: stack-4 (sequential, depends on stack-3)
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
The Orchestrator executes Group A, waits for merge, fans out Group B in
|
|
159
|
-
parallel worktrees, waits for Group B merges, then executes Group C.
|
|
160
|
-
|
|
161
|
-
---
|
|
162
|
-
|
|
163
|
-
## Graceful unwind
|
|
164
|
-
|
|
165
|
-
If branch N is rejected:
|
|
166
|
-
- **Branches that depend on N** (per manifest): also discarded
|
|
167
|
-
- **Branches independent of N**: survive untouched
|
|
168
|
-
- **Agent never needs to untangle** — independence is designed in, not retrofitted
|
|
169
|
-
|
|
170
|
-
The dependency graph in the manifest makes this mechanical:
|
|
171
|
-
1. Look up what depends on N (transitively)
|
|
172
|
-
2. Discard N and all its dependents
|
|
173
|
-
3. Everything else is unaffected
|
|
174
|
-
|
|
175
|
-
This is why independence is the default and dependencies are the exception.
|
|
176
|
-
|
|
177
|
-
---
|
|
178
|
-
|
|
179
|
-
## Squash merge — two protocols
|
|
180
|
-
|
|
181
|
-
When merging stacked PRs whose bases are other feature branches
|
|
182
|
-
(Graphite-style stack — common when the agent declares "depends on"
|
|
183
|
-
in the manifest), GitHub auto-closes dependent PRs the moment the
|
|
184
|
-
base branch is deleted. ("Cannot change the base branch of a closed
|
|
185
|
-
pull request.") Recovery requires re-creating each PR. Costs ~3-8
|
|
186
|
-
turns per stack. Observed 2026-04-18c (#178/#179/#180 cascade).
|
|
187
|
-
|
|
188
|
-
Two protocols handle this. Pick by **when** you can act:
|
|
189
|
-
|
|
190
|
-
| Protocol | When to use | Trade-off |
|
|
191
|
-
|----------|-------------|-----------|
|
|
192
|
-
| **Retarget-before-merge** (preferred) | You have access to the dependent PRs before merging stack-N | Cleanest — no auto-close, no recovery cost |
|
|
193
|
-
| **Rebase-after-merge** (fallback) | Auto-close already happened, OR you forgot to retarget | Recoverable but expensive — per-PR rebase + re-create |
|
|
194
|
-
|
|
195
|
-
If the iteration uses **base = main** for every branch (independence
|
|
196
|
-
designed in via manifest, no Graphite-style chaining), neither cascade
|
|
197
|
-
fires — but stacked PRs with declared dependencies almost always use
|
|
198
|
-
chained bases.
|
|
199
|
-
|
|
200
|
-
### Retarget-before-merge (preferred)
|
|
201
|
-
|
|
202
|
-
**Before** squash-merging PR N in a stack:
|
|
203
|
-
|
|
204
|
-
1. **Identify dependent PRs** — those whose `baseRefName` equals
|
|
205
|
-
PR N's `headRefName`. Use the helper script:
|
|
206
|
-
|
|
207
|
-
```bash
|
|
208
|
-
scripts/check-stack-dependents.sh <PR-N-number>
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
This lists open PRs that will auto-close if PR N merges and its
|
|
212
|
-
branch is deleted.
|
|
213
|
-
|
|
214
|
-
2. **Retarget each dependent to main** (or the stack root):
|
|
215
|
-
|
|
216
|
-
```bash
|
|
217
|
-
gh pr edit <dependent-PR-number> --base main
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
The dependent PR survives the merge. Its diff may now show extra
|
|
221
|
-
commits (the work from PR N) until the dependent is rebased — but
|
|
222
|
-
it stays open.
|
|
223
|
-
|
|
224
|
-
3. **Merge PR N**:
|
|
225
|
-
|
|
226
|
-
```bash
|
|
227
|
-
gh pr merge <PR-N-number> --squash --delete-branch
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
Auto-close cascade does not fire because no other PR has PR N's
|
|
231
|
-
branch as base anymore.
|
|
232
|
-
|
|
233
|
-
4. **(Optional) Rebase dependent on top of merged main** if you want
|
|
234
|
-
the diff to show only the dependent's own work:
|
|
235
|
-
|
|
236
|
-
```bash
|
|
237
|
-
git checkout <dependent-branch>
|
|
238
|
-
git pull origin main --rebase
|
|
239
|
-
git push --force-with-lease
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
5. **Repeat** for the next PR in stack order.
|
|
243
|
-
|
|
244
|
-
#### Why this works
|
|
245
|
-
|
|
246
|
-
The auto-close trigger is "base branch deleted on a closed/merged PR
|
|
247
|
-
where another PR depends on it." Retarget breaks the dependency
|
|
248
|
-
*before* the delete fires. The dependents continue tracking main; their
|
|
249
|
-
content is unchanged.
|
|
250
|
-
|
|
251
|
-
### Rebase-after-merge (fallback)
|
|
252
|
-
|
|
253
|
-
Use only if the cascade has already fired (dependent PRs show
|
|
254
|
-
"Closed — base branch was deleted") OR you forgot the retarget step.
|
|
255
|
-
|
|
256
|
-
After squash-merging PR N in a stack (without prior retarget):
|
|
257
|
-
|
|
258
|
-
1. **Pull updated main**: `git checkout main && git pull`
|
|
259
|
-
2. **Rebase the next branch**: `git checkout feature/next && git rebase main`
|
|
260
|
-
3. **Force push with lease**: `git push --force-with-lease`
|
|
261
|
-
(safe force push — fails if someone else pushed to the branch)
|
|
262
|
-
4. **If GitHub auto-closed the downstream PR**: re-create it pointing
|
|
263
|
-
at main, since the closed PR cannot be reopened with a new base:
|
|
264
|
-
```bash
|
|
265
|
-
gh pr create --base main --head feature/next \
|
|
266
|
-
--title "[same as closed PR]" \
|
|
267
|
-
--body "[same as closed PR, plus link to closed PR for context]"
|
|
268
|
-
```
|
|
269
|
-
Or merge locally:
|
|
270
|
-
```bash
|
|
271
|
-
git checkout main
|
|
272
|
-
git merge --squash feature/next
|
|
273
|
-
git commit -m "feat: description"
|
|
274
|
-
```
|
|
275
|
-
5. **Repeat** for remaining branches in stack order
|
|
276
|
-
|
|
277
|
-
#### Why this happens
|
|
278
|
-
|
|
279
|
-
Squash merge creates a single new commit on main that replaces all
|
|
280
|
-
commits from the branch. The next branch's base commits no longer exist
|
|
281
|
-
on main — they were squashed into one. GitHub sees a conflict because
|
|
282
|
-
the branch history diverged from main. Combined with branch deletion,
|
|
283
|
-
the auto-close cascade fires for any dependent PR.
|
|
284
|
-
|
|
285
|
-
### Auto-save checkpoint conflicts
|
|
286
|
-
|
|
287
|
-
If the auto-save launchd timer committed checkpoint files (e.g.,
|
|
288
|
-
`.test-baseline`) on feature branches during construction, these
|
|
289
|
-
checkpoints will conflict during rebase. Use `git rebase --skip` to
|
|
290
|
-
drop the checkpoint commits — they're not part of the real work.
|
|
291
|
-
|
|
292
|
-
The auto-save timer should be paused during autonomous sessions
|
|
293
|
-
(SESSION_LOCK check, see #62).
|
|
294
|
-
|
|
295
|
-
### Alternative: regular merge commits
|
|
296
|
-
|
|
297
|
-
Using regular merge commits (no squash) preserves branch relationships
|
|
298
|
-
and avoids the rebase cascade. Trade-off: messier main history with
|
|
299
|
-
merge commits. Squash is still preferred for a clean main, but the
|
|
300
|
-
rebase step is the cost.
|
|
301
|
-
|
|
302
|
-
---
|
|
303
|
-
|
|
304
|
-
## Naming convention
|
|
305
|
-
|
|
306
|
-
```
|
|
307
|
-
feature/ISSUE-NNN-stack-N-short-description
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
Examples:
|
|
311
|
-
- `feature/47-stack-1-crm-data-model`
|
|
312
|
-
- `feature/47-stack-2-crm-api-routes`
|
|
313
|
-
- `feature/47-stack-3-crm-list-view`
|
|
314
|
-
|
|
315
|
-
The `stack-N` segment makes merge ordering obvious in `git branch` output
|
|
316
|
-
and GitHub's PR list.
|
|
317
|
-
|
|
318
|
-
---
|
|
319
|
-
|
|
320
|
-
## Per-branch verification
|
|
321
|
-
|
|
322
|
-
Each branch passes `/verify` independently before the PR is opened.
|
|
323
|
-
CI must pass on each branch in isolation. A branch that only works when
|
|
324
|
-
combined with another branch is not atomic — fix the decomposition.
|
|
325
|
-
|
|
326
|
-
Exception: Dependent branches (stack-4 depends on stack-3) are verified
|
|
327
|
-
against their base branch, not against main alone.
|
|
328
|
-
|
|
329
|
-
---
|
|
330
|
-
|
|
331
|
-
## Automatic stack creation (via /autonomous)
|
|
332
|
-
|
|
333
|
-
When `/autonomous start` enters Construction, the Orchestrator runs a
|
|
334
|
-
five-step automation sequence (defined in strategy/autonomous-boot-sequence.md Step 9).
|
|
335
|
-
This section documents what the automation produces so agents know what
|
|
336
|
-
to expect when picking up a stack mid-session.
|
|
337
|
-
|
|
338
|
-
### What gets created automatically
|
|
339
|
-
|
|
340
|
-
**1. GitHub issues** — one per task, created via `gh issue create`.
|
|
341
|
-
Each issue includes: what, acceptance criteria, and a ref to the
|
|
342
|
-
iteration goal. Issue numbers are assigned before any branch is created.
|
|
343
|
-
|
|
344
|
-
**2. Stack manifest** — written to `docs/branch-stacks/YYYY-MM-DD-slug.md`
|
|
345
|
-
before any branch is created. The manifest is committed first so all
|
|
346
|
-
agents can find it.
|
|
347
|
-
|
|
348
|
-
**3. Branches** — created from main in dependency order, named
|
|
349
|
-
`feature/ISSUE-NNN-stack-N-short-description`.
|
|
350
|
-
|
|
351
|
-
### Automation invariants
|
|
352
|
-
|
|
353
|
-
- The manifest is always committed before branches are created.
|
|
354
|
-
If you see a branch without a manifest, the automation was interrupted.
|
|
355
|
-
- Issue numbers in the manifest are real GitHub issue numbers.
|
|
356
|
-
A placeholder NNN means the automation did not complete — finish it.
|
|
357
|
-
- Every branch bases from main, not from the previous branch.
|
|
358
|
-
Stacked rebases follow the squash-merge protocol in this document.
|
|
359
|
-
- The manifest is updated after each PR opens (status: pr-open) and
|
|
360
|
-
after each merge (status: merged). Pending = not yet started.
|
|
361
|
-
|
|
362
|
-
### Resuming an interrupted stack
|
|
363
|
-
|
|
364
|
-
If the automation was interrupted (crash, time budget exhausted, pause),
|
|
365
|
-
the next session reads:
|
|
366
|
-
|
|
367
|
-
1. `docs/branch-stacks/YYYY-MM-DD-slug.md` — what's done, what's pending
|
|
368
|
-
2. `docs/whereami.md` — branch_stack field points at the manifest
|
|
369
|
-
3. GitHub issues — open issues with no linked PR are pending branches
|
|
370
|
-
|
|
371
|
-
Resume from the first branch with status "pending" in the manifest.
|
|
372
|
-
Do not re-create issues or rewrite the manifest unless it is corrupted.
|
|
373
|
-
|
|
374
|
-
### Manual stack creation (non-autonomous sessions)
|
|
375
|
-
|
|
376
|
-
The standard still applies for manually created stacks — write the
|
|
377
|
-
manifest first, create issues, then branches. The automation does this
|
|
378
|
-
programmatically. Format and invariants are identical.
|
|
379
|
-
|
|
380
|
-
---
|
|
381
|
-
|
|
382
|
-
## Integration with process framework
|
|
383
|
-
|
|
384
|
-
| Concept | Maps to |
|
|
385
|
-
|---------|---------|
|
|
386
|
-
| Branch stack | Iteration |
|
|
387
|
-
| Stack manifest | Iteration work breakdown |
|
|
388
|
-
| Individual branch | Task within iteration |
|
|
389
|
-
| Iteration goal | Governs the whole stack |
|
|
390
|
-
| Parallel groups | Orchestrator routing |
|
|
391
|
-
|
|
392
|
-
Individual branches do not need their own iteration goals. The stack-level
|
|
393
|
-
bet covers time budget, risk, and value for the entire body of work.
|
|
394
|
-
|
|
395
|
-
---
|
|
396
|
-
|
|
397
|
-
## Relation to existing branching rules
|
|
398
|
-
|
|
399
|
-
This standard extends `.claude/rules/branching.md`. All existing rules
|
|
400
|
-
still apply:
|
|
401
|
-
- `main` is always deployable
|
|
402
|
-
- Every branch ties to a GitHub Issue (stack branches share the parent issue)
|
|
403
|
-
- Squash merge to main
|
|
404
|
-
- No branches older than 5 days
|
|
405
|
-
- Force push on feature branches is fine, never on main
|
|
406
|
-
|
|
407
|
-
The addition: branches can now be explicitly sequenced and parallelized
|
|
408
|
-
via a stack manifest, with graceful unwind as a first-class property.
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
tier: lite
|
|
3
|
-
description: "This standard codifies language-agnostic principles for writing safer code across bassclef's supported stacks (TypeScript, Python, Ruby, Java, Go, bash)."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Code Safety Principles — Language-Agnostic
|
|
7
|
-
|
|
8
|
-
This standard codifies language-agnostic principles for writing safer code across bassclef's supported stacks (TypeScript, Python, Ruby, Java, Go, bash). It is the substrate-internal companion to the Saltzer & Schroeder luminary — the luminary names WHY each principle matters at the protection-mechanism design level; this standard names WHAT the principle looks like in source code.
|
|
9
|
-
|
|
10
|
-
## Why this standard exists
|
|
11
|
-
|
|
12
|
-
Bassclef's `.claude/rules/security.md` is scoped to web-application source files (`.ts`, `.tsx`, `.json`, `.env`, `Dockerfile`). It catches the OWASP-top-10 surface for the web layer. It does not cover:
|
|
13
|
-
|
|
14
|
-
- Bash hooks (bassclef's own implementation language for `.claude/hooks/*.sh`)
|
|
15
|
-
- Backend daemons (Python, Go, Java, Ruby — any language an adopter ships)
|
|
16
|
-
- Code review of cross-cutting concerns (default-behavior choices, scope choices, override-path design)
|
|
17
|
-
|
|
18
|
-
The principles in this standard apply to ALL six languages because they are about the *shape* of code, not language-specific syntax. The downstream stack-specific guides (Phase X-3 `bash-hook-safety.md`; Phase Y reference configs per stack) instantiate these principles in the language idiom of the day.
|
|
19
|
-
|
|
20
|
-
## Anchor luminary
|
|
21
|
-
|
|
22
|
-
`@luminary saltzer-schroeder` is the authority. Their 1975 paper articulated the 8 principles for protection-mechanism design that this standard implements at the source-code level.
|
|
23
|
-
|
|
24
|
-
INSTEAD of inventing bassclef-specific principles: this standard maps Saltzer & Schroeder's 8 principles into 6 source-code disciplines that any language can express. The 1975 framing predates every modern attack class and still holds.
|
|
25
|
-
|
|
26
|
-
## The six source-code disciplines
|
|
27
|
-
|
|
28
|
-
### 1. Validate at boundaries
|
|
29
|
-
|
|
30
|
-
Every value entering the system from an external source must be validated at the boundary. After validation, internal code treats the value as trusted.
|
|
31
|
-
|
|
32
|
-
INSTEAD of validating at every call site: validate once at the entry boundary; pass typed values to internal code that trusts them.
|
|
33
|
-
|
|
34
|
-
**Boundaries to validate at:**
|
|
35
|
-
|
|
36
|
-
- HTTP request handlers (parse + validate body, query, headers, path params before any business logic)
|
|
37
|
-
- CLI argument parsers (validate flag values before dispatch)
|
|
38
|
-
- File parsers (validate schema/structure before consuming content)
|
|
39
|
-
- Foreign-key dereferences across service boundaries (validate the referenced object's shape before use)
|
|
40
|
-
- Environment variable reads at process startup (validate types + ranges before runtime use)
|
|
41
|
-
|
|
42
|
-
**Per language idiom:**
|
|
43
|
-
|
|
44
|
-
| Stack | Validation primitive |
|
|
45
|
-
|---|---|
|
|
46
|
-
| TypeScript | Zod / Yup / io-ts schema at handler entry |
|
|
47
|
-
| Python | Pydantic model at handler entry; argparse with custom types for CLI |
|
|
48
|
-
| Ruby | dry-validation or ActiveModel validation at controller boundary |
|
|
49
|
-
| Java | Jakarta Bean Validation (JSR 380) annotations; manual validators for non-bean inputs |
|
|
50
|
-
| Go | github.com/go-playground/validator at handler entry; validate.Var for ad-hoc |
|
|
51
|
-
| Bash | argparse-style validation in helper functions; `[[ -n "${var:?}" ]]` for required values |
|
|
52
|
-
|
|
53
|
-
### 2. Fail-safe defaults
|
|
54
|
-
|
|
55
|
-
Default behavior denies / refuses / rejects unless an explicit signal permits. The author of a new code path is forced to make the permission decision visible.
|
|
56
|
-
|
|
57
|
-
INSTEAD of "permit by default, deny on exclusion list": deny by default, permit on explicit allowlist. The allowlist makes new permissions visible; the exclusion list makes new denials invisible.
|
|
58
|
-
|
|
59
|
-
**Examples by domain:**
|
|
60
|
-
|
|
61
|
-
- **HTTP routes** — middleware denies all paths by default; routes opt in via explicit definitions. Catch-all 404 vs catch-all 200.
|
|
62
|
-
- **Feature flags** — new flag defaults to OFF; opt-in turns on. INSTEAD of new flag default ON (silently activating in every environment).
|
|
63
|
-
- **CORS** — empty origin list rejects; explicit origins permit. INSTEAD of `*` wildcard.
|
|
64
|
-
- **DB row visibility** — multi-tenant query starts with tenant filter; opt in to cross-tenant only with explicit annotation. INSTEAD of unfiltered base query + per-call tenant filter (easy to forget).
|
|
65
|
-
- **Bash auto-save** — refuse all branches; allowlist enables. INSTEAD of allow all branches; refuse list excludes (PR #1058 anti-pattern).
|
|
66
|
-
|
|
67
|
-
### 3. Least privilege
|
|
68
|
-
|
|
69
|
-
Each operation runs with the minimum privileges needed to complete its job. Tokens, credentials, file modes, network access, database permissions — all scoped to the narrowest grant.
|
|
70
|
-
|
|
71
|
-
INSTEAD of granting broad permissions because tightening is annoying: grant narrow permissions at creation; broaden only with explicit justification.
|
|
72
|
-
|
|
73
|
-
**Per language idiom:**
|
|
74
|
-
|
|
75
|
-
| Stack | Least-privilege primitive |
|
|
76
|
-
|---|---|
|
|
77
|
-
| TypeScript | scoped Prisma client / scoped fetch credentials / scoped GitHub PAT |
|
|
78
|
-
| Python | scoped boto3 IAM roles; scoped requests session with restricted cookies |
|
|
79
|
-
| Ruby | scoped ActiveRecord connection pool per concern; scoped Net::HTTP credentials |
|
|
80
|
-
| Java | scoped JDBC connection with role-based grants; scoped HttpClient TLS config |
|
|
81
|
-
| Go | scoped HTTP client; scoped database/sql DSN per role |
|
|
82
|
-
| Bash | `--scope=<minimum>` flags on every CLI; `sudo` disallowed by default; file modes 644/755 by default |
|
|
83
|
-
|
|
84
|
-
Token discipline (per memory `feedback_never_paste_tokens_in_chat`) is least privilege applied to authentication.
|
|
85
|
-
INSTEAD of broad-org admin tokens: fine-grained PATs scoped to a single target repo + minimum permission set. INSTEAD of pasting credential values into any chat / log / commit: reference credentials by environment-variable name only.
|
|
86
|
-
|
|
87
|
-
### 4. Complete mediation
|
|
88
|
-
|
|
89
|
-
Every access to every protected resource passes through the protection mechanism. There are no "trusted" internal paths that skip the check.
|
|
90
|
-
|
|
91
|
-
INSTEAD of checking authorization at the boundary and trusting internal callers: check at every access point. The cost of one extra check is small; the cost of one missed check can be the whole system.
|
|
92
|
-
|
|
93
|
-
**Examples by domain:**
|
|
94
|
-
|
|
95
|
-
- **DB queries** — Row-level security at the database is complete mediation; ORM-side filters are bypass-able if a caller uses raw SQL
|
|
96
|
-
- **HTTP middleware** — Apply auth middleware to a route group; selective-skip is a security bug.
|
|
97
|
-
INSTEAD of allowing per-route opt-out: route groups are the granularity; new routes inherit the middleware.
|
|
98
|
-
- **Tenant filtering** — Filter at the query builder layer (every query inherits); not at the controller layer (controllers can forget).
|
|
99
|
-
INSTEAD of controller-layer filtering: query-builder-layer filtering so the tenant context is structurally inseparable from every query.
|
|
100
|
-
- **File access** — Mediate via accessor functions that include the check; raw file handles bypass the check.
|
|
101
|
-
INSTEAD of granting raw handles for performance: accessor functions own the read/write surface; performance optimization lives inside the accessor.
|
|
102
|
-
- **Bash hook PreToolUse** — Hook fires on every matching tool call, not "first call per session"
|
|
103
|
-
|
|
104
|
-
### 5. Defense in depth
|
|
105
|
-
|
|
106
|
-
Multiple independent layers protect the same resource. A single compromise of one layer leaves the resource still protected by the others.
|
|
107
|
-
|
|
108
|
-
INSTEAD of relying on one strong layer: stack multiple layers, each cheap, with no single layer load-bearing.
|
|
109
|
-
|
|
110
|
-
**Example stack for bassclef production deploys:**
|
|
111
|
-
|
|
112
|
-
1. GitHub Environment with `required_reviewers` (separation of privilege)
|
|
113
|
-
2. `deploy-guard.sh` hook BLOCKs without explicit `DEPLOY_PROD=1` env var
|
|
114
|
-
3. `gh pr merge` requires operator account (not agent token)
|
|
115
|
-
4. CI passing gate (test + build + lint + security scan)
|
|
116
|
-
5. Manual smoke-test acknowledgement before traffic shift
|
|
117
|
-
|
|
118
|
-
Five layers. Compromise of any one (e.g., agent token leaked) still leaves four layers protecting the deploy.
|
|
119
|
-
|
|
120
|
-
INSTEAD of "we have CI, that's enough": every layer is cheap; every layer catches a different failure class.
|
|
121
|
-
|
|
122
|
-
### 6. Audit at every layer
|
|
123
|
-
|
|
124
|
-
Every state-modifying action emits an audit record. The record names: who, what, when, from where, with what authority.
|
|
125
|
-
|
|
126
|
-
INSTEAD of audit-only-on-failure: audit on every state change so post-incident reconstruction has the data it needs.
|
|
127
|
-
|
|
128
|
-
**Per language idiom:**
|
|
129
|
-
|
|
130
|
-
| Stack | Audit primitive |
|
|
131
|
-
|---|---|
|
|
132
|
-
| TypeScript | structured logger (pino, winston) + trace ID at handler entry |
|
|
133
|
-
| Python | structlog or loguru + trace ID; opentelemetry for cross-service |
|
|
134
|
-
| Ruby | structured Rails logger + Lograge; trace ID via request middleware |
|
|
135
|
-
| Java | SLF4J + Logback structured layout; OpenTelemetry tracer |
|
|
136
|
-
| Go | zap or zerolog + trace context; OpenTelemetry SDK |
|
|
137
|
-
| Bash | `trace-helper.sh` writes JSONL to `.claude/state/traces/<session>.jsonl` |
|
|
138
|
-
|
|
139
|
-
Bassclef's `lib/trace-helper.sh` is the substrate's audit primitive for bash. Every hook fires `trace_record <hook> <verb> <context>` before exit. Override usage (e.g., `SKIP_*=1`) is logged automatically.
|
|
140
|
-
|
|
141
|
-
## What this standard does NOT do
|
|
142
|
-
|
|
143
|
-
- **Does not specify cryptographic primitives** — algorithm choice, key length, library selection are out of scope. Use the language's standard library + vetted cryptography library (e.g., libsodium binding, Bouncy Castle).
|
|
144
|
-
- **Does not catalog OWASP top-10 mitigations** — `.claude/rules/security.md` covers the web layer; this standard covers the substrate-internal layer that the web layer rests on.
|
|
145
|
-
- **Does not replace `/security-review`** — that skill applies these principles to a specific PR. This standard is the reference the skill cites.
|
|
146
|
-
- **Does not specify threat models** — Schneier-anchored threat-thinking is a separate luminary candidate (deferred per Phase X+Y+Z bet's Out of scope).
|
|
147
|
-
|
|
148
|
-
## When this standard fires
|
|
149
|
-
|
|
150
|
-
| Surface | What to check |
|
|
151
|
-
|---|---|
|
|
152
|
-
| New HTTP handler / route | Boundary validation present? Default behavior fail-safe? |
|
|
153
|
-
| New bash hook | All 8 principles via stack-translation table in `saltzer-schroeder.md` |
|
|
154
|
-
| New CLI tool | Argument validation? Least-privilege credential scope? |
|
|
155
|
-
| New cross-service call | Validation on the response? Audit emit at call site? |
|
|
156
|
-
| Schema migration | Defense in depth via review + dry-run + rollback? |
|
|
157
|
-
| Code review | All 6 disciplines applied? |
|
|
158
|
-
|
|
159
|
-
## Refs
|
|
160
|
-
|
|
161
|
-
- `@luminary saltzer-schroeder` — anchor; 8 principles for protection-mechanism design
|
|
162
|
-
- `.claude/rules/security.md` — web-layer rule (`.ts/.tsx/.json/.env/Dockerfile` scope)
|
|
163
|
-
- `.claude/rules/destructive-operations.md` — agent self-assessment companion
|
|
164
|
-
- `standards/bash-hook-safety.md` (Phase X-3) — bash-specific instantiation of these principles
|
|
165
|
-
- `docs/iteration-bets/2026-06-17a-secure-coding-foundations-longrun.md` — goal authoring this standard
|
|
166
|
-
- bassclef#1058 — concrete failure (auto-save scope hole) that motivated this standard
|
|
167
|
-
|
|
168
|
-
## Composes with
|
|
169
|
-
|
|
170
|
-
- `standards/destructive-operations.md` style → `.claude/rules/destructive-operations.md` (agent self-assessment)
|
|
171
|
-
- `standards/bassclef-configs-schema.md` § Security scanning (Phase Y-2) — adopter-facing scanner-adapter config
|
|
172
|
-
- `standards/security-scanner-adapter.md` (Phase Y-1) — adapter pattern that uses scanner outputs to enforce these disciplines
|
|
173
|
-
|
|
174
|
-
## Retirement
|
|
175
|
-
|
|
176
|
-
This standard retires only if Saltzer & Schroeder's principles are superseded by a fundamentally different protection-mechanism framework. The 8 principles have held for 50 years; retirement is not a near-term concern. The stack-translation tables evolve as bassclef adds support for new languages.
|