@thebassclef/lite 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +85 -4
  3. package/dist/cli.cjs +1610 -0
  4. package/dist/cli.js +1587 -0
  5. package/dist/index.cjs +4 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +4 -0
  8. package/package.json +51 -3
  9. package/substrate/.bassclef/lite-manifest.json +1794 -0
  10. package/substrate/.claude/agents/architect.md +70 -0
  11. package/substrate/.claude/agents/builder.md +114 -0
  12. package/substrate/.claude/agents/designer.md +156 -0
  13. package/substrate/.claude/agents/reviewer.md +88 -0
  14. package/substrate/.claude/hooks/artifact-ingestion-gate.sh +357 -0
  15. package/substrate/.claude/hooks/assert-verify-steering.sh +77 -0
  16. package/substrate/.claude/hooks/bassclef-source-config-validate.sh +215 -0
  17. package/substrate/.claude/hooks/bassclef-sync.sh +634 -0
  18. package/substrate/.claude/hooks/compound-noun-scrub.sh +292 -0
  19. package/substrate/.claude/hooks/kiss-expansion-inject.sh +69 -0
  20. package/substrate/.claude/hooks/plain-english-steering.sh +156 -0
  21. package/substrate/.claude/hooks/post-skill-friction-check.sh +177 -0
  22. package/substrate/.claude/hooks/post-skill-telemetry.sh +62 -0
  23. package/substrate/.claude/hooks/pre-build-gate.sh +511 -0
  24. package/substrate/.claude/hooks/pre-commit-gate.sh +452 -0
  25. package/substrate/.claude/hooks/session-end.sh +433 -0
  26. package/substrate/.claude/hooks/session-reflection.sh +303 -0
  27. package/substrate/.claude/hooks/skill-body-grade-gate.sh +219 -0
  28. package/substrate/.claude/hooks/skill-body-intent-drift.sh +107 -0
  29. package/substrate/.claude/hooks/skill-step-list-check.sh +171 -0
  30. package/substrate/.claude/hooks/state-validate.sh +271 -0
  31. package/substrate/.claude/hooks/substrate-clarity-gate.sh +1110 -0
  32. package/substrate/.claude/hooks/temperance-gate.sh +147 -0
  33. package/substrate/.claude/hooks/testing-tier-enforce.sh +233 -0
  34. package/substrate/.claude/hooks/turn-prose-grade-measure.sh +219 -0
  35. package/substrate/.claude/hooks/turn-prose-kiss-check.sh +434 -0
  36. package/substrate/.claude/hooks/vocabulary-migration-check.sh +171 -0
  37. package/substrate/.claude/hooks/whereami-utc-gate.sh +142 -0
  38. package/substrate/.claude/luminaries/alan-cooper.md +170 -0
  39. package/substrate/.claude/luminaries/alistair-cockburn.md +140 -0
  40. package/substrate/.claude/luminaries/amazon-pr-faq.md +34 -0
  41. package/substrate/.claude/luminaries/ash-maurya.md +121 -0
  42. package/substrate/.claude/luminaries/bill-buxton.md +210 -0
  43. package/substrate/.claude/luminaries/charles-sanders-peirce.md +150 -0
  44. package/substrate/.claude/luminaries/david-ogilvy.md +192 -0
  45. package/substrate/.claude/luminaries/don-norman.md +173 -0
  46. package/substrate/.claude/luminaries/edward-tufte.md +179 -0
  47. package/substrate/.claude/luminaries/eric-evans.md +160 -0
  48. package/substrate/.claude/luminaries/frederick-brooks.md +50 -0
  49. package/substrate/.claude/luminaries/gang-of-four.md +157 -0
  50. package/substrate/.claude/luminaries/jason-fried-dhh.md +46 -0
  51. package/substrate/.claude/luminaries/jesse-james-garrett.md +154 -0
  52. package/substrate/.claude/luminaries/john-ousterhout.md +94 -0
  53. package/substrate/.claude/luminaries/karl-popper.md +132 -0
  54. package/substrate/.claude/luminaries/kent-beck.md +168 -0
  55. package/substrate/.claude/luminaries/linus-torvalds.md +218 -0
  56. package/substrate/.claude/luminaries/martin-fowler.md +164 -0
  57. package/substrate/.claude/luminaries/michael-feathers.md +125 -0
  58. package/substrate/.claude/luminaries/michael-nygard.md +118 -0
  59. package/substrate/.claude/luminaries/robert-c-martin.md +164 -0
  60. package/substrate/.claude/luminaries/saltzer-schroeder.md +194 -0
  61. package/substrate/.claude/luminaries/sophia-prater.md +193 -0
  62. package/substrate/.claude/luminaries/stephen-toulmin.md +131 -0
  63. package/substrate/.claude/rules/artifact-ingestion.md +179 -0
  64. package/substrate/.claude/rules/assert-only-after-verify.md +137 -0
  65. package/substrate/.claude/rules/blocked-items.md +146 -0
  66. package/substrate/.claude/rules/branching.md +28 -0
  67. package/substrate/.claude/rules/commit-conventions.md +22 -0
  68. package/substrate/.claude/rules/context-engineering.md +202 -0
  69. package/substrate/.claude/rules/context-management.md +85 -0
  70. package/substrate/.claude/rules/destructive-operations.md +69 -0
  71. package/substrate/.claude/rules/diagnosis.md +38 -0
  72. package/substrate/.claude/rules/guardrails.md +73 -0
  73. package/substrate/.claude/rules/identifier-leak-prevention.md +104 -0
  74. package/substrate/.claude/rules/lite-manifest-schema-change-discipline.md +98 -0
  75. package/substrate/.claude/rules/oo-ad-entry-point.md +117 -0
  76. package/substrate/.claude/rules/operator-facing-prose.md +196 -0
  77. package/substrate/.claude/rules/plain-english-discipline.md +154 -0
  78. package/substrate/.claude/rules/pr-body-shape.md +317 -0
  79. package/substrate/.claude/rules/pr-strategy.md +167 -0
  80. package/substrate/.claude/rules/sdlc-gates.md +149 -0
  81. package/substrate/.claude/rules/session-artifacts.md +236 -0
  82. package/substrate/.claude/rules/state-schema-validation.md +162 -0
  83. package/substrate/.claude/rules/whereami-load-bearing.md +202 -0
  84. package/substrate/.claude/rules/writing-craft-discipline.md +92 -0
  85. package/substrate/.claude/skills/build/SKILL.md +640 -0
  86. package/substrate/.claude/skills/decompose/SKILL.md +280 -0
  87. package/substrate/.claude/skills/diagnose/SKILL.md +297 -0
  88. package/substrate/.claude/skills/howdoi/SKILL.md +105 -0
  89. package/substrate/.claude/skills/ia-model/SKILL.md +108 -0
  90. package/substrate/.claude/skills/interaction-design/SKILL.md +112 -0
  91. package/substrate/.claude/skills/interpret-input/SKILL.md +180 -0
  92. package/substrate/.claude/skills/kiss/SKILL.md +449 -0
  93. package/substrate/.claude/skills/launch/SKILL.md +924 -0
  94. package/substrate/.claude/skills/lean-canvas/SKILL.md +332 -0
  95. package/substrate/.claude/skills/longrun/SKILL.md +426 -0
  96. package/substrate/.claude/skills/luminary/SKILL.md +481 -0
  97. package/substrate/.claude/skills/ogilvy-writing-audit/SKILL.md +177 -0
  98. package/substrate/.claude/skills/onboard-repo/SKILL.md +2190 -0
  99. package/substrate/.claude/skills/pattern-review/SKILL.md +99 -0
  100. package/substrate/.claude/skills/personas/SKILL.md +207 -0
  101. package/substrate/.claude/skills/promote/SKILL.md +283 -0
  102. package/substrate/.claude/skills/requirement/SKILL.md +98 -0
  103. package/substrate/.claude/skills/retro/SKILL.md +117 -0
  104. package/substrate/.claude/skills/riff/SKILL.md +114 -0
  105. package/substrate/.claude/skills/roadmap-reconcile/SKILL.md +163 -0
  106. package/substrate/.claude/skills/session-end/SKILL.md +309 -0
  107. package/substrate/.claude/skills/session-log/SKILL.md +299 -0
  108. package/substrate/.claude/skills/skills/SKILL.md +228 -0
  109. package/substrate/.claude/skills/spec/SKILL.md +105 -0
  110. package/substrate/.claude/skills/sprint/SKILL.md +392 -0
  111. package/substrate/.claude/skills/stage/SKILL.md +384 -0
  112. package/substrate/.claude/skills/state-a-problem/SKILL.md +185 -0
  113. package/substrate/.claude/skills/temperance/SKILL.md +108 -0
  114. package/substrate/.claude/skills/use-case/SKILL.md +417 -0
  115. package/substrate/.claude/skills/user-stories/SKILL.md +268 -0
  116. package/substrate/.claude/skills/value-prop/SKILL.md +251 -0
  117. package/substrate/.claude/skills/verify/SKILL.md +160 -0
  118. package/substrate/.claude/skills/whereami/SKILL.md +307 -0
  119. package/substrate/AGENTS.md +79 -0
  120. package/substrate/CLAUDE-lite.md +85 -0
  121. package/substrate/CODE_OF_CONDUCT.md +28 -0
  122. package/substrate/CONTRIBUTING.md +177 -0
  123. package/substrate/README.md +173 -0
  124. package/substrate/SECURITY.md +19 -0
  125. package/substrate/architecture/decisions/ADR-029-release-pipeline.md +79 -0
  126. package/substrate/architecture/decisions/ADR-031-non-breaking-changes-adopter-discipline.md +139 -0
  127. package/substrate/architecture/decisions/ADR-032-adopter-sync-dispatcher-architecture.md +192 -0
  128. package/substrate/architecture/decisions/ADR-039-release-tagging-scheme.md +145 -0
  129. package/substrate/architecture/decisions/ADR-040-planning-skill-vocabulary-and-lite-profile.md +155 -0
  130. package/substrate/architecture/decisions/ADR-044-unified-skill-body-template.md +162 -0
  131. package/substrate/lib/clean-artifacts-sweep.sh +112 -0
  132. package/substrate/lib/code-comment-discipline.sh +144 -0
  133. package/substrate/lib/composer-preflight.sh +459 -0
  134. package/substrate/lib/hook-inject.sh +255 -0
  135. package/substrate/lib/luminary-pick.sh +96 -0
  136. package/substrate/lib/output-discipline.sh +143 -0
  137. package/substrate/lib/rewrite-check.sh +214 -0
  138. package/substrate/lib/state.sh +1372 -0
  139. package/substrate/lib/telemetry.sh +205 -0
  140. package/substrate/lib/tier-check.sh +138 -0
  141. package/substrate/lib/tier-dependency-audit.sh +933 -0
  142. package/substrate/presence/install/bassclef-hook-connect.sh +178 -0
  143. package/substrate/presence/install/bassclef-sync.dispatcher.template.sh +841 -0
  144. package/substrate/presence/install/bassclef-sync.template.sh +2076 -0
  145. package/substrate/presence/install/schedule-auto-save.cron.sh +88 -0
  146. package/substrate/presence/install/schedule-auto-save.taskscheduler.md +122 -0
  147. package/substrate/scripts/aggregate-telemetry.sh +217 -0
  148. package/substrate/scripts/analyze-tier-dependencies.sh +239 -0
  149. package/substrate/scripts/generate-lite-manifest.sh +489 -0
  150. package/substrate/scripts/generate-tier-manifest.sh +28 -0
  151. package/substrate/scripts/intent-drift-check.sh +456 -0
  152. package/substrate/scripts/lite-manifest-drift-check.sh +146 -0
  153. package/substrate/scripts/render-lite-manifest-doc.sh +150 -0
  154. package/substrate/standards/bassclef-configs-schema.md +232 -0
  155. package/substrate/standards/bassclef-evolution.md +143 -0
  156. package/substrate/standards/bassclef-internal-jargon.md +244 -0
  157. package/substrate/standards/bassclef-managed-sentinel.md +96 -0
  158. package/substrate/standards/bassclef-source-config.md +228 -0
  159. package/substrate/standards/deferred-actions-schema.md +204 -0
  160. package/substrate/standards/docs-sync-allowlist.md +76 -0
  161. package/substrate/standards/graceful-exit.md +227 -0
  162. package/substrate/standards/hook-idempotency.md +102 -0
  163. package/substrate/standards/lite-manifest-schema-changes.md +75 -0
  164. package/substrate/standards/luminary-problem-patterns.md +481 -0
  165. package/substrate/standards/ogilvy-writing-rules.md +225 -0
  166. package/substrate/standards/opener-discipline.md +96 -0
  167. package/substrate/standards/operator-facing-prose-discipline.md +201 -0
  168. package/substrate/standards/project-directory-layout.md +276 -0
  169. package/substrate/standards/release-tagging.md +137 -0
  170. package/substrate/standards/sdlc-compliance.md +286 -0
  171. package/substrate/standards/secrets-lifecycle.md +210 -0
  172. package/substrate/standards/security-scanner-adapter.md +145 -0
  173. package/substrate/standards/skill-output-discipline.md +90 -0
  174. package/substrate/standards/state-spine.md +511 -0
  175. package/substrate/standards/tech-stack-config.md +109 -0
  176. package/substrate/standards/tier-dependency-analysis.md +167 -0
  177. package/substrate/standards/tier-runtime-deps/lite.md +57 -0
  178. package/substrate/standards/tier-tag-schema.md +155 -0
  179. package/substrate/standards/whereami-schema.md +301 -0
  180. package/substrate/standards/writing-guide.md +213 -0
  181. package/substrate/templates/deferred-action-template.md +45 -0
  182. package/substrate/templates/whereami-template.md +101 -0
