/sniper-feature -- Incremental Feature Lifecycle
You are executing the /sniper-feature command. Your job is to orchestrate a scoped mini-lifecycle for adding a single feature to an existing project. You run the full flow: scoping, planning, story generation, sprint, and merge-back — with user checkpoints between phases. Follow every step below precisely.
Arguments: $ARGUMENTS
Step 0: Pre-Flight Checks
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. Config Migration Check
- Read
schema_versionfrom.sniper/config.yaml. - If
schema_versionis absent or less than 2, run the v1→v2 migration. Write the updated config before proceeding.
0c. Parse Arguments
- Feature description (positional): The feature title/description (e.g., "Add webhook support for real-time event delivery").
--list: List all active and completed features with their status. Print the list and STOP.--resume SNPR-{XXXX}: Resume a paused feature. Find the feature instate.features[], determine its current phase, and jump to the appropriate step.--skip-to {phase}: Skip directly to a specific phase (planning, solving, sprint). Only valid with--resume.
0d. Handle --list
If --list was passed:
============================================
SNIPER Features
============================================
Active Features:
SNPR-{XXXX} {title} {phase} ({progress})
...
Completed Features:
SNPR-{XXXX} {title} completed {date} ({story_count} stories)
...
Total: {active} active, {completed} completed
============================================Then STOP.
0e. Handle --resume
If --resume SNPR-{XXXX} was passed:
- Find the feature in
state.features[]by ID. - If not found, STOP: "Feature SNPR-{XXXX} not found."
- Read the feature's current phase.
- Jump to the corresponding step:
scoping→ Step 2 (re-run scoping or continue)planning→ Step 4 (run planning)solving→ Step 6 (run story generation)sprint→ Step 8 (run sprint)
0f. Verify Feature Description
If no --list or --resume flag, a feature description is required:
- If
$ARGUMENTSdoes not contain a feature description, ask the user: "What feature would you like to add? Describe it in one sentence." - Store the feature description for Step 1.
0g. Check Architecture Doc Exists
- Check if
docs/architecture.mdexists. - If it does NOT exist:
- Print: "No architecture doc found. The feature lifecycle works best with an existing architecture doc. Options: (a) Run
/sniper-ingestfirst to reverse-engineer the architecture (b) Continue without architecture context" - If (a), STOP.
- If (b), note that the architecture delta phase will be skipped.
- Print: "No architecture doc found. The feature lifecycle works best with an existing architecture doc. Options: (a) Run
Step 1: Assign Feature ID and Create Directory
1a. Assign SNPR ID
- Read
state.feature_counterfrom config (default: 1). - Assign the feature ID:
SNPR-{XXXX}where XXXX is zero-padded (e.g., SNPR-0001). - Generate a slug from the feature description (e.g., "Add webhook support" → "webhook-support").
- Increment
feature_counterand write back to config.
1b. Record Feature in State
Add to state.features[]:
- id: "SNPR-{XXXX}"
slug: "{slug}"
title: "{feature description}"
phase: scoping
created_at: "{current ISO timestamp}"
completed_at: null
arch_base_version: {current version of docs/architecture.md, or 0 if it doesn't exist}
stories_total: 0
stories_complete: 01c. Create Feature Directory
docs/features/SNPR-{XXXX}/Print:
============================================
Feature Created: SNPR-{XXXX}
============================================
Title: {feature description}
Slug: {slug}
Dir: docs/features/SNPR-{XXXX}/
Starting scoping phase...
============================================Step 2: Phase 1 — Scoping (Single Agent)
You run scoping directly — no team is spawned. This is lightweight.
2a. Gather Context
Read the following files to understand the current system:
docs/architecture.md(if exists) — understand the system structuredocs/conventions.md(if exists) — understand coding patterns.sniper/config.yaml— get ownership paths and stack info- Source code files relevant to the feature — search for keywords from the feature description in the codebase
2b. Read Template
Read .sniper/templates/feature-brief.md
2c. Produce Feature Brief
Write docs/features/SNPR-{XXXX}/brief.md following the template. Fill in:
- Feature Description — what this feature does, in user-facing terms
- Motivation — why this feature is needed
- Affected Areas — which components/files will be impacted (use architecture doc and codebase search)
- Scope — clear in/out boundaries
- Risks & Open Questions — unknowns that need resolution
- Dependencies — external services, libraries, or other features needed
2d. Update Feature State
Update state.features[] for this feature: phase: scoping (already set).
2e. Present to User
Print:
============================================
Feature Brief: SNPR-{XXXX}
============================================
{Summary of the brief — affected components, scope, key risks}
Full brief: docs/features/SNPR-{XXXX}/brief.md
Options:
yes — Continue to planning phase
edit — Make manual edits, then say "continue"
cancel — Pause this feature (resume later with --resume)
============================================Wait for user response.
- yes → proceed to Step 3
- edit → wait for user to say "continue", then proceed to Step 3
- cancel → STOP. Feature remains in
scopingphase.
Step 3: Transition to Planning
Update state.features[] for this feature: phase: planning
Step 4: Phase 2 — Planning (2-Agent Team)
4a. Read Team Definition
Read .sniper/teams/feature-plan.yaml. Replace {feature_id} with the actual ID and {feature_title} with the title.
4b. Read Context
- Read
docs/features/SNPR-{XXXX}/brief.md(just produced) - Read
docs/architecture.md(if exists) - Read
docs/conventions.md(if exists) - Read templates:
.sniper/templates/feature-spec.mdand.sniper/templates/arch-delta.md
4c. Compose Spawn Prompts
For each teammate in the feature-plan team YAML:
feature-pm:
- Read persona layers: process/product-manager.md, cognitive/systems-thinker.md
- Compose spawn prompt with:
- Feature context (brief, architecture, description)
- Task: produce
docs/features/SNPR-{XXXX}/spec.md - Instructions to follow the feature-spec template
- Remind agent to read the brief first
feature-architect:
- Read persona layers: process/architect.md, technical/backend.md, cognitive/systems-thinker.md
- Compose spawn prompt with:
- Feature context (brief, spec once produced, architecture, conventions)
- Task: produce
docs/features/SNPR-{XXXX}/arch-delta.md - Instructions to follow the arch-delta template
- Note the base architecture version for merge-back tracking
- Blocked by: feature-spec (must wait for PM to complete)
plan_approval: true— the architect must present a plan for approval before writing
4d. Create Team and Tasks
TeamCreate:
team_name: "sniper-feature-plan-{feature_id}"
description: "Feature planning for SNPR-{XXXX}: {title}"Create two tasks:
- "Feature Requirements Spec" — assigned to feature-pm
- "Architecture Delta" — assigned to feature-architect, blocked by task 1
4e. Spawn Teammates and Delegate
Spawn both teammates. Enter delegate mode — coordinate, don't produce artifacts.
- The PM works first (produces spec.md)
- When PM completes, the architect's task unblocks
- The architect reads the spec + architecture and produces arch-delta.md
- The architect's task requires plan approval — review their proposed approach before they write
4f. Verify Artifacts
Once both complete, verify:
docs/features/SNPR-{XXXX}/spec.mdexists and has contentdocs/features/SNPR-{XXXX}/arch-delta.mdexists and has content
4g. Shut Down Planning Team
Send shutdown requests to both teammates.
4h. Run Feature Review
Read .sniper/checklists/feature-review.md. Evaluate the spec and arch-delta sections.
4i. Present to User
Print:
============================================
Feature Planning Complete: SNPR-{XXXX}
============================================
Spec: docs/features/SNPR-{XXXX}/spec.md
Arch Delta: docs/features/SNPR-{XXXX}/arch-delta.md
{Summary: requirement count, component changes, data model changes}
Review: {pass_count}/{total} checklist items passed
Options:
yes — Continue to story generation
edit — Make manual edits, then say "continue"
cancel — Pause this feature
============================================Wait for user response.
Step 5: Transition to Solving
Update state.features[] for this feature: phase: solving
Step 6: Phase 3 — Story Generation (Scoped Solve)
You run this directly as a single agent (same as /sniper-solve), but scoped to the feature.
6a. Read Feature Artifacts
- Read
docs/features/SNPR-{XXXX}/spec.md - Read
docs/features/SNPR-{XXXX}/arch-delta.md - Read
docs/architecture.md(for broader context) - Read
docs/conventions.md(if exists, for coding patterns) - Read story template:
.sniper/templates/story.md
6b. Create Stories Directory
docs/features/SNPR-{XXXX}/stories/6c. Generate Stories
Create 3-8 stories scoped to this feature. Follow the same rules as /sniper-solve Step 7:
- Self-contained: embed all context from the feature spec and arch-delta
- Given/When/Then acceptance criteria
- File ownership from config.yaml
- Complexity: S/M/L (split XL)
- Dependencies form a DAG
Numbering: Stories are numbered sequentially within the feature: S01-{slug}.md, S02-{slug}.md, etc.
Context embedding: Stories reference the feature spec and arch-delta, NOT the main PRD. Embed:
- Relevant requirements from
spec.md - Relevant architecture changes from
arch-delta.md - Patterns from
conventions.md
6d. Update Feature State
stories_total: {count of stories created}6e. Present to User
============================================
Stories Created: SNPR-{XXXX}
============================================
{count} stories in docs/features/SNPR-{XXXX}/stories/
| # | Story | Size | Priority | Ownership | Deps |
|---|-------|------|----------|-----------|------|
| S01 | {title} | M | P0 | backend | None |
| S02 | {title} | S | P0 | backend | S01 |
| ... | ... | ... | ... | ... | ... |
Options:
yes — Start implementation sprint
edit — Make manual edits, then say "continue"
cancel — Pause this feature
============================================Wait for user response.
Step 7: Transition to Sprint
Update state.features[] for this feature: phase: sprint
Step 8: Phase 4 — Sprint (Scoped to Feature)
This runs the sprint logic from /sniper-sprint, but scoped to the feature.
Key Differences from Standard Sprint
Story source: Read stories from
docs/features/SNPR-{XXXX}/stories/instead ofdocs/stories/.Architecture context: Include both
docs/architecture.mdANDdocs/features/SNPR-{XXXX}/arch-delta.mdin teammate spawn prompts. The arch-delta takes precedence for this feature's scope.State tracking: Does NOT increment
state.current_sprint. The feature's sprint is tracked instate.features[].phase: sprintandstate.features[].stories_complete.Team naming: Use
sniper-feature-sprint-{feature_id}to avoid collision with main lifecycle sprint teams.Story completion: Update
state.features[].stories_completecount as stories complete.Conventions context: Include
docs/conventions.md(if exists) in spawn prompts so agents follow established patterns.
Sprint Execution
Follow the same process as /sniper-sprint Steps 1-14, with the adjustments above:
- Step 0: Pre-flight (already done in feature pre-flight)
- Step 1: Do NOT increment
state.current_sprint. Append a phase_log entry withcontext: "feature-sprint-SNPR-{XXXX}". - Step 2: Read team definition from
.sniper/teams/sprint.yaml - Step 3: Present feature stories (from feature dir) for selection. Default: select ALL feature stories.
- Steps 4-6: Same (determine teammates, assign stories, compose prompts — add arch-delta to context)
- Steps 7-14: Same execution, delegate, verify, review, state update
After Sprint Completes
If all feature stories are complete, proceed automatically to Step 9 (merge-back).
If not all stories are complete, present:
Feature SNPR-{XXXX}: {completed}/{total} stories complete.
Run another sprint? (yes/no)Step 9: Phase 5 — Merge-Back
After all feature stories are complete and the sprint is approved:
9a. Conflict Detection
- Read
arch_base_versionfromstate.features[]for this feature. - Read the current version from
docs/architecture.mdheader. - If current version > base version: The architecture doc was modified since this feature started.
- Print: "The architecture doc has been updated since this feature started (was v{base}, now v{current}). Please review the merge-back manually."
- Show the arch-delta changes and ask for user approval before merging.
- Wait for confirmation.
- If current version == base version: Proceed with automatic merge.
9b. Merge Architecture Delta
- Read
docs/features/SNPR-{XXXX}/arch-delta.md - Read
docs/architecture.md - For each section in the delta:
- New Components → Add to the architecture doc's component section (within managed markers if present)
- Modified Components → Update the relevant section in the architecture doc
- New Data Models → Add to the Data Models section
- New/Modified API Endpoints → Add to the API Contracts section
- Infrastructure Changes → Add to the Infrastructure section
- Increment the architecture doc's version number
- Add a changelog entry:
v{N} ({date}): Merged SNPR-{XXXX} — {feature title} - Set architecture doc status back to "Draft"
9c. Update Feature Log
Append to docs/features/log.md (create if it doesn't exist):
| SNPR-{XXXX} | {title} | {start_date} | {completion_date} | {story_count} | {summary of architecture changes} |9d. Update Feature State
phase: complete
completed_at: "{current ISO timestamp}"Update state.artifacts.architecture.version (incremented by merge-back).
Step 10: Present Final Results
============================================
Feature Complete: SNPR-{XXXX}
============================================
{title}
Stories Completed: {count}/{total}
Architecture Updated: v{old} → v{new}
Artifacts:
Brief: docs/features/SNPR-{XXXX}/brief.md
Spec: docs/features/SNPR-{XXXX}/spec.md
Arch Delta: docs/features/SNPR-{XXXX}/arch-delta.md
Stories: docs/features/SNPR-{XXXX}/stories/
Architecture Merge-Back:
{summary of components/models/APIs added or modified}
Feature logged in: docs/features/log.md
============================================
Next Steps
============================================
1. Review the merged architecture doc at docs/architecture.md
2. Run /sniper-feature "next feature" to add another feature
3. Run /sniper-status to see overall project state
4. Run /sniper-audit --target security to audit the new code
============================================IMPORTANT RULES
- The feature lifecycle runs as a single orchestrated session with user checkpoints between phases.
- Phase 1 (scoping) runs as a single agent — no team spawned. Keep it lightweight (2-3 minutes).
- Phase 2 (planning) spawns a 2-agent team. The architect is blocked by the PM.
- Phase 3 (story generation) runs as a single agent scoped to the feature.
- Phase 4 (sprint) spawns the standard sprint team but scoped to feature stories.
- Phase 5 (merge-back) runs as a single agent and merges the arch-delta into the main architecture doc.
- Features are tracked in
state.features[], NOT instate.phase_log(except for sprint entries). - The
arch_base_versionis recorded at scoping time for merge-back conflict detection. - Feature stories live in
docs/features/SNPR-{XXXX}/stories/, not indocs/stories/. - Feature sprints do NOT increment
state.current_sprint. - At every user checkpoint, the user can pause the feature with "cancel" and resume later with
--resume. - If
$ARGUMENTScontains "dry-run", perform Steps 0-2 only (scope the feature) and present the brief without proceeding further. - All file paths are relative to the project root.
