@sniper.ai/core 3.4.0 → 4.1.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.
- package/README.md +16 -14
- package/agents/analyst.md +7 -1
- package/agents/architect.md +9 -1
- package/agents/backend-dev.md +7 -0
- package/agents/code-reviewer.md +7 -0
- package/agents/frontend-dev.md +7 -0
- package/agents/fullstack-dev.md +8 -0
- package/agents/lead-orchestrator.md +9 -0
- package/agents/product-manager.md +9 -1
- package/agents/retro-analyst.md +32 -29
- package/checklists/define.yaml +0 -5
- package/checklists/design.yaml +0 -5
- package/checklists/plan.yaml +0 -5
- package/checklists/retro.yaml +0 -6
- package/config.template.yaml +0 -17
- package/package.json +1 -1
- package/personas/cognitive/structured-decisions.md +41 -0
- package/protocols/explore.yaml +0 -1
- package/protocols/feature.yaml +0 -2
- package/protocols/full.yaml +0 -2
- package/protocols/hotfix.yaml +0 -1
- package/protocols/ingest.yaml +0 -1
- package/protocols/patch.yaml +0 -1
- package/protocols/refactor.yaml +0 -2
- package/schemas/checkpoint.schema.yaml +0 -16
- package/schemas/decision-prompt.schema.yaml +86 -0
- package/schemas/live-status.schema.yaml +0 -17
- package/schemas/protocol.schema.yaml +0 -5
- package/schemas/retro.schema.yaml +0 -14
- package/skills/sniper-flow/SKILL.md +50 -25
- package/skills/sniper-init/SKILL.md +0 -1
- package/skills/sniper-status/SKILL.md +1 -21
- package/templates/architecture.md +0 -7
- package/templates/checkpoint.yaml +0 -5
- package/templates/custom-protocol.yaml +2 -7
- package/templates/decisions.yaml +5 -0
- package/templates/discovery-brief.md +0 -7
- package/templates/live-status.yaml +0 -5
- package/templates/prd.md +0 -8
- package/templates/story.md +0 -5
- package/schemas/cost.schema.yaml +0 -97
- package/schemas/velocity.schema.yaml +0 -52
- package/templates/cost.yaml +0 -23
- 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: **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
|
|
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 memory). Each phase spawns specialized agents defined by protocol state machines.
|
|
13
13
|
|
|
14
14
|
## Overview
|
|
15
15
|
|
|
@@ -24,13 +24,13 @@ npm install @sniper.ai/core
|
|
|
24
24
|
## Contents
|
|
25
25
|
|
|
26
26
|
```
|
|
27
|
-
├── agents/ # Agent definitions (
|
|
27
|
+
├── agents/ # Agent definitions (13 agents)
|
|
28
28
|
├── personas/
|
|
29
29
|
│ └── cognitive/ # Cognitive mixins (3 mixins)
|
|
30
|
-
├── skills/ # Slash command definitions (
|
|
30
|
+
├── skills/ # Slash command definitions (5 skills)
|
|
31
31
|
├── protocols/ # Protocol state machines (7 protocols)
|
|
32
|
-
├── templates/ # Artifact templates (
|
|
33
|
-
├── checklists/ # Quality gate checklists (
|
|
32
|
+
├── templates/ # Artifact templates (15 templates)
|
|
33
|
+
├── checklists/ # Quality gate checklists (13 checklists)
|
|
34
34
|
├── hooks/ # Claude Code hook definitions (2 files)
|
|
35
35
|
├── schemas/ # Runtime data schemas (13 schemas)
|
|
36
36
|
├── config.template.yaml
|
|
@@ -39,7 +39,7 @@ npm install @sniper.ai/core
|
|
|
39
39
|
|
|
40
40
|
## Agents
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
13 agent definitions, each with YAML frontmatter specifying write scope or isolation mode:
|
|
43
43
|
|
|
44
44
|
| Agent | Description |
|
|
45
45
|
|-------|-------------|
|
|
@@ -53,7 +53,9 @@ npm install @sniper.ai/core
|
|
|
53
53
|
| `qa-engineer` | Writes tests, analyzes coverage, validates acceptance criteria |
|
|
54
54
|
| `code-reviewer` | Multi-faceted code review (scope, standards, risk scoring) |
|
|
55
55
|
| `gate-reviewer` | Runs automated checks at phase boundaries |
|
|
56
|
-
| `retro-analyst` | Post-protocol retrospectives and
|
|
56
|
+
| `retro-analyst` | Post-protocol retrospectives and learning capture |
|
|
57
|
+
| `doc-writer` | Incrementally updates project documentation after implementation |
|
|
58
|
+
| `memory-curator` | Curates and maintains project memory (conventions, anti-patterns, decisions) |
|
|
57
59
|
|
|
58
60
|
## Cognitive Mixins
|
|
59
61
|
|
|
@@ -83,14 +85,15 @@ Domain-specific knowledge is provided separately by domain packs (e.g., `@sniper
|
|
|
83
85
|
|
|
84
86
|
## Skills
|
|
85
87
|
|
|
86
|
-
|
|
88
|
+
5 slash commands available in Claude Code:
|
|
87
89
|
|
|
88
90
|
| Command | Description |
|
|
89
91
|
|---------|-------------|
|
|
90
92
|
| `/sniper-flow` | Execute a SNIPER protocol (auto-detects scope or use `--protocol <name>`) |
|
|
91
93
|
| `/sniper-init` | Initialize SNIPER v3 in a new or existing project |
|
|
94
|
+
| `/sniper-learn` | Submit, review, or deprecate project learnings |
|
|
92
95
|
| `/sniper-review` | Manually trigger a review gate for the current phase |
|
|
93
|
-
| `/sniper-status` | Show current protocol progress
|
|
96
|
+
| `/sniper-status` | Show current protocol progress |
|
|
94
97
|
|
|
95
98
|
## Templates
|
|
96
99
|
|
|
@@ -109,14 +112,12 @@ Domain-specific knowledge is provided separately by domain packs (e.g., `@sniper
|
|
|
109
112
|
| `workspace-config.yaml` | YAML | Workspace configuration |
|
|
110
113
|
| `knowledge-manifest.yaml` | YAML | Knowledge base manifest |
|
|
111
114
|
| `checkpoint.yaml` | YAML | Protocol checkpoint state |
|
|
112
|
-
| `cost.yaml` | YAML | Token cost tracking |
|
|
113
115
|
| `live-status.yaml` | YAML | Live protocol status |
|
|
114
|
-
| `
|
|
115
|
-
| `signal-record.yaml` | YAML | Signal event record |
|
|
116
|
+
| `signal-record.yaml` | YAML | Signal event record (deprecated) |
|
|
116
117
|
|
|
117
118
|
## Checklists
|
|
118
119
|
|
|
119
|
-
|
|
120
|
+
13 quality gate checklists:
|
|
120
121
|
|
|
121
122
|
| Checklist | Used by |
|
|
122
123
|
|-----------|---------|
|
|
@@ -124,9 +125,10 @@ Domain-specific knowledge is provided separately by domain packs (e.g., `@sniper
|
|
|
124
125
|
| `define` | full, feature protocols |
|
|
125
126
|
| `design` | full, feature protocols |
|
|
126
127
|
| `solve` | full, feature protocols |
|
|
127
|
-
| `plan` | (deprecated — use define + design) |
|
|
128
128
|
| `implement` | full, feature, patch, refactor, hotfix protocols |
|
|
129
129
|
| `review` | full, feature, patch, refactor protocols |
|
|
130
|
+
| `retro` | full, feature, refactor protocols |
|
|
131
|
+
| `plan` | (deprecated — use define + design + solve) |
|
|
130
132
|
| `multi-faceted-review` | Multi-model review mode |
|
|
131
133
|
| `ingest-scan` | ingest protocol (scan phase) |
|
|
132
134
|
| `ingest-document` | ingest protocol (document phase) |
|
package/agents/analyst.md
CHANGED
|
@@ -25,6 +25,12 @@ 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
|
|
30
29
|
- The discovery brief is research output, not a specification — frame it as findings and constraints, not design
|
|
30
|
+
|
|
31
|
+
## Structured Decision Prompts
|
|
32
|
+
|
|
33
|
+
When you encounter ambiguity or a fork that materially affects discovery output, present a Structured Decision Prompt per the `structured-decisions` cognitive mixin. Common triggers:
|
|
34
|
+
- Scope of competitive analysis (direct competitors only vs. adjacent markets)
|
|
35
|
+
- Depth of codebase analysis (surface scan vs. deep audit)
|
|
36
|
+
- Conflicting stakeholder signals requiring prioritization
|
package/agents/architect.md
CHANGED
|
@@ -17,7 +17,7 @@ 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
|
|
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
|
|
|
@@ -39,3 +39,11 @@ You are a SNIPER architect agent. You design system architecture and produce tec
|
|
|
39
39
|
- Do NOT implement — produce designs only
|
|
40
40
|
- Do NOT add requirements — design against the approved PRD, nothing more
|
|
41
41
|
- Flag any requirement that cannot be met within the current stack
|
|
42
|
+
|
|
43
|
+
## Structured Decision Prompts
|
|
44
|
+
|
|
45
|
+
When you encounter ambiguity or a fork that materially affects the architecture, present a Structured Decision Prompt per the `structured-decisions` cognitive mixin. Common triggers:
|
|
46
|
+
- Multiple viable patterns exist for a component (e.g., event-driven vs. request-response)
|
|
47
|
+
- Technology choice not specified in the PRD or config
|
|
48
|
+
- Trade-off between simplicity and extensibility
|
|
49
|
+
- Integration approach with external systems
|
package/agents/backend-dev.md
CHANGED
|
@@ -41,3 +41,10 @@ Before marking a task complete, verify:
|
|
|
41
41
|
- Do NOT modify frontend code, infrastructure, or CI/CD files
|
|
42
42
|
- Do NOT merge your own worktree — the orchestrator handles merges
|
|
43
43
|
- Do NOT push to remote or create pull requests — the orchestrator handles integration
|
|
44
|
+
|
|
45
|
+
## Structured Decision Prompts
|
|
46
|
+
|
|
47
|
+
When you encounter ambiguity or a fork that materially affects the implementation, present a Structured Decision Prompt per the `structured-decisions` cognitive mixin. Common triggers:
|
|
48
|
+
- Existing API doesn't support what the story requires (extend vs. new endpoint)
|
|
49
|
+
- Database schema design with multiple valid approaches
|
|
50
|
+
- Story acceptance criteria conflict with existing code patterns
|
package/agents/code-reviewer.md
CHANGED
|
@@ -71,3 +71,10 @@ After completing the code review, reconcile the PRD with the implementation:
|
|
|
71
71
|
- Do NOT nitpick style when conventions aren't established
|
|
72
72
|
- Write the review report to `.sniper/artifacts/{protocol_id}/review-report.md` (the `{protocol_id}` is provided by the orchestrator)
|
|
73
73
|
- Only modify `.sniper/artifacts/{protocol_id}/prd.md` during spec reconciliation — never modify project source code or the discovery brief
|
|
74
|
+
|
|
75
|
+
## Structured Decision Prompts
|
|
76
|
+
|
|
77
|
+
When you encounter ambiguity or a fork that materially affects the review outcome, present a Structured Decision Prompt per the `structured-decisions` cognitive mixin. Common triggers:
|
|
78
|
+
- Code works but violates a convention — block or allow with a note?
|
|
79
|
+
- Implementation deviates from spec intentionally — accept the deviation or require a rewrite?
|
|
80
|
+
- Risk finding is borderline between severity levels
|
package/agents/frontend-dev.md
CHANGED
|
@@ -41,3 +41,10 @@ Before marking a task complete, verify:
|
|
|
41
41
|
- Do NOT modify backend code, database schemas, or infrastructure files
|
|
42
42
|
- Do NOT merge your own worktree — the orchestrator handles merges
|
|
43
43
|
- Do NOT push to remote or create pull requests — the orchestrator handles integration
|
|
44
|
+
|
|
45
|
+
## Structured Decision Prompts
|
|
46
|
+
|
|
47
|
+
When you encounter ambiguity or a fork that materially affects the implementation, present a Structured Decision Prompt per the `structured-decisions` cognitive mixin. Common triggers:
|
|
48
|
+
- Component architecture choices (single component vs. compound pattern)
|
|
49
|
+
- State management approach not specified in the architecture doc
|
|
50
|
+
- UX/accessibility trade-offs not covered by the spec
|
package/agents/fullstack-dev.md
CHANGED
|
@@ -42,3 +42,11 @@ Before marking a task complete, verify:
|
|
|
42
42
|
- Do NOT modify infrastructure, CI/CD, or deployment files
|
|
43
43
|
- Do NOT merge your own worktree — the orchestrator handles merges
|
|
44
44
|
- Do NOT push to remote or create pull requests — the orchestrator handles integration
|
|
45
|
+
|
|
46
|
+
## Structured Decision Prompts
|
|
47
|
+
|
|
48
|
+
When you encounter ambiguity or a fork that materially affects the implementation, present a Structured Decision Prompt per the `structured-decisions` cognitive mixin. Common triggers:
|
|
49
|
+
- Existing API doesn't support what the story requires (extend vs. new endpoint)
|
|
50
|
+
- Multiple valid approaches to implement a feature
|
|
51
|
+
- Story acceptance criteria conflict with existing code patterns
|
|
52
|
+
- Dependency choice not specified in the architecture doc
|
|
@@ -49,3 +49,12 @@ When a workspace is detected (`.sniper-workspace/` exists in a parent directory)
|
|
|
49
49
|
- Spawn agents with `mode: "plan"` when the protocol specifies `plan_approval: true`
|
|
50
50
|
- Prefer TaskCreate + Task tool over direct SendMessage for work assignments
|
|
51
51
|
- When a gate fails, DO NOT advance — reassign failed checks to appropriate agents
|
|
52
|
+
|
|
53
|
+
## Structured Decision Prompts
|
|
54
|
+
|
|
55
|
+
Agents may present Structured Decision Prompts (SDPs) to the user during execution. When this happens:
|
|
56
|
+
|
|
57
|
+
1. **Do NOT treat an SDP pause as a stall or failure** — the agent is waiting for user input
|
|
58
|
+
2. **Pass decisions forward** — when spawning agents, include the current decisions log (`.sniper/artifacts/{protocol_id}/decisions.yaml`) so agents don't re-ask settled questions
|
|
59
|
+
3. **Include in interactive review** — when presenting phase summaries during interactive review, list all decisions made during the phase so the user has full visibility
|
|
60
|
+
4. **Initialize the decisions log** — during protocol initialization, create `.sniper/artifacts/{protocol_id}/decisions.yaml` from the decisions template
|
|
@@ -41,7 +41,7 @@ Use the EARS (Easy Approach to Requirements Syntax) patterns:
|
|
|
41
41
|
## Output Artifacts
|
|
42
42
|
|
|
43
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
|
|
44
|
+
- `.sniper/artifacts/{protocol_id}/stories/*.md` — Individual stories (use `story.md` template)
|
|
45
45
|
- The `{protocol_id}` (e.g., `SNPR-20260307-a3f2`) is provided by the orchestrator when spawning you
|
|
46
46
|
- These are per-run snapshots that preserve the plan history
|
|
47
47
|
|
|
@@ -52,3 +52,11 @@ Use the EARS (Easy Approach to Requirements Syntax) patterns:
|
|
|
52
52
|
- Stories must reference the architecture document for technical context
|
|
53
53
|
- Do NOT include implementation details — describe WHAT, not HOW
|
|
54
54
|
- Flag any requirement without a clear acceptance test
|
|
55
|
+
|
|
56
|
+
## Structured Decision Prompts
|
|
57
|
+
|
|
58
|
+
When you encounter ambiguity or a fork that materially affects requirements or story decomposition, present a Structured Decision Prompt per the `structured-decisions` cognitive mixin. Common triggers:
|
|
59
|
+
- User story has multiple valid interpretations
|
|
60
|
+
- Feature scope is ambiguous (include edge case X or defer it?)
|
|
61
|
+
- Story granularity trade-offs (one large story vs. several small ones)
|
|
62
|
+
- Priority conflicts between competing requirements
|
package/agents/retro-analyst.md
CHANGED
|
@@ -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
|
|
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,9 +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/
|
|
29
|
-
4. Read `.sniper/artifacts/{protocol_id}/
|
|
30
|
-
5. Analyze:
|
|
27
|
+
3. Read `.sniper/artifacts/{protocol_id}/meta.yaml` for protocol metadata
|
|
28
|
+
4. Read `.sniper/artifacts/{protocol_id}/decisions.yaml` for Structured Decision Prompt outcomes
|
|
29
|
+
5. Analyze: Which gates failed first? Were there re-runs? Were recommendations overridden?
|
|
31
30
|
6. Write retro report to `.sniper/retros/{protocol_id}.yaml`
|
|
32
31
|
|
|
33
32
|
## Retro Report Schema
|
|
@@ -41,7 +40,6 @@ duration_phases:
|
|
|
41
40
|
gate_attempts: <count>
|
|
42
41
|
gate_result: pass | fail
|
|
43
42
|
metrics:
|
|
44
|
-
total_tokens: <number>
|
|
45
43
|
total_agents_spawned: <number>
|
|
46
44
|
gate_pass_rate: <percentage>
|
|
47
45
|
findings:
|
|
@@ -58,7 +56,7 @@ findings:
|
|
|
58
56
|
- Be specific — cite actual data, not vague observations
|
|
59
57
|
- Focus on actionable improvements, not blame
|
|
60
58
|
- Write to `.sniper/retros/` only — never modify project code
|
|
61
|
-
- Keep the report concise
|
|
59
|
+
- Keep the report concise
|
|
62
60
|
- Compare against previous retros if they exist to track trends
|
|
63
61
|
|
|
64
62
|
## Learning Extraction
|
|
@@ -110,6 +108,33 @@ After extracting new learnings, check effectiveness of previously applied learni
|
|
|
110
108
|
Flag for human review by adding to findings.
|
|
111
109
|
5. If confidence drops below 0.2 after adjustment, set `status: deprecated`.
|
|
112
110
|
|
|
111
|
+
## Structured Decision Prompts
|
|
112
|
+
|
|
113
|
+
When you encounter ambiguity or a fork that materially affects the retrospective, present a Structured Decision Prompt per the `structured-decisions` cognitive mixin. Common triggers:
|
|
114
|
+
- Contradictory signals about whether a pattern is beneficial or harmful
|
|
115
|
+
- Ambiguous gate failures that could be attributed to multiple root causes
|
|
116
|
+
- Uncertainty about whether to create a learning from a borderline finding
|
|
117
|
+
|
|
118
|
+
## Decision Analysis
|
|
119
|
+
|
|
120
|
+
During the retrospective, analyze Structured Decision Prompt outcomes:
|
|
121
|
+
|
|
122
|
+
1. Read `.sniper/artifacts/{protocol_id}/decisions.yaml`
|
|
123
|
+
2. Count total decisions, recommendation acceptance rate, and escape hatch usage
|
|
124
|
+
3. For decisions where the user overrode the recommendation:
|
|
125
|
+
- Check if the non-recommended choice led to downstream issues (gate failures, rework)
|
|
126
|
+
- If the override was successful, create a learning capturing the user's preference pattern (`confidence: 0.85`, `source.type: human`)
|
|
127
|
+
- If the override led to issues, note it as a `needs_improvement` finding
|
|
128
|
+
4. Include decision summary in the retro report:
|
|
129
|
+
```yaml
|
|
130
|
+
decisions_analyzed:
|
|
131
|
+
total: <count>
|
|
132
|
+
recommendation_accepted: <count>
|
|
133
|
+
recommendation_overridden: <count>
|
|
134
|
+
escape_hatch_used: <count>
|
|
135
|
+
override_success_rate: <percentage>
|
|
136
|
+
```
|
|
137
|
+
|
|
113
138
|
## Signal Analysis
|
|
114
139
|
|
|
115
140
|
During the retrospective, analyze external signals from both legacy and new stores:
|
|
@@ -132,25 +157,3 @@ During the retrospective, analyze external signals from both legacy and new stor
|
|
|
132
157
|
recurrence: <count>
|
|
133
158
|
```
|
|
134
159
|
|
|
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`
|
package/checklists/define.yaml
CHANGED
|
@@ -21,8 +21,3 @@ checks:
|
|
|
21
21
|
description: PRD explicitly defines what is out of scope
|
|
22
22
|
check: grep:.sniper/artifacts/{protocol_id}/prd.md:"## Out of Scope"
|
|
23
23
|
blocking: true # Out of scope must be explicit — this is where scope creep dies
|
|
24
|
-
|
|
25
|
-
- id: token_budget
|
|
26
|
-
description: PRD is concise (under 12000 chars)
|
|
27
|
-
check: wc:.sniper/artifacts/{protocol_id}/prd.md:<12000
|
|
28
|
-
blocking: false
|
package/checklists/design.yaml
CHANGED
|
@@ -36,8 +36,3 @@ checks:
|
|
|
36
36
|
description: No unresolved open questions remain
|
|
37
37
|
check: "!grep:.sniper/artifacts/{protocol_id}/plan.md:\\*\\*TBD\\*\\*|\\*\\*TODO\\*\\*|\\*\\*OPEN\\*\\*"
|
|
38
38
|
blocking: false
|
|
39
|
-
|
|
40
|
-
- id: token_budget
|
|
41
|
-
description: Architecture plan within character budget (~4000 tokens = 16000 chars)
|
|
42
|
-
check: wc:.sniper/artifacts/{protocol_id}/plan.md:<16000
|
|
43
|
-
blocking: false
|
package/checklists/plan.yaml
CHANGED
|
@@ -26,8 +26,3 @@ checks:
|
|
|
26
26
|
description: No unresolved open questions remain
|
|
27
27
|
check: "!grep:.sniper/artifacts/{protocol_id}/plan.md:\\*\\*TBD\\*\\*|\\*\\*TODO\\*\\*|\\*\\*OPEN\\*\\*"
|
|
28
28
|
blocking: false
|
|
29
|
-
|
|
30
|
-
- id: token_budget
|
|
31
|
-
description: Architecture plan within character budget (~4000 tokens = 16000 chars)
|
|
32
|
-
check: wc:.sniper/artifacts/{protocol_id}/plan.md:<16000
|
|
33
|
-
blocking: false
|
package/checklists/retro.yaml
CHANGED
package/config.template.yaml
CHANGED
|
@@ -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
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Structured Decision Prompts
|
|
2
|
+
|
|
3
|
+
When you encounter a question, ambiguity, or fork where the user's intent is unclear and the decision materially affects the outcome, surface it as a **Structured Decision Prompt (SDP)** instead of silently assuming or dumping free-form text.
|
|
4
|
+
|
|
5
|
+
## Format
|
|
6
|
+
|
|
7
|
+
Present decisions exactly like this:
|
|
8
|
+
|
|
9
|
+
```markdown
|
|
10
|
+
Decision needed: {title}
|
|
11
|
+
|
|
12
|
+
{1-3 sentences of context — what you're working on, what triggered the question}
|
|
13
|
+
|
|
14
|
+
1. {Option label} — {1-2 sentence description with trade-offs}
|
|
15
|
+
2. {Option label} — {1-2 sentence description with trade-offs}
|
|
16
|
+
...
|
|
17
|
+
★ Recommended: Option {N} — {rationale}
|
|
18
|
+
|
|
19
|
+
{N+1}. Custom response / discuss further
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Then **stop and wait** for the user to select an option before continuing.
|
|
23
|
+
|
|
24
|
+
## After Resolution
|
|
25
|
+
|
|
26
|
+
Record the decision in `.sniper/artifacts/{protocol_id}/decisions.yaml` (append to the `decisions` array). Downstream agents read this file to avoid re-asking settled questions.
|
|
27
|
+
|
|
28
|
+
## When NOT to Use SDPs
|
|
29
|
+
|
|
30
|
+
- **Trivial decisions** with obvious answers — use your judgment and move on
|
|
31
|
+
- **Already answered** by project conventions, CLAUDE.md, learnings, PRD, architecture doc, or a prior decision in `decisions.yaml`
|
|
32
|
+
- **Implementation details** that don't affect the user-facing outcome
|
|
33
|
+
- **Style preferences** already codified in linter config or conventions
|
|
34
|
+
|
|
35
|
+
## Guidelines
|
|
36
|
+
|
|
37
|
+
- **2-4 options** plus the escape hatch. More than 5 causes decision fatigue.
|
|
38
|
+
- **Always recommend.** The user hired you for your judgment — give it.
|
|
39
|
+
- **Be concrete.** "Use Redis for caching" not "Consider a caching layer."
|
|
40
|
+
- **Include trade-offs** in each option so the user can make an informed choice.
|
|
41
|
+
- **Batch related decisions** if multiple arise close together — present them in a single prompt rather than interrupting repeatedly.
|
package/protocols/explore.yaml
CHANGED
package/protocols/feature.yaml
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
name: feature
|
|
2
2
|
description: Incremental feature — define, design, solve, implement, review, retro
|
|
3
|
-
budget: 800000 # 800K tokens
|
|
4
3
|
|
|
5
4
|
phases:
|
|
6
5
|
- name: define
|
|
@@ -75,5 +74,4 @@ phases:
|
|
|
75
74
|
human_approval: false
|
|
76
75
|
outputs:
|
|
77
76
|
- .sniper/retros/{protocol_id}.yaml
|
|
78
|
-
- .sniper/memory/velocity.yaml
|
|
79
77
|
- .sniper/memory/learnings/
|
package/protocols/full.yaml
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
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
|
|
@@ -91,7 +90,6 @@ phases:
|
|
|
91
90
|
human_approval: false
|
|
92
91
|
outputs:
|
|
93
92
|
- .sniper/retros/{protocol_id}.yaml
|
|
94
|
-
- .sniper/memory/velocity.yaml
|
|
95
93
|
- .sniper/memory/learnings/
|
|
96
94
|
|
|
97
95
|
- name: curate
|
package/protocols/hotfix.yaml
CHANGED
package/protocols/ingest.yaml
CHANGED
package/protocols/patch.yaml
CHANGED
package/protocols/refactor.yaml
CHANGED
|
@@ -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.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
$schema: "https://json-schema.org/draft/2020-12/schema"
|
|
2
|
+
$id: "https://sniper.ai/schemas/decision-prompt"
|
|
3
|
+
title: Decision Prompt
|
|
4
|
+
description: Schema for Structured Decision Prompts (SDPs) — the format agents use to present questions, ambiguities, and decision points to the user with concrete options and a recommendation.
|
|
5
|
+
type: object
|
|
6
|
+
required:
|
|
7
|
+
- id
|
|
8
|
+
- phase
|
|
9
|
+
- agent
|
|
10
|
+
- context
|
|
11
|
+
- options
|
|
12
|
+
- recommendation
|
|
13
|
+
properties:
|
|
14
|
+
id:
|
|
15
|
+
type: string
|
|
16
|
+
pattern: "^D-[a-z]+-\\d{3}$"
|
|
17
|
+
description: "Unique decision ID in format D-{phase}-{seq} (e.g., D-design-001)."
|
|
18
|
+
phase:
|
|
19
|
+
type: string
|
|
20
|
+
description: Protocol phase where the decision arose.
|
|
21
|
+
agent:
|
|
22
|
+
type: string
|
|
23
|
+
description: Agent requesting the decision.
|
|
24
|
+
context:
|
|
25
|
+
type: string
|
|
26
|
+
description: "1-3 sentences explaining what the agent is working on and what triggered the question."
|
|
27
|
+
options:
|
|
28
|
+
type: array
|
|
29
|
+
minItems: 2
|
|
30
|
+
maxItems: 4
|
|
31
|
+
items:
|
|
32
|
+
type: object
|
|
33
|
+
required:
|
|
34
|
+
- label
|
|
35
|
+
- description
|
|
36
|
+
properties:
|
|
37
|
+
label:
|
|
38
|
+
type: string
|
|
39
|
+
description: Short option name (e.g., "JWT with refresh tokens").
|
|
40
|
+
description:
|
|
41
|
+
type: string
|
|
42
|
+
description: "1-2 sentence explanation including trade-offs."
|
|
43
|
+
additionalProperties: false
|
|
44
|
+
recommendation:
|
|
45
|
+
type: object
|
|
46
|
+
required:
|
|
47
|
+
- option_index
|
|
48
|
+
- rationale
|
|
49
|
+
properties:
|
|
50
|
+
option_index:
|
|
51
|
+
type: integer
|
|
52
|
+
minimum: 0
|
|
53
|
+
description: 0-based index into the options array.
|
|
54
|
+
rationale:
|
|
55
|
+
type: string
|
|
56
|
+
description: Why this option is recommended given the project context.
|
|
57
|
+
additionalProperties: false
|
|
58
|
+
escape_hatch:
|
|
59
|
+
type: string
|
|
60
|
+
default: "Custom response / discuss further"
|
|
61
|
+
description: Label for the free-form input option (always rendered as the last numbered choice).
|
|
62
|
+
|
|
63
|
+
# Resolution (filled after user responds)
|
|
64
|
+
resolution:
|
|
65
|
+
type: object
|
|
66
|
+
properties:
|
|
67
|
+
selected_option:
|
|
68
|
+
type: [integer, "null"]
|
|
69
|
+
description: "0-based index of the selected option, or null if escape hatch was used."
|
|
70
|
+
selected_label:
|
|
71
|
+
type: string
|
|
72
|
+
description: "Label of the selected option (copied from options array for readability). Null if escape hatch."
|
|
73
|
+
options_snapshot:
|
|
74
|
+
type: array
|
|
75
|
+
items:
|
|
76
|
+
type: string
|
|
77
|
+
description: "Labels of all options at the time of resolution, for audit trail readability."
|
|
78
|
+
custom_response:
|
|
79
|
+
type: string
|
|
80
|
+
description: "Free-form text if the user chose the escape hatch. Null otherwise."
|
|
81
|
+
timestamp:
|
|
82
|
+
type: string
|
|
83
|
+
format: date-time
|
|
84
|
+
description: When the decision was resolved.
|
|
85
|
+
additionalProperties: false
|
|
86
|
+
additionalProperties: false
|
|
@@ -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
|
|
@@ -46,8 +46,9 @@ After auto-detection, check trigger tables: run `git diff --name-only` and match
|
|
|
46
46
|
|
|
47
47
|
1. **Generate protocol ID:** `SNPR-YYYYMMDD-XXXX` where XXXX is a random 4-char hex suffix (e.g., `SNPR-20260307-a3f2`). No registry parsing needed.
|
|
48
48
|
2. **Create artifact directory:** `mkdir -p .sniper/artifacts/{protocol_id}/`
|
|
49
|
-
3. **
|
|
50
|
-
4. **
|
|
49
|
+
3. **Initialize decisions log:** Copy `decisions.yaml` template to `.sniper/artifacts/{protocol_id}/decisions.yaml`
|
|
50
|
+
4. **Write metadata:** Create `.sniper/artifacts/{protocol_id}/meta.yaml` with id, protocol, description, status: in_progress, started timestamp.
|
|
51
|
+
5. **Append to registry:** Add a row to `.sniper/artifacts/registry.md`. If registry doesn't exist, create it with a header row first.
|
|
51
52
|
|
|
52
53
|
## 3. Phase Execution Loop
|
|
53
54
|
|
|
@@ -57,8 +58,7 @@ For each phase in the protocol, execute these 5 steps:
|
|
|
57
58
|
|
|
58
59
|
1. Read protocol YAML for the current phase definition
|
|
59
60
|
2. Read `.sniper/config.yaml` for agent config, ownership, commands
|
|
60
|
-
3.
|
|
61
|
-
4. Compose agents per [Reference: Agent Composition](#reference-agent-composition)
|
|
61
|
+
3. Compose agents per [Reference: Agent Composition](#reference-agent-composition)
|
|
62
62
|
|
|
63
63
|
### Execute
|
|
64
64
|
|
|
@@ -79,11 +79,10 @@ phase: <phase>
|
|
|
79
79
|
timestamp: <ISO 8601>
|
|
80
80
|
status: completed | failed
|
|
81
81
|
agents: [status per agent]
|
|
82
|
-
token_usage: [phase + cumulative]
|
|
83
82
|
commits: [git SHAs produced]
|
|
84
83
|
```
|
|
85
84
|
|
|
86
|
-
Update `.sniper/live-status.yaml` with current phase
|
|
85
|
+
Update `.sniper/live-status.yaml` with current phase and agent statuses.
|
|
87
86
|
|
|
88
87
|
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
88
|
|
|
@@ -107,25 +106,15 @@ After the `solve` phase completes, populate the `stories` array in `.sniper/live
|
|
|
107
106
|
|
|
108
107
|
1. Write final checkpoint
|
|
109
108
|
2. Update `.sniper/live-status.yaml` with `status: completed`
|
|
110
|
-
3. Update `.sniper/artifacts/{protocol_id}/meta.yaml` with final status,
|
|
109
|
+
3. Update `.sniper/artifacts/{protocol_id}/meta.yaml` with final status, commits, agents used
|
|
111
110
|
4. Update `.sniper/artifacts/registry.md` entry from `in_progress` to `completed`
|
|
112
|
-
5. Present summary: phases completed, gate results,
|
|
111
|
+
5. Present summary: phases completed, gate results, learnings created
|
|
113
112
|
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
113
|
|
|
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
114
|
## Rules
|
|
125
115
|
|
|
126
116
|
- ALWAYS generate a protocol ID and create `.sniper/artifacts/{protocol_id}/` before spawning any agent
|
|
127
117
|
- ALWAYS checkpoint between phases
|
|
128
|
-
- ALWAYS respect token budgets
|
|
129
118
|
- ALWAYS present the plan for interactive review when `interactive_review: true`
|
|
130
119
|
- NEVER skip a gate — every phase transition goes through its gate
|
|
131
120
|
- NEVER advance past a failed blocking gate check
|
|
@@ -145,6 +134,7 @@ For each agent in the phase, build the full prompt by layering these sources. Ea
|
|
|
145
134
|
| 3. Domain knowledge | `.sniper/knowledge/manifest.yaml` → referenced files (from agent's `knowledge_sources` frontmatter) | SKIP — no knowledge section |
|
|
146
135
|
| 4. Workspace conventions | `.sniper-workspace/config.yaml` → `shared.conventions` and `shared.anti_patterns` | SKIP — no workspace section |
|
|
147
136
|
| 5. Learnings | `.sniper/memory/learnings/` → scoped, confidence-ranked, top 10 | SKIP — no learnings |
|
|
137
|
+
| 6. Decisions | `.sniper/artifacts/{protocol_id}/decisions.yaml` → prior decisions | SKIP — no decisions yet |
|
|
148
138
|
|
|
149
139
|
**Learning Composition (Layer 5):**
|
|
150
140
|
|
|
@@ -163,7 +153,7 @@ After composing learnings into the prompt, record the current protocol ID in eac
|
|
|
163
153
|
|
|
164
154
|
**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."
|
|
165
155
|
|
|
166
|
-
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}.`).
|
|
156
|
+
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).
|
|
167
157
|
|
|
168
158
|
Replace all `{protocol_id}` placeholders in the composed prompt with the actual protocol ID.
|
|
169
159
|
|
|
@@ -201,25 +191,60 @@ For agents working in worktrees (after all implementation agents complete):
|
|
|
201
191
|
When a phase has `interactive_review: true`:
|
|
202
192
|
|
|
203
193
|
1. Read produced artifacts from `.sniper/artifacts/` or `.sniper/artifacts/{protocol_id}/` as appropriate
|
|
204
|
-
2.
|
|
194
|
+
2. Read `.sniper/artifacts/{protocol_id}/decisions.yaml` for any Structured Decision Prompts resolved during this phase
|
|
195
|
+
3. Present a structured summary appropriate to the phase:
|
|
205
196
|
- **discover:** findings, constraints, codebase landscape, open questions
|
|
206
197
|
- **define:** requirements, success criteria, scope boundaries, out-of-scope items
|
|
207
198
|
- **design:** key architectural decisions, component overview, data model, trade-offs
|
|
208
199
|
- **solve:** story list, dependencies, acceptance criteria summary
|
|
209
|
-
|
|
200
|
+
4. If decisions were made during the phase, include a **Decisions** section listing each decision: the question, the selected option, and the rationale
|
|
201
|
+
5. Offer options:
|
|
210
202
|
- **Approve** — continue to next phase
|
|
211
203
|
- **Request changes** — describe changes (architect/PM will revise, then re-present)
|
|
212
204
|
- **Edit directly** — user modifies plan files, says "done", re-validate via gate
|
|
213
|
-
|
|
205
|
+
6. Only advance after explicit user approval
|
|
206
|
+
|
|
207
|
+
## Reference: Structured Decision Prompts
|
|
208
|
+
|
|
209
|
+
Agents may present Structured Decision Prompts (SDPs) when they encounter ambiguity or decision points during execution. This is expected behavior, not an error.
|
|
210
|
+
|
|
211
|
+
**How SDPs work during phase execution:**
|
|
212
|
+
|
|
213
|
+
1. An agent encounters a question where the user's intent is unclear and the decision materially affects the outcome
|
|
214
|
+
2. The agent presents numbered options with a recommendation and an escape hatch (custom response / discuss further)
|
|
215
|
+
3. The user selects an option by number or types a custom response
|
|
216
|
+
4. The agent records the decision in `.sniper/artifacts/{protocol_id}/decisions.yaml` and continues
|
|
217
|
+
5. At the phase's interactive review, the decisions log is included in the summary
|
|
218
|
+
|
|
219
|
+
**Decision record format:**
|
|
220
|
+
```yaml
|
|
221
|
+
decisions:
|
|
222
|
+
- id: D-design-001
|
|
223
|
+
phase: design
|
|
224
|
+
agent: architect
|
|
225
|
+
context: "Authentication strategy for the API"
|
|
226
|
+
selected_option: 0
|
|
227
|
+
selected_label: "JWT with refresh tokens"
|
|
228
|
+
options_snapshot:
|
|
229
|
+
- "JWT with refresh tokens"
|
|
230
|
+
- "Session-based auth"
|
|
231
|
+
- "OAuth2 with external provider"
|
|
232
|
+
custom_response: null
|
|
233
|
+
timestamp: 2026-03-11T14:30:00Z
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**Downstream context:** When spawning agents, include the current decisions log (Layer 6 in Agent Composition) so agents don't re-ask settled questions.
|
|
237
|
+
|
|
238
|
+
**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.
|
|
214
239
|
|
|
215
240
|
## Reference: Retrospective (Legacy)
|
|
216
241
|
|
|
217
242
|
> **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`.
|
|
218
243
|
|
|
219
244
|
When `auto_retro: true` and no `retro` phase exists in the protocol:
|
|
220
|
-
1. Spawn `retro-analyst` as a single-agent phase with: protocol ID, checkpoint history, gate results
|
|
221
|
-
2. The retro-analyst writes a report to `.sniper/retros/{protocol_id}.yaml`, extracts learnings to `.sniper/memory/learnings/`,
|
|
222
|
-
3. Run the retro gate checklist (retro report exists
|
|
245
|
+
1. Spawn `retro-analyst` as a single-agent phase with: protocol ID, checkpoint history, gate results
|
|
246
|
+
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
|
|
247
|
+
3. Run the retro gate checklist (retro report exists)
|
|
223
248
|
|
|
224
249
|
## Reference: Review Gate Feedback Capture
|
|
225
250
|
|
|
@@ -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
|
|
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 -->
|
|
@@ -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
|
|
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
|
|
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) ────────────────────────────
|
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
# Discovery Brief
|
|
2
|
-
<!-- Budget: 3000 tokens max -->
|
|
3
2
|
<!-- This is research output, not a specification. Frame as findings and constraints, not design decisions. -->
|
|
4
3
|
|
|
5
4
|
## Context
|
|
6
|
-
<!-- ~300 tokens: What exists today, what triggered this investigation -->
|
|
7
5
|
|
|
8
6
|
## Findings
|
|
9
|
-
<!-- ~800 tokens: Key discoveries from codebase analysis, research, and requirements elicitation -->
|
|
10
7
|
<!-- Ground every finding in evidence — cite file paths, line numbers, or URLs -->
|
|
11
8
|
|
|
12
9
|
## Constraints
|
|
13
|
-
<!-- ~400 tokens: Technical constraints, dependencies, and limitations discovered -->
|
|
14
10
|
|
|
15
11
|
## Risks
|
|
16
|
-
<!-- ~300 tokens: Technical risks, unknowns, and potential blockers -->
|
|
17
12
|
|
|
18
13
|
## Out of Scope
|
|
19
|
-
<!-- ~200 tokens: Explicitly list what this work should NOT cover -->
|
|
20
14
|
|
|
21
15
|
## Open Questions
|
|
22
|
-
<!-- ~200 tokens: Unresolved questions that need answers before defining requirements -->
|
|
23
16
|
<!-- Distinguish facts from assumptions explicitly -->
|
package/templates/prd.md
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
# Product Requirements Document
|
|
2
|
-
<!-- Budget: 3000 tokens max -->
|
|
3
2
|
<!-- This defines WHAT to build and WHY — not HOW. Architecture comes later. -->
|
|
4
3
|
|
|
5
4
|
## Context
|
|
6
|
-
<!-- ~300 tokens: What exists today and why this work is needed -->
|
|
7
5
|
|
|
8
6
|
## Problem
|
|
9
|
-
<!-- ~400 tokens: What specific problem are we solving -->
|
|
10
7
|
|
|
11
8
|
## Users
|
|
12
|
-
<!-- ~200 tokens: Who are the users and what do they need -->
|
|
13
9
|
|
|
14
10
|
## Requirements
|
|
15
|
-
<!-- ~800 tokens: EARS-format requirements -->
|
|
16
11
|
<!-- Use: "The <system> shall <action>" for each requirement -->
|
|
17
12
|
|
|
18
13
|
### Functional Requirements
|
|
@@ -20,11 +15,8 @@
|
|
|
20
15
|
### Non-Functional Requirements
|
|
21
16
|
|
|
22
17
|
## Out of Scope
|
|
23
|
-
<!-- ~200 tokens: Explicitly list what this work does NOT cover -->
|
|
24
18
|
<!-- This section is mandatory — scope creep dies here -->
|
|
25
19
|
|
|
26
20
|
## Success Criteria
|
|
27
|
-
<!-- ~300 tokens: Measurable outcomes that define "done" -->
|
|
28
21
|
|
|
29
22
|
## Open Questions
|
|
30
|
-
<!-- ~200 tokens: Unresolved questions that need answers before design -->
|
package/templates/story.md
CHANGED
|
@@ -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 -->
|
package/schemas/cost.schema.yaml
DELETED
|
@@ -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
|
package/templates/cost.yaml
DELETED
|
@@ -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
|
package/templates/velocity.yaml
DELETED