@wazir-dev/cli 1.0.0 → 1.2.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 (163) hide show
  1. package/CHANGELOG.md +100 -2
  2. package/README.md +6 -6
  3. package/docs/concepts/architecture.md +1 -1
  4. package/docs/concepts/roles-and-workflows.md +2 -0
  5. package/docs/concepts/why-wazir.md +59 -0
  6. package/docs/decisions/2026-03-19-deferred-items.md +564 -0
  7. package/docs/decisions/2026-03-19-enhancement-decisions.md +300 -0
  8. package/docs/plans/2026-03-15-cli-pipeline-integration-plan.md +1 -1
  9. package/docs/readmes/INDEX.md +21 -5
  10. package/docs/readmes/features/expertise/README.md +2 -2
  11. package/docs/readmes/features/exports/README.md +2 -2
  12. package/docs/readmes/features/schemas/README.md +3 -0
  13. package/docs/readmes/features/skills/README.md +17 -0
  14. package/docs/readmes/features/skills/clarifier.md +5 -0
  15. package/docs/readmes/features/skills/claude-cli.md +5 -0
  16. package/docs/readmes/features/skills/codex-cli.md +5 -0
  17. package/docs/readmes/features/skills/dispatching-parallel-agents.md +5 -0
  18. package/docs/readmes/features/skills/executing-plans.md +5 -0
  19. package/docs/readmes/features/skills/executor.md +5 -0
  20. package/docs/readmes/features/skills/finishing-a-development-branch.md +5 -0
  21. package/docs/readmes/features/skills/gemini-cli.md +5 -0
  22. package/docs/readmes/features/skills/humanize.md +5 -0
  23. package/docs/readmes/features/skills/init-pipeline.md +5 -0
  24. package/docs/readmes/features/skills/receiving-code-review.md +5 -0
  25. package/docs/readmes/features/skills/requesting-code-review.md +5 -0
  26. package/docs/readmes/features/skills/reviewer.md +5 -0
  27. package/docs/readmes/features/skills/subagent-driven-development.md +5 -0
  28. package/docs/readmes/features/skills/using-git-worktrees.md +5 -0
  29. package/docs/readmes/features/skills/wazir.md +5 -0
  30. package/docs/readmes/features/skills/writing-skills.md +5 -0
  31. package/docs/readmes/features/workflows/prepare-next.md +1 -1
  32. package/docs/reference/configuration-reference.md +47 -6
  33. package/docs/reference/launch-checklist.md +4 -4
  34. package/docs/reference/review-loop-pattern.md +538 -0
  35. package/docs/reference/roles-reference.md +1 -0
  36. package/docs/reference/skill-tiers.md +147 -0
  37. package/docs/reference/tooling-cli.md +5 -1
  38. package/docs/truth-claims.yaml +18 -0
  39. package/expertise/antipatterns/process/ai-coding-antipatterns.md +97 -1
  40. package/exports/hosts/claude/.claude/agents/clarifier.md +3 -0
  41. package/exports/hosts/claude/.claude/agents/designer.md +3 -0
  42. package/exports/hosts/claude/.claude/agents/executor.md +2 -0
  43. package/exports/hosts/claude/.claude/agents/planner.md +3 -0
  44. package/exports/hosts/claude/.claude/agents/researcher.md +2 -0
  45. package/exports/hosts/claude/.claude/agents/reviewer.md +5 -1
  46. package/exports/hosts/claude/.claude/agents/specifier.md +3 -0
  47. package/exports/hosts/claude/.claude/commands/clarify.md +4 -0
  48. package/exports/hosts/claude/.claude/commands/design-review.md +4 -0
  49. package/exports/hosts/claude/.claude/commands/design.md +4 -0
  50. package/exports/hosts/claude/.claude/commands/discover.md +4 -0
  51. package/exports/hosts/claude/.claude/commands/execute.md +4 -0
  52. package/exports/hosts/claude/.claude/commands/plan-review.md +4 -0
  53. package/exports/hosts/claude/.claude/commands/plan.md +4 -0
  54. package/exports/hosts/claude/.claude/commands/spec-challenge.md +4 -0
  55. package/exports/hosts/claude/.claude/commands/specify.md +4 -0
  56. package/exports/hosts/claude/.claude/commands/verify.md +4 -0
  57. package/exports/hosts/claude/.claude/settings.json +9 -0
  58. package/exports/hosts/claude/CLAUDE.md +1 -1
  59. package/exports/hosts/claude/export.manifest.json +22 -20
  60. package/exports/hosts/claude/host-package.json +3 -1
  61. package/exports/hosts/codex/AGENTS.md +1 -1
  62. package/exports/hosts/codex/export.manifest.json +22 -20
  63. package/exports/hosts/codex/host-package.json +3 -1
  64. package/exports/hosts/cursor/.cursor/hooks.json +4 -0
  65. package/exports/hosts/cursor/.cursor/rules/wazir-core.mdc +1 -1
  66. package/exports/hosts/cursor/export.manifest.json +22 -20
  67. package/exports/hosts/cursor/host-package.json +3 -1
  68. package/exports/hosts/gemini/GEMINI.md +1 -1
  69. package/exports/hosts/gemini/export.manifest.json +22 -20
  70. package/exports/hosts/gemini/host-package.json +3 -1
  71. package/hooks/context-mode-router +191 -0
  72. package/hooks/definitions/context_mode_router.yaml +19 -0
  73. package/hooks/definitions/loop_cap_guard.yaml +1 -1
  74. package/hooks/hooks.json +43 -0
  75. package/hooks/protected-path-write-guard +8 -0
  76. package/hooks/routing-matrix.json +45 -0
  77. package/hooks/session-start +62 -1
  78. package/llms-full.txt +905 -132
  79. package/package.json +3 -3
  80. package/roles/clarifier.md +3 -0
  81. package/roles/designer.md +3 -0
  82. package/roles/executor.md +2 -0
  83. package/roles/planner.md +3 -0
  84. package/roles/researcher.md +2 -0
  85. package/roles/reviewer.md +5 -1
  86. package/roles/specifier.md +3 -0
  87. package/schemas/hook.schema.json +2 -1
  88. package/schemas/phase-report.schema.json +80 -0
  89. package/schemas/usage.schema.json +25 -1
  90. package/schemas/wazir-manifest.schema.json +19 -0
  91. package/skills/brainstorming/SKILL.md +20 -56
  92. package/skills/clarifier/SKILL.md +243 -0
  93. package/skills/claude-cli/SKILL.md +320 -0
  94. package/skills/codex-cli/SKILL.md +260 -0
  95. package/skills/debugging/SKILL.md +24 -1
  96. package/skills/design/SKILL.md +13 -0
  97. package/skills/dispatching-parallel-agents/SKILL.md +13 -0
  98. package/skills/executing-plans/SKILL.md +28 -2
  99. package/skills/executor/SKILL.md +129 -0
  100. package/skills/finishing-a-development-branch/SKILL.md +13 -0
  101. package/skills/gemini-cli/SKILL.md +260 -0
  102. package/skills/humanize/SKILL.md +13 -0
  103. package/skills/init-pipeline/SKILL.md +76 -78
  104. package/skills/prepare-next/SKILL.md +81 -10
  105. package/skills/receiving-code-review/SKILL.md +21 -0
  106. package/skills/requesting-code-review/SKILL.md +38 -5
  107. package/skills/reviewer/SKILL.md +423 -0
  108. package/skills/run-audit/SKILL.md +13 -0
  109. package/skills/scan-project/SKILL.md +13 -0
  110. package/skills/self-audit/SKILL.md +197 -16
  111. package/skills/subagent-driven-development/SKILL.md +38 -2
  112. package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +2 -0
  113. package/skills/subagent-driven-development/implementer-prompt.md +8 -0
  114. package/skills/subagent-driven-development/spec-reviewer-prompt.md +7 -0
  115. package/skills/tdd/SKILL.md +21 -0
  116. package/skills/using-git-worktrees/SKILL.md +13 -0
  117. package/skills/using-skills/SKILL.md +13 -0
  118. package/skills/verification/SKILL.md +13 -0
  119. package/skills/wazir/SKILL.md +286 -262
  120. package/skills/writing-plans/SKILL.md +44 -4
  121. package/skills/writing-skills/SKILL.md +13 -0
  122. package/templates/artifacts/implementation-plan.md +3 -0
  123. package/templates/artifacts/tasks-template.md +133 -0
  124. package/templates/examples/phase-report.example.json +48 -0
  125. package/templates/examples/wazir-manifest.example.yaml +1 -1
  126. package/tooling/src/adapters/composition-engine.js +256 -0
  127. package/tooling/src/adapters/model-router.js +84 -0
  128. package/tooling/src/capture/command.js +111 -2
  129. package/tooling/src/capture/run-config.js +23 -0
  130. package/tooling/src/capture/store.js +24 -0
  131. package/tooling/src/capture/usage.js +106 -0
  132. package/tooling/src/checks/ac-matrix.js +256 -0
  133. package/tooling/src/checks/brand-truth.js +3 -6
  134. package/tooling/src/checks/command-registry.js +13 -0
  135. package/tooling/src/checks/docs-truth.js +1 -1
  136. package/tooling/src/checks/runtime-surface.js +3 -7
  137. package/tooling/src/checks/skills.js +111 -0
  138. package/tooling/src/cli.js +17 -3
  139. package/tooling/src/commands/stats.js +161 -0
  140. package/tooling/src/commands/validate.js +5 -1
  141. package/tooling/src/export/compiler.js +33 -37
  142. package/tooling/src/gating/agent.js +145 -0
  143. package/tooling/src/guards/phase-prerequisite-guard.js +127 -0
  144. package/tooling/src/hooks/routing-logic.js +69 -0
  145. package/tooling/src/init/auto-detect.js +260 -0
  146. package/tooling/src/init/command.js +161 -0
  147. package/tooling/src/input/scanner.js +46 -0
  148. package/tooling/src/reports/command.js +103 -0
  149. package/tooling/src/reports/phase-report.js +323 -0
  150. package/tooling/src/state/command.js +160 -0
  151. package/tooling/src/state/db.js +287 -0
  152. package/tooling/src/status/command.js +53 -1
  153. package/wazir.manifest.yaml +26 -17
  154. package/workflows/clarify.md +4 -0
  155. package/workflows/design-review.md +4 -0
  156. package/workflows/design.md +4 -0
  157. package/workflows/discover.md +4 -0
  158. package/workflows/execute.md +4 -0
  159. package/workflows/plan-review.md +4 -0
  160. package/workflows/plan.md +4 -0
  161. package/workflows/spec-challenge.md +4 -0
  162. package/workflows/specify.md +4 -0
  163. package/workflows/verify.md +4 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wazir-dev/cli",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "description": "Host-native engineering OS kit for AI coding agents — roles, phases, expertise modules, quality gates for Claude, Codex, Gemini & Cursor",
