@wazir-dev/cli 1.3.0 → 1.4.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 (133) hide show
  1. package/CHANGELOG.md +17 -2
  2. package/docs/research/2026-03-20-agents/a18fb002157904af5.txt +187 -0
  3. package/docs/research/2026-03-20-agents/a1d0ac79ac2f11e6f.txt +2 -0
  4. package/docs/research/2026-03-20-agents/a324079de037abd7c.txt +198 -0
  5. package/docs/research/2026-03-20-agents/a357586bccfafb0e5.txt +256 -0
  6. package/docs/research/2026-03-20-agents/a4365394e4d753105.txt +137 -0
  7. package/docs/research/2026-03-20-agents/a492af28bc52d3613.txt +136 -0
  8. package/docs/research/2026-03-20-agents/a4984db0b6a8eee07.txt +124 -0
  9. package/docs/research/2026-03-20-agents/a5b30e59d34bbb062.txt +214 -0
  10. package/docs/research/2026-03-20-agents/a5cf7829dab911586.txt +165 -0
  11. package/docs/research/2026-03-20-agents/a607157c30dd97c9e.txt +96 -0
  12. package/docs/research/2026-03-20-agents/a60b68b1e19d1e16b.txt +115 -0
  13. package/docs/research/2026-03-20-agents/a722af01c5594aba0.txt +166 -0
  14. package/docs/research/2026-03-20-agents/a787bdc516faa5829.txt +181 -0
  15. package/docs/research/2026-03-20-agents/a7c46d1bba1056ed2.txt +132 -0
  16. package/docs/research/2026-03-20-agents/a7e5abbab2b281a0d.txt +100 -0
  17. package/docs/research/2026-03-20-agents/a8dbadc66cd0d7d5a.txt +95 -0
  18. package/docs/research/2026-03-20-agents/a904d9f45d6b86a6d.txt +75 -0
  19. package/docs/research/2026-03-20-agents/a927659a942ee7f60.txt +102 -0
  20. package/docs/research/2026-03-20-agents/a962cb569191f7583.txt +125 -0
  21. package/docs/research/2026-03-20-agents/aab6decea538aac41.txt +148 -0
  22. package/docs/research/2026-03-20-agents/abd58b853dd938a1b.txt +295 -0
  23. package/docs/research/2026-03-20-agents/ac009da573eff7f65.txt +100 -0
  24. package/docs/research/2026-03-20-agents/ac1bc783364405e5f.txt +190 -0
  25. package/docs/research/2026-03-20-agents/aca5e2b57fde152a0.txt +132 -0
  26. package/docs/research/2026-03-20-agents/ad849b8c0a7e95b8b.txt +176 -0
  27. package/docs/research/2026-03-20-agents/adc2b12a4da32c962.txt +258 -0
  28. package/docs/research/2026-03-20-agents/af97caaaa9a80e4cb.txt +146 -0
  29. package/docs/research/2026-03-20-agents/afc5faceee368b3ca.txt +111 -0
  30. package/docs/research/2026-03-20-agents/afdb282d866e3c1e4.txt +164 -0
  31. package/docs/research/2026-03-20-agents/afe9d1f61c02b1e8d.txt +299 -0
  32. package/docs/research/2026-03-20-agents/b4hmkwril.txt +1856 -0
  33. package/docs/research/2026-03-20-agents/b80ptk89g.txt +1856 -0
  34. package/docs/research/2026-03-20-agents/bf54s1jss.txt +1150 -0
  35. package/docs/research/2026-03-20-agents/bhd6kq2kx.txt +1856 -0
  36. package/docs/research/2026-03-20-agents/bmb2fodyr.txt +988 -0
  37. package/docs/research/2026-03-20-agents/bmmsrij8i.txt +826 -0
  38. package/docs/research/2026-03-20-agents/bn4t2ywpu.txt +2175 -0
  39. package/docs/research/2026-03-20-agents/bu22t9f1z.txt +0 -0
  40. package/docs/research/2026-03-20-agents/bwvl98v2p.txt +738 -0
  41. package/docs/research/2026-03-20-agents/psych-a3697a7fd06eb64fd.txt +135 -0
  42. package/docs/research/2026-03-20-agents/psych-a37776fabc870feae.txt +123 -0
  43. package/docs/research/2026-03-20-agents/psych-a5b1fe05c0589efaf.txt +2 -0
  44. package/docs/research/2026-03-20-agents/psych-a95c15b1f29424435.txt +76 -0
  45. package/docs/research/2026-03-20-agents/psych-a9c26f4d9172dde7c.txt +2 -0
  46. package/docs/research/2026-03-20-agents/psych-aa19c69f0ca2c5ad3.txt +2 -0
  47. package/docs/research/2026-03-20-agents/psych-aa4e4cb70e1be5ecb.txt +95 -0
  48. package/docs/research/2026-03-20-agents/psych-ab5b302f26a554663.txt +102 -0
  49. package/docs/research/2026-03-20-deep-research-complete.md +101 -0
  50. package/docs/research/2026-03-20-deep-research-status.md +38 -0
  51. package/docs/research/2026-03-20-enforcement-research.md +107 -0
  52. package/expertise/composition-map.yaml +27 -8
  53. package/expertise/digests/reviewer/ai-coding-digest.md +83 -0
  54. package/expertise/digests/reviewer/architectural-thinking-digest.md +63 -0
  55. package/expertise/digests/reviewer/architecture-antipatterns-digest.md +49 -0
  56. package/expertise/digests/reviewer/code-smells-digest.md +53 -0
  57. package/expertise/digests/reviewer/coupling-cohesion-digest.md +54 -0
  58. package/expertise/digests/reviewer/ddd-digest.md +60 -0
  59. package/expertise/digests/reviewer/dependency-risk-digest.md +40 -0
  60. package/expertise/digests/reviewer/error-handling-digest.md +55 -0
  61. package/expertise/digests/reviewer/review-methodology-digest.md +49 -0
  62. package/exports/hosts/claude/.claude/commands/learn.md +61 -8
  63. package/exports/hosts/claude/.claude/settings.json +7 -6
  64. package/exports/hosts/claude/export.manifest.json +6 -3
  65. package/exports/hosts/claude/host-package.json +3 -0
  66. package/exports/hosts/codex/export.manifest.json +6 -3
  67. package/exports/hosts/codex/host-package.json +3 -0
  68. package/exports/hosts/cursor/.cursor/hooks.json +6 -6
  69. package/exports/hosts/cursor/export.manifest.json +6 -3
  70. package/exports/hosts/cursor/host-package.json +3 -0
  71. package/exports/hosts/gemini/export.manifest.json +6 -3
  72. package/exports/hosts/gemini/host-package.json +3 -0
  73. package/hooks/definitions/pretooluse_dispatcher.yaml +26 -0
  74. package/hooks/definitions/pretooluse_pipeline_guard.yaml +22 -0
  75. package/hooks/definitions/stop_pipeline_gate.yaml +22 -0
  76. package/hooks/hooks.json +7 -6
  77. package/hooks/pretooluse-dispatcher +84 -0
  78. package/hooks/pretooluse-pipeline-guard +9 -0
  79. package/hooks/stop-pipeline-gate +9 -0
  80. package/package.json +2 -2
  81. package/schemas/decision.schema.json +15 -0
  82. package/schemas/hook.schema.json +4 -1
  83. package/skills/TEMPLATE-3-ZONE.md +160 -0
  84. package/skills/brainstorming/SKILL.md +127 -23
  85. package/skills/clarifier/SKILL.md +175 -18
  86. package/skills/claude-cli/SKILL.md +91 -12
  87. package/skills/codex-cli/SKILL.md +91 -12
  88. package/skills/debugging/SKILL.md +133 -38
  89. package/skills/design/SKILL.md +173 -37
  90. package/skills/dispatching-parallel-agents/SKILL.md +129 -31
  91. package/skills/executing-plans/SKILL.md +113 -25
  92. package/skills/executor/SKILL.md +185 -21
  93. package/skills/finishing-a-development-branch/SKILL.md +107 -18
  94. package/skills/gemini-cli/SKILL.md +91 -12
  95. package/skills/humanize/SKILL.md +92 -13
  96. package/skills/init-pipeline/SKILL.md +90 -17
  97. package/skills/prepare-next/SKILL.md +93 -24
  98. package/skills/receiving-code-review/SKILL.md +90 -16
  99. package/skills/requesting-code-review/SKILL.md +100 -24
  100. package/skills/requesting-code-review/code-reviewer.md +29 -17
  101. package/skills/reviewer/SKILL.md +190 -50
  102. package/skills/run-audit/SKILL.md +92 -15
  103. package/skills/scan-project/SKILL.md +93 -14
  104. package/skills/self-audit/SKILL.md +113 -39
  105. package/skills/skill-research/SKILL.md +94 -7
  106. package/skills/subagent-driven-development/SKILL.md +129 -30
  107. package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +30 -2
  108. package/skills/subagent-driven-development/implementer-prompt.md +40 -27
  109. package/skills/subagent-driven-development/spec-reviewer-prompt.md +25 -12
  110. package/skills/tdd/SKILL.md +125 -20
  111. package/skills/using-git-worktrees/SKILL.md +118 -28
  112. package/skills/using-skills/SKILL.md +116 -29
  113. package/skills/verification/SKILL.md +127 -22
  114. package/skills/wazir/SKILL.md +517 -153
  115. package/skills/writing-plans/SKILL.md +134 -28
  116. package/skills/writing-skills/SKILL.md +91 -13
  117. package/skills/writing-skills/anthropic-best-practices.md +104 -64
  118. package/skills/writing-skills/persuasion-principles.md +100 -34
  119. package/tooling/src/capture/command.js +29 -1
  120. package/tooling/src/capture/decision.js +40 -0
  121. package/tooling/src/capture/store.js +1 -0
  122. package/tooling/src/config/depth-table.js +60 -0
  123. package/tooling/src/export/compiler.js +7 -8
  124. package/tooling/src/guards/guardrail-functions.js +131 -0
  125. package/tooling/src/guards/phase-prerequisite-guard.js +39 -3
  126. package/tooling/src/hooks/pretooluse-dispatcher.js +300 -0
  127. package/tooling/src/hooks/pretooluse-pipeline-guard.js +141 -0
  128. package/tooling/src/hooks/stop-pipeline-gate.js +92 -0
  129. package/tooling/src/learn/pipeline.js +177 -0
  130. package/tooling/src/state/db.js +251 -2
  131. package/tooling/src/state/pipeline-state.js +262 -0
  132. package/wazir.manifest.yaml +3 -0
  133. package/workflows/learn.md +61 -8
