@sniper.ai/core 3.3.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +12 -10
  2. package/agents/analyst.md +3 -3
  3. package/agents/architect.md +9 -6
  4. package/agents/code-reviewer.md +9 -8
  5. package/agents/product-manager.md +18 -4
  6. package/agents/retro-analyst.md +5 -30
  7. package/checklists/define.yaml +23 -0
  8. package/checklists/design.yaml +38 -0
  9. package/checklists/discover.yaml +18 -8
  10. package/checklists/multi-faceted-review.yaml +3 -3
  11. package/checklists/plan.yaml +3 -6
  12. package/checklists/retro.yaml +0 -6
  13. package/checklists/review.yaml +2 -2
  14. package/config.template.yaml +0 -17
  15. package/package.json +1 -1
  16. package/protocols/explore.yaml +0 -1
  17. package/protocols/feature.yaml +19 -10
  18. package/protocols/full.yaml +23 -17
  19. package/protocols/hotfix.yaml +0 -1
  20. package/protocols/ingest.yaml +0 -1
  21. package/protocols/patch.yaml +0 -1
  22. package/protocols/refactor.yaml +0 -2
  23. package/schemas/checkpoint.schema.yaml +0 -16
  24. package/schemas/live-status.schema.yaml +0 -17
  25. package/schemas/protocol.schema.yaml +0 -5
  26. package/schemas/retro.schema.yaml +0 -14
  27. package/skills/sniper-flow/SKILL.md +12 -22
  28. package/skills/sniper-init/SKILL.md +0 -1
  29. package/skills/sniper-status/SKILL.md +1 -21
  30. package/templates/architecture.md +0 -7
  31. package/templates/checkpoint.yaml +0 -5
  32. package/templates/custom-protocol.yaml +2 -7
  33. package/templates/discovery-brief.md +16 -0
  34. package/templates/live-status.yaml +0 -5
  35. package/templates/prd.md +22 -0
  36. package/templates/story.md +0 -5
  37. package/schemas/cost.schema.yaml +0 -97
  38. package/schemas/velocity.schema.yaml +0 -52
  39. package/templates/cost.yaml +0 -23
  40. package/templates/velocity.yaml +0 -9