6
6
  "bin": {
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "scripts": {
31
31
  "test": "npm run test:active",
32
- "test:active": "node --test tooling/test/cli.test.js tooling/test/validate.test.js tooling/test/index.test.js tooling/test/doctor-status.test.js tooling/test/guard-hooks.test.js tooling/test/export.test.js tooling/test/capture.test.js tooling/test/schema-examples.test.js tooling/test/git-flow-docs.test.js tooling/test/role-contracts.test.js tooling/test/ci-workflow.test.js tooling/test/contributing.test.js tooling/test/author-artifact.test.js tooling/test/capture/usage.test.js tooling/test/docs-drift.test.js",
32
+ "test:active": "node --test tooling/test/cli.test.js tooling/test/validate.test.js tooling/test/index.test.js tooling/test/doctor-status.test.js tooling/test/guard-hooks.test.js tooling/test/export.test.js tooling/test/capture.test.js tooling/test/schema-examples.test.js tooling/test/git-flow-docs.test.js tooling/test/role-contracts.test.js tooling/test/ci-workflow.test.js tooling/test/contributing.test.js tooling/test/author-artifact.test.js tooling/test/capture/usage.test.js tooling/test/adapters/composition-engine.test.js tooling/test/docs-drift.test.js tooling/test/init.test.js tooling/test/gating/agent.test.js tooling/test/guards/phase-prerequisite-guard.test.js tooling/test/hooks/context-mode-router.test.js tooling/test/hooks/session-start.test.js tooling/test/input-scanning.test.js tooling/test/init/auto-detect.test.js tooling/test/adapters/model-router.test.js tooling/test/state/db.test.js tooling/test/reports/phase-report.test.js tooling/test/logo-svg.test.js tooling/test/adapters/context-mode.test.js",
33
33
  "test:coverage": "c8 npm run test:active",
34
34
  "prepare": "husky"
35
35
  },
@@ -61,8 +61,8 @@
61
61
  "tdd"
62
62
  ],
