/sniper-plan -- Phase 2: Planning & Architecture (Parallel Team with Coordination)
You are executing the /sniper-plan command. Your job is to spawn a planning team that produces the PRD, system architecture, UX specification, and security requirements. This phase has task dependencies and coordination pairs -- you must manage the flow. You are the team lead -- you coordinate, you do NOT produce artifacts yourself. Follow every step below precisely.
Arguments: $ARGUMENTS
Step 0: Pre-Flight Checks
Perform ALL checks before proceeding. If any critical check fails, STOP.
0a. Verify SNIPER Is Initialized
- Read
.sniper/config.yaml. - If the file does not exist or
project.nameis empty:- STOP. Print: "SNIPER is not initialized. Run
/sniper-initfirst."
- STOP. Print: "SNIPER is not initialized. Run
0b. Verify Phase 1 Artifacts Exist
Check that the following files exist and are non-empty:
docs/brief.md-- REQUIRED. If missing, STOP and print: "Phase 1 artifactdocs/brief.mdis missing. Run/sniper-discoverfirst."docs/risks.md-- Recommended but not blocking. If missing, print a warning.docs/personas.md-- Recommended but not blocking. If missing, print a warning.
0c. Config Migration Check
- Read
schema_versionfrom.sniper/config.yaml. - If
schema_versionis absent or less than 2, run the v1→v2 migration as defined in the Config Reader Protocol. Write the updated config before proceeding.
0d. Verify Phase State
- Determine the current active phase: find the last entry in
state.phase_logwherecompleted_atis null. - If no active phase: Good -- proceed. Re-running plan after sprint is normal iteration.
- If active phase is
plan: Already in progress.- Ask the user: "A plan phase is already in progress ({context}). Options: (a) Resume it (b) Start a new plan with a different context"
- If active phase is something else:
- Ask the user: "You have an active {phase} phase ({context}) that hasn't completed. Options: (a) Pause it and start planning (b) Complete {phase} first"
0e. Amendment Detection
- Check if the target artifact files already exist and are non-empty:
docs/prd.mddocs/architecture.mddocs/ux-spec.mddocs/security.md
- If ANY exist: Enter amendment mode. Note which files exist and their current version numbers. Agents will be instructed to amend rather than create.
- If NONE exist: Normal create mode.
0f. Verify Framework Files
Check that these files exist:
.sniper/teams/plan.yaml.sniper/spawn-prompts/_template.md.sniper/checklists/plan-review.md.sniper/personas/process/product-manager.md.sniper/personas/process/architect.md.sniper/personas/process/ux-designer.md.sniper/personas/technical/api-design.md.sniper/personas/technical/backend.md.sniper/personas/technical/frontend.md.sniper/personas/technical/security.md.sniper/personas/cognitive/systems-thinker.md.sniper/personas/cognitive/security-first.md.sniper/personas/cognitive/user-empathetic.md.sniper/templates/prd.md.sniper/templates/architecture.md.sniper/templates/ux-spec.md
Report any missing files as warnings. Continue if the team YAML and key personas exist.
Step 1: Update Lifecycle State
Edit .sniper/config.yaml:
- Append to
state.phase_log:yaml- phase: plan context: "{from --context argument, or 'initial' for first run, or 'iteration-N' for re-runs}" started_at: "{current ISO timestamp}" completed_at: null approved_by: null
Step 2: Read Team Definition
- Read
.sniper/teams/plan.yamlin full. - Parse out:
team_name:sniper-planmodel_override:opus-- note this for all teammate spawns- The list of
teammateswith theirname,composelayers,tasks(includingreads,blocked_by,plan_approval) - The
coordinationpairs - The
review_gatesection (should bestrict)
- Map out the dependency graph:
product-manager(prd) -> NO dependencies, starts immediatelyarchitect(architecture) -> blocked_by: [prd]ux-designer(ux-spec) -> blocked_by: [prd]security-analyst(security) -> blocked_by: [prd]
- Note:
architecthasplan_approval: true-- you MUST approve their approach before they execute.
Step 3: Read Project Context and Phase 1 Artifacts
- Read
.sniper/config.yamlfor project settings, stack, and ownership. - Read the Phase 1 discovery artifacts:
docs/brief.mddocs/risks.md(if exists)docs/personas.md(if exists)
- Read the artifact templates:
.sniper/templates/prd.md.sniper/templates/architecture.md.sniper/templates/ux-spec.md
- If
domain_packis set, read domain context files.
Step 4: Compose Spawn Prompts
For each teammate, compose a spawn prompt by reading persona layer files and assembling them into the template from .sniper/spawn-prompts/_template.md.
Teammate: product-manager
Read persona layers:
- Process:
.sniper/personas/process/product-manager.md - Technical:
.sniper/personas/technical/api-design.md - Cognitive:
.sniper/personas/cognitive/systems-thinker.md - Domain: domain pack context if configured, otherwise skip
- Process:
Assemble using the spawn template:
{name}= "product-manager"{ownership}= thedocsownership paths from config.yaml
Append task context:
## Your Task **Task ID:** prd **Task Name:** Product Requirements Document **Output File:** docs/prd.md **Template:** .sniper/templates/prd.md Write a comprehensive PRD covering: problem statement, user stories, feature requirements (P0/P1/P2), success metrics, constraints, and out-of-scope items. This is the single source of truth for what to build. ## Required Reading (read these BEFORE writing) - docs/brief.md - docs/personas.md (if exists) - docs/risks.md (if exists) ## Project Context - **Project:** {project.name} - **Type:** {project.type} - **Description:** {project.description} - **Stack:** {summary of stack section} ## Instructions (Create Mode — when docs/prd.md does NOT exist) 1. Read ALL the required reading files listed above. 2. Read the template at `.sniper/templates/prd.md` for expected output format. 3. Synthesize the discovery artifacts into a coherent PRD. 4. Every P0 requirement MUST have testable acceptance criteria. 5. User stories must reference the personas from `docs/personas.md`. 6. Write the complete output to `docs/prd.md`. 7. When complete, message the team lead. Other teammates are waiting on your output. ## Instructions (Amendment Mode — when docs/prd.md already exists) 1. Read the EXISTING `docs/prd.md` first. Note its current version number. 2. Read ALL the required reading files listed above. 3. AMEND the existing PRD: add new requirements, update changed sections, mark removed items as deprecated. Preserve content outside managed sections (<!-- sniper:managed --> markers). 4. Every P0 requirement MUST have testable acceptance criteria. 5. Increment the version number and add a changelog entry describing what changed. 6. Set Status back to "Draft". 7. When complete, message the team lead. Other teammates are waiting on your output.
Teammate: architect
Read persona layers:
- Process:
.sniper/personas/process/architect.md - Technical:
.sniper/personas/technical/backend.md - Cognitive:
.sniper/personas/cognitive/security-first.md - Domain: domain pack context if configured
- Process:
Assemble using the spawn template:
{name}= "architect"{ownership}= thedocsownership paths
Append task context:
## Your Task **Task ID:** architecture **Task Name:** System Architecture Document **Output File:** docs/architecture.md **Template:** .sniper/templates/architecture.md **IMPORTANT:** This task has `plan_approval: true`. You MUST describe your approach first and wait for the team lead to approve before writing the full document. Design the complete system architecture including: component diagram, data models, API contracts, infrastructure topology, technology choices with rationale, and non-functional requirements. ## Required Reading (read these BEFORE starting) - docs/prd.md (WAIT for this to be completed first -- you are blocked until it exists) - docs/brief.md - docs/risks.md (if exists) ## Coordination - You will coordinate with `security-analyst` -- they will review your security architecture decisions. - You will coordinate with `ux-designer` -- align frontend component boundaries with your API contracts. - When you have API contracts drafted, message `ux-designer` to validate component hierarchy. - When you have security architecture drafted, message `security-analyst` for review. ## Project Context - **Project:** {project.name} - **Type:** {project.type} - **Stack:** {full stack details} ## Instructions 1. WAIT until `docs/prd.md` exists (the product-manager must complete it first). 2. Read all required reading files. 3. Read the template at `.sniper/templates/architecture.md`. 4. **PLAN APPROVAL REQUIRED:** Before writing the full architecture, describe your high-level approach to the team lead: - Proposed component boundaries - Key technology choices and rationale - Data flow overview - Infrastructure topology approach Wait for the lead to approve or provide feedback before proceeding. 5. After approval, write the complete architecture document to `docs/architecture.md`. 6. Message `security-analyst` and `ux-designer` when your document is ready for their review. 7. Message the team lead when complete.
Teammate: ux-designer
Read persona layers:
- Process:
.sniper/personas/process/ux-designer.md - Technical:
.sniper/personas/technical/frontend.md - Cognitive:
.sniper/personas/cognitive/user-empathetic.md - Domain: domain pack context if configured
- Process:
Assemble using the spawn template:
{name}= "ux-designer"{ownership}= thedocsownership paths
Append task context:
## Your Task **Task ID:** ux-spec **Task Name:** UX Specification **Output File:** docs/ux-spec.md **Template:** .sniper/templates/ux-spec.md Create the UX specification: information architecture, screen inventory, key user flows (with decision trees), component hierarchy, interaction patterns, and responsive breakpoints. ## Required Reading (read these BEFORE starting) - docs/prd.md (WAIT for this to be completed first -- you are blocked until it exists) - docs/personas.md (if exists) ## Coordination - You will coordinate with `architect` -- validate that your component hierarchy aligns with their API contracts and backend architecture. - When the architect shares their API contracts, review them and provide feedback on frontend data needs. ## Project Context - **Project:** {project.name} - **Type:** {project.type} - **Stack:** {frontend framework, etc.} ## Instructions 1. WAIT until `docs/prd.md` exists. 2. Read all required reading files. 3. Read the template at `.sniper/templates/ux-spec.md`. 4. Write the UX specification to `docs/ux-spec.md`. 5. When `architect` messages you about API contracts, review and provide feedback. 6. Message the team lead when complete.
Teammate: security-analyst
Read persona layers:
- Process:
.sniper/personas/process/architect.md - Technical:
.sniper/personas/technical/security.md - Cognitive:
.sniper/personas/cognitive/security-first.md - Domain: domain pack context if configured
- Process:
Assemble using the spawn template:
{name}= "security-analyst"{ownership}= thedocsownership paths
Append task context:
## Your Task **Task ID:** security **Task Name:** Security & Compliance Requirements **Output File:** docs/security.md Define security architecture: auth model, data encryption strategy, compliance requirements (with specific regulations), threat model, and security testing requirements. ## Required Reading (read these BEFORE starting) - docs/prd.md (WAIT for this to be completed first) - docs/risks.md (if exists) ## Coordination - You will coordinate with `architect` -- review their architecture for security concerns. - When the architect shares their document, review it and provide security feedback via messaging. ## Project Context - **Project:** {project.name} - **Type:** {project.type} - **Stack:** {infrastructure, etc.} ## Instructions 1. WAIT until `docs/prd.md` exists. 2. Read all required reading files. 3. Write the security requirements to `docs/security.md`. 4. When `architect` messages you about their architecture, review it for security concerns and provide feedback. 5. If you find security issues in the architecture, message the architect directly with specific concerns. 6. Message the team lead when complete.
Step 5: Create the Agent Team
Use the TeamCreate tool:
TeamCreate:
team_name: "sniper-plan"
description: "SNIPER Phase 2: Planning & Architecture for {project.name}. Model override: opus."Step 6: Create Tasks with Dependencies
Create tasks in the shared task list. Dependencies matter here -- the architect, UX designer, and security analyst are all blocked by the product manager completing the PRD.
Task 1: PRD (no dependencies -- starts immediately)
TaskCreate:
subject: "Write the Product Requirements Document"
description: "Synthesize discovery artifacts into a comprehensive PRD. Output: docs/prd.md. Template: .sniper/templates/prd.md. Reads: docs/brief.md, docs/personas.md, docs/risks.md. This task BLOCKS architect, ux-designer, and security-analyst."
activeForm: "Writing the Product Requirements Document"Task 2: Architecture (blocked by PRD)
TaskCreate:
subject: "Design the system architecture"
description: "Design complete system architecture with components, data models, API contracts, infrastructure. Output: docs/architecture.md. Template: .sniper/templates/architecture.md. PLAN APPROVAL REQUIRED: must describe approach and get lead approval before executing. Blocked by: PRD task."
activeForm: "Designing system architecture"After creating Task 2, set its dependency:
TaskUpdate:
taskId: "{task 2 id}"
addBlockedBy: ["{task 1 id}"]Task 3: UX Specification (blocked by PRD)
TaskCreate:
subject: "Create the UX specification"
description: "Define information architecture, screen inventory, user flows, component hierarchy, responsive breakpoints. Output: docs/ux-spec.md. Template: .sniper/templates/ux-spec.md. Blocked by: PRD task."
activeForm: "Creating UX specification"After creating Task 3, set its dependency:
TaskUpdate:
taskId: "{task 3 id}"
addBlockedBy: ["{task 1 id}"]Task 4: Security Requirements (blocked by PRD)
TaskCreate:
subject: "Define security and compliance requirements"
description: "Define auth model, encryption, compliance, threat model, security testing. Output: docs/security.md. Blocked by: PRD task."
activeForm: "Defining security requirements"After creating Task 4, set its dependency:
TaskUpdate:
taskId: "{task 4 id}"
addBlockedBy: ["{task 1 id}"]Step 7: Spawn Teammates
Spawn each teammate using the Task tool with:
team_name: "sniper-plan"name: the teammate name- The full composed spawn prompt from Step 4
Spawn order matters for efficiency:
- Spawn
product-managerFIRST -- they have no blockers and others depend on them. - Spawn
architect,ux-designer, andsecurity-analyst-- they will wait for the PRD.
Assign tasks to teammates using TaskUpdate:
- Task 1 (PRD) -> owner: "product-manager", status: "in_progress"
- Task 2 (Architecture) -> owner: "architect" (stays
pendinguntil PRD completes) - Task 3 (UX Spec) -> owner: "ux-designer" (stays
pendinguntil PRD completes) - Task 4 (Security) -> owner: "security-analyst" (stays
pendinguntil PRD completes)
Step 8: Enter Delegate Mode
You are the team lead. You coordinate, you do NOT produce artifacts.
Phase 8a: PRD Completion
- Wait for
product-managerto complete the PRD. - When they report completion, verify
docs/prd.mdexists and is non-empty. - Mark Task 1 as
completedvia TaskUpdate. - The blocked tasks (2, 3, 4) are now unblocked.
- Message
architect,ux-designer, andsecurity-analyst:"The PRD is complete at
docs/prd.md. You may now begin your tasks. Read the PRD before starting." - Update tasks 2, 3, 4 to
in_progress.
Phase 8b: Architect Plan Approval
- The architect has
plan_approval: true. They MUST describe their approach before executing. - When the architect sends their plan/approach, carefully review it:
- Does the component architecture align with the PRD requirements?
- Are the technology choices appropriate for the stack in config.yaml?
- Is the data model sound?
- Are there obvious gaps or risks?
- Decide:
- If the approach looks solid: Approve by messaging the architect: "Plan approved. Proceed with the full architecture document."
- If it needs changes: Send specific feedback: "Please revise: {specific issues}". Wait for revised plan.
- If you are unsure: Present the architect's plan to the USER and ask for their input before approving.
Phase 8c: Coordination Facilitation
Monitor for coordination between teammates:
- architect <-> security-analyst: When the architect completes or shares their draft, ensure the security analyst reviews it. If the security analyst finds issues, facilitate the conversation.
- architect <-> ux-designer: When the architect has API contracts, ensure the UX designer validates that component hierarchy aligns. Facilitate alignment if there are conflicts.
If teammates are not coordinating on their own, prompt them:
- Message architect: "Have you shared your API contracts with ux-designer for validation?"
- Message security-analyst: "The architecture document is ready. Please review it for security concerns."
Phase 8d: Completion Monitoring
Track progress. As each teammate completes:
- Verify their output file exists and is non-empty.
- Mark their task as
completed. - If a teammate has been working for more than 20 minutes without a message, check on them.
Wait for ALL four tasks to complete before proceeding.
Step 9: Verify All Artifacts
Verify these files exist and contain content:
docs/prd.md-- REQUIREDdocs/architecture.md-- REQUIREDdocs/ux-spec.md-- REQUIREDdocs/security.md-- Recommended but not strictly required
If any REQUIRED file is missing, message the responsible teammate and wait for completion. Do NOT proceed without the PRD, architecture, and UX spec.
Step 10: Run Review Gate (STRICT -- Human Must Approve)
This is a STRICT gate. Human approval is NON-NEGOTIABLE.
- Read the review checklist at
.sniper/checklists/plan-review.md. - For each checklist section, read the relevant artifact and evaluate:
- PRD section: Read
docs/prd.mdand check each item. - Architecture section: Read
docs/architecture.mdand check each item. - UX section: Read
docs/ux-spec.mdand check each item. - Security section: Read
docs/security.md(if exists) and check each item. - Cross-Document Consistency: Verify alignment across all artifacts.
- PRD section: Read
- Compile the review into a structured report:
============================================
SNIPER Phase 2: Planning Review
============================================
Gate Mode: STRICT (human approval required)
## PRD Review (docs/prd.md)
[PASS] / [ATTENTION] / [FAIL] for each checklist item
## Architecture Review (docs/architecture.md)
[PASS] / [ATTENTION] / [FAIL] for each checklist item
## UX Specification Review (docs/ux-spec.md)
[PASS] / [ATTENTION] / [FAIL] for each checklist item
## Security Review (docs/security.md)
[PASS] / [ATTENTION] / [FAIL] for each checklist item
## Cross-Document Consistency
[PASS] / [ATTENTION] / [FAIL] for each checklist item
Summary:
Passed: {count}/{total}
Attention: {count}
Failed: {count}
============================================- ALWAYS present this review to the user and wait for explicit approval.
Print to the user:
"Phase 2 planning review is complete. Please review the artifacts and the checklist results above."
"Your options:"
- Approve -- advance to Phase 3 (Epic Sharding)
- Request revisions -- specify which artifacts need changes, and I will instruct the relevant teammates
- Reject -- stop the process for manual review
- WAIT for the user to respond. Do not auto-advance. Do not assume approval.
If User Requests Revisions
- Parse their feedback to determine which artifacts need changes.
- Message the relevant teammate(s) with specific revision instructions.
- Wait for revisions to complete.
- Re-run the checklist evaluation.
- Present the updated review to the user again.
- Repeat until the user approves.
If User Approves
Proceed to Step 11.
If User Rejects
Print: "Phase 2 halted. Review artifacts manually in docs/. Run /sniper-plan again when ready to retry." Update state with approved_by: "rejected" and STOP.
Step 11: Update State and Shut Down Team
Update Lifecycle State
Edit .sniper/config.yaml:
- Update artifact tracking (increment version if amendment mode):
- Set
state.artifacts.prd.status: draftand incrementstate.artifacts.prd.version - Set
state.artifacts.architecture.status: draftand incrementstate.artifacts.architecture.version - Set
state.artifacts.ux_spec.status: draftand incrementstate.artifacts.ux_spec.version - Set
state.artifacts.security.status: draftand incrementstate.artifacts.security.version(if produced)
- Set
- Update the plan entry in
state.phase_log:- Set
completed_at: "{current ISO timestamp}" - Set
approved_by: "human"(since this is a strict gate)
- Set
Shut Down Teammates
Send shutdown requests to each teammate:
- Send shutdown_request to "product-manager"
- Send shutdown_request to "architect"
- Send shutdown_request to "ux-designer"
- Send shutdown_request to "security-analyst"
Wait for all teammates to acknowledge shutdown.
Step 12: Present Results and Next Steps
============================================
SNIPER Phase 2: Planning Complete
============================================
Artifacts Produced:
- docs/prd.md [draft, approved]
- docs/architecture.md [draft, approved]
- docs/ux-spec.md [draft, approved]
- docs/security.md [draft, approved]
Review Gate: STRICT
Status: APPROVED by human
Passed: {count}/{total} checklist items
Phase Duration: {time elapsed}
============================================
Next Steps
============================================
1. Run `/sniper-solve` to begin Phase 3: Epic Sharding & Story Creation
2. Or run `/sniper-status` to see the full lifecycle state
Note: Phase 3 runs as a single agent (no team spawned).
It will break the PRD into epics and create implementation stories.
============================================IMPORTANT RULES
- You are the LEAD. You coordinate. You do NOT write artifact files.
- The
model_override: opusfrom the team YAML should be noted in the team description. If the Task tool supports model selection, use opus for all teammates in this phase. - The architect's
plan_approval: trueis MANDATORY. Do NOT let the architect skip the plan approval step. - The review gate is STRICT. Do NOT auto-advance. ALWAYS wait for human approval.
- If
$ARGUMENTScontains "dry-run", perform Steps 0-4 only (compose prompts) and print them without spawning. - If
$ARGUMENTScontains "skip-review", IGNORE IT. The plan gate is strict and cannot be skipped. - Dependencies: product-manager runs first. Architect, UX designer, and security analyst are blocked until PRD completes.
- Coordination: actively facilitate cross-team communication, especially architect<->security and architect<->UX.
- If a teammate is blocked or unresponsive for more than 10 minutes, check on them and report to the user if needed.
- All file paths are relative to the project root.
- Do NOT proceed to
/sniper-solveautomatically -- always let the user initiate the next phase.
