@zigrivers/scaffold 3.26.0 → 3.28.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 (126) hide show
  1. package/README.md +21 -7
  2. package/content/knowledge/core/ai-memory-management.md +17 -0
  3. package/content/knowledge/core/claude-md-patterns.md +2 -2
  4. package/content/knowledge/core/coding-conventions.md +2 -2
  5. package/content/knowledge/core/task-decomposition.md +4 -4
  6. package/content/knowledge/core/task-tracking.md +120 -29
  7. package/content/knowledge/core/user-stories.md +1 -1
  8. package/content/knowledge/execution/multi-agent-coordination.md +118 -0
  9. package/content/knowledge/execution/task-claiming-strategy.md +15 -3
  10. package/content/knowledge/execution/worktree-management.md +5 -3
  11. package/content/knowledge/web3/web3-access-control.md +189 -0
  12. package/content/knowledge/web3/web3-architecture.md +162 -0
  13. package/content/knowledge/web3/web3-audit-workflow.md +151 -0
  14. package/content/knowledge/web3/web3-common-vulnerabilities.md +171 -0
  15. package/content/knowledge/web3/web3-conventions.md +162 -0
  16. package/content/knowledge/web3/web3-deployment-and-verification.md +216 -0
  17. package/content/knowledge/web3/web3-dev-environment.md +150 -0
  18. package/content/knowledge/web3/web3-gas-optimization.md +165 -0
  19. package/content/knowledge/web3/web3-oracles-and-external-data.md +155 -0
  20. package/content/knowledge/web3/web3-project-structure.md +212 -0
  21. package/content/knowledge/web3/web3-requirements.md +152 -0
  22. package/content/knowledge/web3/web3-security.md +163 -0
  23. package/content/knowledge/web3/web3-testing.md +180 -0
  24. package/content/knowledge/web3/web3-upgradeability.md +189 -0
  25. package/content/methodology/web3-overlay.yml +40 -0
  26. package/content/pipeline/build/multi-agent-resume.md +27 -7
  27. package/content/pipeline/build/multi-agent-start.md +35 -7
  28. package/content/pipeline/build/new-enhancement.md +8 -1
  29. package/content/pipeline/build/quick-task.md +9 -0
  30. package/content/pipeline/build/single-agent-resume.md +11 -4
  31. package/content/pipeline/build/single-agent-start.md +13 -4
  32. package/content/pipeline/consolidation/workflow-audit.md +1 -1
  33. package/content/pipeline/environment/git-workflow.md +2 -2
  34. package/content/pipeline/foundation/beads.md +148 -22
  35. package/content/pipeline/foundation/coding-standards.md +1 -1
  36. package/content/tools/post-implementation-review.md +6 -6
  37. package/content/tools/prompt-pipeline.md +1 -1
  38. package/content/tools/release.md +5 -5
  39. package/content/tools/review-code.md +347 -3
  40. package/content/tools/review-pr.md +349 -7
  41. package/content/tools/version-bump.md +5 -5
  42. package/dist/cli/commands/observe.d.ts +2 -0
  43. package/dist/cli/commands/observe.d.ts.map +1 -1
  44. package/dist/cli/commands/observe.js +9 -1
  45. package/dist/cli/commands/observe.js.map +1 -1
  46. package/dist/cli/commands/observe.test.js +36 -0
  47. package/dist/cli/commands/observe.test.js.map +1 -1
  48. package/dist/config/schema.d.ts +672 -126
  49. package/dist/config/schema.d.ts.map +1 -1
  50. package/dist/config/schema.js +8 -1
  51. package/dist/config/schema.js.map +1 -1
  52. package/dist/config/schema.test.js +2 -2
  53. package/dist/config/schema.test.js.map +1 -1
  54. package/dist/config/validators/index.d.ts.map +1 -1
  55. package/dist/config/validators/index.js +2 -0
  56. package/dist/config/validators/index.js.map +1 -1
  57. package/dist/config/validators/web3.d.ts +4 -0
  58. package/dist/config/validators/web3.d.ts.map +1 -0
  59. package/dist/config/validators/web3.js +15 -0
  60. package/dist/config/validators/web3.js.map +1 -0
  61. package/dist/e2e/project-type-overlays.test.js +76 -0
  62. package/dist/e2e/project-type-overlays.test.js.map +1 -1
  63. package/dist/observability/adapters/beads.d.ts +4 -0
  64. package/dist/observability/adapters/beads.d.ts.map +1 -1
  65. package/dist/observability/adapters/beads.js +25 -2
  66. package/dist/observability/adapters/beads.js.map +1 -1
  67. package/dist/observability/adapters/beads.test.js +40 -2
  68. package/dist/observability/adapters/beads.test.js.map +1 -1
  69. package/dist/observability/engine/ledger-writer.d.ts +11 -1
  70. package/dist/observability/engine/ledger-writer.d.ts.map +1 -1
  71. package/dist/observability/engine/ledger-writer.js +6 -0
  72. package/dist/observability/engine/ledger-writer.js.map +1 -1
  73. package/dist/observability/engine/llm-dispatcher.d.ts.map +1 -1
  74. package/dist/observability/engine/llm-dispatcher.js +36 -5
  75. package/dist/observability/engine/llm-dispatcher.js.map +1 -1
  76. package/dist/observability/engine/llm-dispatcher.test.js +23 -0
  77. package/dist/observability/engine/llm-dispatcher.test.js.map +1 -1
  78. package/dist/project/adopt.d.ts.map +1 -1
  79. package/dist/project/adopt.js +3 -1
  80. package/dist/project/adopt.js.map +1 -1
  81. package/dist/project/detectors/coverage.test.js +3 -2
  82. package/dist/project/detectors/coverage.test.js.map +1 -1
  83. package/dist/project/detectors/disambiguate.js +1 -1
  84. package/dist/project/detectors/disambiguate.js.map +1 -1
  85. package/dist/project/detectors/index.d.ts.map +1 -1
  86. package/dist/project/detectors/index.js +2 -0
  87. package/dist/project/detectors/index.js.map +1 -1
  88. package/dist/project/detectors/resolve-detection.test.js +57 -0
  89. package/dist/project/detectors/resolve-detection.test.js.map +1 -1
  90. package/dist/project/detectors/types.d.ts +6 -2
  91. package/dist/project/detectors/types.d.ts.map +1 -1
  92. package/dist/project/detectors/types.js.map +1 -1
  93. package/dist/project/detectors/web3.d.ts +4 -0
  94. package/dist/project/detectors/web3.d.ts.map +1 -0
  95. package/dist/project/detectors/web3.js +37 -0
  96. package/dist/project/detectors/web3.js.map +1 -0
  97. package/dist/project/detectors/web3.test.d.ts +2 -0
  98. package/dist/project/detectors/web3.test.d.ts.map +1 -0
  99. package/dist/project/detectors/web3.test.js +75 -0
  100. package/dist/project/detectors/web3.test.js.map +1 -0
  101. package/dist/types/config.d.ts +8 -1
  102. package/dist/types/config.d.ts.map +1 -1
  103. package/dist/wizard/copy/core.d.ts.map +1 -1
  104. package/dist/wizard/copy/core.js +4 -0
  105. package/dist/wizard/copy/core.js.map +1 -1
  106. package/dist/wizard/copy/index.d.ts.map +1 -1
  107. package/dist/wizard/copy/index.js +2 -0
  108. package/dist/wizard/copy/index.js.map +1 -1
  109. package/dist/wizard/copy/types.d.ts +5 -1
  110. package/dist/wizard/copy/types.d.ts.map +1 -1
  111. package/dist/wizard/copy/types.test-d.js +7 -0
  112. package/dist/wizard/copy/types.test-d.js.map +1 -1
  113. package/dist/wizard/copy/web3.d.ts +3 -0
  114. package/dist/wizard/copy/web3.d.ts.map +1 -0
  115. package/dist/wizard/copy/web3.js +15 -0
  116. package/dist/wizard/copy/web3.js.map +1 -0
  117. package/dist/wizard/questions.d.ts +2 -1
  118. package/dist/wizard/questions.d.ts.map +1 -1
  119. package/dist/wizard/questions.js +8 -1
  120. package/dist/wizard/questions.js.map +1 -1
  121. package/dist/wizard/questions.test.js +14 -0
  122. package/dist/wizard/questions.test.js.map +1 -1
  123. package/dist/wizard/wizard.d.ts.map +1 -1
  124. package/dist/wizard/wizard.js +1 -0
  125. package/dist/wizard/wizard.js.map +1 -1
  126. package/package.json +1 -1
