bigpowers 2.90.2 → 2.91.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/.agents/skills/build-epic/SKILL.md +1 -1
  2. package/.agents/skills/commit-message/SKILL.md +1 -0
  3. package/.agents/skills/guard-git/SKILL.md +7 -2
  4. package/.agents/skills/release-branch/SKILL.md +4 -5
  5. package/.agents/skills/run-planning/SKILL.md +6 -1
  6. package/.agents/skills/verify-work/SKILL.md +2 -1
  7. package/.cline/skills/build-epic/SKILL.md +1 -1
  8. package/.cline/skills/commit-message/SKILL.md +1 -0
  9. package/.cline/skills/guard-git/SKILL.md +7 -2
  10. package/.cline/skills/release-branch/SKILL.md +4 -5
  11. package/.cline/skills/run-planning/SKILL.md +6 -1
  12. package/.cline/skills/verify-work/SKILL.md +2 -1
  13. package/.codebuddy/skills/build-epic/SKILL.md +1 -1
  14. package/.codebuddy/skills/commit-message/SKILL.md +1 -0
  15. package/.codebuddy/skills/guard-git/SKILL.md +7 -2
  16. package/.codebuddy/skills/release-branch/SKILL.md +4 -5
  17. package/.codebuddy/skills/run-planning/SKILL.md +6 -1
  18. package/.codebuddy/skills/verify-work/SKILL.md +2 -1
  19. package/.codex/skills/build-epic/SKILL.md +1 -1
  20. package/.codex/skills/commit-message/SKILL.md +1 -0
  21. package/.codex/skills/guard-git/SKILL.md +7 -2
  22. package/.codex/skills/release-branch/SKILL.md +4 -5
  23. package/.codex/skills/run-planning/SKILL.md +6 -1
  24. package/.codex/skills/verify-work/SKILL.md +2 -1
  25. package/.copilot/skills/build-epic/SKILL.md +1 -1
  26. package/.copilot/skills/commit-message/SKILL.md +1 -0
  27. package/.copilot/skills/guard-git/SKILL.md +7 -2
  28. package/.copilot/skills/release-branch/SKILL.md +4 -5
  29. package/.copilot/skills/run-planning/SKILL.md +6 -1
  30. package/.copilot/skills/verify-work/SKILL.md +2 -1
  31. package/.cursor/rules/build-epic.mdc +1 -1
  32. package/.cursor/rules/commit-message.mdc +1 -0
  33. package/.cursor/rules/guard-git.mdc +7 -2
  34. package/.cursor/rules/release-branch.mdc +4 -5
  35. package/.cursor/rules/run-planning.mdc +6 -1
  36. package/.cursor/rules/verify-work.mdc +2 -1
  37. package/.gemini/extensions/bigpowers/commands/prompts/build-epic.md +1 -1
  38. package/.gemini/extensions/bigpowers/commands/prompts/commit-message.md +1 -0
  39. package/.gemini/extensions/bigpowers/commands/prompts/guard-git.md +7 -2
  40. package/.gemini/extensions/bigpowers/commands/prompts/release-branch.md +4 -5
  41. package/.gemini/extensions/bigpowers/commands/prompts/run-planning.md +6 -1
  42. package/.gemini/extensions/bigpowers/commands/prompts/verify-work.md +2 -1
  43. package/.gemini/extensions/bigpowers/gemini-extension.json +1 -1
  44. package/.gemini/extensions/bigpowers/skills/build-epic/SKILL.md +1 -1
  45. package/.gemini/extensions/bigpowers/skills/commit-message/SKILL.md +1 -0
  46. package/.gemini/extensions/bigpowers/skills/guard-git/SKILL.md +7 -2
  47. package/.gemini/extensions/bigpowers/skills/release-branch/SKILL.md +4 -5
  48. package/.gemini/extensions/bigpowers/skills/run-planning/SKILL.md +6 -1
  49. package/.gemini/extensions/bigpowers/skills/verify-work/SKILL.md +2 -1
  50. package/.hermes/skills/build-epic/SKILL.md +1 -1
  51. package/.hermes/skills/commit-message/SKILL.md +1 -0
  52. package/.hermes/skills/guard-git/SKILL.md +7 -2
  53. package/.hermes/skills/release-branch/SKILL.md +4 -5
  54. package/.hermes/skills/run-planning/SKILL.md +6 -1
  55. package/.hermes/skills/verify-work/SKILL.md +2 -1
  56. package/.kilocode/rules/build-epic.md +1 -1
  57. package/.kilocode/rules/commit-message.md +1 -0
  58. package/.kilocode/rules/guard-git.md +7 -2
  59. package/.kilocode/rules/release-branch.md +4 -5
  60. package/.kilocode/rules/run-planning.md +6 -1
  61. package/.kilocode/rules/verify-work.md +2 -1
  62. package/.mimocode/skills/build-epic/SKILL.md +1 -1
  63. package/.mimocode/skills/commit-message/SKILL.md +1 -0
  64. package/.mimocode/skills/guard-git/SKILL.md +7 -2
  65. package/.mimocode/skills/release-branch/SKILL.md +4 -5
  66. package/.mimocode/skills/run-planning/SKILL.md +6 -1
  67. package/.mimocode/skills/verify-work/SKILL.md +2 -1
  68. package/.opencode/skills/build-epic/SKILL.md +1 -1
  69. package/.opencode/skills/commit-message/SKILL.md +1 -0
  70. package/.opencode/skills/guard-git/SKILL.md +7 -2
  71. package/.opencode/skills/release-branch/SKILL.md +4 -5
  72. package/.opencode/skills/run-planning/SKILL.md +6 -1
  73. package/.opencode/skills/verify-work/SKILL.md +2 -1
  74. package/.pi/package.json +1 -1
  75. package/.pi/prompts/build-epic.md +1 -1
  76. package/.pi/prompts/commit-message.md +1 -0
  77. package/.pi/prompts/guard-git.md +7 -2
  78. package/.pi/prompts/release-branch.md +4 -5
  79. package/.pi/prompts/run-planning.md +6 -1
  80. package/.pi/prompts/verify-work.md +2 -1
  81. package/.pi/skills/build-epic/SKILL.md +1 -1
  82. package/.pi/skills/commit-message/SKILL.md +1 -0
  83. package/.pi/skills/guard-git/SKILL.md +7 -2
  84. package/.pi/skills/release-branch/SKILL.md +4 -5
  85. package/.pi/skills/run-planning/SKILL.md +6 -1
  86. package/.pi/skills/verify-work/SKILL.md +2 -1
  87. package/.qwen/skills/build-epic/SKILL.md +1 -1
  88. package/.qwen/skills/commit-message/SKILL.md +1 -0
  89. package/.qwen/skills/guard-git/SKILL.md +7 -2
  90. package/.qwen/skills/release-branch/SKILL.md +4 -5
  91. package/.qwen/skills/run-planning/SKILL.md +6 -1
  92. package/.qwen/skills/verify-work/SKILL.md +2 -1
  93. package/.trae/skills/build-epic/SKILL.md +1 -1
  94. package/.trae/skills/commit-message/SKILL.md +1 -0
  95. package/.trae/skills/guard-git/SKILL.md +7 -2
  96. package/.trae/skills/release-branch/SKILL.md +4 -5
  97. package/.trae/skills/run-planning/SKILL.md +6 -1
  98. package/.trae/skills/verify-work/SKILL.md +2 -1
  99. package/.windsurf/rules/build-epic.md +1 -1
  100. package/.windsurf/rules/commit-message.md +1 -0
  101. package/.windsurf/rules/guard-git.md +7 -2
  102. package/.windsurf/rules/release-branch.md +4 -5
  103. package/.windsurf/rules/run-planning.md +6 -1
  104. package/.windsurf/rules/verify-work.md +2 -1
  105. package/.zcode/skills/build-epic/SKILL.md +1 -1
  106. package/.zcode/skills/commit-message/SKILL.md +1 -0
  107. package/.zcode/skills/guard-git/SKILL.md +7 -2
  108. package/.zcode/skills/release-branch/SKILL.md +4 -5
  109. package/.zcode/skills/run-planning/SKILL.md +6 -1
  110. package/.zcode/skills/verify-work/SKILL.md +2 -1
  111. package/CHANGELOG.md +15 -0
  112. package/extensions/omp-hooks.ts +197 -58
  113. package/hooks/pre/bash.sh +54 -7
  114. package/hooks/pre-tool-use.sh +72 -12
  115. package/package.json +2 -1
  116. package/scripts/convert-legado.sh +1 -0
  117. package/scripts/lib/__pycache__/atomic_write.cpython-310.pyc +0 -0
  118. package/scripts/lib/__pycache__/link_utils.cpython-310.pyc +0 -0
  119. package/scripts/lib/__pycache__/srp_engine_links.cpython-310.pyc +0 -0
  120. package/scripts/lib/__pycache__/srp_engine_okf.cpython-310.pyc +0 -0
  121. package/scripts/lib/assert-epic-gate.sh +32 -0
  122. package/scripts/lib/assert-planning-artifacts.sh +65 -0
  123. package/scripts/lib/git-argv.py +168 -0
  124. package/scripts/lib/golden-suite-gates.sh +2 -0
  125. package/scripts/omp-guard-probe.ts +46 -0
  126. package/scripts/test-generated-path-hook.sh +57 -0
  127. package/scripts/test-guard-git-normalize.sh +189 -0
  128. package/scripts/test-test-lock-hook.sh +100 -0
  129. package/scripts/validate-doctrine.sh +4 -4
  130. package/scripts/verify-adversarial.sh +146 -0
  131. package/scripts/verify-tdd-red-commit.sh +39 -1
  132. package/skills/build-epic/SKILL.md +1 -1
  133. package/skills/commit-message/SKILL.md +1 -0
  134. package/skills/guard-git/SKILL.md +7 -2
  135. package/skills/release-branch/SKILL.md +4 -5
  136. package/skills/run-planning/SKILL.md +6 -1
  137. package/skills/verify-work/SKILL.md +2 -1
  138. package/skills-lock.json +6 -6
  139. package/tests/test-artifact-assertions.sh +86 -0
  140. package/tests/test-verify-adversarial.sh +27 -0
