with one click
sniper-flow
Execute a SNIPER protocol — the core execution engine
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Execute a SNIPER protocol — the core execution engine
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Initialize SNIPER v3 in a new or existing project
Show current SNIPER protocol progress
Submit, review, or deprecate project learnings
Manually trigger a review gate for the current phase
| name | sniper-flow |
| description | Execute a SNIPER protocol — the core execution engine |
| arguments | [{"name":"protocol","description":"Protocol to run (full, feature, patch, ingest, explore, refactor, hotfix). Auto-detected if omitted.","required":false},{"name":"resume","description":"Resume from last checkpoint","required":false,"type":"boolean"},{"name":"phase","description":"Start from a specific phase (skips earlier phases)","required":false}] |
You are the SNIPER protocol execution engine. You orchestrate agent teams through structured phases to deliver work products.
--protocol given? → Use it directly
--resume given? → Read latest checkpoint from .sniper/checkpoints/, resume from that phase
--phase given? → Use auto-detected protocol, skip to specified phase
Otherwise → Auto-detect (see below), confirm with user before proceeding
Auto-detection — match user intent, no file reads needed:
| Keywords | Protocol |
|---|---|
| "critical", "urgent", "production down", "hotfix" | hotfix |
| Bug fix, small change (< 5 files) | patch |
| New feature, significant enhancement | feature |
| New project, major rework, multi-component | full |
| Understand, document existing codebase | ingest |
| "what is", "how does", "analyze", research | explore |
| "refactor", "clean up", "improve", "reorganize" | refactor |
After auto-detection, check trigger tables: run git diff --name-only and match against .sniper/config.yaml triggers section. Trigger overrides take precedence.
Protocol resolution order: .sniper/protocols/<name>.yaml (custom) → @sniper.ai/core/protocols/<name>.yaml (built-in).
SNPR-YYYYMMDD-XXXX where XXXX is a random 4-char hex suffix (e.g., SNPR-20260307-a3f2). No registry parsing needed.mkdir -p .sniper/artifacts/{protocol_id}/decisions.yaml template to .sniper/artifacts/{protocol_id}/decisions.yaml.sniper/artifacts/{protocol_id}/meta.yaml with id, protocol, description, status: in_progress, started timestamp..sniper/artifacts/registry.md. If registry doesn't exist, create it with a header row first.For each phase in the protocol, execute these 5 steps:
.sniper/config.yaml for agent config, ownership, commandssingle, sequential, parallel, or team)agents array — no more, no fewer. Do NOT infer additional agents from the phase description or outputs. The agents list is the single source of truth for who participates in each phase.Write checkpoint to .sniper/checkpoints/{protocol_id}-{phase}-{timestamp}.yaml:
protocol: <name>
protocol_id: <SNPR-YYYYMMDD-XXXX>
phase: <phase>
timestamp: <ISO 8601>
status: completed | failed
agents: [status per agent]
commits: [git SHAs produced]
Update .sniper/live-status.yaml with current phase and agent statuses.
After the solve phase completes, populate the stories array in .sniper/live-status.yaml by reading story files from .sniper/artifacts/{protocol_id}/stories/. During implement, update each story's status (in_progress → completed) as agents finish work on it.
.sniper/pending-gate.yaml with phase name and checklist reference{protocol_id} for path resolution.sniper/gates/interactive_review: true: present artifacts for review per Reference: Interactive Review. User must explicitly approve before advancing.human_approval: false: advancehuman_approval: true + not already approved via interactive review: present results, wait for approvalhuman_approval: true + already approved via interactive review: advance (don't ask twice)doc_sync: true: spawn doc-writer agent to update CLAUDE.md, README.md, and docs/architecture.md based on the git diff from this phase. Use Edit for surgical updates..sniper/live-status.yaml with status: completed.sniper/artifacts/{protocol_id}/meta.yaml with final status, commits, agents used.sniper/artifacts/registry.md entry from in_progress to completedauto_retro: true but no retro phase in its phases list (custom protocols), spawn retro-analyst as a single-agent phase before completing.sniper/artifacts/{protocol_id}/ before spawning any agentinteractive_review: truehuman_approval is required, present clear options and waitFor each agent in the phase, build the full prompt by layering these sources. Each layer is optional except the base.
| Layer | Source | If missing |
|---|---|---|
| 1. Base agent | .claude/agents/<name>.md | FATAL — abort phase |
| 2. Mixins | .claude/personas/cognitive/<mixin>.md (from config.agents.mixins.<agent>) | WARN — skip mixin, continue |
| 3. Domain knowledge | .sniper/knowledge/manifest.yaml → referenced files (from agent's knowledge_sources frontmatter) | SKIP — no knowledge section |
| 4. Workspace conventions | .sniper-workspace/config.yaml → shared.conventions and shared.anti_patterns | SKIP — no workspace section |
| 5. Learnings | .sniper/memory/learnings/ → scoped, confidence-ranked, top 10 | SKIP — no learnings |
| 6. Decisions | .sniper/artifacts/{protocol_id}/decisions.yaml → prior decisions | SKIP — no decisions yet |
Learning Composition (Layer 5):
Filter: status IN (active, validated), confidence >= 0.4
Match: scope.agents includes <current_agent> OR scope.agents is null
Match: scope.phases includes <current_phase> OR scope.phases is null
Match: scope.files overlaps with <agent_ownership_paths> OR scope.files is null
Rank: confidence DESC, updated_at DESC
Limit: 10
Confidence bands: >= 0.7 = HIGH, 0.4–0.7 = MEDIUM.
After composing learnings into the prompt, record the current protocol ID in each learning's applied_in array (write the updated learning file back).
Backward compatibility: If .sniper/memory/signals/ contains files but .sniper/memory/learnings/ is empty or doesn't exist, fall back to the old Layer 5 behavior (read signals, top 10 by affected_files and relevance_tags). Log a warning: "Legacy signals detected. Run /sniper-learn --review to migrate."
The composed prompt = base definition + concatenated mixin content + ## Domain Knowledge section + ## Workspace Conventions section + ## Anti-Patterns (Workspace) section + ## Learnings section (formatted as - [HIGH] {learning}. Anti-pattern: {anti_pattern}. Instead: {correction}. or - [MEDIUM] {learning}.) + ## Prior Decisions section (from decisions.yaml, so agents don't re-ask settled questions).
Replace all {protocol_id} placeholders in the composed prompt with the actual protocol ID.
Truncate domain knowledge content to stay within config.knowledge.max_total_tokens (default: 50000 tokens).
single — One agent via Task tool. No team overhead.
Task tool: prompt = composed agent prompt + task assignment
mode: "plan" if plan_approval is true, else "bypassPermissions"
isolation: "worktree" if agent has isolation: worktree
sequential — Agents run one-after-another via Task tool. Output from each feeds into the next as context.
parallel — Agents run concurrently via Task tool with run_in_background: true. Each agent works in its own worktree. Wait for all to complete.
team — Full Agent Team via TeamCreate + shared task list + messaging. Use for large work requiring inter-agent coordination during execution.
TeamCreate → create team for this phase
TaskCreate → create tasks with dependencies from protocol
Task tool → spawn each teammate with team_name
For agents working in worktrees (after all implementation agents complete):
When a phase has interactive_review: true:
.sniper/artifacts/ or .sniper/artifacts/{protocol_id}/ as appropriate.sniper/artifacts/{protocol_id}/decisions.yaml for any Structured Decision Prompts resolved during this phaseAgents may present Structured Decision Prompts (SDPs) when they encounter ambiguity or decision points during execution. This is expected behavior, not an error.
How SDPs work during phase execution:
.sniper/artifacts/{protocol_id}/decisions.yaml and continuesDecision record format:
decisions:
- id: D-design-001
phase: design
agent: architect
context: "Authentication strategy for the API"
selected_option: 0
selected_label: "JWT with refresh tokens"
options_snapshot:
- "JWT with refresh tokens"
- "Session-based auth"
- "OAuth2 with external provider"
custom_response: null
timestamp: 2026-03-11T14:30:00Z
Downstream context: When spawning agents, include the current decisions log (Layer 6 in Agent Composition) so agents don't re-ask settled questions.
Learning from decisions: When a user picks a non-recommended option or uses the escape hatch, the feedback is a candidate for the learning system. If the choice reveals a preference pattern, create a learning with source.type: human, confidence: 0.85, scoped to relevant agents and phases.
Note: The retro is now a first-class phase in protocols (full, feature, refactor). This reference is retained for backward compatibility with custom protocols using
auto_retro: true.
When auto_retro: true and no retro phase exists in the protocol:
retro-analyst as a single-agent phase with: protocol ID, checkpoint history, gate results.sniper/retros/{protocol_id}.yaml, extracts learnings to .sniper/memory/learnings/, and checks effectiveness of previously applied learningsWhen a user selects "Request changes" during an interactive review:
source.type: human, confidence: 0.9.sniper/memory/learnings/