package/README.md CHANGED
@@ -9,7 +9,7 @@ Framework core for [SNIPER](https://sniperai.dev) -- provides agents, personas,
9
9
 
10
10
  SNIPER is an AI-powered project lifecycle framework for orchestrating Claude Code agent teams through structured phases. It takes projects from discovery through implementation using parallel agent teams, review gates, and domain-specific knowledge packs.
11
11
 
12
- A full lifecycle runs through four phases: **Discover** (research and analysis), **Plan** (architecture and design), **Implement** (code with worktree isolation), and **Review** (multi-faceted code review). Each phase spawns specialized agents defined by protocol state machines.
12
+ A full lifecycle runs through: **Discover** (research and analysis), **Define** (PRD and requirements), **Design** (architecture), **Solve** (story sharding), **Implement** (code with worktree isolation), **Review** (multi-faceted code review), and **Retro** (learnings and velocity). Each phase spawns specialized agents defined by protocol state machines.
13
13
 
14
14
  ## Overview
15
15
 
@@ -73,8 +73,8 @@ Domain-specific knowledge is provided separately by domain packs (e.g., `@sniper
73
73
 
74
74
  | Protocol | Phases | Description |
75
75
  |----------|--------|-------------|
76
- | `full` | discover → plan → implement → review | Complete project lifecycle |
77
- | `feature` | plan → implement → review | Incremental feature development |
76
+ | `full` | discover → definedesign → solve → implement → review → retro | Complete project lifecycle |
77
+ | `feature` | definedesign → solve → implement → review → retro | Incremental feature development |
78
78
  | `patch` | implement → review | Quick fix with review |
79
79
  | `ingest` | scan → document → extract | Codebase ingestion and convention extraction |
80
80
  | `explore` | discover | Exploratory analysis only |
@@ -94,12 +94,13 @@ Domain-specific knowledge is provided separately by domain packs (e.g., `@sniper
94
94
 
95
95
  ## Templates
96
96
 
97
- 14 artifact templates:
97
+ 15 artifact templates:
98
98
 
99
99
  | Template | Type | Description |
100
100
  |----------|------|-------------|
101
101
  | `architecture.md` | Markdown | System architecture document |
102
- | `spec.md` | Markdown | Project specification |
102
+ | `discovery-brief.md` | Markdown | Discovery research brief |
103
+ | `prd.md` | Markdown | Product requirements document |
103
104
  | `story.md` | Markdown | User story with acceptance criteria |
104
105
  | `codebase-overview.md` | Markdown | Codebase analysis summary |
105
106
  | `review-report.md` | Markdown | Standard review report |
@@ -108,19 +109,20 @@ Domain-specific knowledge is provided separately by domain packs (e.g., `@sniper
108
109
  | `workspace-config.yaml` | YAML | Workspace configuration |
109
110
  | `knowledge-manifest.yaml` | YAML | Knowledge base manifest |
110
111
  | `checkpoint.yaml` | YAML | Protocol checkpoint state |
111
- | `cost.yaml` | YAML | Token cost tracking |
112
112
  | `live-status.yaml` | YAML | Live protocol status |
113
- | `velocity.yaml` | YAML | Velocity calibration data |
114
113
  | `signal-record.yaml` | YAML | Signal event record |
115
114
 
116
115
  ## Checklists
117
116
 
118
- 9 quality gate checklists:
117
+ 11 quality gate checklists:
119
118
 
120
119
  | Checklist | Used by |
121
120
  |-----------|---------|
122
- | `discover` | full, explore protocols |
123
- | `plan` | full, feature protocols |
121
+ | `discover` | full protocol |
122
+ | `define` | full, feature protocols |
123
+ | `design` | full, feature protocols |
124
+ | `solve` | full, feature protocols |
125
+ | `plan` | (deprecated — use define + design) |
124
126
  | `implement` | full, feature, patch, refactor, hotfix protocols |
125
127
  | `review` | full, feature, patch, refactor protocols |
126
128
  | `multi-faceted-review` | Multi-model review mode |
package/agents/analyst.md CHANGED
@@ -13,11 +13,11 @@ You are a SNIPER analyst agent. You research, analyze, and produce discovery art
13
13
  2. **Requirements Elicitation** — Extract and clarify requirements from user input, docs, and existing code
14
14
  3. **Competitive Research** — Use web search to research approaches, libraries, and prior art
15
15
  4. **Risk Identification** — Surface technical risks, dependencies, and unknowns
16
- 5. **Spec Production** — Write discovery specs using the spec template
16
+ 5. **Discovery Brief Production** — Write a discovery brief that captures findings, constraints, and open questions
17
17
 
18
18
  ## Output Artifacts
19
19
 
20
- - `.sniper/artifacts/spec.md` — Discovery specification (use `spec.md` template)
20
+ - `.sniper/artifacts/discovery-brief.md` — Discovery brief: research findings, constraints, and open questions (NOT a spec — no design decisions)
21
21
  - `.sniper/artifacts/codebase-overview.md` — Architecture and convention analysis (use `codebase-overview.md` template)
22
22
 
23
23
  ## Rules
@@ -25,5 +25,5 @@ You are a SNIPER analyst agent. You research, analyze, and produce discovery art
25
25
  - Ground every finding in evidence — cite file paths, line numbers, or URLs
26
26
  - Distinguish facts from assumptions explicitly
27
27
  - Flag unknowns as open questions rather than guessing
28
- - Respect token budgets annotated in templates
29
28
  - Do NOT make architectural decisions — surface options with tradeoffs for the architect
29
+ - The discovery brief is research output, not a specification — frame it as findings and constraints, not design
@@ -17,17 +17,19 @@ You are a SNIPER architect agent. You design system architecture and produce tec
17
17
 
18
18
  ## Output Artifacts
19
19
 
20
- - `.sniper/artifacts/{protocol_id}/plan.md` — Architecture plan for this protocol run (use `architecture.md` template, 4000 token budget)
20
+ - `.sniper/artifacts/{protocol_id}/plan.md` — Architecture plan for this protocol run (use `architecture.md` template)
21
21
  - The `{protocol_id}` (e.g., `SNPR-20260307-a3f2`) is provided by the orchestrator when spawning you
22
22
  - This is a per-run snapshot; the master `docs/architecture.md` is updated separately by the doc-writer
23
23
 
24
24
  ## Decision Framework
25
25
 
26
- 1. Read the discovery spec and codebase overview first
27
- 2. Identify the smallest set of components that satisfies requirements
28
- 3. For each decision, document: context, options considered, decision, consequences
29
- 4. Validate designs against the stack defined in `.sniper/config.yaml`
30
- 5. Prefer boring technology choose well-understood patterns over novel ones
26
+ 1. Read the approved PRD (`.sniper/artifacts/{protocol_id}/prd.md`) as your primary input — design against these requirements
27
+ 2. Read the discovery brief (`.sniper/artifacts/discovery-brief.md`) and codebase overview for context
28
+ 3. Identify the smallest set of components that satisfies the PRD requirements
29
+ 4. For each decision, document: context, options considered, decision, consequences
30
+ 5. Validate designs against the stack defined in `.sniper/config.yaml`
31
+ 6. Prefer boring technology — choose well-understood patterns over novel ones
32
+ 7. Reference the PRD in your plan document
31
33
 
32
34
  ## Rules
33
35
 
@@ -35,4 +37,5 @@ You are a SNIPER architect agent. You design system architecture and produce tec
35
37
  - Every API contract must include error cases
36
38
  - Do NOT over-architect — design for current requirements, not hypothetical futures
37
39
  - Do NOT implement — produce designs only
40
+ - Do NOT add requirements — design against the approved PRD, nothing more
38
41
  - Flag any requirement that cannot be met within the current stack
@@ -54,19 +54,20 @@ Risk categories to evaluate:
54
54
 
55
55
  ## Spec Reconciliation
56
56
 
57
- After completing the code review, reconcile the spec with the implementation:
57
+ After completing the code review, reconcile the PRD with the implementation:
58
58
 
59
- 1. Compare `.sniper/artifacts/spec.md` requirements against actual implementation
60
- 2. If implementation differs from spec (intentionally or due to discoveries during implementation), update `.sniper/artifacts/spec.md` to reflect reality
61
- 3. Add a "Last reconciled: YYYY-MM-DD" line at the bottom of the spec
62
- 4. This is a reconciliation (spec tracks reality), NOT a compliance check
63
- 5. Only update if there are meaningful differences; don't touch the spec if it's already accurate
59
+ 1. Compare `.sniper/artifacts/{protocol_id}/prd.md` requirements against actual implementation
60
+ 2. If implementation differs from PRD (intentionally or due to discoveries during implementation), update the PRD to reflect reality
61
+ 3. Add a "Last reconciled: YYYY-MM-DD" line at the bottom of the PRD
62
+ 4. This is a reconciliation (docs track reality), NOT a compliance check
63
+ 5. Only update if there are meaningful differences; don't touch docs if they're already accurate
64
+ 6. Do NOT modify `.sniper/artifacts/discovery-brief.md` — that is the analyst's responsibility
64
65
 
65
66
  ## Rules
66
67
 
67
68
  - Categorize findings as: `blocking` (must fix), `suggestion` (should fix), `nit` (optional)
68
69
  - Cite specific file paths and line numbers for every finding
69
- - If the implementation matches the spec and passes all checks, say so clearly
70
+ - If the implementation matches the PRD and passes all checks, say so clearly
70
71
  - Do NOT nitpick style when conventions aren't established
71
72
  - Write the review report to `.sniper/artifacts/{protocol_id}/review-report.md` (the `{protocol_id}` is provided by the orchestrator)
72
- - Only modify master `.sniper/artifacts/spec.md` during spec reconciliation — never modify project source code
73
+ - Only modify `.sniper/artifacts/{protocol_id}/prd.md` during spec reconciliation — never modify project source code or the discovery brief
@@ -5,16 +5,30 @@ write_scope:
5
5
 
6
6
  # Product Manager
7
7
 
8
- You are a SNIPER product manager agent. You translate requirements into structured stories with EARS acceptance criteria.
8
+ You are a SNIPER product manager agent. You define product requirements and translate them into structured stories with EARS acceptance criteria.
9
9
 
10
10
  ## Responsibilities
11
11
 
12
- 1. **PRD Writing** — Produce product requirements documents from specs and architecture
12
+ 1. **PRD Writing** — Produce product requirements documents from the discovery brief
13
13
  2. **Story Creation** — Break PRDs into implementable stories with EARS acceptance criteria
14
14
  3. **Scope Management** — Clearly delineate in-scope vs out-of-scope items
15
15
  4. **Priority Ordering** — Order stories by dependency and user value
16
16
  5. **Success Metrics** — Define measurable success criteria for each requirement
17
17
 
18
+ ## Workflow
19
+
20
+ ### During `define` phase (PRD writing)
21
+ 1. Read the discovery brief (`.sniper/artifacts/discovery-brief.md`) as your primary input
22
+ 2. Produce a PRD that defines WHAT to build and WHY — not HOW
23
+ 3. The PRD **must** include a `## Out of Scope` section — this is not optional
24
+ 4. The PRD **must** include a `## Success Criteria` section with measurable outcomes
25
+ 5. Do NOT coordinate with or wait for the architect — you run before them
26
+
27
+ ### During `solve` phase (story creation)
28
+ 1. Read the approved PRD and architecture plan as inputs
29
+ 2. Break the PRD into implementable stories with EARS acceptance criteria
30
+ 3. Order stories by dependency, then user value
31
+
18
32
  ## EARS Criteria Format
19
33
 
20
34
  Use the EARS (Easy Approach to Requirements Syntax) patterns:
@@ -26,8 +40,8 @@ Use the EARS (Easy Approach to Requirements Syntax) patterns:
26
40
 
27
41
  ## Output Artifacts
28
42
 
29
- - `.sniper/artifacts/{protocol_id}/prd.md` — Product requirements for this protocol run (use `spec.md` template adapted for PRD)
30
- - `.sniper/artifacts/{protocol_id}/stories/*.md` — Individual stories (use `story.md` template, 1500 token budget each)
43
+ - `.sniper/artifacts/{protocol_id}/prd.md` — Product requirements for this protocol run (use `prd.md` template)
44
+ - `.sniper/artifacts/{protocol_id}/stories/*.md` — Individual stories (use `story.md` template)
31
45
  - The `{protocol_id}` (e.g., `SNPR-20260307-a3f2`) is provided by the orchestrator when spawning you
32
46
  - These are per-run snapshots that preserve the plan history
33
47
 
@@ -11,10 +11,9 @@ You are a SNIPER retro analyst agent. You run automated retrospectives after pro
11
11
 
12
12
  1. **Protocol Analysis** — Review what happened during the completed protocol execution
13
13
  2. **Pattern Extraction** — Identify what worked well and what didn't
14
- 3. **Metric Collection** — Gather token usage, duration, agent count, and gate results
14
+ 3. **Metric Collection** — Gather duration, agent count, and gate results
15
15
  4. **Recommendation Generation** — Suggest concrete improvements for next time
16
16
  5. **Retro Report** — Write structured retro to `.sniper/retros/`
17
- 6. **Velocity Tracking** — Record execution metrics to `.sniper/memory/velocity.yaml` for budget calibration
18
17
 
19
18
  ## Invocation
20
19
 
@@ -25,10 +24,9 @@ The orchestrator provides you with the `protocol_id` (e.g., `SNPR-20260307-a3f2`
25
24
 
26
25
  1. Read `.sniper/checkpoints/{protocol_id}-*` for the completed protocol's checkpoint history
27
26
  2. Read `.sniper/gates/` for gate results (pass/fail patterns)
28
- 3. Read `.sniper/cost.yaml` for token usage data
29
- 4. Read `.sniper/artifacts/{protocol_id}/meta.yaml` for protocol metadata
30
- 5. Analyze: What took the most tokens? Which gates failed first? Were there re-runs?
31
- 6. Write retro report to `.sniper/retros/{protocol_id}.yaml`
27
+ 3. Read `.sniper/artifacts/{protocol_id}/meta.yaml` for protocol metadata
28
+ 4. Analyze: Which gates failed first? Were there re-runs?
29
+ 5. Write retro report to `.sniper/retros/{protocol_id}.yaml`
32
30
 
33
31
  ## Retro Report Schema
34
32
 
@@ -41,7 +39,6 @@ duration_phases:
41
39
  gate_attempts: <count>
42
40
  gate_result: pass | fail
43
41
  metrics:
44
- total_tokens: <number>
45
42
  total_agents_spawned: <number>
46
43
  gate_pass_rate: <percentage>
47
44
  findings:
@@ -58,7 +55,7 @@ findings:
58
55
  - Be specific — cite actual data, not vague observations
59
56
  - Focus on actionable improvements, not blame
60
57
  - Write to `.sniper/retros/` only — never modify project code
61
- - Keep the report concise — under 1000 tokens
58
+ - Keep the report concise
62
59
  - Compare against previous retros if they exist to track trends
63
60
 
64
61
  ## Learning Extraction
@@ -132,25 +129,3 @@ During the retrospective, analyze external signals from both legacy and new stor
132
129
  recurrence: <count>
133
130
  ```
134
131
 
135
- ## Velocity Tracking
136
-
137
- After writing the retro report, update velocity data:
138
-
139
- 1. Read `.sniper/memory/velocity.yaml` (create if it doesn't exist)
140
- 2. Append a new execution record:
141
- ```yaml
142
- - protocol: <protocol_name>
143
- completed_at: <ISO 8601>
144
- wall_clock_seconds: <duration>
145
- tokens_used: <total_tokens>
146
- tokens_per_phase:
147
- <phase_name>: <tokens>
148
- ```
149
- 3. After 5+ executions of the same protocol, compute `calibrated_budgets`:
150
- - Collect all `tokens_used` values for that protocol
151
- - Calculate the p75 (75th percentile) value
152
- - Set `calibrated_budgets.<protocol>` to that value
153
- 4. Update `rolling_averages.<protocol>` with exponential moving average:
154
- - Formula: `new_avg = 0.3 * latest_tokens + 0.7 * previous_avg`
155
- - If no previous average, use the latest value
156
- 5. Write updated velocity data back to `.sniper/memory/velocity.yaml`
@@ -0,0 +1,23 @@
1
+ name: define
2
+ description: PRD quality gate — requirements completeness and scope clarity
3
+
4
+ checks:
5
+ - id: prd_produced
6
+ description: PRD document exists
7
+ check: file:.sniper/artifacts/{protocol_id}/prd.md
8
+ blocking: true
9
+
10
+ - id: requirements_defined
11
+ description: PRD has a Requirements section
12
+ check: grep:.sniper/artifacts/{protocol_id}/prd.md:"## Requirements"
13
+ blocking: true
14
+
15
+ - id: success_criteria_defined
16
+ description: PRD has measurable success criteria
17
+ check: grep:.sniper/artifacts/{protocol_id}/prd.md:"## Success Criteria"
18
+ blocking: true
19
+
20
+ - id: scope_boundaries
21
+ description: PRD explicitly defines what is out of scope
22
+ check: grep:.sniper/artifacts/{protocol_id}/prd.md:"## Out of Scope"
23
+ blocking: true # Out of scope must be explicit — this is where scope creep dies
@@ -0,0 +1,38 @@
1
+ name: design
2
+ description: Architecture quality gate — design completeness
3
+
4
+ checks:
5
+ - id: plan_produced
6
+ description: Architecture plan exists
7
+ check: file:.sniper/artifacts/{protocol_id}/plan.md
8
+ blocking: true
9
+
10
+ - id: has_context_section
11
+ description: Plan includes context and constraints
12
+ check: grep:.sniper/artifacts/{protocol_id}/plan.md:"## Context"
13
+ blocking: true
14
+
15
+ - id: has_decisions_section
16
+ description: Plan documents key architectural decisions
17
+ check: grep:.sniper/artifacts/{protocol_id}/plan.md:"## Decisions"
18
+ blocking: true
19
+
20
+ - id: has_components_section
21
+ description: Plan breaks down into components
22
+ check: grep:.sniper/artifacts/{protocol_id}/plan.md:"## Components"
23
+ blocking: true
24
+
25
+ - id: has_data_model_section
26
+ description: Plan defines data model (or explicitly states N/A)
27
+ check: grep:.sniper/artifacts/{protocol_id}/plan.md:"## Data Model"
28
+ blocking: false # Not every feature requires a data model
29
+
30
+ - id: references_prd
31
+ description: Plan references the approved PRD
32
+ check: grep:.sniper/artifacts/{protocol_id}/plan.md:"prd.md"
33
+ blocking: false
34
+
35
+ - id: open_questions
36
+ description: No unresolved open questions remain
37
+ check: "!grep:.sniper/artifacts/{protocol_id}/plan.md:\\*\\*TBD\\*\\*|\\*\\*TODO\\*\\*|\\*\\*OPEN\\*\\*"
38
+ blocking: false
@@ -2,19 +2,29 @@ name: discover
2
2
  description: Discovery phase quality gate
3
3
 
4
4
  checks:
5
- - id: spec_produced
6
- description: Discovery spec exists
7
- check: file:.sniper/artifacts/spec.md
5
+ - id: discovery_brief_produced
6
+ description: Discovery brief exists
7
+ check: file:.sniper/artifacts/discovery-brief.md
8
8
  blocking: true
9
9
 
10
- - id: scope_defined
11
- description: Spec defines in-scope requirements
12
- check: grep:.sniper/artifacts/spec.md:"## Requirements"
10
+ - id: findings_defined
11
+ description: Brief defines key findings
12
+ check: grep:.sniper/artifacts/discovery-brief.md:"## Findings"
13
13
  blocking: true
14
14
 
15
+ - id: constraints_identified
16
+ description: Brief identifies constraints
17
+ check: grep:.sniper/artifacts/discovery-brief.md:"## Constraints"
18
+ blocking: false
19
+
20
+ - id: risks_identified
21
+ description: Brief identifies risks
22
+ check: grep:.sniper/artifacts/discovery-brief.md:"## Risks"
23
+ blocking: false
24
+
15
25
  - id: out_of_scope_explicit
16
- description: Spec explicitly lists out-of-scope items
17
- check: grep:.sniper/artifacts/spec.md:"## Out of Scope"
26
+ description: Brief explicitly lists out-of-scope items
27
+ check: grep:.sniper/artifacts/discovery-brief.md:"## Out of Scope"
18
28
  blocking: false
19
29
 
20
30
  - id: codebase_overview
@@ -4,9 +4,9 @@ description: Multi-dimensional review gate — scope, standards, and risk
4
4
 
5
5
  checks:
6
6
  # Scope Validation — does the implementation match requirements?
7
- - id: scope_spec_match
8
- description: Implementation addresses all spec requirements
9
- check: file:.sniper/artifacts/spec.md
7
+ - id: scope_prd_match
8
+ description: PRD exists (scope validation is performed by code-reviewer agent)
9
+ check: file:.sniper/artifacts/{protocol_id}/prd.md
10
10
  blocking: true
11
11
 
12
12
  - id: scope_acceptance_criteria
@@ -1,5 +1,7 @@
1
1
  name: plan
2
- description: Planning phase quality gate
2
+ description: Planning phase quality gate (DEPRECATED — use define.yaml + design.yaml instead)
3
+ # DEPRECATED: This checklist is retained for backward compatibility with custom protocols
4
+ # that reference the combined "plan" phase. New protocols use separate "define" and "design" phases.
3
5
  # Note: {protocol_id} is resolved at gate-review time from the active checkpoint
4
6
 
5
7
  checks:
@@ -24,8 +26,3 @@ checks:
24
26
  description: No unresolved open questions remain
25
27
  check: "!grep:.sniper/artifacts/{protocol_id}/plan.md:\\*\\*TBD\\*\\*|\\*\\*TODO\\*\\*|\\*\\*OPEN\\*\\*"
26
28
  blocking: false
27
-
28
- - id: token_budget
29
- description: Architecture plan within character budget (~4000 tokens = 16000 chars)
30
- check: wc:.sniper/artifacts/{protocol_id}/plan.md:<16000
31
- blocking: false
@@ -7,9 +7,3 @@ checks:
7
7
  type: file_exists
8
8
  path: ".sniper/retros/{protocol_id}.yaml"
9
9
  blocking: true
10
-
11
- - id: velocity_updated
12
- description: Velocity data updated
13
- type: file_exists
14
- path: ".sniper/memory/velocity.yaml"
15
- blocking: true
@@ -24,6 +24,6 @@ checks:
24
24
  blocking: true
25
25
 
26
26
  - id: spec_reconciled
27
- description: Spec has been reconciled with implementation
28
- check: "grep:.sniper/artifacts/spec.md:Last reconciled:"
27
+ description: PRD has been reconciled with implementation
28
+ check: "grep:.sniper/artifacts/{protocol_id}/prd.md:Last reconciled:"
29
29
  blocking: false
@@ -44,16 +44,6 @@ routing:
44
44
  # Default protocol when auto-detect is ambiguous
45
45
  default: feature
46
46
 
47
- # Protocol token budgets (override protocol defaults)
48
- budgets:
49
- full: 2000000
50
- feature: 800000
51
- patch: 200000
52
- ingest: 1000000
53
- explore: 500000
54
- refactor: 600000
55
- hotfix: 100000
56
-
57
47
  # Trigger tables — map file patterns to agents or protocols
58
48
  # Example:
59
49
  # - pattern: "src/api/**"
@@ -64,12 +54,6 @@ routing:
64
54
  # protocol: full
65
55
  triggers: []
66
56
 
67
- # Cost enforcement
68
- cost:
69
- warn_threshold: 0.7 # Warn at 70% of budget
70
- soft_cap: 0.9 # Soft cap at 90% — agents must justify continuing
71
- hard_cap: 1.0 # Hard cap at 100% — stop execution
72
-
73
57
  # Review configuration
74
58
  review:
75
59
  multi_model: false # Enable multi-model review for gate checks
@@ -161,5 +145,4 @@ learning:
161
145
  visibility:
162
146
  live_status: true # Maintain .sniper/live-status.yaml
163
147
  checkpoints: true # Write phase checkpoints
164
- cost_tracking: true # Track token usage
165
148
  # auto_retro: true # DEPRECATED — use retro phase in protocols instead
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sniper.ai/core",
3
- "version": "3.3.1",
3
+ "version": "4.0.0",
4
4
  "description": "SNIPER framework core — agents, skills, protocols, checklists, templates, and hooks",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,6 +1,5 @@
1
1
  name: explore
2
2
  description: Exploratory analysis — understand a codebase or problem space
3
- budget: 500000 # 500K tokens
4
3
 
5
4
  phases:
6
5
  - name: discover
@@ -1,30 +1,40 @@
1
1
  name: feature
2
- description: Incremental feature — plan, implement, review
3
- budget: 800000 # 800K tokens
2
+ description: Incremental feature — define, design, solve, implement, review, retro
4
3
 
5
4
  phases:
6
- - name: plan
7
- description: Feature design and architecture
5
+ - name: define
6
+ description: Product requirements for the feature
8
7
  agents:
9
- - architect
10
8
  - product-manager
11
- spawn_strategy: sequential # Architect designs first, PM refines PRD from that
9
+ spawn_strategy: single
10
+ interactive_review: true # User reviews PRD before architecture
11
+ gate:
12
+ checklist: define
13
+ human_approval: true
14
+ outputs:
15
+ - .sniper/artifacts/{protocol_id}/prd.md
16
+
17
+ - name: design
18
+ description: Technical design against approved requirements
19
+ agents:
20
+ - architect
21
+ spawn_strategy: single
12
22
  interactive_review: true # User reviews architecture before story sharding
13
23
  gate:
14
- checklist: plan
24
+ checklist: design
15
25
  human_approval: true
16
26
  outputs:
17
27
  - .sniper/artifacts/{protocol_id}/plan.md
18
- - .sniper/artifacts/{protocol_id}/prd.md
19
28
 
20
29
  - name: solve
21
30
  description: Story creation from approved architecture
22
31
  agents:
23
32
  - product-manager
24
33
  spawn_strategy: single
34
+ interactive_review: true # User reviews story decomposition before implementation
25
35
  gate:
26
36
  checklist: solve
27
- human_approval: false
37
+ human_approval: true # Review story decomposition before implementation
28
38
  outputs:
29
39
  - .sniper/artifacts/{protocol_id}/stories/
30
40
 
@@ -64,5 +74,4 @@ phases:
64
74
  human_approval: false
65
75
  outputs:
66
76
  - .sniper/retros/{protocol_id}.yaml
67
- - .sniper/memory/velocity.yaml
68
77
  - .sniper/memory/learnings/
@@ -1,46 +1,53 @@
1
1
  name: full
2
2
  description: Complete project lifecycle — discovery through review
3
- budget: 2000000 # 2M tokens
4
3
 
5
4
  phases:
6
5
  - name: discover
7
- description: Research and analyze codebase to produce discovery spec
6
+ description: Research problem space, analyze codebase, identify constraints
8
7
  agents:
9
8
  - analyst
10
- spawn_strategy: single # One agent, no team needed
11
- interactive_review: true # User reviews spec before architecture begins
9
+ spawn_strategy: single
10
+ interactive_review: true # User reviews discovery brief before PRD begins
12
11
  gate:
13
12
  checklist: discover
14
13
  human_approval: true
15
14
  outputs:
16
- - .sniper/artifacts/spec.md # Living master doc
15
+ - .sniper/artifacts/discovery-brief.md # Living master doc
17
16
  - .sniper/artifacts/codebase-overview.md # Living master doc
18
17
 
19
- - name: plan
20
- description: Architecture design and PRD refinement
18
+ - name: define
19
+ description: Product requirements what to build, success criteria, scope boundaries
21
20
  agents:
22
- - architect
23
21
  - product-manager
24
- spawn_strategy: team # Multiple agents, use TeamCreate
22
+ spawn_strategy: single
23
+ interactive_review: true # User reviews PRD before architecture begins — highest-leverage gate
24
+ gate:
25
+ checklist: define
26
+ human_approval: true
27
+ outputs:
28
+ - .sniper/artifacts/{protocol_id}/prd.md
29
+
30
+ - name: design
31
+ description: Architecture design against approved PRD requirements
32
+ agents:
33
+ - architect
34
+ spawn_strategy: single
25
35
  interactive_review: true # User reviews architecture before story sharding
26
- coordination:
27
- - between: [architect, product-manager]
28
- topic: Architecture must be finalized before PRD is updated
29
36
  gate:
30
- checklist: plan
31
- human_approval: true # Human reviews architecture before stories are created
37
+ checklist: design
38
+ human_approval: true
32
39
  outputs:
33
40
  - .sniper/artifacts/{protocol_id}/plan.md
34
- - .sniper/artifacts/{protocol_id}/prd.md
35
41
 
36
42
  - name: solve
37
43
  description: Epic sharding and story creation from approved architecture
38
44
  agents:
39
45
  - product-manager
40
46
  spawn_strategy: single
47
+ interactive_review: true # User reviews story decomposition before implementation
41
48
  gate:
42
49
  checklist: solve
43
- human_approval: false
50
+ human_approval: true # Bad decomposition causes expensive rework — worth 5 minutes
44
51
  outputs:
45
52
  - .sniper/artifacts/{protocol_id}/stories/
46
53
 
@@ -83,7 +90,6 @@ phases:
83
90
  human_approval: false
84
91
  outputs:
85
92
  - .sniper/retros/{protocol_id}.yaml
86
- - .sniper/memory/velocity.yaml
87
93
  - .sniper/memory/learnings/
88
94
 
89
95
  - name: curate
@@ -1,6 +1,5 @@
1
1
  name: hotfix
2
2
  description: Critical fix — fastest path to production
3
- budget: 100000 # 100K tokens
4
3
 
5
4
  phases:
6
5
  - name: implement
@@ -1,6 +1,5 @@
1
1
  name: ingest
2
2
  description: Codebase ingestion — scan, document, extract conventions
3
- budget: 1000000 # 1M tokens
4
3
 
5
4
  phases:
6
5
  - name: scan
@@ -1,6 +1,5 @@
1
1
  name: patch
2
2
  description: Quick fix — implement and review only
3
- budget: 200000 # 200K tokens
4
3
 
5
4
  phases:
6
5
  - name: implement
@@ -1,6 +1,5 @@
1
1
  name: refactor
2
2
  description: Code improvement — analyze, refactor, and review
3
- budget: 600000 # 600K tokens
4
3
 
5
4
  phases:
6
5
  - name: analyze
@@ -50,5 +49,4 @@ phases:
50
49
  human_approval: false
51
50
  outputs:
52
51
  - .sniper/retros/{protocol_id}.yaml
53
- - .sniper/memory/velocity.yaml
54
52
  - .sniper/memory/learnings/
@@ -92,22 +92,6 @@ properties:
92
92
  - draft
93
93
  - complete
94
94
  description: Whether the artifact is a draft or complete.
95
- token_usage:
96
- type: object
97
- description: Token consumption metrics for this phase.
98
- properties:
99
- phase_tokens:
100
- type: integer
101
- minimum: 0
102
- description: Tokens consumed during this phase.
103
- cumulative_tokens:
104
- type: integer
105
- minimum: 0
106
- description: Total tokens consumed across all phases up to and including this one.
107
- budget_remaining:
108
- type: number
109
- minimum: 0
110
- description: Remaining token budget.
111
95
  commits:
112
96
  type: array
113
97
  description: Git commits made during this phase, used for logical revert.
@@ -126,23 +126,6 @@ properties:
126
126
  type: string
127
127
  format: date-time
128
128
  description: ISO 8601 timestamp of when the gate review completed.
129
- cost:
130
- type: object
131
- description: Current cost snapshot.
132
- properties:
133
- tokens_used:
134
- type: integer
135
- minimum: 0
136
- description: Total tokens consumed so far.
137
- budget:
138
- type: number
139
- minimum: 0
140
- description: Total token budget.
141
- percent:
142
- type: number
143
- minimum: 0
144
- maximum: 100
145
- description: Percentage of budget consumed.
146
129
  next_action:
147
130
  type: string
148
131
  description: Description of the next expected action or step.
@@ -6,7 +6,6 @@ type: object
6
6
  required:
7
7
  - name
8
8
  - description
9
- - budget
10
9
  - phases
11
10
  properties:
12
11
  name:
@@ -15,10 +14,6 @@ properties:
15
14
  description:
16
15
  type: string
17
16
  description: Human-readable description of the protocol's purpose.
18
- budget:
19
- type: integer
20
- minimum: 1
21
- description: Maximum token budget for the entire protocol execution.
22
17
  phases:
23
18
  type: array
24
19
  minItems: 1
@@ -82,18 +82,4 @@ properties:
82
82
  type: array
83
83
  items: { type: string }
84
84
  description: IDs of learnings created from this retro's findings.
85
- velocity:
86
- type: object
87
- description: Velocity metrics for this execution, used for budget calibration.
88
- properties:
89
- wall_clock_seconds:
90
- type: number
91
- minimum: 0
92
- description: Total wall clock time for the protocol execution in seconds.
93
- tokens_per_phase:
94
- type: object
95
- description: Token usage broken down by phase name.
96
- additionalProperties:
97
- type: integer
98
- minimum: 0
99
85
  additionalProperties: false
@@ -57,8 +57,7 @@ For each phase in the protocol, execute these 5 steps:
57
57
 
58
58
  1. Read protocol YAML for the current phase definition
59
59
  2. Read `.sniper/config.yaml` for agent config, ownership, commands
60
- 3. Check `.sniper/memory/velocity.yaml` for calibrated budget — use it if available, otherwise use configured budget. Log which source is used.
61
- 4. Compose agents per [Reference: Agent Composition](#reference-agent-composition)
60
+ 3. Compose agents per [Reference: Agent Composition](#reference-agent-composition)
62
61
 
63
62
  ### Execute
64
63
 
@@ -79,11 +78,10 @@ phase: <phase>
79
78
  timestamp: <ISO 8601>
80
79
  status: completed | failed
81
80
  agents: [status per agent]
82
- token_usage: [phase + cumulative]
83
81
  commits: [git SHAs produced]
84
82
  ```
85
83
 
86
- Update `.sniper/live-status.yaml` with current phase, agent statuses, and cost percentage.
84
+ Update `.sniper/live-status.yaml` with current phase and agent statuses.
87
85
 
88
86
  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.
89
87
 
@@ -107,25 +105,15 @@ After the `solve` phase completes, populate the `stories` array in `.sniper/live
107
105
 
108
106
  1. Write final checkpoint
109
107
  2. Update `.sniper/live-status.yaml` with `status: completed`
110
- 3. Update `.sniper/artifacts/{protocol_id}/meta.yaml` with final status, token usage, commits, agents used
108
+ 3. Update `.sniper/artifacts/{protocol_id}/meta.yaml` with final status, commits, agents used
111
109
  4. Update `.sniper/artifacts/registry.md` entry from `in_progress` to `completed`
112
- 5. Present summary: phases completed, gate results, token usage, learnings created
110
+ 5. Present summary: phases completed, gate results, learnings created
113
111
  6. **Backward compatibility:** If the protocol has `auto_retro: true` but no `retro` phase in its phases list (custom protocols), spawn retro-analyst as a single-agent phase before completing
114
112
 
115
- ## Cost Tracking
116
-
117
- Maintain `.sniper/cost.yaml` throughout execution. At each checkpoint:
118
- - `warn_threshold` → log warning, continue
119
- - `soft_cap` → pause, ask user whether to continue
120
- - `hard_cap` → checkpoint and stop gracefully
121
-
122
- Read thresholds from `.sniper/config.yaml` cost section.
123
-
124
113
  ## Rules
125
114
 
126
115
  - ALWAYS generate a protocol ID and create `.sniper/artifacts/{protocol_id}/` before spawning any agent
127
116
  - ALWAYS checkpoint between phases
128
- - ALWAYS respect token budgets
129
117
  - ALWAYS present the plan for interactive review when `interactive_review: true`
130
118
  - NEVER skip a gate — every phase transition goes through its gate
131
119
  - NEVER advance past a failed blocking gate check
@@ -200,10 +188,12 @@ For agents working in worktrees (after all implementation agents complete):
200
188
 
201
189
  When a phase has `interactive_review: true`:
202
190
 
203
- 1. Read produced artifacts from `.sniper/artifacts/{protocol_id}/` (e.g., `spec.md`, `plan.md`, `prd.md`)
191
+ 1. Read produced artifacts from `.sniper/artifacts/` or `.sniper/artifacts/{protocol_id}/` as appropriate
204
192
  2. Present a structured summary appropriate to the phase:
205
- - **discover:** scope, requirements, key findings, open questions
206
- - **plan:** key architectural decisions, component overview, data model, trade-offs
193
+ - **discover:** findings, constraints, codebase landscape, open questions
194
+ - **define:** requirements, success criteria, scope boundaries, out-of-scope items
195
+ - **design:** key architectural decisions, component overview, data model, trade-offs
196
+ - **solve:** story list, dependencies, acceptance criteria summary
207
197
  3. Offer options:
208
198
  - **Approve** — continue to next phase
209
199
  - **Request changes** — describe changes (architect/PM will revise, then re-present)
@@ -215,9 +205,9 @@ When a phase has `interactive_review: true`:
215
205
  > **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`.
216
206
 
217
207
  When `auto_retro: true` and no `retro` phase exists in the protocol:
218
- 1. Spawn `retro-analyst` as a single-agent phase with: protocol ID, checkpoint history, gate results, cost data
219
- 2. The retro-analyst writes a report to `.sniper/retros/{protocol_id}.yaml`, extracts learnings to `.sniper/memory/learnings/`, updates `.sniper/memory/velocity.yaml`, and checks effectiveness of previously applied learnings
220
- 3. Run the retro gate checklist (retro report exists + velocity updated)
208
+ 1. Spawn `retro-analyst` as a single-agent phase with: protocol ID, checkpoint history, gate results
209
+ 2. The retro-analyst writes a report to `.sniper/retros/{protocol_id}.yaml`, extracts learnings to `.sniper/memory/learnings/`, and checks effectiveness of previously applied learnings
210
+ 3. Run the retro gate checklist (retro report exists)
221
211
 
222
212
  ## Reference: Review Gate Feedback Capture
223
213
 
@@ -76,7 +76,6 @@ Create the following directory structure:
76
76
  memory/
77
77
  learnings/ ← Unified learning store (replaces signals/)
78
78
  signals/ ← Legacy — kept for backward compat, migrated by memory-curator
79
- velocity.yaml
80
79
  archive/ ← Deprecated learnings archived here
81
80
  .claude/
82
81
  agents/ ← Copied from @sniper.ai/core/agents/
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sniper-status
3
- description: Show current SNIPER protocol progress and cost
3
+ description: Show current SNIPER protocol progress
4
4
  arguments: []
5
5
  ---
6
6
 
@@ -15,7 +15,6 @@ Display the current state of SNIPER in this project.
15
15
  Read the following files (skip if they don't exist):
16
16
  - `.sniper/config.yaml` — Project configuration
17
17
  - `.sniper/live-status.yaml` — Active protocol progress
18
- - `.sniper/cost.yaml` — Token usage tracking
19
18
 
20
19
  If `.sniper/config.yaml` doesn't exist, display: "SNIPER is not initialized. Run `/sniper-init` first."
21
20
 
@@ -34,21 +33,10 @@ Format and display:
34
33
  - Agent status per active phase
35
34
  - Gate results for completed phases
36
35
 
37
- **Cost Summary** (if tracking enabled):
38
- - Tokens used vs budget
39
- - Budget percentage with visual bar
40
- - Warning if approaching soft/hard cap
41
-
42
36
  **Recent Activity**:
43
37
  - Last 3 checkpoints with timestamps
44
38
  - Last gate result
45
39
 
46
- **Velocity Trends** (if velocity data exists):
47
- - Read `.sniper/memory/velocity.yaml`
48
- - Show last 5 executions per protocol with tokens used
49
- - Show calibrated budget vs configured budget comparison
50
- - Show trend direction: ↑ (increasing usage), ↓ (decreasing usage), → (stable)
51
-
52
40
  ### 3. Format Output
53
41
 
54
42
  Use clear formatting:
@@ -63,17 +51,9 @@ Phase: implement [===========-----] 68%
63
51
 
64
52
  Gates:
65
53
  plan: PASS (2025-01-15)
66
-
67
- Cost: 245K / 800K tokens (31%)
68
- [======--------------] 31%
69
-
70
- Velocity:
71
- feature: 612K avg (calibrated: 750K, configured: 800K) →
72
- patch: 145K avg (calibrated: 180K, configured: 200K) ↓
73
54
  ```
74
55
 
75
56
  ## Rules
76
57
 
77
58
  - Read-only — this skill never modifies any files
78
59
  - If no protocol is active, show config summary only
79
- - If cost tracking is disabled, skip cost section
@@ -1,23 +1,16 @@
1
1
  # Architecture
2
- <!-- Budget: 4000 tokens max -->
3
2
 
4
3
  ## Context
5
- <!-- ~400 tokens: Technical context, constraints, existing system landscape -->
6
4
 
7
5
  ## Decisions
8
- <!-- ~800 tokens: Key architectural decisions with rationale -->
9
6
  <!-- For each decision: Context | Options Considered | Decision | Consequences -->
10
7
 
11
8
  ## Components
12
- <!-- ~1000 tokens: Component breakdown with responsibilities -->
13
9
  <!-- For each component: Name | Responsibility | Dependencies | Owner -->
14
10
 
15
11
  ## Data Model
16
- <!-- ~600 tokens: Core entities and relationships -->
17
12
 
18
13
  ## API Contracts
19
- <!-- ~800 tokens: Key API interfaces including error cases -->
20
14
  <!-- For each endpoint: Method | Path | Request | Response | Errors -->
21
15
 
22
16
  ## Infrastructure
23
- <!-- ~400 tokens: Deployment, scaling, monitoring considerations -->
@@ -19,9 +19,4 @@ artifacts_produced: []
19
19
  # - path: .sniper/artifacts/spec.md
20
20
  # status: draft | complete
21
21
 
22
- token_usage:
23
- phase_tokens: 0
24
- cumulative_tokens: 0
25
- budget_remaining: 0
26
-
27
22
  notes: ""
@@ -13,10 +13,6 @@ name: my-protocol
13
13
  # description (required): What this protocol accomplishes.
14
14
  description: Describe the goal of your custom protocol
15
15
 
16
- # budget (required): Maximum token budget for the entire execution.
17
- # Common ranges: 100K (hotfix), 800K (feature), 2M (full lifecycle)
18
- budget: 500000
19
-
20
16
  # phases (required): Ordered list of phases. Each phase runs sequentially.
21
17
  # The protocol engine executes phases top-to-bottom, gating between each.
22
18
  phases:
@@ -94,10 +90,10 @@ phases:
94
90
  - .sniper/artifacts/{protocol_id}/review-report.md
95
91
 
96
92
  # ── Phase 4: Retro (recommended) ──────────────────────────
97
- # Runs the retro-analyst to extract learnings, update velocity, and check
93
+ # Runs the retro-analyst to extract learnings and check
98
94
  # learning effectiveness. Replaces the old auto_retro flag.
99
95
  - name: retro
100
- description: Retrospective — extract learnings and update velocity
96
+ description: Retrospective — extract learnings
101
97
  agents:
102
98
  - retro-analyst
103
99
  spawn_strategy: single
@@ -106,7 +102,6 @@ phases:
106
102
  human_approval: false
107
103
  outputs:
108
104
  - .sniper/retros/{protocol_id}.yaml
109
- - .sniper/memory/velocity.yaml
110
105
  - .sniper/memory/learnings/
111
106
 
112
107
  # ── Phase 5: Curate (optional) ────────────────────────────
@@ -0,0 +1,16 @@
1
+ # Discovery Brief
2
+ <!-- This is research output, not a specification. Frame as findings and constraints, not design decisions. -->
3
+
4
+ ## Context
5
+
6
+ ## Findings
7
+ <!-- Ground every finding in evidence — cite file paths, line numbers, or URLs -->
8
+
9
+ ## Constraints
10
+
11
+ ## Risks
12
+
13
+ ## Out of Scope
14
+
15
+ ## Open Questions
16
+ <!-- Distinguish facts from assumptions explicitly -->
@@ -24,9 +24,4 @@ gate_results: []
24
24
  # result: pass
25
25
  # timestamp: ""
26
26
 
27
- cost:
28
- tokens_used: 0
29
- budget: 0
30
- percent: 0
31
-
32
27
  next_action: "" # Human-readable description of what's next
@@ -0,0 +1,22 @@
1
+ # Product Requirements Document
2
+ <!-- This defines WHAT to build and WHY — not HOW. Architecture comes later. -->
3
+
4
+ ## Context
5
+
6
+ ## Problem
7
+
8
+ ## Users
9
+
10
+ ## Requirements
11
+ <!-- Use: "The <system> shall <action>" for each requirement -->
12
+
13
+ ### Functional Requirements
14
+
15
+ ### Non-Functional Requirements
16
+
17
+ ## Out of Scope
18
+ <!-- This section is mandatory — scope creep dies here -->
19
+
20
+ ## Success Criteria
21
+
22
+ ## Open Questions
@@ -6,16 +6,12 @@ completed_at:
6
6
  ---
7
7
 
8
8
  # Story: [TITLE]
9
- <!-- Budget: 1500 tokens max -->
10
9
 
11
10
  ## Context
12
- <!-- ~200 tokens: Why this story exists, link to architecture/spec -->
13
11
 
14
12
  ## Task
15
- <!-- ~400 tokens: What needs to be done, specific and actionable -->
16
13
 
17
14
  ## Acceptance Criteria
18
- <!-- ~600 tokens: EARS-format criteria -->
19
15
  <!-- Each criterion must be independently testable -->
20
16
 
21
17
  1. When [event], the system shall [action]
@@ -23,4 +19,3 @@ completed_at:
23
19
  3. If [condition], then the system shall [action]
24
20
 
25
21
  ## Technical Notes
26
- <!-- ~300 tokens: Implementation hints, relevant code locations, gotchas -->
@@ -1,97 +0,0 @@
1
- $schema: "https://json-schema.org/draft/2020-12/schema"
2
- $id: "https://sniper.ai/schemas/cost"
3
- title: Cost Tracking
4
- description: Schema for SNIPER cost tracking that monitors token usage and budget across phases.
5
- type: object
6
- required:
7
- - protocol
8
- - started_at
9
- - budget
10
- properties:
11
- protocol:
12
- type: string
13
- description: The SNIPER protocol version identifier.
14
- started_at:
15
- type: string
16
- format: date-time
17
- description: ISO 8601 timestamp of when cost tracking began.
18
- budget:
19
- type: number
20
- minimum: 0
21
- description: Total token budget allocated for the project.
22
- phases:
23
- type: array
24
- description: Per-phase cost breakdown.
25
- items:
26
- type: object
27
- required:
28
- - name
29
- properties:
30
- name:
31
- type: string
32
- description: Phase name (e.g. discover, plan, implement, review).
33
- started_at:
34
- type: string
35
- format: date-time
36
- description: ISO 8601 timestamp of when this phase started.
37
- completed_at:
38
- type: string
39
- format: date-time
40
- description: ISO 8601 timestamp of when this phase completed.
41
- tokens_used:
42
- type: integer
43
- minimum: 0
44
- description: Total tokens consumed during this phase.
45
- agents:
46
- type: array
47
- description: Per-agent cost breakdown within this phase.
48
- items:
49
- type: object
50
- required:
51
- - name
52
- - tokens_used
53
- properties:
54
- name:
55
- type: string
56
- description: Agent persona name.
57
- tokens_used:
58
- type: integer
59
- minimum: 0
60
- description: Tokens consumed by this agent.
61
- totals:
62
- type: object
63
- description: Aggregate cost totals.
64
- properties:
65
- tokens_used:
66
- type: integer
67
- minimum: 0
68
- description: Total tokens consumed across all phases.
69
- budget_remaining:
70
- type: number
71
- minimum: 0
72
- description: Remaining token budget.
73
- budget_percent_used:
74
- type: number
75
- minimum: 0
76
- maximum: 100
77
- description: Percentage of budget consumed.
78
- enforcement:
79
- type: object
80
- description: Budget enforcement thresholds expressed as fractions of the total budget.
81
- properties:
82
- warn_threshold:
83
- type: number
84
- minimum: 0
85
- maximum: 1
86
- description: Fraction of budget at which a warning is issued.
87
- soft_cap:
88
- type: number
89
- minimum: 0
90
- maximum: 1
91
- description: Fraction of budget at which soft enforcement begins (e.g. require confirmation).
92
- hard_cap:
93
- type: number
94
- minimum: 0
95
- maximum: 1
96
- description: Fraction of budget at which execution is halted.
97
- additionalProperties: false
@@ -1,52 +0,0 @@
1
- $schema: "https://json-schema.org/draft/2020-12/schema"
2
- $id: "https://sniper.ai/schemas/velocity"
3
- title: Velocity
4
- description: Protocol execution history and calibrated budgets for adaptive budget selection.
5
- type: object
6
- required:
7
- - executions
8
- properties:
9
- executions:
10
- type: array
11
- description: History of protocol executions with timing and token data.
12
- items:
13
- type: object
14
- required:
15
- - protocol
16
- - completed_at
17
- - tokens_used
18
- properties:
19
- protocol:
20
- type: string
21
- description: Protocol name that was executed.
22
- completed_at:
23
- type: string
24
- format: date-time
25
- description: ISO 8601 timestamp of when the execution completed.
26
- wall_clock_seconds:
27
- type: number
28
- minimum: 0
29
- description: Wall clock duration of the execution in seconds.
30
- tokens_used:
31
- type: integer
32
- minimum: 0
33
- description: Total tokens consumed during the execution.
34
- tokens_per_phase:
35
- type: object
36
- description: Token usage broken down by phase name.
37
- additionalProperties:
38
- type: integer
39
- minimum: 0
40
- calibrated_budgets:
41
- type: object
42
- description: p75 of token usage from last 5+ executions, keyed by protocol name.
43
- additionalProperties:
44
- type: integer
45
- minimum: 0
46
- rolling_averages:
47
- type: object
48
- description: Exponential moving average of token usage, keyed by protocol name.
49
- additionalProperties:
50
- type: number
51
- minimum: 0
52
- additionalProperties: false
@@ -1,23 +0,0 @@
1
- # Cost tracking for protocol execution
2
- protocol: ""
3
- started_at: ""
4
- budget: 0
5
-
6
- phases: []
7
- # - name: discover
8
- # started_at: ""
9
- # completed_at: ""
10
- # tokens_used: 0
11
- # agents:
12
- # - name: analyst
13
- # tokens_used: 0
14
-
15
- totals:
16
- tokens_used: 0
17
- budget_remaining: 0
18
- budget_percent_used: 0
19
-
20
- enforcement:
21
- warn_threshold: 0.7 # Warn at 70% budget
22
- soft_cap: 0.9 # Soft cap at 90% — agents must justify continuation
23
- hard_cap: 1.0 # Hard cap at 100% — stop execution
@@ -1,9 +0,0 @@
1
- # Velocity — protocol execution history and calibrated budgets
2
- # Auto-populated by retro-analyst after each protocol completion
3
- # Read by /sniper-flow for adaptive budget selection
4
-
5
- executions: []
6
-
7
- calibrated_budgets: {}
8
-
9
- rolling_averages: {}