63
63
  "dependencies": {
64
+ "@inquirer/prompts": "^8.3.2",
64
65
  "ajv": "^8.18.0",
65
- "gray-matter": "^4.0.3",
66
66
  "yaml": "^2.0.0"
67
67
  },
68
68
  "devDependencies": {
@@ -30,6 +30,7 @@ Default approach: recall L1 (structural summaries)
30
30
  - clarification artifact
31
31
  - unresolved questions list
32
32
  - scope summary with cited sources
33
+ - emits clarification artifact for reviewer loops
33
34
 
34
35
  ## Escalation Rules
35
36
 
@@ -40,3 +41,5 @@ Default approach: recall L1 (structural summaries)
40
41
  - leaves material ambiguity unresolved without escalation
41
42
  - mutates `input/`
42
43
  - invents constraints or facts without evidence
44
+ - self-reviews own output instead of delegating to reviewer
45
+ - performs substantial discovery research inline without delegating to the discover workflow when delegation is required
package/roles/designer.md CHANGED
@@ -35,6 +35,9 @@ Default approach: recall L1 (structural summaries)
35
35
  - exported HTML + CSS scaffold
36
36
  - design tokens JSON (colors, spacing, typography)
37
37
  - screenshot PNGs of key frames
38
+ - emits design artifact for design-review loop
39
+
40
+ Design is not approved for planning until it survives the design-review loop owned by the reviewer role.
38
41
 
39
42
  ## Git-Flow Responsibilities
40
43
 
package/roles/executor.md CHANGED
@@ -31,6 +31,7 @@ Default approach: direct file read (full content)
31
31
  - code and docs changes
32
32
  - execution notes
33
33
  - verification evidence
34
+ - submits per-task output for review before commit
34
35
 
35
36
  ## Git-Flow Responsibilities
36
37
 
@@ -53,3 +54,4 @@ All text outputs (code comments, commit messages, PR descriptions, CHANGELOG ent
53
54
  - unwired paths
54
55
  - fake tests
55
56
  - writes to protected paths outside approved flows
57
+ - commits before review passes
package/roles/planner.md CHANGED
@@ -32,6 +32,9 @@ Default approach: recall L1 (structural summaries)
32
32
  - implementation plan artifact
33
33
  - ordered task list
34
34
  - verification plan per section
35
+ - emits plan artifact for plan-review loop
36
+
37
+ Plan is not approved until it survives the plan-review loop owned by the reviewer role.
35
38
 
36
39
  ## Git-Flow Responsibilities
37
40
 
@@ -31,6 +31,7 @@ Default approach: recall L1 (structural summaries)
31
31
  - research artifact with citations
32
32
  - finding summaries linked to sources
33
33
  - open risks and unknowns
34
+ - submits research artifact for reviewer evaluation before it flows downstream
34
35
 
35
36
  ## Escalation Rules
36
37
 
@@ -41,3 +42,4 @@ Default approach: recall L1 (structural summaries)
41
42
  - unsupported claims
42
43
  - stale or missing citations
43
44
  - substituting confidence for evidence
45
+ - research artifact used downstream without passing review
package/roles/reviewer.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Purpose
4
4
 
5
- Perform adversarial review to find correctness, scope, wiring, verification, and drift failures.
5
+ Perform adversarial review to find correctness, scope, wiring, verification, and drift failures. Owns all review loops: research-review, clarification-review, spec-challenge, design-review, plan-review, task-review, and final review.
6
6
 
7
7
  ## Inputs
8
8
 
@@ -17,6 +17,7 @@ Perform adversarial review to find correctness, scope, wiring, verification, and
17
17
  - source-backed comparison to spec/plan
18
18
  - secondary model review when available
19
19
  - Wazir CLI recall and index commands (see Context retrieval)
20
+ - review loop pattern (see docs/reference/review-loop-pattern.md)
20
21
 
21
22
  ## Context retrieval
22
23
 
@@ -32,6 +33,9 @@ Default approach: recall L1, escalate to direct read for flagged issues
32
33
  - findings with severity
33
34
  - rationale tied to evidence
34
35
  - explicit no-findings verdict when applicable
36
+ - review loop pass logs with source attribution ([Wazir], [Codex], [Both])
37
+
38
+ Review mode is always passed explicitly by the caller (--mode). The reviewer does not auto-detect mode from artifact availability.
35
39
 
36
40
  ## Git-Flow Responsibilities
37
41
 
@@ -31,6 +31,9 @@ Default approach: recall L1 (structural summaries)
31
31
  - spec artifact
32
32
  - measurable acceptance criteria
33
33
  - explicit non-goals and assumptions
34
+ - emits spec artifact for spec-challenge review loop
35
+
36
+ Spec is not approved until it survives the spec-challenge loop owned by the reviewer role.
34
37
 
35
38
  ## Writing Quality
36
39
 
@@ -23,7 +23,8 @@
23
23
  "pre_compact_summary",
24
24
  "stop_handoff_harvest",
25
25
  "protected_path_write_guard",
26
- "loop_cap_guard"
26
+ "loop_cap_guard",
27
+ "context_mode_router"
27
28
  ]
28
29
  },