@@ -98,10 +98,10 @@ Recover your context by checking the current state of work:
98
98
 
99
99
  **If Beads is configured** (`.beads/` exists):
100
100
  - `bd list` — check for tasks with `in_progress` status
101
- - If a PR shows as merged, close the corresponding task: `bd close <id> && bd sync`
101
+ - If a PR shows as merged, close the corresponding task: `bd close <id>`
102
102
  - If there is in-progress work, finish it (see "Resume In-Progress Work" below)
103
- - Otherwise, start fresh with `bd ready` to find the next available task
104
- - Continue working until `bd ready` shows no available tasks
103
+ - Otherwise, atomically claim the next ready task: `TASK=$(bd ready --claim --json | jq -r '.id')` (sets `assignee=$BEADS_ACTOR` + `status=in_progress`; no race window).
104
+ - Continue working until `bd ready --claim --json` returns no task.
105
105
 
106
106
  **Without Beads:**
107
107
  - Read `docs/implementation-playbook.md` as the primary task reference.
@@ -148,6 +148,13 @@ Once in-progress work is complete (or if there was none):
148
148
  - Fix any findings at or above `fix_threshold` before proceeding
149
149
 
150
150
  3. **Create PR** (if not already created for in-progress work)
151
+ - If Beads is configured, run the PR-readiness checklist first:
152
+ ```bash
153
+ if [ -d .beads ]; then
154
+ bd preflight
155
+ fi
156
+ ```
157
+ Fix any issues `bd preflight` flags before proceeding.
151
158
  - Push the branch: `git push -u origin HEAD`