@@ -0,0 +1,60 @@
1
+ # Domain-Driven Design — Reviewer Digest
2
+
3
+ > Evaluation-focused extract for reviewer context. For full guidance, see `architecture/foundations/domain-driven-design.md`.
4
+
5
+ ## Bounded Context Check
6
+
7
+ - Is the module boundary aligned with a domain concept (not a technical layer)?
8
+ - Do different modules use the same term to mean different things? If yes, a context boundary is needed.
9
+ - Are there translation/mapping layers between modules? If not and they share types, potential coupling risk.
10
+ - Is the system applying DDD where it's warranted? (Complex domain logic, multiple teams, long-lived system) Or is it over-engineering CRUD?
11
+
12
+ ## Entity & Value Object Check
13
+
14
+ - Do domain objects have identity (ID field) that persists across state changes? If yes, they are Entities.
15
+ - Are domain objects defined purely by their attributes (money, address, date range)? If yes, they are Value Objects.
16
+ - Are entities being compared by value when they should be compared by ID?
17
+ - Are value objects being given IDs when they should be immutable and interchangeable?
18
+ - Are value objects actually immutable? (No setters, no mutation methods)
19
+
20
+ ## Aggregate Check
21
+
22
+ - Is there a clear aggregate root that controls access to child entities?
23
+ - Are child entities being accessed directly (bypassing the root)? This breaks aggregate invariants.
24
+ - Does the aggregate enforce its invariants (validation, state transitions)?
25
+ - Are aggregates too large? (>5 entities suggests decomposition needed)
26
+ - Are aggregates being loaded in full when only a subset is needed? (Performance smell)
27
+ - Do transactions span multiple aggregates? (Design smell — aggregates should be consistency boundaries)
28
+
29
+ ## Domain Event Check
30
+
31
+ - Are significant state changes published as domain events?
32
+ - Do event names use past tense and domain language? (`OrderPlaced`, not `HandleOrder`)
33
+ - Are events immutable once published?
34
+ - Is there a clear distinction between domain events (within bounded context) and integration events (across contexts)?
35
+
36
+ ## Naming Review
37
+
38
+ | Signal | Issue | Severity |
39
+ |--------|-------|----------|
40
+ | Generic names: `Service`, `Manager`, `Handler`, `Processor` | Missing domain language | medium |
41
+ | Technical names in domain layer: `UserDTO`, `OrderRepository` | Infrastructure leaking into domain | medium |
42
+ | Inconsistent naming: `Customer` in one module, `Client` in another for same concept | Missing ubiquitous language | high |
43
+ | Verb-only names: `validate`, `process`, `handle` without domain qualifier | Ambiguous responsibility | medium |
44
+ | Pluralization confusion: `Order` entity vs `Orders` service vs `OrderList` collection | No naming convention | low |
45
+
46
+ ## Repository Pattern Check
47
+
48
+ - Do repositories return domain objects (not database rows/DTOs)?
49
+ - Is the repository interface in the domain layer, implementation in infrastructure?
50
+ - Are queries filtering by domain concepts (not SQL/table structure)?
51
+ - Is there one repository per aggregate root? (Not per entity or per table)
52
+
53
+ ## Strategic DDD Red Flags
54
+
55
+ | Signal | Issue | Severity |
56
+ |--------|-------|----------|
57
+ | Universal data model shared across all modules | Missing bounded contexts | high |
58
+ | One "User" type used everywhere with 30+ fields | Context-specific models needed | high |
59
+ | Tactical patterns (Aggregates, Value Objects) without strategic boundaries | Cargo-culting DDD | medium |
60
+ | No ubiquitous language — developers and domain experts use different terms | Core DDD principle violated | high |
@@ -0,0 +1,40 @@
1
+ # Dependency Risk — Reviewer Digest
2
+
3
+ > Detection-focused extract for reviewer context. For full analysis, see `antipatterns/code/dependency-antipatterns.md`.
4
+
5
+ ## Dependency Antipatterns
6
+
7
+ | Antipattern | Detection Signal | Severity |
8
+ |-------------|-----------------|----------|
9
+ | **Trivial Dependency (Left-Pad)** | Package imported for one utility function achievable in <10 lines | medium |
10
+ | **Phantom Dependency** | Import resolves at dev time but not in production (missing from package.json `dependencies`) | critical |
11
+ | **Version Range Roulette** | `"*"` or `"latest"` or overly broad ranges (`^0.x`) in package.json | high |
12
+ | **Dependency Confusion** | Internal package name collides with public registry name; no scoped namespace | critical |
13
+ | **Typosquatting Risk** | Package name is one character off from a popular package | high |
14
+ | **Circular Dependency** | A imports B imports C imports A | high |
15
+ | **Diamond Dependency** | Two deps require incompatible versions of a shared transitive dep | high |
16
+ | **Stale Lock File** | package-lock.json / yarn.lock not updated after package.json change | medium |
17
+ | **Dev Dependency in Production** | devDependency imported in src/ code | high |
18
+ | **Unused Dependency** | Package in package.json but no import found in src/ | low |
19
+ | **Deprecated API Usage** | Calling APIs marked @deprecated in the dependency | medium |
20
+ | **Tightly Coupled to Dependency** | Dependency's types/interfaces leak through public API | medium |
21
+ | **Unmaintained Dependency** | No commits in 12+ months, unresolved security advisories | medium |
22
+ | **License Incompatibility** | Dependency license conflicts with project license (e.g., GPL in MIT project) | high |
23
+ | **Transitive Bloat** | Adding one dependency pulls in 100+ transitive deps | medium |
24
+
25
+ ## Import Health Checks
26
+
27
+ - Every `import` or `require` resolves to an installed package or local file
28
+ - No circular import chains (check with `madge --circular`)
29
+ - Lock file is consistent with package.json
30
+ - No `node_modules` path imports (e.g., `require('pkg/node_modules/sub')`)
31
+ - No relative imports escaping package boundaries (e.g., `../../other-package/src/`)
32
+
33
+ ## New Dependency Evaluation
34
+
35
+ When a PR adds a new dependency, check:
36
+ 1. **Necessity:** Can the functionality be achieved in <20 lines without the dep?
37
+ 2. **Health:** Last publish date, open issues ratio, known CVEs
38
+ 3. **Size:** What is the install footprint? (check `bundlephobia` or `packagephobia`)
39
+ 4. **License:** Compatible with project license?
40
+ 5. **Alternatives:** Is there a lighter or more maintained alternative?
@@ -0,0 +1,55 @@
1
+ # Error Handling — Reviewer Digest
2
+
3
+ > Detection-focused extract for reviewer context. For full analysis, see `antipatterns/code/error-handling-antipatterns.md`.
4
+
5
+ ## Error Handling Antipatterns
6
+
7
+ | Antipattern | Detection Signal | Severity |
8
+ |-------------|-----------------|----------|
9
+ | **Pokemon Exception (AP-01)** | `catch(Exception e)` / `catch(e) {}` catching everything without discrimination | critical |
10
+ | **Swallowed Exception (AP-02)** | Empty catch block, or catch that only logs without re-throwing or recovering | high |
11
+ | **Exception as Flow Control (AP-03)** | Using try/catch for expected conditions (not found, validation failure, empty input) | medium |
12
+ | **Incomplete Error Handling (AP-04)** | Handling some error cases but not others from the same operation | high |
13
+ | **Missing Async Error Handling (AP-05)** | `await` without try/catch or `.catch()`; unhandled promise rejections | high |
14
+ | **Re-throw Without Context (AP-06)** | `catch(e) { throw e }` losing stack/context information; no wrapping | medium |
15
+ | **Error String Matching (AP-07)** | `if (error.message.includes('not found'))` instead of typed error classes | medium |
16
+ | **Silent Failure (AP-08)** | Function returns null/undefined on error with no indication to caller | high |
17
+ | **Inconsistent Error Types (AP-09)** | Same module throws Error, string, object, and number | medium |
18
+ | **Missing Error Boundary (AP-10)** | UI component tree can crash entirely from one child component error | high |
19
+ | **Retry Without Backoff (AP-11)** | Retrying failed operations in a tight loop without exponential backoff | high |
20
+ | **Logging Without Acting (AP-12)** | `catch(e) { logger.error(e) }` — logged but no recovery, no re-throw, no alert | high |
21
+ | **Overly Broad Recovery (AP-13)** | Catch block returns a default value for ALL errors, masking different failure modes | high |
22
+ | **Missing Cleanup (AP-14)** | Resources (file handles, DB connections, locks) not released in error paths | high |
23
+ | **User-Facing Stack Traces (AP-15)** | Error responses include internal stack traces, file paths, or SQL queries | high (security) |
24
+ | **Missing Correlation ID (AP-16)** | Errors logged without request/trace ID, making debugging across services impossible | medium |
25
+
26
+ ## Async Error Patterns
27
+
28
+ - Every `await` should be in a try/catch or the promise should have `.catch()`
29
+ - `Promise.all` should handle partial failures (use `Promise.allSettled` if appropriate)
30
+ - Event handlers and callbacks should have error handling
31
+ - Stream/iterator error events should be subscribed to
32
+ - Async generators should handle `throw()` method calls
33
+
34
+ ## Error Propagation Check
35
+
36
+ - Do errors propagate upward with context added at each layer?
37
+ - Is there a top-level error handler (global catch, error middleware, process.on('unhandledRejection'))?
38
+ - Are user-facing error messages sanitized (no stack traces, no internal details)?
39
+ - Are errors logged with correlation IDs for tracing?
40
+ - Do error responses use consistent format (error code + message + optional details)?
41
+
42
+ ## Transaction & State Consistency
43
+
44
+ - Are multi-step mutations wrapped in transactions?
45
+ - If a step fails mid-operation, is partial state rolled back or compensated?
46
+ - Are idempotency keys used for operations that might be retried?
47
+ - Do constructors/initializers validate invariants, or can objects be created in invalid state?
48
+
49
+ ## Resource Cleanup Checklist
50
+
51
+ - File handles: opened in try, closed in finally
52
+ - Database connections: returned to pool in finally
53
+ - Locks/mutexes: released in finally
54
+ - Temporary files: deleted in finally
55
+ - Event listeners: removed in cleanup/dispose
@@ -0,0 +1,49 @@
1
+ # Code Review Methodology — Reviewer Digest
2
+
3
+ > Detection-focused extract for reviewer context. For full analysis, see `antipatterns/process/code-review-antipatterns.md`.
4
+
5
+ ## Reviewer Antipatterns to Avoid
6
+
7
+ | Antipattern | Signal You're Doing It | Correction |
8
+ |-------------|----------------------|------------|
9
+ | **Rubber Stamping (AP-01)** | All passes clean with no findings | Every diff has something worth noting. Look harder. |
10
+ | **Nitpick Focus (AP-02)** | >50% of findings are style/formatting | Rebalance: logic > structure > style |
11
+ | **Too-Late Review (AP-03)** | Raising architectural objections after full implementation | Review early artifacts (spec, design, plan) when available |
12
+ | **Scope Creep (AP-04)** | Suggesting features/refactors outside the diff | Review what changed. File issues for what should change next. |
13
+ | **Severity Inflation (AP-05)** | Everything is "blocking" | Reserve blocking for: security, data loss, crash, wrong behavior. |
14
+ | **Severity Deflation (AP-06)** | Nothing is "blocking" despite clear bugs | If it would break in production, it's blocking. Period. |
15
+ | **Confirmation Bias (AP-07)** | Checking "did they follow the plan" not "does it work" | Test against the spec, not the approach. |
16
+ | **Anchoring (AP-08)** | Prior review pass findings anchoring this pass | Each pass is independent. Re-read the diff fresh. |
17
+ | **Inconsistent Standards (AP-09)** | Different quality bar for different authors or modules | Apply the same severity criteria uniformly across the codebase. |
18
+ | **Review by Checklist Only (AP-10)** | Mechanically checking boxes without reading logic | Checklists supplement deep reading, they don't replace it. |
19
+
20
+ ## Severity Calibration
21
+
22
+ | Severity | Criteria | Examples |
23
+ |----------|----------|---------|
24
+ | **blocking** | Would cause incorrect behavior, data loss, security vulnerability, or crash in production | Missing auth check, SQL injection, unhandled null, wrong business logic |
25
+ | **warning** | Degrades quality but does not break correctness | Missing error message, poor naming, missing test for edge case |
26
+ | **note** | Improvement opportunity, style preference, or observation | Alternative approach suggestion, documentation gap, minor duplication |
27
+
28
+ ## Dimension Coverage Discipline
29
+
30
+ - Score EVERY assigned dimension, even if it passes cleanly
31
+ - A dimension with no findings gets score 10 with brief justification
32
+ - Never skip a dimension because "it looks fine" — that is rubber stamping
33
+ - Findings must reference specific file:line locations
34
+
35
+ ## Review Pass Independence
36
+
37
+ - Each review pass is a fresh evaluation — do not anchor on previous pass findings
38
+ - Re-read the diff from scratch on each pass
39
+ - If a prior finding was fixed, verify the fix independently (don't assume it's correct)
40
+ - Track pass numbers explicitly: pass 1 of N, pass 2 of N
41
+
42
+ ## Finding Quality Checklist
43
+
44
+ Each finding must have:
45
+ 1. **Location:** file path and line number(s)
46
+ 2. **Severity:** blocking / warning / note
47
+ 3. **Dimension:** which review dimension it belongs to
48
+ 4. **Description:** what the issue is and why it matters
49
+ 5. **Source tag:** `[Internal]`, `[Codex]`, or `[Both]`
@@ -2,37 +2,90 @@
2
2
 
