bigpowers 2.73.8 → 2.74.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 (138) hide show
  1. package/.continue/rules/context7-mcp.md +0 -0
  2. package/.continue/rules/diagnose-stall.md +0 -0
  3. package/.kilocode/rules/context7-mcp.md +0 -0
  4. package/.kilocode/rules/diagnose-stall.md +0 -0
  5. package/.pi/package.json +2 -2
  6. package/.pi/prompts/audit-code.md +17 -13
  7. package/.pi/prompts/change-request.md +3 -1
  8. package/.pi/prompts/compose-workflow.md +15 -0
  9. package/.pi/prompts/context7-mcp.md +54 -0
  10. package/.pi/prompts/craft-skill.md +28 -0
  11. package/.pi/prompts/deepen-architecture.md +20 -0
  12. package/.pi/prompts/delegate-task.md +14 -0
  13. package/.pi/prompts/deploy.md +8 -0
  14. package/.pi/prompts/develop-tdd.md +15 -4
  15. package/.pi/prompts/diagnose-stall.md +53 -0
  16. package/.pi/prompts/dispatch-agents.md +49 -19
  17. package/.pi/prompts/gate-trace.md +9 -1
  18. package/.pi/prompts/guard-git.md +14 -0
  19. package/.pi/prompts/migrate-spec.md +12 -0
  20. package/.pi/prompts/plan-work.md +62 -2
  21. package/.pi/prompts/publish-package.md +11 -0
  22. package/.pi/prompts/release-branch.md +39 -43
  23. package/.pi/prompts/request-review.md +57 -17
  24. package/.pi/prompts/run-benchmark.md +3 -3
  25. package/.pi/prompts/run-evals.md +26 -6
  26. package/.pi/prompts/security-review.md +56 -8
  27. package/.pi/prompts/seed-conventions.md +61 -0
  28. package/.pi/prompts/session-state.md +5 -10
  29. package/.pi/prompts/slice-tasks.md +3 -0
  30. package/.pi/prompts/smoke-test.md +11 -0
  31. package/.pi/prompts/stocktake-skills.md +2 -1
  32. package/.pi/prompts/validate-contracts.md +12 -0
  33. package/.pi/prompts/validate-fix.md +2 -0
  34. package/.pi/prompts/verify-work.md +31 -20
  35. package/.pi/prompts/wire-ci.md +11 -0
  36. package/.pi/prompts/write-document.md +10 -0
  37. package/.pi/skills/audit-code/SKILL.md +17 -13
  38. package/.pi/skills/change-request/SKILL.md +3 -1
  39. package/.pi/skills/compose-workflow/SKILL.md +15 -0
  40. package/.pi/skills/context7-mcp/SKILL.md +56 -0
  41. package/.pi/skills/craft-skill/SKILL.md +28 -0
  42. package/.pi/skills/deepen-architecture/SKILL.md +20 -0
  43. package/.pi/skills/delegate-task/SKILL.md +14 -0
  44. package/.pi/skills/deploy/SKILL.md +8 -0
  45. package/.pi/skills/develop-tdd/SKILL.md +15 -4
  46. package/.pi/skills/diagnose-stall/SKILL.md +55 -0
  47. package/.pi/skills/dispatch-agents/SKILL.md +49 -19
  48. package/.pi/skills/gate-trace/SKILL.md +9 -1
  49. package/.pi/skills/guard-git/SKILL.md +14 -0
  50. package/.pi/skills/migrate-spec/SKILL.md +12 -0
  51. package/.pi/skills/plan-work/SKILL.md +62 -2
  52. package/.pi/skills/publish-package/SKILL.md +11 -0
  53. package/.pi/skills/release-branch/SKILL.md +39 -43
  54. package/.pi/skills/request-review/SKILL.md +57 -17
  55. package/.pi/skills/run-benchmark/SKILL.md +3 -3
  56. package/.pi/skills/run-evals/SKILL.md +26 -6
  57. package/.pi/skills/security-review/SKILL.md +56 -8
  58. package/.pi/skills/seed-conventions/SKILL.md +61 -0
  59. package/.pi/skills/session-state/SKILL.md +5 -10
  60. package/.pi/skills/slice-tasks/SKILL.md +3 -0
  61. package/.pi/skills/smoke-test/SKILL.md +11 -0
  62. package/.pi/skills/stocktake-skills/SKILL.md +2 -1
  63. package/.pi/skills/validate-contracts/SKILL.md +12 -0
  64. package/.pi/skills/validate-fix/SKILL.md +2 -0
  65. package/.pi/skills/verify-work/SKILL.md +31 -20
  66. package/.pi/skills/wire-ci/SKILL.md +11 -0
  67. package/.pi/skills/write-document/SKILL.md +10 -0
  68. package/CHANGELOG.md +14 -0
  69. package/CLAUDE.md +59 -1
  70. package/CONVENTIONS.md +80 -5
  71. package/README.md +1 -1
  72. package/SKILL-INDEX.md +1 -1
  73. package/package.json +1 -1
  74. package/scripts/bp-churn-rank.sh +49 -0
  75. package/scripts/check-import-boundaries.sh +64 -0
  76. package/scripts/compile-rule-matrix.sh +114 -0
  77. package/scripts/hooks/rtk-rewrite.sh +11 -0
  78. package/scripts/hooks/token-mgmt-pre-tool-use.sh +53 -0
  79. package/scripts/install.sh +6 -0
  80. package/scripts/lib/completeness-critic.sh +62 -0
  81. package/scripts/lib/doc-fetch-cache.sh +71 -0
  82. package/scripts/lib/golden-suite-gates.sh +3 -1
  83. package/scripts/lib/parallel-review-worktrees.sh +34 -0
  84. package/scripts/lib/plan-consistency-check.sh +88 -0
  85. package/scripts/lib/run-benchmark.py +210 -0
  86. package/scripts/lib/simple_yaml.py +130 -0
  87. package/scripts/lib/sync-context-engineering-ref.sh +19 -0
  88. package/scripts/lib/trace-matrix.py +10 -281
  89. package/scripts/lib/trace_renderer.py +147 -0
  90. package/scripts/references-manifest.yaml +19 -0
  91. package/scripts/run-benchmark.sh +6 -0
  92. package/scripts/sync-references.sh +25 -0
  93. package/scripts/test-trace-matrix-size.sh +46 -0
  94. package/scripts/validate-skill-catalog.sh +147 -0
  95. package/scripts/validate-skill-description.sh +70 -0
  96. package/skills/audit-code/SKILL.md +19 -13
  97. package/skills/change-request/SKILL.md +3 -1
  98. package/skills/compose-workflow/SKILL.md +15 -0
  99. package/skills/context7-mcp/SKILL.md +57 -0
  100. package/skills/craft-skill/SKILL.md +29 -0
  101. package/skills/deepen-architecture/SKILL.md +22 -0
  102. package/skills/delegate-task/SKILL.md +14 -0
  103. package/skills/deploy/SKILL.md +9 -0
  104. package/skills/develop-tdd/SKILL.md +18 -4
  105. package/skills/diagnose-stall/SKILL.md +56 -0
  106. package/skills/dispatch-agents/SKILL.md +51 -19
  107. package/skills/gate-trace/SKILL.md +11 -1
  108. package/skills/guard-git/REFERENCE.md +14 -0
  109. package/skills/migrate-spec/REFERENCE.md +12 -0
  110. package/skills/plan-work/REFERENCE.md +29 -2
  111. package/skills/plan-work/SKILL.md +38 -0
  112. package/skills/publish-package/REFERENCE.md +11 -0
  113. package/skills/release-branch/REFERENCE.md +14 -0
  114. package/skills/release-branch/SKILL.md +28 -43
  115. package/skills/request-review/SKILL.md +59 -17
  116. package/skills/run-benchmark/SKILL.md +4 -4
  117. package/skills/run-evals/REFERENCE.md +14 -4
  118. package/skills/run-evals/SKILL.md +13 -2
  119. package/skills/security-review/REFERENCE-false-positives.md +9 -8
  120. package/skills/security-review/REFERENCE-vuln-categories.md +4 -0
  121. package/skills/security-review/SKILL.md +45 -0
  122. package/skills/security-review/fixtures/CWE-79-xss-negative.js +6 -0
  123. package/skills/security-review/fixtures/CWE-79-xss-positive.js +6 -0
  124. package/skills/security-review/fixtures/CWE-89-sqli-negative.py +8 -0
  125. package/skills/security-review/fixtures/CWE-89-sqli-positive.py +9 -0
  126. package/skills/seed-conventions/REFERENCE.md +40 -0
  127. package/skills/seed-conventions/SKILL.md +22 -0
  128. package/skills/session-state/SKILL.md +5 -10
  129. package/skills/slice-tasks/SKILL.md +3 -0
  130. package/skills/smoke-test/REFERENCE.md +11 -0
  131. package/skills/stocktake-skills/SKILL.md +3 -1
  132. package/skills/validate-contracts/REFERENCE.md +12 -0
  133. package/skills/validate-fix/SKILL.md +3 -0
  134. package/skills/verify-work/REFERENCE.md +17 -0
  135. package/skills/verify-work/SKILL.md +18 -20
  136. package/skills/wire-ci/REFERENCE.md +11 -0
  137. package/skills/write-document/REFERENCE.md +10 -0
  138. package/skills-lock.json +32 -22