152
159
  - Create a pull request: `gh pr create`
153
160
  - Follow the PR workflow from `docs/git-workflow.md` or CLAUDE.md
@@ -187,7 +194,7 @@ Once in-progress work is complete (or if there was none):
187
194
  - Push updates and re-request review
188
195
 
189
196
  **Task was completed by another agent (multi-agent overlap):**
190
- - If Beads: `bd sync` will show updated task states
197
+ - If Beads: A `git pull` (and `bd dolt pull` if a Dolt remote is configured) brings the local DB current; run `bd doctor --fix` if anything looks stale.
191
198
  - Without Beads: check the plan/playbook for recently completed tasks
192
199
  - Skip to the next available task
193
200
 
@@ -101,11 +101,13 @@ Before writing any code, verify the environment is ready:
101
101
  Check if `.beads/` directory exists.
102
102
 
103
103
  **If Beads is configured:**
104
- - Run `bd ready` to see available tasks
105
- - Pick the lowest-ID unblocked task
104
+ - Atomically claim the next ready task: `TASK=$(bd ready --claim --json | jq -r '.id')`
105
+ - This sets `assignee=$BEADS_ACTOR` (or your git user.name) and `status=in_progress` in a single round-trip no race window vs other agents.
106
+ - If you need a specific task by ID instead, use `bd update <id> --claim`.
107
+ - If `bd ready --claim` returns no task, you're done — exit the loop.
106
108
  - Implement following the TDD workflow below
107
- - After PR is merged, run `bd close <id> && bd sync`
108
- - Repeat with `bd ready` until no tasks remain
109
+ - After PR is merged, run `bd close <id>`
110
+ - Repeat (`bd ready --claim --json`) until no tasks remain
109
111
 
110
112
  **Without Beads:**
111
113
  1. Read `docs/implementation-playbook.md` as the primary task execution reference.
@@ -153,6 +155,13 @@ For each task:
153
155
  - Fix any findings at or above `fix_threshold` before proceeding
154
156
 
155
157
  7. **Create PR**
158
+ - If Beads is configured, run the PR-readiness checklist first:
159
+ ```bash
160
+ if [ -d .beads ]; then
161
+ bd preflight
162
+ fi
163
+ ```
164
+ Fix any issues `bd preflight` flags before proceeding. (Note: do NOT use `[ -d .beads ] && bd preflight` — that returns exit-1 when `.beads/` is absent and breaks any caller running under `set -e`.)
156
165
  - Push the branch: `git push -u origin HEAD`
157
166
  - Create a pull request: `gh pr create`
158
167
  - Include in the PR description: what was implemented, key decisions, files changed
@@ -37,7 +37,7 @@ inconsistent command formats. Fix all issues found.
37
37
 
38
38
  ## Quality Criteria
39
39
  - (mvp) CLAUDE.md contains complete workflow (9 steps + AI review step 4.5)