3
3
  ## Purpose
4
4
 
5
- Extract durable scoped learnings and experiments from the completed run.
5
+ Extract durable scoped learnings from the completed run using the 4-stage promotion pipeline.
6
6
 
7
7
  ## Phase entry
8
8
 
9
9
  On entering this phase, run:
10
- `wazir capture event --run <run-id> --event phase_enter --phase <phase-name> --status in_progress`
10
+ `wazir capture event --run <run-id> --event phase_enter --phase learn --status in_progress`
11
11
 
12
12
  ## Inputs
13
13
 
14
14
  - run artifacts
15
- - review findings
15
+ - review findings (all passes, all tiers)
16
16
  - verification proof
17
17
 
18
18
  ## Primary Role
19
19
 
20
20
  - `learner`
21
21
 
22
+ ## Pipeline Stages
23
+
24
+ The learning pipeline follows a 4-stage promotion model (Tally → Candidate → Promote → Active):
25
+
26
+ ### Stage 1: TALLY (Automatic)
27
+
28
+ Every finding from the run is:
29
+ 1. Canonicalized (file paths, line numbers, identifiers stripped)
30
+ 2. Hashed for dedup
31
+ 3. Clustered by semantic similarity in `finding_clusters` table
32
+ 4. Category-tagged (from the reviewer's finding category)
33
+
34
+ Also:
35
+ - Read `.wazir/runs/<id>/decisions.ndjson` for recurring patterns
36
+ - Append summary to `memory/findings/cumulative-findings.md`
37
+
38
+ Implementation: `tooling/src/learn/pipeline.js` → `tallyFinding()`
39
+
40
+ ### Stage 2: CANDIDATE (Automatic)
41
+
42
+ Clusters meeting the promotion threshold are flagged:
43
+ - **Occurrence threshold:** 3+ findings with the same canonical pattern
44
+ - **Run threshold:** Pattern must appear across 2+ distinct runs
45
+ - **Drift cap:** No promotion if active antipatterns count >= 30
46
+
47
+ Implementation: `tooling/src/learn/pipeline.js` → `identifyCandidates()` + `promoteToCandidates()`
48
+
49
+ ### Stage 3: PROMOTE (Human Gate)
50
+
51
+ Candidates are proposed for user review:
52
+ - Written to `memory/learnings/proposed/<run-id>-<NNN>.md`
53
+ - User reviews and accepts/rejects via `/wazir audit learnings`
54
+ - Accepted candidates move to `status: accepted` in `antipattern_candidates` table
55
+
56
+ ### Stage 4: ACTIVE (Automatic)
57
+
58
+ Accepted antipatterns are loaded into reviewer context for future runs:
59
+ - Injected as project-level learnings alongside expertise modules
60
+ - Hit-rate tracked: if an antipattern triggers in <5% of runs over 90 days, it's demoted
61
+ - Max 30 active project-level antipatterns (drift prevention)
62
+
63
+ ## Drift Prevention
64
+
65
+ - **Cap:** 30 active project antipatterns maximum
66
+ - **TTL:** 90-day expiry on unreviewed candidates
67
+ - **Demotion:** Antipatterns with <5% hit rate over 90 days are auto-demoted
68
+ - **Consolidation:** When count exceeds 25, similar antipatterns are merged
69
+
22
70
  ## Outputs
23
71
 
24
- - proposed learning artifacts
25
- - experiment summaries
72
+ - Tallied findings in `finding_clusters` table
73
+ - Promoted candidates in `antipattern_candidates` table
74
+ - Proposed learning artifacts in `memory/learnings/proposed/`
75
+ - Cumulative findings appended to `memory/findings/cumulative-findings.md`
26
76
 
27
77
  ## Approval Gate
28
78
 
29
- - accepted learnings require explicit review and scope tags
79
+ - Accepted learnings require explicit user review and scope tags
80
+ - Learnings are NEVER auto-applied to future runs without user acceptance
30
81
 
31
82
  ## Phase exit
32
83
 
33
84
  On completing this phase, run:
34
- `wazir capture event --run <run-id> --event phase_exit --phase <phase-name> --status completed`
85
+ `wazir capture event --run <run-id> --event phase_exit --phase learn --status completed`
35
86
 
36
87
  ## Failure Conditions
37
88
 
38
- - auto-applied learning drift
89
+ - auto-applied learning drift (bypassing human gate)
90
+ - candidate count exceeds cap without consolidation
91
+ - stale candidates not expired
@@ -1,21 +1,22 @@
1
1
  {
2
2
  "hooks": {
3
- "PreToolUse": [
3
+ "Stop": [
4
4
  {
5
- "matcher": "Write|Edit",
6
5
  "hooks": [
7
6
  {
8
7
  "type": "command",
9
- "command": "./hooks/protected-path-write-guard"
8
+ "command": "./hooks/stop-pipeline-gate"
10
9
  }
11
10
  ]
12
- },
11
+ }
12
+ ],
13
+ "PreToolUse": [
13
14
  {
14
- "matcher": "Bash",
15
+ "matcher": "Write|Edit|Bash",
15
16
  "hooks": [
16
17
  {
17
18
  "type": "command",
18
- "command": "./hooks/context-mode-router"
19
+ "command": "./hooks/pretooluse-dispatcher"
19
20
  }
20
21
  ]
21
22
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "host": "claude",
3
3
  "source_hashes": {
4
- "wazir.manifest.yaml": "f00776eb08ed3332b8f855001a2fd0b866cd0b81d009c6fbb316149c398c51ca",
4
+ "wazir.manifest.yaml": "48a188248faf429807b241eb57fbb99afae3c6ddfdf71b24c5c532ca0bc2d33f",
5
5
  "roles/clarifier.md": "1e1b8a2c05f1070fdcef485963cfcbffff62c4b2703a8d73fe51ac52d056e573",
6
6
  "roles/content-author.md": "cc20b80bd70ab68b3239a9cf56bf1ffc2c06843d38afc6b190844b35a1d73c3e",
7
7
  "roles/designer.md": "76cff5bda82975cfb4074de71681e7c8ba284e2e49d0cc98f90208642fef74fc",
@@ -18,7 +18,7 @@
18
18
  "workflows/design.md": "7f69758b22f88c12d16846ac1dd444f4e178ab116559ef9f2f26f6daa1a10d62",
19
19
  "workflows/discover.md": "0696add486f739a46ed4c2b71b67bdda3ab9fea2d1395e662191282529ed21d2",
20
20
  "workflows/execute.md": "33428704476877b2c8cf34c6eda3a56d1fd71e8bbea0f05c122bb3da2c6475a6",
21
- "workflows/learn.md": "9b1955a00eb0ea47af08a3639c3cbc2f15b8eab6cc02127e829bc8c83b0a52b5",
21
+ "workflows/learn.md": "450bbfbfaa9143365284e13c608f800e94caea47210c57d252d1c9a720160035",
22
22
  "workflows/plan-review.md": "1dfe76dfe4fd9c32409d508e47654ad3b985b5429bd4616adde719b19fd606ac",
23
23
  "workflows/plan.md": "fd52737159ab13688af8cbcb1c3fa224b1a9dda441b9ab337ab98cbfb5c68fa5",
24
24
  "workflows/prepare-next.md": "8769b692be6d9fddf3b3f36fee6888159fb9fb2a5c31360cdbc9402e0f43fc27",
@@ -32,9 +32,12 @@
32
32
  "hooks/definitions/post_tool_capture.yaml": "a773cd6e18972dee8eef3b7cb06fd1d319a71de4588897cebfbe643f6781a3b2",
33
33
  "hooks/definitions/pre_compact_summary.yaml": "daa0175d79f3e0127c5ce86a7a2f8df0be3f58b5c94fe749da715a17c7b2d04e",
34
34
  "hooks/definitions/pre_tool_capture_route.yaml": "3c2663380ff3cd09f09de5b96bcf6123266fa74d8a03dfb2d6fbe40a43fb13cf",
35
+ "hooks/definitions/pretooluse_dispatcher.yaml": "5b0646ab17704e6f4665bb4c08ead5bcfe2aa6e71395fa5694cb0debcbce69da",
36
+ "hooks/definitions/pretooluse_pipeline_guard.yaml": "ac89617b91093ff0a39da0e8c48affbcaa71054666fa316a42c32f73f656ae69",
35
37
  "hooks/definitions/protected_path_write_guard.yaml": "6683d41778b823e2a4e606065597569aa04363f091e135e165de9732f1fc2171",
36
38
  "hooks/definitions/session_start.yaml": "9383fcf1f8304c87e57726478a461706c0fc73dc62bcc4d8661f2eeffa43a82d",
37
39
  "hooks/definitions/stop_handoff_harvest.yaml": "67a3c0a8bb7cb66b88e77dc79e748082e964d278c47935662c453922a846482b",
38
- "hooks/hooks.json": "f255345793951b5cf6f6d8c9a8b6a6ad2d3140023453410127a6f70d8e110c26"
40
+ "hooks/definitions/stop_pipeline_gate.yaml": "f27dde7605809aae56ac566b93b8692f5d40db1e11b569010e32d2878b677fcf",
41
+ "hooks/hooks.json": "65e022a151aa9546a6988581ee62ec853f0df5580aeed4b164e3ccc3dc2e72de"
39
42
  }
40
43
  }
@@ -32,9 +32,12 @@
32
32
  "hooks/definitions/post_tool_capture.yaml",
33
33
  "hooks/definitions/pre_compact_summary.yaml",
34
34
  "hooks/definitions/pre_tool_capture_route.yaml",
35
+ "hooks/definitions/pretooluse_dispatcher.yaml",
36
+ "hooks/definitions/pretooluse_pipeline_guard.yaml",
35
37
  "hooks/definitions/protected_path_write_guard.yaml",
36
38
  "hooks/definitions/session_start.yaml",
37
39
  "hooks/definitions/stop_handoff_harvest.yaml",
40
+ "hooks/definitions/stop_pipeline_gate.yaml",
38
41
  "hooks/hooks.json"
39
42
  ],
40
43
  "files": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "host": "codex",
3
3
  "source_hashes": {
4
- "wazir.manifest.yaml": "f00776eb08ed3332b8f855001a2fd0b866cd0b81d009c6fbb316149c398c51ca",
4
+ "wazir.manifest.yaml": "48a188248faf429807b241eb57fbb99afae3c6ddfdf71b24c5c532ca0bc2d33f",
5
5
  "roles/clarifier.md": "1e1b8a2c05f1070fdcef485963cfcbffff62c4b2703a8d73fe51ac52d056e573",
6
6
  "roles/content-author.md": "cc20b80bd70ab68b3239a9cf56bf1ffc2c06843d38afc6b190844b35a1d73c3e",
7
7
  "roles/designer.md": "76cff5bda82975cfb4074de71681e7c8ba284e2e49d0cc98f90208642fef74fc",
@@ -18,7 +18,7 @@
18
18
  "workflows/design.md": "7f69758b22f88c12d16846ac1dd444f4e178ab116559ef9f2f26f6daa1a10d62",
19
19
  "workflows/discover.md": "0696add486f739a46ed4c2b71b67bdda3ab9fea2d1395e662191282529ed21d2",
20
20
  "workflows/execute.md": "33428704476877b2c8cf34c6eda3a56d1fd71e8bbea0f05c122bb3da2c6475a6",
21
- "workflows/learn.md": "9b1955a00eb0ea47af08a3639c3cbc2f15b8eab6cc02127e829bc8c83b0a52b5",
21
+ "workflows/learn.md": "450bbfbfaa9143365284e13c608f800e94caea47210c57d252d1c9a720160035",
22
22
  "workflows/plan-review.md": "1dfe76dfe4fd9c32409d508e47654ad3b985b5429bd4616adde719b19fd606ac",
23
23
  "workflows/plan.md": "fd52737159ab13688af8cbcb1c3fa224b1a9dda441b9ab337ab98cbfb5c68fa5",
24
24
  "workflows/prepare-next.md": "8769b692be6d9fddf3b3f36fee6888159fb9fb2a5c31360cdbc9402e0f43fc27",
@@ -32,9 +32,12 @@
32
32
  "hooks/definitions/post_tool_capture.yaml": "a773cd6e18972dee8eef3b7cb06fd1d319a71de4588897cebfbe643f6781a3b2",
33
33
  "hooks/definitions/pre_compact_summary.yaml": "daa0175d79f3e0127c5ce86a7a2f8df0be3f58b5c94fe749da715a17c7b2d04e",
34
34
  "hooks/definitions/pre_tool_capture_route.yaml": "3c2663380ff3cd09f09de5b96bcf6123266fa74d8a03dfb2d6fbe40a43fb13cf",
35
+ "hooks/definitions/pretooluse_dispatcher.yaml": "5b0646ab17704e6f4665bb4c08ead5bcfe2aa6e71395fa5694cb0debcbce69da",
36
+ "hooks/definitions/pretooluse_pipeline_guard.yaml": "ac89617b91093ff0a39da0e8c48affbcaa71054666fa316a42c32f73f656ae69",
35
37
  "hooks/definitions/protected_path_write_guard.yaml": "6683d41778b823e2a4e606065597569aa04363f091e135e165de9732f1fc2171",
36
38
  "hooks/definitions/session_start.yaml": "9383fcf1f8304c87e57726478a461706c0fc73dc62bcc4d8661f2eeffa43a82d",
37
39
  "hooks/definitions/stop_handoff_harvest.yaml": "67a3c0a8bb7cb66b88e77dc79e748082e964d278c47935662c453922a846482b",
38
- "hooks/hooks.json": "f255345793951b5cf6f6d8c9a8b6a6ad2d3140023453410127a6f70d8e110c26"
40
+ "hooks/definitions/stop_pipeline_gate.yaml": "f27dde7605809aae56ac566b93b8692f5d40db1e11b569010e32d2878b677fcf",
41
+ "hooks/hooks.json": "65e022a151aa9546a6988581ee62ec853f0df5580aeed4b164e3ccc3dc2e72de"
39
42
  }
40
43
  }
@@ -32,9 +32,12 @@
32
32
  "hooks/definitions/post_tool_capture.yaml",
33
33
  "hooks/definitions/pre_compact_summary.yaml",
34
34
  "hooks/definitions/pre_tool_capture_route.yaml",
35
+ "hooks/definitions/pretooluse_dispatcher.yaml",
36
+ "hooks/definitions/pretooluse_pipeline_guard.yaml",
35
37
  "hooks/definitions/protected_path_write_guard.yaml",
36
38
  "hooks/definitions/session_start.yaml",
37
39
  "hooks/definitions/stop_handoff_harvest.yaml",
40
+ "hooks/definitions/stop_pipeline_gate.yaml",
38
41
  "hooks/hooks.json"
39
42
  ],
40
43
  "files": [
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "hooks": [
3
3
  {
4
- "name": "protected-path-write-guard",
5
- "command": "./hooks/protected-path-write-guard"
4
+ "name": "pretooluse-dispatcher",
5
+ "command": "./hooks/pretooluse-dispatcher"
6
6
  },
7
7
  {
8
8
  "name": "loop-cap-guard",
9
9
  "command": "./hooks/loop-cap-guard"
10
10
  },
11
- {
12
- "name": "context-mode-router",
13
- "command": "./hooks/context-mode-router"
14
- },
15
11
  {
16
12
  "name": "session-start",
17
13
  "command": "./hooks/session-start"
14
+ },
15
+ {
16
+ "name": "stop-pipeline-gate",
17
+ "command": "./hooks/stop-pipeline-gate"
18
18
  }
19
19
  ]
20
20
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "host": "cursor",
3
3
  "source_hashes": {
4
- "wazir.manifest.yaml": "f00776eb08ed3332b8f855001a2fd0b866cd0b81d009c6fbb316149c398c51ca",
4
+ "wazir.manifest.yaml": "48a188248faf429807b241eb57fbb99afae3c6ddfdf71b24c5c532ca0bc2d33f",
5
5
  "roles/clarifier.md": "1e1b8a2c05f1070fdcef485963cfcbffff62c4b2703a8d73fe51ac52d056e573",
6
6
  "roles/content-author.md": "cc20b80bd70ab68b3239a9cf56bf1ffc2c06843d38afc6b190844b35a1d73c3e",
7
7
  "roles/designer.md": "76cff5bda82975cfb4074de71681e7c8ba284e2e49d0cc98f90208642fef74fc",
@@ -18,7 +18,7 @@
18
18
  "workflows/design.md": "7f69758b22f88c12d16846ac1dd444f4e178ab116559ef9f2f26f6daa1a10d62",
19
19
  "workflows/discover.md": "0696add486f739a46ed4c2b71b67bdda3ab9fea2d1395e662191282529ed21d2",
20
20
  "workflows/execute.md": "33428704476877b2c8cf34c6eda3a56d1fd71e8bbea0f05c122bb3da2c6475a6",
21
- "workflows/learn.md": "9b1955a00eb0ea47af08a3639c3cbc2f15b8eab6cc02127e829bc8c83b0a52b5",
21
+ "workflows/learn.md": "450bbfbfaa9143365284e13c608f800e94caea47210c57d252d1c9a720160035",
22
22
  "workflows/plan-review.md": "1dfe76dfe4fd9c32409d508e47654ad3b985b5429bd4616adde719b19fd606ac",
23
23
  "workflows/plan.md": "fd52737159ab13688af8cbcb1c3fa224b1a9dda441b9ab337ab98cbfb5c68fa5",
24
24
  "workflows/prepare-next.md": "8769b692be6d9fddf3b3f36fee6888159fb9fb2a5c31360cdbc9402e0f43fc27",
@@ -32,9 +32,12 @@
32
32
  "hooks/definitions/post_tool_capture.yaml": "a773cd6e18972dee8eef3b7cb06fd1d319a71de4588897cebfbe643f6781a3b2",
33
33
  "hooks/definitions/pre_compact_summary.yaml": "daa0175d79f3e0127c5ce86a7a2f8df0be3f58b5c94fe749da715a17c7b2d04e",
34
34
  "hooks/definitions/pre_tool_capture_route.yaml": "3c2663380ff3cd09f09de5b96bcf6123266fa74d8a03dfb2d6fbe40a43fb13cf",
35
+ "hooks/definitions/pretooluse_dispatcher.yaml": "5b0646ab17704e6f4665bb4c08ead5bcfe2aa6e71395fa5694cb0debcbce69da",
36
+ "hooks/definitions/pretooluse_pipeline_guard.yaml": "ac89617b91093ff0a39da0e8c48affbcaa71054666fa316a42c32f73f656ae69",
35
37
  "hooks/definitions/protected_path_write_guard.yaml": "6683d41778b823e2a4e606065597569aa04363f091e135e165de9732f1fc2171",
36
38
  "hooks/definitions/session_start.yaml": "9383fcf1f8304c87e57726478a461706c0fc73dc62bcc4d8661f2eeffa43a82d",
37
39
  "hooks/definitions/stop_handoff_harvest.yaml": "67a3c0a8bb7cb66b88e77dc79e748082e964d278c47935662c453922a846482b",
38
- "hooks/hooks.json": "f255345793951b5cf6f6d8c9a8b6a6ad2d3140023453410127a6f70d8e110c26"
40
+ "hooks/definitions/stop_pipeline_gate.yaml": "f27dde7605809aae56ac566b93b8692f5d40db1e11b569010e32d2878b677fcf",
41
+ "hooks/hooks.json": "65e022a151aa9546a6988581ee62ec853f0df5580aeed4b164e3ccc3dc2e72de"
39
42
  }
40
43
  }
@@ -32,9 +32,12 @@
32
32
  "hooks/definitions/post_tool_capture.yaml",
33
33
  "hooks/definitions/pre_compact_summary.yaml",
34
34
  "hooks/definitions/pre_tool_capture_route.yaml",
35
+ "hooks/definitions/pretooluse_dispatcher.yaml",
36
+ "hooks/definitions/pretooluse_pipeline_guard.yaml",
35
37
  "hooks/definitions/protected_path_write_guard.yaml",
36
38
  "hooks/definitions/session_start.yaml",
37
39
  "hooks/definitions/stop_handoff_harvest.yaml",
40
+ "hooks/definitions/stop_pipeline_gate.yaml",
38
41
  "hooks/hooks.json"
39
42
  ],
