一键导入
wz-wazir
One-command pipeline — type /wazir followed by what you want to build. Handles init, clarification, execution, review, and audits automatically.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
One-command pipeline — type /wazir followed by what you want to build. Handles init, clarification, execution, review, and audits automatically.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Use before implementation work to turn operator briefings into an approved design with explicit trade-offs.
Run the clarification pipeline — research, clarify scope, brainstorm design, generate task specs and execution plan. Pauses for user approval between phases.
How to use Claude Code CLI programmatically for reviews, automation, and non-interactive operations within Wazir pipelines.
How to use Codex CLI programmatically for reviews, execution, and sandbox operations within Wazir pipelines.
Measure pipeline compliance for a completed run — checks phase execution, artifact production, gate evidence, hook enforcement, and publishes per-step and aggregate compliance scores.
Use when behavior is wrong or verification fails. Follow an observe-hypothesize-test-fix loop instead of guesswork.
基于 SOC 职业分类
| name | wz:wazir |
| description | One-command pipeline — type /wazir followed by what you want to build. Handles init, clarification, execution, review, and audits automatically. |
Before anything else happens here: read your phase checklist. It's at .wazir/runs/latest/phases/. Every item on it is there because skipping it caused problems before. Are you going to follow it or skip it?
The user typed /wazir <their request>. Run the entire pipeline end-to-end, handling each phase automatically and only pausing where human input is required.
All questions use numbered interactive options — one question at a time, defaults marked "(Recommended)", wait for user response before proceeding.
After every user response (approval, correction, rejection, redirect, instruction), capture it:
captureUserInput(runDir, { phase: '<current-phase>', type: '<instruction|approval|correction|rejection|redirect>', content: '<user message>', context: '<what prompted the question>' })
This uses tooling/src/capture/user-input.js. The log at user-input-log.ndjson feeds the learning system — user corrections are the strongest signal for improvement. At run end, prune logs older than 10 runs via pruneOldInputLogs(stateRoot, 10).
Follow the Canonical Command Matrix in hooks/routing-matrix.json.
wazir index search-symbols <query> firstwazir recall file <path> --tier L1 for targeted readswazir index build && wazir index summarize --tier allBefore anything else, check if the request starts with a known subcommand:
| Input | Action |
|---|---|
/wazir audit ... | Jump to Audit Mode (see below) |
/wazir prd [run-id] | Jump to PRD Mode (see below) |
/wazir init | Invoke the init-pipeline skill directly, then stop |
| Anything else | Continue to Phase 1 (Init) |
The pipeline has 4 phases. Each phase groups related workflows. Individual workflows within a phase can be enabled/disabled via workflow_policy in run-config.
| Phase | Contains | Owner Skill | Key Output |
|---|---|---|---|
| Init | Setup, prereqs, run directory, input scan | wz:wazir (inline) | run-config.yaml |
| Clarifier | Research, clarify, specify, brainstorm, plan | wz:clarifier | Approved spec + design + plan |
| Executor | Implement, verify | wz:executor | Code + verification proof |
| Final Review | Integration verification, concern resolution, 2+1 pass review, learn, prepare next | wz:reviewer | Verdict + learnings + handoff |
Before bootstrap, verify the Wazir CLI is installed:
which wazir
If not installed, check npm is available and auto-install:
which npm || { echo "npm not found — install Node.js 20+ first"; exit 1; }
npm install -g @wazir-dev/cli
After install, verify with which wazir. If install fails (permissions, no npm), ask the user for help — do not proceed without the CLI.
The CLI is required — the pipeline uses wazir capture, wazir validate, wazir index, and wazir doctor throughout execution.
Then check if this project is initialized:
wazir doctor --json
If doctor reports the project is not initialized (no .wazir/state/config.json), run:
wazir init
This creates state directories and detects the project's host and stack. It works in any project — no wazir.manifest.yaml needed.
After CLI check passes, run this command:
wazir capture ensure
This creates or resumes a pipeline run. Until this runs, you CANNOT write code — the bootstrap gate will block all Write/Edit/Bash calls. Please try 100% compliance with Wazir pipeline and skill usage.
Immediately after wazir capture ensure, read the active phase checklist and populate your task list to match it exactly. This ensures your task list IS the pipeline — not a competing instruction set.
.wazir/runs/latest/phases/ (the file whose header contains — ACTIVE)- [ ])TaskCreate with:
- [ ] prefix and any <!-- ... --> comments)- [x])Why: The agent naturally follows its own task list. If that list matches the pipeline checklist, pipeline compliance happens automatically. If you create a separate task list, it competes with the pipeline and compliance drops.
Before starting: Check .wazir/runs/latest/phases/init.md for your current checklist. Complete all items before proceeding to Phase 2.
Take whatever the user wrote after /wazir and save it as the briefing:
.wazir/input/ if it doesn't exist.wazir/input/briefing.md with a timestamp headerIf the user provided no text after /wazir, ask:
What would you like to build?
Save their answer as the briefing, then continue.
Scan both input/ (project-level) and .wazir/input/ (state-level) for existing briefing materials. If files exist beyond briefing.md, list them:
Found input files:
input/2026-03-19-deferred-items.md.wazir/input/briefing.mdUsing all found input as context for clarification.
Parse the request for inline modifiers before the main text:
/wazir quick fix the login redirect → depth = quick, intent = bugfix/wazir deep design a new onboarding flow → depth = deep, intent = featureRecognized modifiers:
quick, deep (standard is default when omitted)auto, interactive (guided is default when omitted)
/wazir auto fix the auth bug → interaction_mode = auto/wazir interactive design the onboarding → interaction_mode = interactivebugfix, feature, refactor, docs, spikeCheck if .wazir/state/config.json exists and has config_version: 2.
config_version or config_version !== 2): Invoke the init-pipeline skill. It handles dependency checks, asks 3-4 questions, and writes config.Config: <model_mode summary> | <interaction_mode> | Reconfigure: /wazir init
Model mode summary formats: single, multi-model (Haiku/Sonnet/Opus), multi-tool (Opus + Codex gpt-5.4)Run wazir doctor --json to verify repo health. Stop if unhealthy.
Run wazir validate branches to check the current git branch.
If on main or develop:
You're on [branch]. The pipeline requires a feature branch.
Ask the user via AskUserQuestion:
Wait for the user's selection before continuing.
INDEX_STATS=$(wazir index stats --json 2>/dev/null)
FILE_COUNT=$(echo "$INDEX_STATS" | jq -r '.file_count // 0')
if [ "$FILE_COUNT" -eq 0 ]; then
wazir index build && wazir index summarize --tier all
else
wazir index refresh
fi
Generate a run ID using the current timestamp: run-YYYYMMDD-HHMMSS
mkdir -p .wazir/runs/run-YYYYMMDD-HHMMSS/{sources,tasks,artifacts,reviews,clarified}
ln -sfn run-YYYYMMDD-HHMMSS .wazir/runs/latest
Initialize event capture:
wazir capture init --run <run-id> --phase init --status starting
Check if a previous incomplete run exists (via latest symlink pointing to a run without completed_at).
If previous incomplete run found, present:
A previous incomplete run was detected:
<previous-run-id>
Ask the user via AskUserQuestion:
Wait for the user's selection before continuing.
If Resume:
clarified/ from previous run into new run, EXCEPT user-feedback.md.No questions asked. Depth, intent, and interaction mode are inferred or read from project config.
Interaction mode wiring: Read interaction_mode from .wazir/state/config.json as the project default. Inline modifiers override:
interaction_mode = inline_modifier ?? project_config.interaction_mode ?? 'guided'
Infer intent from the request text using keyword matching:
| Keywords in request | Inferred Intent |
|---|---|
| fix, bug, broken, crash, error, issue, wrong | bugfix |
| refactor, clean, restructure, reorganize, rename, simplify | refactor |
| doc, document, readme, guide, explain | docs |
| research, spike, explore, investigate, prototype | spike |
| (anything else) | feature |
Depth defaults to standard. Override only via inline modifiers (/wazir quick ..., /wazir deep ...).
Save to .wazir/runs/<run-id>/run-config.yaml:
run_id: run-YYYYMMDD-HHMMSS
parent_run_id: null
continuation_reason: null
request: "the original user request"
request_summary: "short summary"
parsed_intent: feature
entry_point: "/wazir"
depth: standard
interaction_mode: guided # from inline modifier ?? project config ?? 'guided'
# Workflow policy — individual workflows within each phase
workflow_policy:
# Clarifier phase workflows
discover: { enabled: true, loop_cap: 10 }
clarify: { enabled: true, loop_cap: 10 }
specify: { enabled: true, loop_cap: 10 }
spec-challenge: { enabled: true, loop_cap: 10 }
author: { enabled: false, loop_cap: 10 }
design: { enabled: true, loop_cap: 10 }
design-review: { enabled: true, loop_cap: 10 } # covers architectural-design-review + visual-design-review
plan: { enabled: true, loop_cap: 10 }
plan-review: { enabled: true, loop_cap: 10 }
# Executor phase workflows
execute: { enabled: true, loop_cap: 10 }
verify: { enabled: true, loop_cap: 5 }
# Final Review phase workflows
review: { enabled: true, loop_cap: 10 }
learn: { enabled: true, loop_cap: 5 }
prepare_next: { enabled: true, loop_cap: 5 }
run_audit: { enabled: false, loop_cap: 10 }
research_topics: []
created_at: "YYYY-MM-DDTHH:MM:SSZ"
completed_at: null
Map intent + depth to applicable workflows. The system decides — the user does NOT pick.
| Class | Workflows | Rules |
|---|---|---|
| Core (always run) | clarify, execute, verify, review | Never skipped |
| Adaptive (run when evidence says so) | discover, design, author, specify | Skipped for bugfix/docs/spike at quick depth |
| Scale (intensity varies) | spec-challenge, plan-review, architectural-design-review, visual-design-review | Loop cap controls iteration depth |
| Post-run (always run) | learn, prepare_next | Part of Final Review phase |
Log skip decisions with reasons in workflow_policy.
After building run config:
High confidence — one-line summary and proceed:
Running: standard depth, feature, sequential. Proceeding...
Low confidence — show plan and ask:
Ask the user via AskUserQuestion:
Wait for the user's selection before continuing.
wazir capture event --run <run-id> --event phase_exit --phase init --status completed
Run the phase report and display it to the user:
wazir report phase --run <run-id> --phase init
Output the report content to the user in the conversation.
The interaction_mode field in run-config controls how the pipeline interacts with the user:
| Mode | Inline modifier | Behavior | Best for |
|---|---|---|---|
guided | (default) | Pipeline runs, pauses at phase checkpoints for user approval. Current default behavior. | Most work |
auto | /wazir auto ... | No human checkpoints. Codex reviews all. Gating agent decides continue/loop_back/escalate. Stops ONLY on escalate. | Overnight, clear spec, well-understood domain |
interactive | /wazir interactive ... | More questions, more discussion, co-designs with user. Researcher presents options. Executor checks approach before coding. | Ambiguous requirements, new domain, learning |
auto mode constraints.wazir/state/config.json). Error: "Auto mode requires an external reviewer (multi-tool mode with Codex or Gemini). Configure it first or use guided mode.".wazir/runs/<id>/escalations/, and wait for user inputguided mode (default)Current behavior — no changes needed. Checkpoints at phase boundaries, user approves before advancing.
interactive modeAll phase skills check interaction_mode from run-config at every checkpoint:
# Read from run-config
interaction_mode = run_config.interaction_mode ?? 'guided'
# At each checkpoint:
if interaction_mode == 'auto':
# Skip checkpoint, let gating agent decide
elif interaction_mode == 'interactive':
# More detailed question, present options, discuss
else:
# guided — standard checkpoint with AskUserQuestion
The pipeline has 4 top-level phases, each containing multiple workflows with review loops:
Phase 1: Init
└── (inline — no sub-workflows)
Phase 2: Clarifier
├── discover (research) ← research-review loop
├── clarify ← clarification-review loop
├── specify ← spec-challenge loop
├── author (adaptive) ← approval gate
├── design ← architectural-design-review loop
└── plan ← plan-review loop
Phase 3: Executor
├── execute (per-task) ← task-review loop per task
└── verify
Phase 4: Final Review (Completion Pipeline)
├── integration-verify ← full suite on merged main
├── concern-resolve ← fresh agent, sycophancy guard
├── review (final) ← 2+1 pass compliance audit
├── learn ← adoption rates, quality delta, user corrections
└── prepare_next
Event capture uses both levels. When emitting phase events, include --parent-phase:
wazir capture event --run <id> --event phase_enter --phase discover --parent-phase clarifier --status in_progress
This is the point where compliance usually drops off. You feel like you're making progress so you stop checking the list. Don't fall into that trap. Pull up .wazir/runs/latest/phases/ again. What's next on it?
Progress markers between workflows: After each workflow completes, output:
Phase 2: Clarifier > Workflow: specify (3 of 6 workflows complete)
wazir status shows both levels: "Phase 2: Clarifier > Workflow: specify"
Before starting: Check .wazir/runs/latest/phases/clarifier.md for your current checklist. Complete all items before proceeding to Phase 3.
Before starting this phase, output to the user:
Clarifier Phase — About to research your codebase, clarify requirements, harden the spec, brainstorm designs, and produce an execution plan.
Why this matters: Without this, I'd guess your tech stack, misunderstand constraints, miss edge cases in the spec, and build the wrong architecture. Every ambiguity left unresolved here becomes a bug or rework cycle later.
Looking for: Unstated assumptions, scope boundaries, conflicting requirements, missing acceptance criteria
wazir capture event --run <run-id> --event phase_enter --phase clarifier --status in_progress
Invoke the wz:clarifier skill. It handles all sub-workflows internally:
Each sub-workflow has its own review loop. User checkpoints between major steps.
Hard rule: items_in_plan >= items_in_input unless the user explicitly approves scope reduction. The clarifier MUST NOT autonomously tier, defer, or drop items from the user's input. It can suggest prioritization, but the decision belongs to the user.
Output: approved spec + design + execution plan in .wazir/runs/latest/clarified/.
After completing this phase, output to the user:
Clarifier Phase complete.
Found: [N] ambiguities resolved, [N] assumptions made explicit, [N] scope boundaries drawn, [N] acceptance criteria hardened
Without this phase: Requirements would be interpreted differently across tasks, acceptance criteria would be vague and untestable, the design would be ad-hoc, and the plan would miss dependency ordering
Changed because of this work: [List spec tightening changes, resolved questions, design decisions, scope adjustments]
wazir capture event --run <run-id> --event phase_exit --phase clarifier --status completed
Run the phase report and display savings to the user:
wazir report phase --run <run-id> --phase clarifier
wazir stats --run <run-id>
Show savings in conversation output:
Context savings this phase: Used wazir index for [N] queries and context-mode for [M] commands, saving ~[X] tokens ([Y]% reduction). Without these, this phase would have consumed [A] tokens instead of [B].
Output the report content to the user in the conversation.
Before starting: Check .wazir/runs/latest/phases/executor.md for your current checklist. Complete all items before proceeding to Phase 4.
Before starting this phase, output to the user:
Executor Phase — About to implement [N] tasks in dependency order with TDD (test-first), per-task code review, and verification before each commit.
Why this matters: Without this discipline, tests get skipped, edge cases get missed, integration points break silently, and review catches problems too late when they're expensive to fix.
Looking for: Correct dependency ordering, test coverage for each task, clean per-task review passes, no implementation drift from the approved plan
Before entering the Executor phase, verify ALL clarifier artifacts exist:
.wazir/runs/latest/clarified/clarification.md.wazir/runs/latest/clarified/spec-hardened.md.wazir/runs/latest/clarified/design.md.wazir/runs/latest/clarified/execution-plan.mdIf ANY file is missing, STOP:
Cannot enter Executor phase: missing prerequisite artifacts from Clarifier.
Missing: [list missing files]
The Clarifier phase must complete before execution can begin. Run
/wazir:clarifierfirst.
Do NOT skip this check. Do NOT rationalize that the input is "clear enough" to bypass clarification. Every pipeline run must produce these artifacts.
wazir capture event --run <run-id> --event phase_enter --phase executor --status in_progress
Pre-execution gate:
wazir validate manifest && wazir validate hooks && wazir validate branches
# Hard gate — stop if any fails.
Invoke the wz:executor skill. It handles:
Per-task review: --mode task-review, 5 task-execution dimensions.
Tasks always run sequentially.
Output: code changes + verification proof in .wazir/runs/latest/artifacts/.
After completing this phase, output to the user:
Executor Phase complete.
Found: [N]/[N] tasks implemented, [N] tests written, [N] per-task review passes completed, [N] findings fixed before commit
Without this phase: Code would ship without tests, review findings would accumulate until final review (10x more expensive to fix), and verification claims would be unsubstantiated
Changed because of this work: [List of commits with conventional commit messages, test counts, verification evidence collected]
wazir capture event --run <run-id> --event phase_exit --phase executor --status completed
Run the phase report and display savings to the user:
wazir report phase --run <run-id> --phase executor
wazir stats --run <run-id>
Output the report content to the user in the conversation.
Show savings in conversation output:
Context savings this phase: Used wazir index for [N] queries and context-mode for [M] commands, saving ~[X] tokens ([Y]% reduction).
Before starting: Check .wazir/runs/latest/phases/final_review.md for your current checklist. Complete all items before marking the run complete.
Before starting this phase, output to the user:
Final Review Phase — About to run adversarial 7-dimension review comparing the implementation against your original input, extract durable learnings, and prepare the handoff.
Why this matters: Without this, implementation drift ships undetected, missing acceptance criteria go unnoticed, untested code paths hide bugs, and the same mistakes repeat in the next run.
Looking for: Spec violations, missing features, dead code paths, unsubstantiated claims, scope creep, security gaps, stale documentation
Before entering the Final Review phase, verify the Executor produced its proof:
.wazir/runs/latest/artifacts/verification-proof.mdIf missing, STOP:
Cannot enter Final Review: missing verification proof from Executor.
The Executor phase must complete and produce
verification-proof.mdbefore final review. Run/wazir:executorfirst.
wazir capture event --run <run-id> --event phase_enter --phase final_review --status in_progress
This phase validates the implementation against the ORIGINAL INPUT (not the task specs — the executor's per-task reviewer already covered that).
Full verification suite on merged main before any review:
If integration fails: identify culprit via sequential merge record. Targeted fix executor receives failing output + acceptance criteria.
A fresh agent (NOT the executor or any producing agent) evaluates:
residuals-<subtask-id>.md filesSycophancy guard: generating agent MUST NOT rebut concerns. Route contested concerns to human.
Invoke wz:reviewer --mode final.
2+1 pass compliance audit comparing implementation against the original user input:
Exit criteria: single unresolved CRITICAL blocks SHIP regardless of score. Score verdicts: PASS (56+), NEEDS MINOR FIXES (42-55), NEEDS REWORK (28-41), FAIL (0-27). Final sign-off (after all actions): SHIP / SHIP WITH CAVEATS / DO NOT SHIP.
Extract durable learnings from the completed run:
memory/learnings/proposed/ with impact scoringPrepare context and handoff for the next run:
execution-summary.md (complete) or handover-batch-N.md (incomplete)After completing this phase, output to the user:
Final Review Phase complete (Completion Pipeline).
Integration verification: [PASS/FAIL] — [N] tests, [N] type errors, [N] lint errors Concern resolution: [N] concerns evaluated, [N] residuals resolved, [N] escalated Final review (2+1 passes): [N] findings — [N] CRITICAL, [N] HIGH, [N] MEDIUM, [N] LOW. Score: [score]/70. Pass 3 reconciliation: [ran/skipped] — [reason] Learnings: [N] proposed (adoption rate: [X]%, quality delta: [Y] points average)
Without this phase: Implementation drift would ship undetected, concerns would accumulate without resolution, cross-subtask integration bugs would hide, and recurring mistakes would never get captured
Changed because of this work: [List of findings fixed per pass, score improvement, learnings extracted, handoff prepared]
wazir capture event --run <run-id> --event phase_exit --phase final_review --status completed
Run the phase report and display it to the user:
wazir report phase --run <run-id> --phase final_review
Output the report content to the user in the conversation.
Before presenting results:
wazir validate branches
wazir validate commits
wazir validate changelog --require-entries --base $(git merge-base HEAD develop || git merge-base HEAD main)
Both must pass before PR. These are not warnings.
Completion is autonomous — the pipeline presents its sign-off and proceeds. User interaction happens only for two exceptions:
Present the completion pipeline results:
Completion Pipeline Results
Integration verification: [PASS/FAIL] Concern resolution: [N] concerns, [N] residuals Final review (2+1 passes): Score [score]/70 — [N] CRITICAL, [N] HIGH, [N] MEDIUM, [N] LOW Sign-off: [SHIP / SHIP WITH CAVEATS / DO NOT SHIP]
Learnings: [N] proposed. Handoff:
.wazir/runs/<run-id>/execution-summary.md
If SHIP or SHIP WITH CAVEATS: proceed to create PR automatically.
If DO NOT SHIP: present findings and stop.
If any CRITICAL or HIGH drift finding exists (implementation doesn't match what user asked for):
Drift detected — user decision required.
[List drift findings with evidence]
Ask the user via AskUserQuestion:
If a concern maps to a spec requirement but the resolution is unacceptable (requires spec/design change):
Unresolvable concern — user decision required.
[Concern details, spec requirement it maps to, why resolution failed]
Ask the user via AskUserQuestion:
Even if score is 56+, a single unresolved CRITICAL finding overrides to DO NOT SHIP. Present the CRITICAL finding(s) and stop.
wazir capture summary --run <run-id>
wazir status --run <run-id> --json
If any phase fails:
Phase [name] failed: [reason]
Ask the user via AskUserQuestion:
Wait for the user's selection before continuing.
Triggered by /wazir audit or /wazir audit <focus>.
Runs a structured codebase audit. Invokes the run-audit skill.
Parse inline audit types: /wazir audit security → skip Question 1.
After audit:
Ask the user via AskUserQuestion:
Wait for the user's selection before continuing.
If option 3, save findings as briefing and run pipeline with intent = bugfix.
Triggered by /wazir prd or /wazir prd <run-id>.
Generates a PRD from a completed run. Reads approved design, task specs, execution plan, review results. Saves to docs/prd/YYYY-MM-DD-<topic>-prd.md.
After generation:
Ask the user via AskUserQuestion:
Wait for the user's selection before continuing.
Every phase produces reasoning output at two layers:
Before each major decision, output one trigger sentence and one reasoning sentence:
"Your request mentions 'overnight autonomous run' — researching how Devin and Karpathy's autoresearch handle this, because unattended runs need different safety constraints than interactive ones."
After each phase, output what was found and a counterfactual:
"Found: you use Supabase auth (not custom JWT). If I'd skipped research, I would have built JWT middleware — completely wrong."
Save full reasoning chain to .wazir/runs/<id>/reasoning/phase-<name>-reasoning.md with entries:
### Decision: [title]
- **Trigger:** What prompted this decision
- **Options considered:** List of alternatives
- **Chosen:** The selected option
- **Reasoning:** Why this option was chosen
- **Confidence:** high | medium | low
- **Counterfactual:** What would have gone wrong without this information
Create the reasoning/ directory during run init. Every phase skill (clarifier, executor, reviewer) writes its own reasoning file. Counterfactuals appear in BOTH conversation output AND reasoning files.
Final challenge: name every checklist item you completed and what you produced for each one. If any answer is "I think I covered that" instead of "here's the output," you have more work to do. Which items are you unsure about?