40
- - (mvp) Commit format is consistent everywhere (If Beads: [BD-<id>] type(scope): description. Without Beads: type(scope): description)
40
+ - (mvp) Commit format is consistent everywhere (If Beads: [bd-<id>] type(scope): description. Without Beads: type(scope): description)
41
41
  - (mvp) Branch naming is consistent everywhere (If Beads: bd-<task-id>/<short-desc>. Without Beads: <type>/<short-desc>)
42
42
  - (mvp) PR workflow includes all 8 sub-steps with --delete-branch flag
43
43
  - (mvp) If Beads: task closure uses bd close (not bd update --status completed)
@@ -34,11 +34,11 @@ parallel agents, CI pipeline, branch protection, and conflict prevention rules.
34
34
 
35
35
  ## Quality Criteria
36
36
  - (mvp) Branch naming format is consistent (Beads: bd-<task-id>/<desc>. Non-Beads: <type>/<desc>)
37
- - (mvp) Commit format is consistent (Beads: [BD-<id>] type(scope): desc. Non-Beads: type(scope): desc)
37
+ - (mvp) Commit format is consistent (Beads: [bd-<id>] type(scope): desc. Non-Beads: type(scope): desc)
38
38
  - (deep) PR workflow includes all 8 sub-steps (commit, AI review, rebase, push, create,
39
39
  auto-merge with --delete-branch, watch CI, confirm merge)
40
40
  - (deep) Worktree script creates permanent worktrees with workspace branches
41
- - (deep) If Beads: BD_ACTOR environment variable documented for agent identity
41
+ - (deep) If Beads: BEADS_ACTOR environment variable documented for agent identity
42
42
  - (deep) CI workflow job name matches branch protection context
43
43
  - (mvp) Branch cleanup documented for both single-agent and worktree-agent variants
44
44
  - (deep) Agent crash recovery procedure documented
@@ -21,34 +21,157 @@ and autonomous behavior guidelines.
21
21
  - Existing CLAUDE.md (optional) — if present, operates in update mode
22
22
 
23
23
  ## Expected Outputs
24
- - .beads/ directory — initialized Beads data store with git hooks
24
+ - .beads/ directory — initialized Beads data store with git hooks (installed/repaired via `bd doctor --fix`)
25
25
  - tasks/lessons.md — patterns and anti-patterns file for cross-session learning
26
- - CLAUDE.md — initial skeleton with Core Principles, Task Management (Beads),
27
- Self-Improvement, and Autonomous Behavior sections
26
+ - CLAUDE.md — marker-managed Beads integration block installed via `bd setup claude`
27
+ (the recipe owns the section between `<!-- BEGIN BEADS INTEGRATION ... -->` and
28
+ `<!-- END BEADS INTEGRATION -->`; survives re-runs). The recipe wires `bd prime
29
+ --hook-json` into SessionStart/PreCompact hooks so agent context is loaded
30
+ automatically. Scaffold adds its own Core Principles + commit convention sections
31
+ AROUND that block but does NOT hand-roll the Beads command reference — `bd prime`
32
+ is the single source of truth for agent context.
28
33
 
29
34
  ## Quality Criteria
30
35
  - (mvp) `bd ready` executes without error (Beads is initialized)
31
36
  - (mvp) .beads/ directory exists and contains Beads data files
32
- - (mvp) Beads git hooks are installed (data-sync hooks, not code-quality hooks)
37
+ - (mvp) Beads git hooks are installed; `bd doctor --fix` was run after `bd init` to
38
+ ensure hooks/config are current (idempotent — also the canonical recovery path if
39
+ `bd` is upgraded later)
33
40
  - (mvp) tasks/lessons.md exists with Patterns, Anti-Patterns, and Common Gotchas sections