40
43
  "files": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "host": "gemini",
3
3
  "source_hashes": {
4
- "wazir.manifest.yaml": "f00776eb08ed3332b8f855001a2fd0b866cd0b81d009c6fbb316149c398c51ca",
4
+ "wazir.manifest.yaml": "48a188248faf429807b241eb57fbb99afae3c6ddfdf71b24c5c532ca0bc2d33f",
5
5
  "roles/clarifier.md": "1e1b8a2c05f1070fdcef485963cfcbffff62c4b2703a8d73fe51ac52d056e573",
6
6
  "roles/content-author.md": "cc20b80bd70ab68b3239a9cf56bf1ffc2c06843d38afc6b190844b35a1d73c3e",
7
7
  "roles/designer.md": "76cff5bda82975cfb4074de71681e7c8ba284e2e49d0cc98f90208642fef74fc",
@@ -18,7 +18,7 @@
18
18
  "workflows/design.md": "7f69758b22f88c12d16846ac1dd444f4e178ab116559ef9f2f26f6daa1a10d62",
19
19
  "workflows/discover.md": "0696add486f739a46ed4c2b71b67bdda3ab9fea2d1395e662191282529ed21d2",
20
20
  "workflows/execute.md": "33428704476877b2c8cf34c6eda3a56d1fd71e8bbea0f05c122bb3da2c6475a6",
21
- "workflows/learn.md": "9b1955a00eb0ea47af08a3639c3cbc2f15b8eab6cc02127e829bc8c83b0a52b5",
21
+ "workflows/learn.md": "450bbfbfaa9143365284e13c608f800e94caea47210c57d252d1c9a720160035",
22
22
  "workflows/plan-review.md": "1dfe76dfe4fd9c32409d508e47654ad3b985b5429bd4616adde719b19fd606ac",
23
23
  "workflows/plan.md": "fd52737159ab13688af8cbcb1c3fa224b1a9dda441b9ab337ab98cbfb5c68fa5",
24
24
  "workflows/prepare-next.md": "8769b692be6d9fddf3b3f36fee6888159fb9fb2a5c31360cdbc9402e0f43fc27",
@@ -32,9 +32,12 @@
32
32
  "hooks/definitions/post_tool_capture.yaml": "a773cd6e18972dee8eef3b7cb06fd1d319a71de4588897cebfbe643f6781a3b2",
33
33
  "hooks/definitions/pre_compact_summary.yaml": "daa0175d79f3e0127c5ce86a7a2f8df0be3f58b5c94fe749da715a17c7b2d04e",
34
34
  "hooks/definitions/pre_tool_capture_route.yaml": "3c2663380ff3cd09f09de5b96bcf6123266fa74d8a03dfb2d6fbe40a43fb13cf",
35
+ "hooks/definitions/pretooluse_dispatcher.yaml": "5b0646ab17704e6f4665bb4c08ead5bcfe2aa6e71395fa5694cb0debcbce69da",
36
+ "hooks/definitions/pretooluse_pipeline_guard.yaml": "ac89617b91093ff0a39da0e8c48affbcaa71054666fa316a42c32f73f656ae69",
35
37
  "hooks/definitions/protected_path_write_guard.yaml": "6683d41778b823e2a4e606065597569aa04363f091e135e165de9732f1fc2171",
36
38
  "hooks/definitions/session_start.yaml": "9383fcf1f8304c87e57726478a461706c0fc73dc62bcc4d8661f2eeffa43a82d",
37
39
  "hooks/definitions/stop_handoff_harvest.yaml": "67a3c0a8bb7cb66b88e77dc79e748082e964d278c47935662c453922a846482b",
38
- "hooks/hooks.json": "f255345793951b5cf6f6d8c9a8b6a6ad2d3140023453410127a6f70d8e110c26"
40
+ "hooks/definitions/stop_pipeline_gate.yaml": "f27dde7605809aae56ac566b93b8692f5d40db1e11b569010e32d2878b677fcf",
41
+ "hooks/hooks.json": "65e022a151aa9546a6988581ee62ec853f0df5580aeed4b164e3ccc3dc2e72de"
39
42
  }