29
30
  "description": { "type": "string", "minLength": 1 },
@@ -0,0 +1,80 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://wazir.dev/schemas/phase-report.schema.json",
4
+ "title": "Phase Report",
5
+ "type": "object",
6
+ "required": ["phase_name", "run_id", "timestamp", "attempted_actions", "drift_analysis", "quality_metrics", "risk_flags", "decisions"],
7
+ "properties": {
8
+ "phase_name": { "type": "string", "minLength": 1 },
9
+ "run_id": { "type": "string", "minLength": 1 },
10
+ "timestamp": { "type": "string", "format": "date-time" },
11
+ "attempted_actions": {
12
+ "type": "array",
13
+ "items": {
14
+ "type": "object",
15
+ "required": ["description", "outcome", "evidence"],
16
+ "properties": {
17
+ "description": { "type": "string", "minLength": 1 },
18
+ "outcome": { "type": "string", "enum": ["success", "fail", "uncertain"] },
19
+ "evidence": { "type": "string" }
20
+ },
21
+ "additionalProperties": true
22
+ }
23
+ },
24
+ "drift_analysis": {
25
+ "type": "object",
26
+ "required": ["delta"],
27
+ "properties": {
28
+ "delta": { "type": "integer", "minimum": 0 },
29
+ "description": { "type": "string" }
30
+ },
31
+ "additionalProperties": true
32
+ },
33
+ "quality_metrics": {
34
+ "type": "object",
35
+ "properties": {
36
+ "test_pass_count": { "type": "integer", "minimum": 0 },
37
+ "test_fail_count": { "type": "integer", "minimum": 0 },
38
+ "lint_errors": { "type": "integer", "minimum": 0 },
39
+ "type_errors": { "type": "integer", "minimum": 0 }
40
+ },
41
+ "additionalProperties": true
42
+ },
43
+ "risk_flags": {
44
+ "type": "array",
45
+ "items": {
46
+ "type": "object",
47
+ "required": ["severity", "description"],
48
+ "properties": {
49
+ "severity": { "type": "string", "enum": ["low", "medium", "high"] },
50
+ "description": { "type": "string", "minLength": 1 },
51
+ "mitigation": { "type": "string" }
52
+ },
53
+ "additionalProperties": true
54
+ }
55
+ },
56
+ "decisions": {
57
+ "type": "array",
58
+ "items": {
59
+ "type": "object",
60
+ "required": ["description", "rationale"],
61
+ "properties": {
62
+ "description": { "type": "string", "minLength": 1 },
63
+ "rationale": { "type": "string", "minLength": 1 },
64
+ "alternatives_considered": { "type": "array", "items": { "type": "string" } },
65
+ "source": { "type": "string" }
66
+ },
67
+ "additionalProperties": true
68
+ }
69
+ },
70
+ "verdict_recommendation": {
71
+ "type": "object",
72
+ "properties": {
73
+ "verdict": { "type": "string", "enum": ["continue", "loop_back", "escalate"] },
74
+ "reasoning": { "type": "string" }
75
+ },
76
+ "additionalProperties": true
77
+ }
78
+ },
79
+ "additionalProperties": true
80
+ }
@@ -4,7 +4,7 @@
4
4
  "title": "Usage Report",