34
- - (mvp) CLAUDE.md contains Core Principles with all four tenets (Simplicity, No Laziness, TDD, Prove It)
35
- - (mvp) CLAUDE.md contains Beads command reference table
36
- - (mvp) CLAUDE.md contains commit-message convention requiring Beads task IDs
37
- - (mvp) Bootstrap commit uses `[BD-0]` convention
41
+ - (mvp) `bd setup claude` was run after `bd init` to install the upstream-managed
42
+ Beads integration block in CLAUDE.md (marker-wrapped, hook-driven). For projects
43
+ also targeting Codex CLI or Gemini CLI: `bd setup codex` and/or `bd setup gemini`
44
+ were run. Verify with `bd setup claude --check`.
45
+ - (mvp) CLAUDE.md contains Core Principles with all four tenets (Simplicity, No Laziness, TDD, Prove It) — scaffold-owned content, ADJACENT to the Beads-managed block
46
+ - (mvp) CLAUDE.md contains commit-message convention requiring Beads task IDs — scaffold-owned content
47
+ - (mvp) CLAUDE.md contains an upgrade-remediation callout: "If `bd` was upgraded since
48
+ last `bd init`, run `bd doctor --fix` to re-sync git hooks and project config. This
49
+ fixes errors like `unknown command \"hook\" for \"bd\"` from stale post-checkout /
50
+ post-merge hook shims."
51
+ - (mvp) Bootstrap commit uses `[bd-<id>]` convention (lowercase hash-style IDs per Beads v1.0.0+)
52
+ - (mvp) Auto-export to `.beads/issues.jsonl` is explicitly enabled after `bd init`:
53
+ `bd config set export.auto true && bd config set export.git-add true`. As of
54
+ Beads v1.0.4-Unreleased this is opt-in (previously default); explicit enable means
55
+ release/version-bump tooling can rely on `.beads/issues.jsonl` being current.
56
+ - (mvp) Agents pick up Beads workflow context via `bd prime` (loaded automatically by
57
+ the hooks `bd setup claude` installs). Scaffold does NOT hand-roll a Beads command
58
+ reference table — that lives upstream in `bd prime` output. If a project wants
59
+ custom prime content, write `.beads/PRIME.md`.
60
+ - (deep) `bd config set types.custom '["story","milestone","spike"]'` was run so
61
+ downstream prompts can use `-t story` and `-t milestone`. Verify with `bd config get types.custom`.
38
62
  - (deep) Cross-doc consistency verified against git-workflow.md and coding-standards.md
39
63
 
40
64
  ## Methodology Scaling
41
- - **deep**: Full Beads setup with all CLAUDE.md sections, detailed command reference
42
- table, priority level documentation, and cross-doc consistency checks against
65
+ - **deep**: Full Beads setup `bd init`, then `bd doctor --fix`, then `bd setup
66
+ claude` (and/or `bd setup codex`, `bd setup gemini` for multi-platform projects).
67
+ Enable custom issue types via `bd config set types.custom '["story","milestone","spike"]'`
68
+ so downstream prompts can use `-t story` for user stories and `-t milestone` for
69
+ releases. Scaffold-owned CLAUDE.md content (Core Principles + commit convention +
70
+ upgrade-remediation callout) is composed ADJACENT to the recipe-managed integration
71
+ block. Detailed priority level documentation. Cross-doc consistency checks against
43
72
  existing git-workflow.md and coding-standards.md.
44
- - **mvp**: Initialize Beads, create tasks/lessons.md, add minimal CLAUDE.md
45
- sections (Core Principles + Beads commands). Skip cross-doc checks.
73
+ - **mvp**: `bd init`, `bd doctor --fix`, `bd setup claude`, create tasks/lessons.md,
74
+ add minimal scaffold-owned CLAUDE.md sections (Core Principles + commit convention +
75
+ upgrade-remediation callout). Skip cross-doc checks. Custom types stay off — only
76
+ built-in `bug|feature|task|epic|chore|decision` available.
46
77
  - **custom:depth(1-5)**:
47
- - Depth 1: Initialize Beads + create tasks/lessons.md. Minimal CLAUDE.md with Core Principles only.
48
- - Depth 2: Depth 1 + add Beads command reference table to CLAUDE.md.
49
- - Depth 3: Add full command table, priority level documentation, and autonomous behavior rules.
50
- - Depth 4: Full setup with cross-doc consistency checks against git-workflow.md and coding-standards.md.
51
- - Depth 5: Full setup + detailed autonomous behavior rules + commit-message convention enforcement.
78
+ - Depth 1: `bd init` + `bd doctor --fix` + `bd setup claude` + create tasks/lessons.md. Minimal scaffold CLAUDE.md content (Core Principles only).
79
+ - Depth 2: Depth 1 + add commit convention + upgrade-remediation callout.
80
+ - Depth 3: Add priority level documentation and autonomous behavior rules.
81
+ - Depth 4: Full setup with cross-doc consistency checks against git-workflow.md and coding-standards.md. Enable `bd config set types.custom '["story","milestone","spike"]'`.
82
+ - Depth 5: Full setup + detailed autonomous behavior rules + commit-message convention enforcement. Run `bd setup codex` and `bd setup gemini` if the project targets those CLIs.
83
+
84
+ ## Instructions
85
+
86
+ Execute these steps in order. Each is idempotent — re-running this prompt on an
87
+ existing setup updates rather than re-initializes.
88
+
89
+ 1. **Initialize Beads** (skip if `.beads/` already contains a Dolt DB):
90
+ ```bash
91
+ bd init
92
+ ```
93
+
94
+ 2. **Sync hooks and project config against the installed bd version** (idempotent; also
95
+ the canonical recovery path if `bd` is upgraded later):
96
+ ```bash
97
+ bd doctor --fix
98
+ ```
99
+
100
+ 3. **Install the upstream-managed editor integration** for whichever AI agent CLI
101
+ the project targets. The recipe writes a marker-managed block in CLAUDE.md /
102
+ AGENTS.md / GEMINI.md and installs the SessionStart hooks that load
103
+ `bd prime --hook-json`:
104
+ ```bash
105
+ bd setup claude # Claude Code (always)
106
+ bd setup codex # Codex CLI (multi-platform projects only)
107
+ bd setup gemini # Gemini CLI (multi-platform projects only)
108
+ ```
109
+ Verify with `bd setup claude --check`.
110
+
111
+ 4. **Create the project merge-slot** (one-time; idempotent — re-running on an
112
+ existing slot is a no-op). This is required by the multi-agent flow's
113
+ `bd merge-slot acquire --wait` later, and creating it now means downstream
114
+ PR steps can rely on it being present:
115
+ ```bash
116
+ bd merge-slot create 2>/dev/null || true # exit 0 even if slot already exists
117
+ ```
118
+
119
+ 5. **Enable JSONL auto-export** so release/version-bump tooling can rely on
120
+ `.beads/issues.jsonl` being current (Beads v1.0.4-Unreleased flipped these
121
+ to opt-in):
122
+ ```bash
123
+ bd config set export.auto true
124
+ bd config set export.git-add true
125
+ ```
126
+
127
+ 6. **(deep methodology only) Enable custom issue types** so downstream prompts can
128
+ use `-t story` for user stories and `-t milestone` for releases:
129
+ ```bash
130
+ bd config set types.custom '["story","milestone","spike"]'
131
+ ```
132
+ Verify with `bd config get types.custom`.
133
+
134
+ 7. **Create the lessons-learned file** for cross-session memory (skip if it already exists — never overwrite accumulated lessons):
135
+ ```bash
136
+ mkdir -p tasks
137
+ if [ ! -f tasks/lessons.md ]; then
138
+ cat > tasks/lessons.md <<'EOF'
139
+ # Lessons Learned
140
+
141
+ ## Patterns
142
+
143
+ (Add discovered patterns here.)
144
+
145
+ ## Anti-Patterns
146
+
147
+ (Add anti-patterns here.)
148
+
149
+ ## Common Gotchas
150
+
151
+ (Add gotchas here.)
152
+ EOF
153
+ else
154
+ # Append any missing section headings; existing content stays.
155
+ grep -q "^## Patterns" tasks/lessons.md || printf '\n## Patterns\n\n(Add discovered patterns here.)\n' >> tasks/lessons.md
156
+ grep -q "^## Anti-Patterns" tasks/lessons.md || printf '\n## Anti-Patterns\n\n(Add anti-patterns here.)\n' >> tasks/lessons.md
157
+ grep -q "^## Common Gotchas" tasks/lessons.md || printf '\n## Common Gotchas\n\n(Add gotchas here.)\n' >> tasks/lessons.md
158
+ fi
159
+ ```
160
+
161
+ 8. **Compose scaffold-owned CLAUDE.md sections** ADJACENT to (not replacing) the
162
+ recipe-managed block from step 3. The scaffold-owned content includes Core
163
+ Principles (Simplicity, No Laziness, TDD, Prove It), the commit-message
164
+ convention (`[bd-<id>]` prefix, lowercase hash IDs), the upgrade-remediation
165
+ callout ("If `bd` was upgraded since last `bd init`, run `bd doctor --fix`..."),
166
+ and (deep) autonomous behavior rules.
167
+
168
+ 9. **Bootstrap commit** with the lowercase hash-style ID convention:
169
+ ```bash
170
+ git add .beads tasks/lessons.md CLAUDE.md
171
+ git commit -m "[bd-<id>] chore: initialize Beads task tracking"
172
+ ```
173
+ The bd-<id> here references whatever bootstrap task you created via
174
+ `bd create "Initialize Beads"` (or the auto-generated bootstrap bead).
52
175
 