40
43
  }
@@ -32,9 +32,12 @@
32
32
  "hooks/definitions/post_tool_capture.yaml",
33
33
  "hooks/definitions/pre_compact_summary.yaml",
34
34
  "hooks/definitions/pre_tool_capture_route.yaml",
35
+ "hooks/definitions/pretooluse_dispatcher.yaml",
36
+ "hooks/definitions/pretooluse_pipeline_guard.yaml",
35
37
  "hooks/definitions/protected_path_write_guard.yaml",
36
38
  "hooks/definitions/session_start.yaml",
37
39
  "hooks/definitions/stop_handoff_harvest.yaml",
40
+ "hooks/definitions/stop_pipeline_gate.yaml",
38
41
  "hooks/hooks.json"
39
42
  ],
40
43
  "files": [
@@ -0,0 +1,26 @@
1
+ id: pretooluse_dispatcher
2
+ trigger: pretooluse_dispatcher
3
+ description: Consolidated PreToolUse dispatcher. Evaluates protected paths, phase restrictions, and context-mode routing in a single hook. Replaces protected_path_write_guard, pretooluse_pipeline_guard, and context_mode_router.
4
+ input_contract:
5
+ required:
6
+ - tool
7
+ optional:
8
+ - input
9
+ allowed_side_effects:
10
+ - read_pipeline_state
11
+ - read_manifest
12
+ - read_routing_matrix
13
+ - append_routing_log
14
+ output_contract:
15
+ produces:
16
+ - decision (allow|deny)
17
+ - reason
18
+ - routing_decision
19
+ failure_behavior:
20
+ mode: block
21
+ exit_code: 1
22
+ host_fallback:
23
+ claude: native_hook
24
+ codex: wrapper_command
25
+ gemini: wrapper_command
26
+ cursor: native_or_wrapper
@@ -0,0 +1,22 @@
1
+ id: pretooluse_pipeline_guard
2
+ trigger: pretooluse_pipeline_guard
3
+ description: Enforces phase-specific tool restrictions by reading pipeline-state.json. Blocks Write/Edit in read-only phases and git mutations outside execute phase.
4
+ input_contract:
5
+ required:
6
+ - tool
7
+ optional:
8
+ - input
9
+ allowed_side_effects:
10
+ - read_pipeline_state
11
+ output_contract:
12
+ produces:
13
+ - decision (allow|deny)
14
+ - reason
15
+ failure_behavior:
16
+ mode: block
17
+ exit_code: 1
18
+ host_fallback:
19
+ claude: native_hook
20
+ codex: wrapper_command
21
+ gemini: wrapper_command
22
+ cursor: native_or_wrapper
@@ -0,0 +1,22 @@
1
+ id: stop_pipeline_gate
2
+ trigger: stop_pipeline_gate
3
+ description: Blocks conversation completion when the pipeline has incomplete phases. Reads pipeline-state.json and returns block/allow decision.
4
+ input_contract:
5
+ required: []
6
+ optional:
7
+ - stop_reason
8
+ allowed_side_effects:
9
+ - read_pipeline_state
10
+ - write_stop_hook_active_flag
11
+ output_contract:
12
+ produces:
13
+ - decision (allow|block)
14
+ - reason
15
+ failure_behavior:
16
+ mode: block
17
+ exit_code: 1
18
+ host_fallback:
19
+ claude: native_hook
20
+ codex: wrapper_command
21
+ gemini: wrapper_command
22
+ cursor: native_or_wrapper