5
5
  "description": "Per-run token usage tracking and context savings data.",
6
6
  "type": "object",
7
- "required": ["schema_version", "run_id", "created_at", "updated_at", "phases", "roles", "savings", "totals"],
7
+ "required": ["schema_version", "run_id", "created_at", "updated_at", "phases", "roles", "savings", "routing", "totals"],
8
8
  "properties": {
9
9
  "schema_version": { "type": "integer", "const": 1 },
10
10
  "run_id": { "type": "string", "minLength": 1 },
@@ -81,6 +81,30 @@
81
81
  "post_compaction_tokens_est": { "type": "integer", "minimum": 0 }
82
82
  },
83
83
  "additionalProperties": false
84
+ },
85
+ "index_queries": {
86
+ "type": "object",
87
+ "properties": {
88
+ "count": { "type": "integer", "minimum": 0 },
89
+ "total_raw_bytes": { "type": "integer", "minimum": 0 },
90
+ "total_summary_bytes": { "type": "integer", "minimum": 0 },
91
+ "estimated_tokens_saved": { "type": "integer", "minimum": 0 },
92
+ "bytes_avoided": { "type": "integer", "minimum": 0 }
93
+ },
94
+ "additionalProperties": false
95
+ }
96
+ },
97
+ "additionalProperties": false
98
+ },
99
+ "routing": {
100
+ "type": "object",
101
+ "properties": {
102
+ "total_commands": { "type": "integer", "minimum": 0 },
103
+ "context_mode_routed": { "type": "integer", "minimum": 0 },
104
+ "passthrough": { "type": "integer", "minimum": 0 },
105
+ "by_category": {
106
+ "type": "object",
107
+ "additionalProperties": { "type": "integer", "minimum": 0 }
84
108
  }
85
109
  },
86
110
  "additionalProperties": false
@@ -87,6 +87,25 @@
87
87
  "uniqueItems": true,
88
88
  "minItems": 1
89
89
  },
