Skip to content
Template

SNIPER Custom Protocol Template

Source: custom-protocol.yaml

123 lines
yaml
# ─────────────────────────────────────────────────────────────
# SNIPER Custom Protocol Template
# ─────────────────────────────────────────────────────────────
# Copy this file to .sniper/protocols/<name>.yaml and customize.
# Run `sniper protocol validate <name>` to check your protocol.
# See built-in protocols in @sniper.ai/core/protocols/ for examples.
# ─────────────────────────────────────────────────────────────

# name (required): Unique identifier for your protocol.
# Used in --protocol flag: /sniper-flow --protocol my-protocol
name: my-protocol

# description (required): What this protocol accomplishes.
description: Describe the goal of your custom protocol

# phases (required): Ordered list of phases. Each phase runs sequentially.
# The protocol engine executes phases top-to-bottom, gating between each.
phases:
  # ── Phase 1: Plan ──────────────────────────────────────────
  - name: plan
    # description (required): What this phase accomplishes.
    description: Design the approach and break down into tasks

    # agents (required): Which agent personas to assign.
    # Available built-in agents: analyst, architect, product-manager,
    #   fullstack-dev, backend-dev, frontend-dev, qa-engineer,
    #   code-reviewer, retro-analyst
    agents:
      - architect

    # spawn_strategy (required): How to launch agents.
    #   "single" — one agent works alone
    #   "team"   — multiple agents coordinate via TeamCreate
    spawn_strategy: single

    # gate (optional): Quality gate evaluated before moving to next phase.
    # Omit to skip gating (like hotfix protocol).
    gate:
      # checklist: Name of checklist from packages/core/checklists/
      # Available: discover, plan, implement, review
      checklist: plan
      # human_approval: If true, a human must approve before proceeding.
      human_approval: true

    # outputs (optional): Expected artifacts this phase produces.
    # Used for tracking and checkpoint reporting.
    outputs:
      - .sniper/artifacts/{protocol_id}/design.md

  # ── Phase 2: Implement ─────────────────────────────────────
  - name: implement
    description: Build the feature according to the plan

    agents:
      - fullstack-dev
      - qa-engineer
    spawn_strategy: team

    # plan_approval (optional): If true, each agent must get their
    # execution plan approved before writing code.
    plan_approval: true

    gate:
      checklist: implement
      human_approval: false

    outputs:
      - source code changes
      - test files

    # coordination (optional): Constraints between agents in team phases.
    # Only meaningful when spawn_strategy is "team".
    # coordination:
    #   - between: [fullstack-dev, qa-engineer]
    #     topic: Tests must cover all new public APIs

  # ── Phase 3: Review ────────────────────────────────────────
  - name: review
    description: Code review and final quality check

    agents:
      - code-reviewer
    spawn_strategy: single

    gate:
      checklist: review
      human_approval: true

    outputs:
      - .sniper/artifacts/{protocol_id}/review-report.md

  # ── Phase 4: Retro (recommended) ──────────────────────────
  # Runs the retro-analyst to extract learnings and check
  # learning effectiveness. Replaces the old auto_retro flag.
  - name: retro
    description: Retrospective — extract learnings
    agents:
      - retro-analyst
    spawn_strategy: single
    gate:
      checklist: retro
      human_approval: false
    outputs:
      - .sniper/retros/{protocol_id}.yaml
      - .sniper/memory/learnings/

  # ── Phase 5: Curate (optional) ────────────────────────────
  # Consolidate, prune, and review learnings. Only runs when learning count
  # exceeds 30 or last curation was more than 5 protocols ago.
  # - name: curate
  #   description: Review and consolidate learnings
  #   agents:
  #     - memory-curator
  #   spawn_strategy: single
  #   skip_if: learning_count < 30 AND last_curation_within_5_protocols
  #   gate:
  #     checklist: none
  #     human_approval: false

# auto_retro (DEPRECATED — use a retro phase instead):
# Retained for backward compatibility. If set to true and no retro phase
# exists, the retro-analyst is spawned as a single-agent phase at completion.
# auto_retro: true