53
176
  ## Conditional Evaluation
54
177
  Enable when: project uses Beads task tracking methodology (user selects Beads during
@@ -56,11 +179,14 @@ setup), or user explicitly enables structured task management. Skip when: user p
56
179
  GitHub Issues, Linear, or another task tracker, or explicitly declines Beads setup.
57
180
 
58
181
  ## Mode Detection
59
- Update mode if .beads/ contains a config.json or tasks directory (not just an
60
- empty directory). In update mode: never re-initialize
61
- .beads/ (existing task data is irreplaceable), never overwrite tasks/lessons.md
62
- (only add missing sections), update CLAUDE.md Beads sections in-place preserving
63
- project-specific customizations.
182
+ Update mode if `.beads/` contains a populated database (look for `.beads/embeddeddolt/`
183
+ in the default embedded-Dolt layout, `.beads/dolt/` in server mode, or any `.beads/*.db`
184
+ file). Legacy v0.x Beads used `.beads/config.json` and a `tasks` directory — recognize
185
+ those too for older projects. When unsure, run `bd info` from the project root: a
186
+ populated DB returns project metadata; an uninitialized one errors. In update mode:
187
+ never re-initialize `.beads/` (existing task data is irreplaceable), never overwrite
188
+ `tasks/lessons.md` (only add missing sections), update CLAUDE.md Beads sections
189
+ in-place preserving project-specific customizations.
64
190
 
65
191
  ## Update Mode Specifics
66
192
  - **Detect prior artifact**: .beads/ directory exists with data files
@@ -33,7 +33,7 @@ self-review checklist.
33
33
  ## Quality Criteria
34
34
  - (mvp) Every standard references the specific tech stack, not generic principles
35
35
  - (deep) Includes >= 2 runnable code examples per section showing the RIGHT way for the stack
36
- - (mvp) Commit message format documented: if project uses Beads task tracking: [BD-<id>] type(scope): description; otherwise: type(scope): description following conventional commits
36
+ - (mvp) Commit message format documented: if project uses Beads task tracking: [bd-<id>] type(scope): description; otherwise: type(scope): description following conventional commits
37
37
  - (mvp) AI-specific coding rules section addresses common AI mistakes (dead code,
38
38
  duplication, magic numbers, premature abstraction, unnecessary features)
39
39
  - (mvp) Linter/formatter configs created and referenced from the document
@@ -433,9 +433,9 @@ The per-story review prompt for Codex and Gemini:
433
433
  \"findings\": [
434
434
  {
435
435
  \"severity\": \"P0|P1|P2|P3\",
436
+ \"category\": \"correctness|edge-case|security|acceptance-criteria|test-coverage\",
436
437
  \"acceptance_criterion\": \"Which criterion (or null if general)\",
437
- \"file\": \"relative/path/to/file.ts\",
438
- \"line\": 42,
438
+ \"location\": \"relative/path/to/file.ts:42\",
439
439
  \"description\": \"Specific description\",
440
440
  \"suggestion\": \"How to fix it\"
441
441
  }
@@ -448,7 +448,7 @@ The per-story review prompt for Codex and Gemini:
448
448
  Return ONLY valid JSON."
449
449
 
450
450
  Normalize the Superpowers code-reviewer findings to the same JSON shape as
451
- Codex/Gemini (severity, acceptance_criterion, file, line, description, suggestion)
451
+ Codex/Gemini (severity, category, acceptance_criterion, location, description, suggestion)
452
452
  before returning. Then return all three channels' findings plus channel status:
453
453
  {
454
454
  "story": "[STORY_TITLE]",
@@ -479,8 +479,8 @@ mmr reconcile "$JOB_ID" --channel superpowers --input /tmp/agent-findings.json
479
479
  ```
480
480
 
481
481
  All findings injected via `mmr reconcile` must use MMR-compatible schema: each
482
- finding needs `severity` (P0-P3), `location` (file:line), and `description`
483
- (`suggestion` is optional). The strict validator will reject findings with
482
+ finding needs `severity` (P0-P3), `category` (stable finding category),
483
+ `location` (file:line), and `description` (`suggestion` is optional). The strict validator will reject findings with
484
484
  missing or invalid required fields.
485
485
 
486
486
  This step is optional — post-implementation review is a full-codebase review (not
@@ -721,7 +721,7 @@ the user they require manual attention before the project is ready to release.
721
721
  3. **Auth failures are not silent** — always surface to the user with the exact recovery command (`! codex login` or `! gemini -p "hello"`). Wait for user response before queuing a compensating pass.
722
722
  4. **Independence** — never share one channel's output with another. Each reviews independently.
723
723
  5. **Verify every fix** — run tests (or re-read the file) immediately after each fix before moving on.
724
- 6. **3-round limit (per finding)** — never attempt to fix the *same* blocking finding more than 3 times. Each round that surfaces a *new, different, fixable* finding is healthy iteration — keep going. Stop only when the same finding recurs across 3 attempts, channels contradict each other, or the user asks to stop. Surface unresolved findings to the user.
724
+ 6. **3-round limit (per finding identity)** — never attempt to fix the *same* blocking finding more than 3 times. Mirror the wrapper hash identity used by `review-pr.md` and `review-code.md`: `location` + `category` + `description` + `suggestion`. This tool's JSON prompt templates already require `category`; it does not have wrapper-side Step 7a attempts-file bookkeeping, so track attempts in the review report/session notes. Each round that surfaces genuinely different findings with new identities is healthy iteration — keep going. Stop when an identity hits 3 attempts, when the same underlying defect recurs across 3 rounds even if reviewer wording changes, when channels contradict each other, or when the user asks to stop. Surface unresolved findings to the user.
725
725
  7. **Document everything** — the report must show which channels ran, which were compensating, which were skipped, and the root cause for any degraded channel.
726
726
  8. **No auto-merge** — this tool modifies local files only. It never pushes, merges, or creates PRs.
727
727
  9. **Dispatch pattern cross-reference** — Phase 2 parallel dispatch uses `superpowers:dispatching-parallel-agents`. Each story subagent dispatches its own `superpowers:code-reviewer` as Channel 3. This two-level nesting is intentional and supported.
@@ -27,7 +27,7 @@ Print the following reference directly. Do not read any files or run any command
27
27
  ### Phase 0 — Prerequisites (one-time)
28
28
  | Action | Command |
29
29
  |--------|---------|
30
- | Install Beads | `npm install -g @beads/bd` or `brew install beads` **(optional)** |
30
+ | Install Beads | `curl -fsSL https://raw.githubusercontent.com/gastownhall/beads/main/scripts/install.sh \| bash` (upstream-recommended), `brew install beads`, or `npm install -g @beads/bd` **(optional)** |
31
31
  | Install Playwright MCP | `claude mcp add playwright npx @playwright/mcp@latest` **(optional — web apps only)** |
32
32
 
33
33
  ### Phase 0 — Product Vision (`vision`)
@@ -227,14 +227,14 @@ Omit empty sections. Use the commit's first line (without the type prefix) as th
227
227
 
228
228
  If `.beads/` exists:
229
229
 
230
- 1. Run `bd list --status closed` (or parse `.beads/issues.jsonl` for closed issues).
231
- 2. Cross-reference closed tasks with the commit range (match task IDs like `BD-xxx` or `scaffold-xxx` in commit messages).
230
+ 1. Run `bd list --status closed --json` (canonical). If `bd` is unavailable in this environment, skip the autogenerated closed-tasks section — manual changelog entry expected.
231
+ 2. Cross-reference closed tasks with the commit range (match task IDs like `bd-xxxx` or `scaffold-xxx` in commit messages).
232
232
  3. If matches found, append a section:
233
233
 
234
234
  ```markdown
235
235
  ### Completed Tasks
236
- - [BD-xxx] Task title
237
- - [BD-yyy] Task title
236
+ - [bd-<id>] Task title
237
+ - [bd-<id2>] Task title
238
238
  ```
239
239
 
240
240
  If `.beads/` does not exist or no tasks match, silently skip this section.
@@ -286,7 +286,7 @@ git add <changed-files>
286
286
  git commit -m "chore(release): vX.Y.Z"
287
287
  ```
288
288
 
289
- If Beads is configured (`.beads/` exists) and a task is active, include the task ID: `[BD-xxx] chore(release): vX.Y.Z`.
289
+ If Beads is configured (`.beads/` exists) and a task is active, include the task ID: `[bd-<id>] chore(release): vX.Y.Z`.
290
290
 
291
291
  ---
292
292