90
+ "phase_prerequisites": {
91
+ "type": "object",
92
+ "additionalProperties": {
93
+ "type": "object",
94
+ "properties": {
95
+ "required_artifacts": {
96
+ "type": "array",
97
+ "items": { "type": "string", "minLength": 1 },
98
+ "uniqueItems": true
99
+ },
100
+ "required_phase_exits": {
101
+ "type": "array",
102
+ "items": { "type": "string", "minLength": 1 },
103
+ "uniqueItems": true
104
+ }
105
+ },
106
+ "additionalProperties": false
107
+ }
108
+ },
90
109
  "roles": {
91
110
  "type": "array",
92
111
  "items": { "type": "string", "minLength": 1 },
@@ -5,6 +5,24 @@ description: Use before implementation work to turn operator briefings into an a
5
5
 
6
6
  # Brainstorming
7
7
 
8
+ ## Model Annotation
9
+ When multi-model mode is enabled:
10
+ - **Opus** for design exploration (brainstorm)
11
+ - **Opus** for design decisions (design)
12
+
13
+ ## Command Routing
14
+ Follow the Canonical Command Matrix in `hooks/routing-matrix.json`.
15
+ - Large commands (test runners, builds, diffs, dependency trees, linting) → context-mode tools
16
+ - Small commands (git status, ls, pwd, wazir CLI) → native Bash
17
+ - If context-mode unavailable, fall back to native Bash with warning
18
+
19
+ ## Codebase Exploration
20
+ 1. Query `wazir index search-symbols <query>` first
21
+ 2. Use `wazir recall file <path> --tier L1` for targeted reads
22
+ 3. Fall back to direct file reads ONLY for files identified by index queries
23
+ 4. Maximum 10 direct file reads without a justifying index query
24
+ 5. If no index exists: `wazir index build && wazir index summarize --tier all`
25
+
8
26
  Read `input/` first, then inspect only the repo surfaces needed to understand the request.
9
27
 
10
28
  Rules:
@@ -12,8 +30,8 @@ Rules:
12
30
  1. Do not write implementation code before the design is reviewed with the operator.
13
31
  2. Ask clarifying questions only when the ambiguity changes scope, architecture, or acceptance criteria.
14
32
  3. Propose 2-3 approaches with trade-offs and a recommendation.
15
- 4. Write the approved design to `docs/plans/YYYY-MM-DD-<topic>-design.md`.
16
- 5. Hand off to `wz:writing-plans` after approval.
33
+ 4. Write the approved design to `.wazir/runs/latest/clarified/design.md` (if inside a pipeline run) or `docs/plans/YYYY-MM-DD-<topic>-design.md` (if standalone).
34
+ 5. After user approves the design concept, the reviewer role runs the design-review loop with `--mode design-review` using canonical design-review dimensions (spec coverage, design-spec consistency, accessibility, visual consistency, exported-code fidelity). See `workflows/design-review.md` and `docs/reference/review-loop-pattern.md`. The designer resolves any findings. If the design-review loop completes all passes clean, hand off to `wz:writing-plans`. Planning does not start until design-review is complete.
17
35
 
18
36
  Required outputs:
19
37
 
@@ -21,57 +39,3 @@ Required outputs:
21
39
  - open questions or resolved assumptions
22
40
  - explicit recommendation and rejected alternatives
23
41
 
24
- ---
25
-
26
- ## Team Mode: Structured Dialogue
27
-
28
- **Condition:** Only activate when `team_mode: parallel` in `.wazir/runs/latest/run-config.yaml`. Otherwise, use the default single-agent brainstorming above.
29
-
30
- When team mode is active, spawn a 3-agent team using Claude Code Agent Teams:
31
-
32
- ### Agents
33
-
34
- | Agent | Role | Cognitive Mode |
35
- |-------|------|----------------|
36
- | **Free Thinker** | Proposes design directions, creative leaps, "what if..." scenarios. Speaks first, opens new threads. | Divergent generation |
37
- | **Grounder** | Challenges proposals, sorts signal from noise, picks winners, redirects dead ends. Responds to Free Thinker. | Convergent editing |
38
- | **Synthesizer** | Observes silently, maintains a running summary, produces the final design document. Never participates in dialogue. | Synthesis only |
39
-
40
- ### Communication Protocol
41
-
42
- - Free Thinker and Grounder exchange via **broadcast** (all agents see every message)
43
- - Synthesizer **NEVER** participates in dialogue — only observes and writes to files
44
- - After each direction is explored (3-5 exchanges), the Grounder decides: pursue, park, or redirect
45
-
46
- ### Dialogue Flow
47
-
48
- 1. **Open a direction** — Free Thinker proposes (broadcast)
49
- 2. **Deepen** — 3-5 exchanges between Free Thinker and Grounder
50
- 3. **Decide** — Grounder calls it: pursue, park, or redirect
51
- 4. **Next direction** — Free Thinker opens a new thread, aware of connections to prior threads
52
-
53
- Early rounds: more divergent. Later rounds: more convergent.
54
-
55
- ### Depth-Bounded Behavior
56
-
57
- | Depth | Directions to explore | Exchanges per direction |
58
- |-------|-----------------------|------------------------|
59
- | Standard | 3-5 | 3 exchanges |
60
- | Deep | 5-8 | 5 exchanges |
61
-
62
- ### Convergence
63
-
64
- The dialogue has converged when:
65
- 1. Enough directions have been explored for the depth level
66
- 2. The pursued directions have genuine range (not variations of the same idea)
67
- 3. The Grounder signals satisfaction
68
- 4. Further dialogue is producing diminishing returns
69
-
70
- ### Output
71
-
72
- The Synthesizer produces the design document following the same format as single-agent brainstorming:
73
- - Design summary
74
- - Open questions or resolved assumptions
75
- - Explicit recommendation and rejected alternatives
76
-
77
- The Synthesizer then writes the design to `docs/plans/YYYY-MM-DD-<topic>-design.md` and hands off to `wz:writing-plans`.
@@ -0,0 +1,243 @@
1
+ ---
2
+ name: wz:clarifier
3
+ description: Run the clarification pipeline — research, clarify scope, brainstorm design, generate task specs and execution plan. Pauses for user approval between phases.
4
+ ---
5
+
6
+ # Clarifier
7
+
8
+ ## Command Routing
9
+ Follow the Canonical Command Matrix in `hooks/routing-matrix.json`.
10
+ - Large commands (test runners, builds, diffs, dependency trees, linting) → context-mode tools
11
+ - Small commands (git status, ls, pwd, wazir CLI) → native Bash
12
+ - If context-mode unavailable, fall back to native Bash with warning
13
+
14
+ ## Codebase Exploration
15
+ 1. Query `wazir index search-symbols <query>` first
16
+ 2. Use `wazir recall file <path> --tier L1` for targeted reads
17
+ 3. Fall back to direct file reads ONLY for files identified by index queries
18
+ 4. Maximum 10 direct file reads without a justifying index query
19
+ 5. If no index exists: `wazir index build && wazir index summarize --tier all`
20
+
21
+ Run the Clarifier phase — everything from reading input to having an approved execution plan.
22
+
23
+ **Pacing rule:** This skill has mandatory user checkpoints between sub-workflows. Do NOT skip checkpoints. Do NOT combine sub-workflows. Complete each fully, present output, and wait for explicit user approval before advancing.
24
+
25
+ Review loops follow the pattern in `docs/reference/review-loop-pattern.md`. All reviewer invocations use explicit `--mode`.
26
+
27
+ **Standalone mode:** If no `.wazir/runs/latest/` exists, artifacts go to `docs/plans/` and review logs go alongside.
28
+
29
+ ## Prerequisites
30
+
31
+ 1. Check `.wazir/state/config.json` exists. If not, run `wazir init` first.
32
+ 2. Check `.wazir/input/briefing.md` exists. If not, ask the user what they want to build and save it there.
33
+ 3. Scan `input/` (project-level) and `.wazir/input/` (state-level) for additional input files. Present what's found.
34
+ 4. Read config for `default_depth` and `multi_tool` settings.
35
+ 5. **Load accepted learnings:** Glob `memory/learnings/accepted/*.md`. For each accepted learning, read scope tags. Inject learnings whose scope matches the current run's intent/stack into context. Limit: top 10 by confidence, most recent first. This is how prior run insights improve future runs.
36
+ 6. Create a run directory if one doesn't exist:
37
+ ```bash
38
+ mkdir -p .wazir/runs/run-YYYYMMDD-HHMMSS/{sources,tasks,artifacts,reviews,clarified}
39
+ ln -sfn run-YYYYMMDD-HHMMSS .wazir/runs/latest
40
+ ```
41
+
42
+ ---
43
+
44
+ ## Context-Mode Usage
45
+
46
+ Read `context_mode` from `.wazir/state/config.json`:
47
+
48
+ - **If `context_mode.enabled: true`:** Use `fetch_and_index` for URL fetching, `search` for follow-up queries on indexed content. Use `execute` or `execute_file` for large outputs instead of Bash.
49
+ - **If `context_mode.enabled: false`:** Fall back to `WebFetch` for URLs and `Bash` for commands.
50
+
51
+ ---
52
+
53
+ ## Sub-Workflow 1: Research (discover workflow)
54
+
55
+ Delegate to the discover workflow (`workflows/discover.md`):
56
+
57
+ 1. **Keyword extraction:** Read the briefing and extract concepts/terms that are vague, reference external standards, or use unfamiliar terminology.
58
+ - **When to research:** concept references an external standard by name, uses a tool/library not seen in the codebase, or is ambiguous enough that two agents could interpret it differently.
59
+ - **When NOT to research:** concept is fully defined in the input, or it's a well-known programming concept.
60
+ 2. **Fetch sources:** For each concept needing research:
61
+ - Use `fetch_and_index` (if context-mode available) or `WebFetch` to fetch the source.
62
+ - Save fetched content to `.wazir/runs/latest/sources/`.
63
+ - Track each fetch in `sources/manifest.json`.
64
+ 3. **Error handling:** 404/unreachable → log failure, continue. Research is best-effort.
65
+ 4. The **researcher role** produces the research artifact.
66
+ 5. The **reviewer role** runs the research-review loop with `--mode research-review`.
67
+ 6. Loop runs for `pass_counts[depth]` passes.
68
+
69
+ Save result to `.wazir/runs/latest/clarified/research-brief.md`.
70
+
71
+ ### Checkpoint: Research Review
72
+
73
+ > **Research complete. Here's what I found:**
74
+ >
75
+ > [Summary of codebase state, relevant architecture, external context]
76
+ >
77
+ > 1. **Looks good, continue** (Recommended)
78
+ > 2. **Missing context** — let me add more information
79
+ > 3. **Wrong direction** — let me clarify the intent
80
+
81
+ **Wait for user response before continuing.**
82
+
83
+ ---
84
+
85
+ ## Sub-Workflow 2: Clarify (clarify workflow)
86
+
87
+ ### Input Preservation (before producing clarification)
88
+
89
+ 1. Glob `.wazir/input/tasks/*.md`. If files exist:
90
+ - Adopt those specs as the starting point — copy content verbatim into the clarification's item descriptions.
91
+ - Enhance with codebase scan + research findings. **Never remove detail — only add.**
92
+ - Every acceptance criterion from input must appear verbatim.
93
+ - Every API endpoint, color hex code, and UI dimension from input must appear in the relevant item section.
94
+ 2. If `.wazir/input/tasks/` is empty or missing, synthesize from `briefing.md` alone.
95
+
96
+ ### Clarification Production
97
+
98
+ Read the briefing, research brief, and codebase context. Produce:
99
+
100
+ - **What** we're building — concrete deliverables
101
+ - **Why** — the motivation and business value
102
+ - **Constraints** — technical, timeline, dependencies
103
+ - **Assumptions** — what we're taking as given
104
+ - **Scope boundaries** — what's IN and what's explicitly OUT
105
+ - **Unresolved questions** — anything ambiguous
106
+
107
+ Save to `.wazir/runs/latest/clarified/clarification.md`.
108
+
109
+ Invoke `wz:reviewer --mode clarification-review`. Resolve findings before presenting to user.
110
+
111
+ ### Checkpoint: Clarification Review
112
+
113
+ > **Here's the clarified scope:**
114
+ >
115
+ > [Full clarification]
116
+ >
117
+ > 1. **Approved — continue to spec hardening** (Recommended)
118
+ > 2. **Needs changes** — [user provides corrections]
119
+ > 3. **Missing important context** — [user adds information]
120
+
121
+ **Wait for user response.** Route feedback: plan corrections → `user-feedback.md`, new requirements → `briefing.md`.
122
+
123
+ ---
124
+
125
+ ## Sub-Workflow 3: Spec Harden (specify + spec-challenge workflows)
126
+
127
+ Delegate to the specify workflow (`workflows/specify.md`):
128
+
129
+ 1. The **specifier role** produces a measurable spec from clarification + research.
130
+ 2. Invoke `wz:reviewer --mode spec-challenge`.
131
+ 3. Loop runs for `pass_counts[depth]` passes.
132
+
133
+ Save result to `.wazir/runs/latest/clarified/spec-hardened.md`.
134
+
135
+ ### Content-Author Detection
136
+
137
+ After spec hardening, scan the spec for content needs. Auto-enable the `author` workflow if the spec mentions any of:
138
+ - Database seeding, seed data, fixtures, sample records
139
+ - Sample content, placeholder text, demo data
140
+ - Test fixtures, mock API responses, test data files
141
+ - Translations, i18n strings, localization
142
+ - Copy (button labels, error messages, onboarding text)
143
+ - Documentation content, user guides, API docs
144
+ - Email templates, notification text
145
+
146
+ If detected, set `workflow_policy.author.enabled = true` in the run config and note:
147
+ > **Content needs detected.** The content-author workflow will run after design approval to produce: [list detected content types].
148
+
149
+ ### Checkpoint: Hardened Spec Review
150
+
151
+ > **Spec hardened. Changes made:**
152
+ >
153
+ > [List of gaps found and how they were tightened]
154
+ >
155
+ > 1. **Approved — continue to brainstorming** (Recommended)
156
+ > 2. **Disagree with a change** — [user specifies]
157
+ > 3. **Found more gaps** — [user adds]
158
+
159
+ **Wait for user response.**
160
+
161
+ ---
162
+
163
+ ## Sub-Workflow 4: Brainstorm (design + design-review workflows)
164
+
165
+ Invoke the `brainstorming` skill (`wz:brainstorming`):
166
+
167
+ 1. Propose 2-3 viable approaches with explicit trade-offs
168
+ 2. For each approach: effort estimate, risk assessment, what it enables/prevents
169
+ 3. Recommend one approach with rationale
170
+
171
+ ### Checkpoint: Design Approval
172
+
173
+ > **Which approach should we implement?**
174
+ >
175
+ > 1. **Approach A** — [one-line summary] (Recommended)
176
+ > 2. **Approach B** — [one-line summary]
177
+ > 3. **Approach C** — [one-line summary]
178
+ > 4. **Modify an approach** — [user specifies changes]
179
+
180
+ **Wait for user response.** This is the most important checkpoint.
181
+
182
+ Save approved design to `.wazir/runs/latest/clarified/design.md`.
183
+
184
+ After approval: design-review loop with `--mode design-review` (5 canonical dimensions: spec coverage, design-spec consistency, accessibility, visual consistency, exported-code fidelity).
185
+
186
+ ---
187
+
188
+ ## Sub-Workflow 5: Plan (plan + plan-review workflows)
189
+
190
+ Delegate to `wz:writing-plans`:
191
+
192
+ 1. Planner produces a SINGLE execution plan at `.wazir/runs/latest/clarified/execution-plan.md` in spec-kit format.
193
+ 2. **Gap analysis exit gate:** Compare original input against plan. Invoke `wz:reviewer --mode plan-review`.
194
+ 3. Loop until clean or cap reached.
195
+
196
+ ### Checkpoint: Plan Review
197
+
198
+ > **Implementation plan: [N] tasks**
199
+ >
200
+ > | # | Task | Complexity | Dependencies | Description |
201
+ > |---|------|-----------|--------------|-------------|
202
+ >
203
+ > 1. **Approved — ready for execution** (Recommended)
204
+ > 2. **Reorder or split tasks**
205
+ > 3. **Missing tasks**
206
+ > 4. **Too granular / too coarse**
207
+
208
+ **Wait for user response.**
209
+
210
+ ---
211
+
212
+ ### Scope Coverage Gate (Hard Gate)
213
+
214
+ Before presenting the plan to the user, verify ALL input items are covered:
215
+
216
+ 1. Count distinct items/deliverables in the input briefing (`.wazir/input/briefing.md` + any `input/*.md` files)
217
+ 2. Count tasks in the execution plan
218
+ 3. **If `tasks_in_plan < items_in_input`:** STOP and present:
219
+
220
+ > **Scope reduction detected.** The input contains [N] items but the plan only covers [M].
221
+ >
222
+ > Missing items: [list]
223
+ >
224
+ > 1. **Add missing items to the plan** (Required)
225
+ > 2. **User explicitly approves reduced scope** — only if user confirms
226
+
227
+ **The clarifier MUST NOT autonomously drop items into "future tiers", "deferred", or "out of scope" without explicit user approval. This is a hard rule.**
228
+
229
+ Invariant: `items_in_plan >= items_in_input` unless user explicitly approves reduction.
230
+
231
+ ---
232
+
233
+ ## Done
234
+
235
+ When the plan is approved:
236
+
237
+ > **Clarifier phase complete.**
238
+ >
239
+ > - Spec: `.wazir/runs/latest/clarified/spec-hardened.md`
240
+ > - Design: `.wazir/runs/latest/clarified/design.md`
241
+ > - Plan: `.wazir/runs/latest/clarified/execution-plan.md`
242
+ >
243
+ > **Next:** Run `/executor` to implement the plan.