@@ -66,7 +66,7 @@ Orchestrates the **build** flow for a single epic: survey → plan tasks → kic
66
66
  After step 5 (verify-work) completes successfully, step 6 runs `audit-code` automatically in `--gate` mode:
67
67
 
68
68
  1. **Run audit:** Invoke `audit-code --gate` on the complete diff for this story.
69
- 2. **Pass (exit 0):** All checklist sections pass → advance to step 7 (commit-message). Record `epic_cycle.audit_result: pass` in `state.yaml`.
69
+ 2. **Pass (exit 0):** All checklist sections pass → run `bash scripts/lib/assert-epic-gate.sh advance` to mechanically confirm the audit pass, then advance to step 7 (commit-message). Record `epic_cycle.audit_result: pass` in `state.yaml`.
70
70
  3. **Fail (exit 1):** One or more checklist sections fail → **reset `epic_cycle.current_step` to `4`** (develop-tdd) and add the failing section IDs to `completed_steps` as `"1,2,3,4,5,6(fail: ...)"`. Record `epic_cycle.audit_result: fail` in `state.yaml`. Do NOT advance past step 6 until audit passes.
71
71
  4. **Audit artifact:** Full audit report saved to `specs/verifications/AUDIT-<epic>-<story>.md` regardless of pass/fail, for reviewer traceability.
72
72
  5. **Enforce F.I.R.S.T:** After audit-code passes, run `enforce-first --quick` on new/modified tests. Append F.I.R.S.T violations (if any) to the audit report. Failing F.I.R.S.T criteria trigger the same loop-back to step 4.
@@ -36,6 +36,7 @@ description: "Reviews working-tree changes, then drafts a Conventional Commits t
36
36
 
37
37
  ## Checklist before finalizing
38
38
 