@@ -3,6 +3,8 @@ description: "PLANNING SPINE STEP 3 of 3 — Plan the work: write detailed imple
3
3
  ---
4
4
 
5
5
 
6
+ # story: e45s29
7
+
6
8
  # Plan Work
7
9
 
8
10
  > **Spine position:** Step 3 — scope-work → slice-tasks → plan-work.
@@ -44,14 +46,45 @@ If this plan touches an existing module, run `assess-impact` first to understand
44
46
 
45
47
  3. **Write capsule story spec + tasks** — Output two files inside the active epic capsule. See [REFERENCE.md](REFERENCE.md) for file formats and the plan-template. Each task MUST include a `risk:` field (`P0` | `P1` | `P2` | `P3`) based on BCP + story type heuristics (see REFERENCE.md). If a test plan artifact (`specs/tech-architecture/eNN-TEST_PLAN_LATEST.md`) exists, read it and inherit its P0/P1 risk classifications and scenario IDs (`SC-eNNsYY-P0-NN`). Each task optionally includes a `security:` field (`none` / `low` / `medium` / `high`) sourced from the epic's `specs/security/epics/<id>/THREAT_MODEL.md`. Tasks with `security: medium` or `security: high` MUST include "no new security findings in affected paths" in their verify steps.
46
48
 
49
+ **Requirement delta tags (e45s29):** When a story modifies existing behavior, the story spec § Requirements MUST use OpenSpec-style delta tags with mandatory before/after content:
50
+
51
+ | Tag | When | Required content |
52
+ |-----|------|------------------|
53
+ | `ADDED` | New requirement | Full requirement text |
54
+ | `MODIFIED` | Changed behavior | **Before:** prior behavior · **After:** new behavior |
55
+ | `REMOVED` | Retired requirement | **Before:** what existed · **After:** (removed) + rationale |
56
+ | `RENAMED` | ID or title change only | **Before:** old ID/title · **After:** new ID/title |
57
+
58
+ Net-new stories (greenfield) use `ADDED` only. `MODIFIED`/`REMOVED`/`RENAMED` without before/after blocks fail the plan-work gate.
59
+
47
60
  4. **Verify step format** — Every step MUST follow: `N. <What to do> → verify: <runnable command>`. See [REFERENCE.md](REFERENCE.md) for good/bad examples.
48
61
 