@@ -0,0 +1,204 @@
1
+ ---
2
+ tier: lite
3
+ description: Standard for docs/deferred-actions/*.md entries — the capability-routed handoff primitive that carries deferred work across session modalities.
4
+ ---
5
+
6
+ # Deferred Actions Schema
7
+
8
+ Standard for `docs/deferred-actions/*.md` entries — the capability-routed
9
+ handoff primitive that carries deferred work across session modalities.
10
+
11
+ Any session whose capabilities don't satisfy a pending action writes an
12
+ entry. Any capable future session picks it up at session-start via
13
+ `.claude/hooks/session-reflection.d/60-deferred-actions.sh`.
14
+
15
+ ## Why this exists
16
+
17
+ Sessions have different capability surfaces (desktop, mobile-ephemeral,
18
+ cloud-web, CI). Work produced in one environment may not be deliverable
19
+ from that environment — a mobile session can compose a release-notes
20
+ addendum but cannot push it to Google Docs (no service-account key);
21
+ an abruptly-stopped session has pending artifacts but no chance to
22
+ push them.
23
+
24
+ Without this handoff, that work silently drops. With it, the next
25
+ capable session sees a `BLOCKED:` entry and resolves it inline with
26
+ the existing blocked-items protocol.
27
+
28
+ ## File location
29
+
30
+ ```
31
+ docs/deferred-actions/
32
+ ├── README.md
33
+ ├── <ISO-ts>-<slug>.md # pending entries
34
+ └── completed/
35
+ └── <ISO-ts>-<slug>.md # git mv'd here on resolution (audit trail)
36
+ ```
37
+
38
+ Entries live flat under `docs/deferred-actions/`. On completion, the
39
+ session that resolves the entry runs `git mv` to `completed/` as the
40
+ audit record. The file name never changes, so history tracks the same
41
+ file across the move.
42
+
43
+ ## Frontmatter schema
44
+
45
+ Every entry starts with YAML frontmatter. Required fields are enforced
46
+ by the scan hook; missing required fields cause the entry to surface as
47
+ `MALFORMED:` with a pointer to this standard.
48
+
49
+ ```yaml
50
+ ---
51
+ id: <ISO-ts>-<slug>
52
+ created_by_session: <chronicle-slug-or-session-id>
53
+ created_in: desktop | ephemeral-mobile | ephemeral-ci | cloud-web
54
+ created_at: <ISO-8601 timestamp, UTC>
55
+ pending_action: <slug describing the action>
56
+ requires_capability: [<cap>, <cap>, ...]
57
+ priority: high | medium | low
58
+ origin_skill: /<skill-name>
59
+ resolves_when: |
60
+ <multi-line description of what "done" looks like>
61
+ ---
62
+ ```
63
+
64
+ ### Field reference
65
+
66
+ | Field | Required | Notes |
67
+ |-------|----------|-------|
68
+ | `id` | yes | Human-readable slug matching the filename (without `.md`). Pattern: `YYYY-MM-DDTHH-MM-SSZ-<slug>`. Dashes in the timestamp portion to keep it filesystem-safe. |
69
+ | `created_by_session` | yes | Chronicle filename (without `.md`) when available; otherwise a session identifier that future readers can trace. |
70
+ | `created_in` | yes | Modality vocabulary — one of `desktop`, `ephemeral-mobile`, `ephemeral-ci`, `cloud-web`. Extend vocabulary by adding rows to the modality table below, not by inventing values inline. |
71
+ | `created_at` | yes | ISO-8601 UTC timestamp. Used by the scan hook to sort entries by age for surfacing. |
72
+ | `pending_action` | yes | Slug describing what needs to happen. Not free-form prose — a reviewable verb phrase. Examples: `push-release-notes-to-gdoc`, `write-retroactive-version-tag`, `apply-memory-proposal`. |
73
+ | `requires_capability` | yes | List of capability tokens (vocabulary below). Session-start hook compares to current modality's capabilities; match → `BLOCKED:`, miss → `INFORM:`. |
74
+ | `priority` | yes | `high` / `medium` / `low`. Surfaces sort order + operator attention. Reserve `high` for integrity-critical (missing chronicle, lost memory proposal). |
75
+ | `origin_skill` | yes | Slash-command name of the skill that created the entry (e.g., `/release-notes`). Lets the session resuming the work re-enter the same skill with context. |
76
+ | `resolves_when` | yes | Plain-language description of the end state. Not a checklist — one or two sentences the resolver can match against. |
77
+
78
+ ## Capability vocabulary
79
+
80
+ Stable set. Extend via this standard, not by inventing tokens inline.
81
+
82
+ | Capability | Meaning |
83
+ |------------|---------|
84
+ | `gcloud-auth` | Session can authenticate to Google Cloud (SA key at `~/.config/gcloud/sunjay-google-ops.json`). Needed for Google Docs push. |
85
+ | `google-docs-write` | Session has network + credentials to write to Google Docs. Composite — requires `gcloud-auth` + `network`. |
86
+ | `gh-auth` | `gh` CLI installed + authenticated in this session. |
87
+ | `git-push` | Session can push commits to remote (SSH keys or HTTPS PAT present). |
88
+ | `git-tag` | Session can create + push annotated tags. Superset of `git-push`. |
89
+ | `network` | Session has outbound internet access. Ephemeral sandboxes may not. |
90
+ | `memory-write` | Session can write to `~/.claude/projects/.../memory/`. Ephemeral sandboxes cannot. |
91
+ | `npm-install` | Session has npm + network to install packages. |
92
+ | `playwright-mcp` | Playwright MCP server configured in settings — visual review possible. |
93
+ | `docker-socket` | Session can run Docker (some CI runners + most desktops). |
94
+
95
+ New capabilities require a row here. The scan hook uses this table to
96
+ match entries to sessions — an entry requiring `rhyming-slang-decoder`
97
+ would never resolve because no modality advertises that capability.
98
+
99
+ ## Modality → capability table (reference)
100
+
101
+ Session-start hook detects modality and synthesizes the capability set.
102
+ Not all modalities are static — a desktop session without `gcloud` auth
103
+ is missing `gcloud-auth` even if its modality generally has it. The
104
+ hook's detection logic (at `60-deferred-actions.sh`) is the source of
105
+ truth; this table is human reference.
106
+
107
+ | Modality | Typical capabilities |
108
+ |----------|---------------------|
109
+ | `desktop` | `gcloud-auth`, `gh-auth`, `git-push`, `git-tag`, `network`, `memory-write`, `npm-install`, `playwright-mcp` |
110
+ | `ephemeral-mobile` | `gh-auth`, `git-push`, `network` (fine-grained PAT only; no `gcloud`, no `memory-write`) |
111
+ | `ephemeral-ci` | `gh-auth`, `git-push`, `network`, workflow-secret-scoped (may include `google-docs-write` via SA key stored in GH secrets) |
112
+ | `cloud-web` | `network` (limited — no shell, no git, no auth) |
113
+
114
+ ## Priority ladder
115
+
116
+ | Priority | When to use |
117
+ |----------|-------------|
118
+ | `high` | Integrity-critical: missing chronicle, orphaned memory proposal, data that will be lost if the next session doesn't pick it up. |
119
+ | `medium` | Delivery gaps with a real downstream cost: release notes not pushed to Google Doc (weekly changelog goes stale), LinkedIn draft not published. |
120
+ | `low` | Nice-to-have: metrics refresh, backfill of an ancillary artifact, retroactive tagging. |
121
+
122
+ Default `medium` if uncertain. Escalate to `high` only when silent drop
123
+ costs more than the cognitive load on the resolver.
124
+
125
+ ## Body sections (in order)
126
+
127
+ Below the frontmatter, the body uses four sections. Session-reflection
128
+ surfaces frontmatter only; the body is for the resolving session.
129
+
130
+ ```markdown
131
+ ## Context
132
+
133
+ Why the work was deferred (one paragraph). Enough for a resolver who
134
+ wasn't in the original session to understand what's pending and why it
135
+ matters.
136
+
137
+ ## Command to execute
138
+
139
+ Exact command, env vars, or agent instruction the resolver runs to
140
+ complete the work. Copy-pasteable. If the resolution is multi-step, a
141
+ small checklist. If it requires operator judgment (merge proposal,
142
+ edit memory file), state "operator action" and describe it.
143
+
144
+ ## On completion
145
+
146
+ What the resolver does after the action succeeds — usually `git mv`
147
+ to `completed/` and any side-effect artifacts (e.g., "commit the push
148
+ log as chronicle footnote").
149
+
150
+ ## Cross-refs
151
+
152
+ Related PRs, issues, chronicles, memory entries, or other deferred
153
+ actions. Makes the audit trail trivially traceable.
154
+ ```
155
+
156
+ ## Lifecycle
157
+
158
+ 1. **Create**: skill or hook detects it can't complete an action, writes
159
+ the entry using `templates/deferred-action-template.md`,
160
+ commits it as part of the session's normal artifact flow.
161
+ 2. **Surface**: next session-start, `60-deferred-actions.sh` scans
162
+ `docs/deferred-actions/*.md`, detects current capabilities, and emits
163
+ `BLOCKED:` (resolvable here) or `INFORM:` (visible, not actionable).
164
+ 3. **Resolve**: resolving session follows the entry's "Command to
165
+ execute" section, verifies "On completion" state.
166
+ 4. **Archive**: `git mv docs/deferred-actions/<id>.md docs/deferred-actions/completed/<id>.md`.
167
+ Commit the move with message `chore: resolve deferred action <id>`.
168
+
169
+ ## Relationship to other rules + standards
170
+
171
+ - `.claude/rules/deferred-actions.md` — rule governing session-start
172
+ surfacing + resolution behavior
173
+ - `.claude/rules/blocked-items.md` — generic BLOCKED protocol; deferred
174
+ actions route through the same "resolve or explicitly defer" path
175
+ - `.claude/rules/mobile-ephemeral-session.md` — modality detection
176
+ primitives; the scan hook reuses its `$CLAUDE_EPHEMERAL` + heuristic
177
+ logic
178
+ - `.claude/rules/session-artifacts.md` — chronicle + LinkedIn tier
179
+ obligations; WS-3's session-rescue writes a deferred-action entry
180
+ when the Stop hook can't complete these
181
+ - `standards/mobile-ephemeral-session.md` — full standard, informs
182
+ modality classifications in the capability table
183
+
184
+ ## Extension
185
+
186
+ - To add a capability: add a row to the capability vocabulary table +
187
+ update the detection logic in `60-deferred-actions.sh`.
188
+ - To add a modality: add a row to the modality→capability table +
189
+ update `created_in` vocabulary in the schema.
190
+ - To add a new pending_action type: no schema change needed; the field
191
+ is free-form slug. If the same action type recurs, update the
192
+ originating skill's SKILL.md to standardize the slug.
193
+
194
+ ## What this standard is NOT
195
+
196
+ - Not a task tracker. GitHub issues remain the bassclef task system.
197
+ Deferred actions are session-to-session handoffs of *already-produced*
198
+ work that couldn't land.
199
+ - Not an audit log. The `completed/` subdirectory is retention for
200
+ traceability, not compliance evidence.
201
+ - Not a substitute for `#221`'s workflow-secret SA key path. Once
202
+ workflow-delivery lands, Google-Doc-push deferrals become rarer.
203
+ Deferred actions still cover memory proposals, session-rescue, and
204
+ any future credential-bound action without a workflow fallback.
@@ -0,0 +1,76 @@
1
+ ---
2
+ tier: lite
3
+ description: Files whose change triggers bassclef-docs-sync.yml.
4
+ ---
5
+
6
+ # Docs Sync Allowlist
7
+
8
+ Files whose change triggers `bassclef-docs-sync.yml`. The workflow syncs bassclef's adopter-facing docs into a discoverable surface (GitHub Wiki + cross-reference verification) so substrate-vs-docs drift can't accumulate silently between sessions.
9
+
10
+ Tracked under c-package iteration goal 2026-05-13. Closes the discipline gap surfaced when `.bassclef-source.json` was described as pointing at S3 (it points at GitHub) one turn after the description shipped.
11
+
12
+ ## Files
13
+
14
+ When any of these paths change in a push to `main`, the docs-sync workflow fires:
15
+
16
+ - `standards/project-directory-layout.md`
17
+ - `docs/bassclef-mental-model.md`
18
+ - `docs/bassclef-overview.md`
19
+ - `docs/getting-started.md` (added 2026-05-14 — dedicated Getting Started walkthrough)
20
+ - `docs/first-use-sequence.md` (added 2026-06-13 — bassclef#965 first-use sequence diagram)
21
+ - `docs/how-skills-work.md` (added 2026-06-13 — adopter guidance on discovery + composition + autonomy modes)
22
+ - `README.md`
23
+ - `docs/hooks-index.md`
24
+ - `docs/glossary.md` (added 2026-05-14 — exhaustive-docs stack)
25
+ - `docs/philosophy.md` (added 2026-05-14)
26
+ - `docs/skills-catalog.md` (added 2026-05-14)
27
+ - `docs/hooks-catalog.md` (added 2026-05-14)
28
+ - `docs/rules-catalog.md` (added 2026-05-14)
29
+ - `architecture/decisions/ADR-*.md` (any new file matching this glob)
30
+ - `.claude/skills/*/SKILL.md` (any new file OR `deprecated: true` flip in frontmatter)
31
+ - `.claude/rules/*.md` (any new file)
32
+ - `standards/bassclef-source-config.md`
33
+ - `standards/vendor-bindings.md`
34
+ - `standards/bassclef-configs-schema.md` (added 2026-06-20 — bassclef#1284 closeout; covers the schema doc updated when new bassclef-configs blocks ship)
35
+ - `standards/sibling-validation-checklist.md` (added 2026-06-20 — bassclef#1284 closeout; operator-runnable end-to-end validation procedure for adopter inheritance)
36
+ - `standards/bassclef-internal-jargon.md` → `Bassclef-Internal-Jargon.md` (added 2026-06-20 — bassclef#1298 / WU-13 of bet 2026-06-20e; the BLOCK / ADVISE / ALLOW wordlist read by turn-prose-kiss-check.sh + pr-body-scrub-check.sh; amended frequently — every wordlist addition should sync to wiki so adopters see current catalog)
37
+ - `standards/adr-template.md` → `ADR-Template.md` (added 2026-06-20 — bassclef#1208 / WU-14 of bet 2026-06-20e; 14-day wiki-as-we-go sweep — ADR template for adopter architecture-record discipline)
38
+ - `standards/bash-hook-safety.md` → `Bash-Hook-Safety.md` (added 2026-06-20 — same; 7 defensive-bash disciplines)
39
+ - `standards/code-safety-principles.md` → `Code-Safety-Principles.md` (added 2026-06-20 — same; language-agnostic safety principles)
40
+ - `standards/frontmatter-schema.md` → `Frontmatter-Schema.md` (added 2026-06-20 — same; required/optional fields for rules + skills)
41
+ - `standards/model-routing-discipline.md` → `Model-Routing-Discipline.md` (added 2026-06-20 — same; per-agent model_tier discipline)
42
+ - `standards/pseudonym-key-schema.md` → `Pseudonym-Key-Schema.md` (added 2026-06-20 — same; operator-private pseudonym registry schema)
43
+ - `standards/security-scanner-adapter.md` → `Security-Scanner-Adapter.md` (added 2026-06-20 — same; per-stack security scanner integration)
44
+ - `standards/tech-stack-config.md` → `Tech-Stack-Config.md` (added 2026-06-20 — same; tech_stack vocabulary bassclef#1127 drives)
45
+
46
+ ## What the workflow does
47
+
48
+ For each changed allowlisted path:
49
+
50
+ 1. **Identify the artifact class.** Standard / mental-model / overview / README / ADR / skill / rule / hooks-index.
51
+ 2. **If a wiki page exists for this artifact**, update it with the new content (light header transform — strip frontmatter, add wiki-style title).
52
+ 3. **If no wiki page exists yet**, create one + add to `_Sidebar.md`.
53
+ 4. **Cross-reference check.** Grep bassclef-overview + README + mental-model for stale links to the changed file. Surface mismatches as warnings on the PR.
54
+ 5. **Step summary.** GitHub Actions step summary names what was synced.
55
+
56
+ ## What does NOT trigger sync
57
+
58
+ Changes to files NOT on the allowlist. The allowlist is intentionally narrow — internal-decomposition docs, chronicles, iteration goals, LinkedIn drafts, sibling-validations, and audits all stay non-synced. Wiki is for adopter-facing reference, not operator-internal records.
59
+
60
+ ## Adding a new path
61
+
62
+ When a new file should be synced, edit this allowlist + the workflow's `paths:` filter in the same PR. Per `standards/project-directory-layout.md` anti-drift rule: substrate change + standard update in same change.
63
+
64
+ ## Override
65
+
66
+ `SKIP_DOCS_SYNC=1` in a commit body skips the workflow for that commit. Logged via trace-helper. Use rarely; prefer narrowing the allowlist if a path shouldn't be synced.
67
+
68
+ ## Sources read
69
+
70
+ - `docs/iteration-bets/2026-05-13-s3-retirement-docs-sync-hooks-index.md` — parent bet
71
+ - `docs/roadmaps/2026-05-07-7-phase-staircase.md` — current `last_event` = `phase_v_mvd_substrate_shipped` at `2026-05-12T01:30:00Z`
72
+ - `.claude/rules/bassclef-workflow-parity.md` — sibling-grep discipline when adding workflows
73
+
74
+ ## Closes
75
+
76
+ WU-4 of c-package bet — the standard half. WU-5 ships the `/docs-sync` skill that runs the same logic locally. The workflow YAML itself ships in this same WU.
@@ -0,0 +1,227 @@
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.
@@ -0,0 +1,102 @@
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.