39
+ - [ ] **Audit pass confirmed (HARD GATE — Issue #182):** In active epic flow, `bash scripts/lib/assert-epic-gate.sh commit` passes.
39
40
  - [ ] Type matches the **dominant** user-visible outcome (`feat` vs `fix` vs `perf`, etc.).
40
41
  - [ ] **Scope** is a short noun in parentheses if it helps (e.g. `fix(api): …`).
41
42
  - [ ] Breaking changes are explicit (`!` and/or `BREAKING CHANGE:` in the body/footer).
@@ -12,7 +12,8 @@ Installs a shared hook that blocks destructive git operations and enforces workf
12
12
 
13
13
  ## What gets blocked/enforced
14
14
 
15
- - **Safety**: `git push --force`, `git reset --hard`, `git clean -f`, `git branch -D`, `git checkout .`, `git restore .`.
15
+ - **Safety**: force push (`-f`, `--force`, `+refspec`), `reset` with `--hard`, `clean` with any `-f*`, `branch -D` / `--delete --force`, `checkout`/`restore` that discard work (`-f`, `.` pathspec).
16
+ - **Argv, not substrings**: the hook tokenizes each command, strips git's global options (`-C <path>`, `-c k=v`, `--no-pager`, `--git-dir=…`) and judges the `(subcommand, arguments)` pair — so `git -C repo reset -q --hard` is blocked, while `git push --force-with-lease` is allowed. Rules live in `scripts/lib/git-argv.py`, mirrored in `extensions/omp-hooks.ts`; `scripts/test-guard-git-normalize.sh` fails if the two disagree.
16
17
  - **Discipline**: Blocks direct commits or pushes to protected branches (`main`, `master`) unless `GIT_BIGPOWERS_LAND=1` (set only by `scripts/land-branch.sh`).
17
18
  - **Allows**: `git push origin <feature-branch>` for backup/CI; solo land push to `main` only inside `land-branch.sh`.
18
19
  - **Standardization**: Enforces [Conventional Commits](https://www.conventionalcommits.org/) for all `git commit` commands.
@@ -37,7 +38,11 @@ Installs a shared hook that blocks destructive git operations and enforces workf
37
38
 
38
39
  ## Customization
39
40
 
40
- To add or remove patterns or protected branches, edit `pre-tool-use.sh`.
41
+ The rule table lives in `scripts/lib/git-argv.py` (shell hooks) and is mirrored in `extensions/omp-hooks.ts`. Add a rule to both and a row to `specs/verifications/fixtures/guard-git-normalize.yaml`.
42
+
43
+ The TS side is judged through `evaluateBashCall()` — the single pure function the `tool_call` handler calls — so the fixture covers **every** rule (destructive argv, protected-branch push, Conventional Commits), not just the argv table. The gate (`bash scripts/test-guard-git-normalize.sh`) runs both implementations with `GIT_BIGPOWERS_LAND` unset and fails if they disagree, so a verdict can never depend on the developer's shell.
44
+
45
+ Protected-branch rules answer differently on `main` than on a feature branch, so a row that touches commit/push semantics states its `branch:` and both sides are run in it (the shell hook in a throwaway repo checked out on that branch). A row without `branch:` is judged on a feature branch. Do not pin the branch inside either implementation — that is what made the gate pass on PRs and fail on `main`.
41
46
 
42
47
  ## Advanced
43
48
 
@@ -56,13 +56,12 @@ git log main...HEAD --format="%B" | grep -qiE 'co[- ]authored[- ]by' && echo "
56
56
  ### 2a. Security gate
57
57
 
58
58
  - [ ] `specs/security/REVIEW.md` exists and is fresh (matches current branch diff)
59
- - [ ] No unresolved HIGH findings with confidence ≥ 8 (or all documented in `specs/security/EXCEPTIONS.md` with sign-off rationale)
60
59
 
61
- If REVIEW.md is missing or stale → run `security-review` inline. Findings block the merge unless documented in EXCEPTIONS.md.
60
+ ### 2b. Audit-code & Traceability gates (HARD GATES — Issue #182)
62
61
 
63
- ### 2b. Traceability gate
64
-
65
- 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.
62
+ - [ ] Run `bash scripts/lib/assert-epic-gate.sh release` (asserts `specs/AUDIT_LATEST.md` passed; blocks release on failure).
63
+ - [ ] No unresolved HIGH security findings with confidence ≥ 8 (or documented in `specs/security/EXCEPTIONS.md`).
64
+ - [ ] Run `gate-trace`. FAIL blocks merge; CONCERNS requires explicit override in `specs/state.yaml`. WAIVED if no matrix available.
66
65
 
67
66
  > **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.
68
67
 
@@ -62,7 +62,12 @@ if written:
62
62
  - `plan-release` — sequence epics by WSJF
63
63
  - `slice-tasks` — cut vertical slices
64
64
 
65
- 4. **Update status** — On successful completion, set `status: done` for that workflow key in `planning-status.yaml`.
65
+ 4. **Mechanical artifact assertion before status update (HARD GATE — Issue #183):**
66
+ Before marking any workflow key `status: done`, run:
67
+ ```bash
68
+ bash scripts/lib/assert-planning-artifacts.sh <workflow-key>
69
+ ```
70
+ If the artifact assertion fails, do NOT advance status. Remediate missing output files before continuing. On success, set `status: done` for that workflow key in `planning-status.yaml`.
66
71
 
67
72
  5. **Advance** — Set `state.yaml` `active_flow: planning` while in this chain. When all required keys are done, set `handoff.next_skill` to `plan-work`.
68
73
 
@@ -62,7 +62,8 @@ Review answers "is the code good?"; Verify answers "does the built thing do what
62
62
  5a. **Blind-spot check** — run `bash scripts/check-blind-spots.sh`. This detects structural quality gaps (verify-gap, test-gap, stale-tag, etc.) beyond percentage coverage. If any HIGH-severity findings exist → **block the verify-work PASS gate**. Findings are written to `specs/blind-spots.json`. MEDIUM/LOW findings warn but don't block.
63
63
  5a2. **Completeness critic (e45s05)** — `bash scripts/lib/completeness-critic.sh`. **BLOCKER** aborts merge gate; WARNING → gaps loop; FILLED = evidence only.
64
64
 
65
- 5b. **NFR Evidence Gate** (P0 only) — Produces go/no-go output on three dimensions: Performance (response time, throughput), Reliability (error rate, recovery), and Operability (logging, health checks). Reads thresholds from `specs/tech-architecture/eNN-TEST_PLAN_LATEST.md` and writes evidence as OKF verification-report bundles to `specs/verifications/NFR-eNNsYY.json`. FAIL on any dimension blocks the gate.
65
+ 5b. **NFR Evidence Gate** (P0 only) — Go/no-go on Performance, Reliability, Operability against `specs/tech-architecture/eNN-TEST_PLAN_LATEST.md`. Evidence written to `specs/verifications/NFR-eNNsYY.json`. FAIL blocks gate.
66
+ 5c. **Adversarial Defect Mutation Gate (HARD GATE — e86 / ab-20)** — `bash scripts/verify-adversarial.sh`. Boundary fuzzing & parameter injection against modified interfaces. Crashes or failures block PASS gate; evidence in `specs/verifications/ADVERSARIAL_LATEST.yaml`.
66
67
  6. **Step-by-step UAT** (skip if P2/P3) — one user-observable action at a time.
67
68
  7. **Gaps loop** — failures → log → `plan-work` → re-verify. Unaddressed HIGH findings from step 5 feed into this loop alongside other quality gaps.
68
69
 
@@ -66,7 +66,7 @@ Orchestrates the **build** flow for a single epic: survey → plan tasks → kic
66
66
  After step 5 (verify-work) completes successfully, step 6 runs `audit-code` automatically in `--gate` mode:
67
67
 
68
68
  1. **Run audit:** Invoke `audit-code --gate` on the complete diff for this story.
69
- 2. **Pass (exit 0):** All checklist sections pass → advance to step 7 (commit-message). Record `epic_cycle.audit_result: pass` in `state.yaml`.
69
+ 2. **Pass (exit 0):** All checklist sections pass → run `bash scripts/lib/assert-epic-gate.sh advance` to mechanically confirm the audit pass, then advance to step 7 (commit-message). Record `epic_cycle.audit_result: pass` in `state.yaml`.
70
70
  3. **Fail (exit 1):** One or more checklist sections fail → **reset `epic_cycle.current_step` to `4`** (develop-tdd) and add the failing section IDs to `completed_steps` as `"1,2,3,4,5,6(fail: ...)"`. Record `epic_cycle.audit_result: fail` in `state.yaml`. Do NOT advance past step 6 until audit passes.
71
71
  4. **Audit artifact:** Full audit report saved to `specs/verifications/AUDIT-<epic>-<story>.md` regardless of pass/fail, for reviewer traceability.
72
72
  5. **Enforce F.I.R.S.T:** After audit-code passes, run `enforce-first --quick` on new/modified tests. Append F.I.R.S.T violations (if any) to the audit report. Failing F.I.R.S.T criteria trigger the same loop-back to step 4.
@@ -36,6 +36,7 @@ description: "Reviews working-tree changes, then drafts a Conventional Commits t
36
36
 
37
37
  ## Checklist before finalizing
38
38
 
39
+ - [ ] **Audit pass confirmed (HARD GATE — Issue #182):** In active epic flow, `bash scripts/lib/assert-epic-gate.sh commit` passes.
39
40
  - [ ] Type matches the **dominant** user-visible outcome (`feat` vs `fix` vs `perf`, etc.).
40
41
  - [ ] **Scope** is a short noun in parentheses if it helps (e.g. `fix(api): …`).
41
42
  - [ ] Breaking changes are explicit (`!` and/or `BREAKING CHANGE:` in the body/footer).
@@ -12,7 +12,8 @@ Installs a shared hook that blocks destructive git operations and enforces workf
12
12
 
13
13
  ## What gets blocked/enforced
14
14
 
15
- - **Safety**: `git push --force`, `git reset --hard`, `git clean -f`, `git branch -D`, `git checkout .`, `git restore .`.
15
+ - **Safety**: force push (`-f`, `--force`, `+refspec`), `reset` with `--hard`, `clean` with any `-f*`, `branch -D` / `--delete --force`, `checkout`/`restore` that discard work (`-f`, `.` pathspec).
16
+ - **Argv, not substrings**: the hook tokenizes each command, strips git's global options (`-C <path>`, `-c k=v`, `--no-pager`, `--git-dir=…`) and judges the `(subcommand, arguments)` pair — so `git -C repo reset -q --hard` is blocked, while `git push --force-with-lease` is allowed. Rules live in `scripts/lib/git-argv.py`, mirrored in `extensions/omp-hooks.ts`; `scripts/test-guard-git-normalize.sh` fails if the two disagree.
16
17
  - **Discipline**: Blocks direct commits or pushes to protected branches (`main`, `master`) unless `GIT_BIGPOWERS_LAND=1` (set only by `scripts/land-branch.sh`).
17
18
  - **Allows**: `git push origin <feature-branch>` for backup/CI; solo land push to `main` only inside `land-branch.sh`.
18
19
  - **Standardization**: Enforces [Conventional Commits](https://www.conventionalcommits.org/) for all `git commit` commands.
@@ -37,7 +38,11 @@ Installs a shared hook that blocks destructive git operations and enforces workf
37
38
 
38
39
  ## Customization
39
40
 
40
- To add or remove patterns or protected branches, edit `pre-tool-use.sh`.
41
+ The rule table lives in `scripts/lib/git-argv.py` (shell hooks) and is mirrored in `extensions/omp-hooks.ts`. Add a rule to both and a row to `specs/verifications/fixtures/guard-git-normalize.yaml`.
42
+
43
+ The TS side is judged through `evaluateBashCall()` — the single pure function the `tool_call` handler calls — so the fixture covers **every** rule (destructive argv, protected-branch push, Conventional Commits), not just the argv table. The gate (`bash scripts/test-guard-git-normalize.sh`) runs both implementations with `GIT_BIGPOWERS_LAND` unset and fails if they disagree, so a verdict can never depend on the developer's shell.
44
+
45
+ Protected-branch rules answer differently on `main` than on a feature branch, so a row that touches commit/push semantics states its `branch:` and both sides are run in it (the shell hook in a throwaway repo checked out on that branch). A row without `branch:` is judged on a feature branch. Do not pin the branch inside either implementation — that is what made the gate pass on PRs and fail on `main`.
41
46
 
42
47
  ## Advanced
43
48
 
@@ -56,13 +56,12 @@ git log main...HEAD --format="%B" | grep -qiE 'co[- ]authored[- ]by' && echo "
56
56
  ### 2a. Security gate
57
57
 
58
58
  - [ ] `specs/security/REVIEW.md` exists and is fresh (matches current branch diff)
59
- - [ ] No unresolved HIGH findings with confidence ≥ 8 (or all documented in `specs/security/EXCEPTIONS.md` with sign-off rationale)
60
59
 
61
- If REVIEW.md is missing or stale → run `security-review` inline. Findings block the merge unless documented in EXCEPTIONS.md.
60
+ ### 2b. Audit-code & Traceability gates (HARD GATES — Issue #182)
62
61
 
63
- ### 2b. Traceability gate
64
-
65
- 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.
62
+ - [ ] Run `bash scripts/lib/assert-epic-gate.sh release` (asserts `specs/AUDIT_LATEST.md` passed; blocks release on failure).
63
+ - [ ] No unresolved HIGH security findings with confidence ≥ 8 (or documented in `specs/security/EXCEPTIONS.md`).
64
+ - [ ] Run `gate-trace`. FAIL blocks merge; CONCERNS requires explicit override in `specs/state.yaml`. WAIVED if no matrix available.
66
65
 
67
66
  > **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.
68
67
 
@@ -62,7 +62,12 @@ if written:
62
62
  - `plan-release` — sequence epics by WSJF
63
63
  - `slice-tasks` — cut vertical slices
64
64
 
65
- 4. **Update status** — On successful completion, set `status: done` for that workflow key in `planning-status.yaml`.
65
+ 4. **Mechanical artifact assertion before status update (HARD GATE — Issue #183):**
66
+ Before marking any workflow key `status: done`, run:
67
+ ```bash
68
+ bash scripts/lib/assert-planning-artifacts.sh <workflow-key>
69
+ ```
70
+ If the artifact assertion fails, do NOT advance status. Remediate missing output files before continuing. On success, set `status: done` for that workflow key in `planning-status.yaml`.
66
71
 
67
72
  5. **Advance** — Set `state.yaml` `active_flow: planning` while in this chain. When all required keys are done, set `handoff.next_skill` to `plan-work`.
68
73
 
@@ -62,7 +62,8 @@ Review answers "is the code good?"; Verify answers "does the built thing do what
62
62
  5a. **Blind-spot check** — run `bash scripts/check-blind-spots.sh`. This detects structural quality gaps (verify-gap, test-gap, stale-tag, etc.) beyond percentage coverage. If any HIGH-severity findings exist → **block the verify-work PASS gate**. Findings are written to `specs/blind-spots.json`. MEDIUM/LOW findings warn but don't block.
63
63
  5a2. **Completeness critic (e45s05)** — `bash scripts/lib/completeness-critic.sh`. **BLOCKER** aborts merge gate; WARNING → gaps loop; FILLED = evidence only.
64
64
 
65
- 5b. **NFR Evidence Gate** (P0 only) — Produces go/no-go output on three dimensions: Performance (response time, throughput), Reliability (error rate, recovery), and Operability (logging, health checks). Reads thresholds from `specs/tech-architecture/eNN-TEST_PLAN_LATEST.md` and writes evidence as OKF verification-report bundles to `specs/verifications/NFR-eNNsYY.json`. FAIL on any dimension blocks the gate.
65
+ 5b. **NFR Evidence Gate** (P0 only) — Go/no-go on Performance, Reliability, Operability against `specs/tech-architecture/eNN-TEST_PLAN_LATEST.md`. Evidence written to `specs/verifications/NFR-eNNsYY.json`. FAIL blocks gate.
66
+ 5c. **Adversarial Defect Mutation Gate (HARD GATE — e86 / ab-20)** — `bash scripts/verify-adversarial.sh`. Boundary fuzzing & parameter injection against modified interfaces. Crashes or failures block PASS gate; evidence in `specs/verifications/ADVERSARIAL_LATEST.yaml`.
66
67
  6. **Step-by-step UAT** (skip if P2/P3) — one user-observable action at a time.
67
68
  7. **Gaps loop** — failures → log → `plan-work` → re-verify. Unaddressed HIGH findings from step 5 feed into this loop alongside other quality gaps.
68
69
 
@@ -66,7 +66,7 @@ Orchestrates the **build** flow for a single epic: survey → plan tasks → kic
66
66
  After step 5 (verify-work) completes successfully, step 6 runs `audit-code` automatically in `--gate` mode:
67
67
 
68
68
  1. **Run audit:** Invoke `audit-code --gate` on the complete diff for this story.
69
- 2. **Pass (exit 0):** All checklist sections pass → advance to step 7 (commit-message). Record `epic_cycle.audit_result: pass` in `state.yaml`.
69
+ 2. **Pass (exit 0):** All checklist sections pass → run `bash scripts/lib/assert-epic-gate.sh advance` to mechanically confirm the audit pass, then advance to step 7 (commit-message). Record `epic_cycle.audit_result: pass` in `state.yaml`.
70
70
  3. **Fail (exit 1):** One or more checklist sections fail → **reset `epic_cycle.current_step` to `4`** (develop-tdd) and add the failing section IDs to `completed_steps` as `"1,2,3,4,5,6(fail: ...)"`. Record `epic_cycle.audit_result: fail` in `state.yaml`. Do NOT advance past step 6 until audit passes.
71
71
  4. **Audit artifact:** Full audit report saved to `specs/verifications/AUDIT-<epic>-<story>.md` regardless of pass/fail, for reviewer traceability.
72
72
  5. **Enforce F.I.R.S.T:** After audit-code passes, run `enforce-first --quick` on new/modified tests. Append F.I.R.S.T violations (if any) to the audit report. Failing F.I.R.S.T criteria trigger the same loop-back to step 4.
@@ -36,6 +36,7 @@ description: "Reviews working-tree changes, then drafts a Conventional Commits t
36
36
 
37
37
  ## Checklist before finalizing
38
38
 
39
+ - [ ] **Audit pass confirmed (HARD GATE — Issue #182):** In active epic flow, `bash scripts/lib/assert-epic-gate.sh commit` passes.
39
40
  - [ ] Type matches the **dominant** user-visible outcome (`feat` vs `fix` vs `perf`, etc.).
40
41
  - [ ] **Scope** is a short noun in parentheses if it helps (e.g. `fix(api): …`).
41
42
  - [ ] Breaking changes are explicit (`!` and/or `BREAKING CHANGE:` in the body/footer).
@@ -12,7 +12,8 @@ Installs a shared hook that blocks destructive git operations and enforces workf
12
12
 
13
13
  ## What gets blocked/enforced
14
14
 
15
- - **Safety**: `git push --force`, `git reset --hard`, `git clean -f`, `git branch -D`, `git checkout .`, `git restore .`.
15
+ - **Safety**: force push (`-f`, `--force`, `+refspec`), `reset` with `--hard`, `clean` with any `-f*`, `branch -D` / `--delete --force`, `checkout`/`restore` that discard work (`-f`, `.` pathspec).
16
+ - **Argv, not substrings**: the hook tokenizes each command, strips git's global options (`-C <path>`, `-c k=v`, `--no-pager`, `--git-dir=…`) and judges the `(subcommand, arguments)` pair — so `git -C repo reset -q --hard` is blocked, while `git push --force-with-lease` is allowed. Rules live in `scripts/lib/git-argv.py`, mirrored in `extensions/omp-hooks.ts`; `scripts/test-guard-git-normalize.sh` fails if the two disagree.
16
17
  - **Discipline**: Blocks direct commits or pushes to protected branches (`main`, `master`) unless `GIT_BIGPOWERS_LAND=1` (set only by `scripts/land-branch.sh`).
17
18
  - **Allows**: `git push origin <feature-branch>` for backup/CI; solo land push to `main` only inside `land-branch.sh`.
18
19
  - **Standardization**: Enforces [Conventional Commits](https://www.conventionalcommits.org/) for all `git commit` commands.
@@ -37,7 +38,11 @@ Installs a shared hook that blocks destructive git operations and enforces workf
37
38
 
38
39
  ## Customization
39
40
 
40
- To add or remove patterns or protected branches, edit `pre-tool-use.sh`.
41
+ The rule table lives in `scripts/lib/git-argv.py` (shell hooks) and is mirrored in `extensions/omp-hooks.ts`. Add a rule to both and a row to `specs/verifications/fixtures/guard-git-normalize.yaml`.
42
+
43
+ The TS side is judged through `evaluateBashCall()` — the single pure function the `tool_call` handler calls — so the fixture covers **every** rule (destructive argv, protected-branch push, Conventional Commits), not just the argv table. The gate (`bash scripts/test-guard-git-normalize.sh`) runs both implementations with `GIT_BIGPOWERS_LAND` unset and fails if they disagree, so a verdict can never depend on the developer's shell.
44
+
45
+ Protected-branch rules answer differently on `main` than on a feature branch, so a row that touches commit/push semantics states its `branch:` and both sides are run in it (the shell hook in a throwaway repo checked out on that branch). A row without `branch:` is judged on a feature branch. Do not pin the branch inside either implementation — that is what made the gate pass on PRs and fail on `main`.
41
46
 
42
47
  ## Advanced
43
48
 
@@ -56,13 +56,12 @@ git log main...HEAD --format="%B" | grep -qiE 'co[- ]authored[- ]by' && echo "
56
56
  ### 2a. Security gate
57
57
 
58
58
  - [ ] `specs/security/REVIEW.md` exists and is fresh (matches current branch diff)
59
- - [ ] No unresolved HIGH findings with confidence ≥ 8 (or all documented in `specs/security/EXCEPTIONS.md` with sign-off rationale)
60
59
 
61
- If REVIEW.md is missing or stale → run `security-review` inline. Findings block the merge unless documented in EXCEPTIONS.md.
60
+ ### 2b. Audit-code & Traceability gates (HARD GATES — Issue #182)
62
61
 
63
- ### 2b. Traceability gate
64
-
65
- 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.
62
+ - [ ] Run `bash scripts/lib/assert-epic-gate.sh release` (asserts `specs/AUDIT_LATEST.md` passed; blocks release on failure).
63
+ - [ ] No unresolved HIGH security findings with confidence ≥ 8 (or documented in `specs/security/EXCEPTIONS.md`).
64
+ - [ ] Run `gate-trace`. FAIL blocks merge; CONCERNS requires explicit override in `specs/state.yaml`. WAIVED if no matrix available.
66
65
 
67
66
  > **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.
68
67
 
@@ -62,7 +62,12 @@ if written:
62
62
  - `plan-release` — sequence epics by WSJF
63
63
  - `slice-tasks` — cut vertical slices
64
64
 
65
- 4. **Update status** — On successful completion, set `status: done` for that workflow key in `planning-status.yaml`.
65
+ 4. **Mechanical artifact assertion before status update (HARD GATE — Issue #183):**
66
+ Before marking any workflow key `status: done`, run:
67
+ ```bash
68
+ bash scripts/lib/assert-planning-artifacts.sh <workflow-key>
69
+ ```
70
+ If the artifact assertion fails, do NOT advance status. Remediate missing output files before continuing. On success, set `status: done` for that workflow key in `planning-status.yaml`.
66
71
 
67
72
  5. **Advance** — Set `state.yaml` `active_flow: planning` while in this chain. When all required keys are done, set `handoff.next_skill` to `plan-work`.
68
73
 
@@ -62,7 +62,8 @@ Review answers "is the code good?"; Verify answers "does the built thing do what
62
62
  5a. **Blind-spot check** — run `bash scripts/check-blind-spots.sh`. This detects structural quality gaps (verify-gap, test-gap, stale-tag, etc.) beyond percentage coverage. If any HIGH-severity findings exist → **block the verify-work PASS gate**. Findings are written to `specs/blind-spots.json`. MEDIUM/LOW findings warn but don't block.
63
63
  5a2. **Completeness critic (e45s05)** — `bash scripts/lib/completeness-critic.sh`. **BLOCKER** aborts merge gate; WARNING → gaps loop; FILLED = evidence only.
64
64
 
65
- 5b. **NFR Evidence Gate** (P0 only) — Produces go/no-go output on three dimensions: Performance (response time, throughput), Reliability (error rate, recovery), and Operability (logging, health checks). Reads thresholds from `specs/tech-architecture/eNN-TEST_PLAN_LATEST.md` and writes evidence as OKF verification-report bundles to `specs/verifications/NFR-eNNsYY.json`. FAIL on any dimension blocks the gate.
65
+ 5b. **NFR Evidence Gate** (P0 only) — Go/no-go on Performance, Reliability, Operability against `specs/tech-architecture/eNN-TEST_PLAN_LATEST.md`. Evidence written to `specs/verifications/NFR-eNNsYY.json`. FAIL blocks gate.
66
+ 5c. **Adversarial Defect Mutation Gate (HARD GATE — e86 / ab-20)** — `bash scripts/verify-adversarial.sh`. Boundary fuzzing & parameter injection against modified interfaces. Crashes or failures block PASS gate; evidence in `specs/verifications/ADVERSARIAL_LATEST.yaml`.
66
67
  6. **Step-by-step UAT** (skip if P2/P3) — one user-observable action at a time.
67
68
  7. **Gaps loop** — failures → log → `plan-work` → re-verify. Unaddressed HIGH findings from step 5 feed into this loop alongside other quality gaps.
68
69
 
@@ -66,7 +66,7 @@ Orchestrates the **build** flow for a single epic: survey → plan tasks → kic
66
66
  After step 5 (verify-work) completes successfully, step 6 runs `audit-code` automatically in `--gate` mode:
67
67
 
68
68
  1. **Run audit:** Invoke `audit-code --gate` on the complete diff for this story.
69
- 2. **Pass (exit 0):** All checklist sections pass → advance to step 7 (commit-message). Record `epic_cycle.audit_result: pass` in `state.yaml`.
69
+ 2. **Pass (exit 0):** All checklist sections pass → run `bash scripts/lib/assert-epic-gate.sh advance` to mechanically confirm the audit pass, then advance to step 7 (commit-message). Record `epic_cycle.audit_result: pass` in `state.yaml`.
70
70
  3. **Fail (exit 1):** One or more checklist sections fail → **reset `epic_cycle.current_step` to `4`** (develop-tdd) and add the failing section IDs to `completed_steps` as `"1,2,3,4,5,6(fail: ...)"`. Record `epic_cycle.audit_result: fail` in `state.yaml`. Do NOT advance past step 6 until audit passes.
71
71
  4. **Audit artifact:** Full audit report saved to `specs/verifications/AUDIT-<epic>-<story>.md` regardless of pass/fail, for reviewer traceability.
72
72
  5. **Enforce F.I.R.S.T:** After audit-code passes, run `enforce-first --quick` on new/modified tests. Append F.I.R.S.T violations (if any) to the audit report. Failing F.I.R.S.T criteria trigger the same loop-back to step 4.
@@ -36,6 +36,7 @@ description: "Reviews working-tree changes, then drafts a Conventional Commits t
36
36
 
37
37
  ## Checklist before finalizing
38
38
 
39
+ - [ ] **Audit pass confirmed (HARD GATE — Issue #182):** In active epic flow, `bash scripts/lib/assert-epic-gate.sh commit` passes.
39
40
  - [ ] Type matches the **dominant** user-visible outcome (`feat` vs `fix` vs `perf`, etc.).
40
41
  - [ ] **Scope** is a short noun in parentheses if it helps (e.g. `fix(api): …`).
41
42
  - [ ] Breaking changes are explicit (`!` and/or `BREAKING CHANGE:` in the body/footer).
@@ -12,7 +12,8 @@ Installs a shared hook that blocks destructive git operations and enforces workf
12
12
 
13
13
  ## What gets blocked/enforced
14
14
 
15
- - **Safety**: `git push --force`, `git reset --hard`, `git clean -f`, `git branch -D`, `git checkout .`, `git restore .`.
15
+ - **Safety**: force push (`-f`, `--force`, `+refspec`), `reset` with `--hard`, `clean` with any `-f*`, `branch -D` / `--delete --force`, `checkout`/`restore` that discard work (`-f`, `.` pathspec).
16
+ - **Argv, not substrings**: the hook tokenizes each command, strips git's global options (`-C <path>`, `-c k=v`, `--no-pager`, `--git-dir=…`) and judges the `(subcommand, arguments)` pair — so `git -C repo reset -q --hard` is blocked, while `git push --force-with-lease` is allowed. Rules live in `scripts/lib/git-argv.py`, mirrored in `extensions/omp-hooks.ts`; `scripts/test-guard-git-normalize.sh` fails if the two disagree.
16
17
  - **Discipline**: Blocks direct commits or pushes to protected branches (`main`, `master`) unless `GIT_BIGPOWERS_LAND=1` (set only by `scripts/land-branch.sh`).
17
18
  - **Allows**: `git push origin <feature-branch>` for backup/CI; solo land push to `main` only inside `land-branch.sh`.
18
19
  - **Standardization**: Enforces [Conventional Commits](https://www.conventionalcommits.org/) for all `git commit` commands.
@@ -37,7 +38,11 @@ Installs a shared hook that blocks destructive git operations and enforces workf
37
38
 
38
39
  ## Customization
39
40
 
40
- To add or remove patterns or protected branches, edit `pre-tool-use.sh`.
41
+ The rule table lives in `scripts/lib/git-argv.py` (shell hooks) and is mirrored in `extensions/omp-hooks.ts`. Add a rule to both and a row to `specs/verifications/fixtures/guard-git-normalize.yaml`.
42
+
43
+ The TS side is judged through `evaluateBashCall()` — the single pure function the `tool_call` handler calls — so the fixture covers **every** rule (destructive argv, protected-branch push, Conventional Commits), not just the argv table. The gate (`bash scripts/test-guard-git-normalize.sh`) runs both implementations with `GIT_BIGPOWERS_LAND` unset and fails if they disagree, so a verdict can never depend on the developer's shell.
44
+
45
+ Protected-branch rules answer differently on `main` than on a feature branch, so a row that touches commit/push semantics states its `branch:` and both sides are run in it (the shell hook in a throwaway repo checked out on that branch). A row without `branch:` is judged on a feature branch. Do not pin the branch inside either implementation — that is what made the gate pass on PRs and fail on `main`.
41
46
 
42
47
  ## Advanced
43
48
 
@@ -56,13 +56,12 @@ git log main...HEAD --format="%B" | grep -qiE 'co[- ]authored[- ]by' && echo "
56
56
  ### 2a. Security gate
57
57
 
58
58
  - [ ] `specs/security/REVIEW.md` exists and is fresh (matches current branch diff)
59
- - [ ] No unresolved HIGH findings with confidence ≥ 8 (or all documented in `specs/security/EXCEPTIONS.md` with sign-off rationale)
60
59
 
61
- If REVIEW.md is missing or stale → run `security-review` inline. Findings block the merge unless documented in EXCEPTIONS.md.
60
+ ### 2b. Audit-code & Traceability gates (HARD GATES — Issue #182)
62
61
 
63
- ### 2b. Traceability gate
64
-
65
- 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.
62
+ - [ ] Run `bash scripts/lib/assert-epic-gate.sh release` (asserts `specs/AUDIT_LATEST.md` passed; blocks release on failure).
63
+ - [ ] No unresolved HIGH security findings with confidence ≥ 8 (or documented in `specs/security/EXCEPTIONS.md`).
64
+ - [ ] Run `gate-trace`. FAIL blocks merge; CONCERNS requires explicit override in `specs/state.yaml`. WAIVED if no matrix available.
66
65
 
67
66
  > **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.
68
67
 
@@ -62,7 +62,12 @@ if written:
62
62
  - `plan-release` — sequence epics by WSJF
63
63
  - `slice-tasks` — cut vertical slices
64
64
 
65
- 4. **Update status** — On successful completion, set `status: done` for that workflow key in `planning-status.yaml`.
65
+ 4. **Mechanical artifact assertion before status update (HARD GATE — Issue #183):**
66
+ Before marking any workflow key `status: done`, run:
67
+ ```bash
68
+ bash scripts/lib/assert-planning-artifacts.sh <workflow-key>
69
+ ```
70
+ If the artifact assertion fails, do NOT advance status. Remediate missing output files before continuing. On success, set `status: done` for that workflow key in `planning-status.yaml`.
66
71
 
67
72
  5. **Advance** — Set `state.yaml` `active_flow: planning` while in this chain. When all required keys are done, set `handoff.next_skill` to `plan-work`.
68
73
 
@@ -62,7 +62,8 @@ Review answers "is the code good?"; Verify answers "does the built thing do what
62
62
  5a. **Blind-spot check** — run `bash scripts/check-blind-spots.sh`. This detects structural quality gaps (verify-gap, test-gap, stale-tag, etc.) beyond percentage coverage. If any HIGH-severity findings exist → **block the verify-work PASS gate**. Findings are written to `specs/blind-spots.json`. MEDIUM/LOW findings warn but don't block.
63
63
  5a2. **Completeness critic (e45s05)** — `bash scripts/lib/completeness-critic.sh`. **BLOCKER** aborts merge gate; WARNING → gaps loop; FILLED = evidence only.
64
64
 
65
- 5b. **NFR Evidence Gate** (P0 only) — Produces go/no-go output on three dimensions: Performance (response time, throughput), Reliability (error rate, recovery), and Operability (logging, health checks). Reads thresholds from `specs/tech-architecture/eNN-TEST_PLAN_LATEST.md` and writes evidence as OKF verification-report bundles to `specs/verifications/NFR-eNNsYY.json`. FAIL on any dimension blocks the gate.
65
+ 5b. **NFR Evidence Gate** (P0 only) — Go/no-go on Performance, Reliability, Operability against `specs/tech-architecture/eNN-TEST_PLAN_LATEST.md`. Evidence written to `specs/verifications/NFR-eNNsYY.json`. FAIL blocks gate.
66
+ 5c. **Adversarial Defect Mutation Gate (HARD GATE — e86 / ab-20)** — `bash scripts/verify-adversarial.sh`. Boundary fuzzing & parameter injection against modified interfaces. Crashes or failures block PASS gate; evidence in `specs/verifications/ADVERSARIAL_LATEST.yaml`.
66
67
  6. **Step-by-step UAT** (skip if P2/P3) — one user-observable action at a time.
67
68
  7. **Gaps loop** — failures → log → `plan-work` → re-verify. Unaddressed HIGH findings from step 5 feed into this loop alongside other quality gaps.
68
69
 
@@ -66,7 +66,7 @@ Orchestrates the **build** flow for a single epic: survey → plan tasks → kic
66
66
  After step 5 (verify-work) completes successfully, step 6 runs `audit-code` automatically in `--gate` mode:
67
67
 
68
68
  1. **Run audit:** Invoke `audit-code --gate` on the complete diff for this story.
69
- 2. **Pass (exit 0):** All checklist sections pass → advance to step 7 (commit-message). Record `epic_cycle.audit_result: pass` in `state.yaml`.
69
+ 2. **Pass (exit 0):** All checklist sections pass → run `bash scripts/lib/assert-epic-gate.sh advance` to mechanically confirm the audit pass, then advance to step 7 (commit-message). Record `epic_cycle.audit_result: pass` in `state.yaml`.
70
70
  3. **Fail (exit 1):** One or more checklist sections fail → **reset `epic_cycle.current_step` to `4`** (develop-tdd) and add the failing section IDs to `completed_steps` as `"1,2,3,4,5,6(fail: ...)"`. Record `epic_cycle.audit_result: fail` in `state.yaml`. Do NOT advance past step 6 until audit passes.
71
71
  4. **Audit artifact:** Full audit report saved to `specs/verifications/AUDIT-<epic>-<story>.md` regardless of pass/fail, for reviewer traceability.
72
72
  5. **Enforce F.I.R.S.T:** After audit-code passes, run `enforce-first --quick` on new/modified tests. Append F.I.R.S.T violations (if any) to the audit report. Failing F.I.R.S.T criteria trigger the same loop-back to step 4.
@@ -36,6 +36,7 @@ description: "Reviews working-tree changes, then drafts a Conventional Commits t
36
36
 
37
37
  ## Checklist before finalizing
38
38
 
39
+ - [ ] **Audit pass confirmed (HARD GATE — Issue #182):** In active epic flow, `bash scripts/lib/assert-epic-gate.sh commit` passes.
39
40
  - [ ] Type matches the **dominant** user-visible outcome (`feat` vs `fix` vs `perf`, etc.).
40
41
  - [ ] **Scope** is a short noun in parentheses if it helps (e.g. `fix(api): …`).
41
42
  - [ ] Breaking changes are explicit (`!` and/or `BREAKING CHANGE:` in the body/footer).
@@ -12,7 +12,8 @@ Installs a shared hook that blocks destructive git operations and enforces workf
12
12
 
13
13
  ## What gets blocked/enforced
14
14
 
15
- - **Safety**: `git push --force`, `git reset --hard`, `git clean -f`, `git branch -D`, `git checkout .`, `git restore .`.
15
+ - **Safety**: force push (`-f`, `--force`, `+refspec`), `reset` with `--hard`, `clean` with any `-f*`, `branch -D` / `--delete --force`, `checkout`/`restore` that discard work (`-f`, `.` pathspec).
16
+ - **Argv, not substrings**: the hook tokenizes each command, strips git's global options (`-C <path>`, `-c k=v`, `--no-pager`, `--git-dir=…`) and judges the `(subcommand, arguments)` pair — so `git -C repo reset -q --hard` is blocked, while `git push --force-with-lease` is allowed. Rules live in `scripts/lib/git-argv.py`, mirrored in `extensions/omp-hooks.ts`; `scripts/test-guard-git-normalize.sh` fails if the two disagree.
16
17
  - **Discipline**: Blocks direct commits or pushes to protected branches (`main`, `master`) unless `GIT_BIGPOWERS_LAND=1` (set only by `scripts/land-branch.sh`).
17
18
  - **Allows**: `git push origin <feature-branch>` for backup/CI; solo land push to `main` only inside `land-branch.sh`.
18
19
  - **Standardization**: Enforces [Conventional Commits](https://www.conventionalcommits.org/) for all `git commit` commands.
@@ -37,7 +38,11 @@ Installs a shared hook that blocks destructive git operations and enforces workf
37
38
 
38
39
  ## Customization
39
40
 
40
- To add or remove patterns or protected branches, edit `pre-tool-use.sh`.
41
+ The rule table lives in `scripts/lib/git-argv.py` (shell hooks) and is mirrored in `extensions/omp-hooks.ts`. Add a rule to both and a row to `specs/verifications/fixtures/guard-git-normalize.yaml`.
42
+
43
+ The TS side is judged through `evaluateBashCall()` — the single pure function the `tool_call` handler calls — so the fixture covers **every** rule (destructive argv, protected-branch push, Conventional Commits), not just the argv table. The gate (`bash scripts/test-guard-git-normalize.sh`) runs both implementations with `GIT_BIGPOWERS_LAND` unset and fails if they disagree, so a verdict can never depend on the developer's shell.
44
+
45
+ Protected-branch rules answer differently on `main` than on a feature branch, so a row that touches commit/push semantics states its `branch:` and both sides are run in it (the shell hook in a throwaway repo checked out on that branch). A row without `branch:` is judged on a feature branch. Do not pin the branch inside either implementation — that is what made the gate pass on PRs and fail on `main`.
41
46
 
42
47
  ## Advanced
43
48
 
@@ -56,13 +56,12 @@ git log main...HEAD --format="%B" | grep -qiE 'co[- ]authored[- ]by' && echo "
56
56
  ### 2a. Security gate
57
57
 
58
58
  - [ ] `specs/security/REVIEW.md` exists and is fresh (matches current branch diff)
59
- - [ ] No unresolved HIGH findings with confidence ≥ 8 (or all documented in `specs/security/EXCEPTIONS.md` with sign-off rationale)
60
59
 
61
- If REVIEW.md is missing or stale → run `security-review` inline. Findings block the merge unless documented in EXCEPTIONS.md.
60
+ ### 2b. Audit-code & Traceability gates (HARD GATES — Issue #182)
62
61
 
63
- ### 2b. Traceability gate
64
-
65
- 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.
62
+ - [ ] Run `bash scripts/lib/assert-epic-gate.sh release` (asserts `specs/AUDIT_LATEST.md` passed; blocks release on failure).
63
+ - [ ] No unresolved HIGH security findings with confidence ≥ 8 (or documented in `specs/security/EXCEPTIONS.md`).
64
+ - [ ] Run `gate-trace`. FAIL blocks merge; CONCERNS requires explicit override in `specs/state.yaml`. WAIVED if no matrix available.
66
65
 
67
66
  > **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.
68
67
 
@@ -62,7 +62,12 @@ if written:
62
62
  - `plan-release` — sequence epics by WSJF
63
63
  - `slice-tasks` — cut vertical slices
64
64
 
65
- 4. **Update status** — On successful completion, set `status: done` for that workflow key in `planning-status.yaml`.
65
+ 4. **Mechanical artifact assertion before status update (HARD GATE — Issue #183):**
66
+ Before marking any workflow key `status: done`, run:
67
+ ```bash
68
+ bash scripts/lib/assert-planning-artifacts.sh <workflow-key>
69
+ ```
70
+ If the artifact assertion fails, do NOT advance status. Remediate missing output files before continuing. On success, set `status: done` for that workflow key in `planning-status.yaml`.
66
71
 
67
72
  5. **Advance** — Set `state.yaml` `active_flow: planning` while in this chain. When all required keys are done, set `handoff.next_skill` to `plan-work`.
68
73
 
@@ -62,7 +62,8 @@ Review answers "is the code good?"; Verify answers "does the built thing do what
62
62
  5a. **Blind-spot check** — run `bash scripts/check-blind-spots.sh`. This detects structural quality gaps (verify-gap, test-gap, stale-tag, etc.) beyond percentage coverage. If any HIGH-severity findings exist → **block the verify-work PASS gate**. Findings are written to `specs/blind-spots.json`. MEDIUM/LOW findings warn but don't block.
63
63
  5a2. **Completeness critic (e45s05)** — `bash scripts/lib/completeness-critic.sh`. **BLOCKER** aborts merge gate; WARNING → gaps loop; FILLED = evidence only.
64
64
 
65
- 5b. **NFR Evidence Gate** (P0 only) — Produces go/no-go output on three dimensions: Performance (response time, throughput), Reliability (error rate, recovery), and Operability (logging, health checks). Reads thresholds from `specs/tech-architecture/eNN-TEST_PLAN_LATEST.md` and writes evidence as OKF verification-report bundles to `specs/verifications/NFR-eNNsYY.json`. FAIL on any dimension blocks the gate.
65
+ 5b. **NFR Evidence Gate** (P0 only) — Go/no-go on Performance, Reliability, Operability against `specs/tech-architecture/eNN-TEST_PLAN_LATEST.md`. Evidence written to `specs/verifications/NFR-eNNsYY.json`. FAIL blocks gate.
66
+ 5c. **Adversarial Defect Mutation Gate (HARD GATE — e86 / ab-20)** — `bash scripts/verify-adversarial.sh`. Boundary fuzzing & parameter injection against modified interfaces. Crashes or failures block PASS gate; evidence in `specs/verifications/ADVERSARIAL_LATEST.yaml`.
66
67
  6. **Step-by-step UAT** (skip if P2/P3) — one user-observable action at a time.
67
68
  7. **Gaps loop** — failures → log → `plan-work` → re-verify. Unaddressed HIGH findings from step 5 feed into this loop alongside other quality gaps.
68
69
 
@@ -65,7 +65,7 @@ Orchestrates the **build** flow for a single epic: survey → plan tasks → kic
65
65
  After step 5 (verify-work) completes successfully, step 6 runs `audit-code` automatically in `--gate` mode:
66
66
 
67
67
  1. **Run audit:** Invoke `audit-code --gate` on the complete diff for this story.
68
- 2. **Pass (exit 0):** All checklist sections pass → advance to step 7 (commit-message). Record `epic_cycle.audit_result: pass` in `state.yaml`.
68
+ 2. **Pass (exit 0):** All checklist sections pass → run `bash scripts/lib/assert-epic-gate.sh advance` to mechanically confirm the audit pass, then advance to step 7 (commit-message). Record `epic_cycle.audit_result: pass` in `state.yaml`.
69
69
  3. **Fail (exit 1):** One or more checklist sections fail → **reset `epic_cycle.current_step` to `4`** (develop-tdd) and add the failing section IDs to `completed_steps` as `"1,2,3,4,5,6(fail: ...)"`. Record `epic_cycle.audit_result: fail` in `state.yaml`. Do NOT advance past step 6 until audit passes.
70
70
  4. **Audit artifact:** Full audit report saved to `specs/verifications/AUDIT-<epic>-<story>.md` regardless of pass/fail, for reviewer traceability.
71
71
  5. **Enforce F.I.R.S.T:** After audit-code passes, run `enforce-first --quick` on new/modified tests. Append F.I.R.S.T violations (if any) to the audit report. Failing F.I.R.S.T criteria trigger the same loop-back to step 4.
@@ -35,6 +35,7 @@ alwaysApply: false
35
35
 
36
36
  ## Checklist before finalizing
37
37
 
38
+ - [ ] **Audit pass confirmed (HARD GATE — Issue #182):** In active epic flow, `bash scripts/lib/assert-epic-gate.sh commit` passes.
38
39
  - [ ] Type matches the **dominant** user-visible outcome (`feat` vs `fix` vs `perf`, etc.).
39
40
  - [ ] **Scope** is a short noun in parentheses if it helps (e.g. `fix(api): …`).
40
41
  - [ ] Breaking changes are explicit (`!` and/or `BREAKING CHANGE:` in the body/footer).
@@ -11,7 +11,8 @@ Installs a shared hook that blocks destructive git operations and enforces workf
11
11
 
12
12
  ## What gets blocked/enforced
13
13
 
14
- - **Safety**: `git push --force`, `git reset --hard`, `git clean -f`, `git branch -D`, `git checkout .`, `git restore .`.
14
+ - **Safety**: force push (`-f`, `--force`, `+refspec`), `reset` with `--hard`, `clean` with any `-f*`, `branch -D` / `--delete --force`, `checkout`/`restore` that discard work (`-f`, `.` pathspec).
15
+ - **Argv, not substrings**: the hook tokenizes each command, strips git's global options (`-C <path>`, `-c k=v`, `--no-pager`, `--git-dir=…`) and judges the `(subcommand, arguments)` pair — so `git -C repo reset -q --hard` is blocked, while `git push --force-with-lease` is allowed. Rules live in `scripts/lib/git-argv.py`, mirrored in `extensions/omp-hooks.ts`; `scripts/test-guard-git-normalize.sh` fails if the two disagree.
15
16
  - **Discipline**: Blocks direct commits or pushes to protected branches (`main`, `master`) unless `GIT_BIGPOWERS_LAND=1` (set only by `scripts/land-branch.sh`).
16
17
  - **Allows**: `git push origin <feature-branch>` for backup/CI; solo land push to `main` only inside `land-branch.sh`.
17
18
  - **Standardization**: Enforces [Conventional Commits](https://www.conventionalcommits.org/) for all `git commit` commands.
@@ -36,7 +37,11 @@ Installs a shared hook that blocks destructive git operations and enforces workf
36
37
 
37
38
  ## Customization
38
39
 
39
- To add or remove patterns or protected branches, edit `pre-tool-use.sh`.
40
+ The rule table lives in `scripts/lib/git-argv.py` (shell hooks) and is mirrored in `extensions/omp-hooks.ts`. Add a rule to both and a row to `specs/verifications/fixtures/guard-git-normalize.yaml`.
41
+
42
+ The TS side is judged through `evaluateBashCall()` — the single pure function the `tool_call` handler calls — so the fixture covers **every** rule (destructive argv, protected-branch push, Conventional Commits), not just the argv table. The gate (`bash scripts/test-guard-git-normalize.sh`) runs both implementations with `GIT_BIGPOWERS_LAND` unset and fails if they disagree, so a verdict can never depend on the developer's shell.
43
+
44
+ Protected-branch rules answer differently on `main` than on a feature branch, so a row that touches commit/push semantics states its `branch:` and both sides are run in it (the shell hook in a throwaway repo checked out on that branch). A row without `branch:` is judged on a feature branch. Do not pin the branch inside either implementation — that is what made the gate pass on PRs and fail on `main`.
40
45
 
41
46
  ## Advanced
42
47
 
@@ -55,13 +55,12 @@ git log main...HEAD --format="%B" | grep -qiE 'co[- ]authored[- ]by' && echo "
55
55
  ### 2a. Security gate
56
56
 
57
57
  - [ ] `specs/security/REVIEW.md` exists and is fresh (matches current branch diff)
58
- - [ ] No unresolved HIGH findings with confidence ≥ 8 (or all documented in `specs/security/EXCEPTIONS.md` with sign-off rationale)
59
58
 
60
- If REVIEW.md is missing or stale → run `security-review` inline. Findings block the merge unless documented in EXCEPTIONS.md.
59
+ ### 2b. Audit-code & Traceability gates (HARD GATES — Issue #182)
61
60
 
62
- ### 2b. Traceability gate
63
-
64
- 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.
61
+ - [ ] Run `bash scripts/lib/assert-epic-gate.sh release` (asserts `specs/AUDIT_LATEST.md` passed; blocks release on failure).
62
+ - [ ] No unresolved HIGH security findings with confidence ≥ 8 (or documented in `specs/security/EXCEPTIONS.md`).
63
+ - [ ] Run `gate-trace`. FAIL blocks merge; CONCERNS requires explicit override in `specs/state.yaml`. WAIVED if no matrix available.
65
64
 
66
65
  > **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.
67
66
 
@@ -61,7 +61,12 @@ if written:
61
61
  - `plan-release` — sequence epics by WSJF
62
62
  - `slice-tasks` — cut vertical slices
63
63
 
64
- 4. **Update status** — On successful completion, set `status: done` for that workflow key in `planning-status.yaml`.
64
+ 4. **Mechanical artifact assertion before status update (HARD GATE — Issue #183):**
65
+ Before marking any workflow key `status: done`, run:
66
+ ```bash
67
+ bash scripts/lib/assert-planning-artifacts.sh <workflow-key>
68
+ ```
69
+ If the artifact assertion fails, do NOT advance status. Remediate missing output files before continuing. On success, set `status: done` for that workflow key in `planning-status.yaml`.
65
70
 
66
71
  5. **Advance** — Set `state.yaml` `active_flow: planning` while in this chain. When all required keys are done, set `handoff.next_skill` to `plan-work`.
67
72
 
@@ -61,7 +61,8 @@ Review answers "is the code good?"; Verify answers "does the built thing do what
61
61
  5a. **Blind-spot check** — run `bash scripts/check-blind-spots.sh`. This detects structural quality gaps (verify-gap, test-gap, stale-tag, etc.) beyond percentage coverage. If any HIGH-severity findings exist → **block the verify-work PASS gate**. Findings are written to `specs/blind-spots.json`. MEDIUM/LOW findings warn but don't block.
62
62
  5a2. **Completeness critic (e45s05)** — `bash scripts/lib/completeness-critic.sh`. **BLOCKER** aborts merge gate; WARNING → gaps loop; FILLED = evidence only.
63
63
 
64
- 5b. **NFR Evidence Gate** (P0 only) — Produces go/no-go output on three dimensions: Performance (response time, throughput), Reliability (error rate, recovery), and Operability (logging, health checks). Reads thresholds from `specs/tech-architecture/eNN-TEST_PLAN_LATEST.md` and writes evidence as OKF verification-report bundles to `specs/verifications/NFR-eNNsYY.json`. FAIL on any dimension blocks the gate.
64
+ 5b. **NFR Evidence Gate** (P0 only) — Go/no-go on Performance, Reliability, Operability against `specs/tech-architecture/eNN-TEST_PLAN_LATEST.md`. Evidence written to `specs/verifications/NFR-eNNsYY.json`. FAIL blocks gate.
65
+ 5c. **Adversarial Defect Mutation Gate (HARD GATE — e86 / ab-20)** — `bash scripts/verify-adversarial.sh`. Boundary fuzzing & parameter injection against modified interfaces. Crashes or failures block PASS gate; evidence in `specs/verifications/ADVERSARIAL_LATEST.yaml`.
65
66
  6. **Step-by-step UAT** (skip if P2/P3) — one user-observable action at a time.
66
67
  7. **Gaps loop** — failures → log → `plan-work` → re-verify. Unaddressed HIGH findings from step 5 feed into this loop alongside other quality gaps.
67
68
 
@@ -65,7 +65,7 @@ Orchestrates the **build** flow for a single epic: survey → plan tasks → kic
65
65
  After step 5 (verify-work) completes successfully, step 6 runs `audit-code` automatically in `--gate` mode:
66
66
 
67
67
  1. **Run audit:** Invoke `audit-code --gate` on the complete diff for this story.
68
- 2. **Pass (exit 0):** All checklist sections pass → advance to step 7 (commit-message). Record `epic_cycle.audit_result: pass` in `state.yaml`.
68
+ 2. **Pass (exit 0):** All checklist sections pass → run `bash scripts/lib/assert-epic-gate.sh advance` to mechanically confirm the audit pass, then advance to step 7 (commit-message). Record `epic_cycle.audit_result: pass` in `state.yaml`.
69
69
  3. **Fail (exit 1):** One or more checklist sections fail → **reset `epic_cycle.current_step` to `4`** (develop-tdd) and add the failing section IDs to `completed_steps` as `"1,2,3,4,5,6(fail: ...)"`. Record `epic_cycle.audit_result: fail` in `state.yaml`. Do NOT advance past step 6 until audit passes.
70
70
  4. **Audit artifact:** Full audit report saved to `specs/verifications/AUDIT-<epic>-<story>.md` regardless of pass/fail, for reviewer traceability.
71
71
  5. **Enforce F.I.R.S.T:** After audit-code passes, run `enforce-first --quick` on new/modified tests. Append F.I.R.S.T violations (if any) to the audit report. Failing F.I.R.S.T criteria trigger the same loop-back to step 4.