62
+ 4a. **Cross-artifact consistency pass (HARD GATE — e45s04)** — Before handoff, run:
63
+
64
+ ```bash
65
+ bash scripts/lib/plan-consistency-check.sh specs/epics/<capsule>/
66
+ ```
67
+
68
+ Print CRITICAL / HIGH / MED findings. **CRITICAL or HIGH blocks code generation** — fix capsule artifacts first. MED requires explicit user acknowledgment.
69
+
70
+ 4b. **tasks.yaml failing ledger (e45s06)** — Every new task entry starts with `status: failing`. Only flip to `status: passing` after its `verify:` command exits 0 during `develop-tdd` or `verify-work`. Never pre-mark passing at plan time.
71
+
49
72
  5. **Review with user** — Confirm step order, granularity, and that verify commands are runnable in this project.
50
73
 
74
+ ## Lifecycle Gates (e45s09)
75
+
76
+ | Gate | When | Pass condition |
77
+ |------|------|----------------|
78
+ | **Pre-Implementation** | Before `kickoff-branch` / first RED commit | Root-cause stated for bugs; `assess-impact` done for module changes; plan-consistency-check PASS |
79
+ | **Validation** | Story marked done | All tasks `status: passing`; verify evidence in `specs/verifications/` |
80
+ | **Reopen-don't-refile** | Regression on shipped story | Reopen existing story/bug — do not create duplicate capsule entries |
81
+
51
82
  After writing capsule tasks, suggest `kickoff-branch` (if not already on a feature branch) then `build-epic`, `execute-plan`, or `develop-tdd`.
52
83
 
53
84
  ## Verify
54
85
 
86
+ → verify: `test -f scripts/lib/plan-consistency-check.sh && bash scripts/lib/plan-consistency-check.sh specs/epics/e45-quality-core/ 2>&1 | head -5`
87
+
55
88
 
56
89
 
57
90
  ## Handoff
@@ -63,6 +96,17 @@ Writes: state.yaml handoff.next_skill = kickoff-branch
63
96
 
64
97
  # Plan Work — Reference
65
98
 
99
+ ## Navigation
100
+
101
+ | Lines | Section |
102
+ |-------|---------|
103
+ | 1 | Title |
104
+ | 3–14 | Navigation |
105
+ | 16–38 | Output file formats |
106
+ | 40–71 | Plan template |
107
+ | 73–91 | Verify step format rules |
108
+ | 93–131 | Sub-operations (risk, define-success, zoom-out, slopcheck, delta tags) |
109
+
66
110
  ## Output file formats
67
111
 
68
112
  ### Story spec: `specs/epics/<capsule>/eNNsYY-<slug>.md`
