@thebassclef/lite 0.1.3 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +431 -135
- package/dist/cli.js +433 -137
- 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/{substrate → dist/lite}/.claude/hooks/artifact-ingestion-gate.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/assert-verify-steering.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/bassclef-source-config-validate.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/bassclef-sync.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/compound-noun-scrub.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/kiss-expansion-inject.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/longrun-prep-compounding-sequence-check.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/plain-english-steering.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/post-skill-friction-check.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/post-skill-telemetry.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/pre-build-gate.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/pre-commit-gate.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/session-end.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/session-reflection.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/skill-body-grade-gate.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/skill-body-intent-drift.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/state-validate.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/substrate-clarity-gate.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/temperance-gate.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/testing-tier-enforce.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/turn-prose-grade-measure.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/turn-prose-kiss-check.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/vocabulary-migration-check.sh +0 -0
- package/{substrate → dist/lite}/.claude/hooks/whereami-utc-gate.sh +0 -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/longrun-prep-compounding-axis-check.sh +0 -492
- package/substrate/.claude/hooks/skill-step-list-check.sh +0 -171
- 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,154 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
tier: lite
|
|
3
|
-
description: Schema for the YAML frontmatter that opens substrate files — .claude/skills/<name>/SKILL.md and .claude/rules/<name>.md.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Frontmatter Schema
|
|
7
|
-
|
|
8
|
-
Schema for the YAML frontmatter that opens substrate files — `.claude/skills/<name>/SKILL.md` and `.claude/rules/<name>.md`. Validated by `.claude/hooks/substrate-clarity-gate.sh` on Edit / Write (bassclef#862 Gap 1; WU-3 of bet 2026-06-18a).
|
|
9
|
-
|
|
10
|
-
Without write-time validation, `tech_stack_match:` declarations from WU-8 + WU-9, future `composes_with:` + `depends_on:` declarations from WU-15, and ordinary skill description fields ship with typos or missing required fields and only surface in adopter sessions. This schema closes the gap at the authoring surface.
|
|
11
|
-
|
|
12
|
-
## When the hook fires
|
|
13
|
-
|
|
14
|
-
On any Edit / Write to:
|
|
15
|
-
|
|
16
|
-
- `.claude/skills/<name>/SKILL.md`
|
|
17
|
-
- `.claude/rules/<name>.md`
|
|
18
|
-
|
|
19
|
-
Other substrate surfaces (luminaries, chronicles, iteration goals, decompositions, journal entries) keep their existing validation rules and do not gain frontmatter-schema enforcement in WU-3.
|
|
20
|
-
|
|
21
|
-
## What the hook validates
|
|
22
|
-
|
|
23
|
-
Three checks fire in order. The first to fail returns the exit code; further checks do not run.
|
|
24
|
-
|
|
25
|
-
| Check | Outcome | Exit |
|
|
26
|
-
|---|---|---|
|
|
27
|
-
| Frontmatter present at top of file (starts with `---`) | Required for files NOT on allowlist; missing → BLOCK | 2 |
|
|
28
|
-
| YAML parses cleanly | Malformed YAML → BLOCK | 2 |
|
|
29
|
-
| Required fields present + non-empty | Missing required → BLOCK | 2 |
|
|
30
|
-
| All field names are recognized | Unknown field → WARN; written to stderr | 0 |
|
|
31
|
-
|
|
32
|
-
The hook continues running existing checks (description length, INSTEAD-block, jargon ladder) after the schema pass.
|
|
33
|
-
|
|
34
|
-
## Skill schema
|
|
35
|
-
|
|
36
|
-
Frontmatter required for every `.claude/skills/<name>/SKILL.md`.
|
|
37
|
-
|
|
38
|
-
**Required fields:**
|
|
39
|
-
|
|
40
|
-
- `name` — the skill's slash-command alias. Lowercase, hyphens, no spaces.
|
|
41
|
-
- `description` — operator-readable one-liner. Length + verb-first + plain-language checks per `.claude/rules/skill-description-clarity.md`.
|
|
42
|
-
|
|
43
|
-
**Recognized optional fields:**
|
|
44
|
-
|
|
45
|
-
| Field | Used by | Type |
|
|
46
|
-
|---|---|---|
|
|
47
|
-
| `args` | skill body (operator-visible args reference) | string |
|
|
48
|
-
| `authoring_luminaries` | skills that declare which luminary lenses shaped their design; picked via `/extract-intent` Voyage matching or `/pick-luminaries` | object (primary: list, supporting: list) |
|
|
49
|
-
| `composes_baseline` | `/launch`, `/riff-prototypes`, `/frontend-design`, `/visual-review` | list[string] (luminary slugs) |
|
|
50
|
-
| `composes_with` | future — WU-15 (bassclef#862 Gap 3) | list[string] (skill slugs) |
|
|
51
|
-
| `depends_on` | future — WU-15 (bassclef#862 Gap 3) | list[string] (skill slugs) |
|
|
52
|
-
| `deprecated` | retirement metadata | bool |
|
|
53
|
-
| `deprecated_decision` | retirement metadata | string |
|
|
54
|
-
| `deprecated_in_favor_of` | retirement metadata | string |
|
|
55
|
-
| `disable_friction_check` | `/promote`-skip discipline | bool |
|
|
56
|
-
| `disable_model_invocation` | Claude Code harness routing | bool |
|
|
57
|
-
| `maturity` | skills declaring lifecycle stage — `alpha`, `beta`, `stable`, `hardened` per ADR-043 | string |
|
|
58
|
-
| `model_tier` | per-agent LLM tier routing | string |
|
|
59
|
-
| `modes` | mode-bearing skills (e.g., `/longrun`) | list[string] |
|
|
60
|
-
| `no_user_modes` | mode-bearing-skill opt-out | bool |
|
|
61
|
-
| `prereqs` | runtime prerequisites — richer shape per bassclef-web#94 | object (see prereqs schema below) |
|
|
62
|
-
| `requires` | runtime prerequisites — older simpler shape | object (cli + network) |
|
|
63
|
-
| `reserved_name_override` | reserved-name-shadow allow path | string |
|
|
64
|
-
| `sizes` | size-bearing skills (e.g., `/value-prop`) | list[string] |
|
|
65
|
-
| `tech_stack_match` | future — stack-bound skills | object |
|
|
66
|
-
| `tiers` | tier-bearing skills (e.g., `/shape`) | list[string] |
|
|
67
|
-
| `user_invocable` | Claude Code harness routing | bool |
|
|
68
|
-
|
|
69
|
-
Unknown fields surface as WARN — adopter-authored fields might appear here; the warning surfaces the new field but does not block.
|
|
70
|
-
|
|
71
|
-
## Prereqs schema (bassclef-web#94)
|
|
72
|
-
|
|
73
|
-
The `prereqs:` block splits runtime prerequisites into required + optional buckets so docs sites can render a signifier per bucket. Skills without a `prereqs:` block still work — docs render a generic "check the skill body" fallback.
|
|
74
|
-
|
|
75
|
-
```yaml
|
|
76
|
-
prereqs:
|
|
77
|
-
required:
|
|
78
|
-
cli: [git, gh]
|
|
79
|
-
env: [ANTHROPIC_API_KEY]
|
|
80
|
-
network: true
|
|
81
|
-
optional:
|
|
82
|
-
cli: [jq]
|
|
83
|
-
env: [VOYAGE_API_KEY]
|
|
84
|
-
note: "VOYAGE_API_KEY enables semantic ranking; grep-only fallback works without."
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Design rules per ticket:
|
|
88
|
-
|
|
89
|
-
- Optional. Skills without the block still work.
|
|
90
|
-
- 4-8 lines typical; 12 lines max. Docs sites render as a collapsed `<details>` block by default (progressive disclosure per Cooper).
|
|
91
|
-
- Uses tool names adopters already know — `git`, `gh`, `python3`, `jq`, `curl`. No bassclef vocabulary.
|
|
92
|
-
- Zero prereqs beyond "you have Claude Code running" — skip the block entirely.
|
|
93
|
-
|
|
94
|
-
Relationship to `requires:`:
|
|
95
|
-
|
|
96
|
-
- `requires:` is the older simpler shape (cli + network only). Existing skills that use it keep working.
|
|
97
|
-
- `prereqs:` is the newer richer shape (required / optional split + env vars + note). Preferred for new lite skills.
|
|
98
|
-
- No migration required. Both fields are recognized. Adopters pick per skill.
|
|
99
|
-
|
|
100
|
-
Docs render logic is out of scope for bassclef — docs sites (Fumadocs or similar) read the manifest and render the signifier block. Bassclef's job is to define the schema and apply it as an exemplar.
|
|
101
|
-
|
|
102
|
-
## Rule schema
|
|
103
|
-
|
|
104
|
-
Frontmatter is OPTIONAL for `.claude/rules/<name>.md`. Many existing rules carry no frontmatter and start with the body directly. When frontmatter IS present, it must conform.
|
|
105
|
-
|
|
106
|
-
**Required fields (when frontmatter is present):**
|
|
107
|
-
|
|
108
|
-
- `description` — one-line operator-readable description of what the rule enforces.
|
|
109
|
-
|
|
110
|
-
**Recognized optional fields:**
|
|
111
|
-
|
|
112
|
-
| Field | Used by | Type |
|
|
113
|
-
|---|---|---|
|
|
114
|
-
| `composes_with` | future — WU-15 (bassclef#862 Gap 3) | list[string] |
|
|
115
|
-
| `depends_on` | future — WU-15 (bassclef#862 Gap 3) | list[string] |
|
|
116
|
-
| `globs` | rule-routing (which file paths the rule applies to) | list[string] |
|
|
117
|
-
| `model_tier` | per-rule LLM tier routing | string |
|
|
118
|
-
| `tech_stack_match` | per-stack rule routing (WU-8 + WU-9; future Phase 2 work) | object — admits `lang`, `frontend`, `backend`, `orm`, `pkg_manager`, `deploy` per `standards/tech-stack-config.md` |
|
|
119
|
-
|
|
120
|
-
Unknown fields surface as WARN.
|
|
121
|
-
|
|
122
|
-
Rules with NO frontmatter pass through validation entirely (the schema applies only when frontmatter is present). Authors adding frontmatter to legacy rules pick the required + optional fields as appropriate.
|
|
123
|
-
|
|
124
|
-
## Allowlist baseline
|
|
125
|
-
|
|
126
|
-
`.claude/hooks/substrate-frontmatter-allowlist.txt` grandfathers files that fail validation today with a 60-day grace window. Same shape as `testing-tier-enforce-allowlist.txt` per bassclef#1037.
|
|
127
|
-
|
|
128
|
-
Format: `<repo-relative-path>|<grace-until ISO 8601>`.
|
|
129
|
-
|
|
130
|
-
At WU-3 ship, the allowlist is empty — current files (75 skills + 19 rules with frontmatter + 33 rules without) all pass. The file ships with its header explaining the shape so future violators can be added with grace if/when they surface.
|
|
131
|
-
|
|
132
|
-
## What this schema does NOT do
|
|
133
|
-
|
|
134
|
-
- Does not enforce field VALUE shape beyond presence + non-empty. `tech_stack_match` content is not validated against the `tech-stack.schema.json` ranges shipped in WU-2. That richer validation lives in the consumer-side hooks that USE the field (future Phase 3 work).
|
|
135
|
-
- Does not require frontmatter on legacy rules without one. 33 rules ship with no frontmatter today; the schema applies only when frontmatter IS present.
|
|
136
|
-
- Does not validate luminary, chronicle, iteration-bet, decomposition, or journal-entry frontmatter. Those surfaces have their own checks in the same hook.
|
|
137
|
-
- Does not catch description-quality issues — that's the existing `.claude/rules/skill-description-clarity.md` rule.
|
|
138
|
-
|
|
139
|
-
## Override path
|
|
140
|
-
|
|
141
|
-
`SKIP_SUBSTRATE_CLARITY=1` — same env var as the rest of the hook's checks. Logged via trace-helper. Use sparingly.
|
|
142
|
-
|
|
143
|
-
## Refs
|
|
144
|
-
|
|
145
|
-
- bassclef#862 Gap 1 — this schema closes it.
|
|
146
|
-
- bassclef#382 — substrate-clarity-gate hook (parent of this validation pass).
|
|
147
|
-
- WU-3 of bet `docs/iteration-bets/2026-06-18a-public-adopter-leverage-longrun.md` — ships the validation.
|
|
148
|
-
- Sister WU-15 (bassclef#862 Gap 3) — adds `composes_with` + `depends_on` field schemas + targets-exist validation.
|
|
149
|
-
- Pairs with `standards/tech-stack-config.md` (WU-2) — tech_stack_match values map to that schema's enums.
|
|
150
|
-
- Sister discipline: `.claude/rules/testing-tier-config.md` (bassclef#1037) — allowlist baseline pattern.
|
|
151
|
-
|
|
152
|
-
## Retirement condition
|
|
153
|
-
|
|
154
|
-
This schema retires only if bassclef migrates off YAML frontmatter as a substrate convention. Field set evolves as new substrate fields ship (e.g., WU-15 introduces composes_with + depends_on into the recognized set).
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
tier: lite
|
|
3
|
-
description: Defines how autonomous agent sessions save state, handle interruptions, and enable the next session to resume without data loss or ambiguity.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Graceful Exit + Checkpointing Standard
|
|
7
|
-
|
|
8
|
-
Defines how autonomous agent sessions save state, handle interruptions, and
|
|
9
|
-
enable the next session to resume without data loss or ambiguity.
|
|
10
|
-
|
|
11
|
-
This standard applies in all configurations. In orchestrator-gated mode it is
|
|
12
|
-
enforced. In operator-gated mode it is advisory — the human is steering, but
|
|
13
|
-
the checkpoint format is still useful.
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Exit Conditions
|
|
18
|
-
|
|
19
|
-
Every agent must recognize the following conditions and respond with the
|
|
20
|
-
prescribed action. Do not finish the current task before responding — respond
|
|
21
|
-
immediately when the condition is detected.
|
|
22
|
-
|
|
23
|
-
| Condition | Trigger | Required action |
|
|
24
|
-
|-----------|---------|----------------|
|
|
25
|
-
| Time budget exhausted | Turn count or duration reaches iteration ceiling | Save state, report progress, write checkpoint, end gracefully |
|
|
26
|
-
| Budget limit reached | Cost ceiling hit (from cost-governance.md) | Save state, surface cost delta, write checkpoint, end |
|
|
27
|
-
| Ambiguity unresolvable | Agent cannot proceed without a human decision that has not been delegated | Save state, write checkpoint with blocker stated, escalate to human |
|
|
28
|
-
| Blocked by external dependency | A required artifact, credential, service, or decision from outside the session is missing | Save state, log blocker in checkpoint, end — do NOT work around |
|
|
29
|
-
| Error after 3 diagnosis attempts | Three Is/Is Not + Five Whys cycles have not resolved the failure | Save state, escalate to Architect (Builder) or human, end |
|
|
30
|
-
| User interrupts | Human interrupts the session at any point | Save state immediately, write checkpoint, report what is done |
|
|
31
|
-
| Session idle timeout | Session has been inactive (platform-level) | Save state before context is lost |
|
|
32
|
-
| Context window pressure ≥ 70% | Active context fills to 70% of limit | Write checkpoint NOW, let compaction run, re-read survival kit after |
|
|
33
|
-
|
|
34
|
-
### What "save state" means
|
|
35
|
-
|
|
36
|
-
1. Commit any in-progress work (even if incomplete — use `chore: wip` if needed)
|
|
37
|
-
2. Clean up worktrees (see below)
|
|
38
|
-
3. Write or update `.claude/CHECKPOINT.md` (see format below)
|
|
39
|
-
4. Update `docs/whereami.md` to reflect current reality
|
|
40
|
-
5. Push if network is available
|
|
41
|
-
|
|
42
|
-
In that order. Steps 2-3 (worktree cleanup + checkpoint) must complete
|
|
43
|
-
before end of session. If steps 4-5 fail, the checkpoint file alone is
|
|
44
|
-
sufficient for recovery.
|
|
45
|
-
|
|
46
|
-
### Worktree cleanup (MUST — if any worktrees exist)
|
|
47
|
-
|
|
48
|
-
If the agent created or used worktrees during this session, clean them up
|
|
49
|
-
before writing the checkpoint. See `standards/worktree-management.md` for
|
|
50
|
-
the full protocol. Summary:
|
|
51
|
-
|
|
52
|
-
1. For each worktree: commit work, push branch, remove worktree
|
|
53
|
-
2. If removal fails (dirty state, locked files): note in checkpoint
|
|
54
|
-
3. Never leave the session with active worktrees if avoidable
|
|
55
|
-
4. The next session's pre-session audit will catch anything missed
|
|
56
|
-
|
|
57
|
-
This is a MUST gate because stale worktrees cause branch locks, disk
|
|
58
|
-
waste, and confusing state for the next session.
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## Checkpoint Format
|
|
63
|
-
|
|
64
|
-
**Location**: `.claude/CHECKPOINT.md`
|
|
65
|
-
|
|
66
|
-
This file is overwritten on every checkpoint. It contains the latest state
|
|
67
|
-
only — it is not a log. The chronicle is the log.
|
|
68
|
-
|
|
69
|
-
```markdown
|
|
70
|
-
# Checkpoint
|
|
71
|
-
|
|
72
|
-
written_at: YYYY-MM-DDTHH:MM:SSZ
|
|
73
|
-
session_id: (same as chronicle entry if one exists)
|
|
74
|
-
exit_reason: (one of: appetite_exhausted | budget_limit | ambiguity | blocked |
|
|
75
|
-
error_escalation | user_interrupt | idle_timeout | context_pressure |
|
|
76
|
-
role_transition | phase_transition | periodic)
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
## Agent state
|
|
81
|
-
|
|
82
|
-
active_agent: Builder
|
|
83
|
-
task: Implementing SearchBar component per spec at docs/specs/crm.md#search
|
|
84
|
-
status: in_progress # done | in_progress | blocked
|
|
85
|
-
|
|
86
|
-
### Done this session
|
|
87
|
-
- Implemented DealCard component (commit abc1234)
|
|
88
|
-
- Added unit tests for DealCard (commit def5678)
|
|
89
|
-
- Updated design tokens for card treatment (commit ghi9012)
|
|
90
|
-
|
|
91
|
-
### In progress
|
|
92
|
-
- SearchBar component — skeleton written, filter logic incomplete
|
|
93
|
-
- File: src/components/SearchBar.tsx (partially complete)
|
|
94
|
-
- Blocking decision: none
|
|
95
|
-
- Estimated remaining: ~15 turns
|
|
96
|
-
|
|
97
|
-
### Blocked
|
|
98
|
-
(none — or state the blocker)
|
|
99
|
-
|
|
100
|
-
### Artifacts produced this session
|
|
101
|
-
| Artifact | Path | Commit |
|
|
102
|
-
|----------|------|--------|
|
|
103
|
-
| DealCard component | src/components/DealCard.tsx | abc1234 |
|
|
104
|
-
| DealCard tests | src/components/DealCard.test.tsx | def5678 |
|
|
105
|
-
| Design tokens | docs/design/tokens/card.md | ghi9012 |
|
|
106
|
-
|
|
107
|
-
### Decision authority exercised
|
|
108
|
-
- Accepted ADR-009 (component library choice) — no violations
|
|
109
|
-
- Spec interpretation: SearchBar debounce = 300ms (inferred from interaction-design)
|
|
110
|
-
|
|
111
|
-
---
|
|
112
|
-
|
|
113
|
-
## Iteration state
|
|
114
|
-
|
|
115
|
-
iteration_bet: docs/iteration-bets/2026-04-07-crm-build.md
|
|
116
|
-
iteration_phase: Construction
|
|
117
|
-
gate_checklist:
|
|
118
|
-
- [x] Spec exists and is referenced
|
|
119
|
-
- [x] GitHub issue open (#41)
|
|
120
|
-
- [x] Branch stack manifest written
|
|
121
|
-
- [ ] All tasks complete
|
|
122
|
-
- [ ] Reviewer sign-off
|
|
123
|
-
- [ ] Designer sign-off
|
|
124
|
-
|
|
125
|
-
risk_register_changes: none this session
|
|
126
|
-
|
|
127
|
-
budget:
|
|
128
|
-
turns_consumed: 14
|
|
129
|
-
turns_remaining: ~6 (estimate)
|
|
130
|
-
duration: ~22 minutes
|
|
131
|
-
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
## Handoff state
|
|
135
|
-
|
|
136
|
-
next_agent: Builder (resume) | Reviewer (if all tasks done)
|
|
137
|
-
resume_task: Complete SearchBar filter logic, then /verify, then open PR
|
|
138
|
-
|
|
139
|
-
### Survival kit (what the next agent MUST read before starting)
|
|
140
|
-
1. docs/iteration-bets/2026-04-07-crm-build.md — scope + acceptance criteria
|
|
141
|
-
2. docs/specs/crm.md — current spec
|
|
142
|
-
3. strategy/agent-choreography.md Section 9 — MUST gates
|
|
143
|
-
4. docs/whereami.md — current phase and subsystem status
|
|
144
|
-
5. docs/branch-stacks/2026-04-07-crm-stack.md — branch dependencies
|
|
145
|
-
6. .claude/agents/builder.md — luminaries + checkpointing rules
|
|
146
|
-
|
|
147
|
-
### Context the next agent needs
|
|
148
|
-
- SearchBar is branch `feature/41-crm-search`, PR not yet open
|
|
149
|
-
- DealCard PR is open (#38), awaiting Reviewer
|
|
150
|
-
- Design token values are in docs/design/tokens/card.md — read before building
|
|
151
|
-
|
|
152
|
-
### Blockers for the next agent
|
|
153
|
-
(none — or state them clearly)
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
## Checkpoint Triggers
|
|
159
|
-
|
|
160
|
-
Checkpoints fire in two modes: event-driven and periodic.
|
|
161
|
-
|
|
162
|
-
### Event-driven triggers (fire immediately when the event occurs)
|
|
163
|
-
|
|
164
|
-
| Event | Who triggers |
|
|
165
|
-
|-------|-------------|
|
|
166
|
-
| Any exit condition (see table above) | Active agent |
|
|
167
|
-
| Role transition (any agent hands off to another) | Outgoing agent, before signaling completion |
|
|
168
|
-
| Phase transition (Inception → Elaboration, etc.) | Orchestrator, after gate validation |
|
|
169
|
-
| Context pressure ≥ 70% | Active agent (self-monitored) |
|
|
170
|
-
|
|
171
|
-
### Periodic trigger
|
|
172
|
-
|
|
173
|
-
Every 20 turns (configurable in substrate.config.md as `checkpoint_interval`).
|
|
174
|
-
If no `checkpoint_interval` is set, default is 20 turns.
|
|
175
|
-
|
|
176
|
-
The periodic trigger exists because event-driven triggers rely on the agent
|
|
177
|
-
recognizing the event. Long tasks can drift without triggering any event.
|
|
178
|
-
The periodic checkpoint ensures a recovery point always exists within 20 turns.
|
|
179
|
-
|
|
180
|
-
### What to skip
|
|
181
|
-
|
|
182
|
-
Do NOT write a checkpoint for trivial tool calls (read, grep, glob). A
|
|
183
|
-
checkpoint is a meaningful state save — it fires at the granularity of
|
|
184
|
-
"completed or partially completed a task," not at every action.
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
## Recovery Protocol
|
|
189
|
-
|
|
190
|
-
When a session starts after a previous session ended abnormally (or was
|
|
191
|
-
interrupted), the Orchestrator (or the operator in operator-gated mode) checks for a
|
|
192
|
-
checkpoint before scheduling any work:
|
|
193
|
-
|
|
194
|
-
1. Check if `.claude/CHECKPOINT.md` exists
|
|
195
|
-
2. If it exists: read it, read `docs/whereami.md`, reconcile any gaps
|
|
196
|
-
3. Present to operator:
|
|
197
|
-
```
|
|
198
|
-
Last session stopped: [exit_reason] at [written_at]
|
|
199
|
-
Active agent was: [agent] working on [task]
|
|
200
|
-
Done: [list from checkpoint]
|
|
201
|
-
In progress: [list from checkpoint]
|
|
202
|
-
Blocked: [list from checkpoint]
|
|
203
|
-
Resume from here, or restart from last clean gate?
|
|
204
|
-
```
|
|
205
|
-
4. On resume: activate the agent named in `next_agent`, point it at the
|
|
206
|
-
survival kit files listed in the checkpoint
|
|
207
|
-
5. On restart: operator decides what to keep. Delete checkpoint after restart
|
|
208
|
-
to avoid stale state
|
|
209
|
-
|
|
210
|
-
The checkpoint is advisory — the operator always decides whether to resume
|
|
211
|
-
or restart. Never resume silently without presenting the checkpoint summary.
|
|
212
|
-
|
|
213
|
-
---
|
|
214
|
-
|
|
215
|
-
## Relationship to Other Standards
|
|
216
|
-
|
|
217
|
-
| Standard | Relationship |
|
|
218
|
-
|----------|-------------|
|
|
219
|
-
| `strategy/agent-choreography.md` | Sections 10 and 12a define when to checkpoint; this standard defines how |
|
|
220
|
-
| `.claude/rules/guardrails.md` | Exit conditions in guardrails reference this standard for protocol |
|
|
221
|
-
| `.claude/skills/session-end/SKILL.md` | Session-end reads the checkpoint if present; incorporates it into the chronicle |
|
|
222
|
-
| `standards/branch-stacking.md` | Branch stack manifest is part of the survival kit for Construction checkpoints |
|
|
223
|
-
| `docs/whereami.md` | Updated at every checkpoint; the checkpoint and whereami are complementary |
|
|
224
|
-
|
|
225
|
-
The checkpoint captures **agent-level state** (what this agent was doing, what's
|
|
226
|
-
done, what's next). Phase-state captures **project-level state** (phase, iteration,
|
|
227
|
-
subsystem maturity). Both must be current for a clean recovery.
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
tier: lite
|
|
3
|
-
description: Hooks must be idempotent. If a hook fails partway and reruns, it must not duplicate work, generate false warnings, or corrupt state.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Hook Idempotency Standard
|
|
7
|
-
|
|
8
|
-
## Principle
|
|
9
|
-
|
|
10
|
-
Hooks must be idempotent. If a hook fails partway and reruns, it must
|
|
11
|
-
not duplicate work, generate false warnings, or corrupt state.
|
|
12
|
-
|
|
13
|
-
## Rules
|
|
14
|
-
|
|
15
|
-
### 1. No write-then-detect
|
|
16
|
-
|
|
17
|
-
A hook must not write state and then check for that state in the same
|
|
18
|
-
execution. The classic violation:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
# BAD: writes SESSION_LOCK, then detects it and warns "another session active"
|
|
22
|
-
echo "$(date)" > .claude/SESSION_LOCK
|
|
23
|
-
if [ -f .claude/SESSION_LOCK ]; then
|
|
24
|
-
echo "WARNING: another session may be active"
|
|
25
|
-
fi
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Fix: check BEFORE writing, or use a lock acquisition pattern:
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
# GOOD: check first, then write
|
|
32
|
-
if [ -f .claude/SESSION_LOCK ]; then
|
|
33
|
-
echo "WARNING: another session may be active"
|
|
34
|
-
else
|
|
35
|
-
echo "$(date)" > .claude/SESSION_LOCK
|
|
36
|
-
fi
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### 2. Append with dedup
|
|
40
|
-
|
|
41
|
-
Hooks that append to files (trace logs, artifact lists) must check
|
|
42
|
-
whether the content already exists:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
# BAD: appends every run, creating duplicates on retry
|
|
46
|
-
echo "gate: temperance" >> docs/sdlc-traces/today.log
|
|
47
|
-
|
|
48
|
-
# GOOD: check before appending
|
|
49
|
-
grep -q "gate: temperance" docs/sdlc-traces/today.log 2>/dev/null || \
|
|
50
|
-
echo "gate: temperance" >> docs/sdlc-traces/today.log
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### 3. Create-if-missing, not create-always
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
# BAD: overwrites existing file on every run
|
|
57
|
-
echo "# Risk Register" > docs/risk-register.md
|
|
58
|
-
|
|
59
|
-
# GOOD: only create if missing
|
|
60
|
-
[ -f docs/risk-register.md ] || echo "# Risk Register" > docs/risk-register.md
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### 4. Exit codes are meaningful
|
|
64
|
-
|
|
65
|
-
- Exit 0: hook succeeded, continue
|
|
66
|
-
- Exit non-zero: hook failed, behavior depends on hook type
|
|
67
|
-
- PreToolUse hooks: non-zero blocks the tool call
|
|
68
|
-
- PostToolUse/Stop hooks: non-zero is logged but doesn't block
|
|
69
|
-
|
|
70
|
-
Never swallow errors silently:
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
# BAD: hides failures
|
|
74
|
-
some_command 2>/dev/null || true
|
|
75
|
-
|
|
76
|
-
# GOOD: log the failure, then decide whether to continue
|
|
77
|
-
some_command 2>&1 || echo "WARNING: some_command failed (non-blocking)"
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### 5. Timeout awareness
|
|
81
|
-
|
|
82
|
-
Stop hooks have limited execution time. If your Stop hook does
|
|
83
|
-
network operations (git push, API calls), put them AFTER local
|
|
84
|
-
operations so that local artifacts are saved even if the hook times out.
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
# Phase 1: Local (always completes)
|
|
88
|
-
write_chronicle
|
|
89
|
-
update_memory
|
|
90
|
-
remove_session_lock
|
|
91
|
-
|
|
92
|
-
# Phase 2: Remote (may timeout — that's OK)
|
|
93
|
-
git push || echo "WARNING: push failed — run manually"
|
|
94
|
-
push_to_gdoc || echo "WARNING: Google Doc push skipped"
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
Minimum recommended Stop hook timeout: 30 seconds.
|
|
98
|
-
|
|
99
|
-
## Verification
|
|
100
|
-
|
|
101
|
-
The `/substrate-check` skill includes a hook idempotency spot-check (step 8)
|
|
102
|
-
that scans for common violations of these rules.
|