@@ -74,14 +118,14 @@ Populated countable-story-format with all 20 sections. Minimum maturity: 3 (Coun
74
118
  ```yaml
75
119
  story_id: e01s01
76
120
  title: Login
77
- status: todo
121
+ status: failing
78
122
  bcps: 3
79
123
  tasks:
80
124
  - id: 1
81
125
  description: "Add login form component tests"
82
126
  verify: "npm test -- login-form.test.tsx"
83
127
  risk: P1
84
- status: todo
128
+ status: failing # flip to passing only after verify exits 0 (e45s06)
85
129
  ```
86
130
 
87
131
  Update `specs/epics/<capsule>/epic.yaml` manifest to list the story and its BCPs. Run `bash scripts/sync-status-from-epics.sh` after structural changes.
@@ -152,6 +196,22 @@ Every task and story MUST be assigned a `risk:` level (P0, P1, P2, P3). When `sp
152
196
 
153
197
  `verify-work` scales its UAT depth based on this field.
154
198
 
199
+ ### Requirement delta tags (e45s29)
200
+
201
+ When modifying existing behavior in story spec § Requirements:
202
+
203
+ ```markdown
204
+ #### MODIFIED: User can reset password via email link
205
+ **Before:** Password reset required admin approval.
206
+ **After:** Self-service reset via signed email link (expires 1h).
207
+
208
+ #### REMOVED: Legacy OAuth1 login
209
+ **Before:** OAuth1 provider supported for enterprise SSO.
210
+ **After:** (removed) — provider deprecated; OAuth2 only.
211
+ ```
212
+
213
+ Tags: `ADDED`, `MODIFIED`, `REMOVED`, `RENAMED`. `MODIFIED`/`REMOVED`/`RENAMED` without before/after → plan-work gate FAIL.
214
+
155
215
  ### Define Success
156
216
 
157
217
  Before planning, convert task statements into observable "step → verify: <cmd>" pairs:
@@ -77,6 +77,17 @@ See [REFERENCE.md](REFERENCE.md)
77
77
 
78
78
  # Publish Package — Reference
79
79
 
80
+ ## Navigation
81
+
82
+ | Lines | Section |
83
+ |-------|---------|
84
+ | 1 | Title |
85
+ | 3–18 | Navigation |
86
+ | 20–28 | Options |
87
+ | 30–60 | Examples |
88
+ | 62–72 | Integration with release-branch |
89
+ | 74–252 | Reference blocks 1–8 |
90
+
80
91
  ## Options
81
92
 
82
93
  | Flag | Description |
@@ -52,6 +52,8 @@ If REVIEW.md is missing or stale → run `security-review` inline. Findings bloc
52
52
 
53
53
  Run `gate-trace` before merge. FAIL blocks merge; CONCERNS requires explicit override in `specs/state.yaml` (`traceability_override: CONCERNS accepted, reason: <explanation>`). WAIVED if no matrix available.
54
54
 
55
+ > **Adversarial refute framing (e45s32):** The final pre-merge check is **refute, not rubber-stamp**. Before declaring ready, actively try to disprove traceability completeness — missing story tags, absent verify evidence, stale security review. Only proceed when refutation fails.
56
+
55
57
  ### 3. Diff review
56
58
 
57
59
  - [ ] All commits intentional, no secrets, CONVENTIONS.md compliance
@@ -72,9 +74,26 @@ bash scripts/land-branch.sh <task-slug> "feat(scope): description"
72
74
 
73
75
  ### 6. Create PR (team-pr only)
74
76
 
75
- Create the pull request, then merge via `gh`:
77
+ Create the pull request with a **literal provenance marker** in the body so agent-generated PRs are identifiable and do not rot silently:
78
+
79
+ ```markdown
80
+ <!-- bigpowers-provenance: agent-generated -->
81
+ ```
82
+
83
+ Place the marker on its own line immediately after the `## Summary` heading. Then merge via `gh`:
76
84
 
77
85
  ```bash
86
+ gh pr create --title "..." --body "$(cat <<'EOF'
87
+ ## Summary
88
+ <!-- bigpowers-provenance: agent-generated -->
89
+
90
+ - ...
91
+
92
+ ## Test plan
93
+ - [ ] ...
94
+
95
+ EOF
96
+ )"
78
97
  gh pr merge --squash --delete-branch
79
98
  ```
80
99
 
@@ -90,55 +109,18 @@ mv specs/epics/eNN-slug specs/epics/archive/
90
109
 
91
110
  ### 7b. CI verification & agent lock release (e39s02)
92
111
 
93
- > **HARD GATE** — Do NOT declare success until CI completes. A push that fails CI is a regression, not a release.
94
-
95
- After push, run CI polling:
112
+ > **HARD GATE** — Do NOT declare success until CI completes. **Three-independent-facts** (e45s15): commit landed, workflow green, registry visible — see [REFERENCE.md](REFERENCE.md#three-independent-facts-release).
96
113
 
97
114
  ```bash
98
115
  bash scripts/wait-for-ci.sh --timeout 600 --interval 30
99
116
  ```
100
117
 
101
- Then release the story lock:
102
-
103
- ```bash
104
- LOCK="specs/agent-locks.yaml"; STORY="<story-id>"
105
- [ -f "$LOCK" ] && python3 -c "
106
- import yaml
107
- d=yaml.safe_load(open('$LOCK'))
108
- if d:d['locks']=[l for l in d['locks'] if l.get('story_id')!='$STORY']
109
- yaml.dump(d,open('$LOCK','w'),default_flow_style=False)
110
- print(f'LOCK RELEASED: $STORY')
111
- "||echo "No lock for $STORY — idempotent"
112
- ```
113
-
114
- - [ ] CI workflow passes after push (wait-for-ci.sh exit 0)
115
- - [ ] `release.ci_verified: true` documented in state.yaml
116
- - On failure: `handoff.next_skill = fix-bug` with CI failure URL
117
-
118
- ### 8. Clean up worktree
119
-
120
- ```bash
121
- git worktree prune
122
- git worktree remove ../<branch-name> 2>/dev/null || true
123
- git branch -d <branch-name>
124
- ```
125
-
126
- ### 8a. Cycle-time recording
118
+ - [ ] CI passes; `release.ci_verified: true` in state.yaml
119
+ - On failure: `handoff.next_skill = fix-bug`
127
120
 
128
- After landing, record delivery metrics with the git-derived, additive script:
121
+ ### 8. Clean up & return
129
122
 
130
- ```bash
131
- bash scripts/record-cycle-time.sh append \
132
- --story <story_id> --bcps <bcps> \
133
- --range "$(git merge-base main HEAD)..HEAD" \
134
- --file specs/metrics/cycle-times.yaml
135
- ```
136
-
137
- ### 9. Return to main
138
-
139
- ```bash
140
- git checkout main && git status && pwd
141
- ```
123
+ Worktree prune, branch delete, `git checkout main`. Cycle-time: see [REFERENCE.md](REFERENCE.md#cycle-time).
142
124
 
143
125
  Report: "Branch released."
144
126
 
@@ -150,6 +132,20 @@ Report: "Branch released."
150
132
 
151
133
  # Release Branch — Reference
152
134
 
135
+ ## Navigation
136
+
137
+ | Lines | Section |
138
+ |-------|---------|
139
+ | 1–3 | Title |
140
+ | 5–16 | Navigation |
141
+ | 18–41 | PR body template |
142
+ | 43–54 | Worktree cleanup |
143
+ | 56–96 | Cycle-time recording |
144
+ | 98–119 | CI verification |
145
+ | 121–126 | Solo-local fallback |
146
+ | 128–134 | Handoff |
147
+ | 136–155 | Reference block 1 (manual squash) |
148
+
153
149
  # Release Branch — Reference
154
150
 
155
151
  ## PR body template (team-pr mode)
@@ -3,21 +3,44 @@ description: Dispatch a fresh reviewer agent with a clean context to critique th
3
3
  ---
4
4
 
5
5
 
6
+ # story: e45s28
7
+
6
8
  # Request Review
7
9
 
8
- Dispatch a fresh reviewer agent with a clean context. The reviewer has no shared state — it can give a genuine second opinion because it hasn't been involved in writing the code.
10
+ Dispatch fresh reviewer agents with clean contexts. Reviewers have no shared state — they find what the coding agent missed.
11
+
12
+ **Distinct from `audit-code`:** `audit-code` is self-review (internal). This skill dispatches external agents.
13
+
14
+ **Solo developer note:** Reviewer agents replace the human reviewer.
15
+
16
+ **Run `audit-code` first.** Don't waste reviewer attention on hygiene issues you could have caught yourself.
17
+
18
+ ## Santa Method — Dual-Blind AND Gate (e45s07)
19
+
20
+ Use **two independent reviewers** (Reviewer A and Reviewer B) with **no shared context** between them or the coding agent.
21
+
22
+ | Parameter | Value |
23
+ |-----------|-------|
24
+ | Reviewers | 2 (mandatory) |
25
+ | `MAX_REVIEW_ITERATIONS` | **5** (hard cap — e45s28; iteration 6 forbidden) |
26
+ | Pass rule | **AND-gate** — both reviewers must pass independently |
27
+ | Blindness | Neither reviewer sees the other's report until both complete |
9
28
 
10
- **Distinct from `audit-code`:** `audit-code` is the coding agent checking its own work (internal). This skill dispatches an external agent whose job is to find what the coding agent missed.
29
+ **Iteration loop (max `MAX_REVIEW_ITERATIONS`):**
11
30
 
12
- **Solo developer note:** This replaces the human reviewer. The reviewer agent IS the reviewer.
31
+ 1. Dispatch Reviewer A and Reviewer B in parallel with identical briefs but separate contexts.
32
+ 2. Collect both reports. Each categorizes findings: must-fix / should-fix / consider.
33
+ 3. **AND-gate:** If **either** reviewer has must-fix findings → FAIL round. Run `respond-review`, fix, re-dispatch both reviewers.
34
+ 4. If both pass (zero must-fix, score ≥ 94% each) → review complete.
35
+ 5. After **5** iterations without dual pass → **stop**; report "Review cap exhausted (5/5). Human decision required." Do not merge.
13
36
 
14
- **Run `audit-code` first.** This skill assumes `audit-code` has already passed. Don't waste a reviewer's attention on hygiene issues you could have caught yourself.
37
+ > **HARD GATE** — Single-reviewer pass is insufficient. Partial agreement does not satisfy the AND-gate.
15
38
 
16
39
  ## Process
17
40
 
18
41
  ### 1. Prepare the review brief
19
42
 
20
- Write a self-contained brief for the reviewer agent. Include:
43
+ Write a self-contained brief for each reviewer. Include:
21
44
 
22
45
  - What was built (feature description, not implementation)
23
46
  - Which files changed (the diff context)
@@ -27,12 +50,25 @@ Write a self-contained brief for the reviewer agent. Include:
27
50
  - What you're most uncertain about (where you want fresh eyes)
28
51
  - **Security focus** — If the epic has a `specs/security/epics/<id>/THREAT_MODEL.md`, include the relevant vulnerability categories as reviewer focal points. Also include the false-positive exclusion rules so the reviewer avoids known-safe patterns. Tag the review as `security-sensitive: true` if THREAT_MODEL risk is HIGH+.
29
52
 
30
- ### 2. Dispatch the reviewer agent
53
+ ### 2. Fan-out parallel reviewers (e45s17)
31
54
 
32
- Use the Agent tool with a completely fresh context. The agent prompt must be self-contained — no references to "our conversation" or "what we discussed."
55
+ Beyond the mandatory dual-blind pair (e45s07), optionally dispatch **N dimension-specific subagents in one message** — one check per agent for broader coverage (OpenAI Codex `code-review-*` pattern):
56
+
57
+ | Agent | Focus |
58
+ |-------|-------|
59
+ | R-correctness | Logic, edge cases, verify command result |
60
+ | R-conventions | CONVENTIONS.md, test quality (F.I.R.S.T) |
61
+ | R-security | Injection, auth, secrets (when `security-sensitive`) |
62
+ | R-design | Simpler alternatives, API shape |
63
+
64
+ Santa Method still applies: each agent is blind; AND-gate uses Reviewer A + B scores. Fan-out agents feed findings into `respond-review` but do not replace the dual-blind pair.
65
+
66
+ ### 2b. Dispatch both reviewer agents (parallel)
67
+
68
+ Use the Agent tool twice with completely fresh contexts. Each prompt must be self-contained — no references to "our conversation" or "what we discussed."
33
69
 
34
70
  ```
35
- You are a code reviewer. Review the following code changes.
71
+ You are code reviewer [A|B]. Review the following code changes independently.
36
72
 
37
73
  Context: [feature description]
38
74
  CONVENTIONS.md rules: [paste relevant sections]
@@ -54,18 +90,22 @@ For each finding, categorize as: must-fix / should-fix / consider.
54
90
  Run the verify command and report the result.
55
91
  ```
56
92
 
57
- ### 3. Collect the report
93
+ ### 3. Collect both reports
58
94
 
59
- When the reviewer returns:
60
- - Read every finding before acting on any
61
- - Note the verify command result
62
- - Compute the quality score: `100 × (total_items − must_fix − should_fix) / total_items`
63
- - Report the score to the user
95
+ When reviewers return:
96
+ - Read every finding from **both** reports before acting on any
97
+ - Note each verify command result
98
+ - Compute quality score per reviewer: `100 × (total_items − must_fix − should_fix) / total_items`
99
+ - **AND-gate check:** both scores ≥ 94% and zero must-fix from **both**?
64
100
 
65
- > **HARD GATE** — If score < 94%, do NOT merge. Run `respond-review` to resolve must-fix and should-fix findings first. The 94% threshold also applies to the compliance SCORE computed by `npm run compliance` (scripts/audit-compliance.sh): SCORE = passing Gherkin scenarios / total × 100.
101
+ > **HARD GATE** — If either score < 94% or either has must-fix → FAIL round. Run `respond-review` first. The 94% threshold also applies to `npm run compliance` (scripts/audit-compliance.sh).
66
102
 
67
103
  ### 4. Hand off to respond-review
68
104
 
69
- Pass the reviewer's report to `respond-review` to categorize findings and apply fixes.
105
+ Pass combined findings to `respond-review` to categorize and apply fixes. Increment iteration counter. Re-dispatch both reviewers until AND-gate passes or iteration 3 exhausted.
106
+
107
+ Report to user: "Review round [N/3]. Reviewer A: [score], Reviewer B: [score]. AND-gate: [PASS|FAIL]."
108
+
109
+ ## Verify
70
110
 
71
- Report to user: "Review complete. [N] findings: [X] must-fix, [Y] should-fix, [Z] consider. Running respond-review."
111
+ → verify: `grep -q 'AND-gate' skills/request-review/SKILL.md && grep -q 'max 3' skills/request-review/SKILL.md && echo OK`
@@ -27,9 +27,9 @@ Benchmark definitions partition scenarios into two sets:
27
27
  ## Usage
28
28
 
29
29
  ```bash
30
- run-benchmark <skill-name> # benchmark single skill
31
- run-benchmark --all # benchmark all with definitions
32
- run-benchmark <skill-name> --baseline # pin results as baseline
30
+ bash scripts/run-benchmark.sh <skill-name> # benchmark single skill
31
+ bash scripts/run-benchmark.sh --all # benchmark all with definitions
32
+ bash scripts/run-benchmark.sh <skill-name> --baseline # pin results as baseline
33
33
  ```
34
34
 
35
35
  ## Process
@@ -14,8 +14,18 @@ description: Eval-Driven Development — define capability and regression evals
14
14
  - **Capability evals** (does it do the job?)
15
15
  - **Regression evals** (did we break anything?)
16
16
  3. Assign grader type per eval: `code` (shell verify) or `model` (rubric).
17
- 4. Run evals; log results table with pass@k (e.g. 3/3 runs).
18
- 5. Block BUILD phase until capability evals pass at agreed k.
17
+ 4. Assign **strictness tier** per eval (graduated promotion — e45s37):
18
+
19
+ | Tier | Meaning | Promotion rule |
20
+ |------|---------|------------------|
21
+ | `EXPERIMENTAL` | New eval, may flake | Not gating |
22
+ | `USUALLY_PASSES` | Stable in dev; ≥2/3 recent runs pass | Blocks BUILD only when combined with ALWAYS_PASSES suite |
23
+ | `ALWAYS_PASSES` | Zero tolerance; required for release | Any single failure blocks BUILD and merge |
24
+
25
+ Promote: `EXPERIMENTAL → USUALLY_PASSES` after 3 consecutive passes; `USUALLY_PASSES → ALWAYS_PASSES` after 5 consecutive passes with zero flakes documented in `specs/state.yaml`.
26
+
27
+ 5. Run evals; log results table with pass@k (e.g. 3/3 runs) and tier per eval.
28
+ 6. Block BUILD phase until all `ALWAYS_PASSES` evals pass at agreed k. `USUALLY_PASSES` failures warn; `EXPERIMENTAL` failures log only.
19
29
 
20
30
  ## Artefact
21
31
 
@@ -29,16 +39,26 @@ description: Eval-Driven Development — define capability and regression evals
29
39
 
30
40
  # Run Evals — Reference
31
41
 
42
+ ## Strictness tiers (e45s37)
43
+
44
+ Add a `tier:` column to each eval row:
45
+
46
+ | Tier | Gate behaviour |
47
+ |------|----------------|
48
+ | `EXPERIMENTAL` | Log only — does not block |
49
+ | `USUALLY_PASSES` | Warn on failure; blocks only when paired with failing `ALWAYS_PASSES` |
50
+ | `ALWAYS_PASSES` | Hard block on any failure |
51
+
32
52
  ## EVALS template
33
53
 
34
54
  ```markdown
35
55
  # EVALS: <feature>
36
56
 
37
57
  ## Capability
38
- | ID | Eval | Grader | verify / rubric |
39
- |----|------|--------|-----------------|
40
- | C1 | ... | code | `verify: npm test -- <file>` |
41
- | C2 | ... | model | Rubric: [ ] criterion A [ ] criterion B |
58
+ | ID | Eval | Grader | Tier | verify / rubric |
59
+ |----|------|--------|------|-----------------|
60
+ | C1 | ... | code | ALWAYS_PASSES | `verify: npm test -- <file>` |
61
+ | C2 | ... | model | USUALLY_PASSES | Rubric: [ ] criterion A [ ] criterion B |
42
62
 
43
63
  ## Regression
44
64
  | ID | Eval | Grader | verify / rubric |
@@ -3,12 +3,24 @@ description: >
3
3
  ---
4
4
 
5
5
 
6
+ # story: e45s26
7
+
6
8
  # Security Review
7
9
 
8
10
  > **HARD GATE** — Requires git context (branch with merge-base or diff). Never
9
11
  > writes files outside `specs/security/`. Findings below confidence 8/10 are
10
12
  > suppressed. **→ verify:** `git rev-parse HEAD >/dev/null 2>&1 && echo "ok" || echo "BLOCKED"`
11
13
 
14
+ ## Parallel worktree mode (e45s18)
15
+
16
+ When running alongside `audit-code`, use isolated worktrees so scans do not race on the same index:
17
+
18
+ ```bash
19
+ bash scripts/lib/parallel-review-worktrees.sh security-review
20
+ ```
21
+
22
+ Each check gets a detached worktree at `.bigpowers/worktrees/review-<name>/`; reports still write only under `specs/security/`.
23
+
12
24
  ## 5-phase scan
13
25
 
14
26
  | # | Phase | What |
@@ -23,6 +35,37 @@ description: >
23
35
 
24
36
  Covered: SQLi, XSS, SSRF, command injection, auth bypass, unsafe deserialization, path traversal, IDOR, crypto flaws, secrets exposure, template injection, NoSQLi
25
37
 
38
+ ## CWE mapping mandate (e45s26)
39
+
40
+ Every **new detection rule** added to this skill MUST:
41
+
42
+ 1. Map to a [CWE](https://cwe.mitre.org/) ID in `REFERENCE-vuln-categories.md` (e.g. SQLi → CWE-89, XSS → CWE-79).
43
+ 2. Ship **two fixture pairs** under `skills/security-review/fixtures/`:
44
+ - **Positive** — minimal code the rule MUST flag (vulnerable pattern present).
45
+ - **Negative** — structurally similar code the rule MUST NOT flag (safe pattern / false-positive guard).
46
+
47
+ | Rule | CWE | Positive fixture | Negative fixture |
48
+ |------|-----|------------------|------------------|
49
+ | SQL injection | CWE-89 | `fixtures/CWE-89-sqli-positive.py` | `fixtures/CWE-89-sqli-negative.py` |
50
+ | XSS (DOM) | CWE-79 | `fixtures/CWE-79-xss-positive.js` | `fixtures/CWE-79-xss-negative.js` |
51
+
52
+ Before merging a new category, run both fixtures through the detection guidance and confirm positive flags / negative passes.
53
+
54
+ ## SQL-safety doctrine (e45s41 — proven authorship)
55
+
56
+ Formal rule for SQL injection classification:
57
+
58
+ | SQL source | Attacker-reachable input? | Verdict |
59
+ |------------|---------------------------|---------|
60
+ | Hardcoded / compile-time constant string | N/A | **Safe** — proven authorship |
61
+ | Developer-authored query with bound parameters only | No dynamic fragments from user input | **Safe** |
62
+ | String concatenation / template with user-controlled values | Yes | **Unsafe** — report as SQLi |
63
+ | ORM query builder with user input in WHERE/JOIN | Yes | **Unsafe** unless parameterized |
64
+ | Stored procedure call with bound args | Args from trusted constants only | **Safe** |
65
+ | Stored procedure with dynamic SQL inside | User input reaches EXEC | **Unsafe** |
66
+
67
+ **Provenance test:** If the agent cannot prove the query string was authored entirely by the developer (no attacker-reachable interpolation), treat as vulnerable. Hardcoded SQL in migrations, seeds, and admin scripts is safe; anything reachable from HTTP/CLI/user input is not.
68
+
26
69
  ## BCP Plus Integration
27
70
 
28
71
  This skill maps to **BCP Plus dimension 12 (Security & Compliance)**. When BCP Plus sizing is active, the threat model categories above correspond to sub-elements within dimension 12. The NFR Gate rule applies: standard-expectation items (e.g., "use HTTPS", "hash passwords") score 0 with a one-line rationale; only above-standard security requirements contribute to the dimension 12 count. See `docs/references/bcp-plus.md` for the full 13-dimension framework and NFR Gate pattern.
@@ -174,14 +217,15 @@ Automatically exclude findings matching these patterns:
174
217
  | 8 | **Race conditions / timing attacks** that are theoretical | Only report if concretely problematic |
175
218
  | 9 | **Outdated third-party libraries** | Managed separately by dependency scanners |
176
219
  | 10 | **Memory safety** in Rust or other memory-safe languages | Impossible by language guarantees |
177
- | 11 | **Unit test files only** | Not production risk |
178
- | 12 | **Log spoofing** | Outputting unsanitized input to logs is not a vuln |
179
- | 13 | **SSRF that only controls path** | Only host/protocol control is exploitable |
180
- | 14 | **User-controlled content in AI system prompts** | Not a security vulnerability |
181
- | 15 | **Regex injection** | Injecting untrusted content into regex is not a vuln |
182
- | 16 | **Regex DOS** | Excluded alongside general DOS |
183
- | 17 | **Documentation files** (.md, .txt) | Insecure docs are not code vulnerabilities |
184
- | 18 | **Lack of audit logs** | Not a vulnerability |
220
+ | 11 | **Hardcoded SQL with proven authorship** — migrations, seeds, static admin queries with no user interpolation | Developer-authored SQL is safe per SQL-safety doctrine (e45s41) |
221
+ | 12 | **Unit test files only** | Not production risk |
222
+ | 13 | **Log spoofing** | Outputting unsanitized input to logs is not a vuln |
223
+ | 14 | **SSRF that only controls path** | Only host/protocol control is exploitable |
224
+ | 15 | **User-controlled content in AI system prompts** | Not a security vulnerability |
225
+ | 16 | **Regex injection** | Injecting untrusted content into regex is not a vuln |
226
+ | 17 | **Regex DOS** | Excluded alongside general DOS |
227
+ | 18 | **Documentation files** (.md, .txt) | Insecure docs are not code vulnerabilities |
228
+ | 19 | **Lack of audit logs** | Not a vulnerability |
185
229
 
186
230
  ## Precedent Rules
187
231
 
@@ -233,6 +277,8 @@ Each category: vulnerable pattern → safe pattern → code example.
233
277
  | Aspect | Detail |
234
278
  |--------|--------|
235
279
  | **Vulnerable** | String interpolation in SQL queries: `f"SELECT * FROM users WHERE id = {uid}"` |
280
+ | **CWE** | CWE-89 (SQL Injection) |
281
+ | **Fixtures** | `fixtures/CWE-89-sqli-positive.py` (flag) · `fixtures/CWE-89-sqli-negative.py` (pass) |
236
282
  | **Safe** | Parameterized queries / ORM: `cursor.execute("SELECT * FROM users WHERE id = %s", (uid,))` |
237
283
  | **Look for** | f-strings, `+` concatenation, `format()` in query builders; raw SQL in ORM `.raw()` / `.execute()` |
238
284
  | **False-positive guard** | Not a FP if the input is user-controlled (HTTP param, file, env var, CLI arg). Env vars are trusted (see exclusion rules). |
@@ -242,6 +288,8 @@ Each category: vulnerable pattern → safe pattern → code example.
242
288
  | Aspect | Detail |
243
289
  |--------|--------|
244
290
  | **Vulnerable** | `element.innerHTML = userInput`, `dangerouslySetInnerHTML={{__html: userInput}}` |
291
+ | **CWE** | CWE-79 (Cross-site Scripting) |
292
+ | **Fixtures** | `fixtures/CWE-79-xss-positive.js` (flag) · `fixtures/CWE-79-xss-negative.js` (pass) |
245
293
  | **Safe** | `element.textContent = userInput`, React JSX (auto-escaped), template engines with auto-escaping |
246
294
  | **Look for** | `.innerHTML`, `document.write()`, `dangerouslySetInnerHTML`, `v-html` (Vue), `bypassSecurityTrustHtml` (Angular) |
247
295
  | **False-positive guard** | React/Angular components without unsafe methods are NOT vulnerable (see exclusion rules). |
@@ -61,7 +61,28 @@ echo "# Specs\n\nAll planning documents for this project." > specs/README.md
61
61
 
62
62
  When generating `CLAUDE.md`, if the user did not name a Preflight command, chain the Test + Lint + Build interview answers into one **Preflight** row (e.g. `npm test && npm run lint && npm run build`).
63
63
 
64
+ ### Self-installing fenced markers (e45s21)
64
65
 
66
+ Skills that write into `CLAUDE.md` or `AGENTS.md` MUST use **fenced HTML comment markers** so handwritten content outside the fence is never clobbered:
67
+
68
+ ```markdown
69
+ <!-- BEGIN bigpowers:section-id -->
70
+ …agent-managed content only…
71
+ <!-- END bigpowers:section-id -->
72
+ ```
73
+
74
+ **Merge rule:** On update, replace only the content *between* matching `BEGIN`/`END` pairs. If a marker pair is missing, append a new fenced block at the end of the file — never rewrite the whole file.
75
+
76
+ **Standard marker IDs** for seeded projects (see [REFERENCE.md](REFERENCE.md) § Fenced markers):
77
+
78
+ | Marker ID | Owner skill | Purpose |
79
+ |-----------|-------------|---------|
80
+ | `project` | seed-conventions | Project, Commands, Architecture |
81
+ | `context-routing` | seed-conventions | Glob → sub-AGENTS.md routing table |
82
+ | `learned-preferences` | session-state | Learned User Preferences + Workspace Facts |
83
+ | `tooling` | setup-environment, guard-git | sqz/rtk/hook blocks installed by tooling skills |
84
+
85
+ Emit these fences in `AGENTS.md` (and therefore `CLAUDE.md` symlink) from `docs/templates/AGENTS.md`. User prose outside fences is sacred.
65
86
 
66
87
  - [ ] CLAUDE.md exists and is populated
67
88
  - [ ] CONVENTIONS.md exists and includes specs/ output convention
@@ -75,8 +96,48 @@ When generating `CLAUDE.md`, if the user did not name a Preflight command, chain
75
96
  ---
76
97
 
77
98
  # story: e51s02 e37s01 e37s03 e37s14
99
+ # story: e45s21
78
100
  # Seed Conventions — Reference Templates
79
101
 
102
+ ## Navigation
103
+
104
+ | Lines | Section |
105
+ |-------|---------|
106
+ | 1–4 | Title + story tags |
107
+ | 6–22 | Navigation (this table) |
108
+ | 24–35 | AGENTS.md spine |
109
+ | 37–76 | Agent config template |
110
+ | 78–85 | opencode.json template |
111
+ | 87–96 | Aider bridge |
112
+ | 98–108 | Codex CLI wiring |
113
+ | 110–118 | CONVENTIONS.md |
114
+ | 120–122 | Stack profile fragments |
115
+ | 124–153 | Local tool wiring |
116
+
117
+ ## Fenced markers (e45s21)
118
+
119
+ Self-installing blocks prevent skills from overwriting user-authored prose. Pattern:
120
+
121
+ ```markdown
122
+ <!-- BEGIN bigpowers:section-id -->
123
+ …managed content…
124
+ <!-- END bigpowers:section-id -->
125
+ ```
126
+
127
+ **Merge algorithm:**
128
+
129
+ 1. If `BEGIN bigpowers:<id>` exists → replace inner content only.
130
+ 2. If missing → append new fenced block at EOF.
131
+ 3. Never delete content outside fences.
132
+
133
+ Seed these marker IDs in generated `AGENTS.md`:
134
+
135
+ | ID | Initial content |
136
+ |----|-----------------|
137
+ | `project` | Project, Commands, Architecture, Conventions, Never, Agent Rules |
138
+ | `context-routing` | Glob → sub-AGENTS.md table (see CLAUDE.md e45s22) |
139
+ | `learned-preferences` | Empty Learned User Preferences + Workspace Facts lists |
140
+
80
141
  ## AGENTS.md spine (Reach Template — e37s01)
81
142
 
82
143
  Canonical source: copy from `docs/templates/AGENTS.md` in the bigpowers repo (Reach Template).
@@ -3,6 +3,8 @@ description: Track implementation decisions and progress in specs/state.yaml to
3
3
  ---
4
4
 
5
5
 
6
+ # story: e45s23
7
+
6
8
  # Session State
7
9
  > **HARD GATE** — **HARD GATE** — Session state must be synchronized with git state. If state.yaml conflicts with the working tree, halt and ask for clarification. Do NOT assume state is correct.
8
10
 
@@ -17,6 +19,8 @@ Maintain a single source of truth for the *current* session in `specs/state.yaml
17
19
 
18
20
  Legacy markdown (`specs/archive/STATE.md`, `RELEASE-PLAN.md`) is **not** SoT when YAML exists — use `specs/state.yaml` only.
19
21
 
22
+ When a story modifies existing behavior, patch only between matching marker pairs in `CLAUDE.md` / `AGENTS.md` `learned-preferences` fence — see e45s21.
23
+
20
24
  ## Handoff block (cold start)
21
25
 
22
26
  When ending a session or before a context-heavy spawn, update `handoff` in `state.yaml`:
@@ -63,6 +67,7 @@ When starting a new session or after a significant context flush:
63
67
  Whenever a significant decision is made or a milestone is reached:
64
68
 
65
69
  - [ ] Patch via `bash scripts/bp-yaml-set.sh specs/state.yaml git.hash <hash>` (or edit directly).
70
+ - [ ] Patch `handoff` and `learned_preferences` / `workspace_facts` in `CLAUDE.md` fenced block when durable user preferences or repo facts crystallize (e45s23).
66
71
  - [ ] Update `handoff.open_decisions` with rationale.
67
72
  - [ ] Update `epic_cycle` when advancing `ship-epic` steps.
68
73
  - [ ] Record open questions under `handoff.open_decisions` or an ADR.
@@ -129,16 +134,6 @@ handoff:
129
134
  next_skill: survey-context
130
135
  ```
131
136
 
132
- ## Tracking commit ratio
133
-
134
- After `release-branch` lands, compute fix-to-feature ratio via:
135
- ```bash
136
- FEAT_COUNT=$(git log main --oneline --grep="^feat" | wc -l | tr -d ' ')
137
- FIX_COUNT=$(git log main --oneline --grep="^fix" | wc -l | tr -d ' ')
138
- FIX_PCT=$((FIX_COUNT * 100 / (FEAT_COUNT + FIX_COUNT)))
139
- ```
140
- Update `specs/state.yaml` `metrics.commit_ratio` with counts. If `fix_pct > 30%`, emit: `"High fix rate (N%) — deploy + smoke-test recommended"`.
141
-
142
137
  ## Anti-Patterns
143
138
 
144
139
  - **Duplicate Plan**: Don't copy `release-plan.yaml` or epic shards into `state.yaml`.