@sniper.ai/core 1.0.1 → 2.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.
- package/README.md +122 -32
- package/framework/checklists/debug-review.md +34 -0
- package/framework/checklists/feature-review.md +42 -0
- package/framework/checklists/ingest-review.md +42 -0
- package/framework/checklists/memory-review.md +30 -0
- package/framework/checklists/perf-review.md +33 -0
- package/framework/checklists/refactor-review.md +33 -0
- package/framework/checklists/security-review.md +34 -0
- package/framework/checklists/test-review.md +32 -0
- package/framework/checklists/workspace-review.md +34 -0
- package/framework/commands/sniper-audit.md +1549 -0
- package/framework/commands/sniper-compose.md +88 -2
- package/framework/commands/sniper-debug.md +337 -0
- package/framework/commands/sniper-discover.md +41 -15
- package/framework/commands/sniper-feature.md +515 -0
- package/framework/commands/sniper-ingest.md +506 -0
- package/framework/commands/sniper-init.md +21 -5
- package/framework/commands/sniper-memory.md +219 -0
- package/framework/commands/sniper-plan.md +41 -19
- package/framework/commands/sniper-review.md +106 -42
- package/framework/commands/sniper-solve.md +47 -14
- package/framework/commands/sniper-sprint.md +132 -17
- package/framework/commands/sniper-status.md +240 -35
- package/framework/commands/sniper-workspace-feature.md +267 -0
- package/framework/commands/sniper-workspace-init.md +252 -0
- package/framework/commands/sniper-workspace-status.md +112 -0
- package/framework/commands/sniper-workspace-validate.md +138 -0
- package/framework/config.template.yaml +88 -9
- package/framework/personas/process/architecture-cartographer.md +25 -0
- package/framework/personas/process/code-archaeologist.md +22 -0
- package/framework/personas/process/code-investigator.md +29 -0
- package/framework/personas/process/code-reviewer.md +26 -0
- package/framework/personas/process/contract-designer.md +31 -0
- package/framework/personas/process/convention-miner.md +27 -0
- package/framework/personas/process/coverage-analyst.md +24 -0
- package/framework/personas/process/flake-hunter.md +30 -0
- package/framework/personas/process/impact-analyst.md +23 -0
- package/framework/personas/process/integration-validator.md +29 -0
- package/framework/personas/process/log-analyst.md +22 -0
- package/framework/personas/process/migration-architect.md +24 -0
- package/framework/personas/process/perf-profiler.md +27 -0
- package/framework/personas/process/release-manager.md +23 -0
- package/framework/personas/process/retro-analyst.md +30 -0
- package/framework/personas/process/threat-modeler.md +30 -0
- package/framework/personas/process/triage-lead.md +23 -0
- package/framework/personas/process/vuln-scanner.md +27 -0
- package/framework/personas/process/workspace-orchestrator.md +30 -0
- package/framework/spawn-prompts/_template.md +3 -0
- package/framework/teams/debug.yaml +56 -0
- package/framework/teams/feature-plan.yaml +61 -0
- package/framework/teams/ingest.yaml +85 -0
- package/framework/teams/perf.yaml +33 -0
- package/framework/teams/refactor.yaml +34 -0
- package/framework/teams/retro.yaml +30 -0
- package/framework/teams/review-pr.yaml +73 -0
- package/framework/teams/review-release.yaml +70 -0
- package/framework/teams/security.yaml +59 -0
- package/framework/teams/test.yaml +59 -0
- package/framework/teams/workspace-feature.yaml +69 -0
- package/framework/teams/workspace-validation.yaml +27 -0
- package/framework/templates/arch-delta.md +74 -0
- package/framework/templates/architecture.md +24 -1
- package/framework/templates/brief.md +22 -1
- package/framework/templates/bug-report.md +55 -0
- package/framework/templates/contract-validation-report.md +68 -0
- package/framework/templates/contract.yaml +60 -0
- package/framework/templates/conventions.md +59 -0
- package/framework/templates/coverage-report.md +67 -0
- package/framework/templates/epic.md +14 -0
- package/framework/templates/feature-brief.md +54 -0
- package/framework/templates/feature-spec.md +53 -0
- package/framework/templates/flaky-report.md +64 -0
- package/framework/templates/investigation.md +49 -0
- package/framework/templates/memory-anti-pattern.yaml +16 -0
- package/framework/templates/memory-convention.yaml +17 -0
- package/framework/templates/memory-decision.yaml +16 -0
- package/framework/templates/migration-plan.md +47 -0
- package/framework/templates/optimization-plan.md +59 -0
- package/framework/templates/performance-profile.md +64 -0
- package/framework/templates/postmortem.md +69 -0
- package/framework/templates/pr-review.md +50 -0
- package/framework/templates/prd.md +24 -1
- package/framework/templates/refactor-scope.md +52 -0
- package/framework/templates/release-readiness.md +66 -0
- package/framework/templates/retro.yaml +44 -0
- package/framework/templates/security.md +22 -1
- package/framework/templates/story.md +16 -0
- package/framework/templates/threat-model.md +71 -0
- package/framework/templates/ux-spec.md +18 -1
- package/framework/templates/vulnerability-report.md +56 -0
- package/framework/templates/workspace-brief.md +52 -0
- package/framework/templates/workspace-plan.md +50 -0
- package/framework/workflows/workspace-feature.md +71 -0
- package/package.json +1 -1
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# /sniper-memory -- Manage Agent Memory (Conventions, Anti-Patterns, Decisions)
|
|
2
|
+
|
|
3
|
+
You are executing the `/sniper-memory` command. Your job is to manage the project's accumulated knowledge — conventions, anti-patterns, and decisions that agents learn over time. Follow every step below precisely.
|
|
4
|
+
|
|
5
|
+
The user's arguments are provided in: $ARGUMENTS
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Step 0: Pre-Flight Checks
|
|
10
|
+
|
|
11
|
+
1. Verify `.sniper/config.yaml` exists (SNIPER is initialized)
|
|
12
|
+
2. Check if `.sniper/memory/` directory exists. If not, create it with empty starter files:
|
|
13
|
+
- `.sniper/memory/conventions.yaml` with `conventions: []`
|
|
14
|
+
- `.sniper/memory/anti-patterns.yaml` with `anti_patterns: []`
|
|
15
|
+
- `.sniper/memory/decisions.yaml` with `decisions: []`
|
|
16
|
+
- `.sniper/memory/estimates.yaml` with `calibration: { velocity_factor: 1.0, common_underestimates: [], last_updated: null, sprints_analyzed: 0 }`
|
|
17
|
+
- `.sniper/memory/retros/` directory
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Step 1: Parse Arguments
|
|
22
|
+
|
|
23
|
+
Parse the following flags from `$ARGUMENTS`:
|
|
24
|
+
|
|
25
|
+
| Flag | Description | Example |
|
|
26
|
+
|------|-------------|---------|
|
|
27
|
+
| (none) | Show memory summary | `/sniper-memory` |
|
|
28
|
+
| `--conventions` | List all conventions | `/sniper-memory --conventions` |
|
|
29
|
+
| `--anti-patterns` | List all anti-patterns | `/sniper-memory --anti-patterns` |
|
|
30
|
+
| `--decisions` | List all decisions | `/sniper-memory --decisions` |
|
|
31
|
+
| `--add convention "rule"` | Add a new convention | `/sniper-memory --add convention "Use barrel exports"` |
|
|
32
|
+
| `--add anti-pattern "desc"` | Add a new anti-pattern | `/sniper-memory --add anti-pattern "Nested ternaries"` |
|
|
33
|
+
| `--add decision "title" --rationale "why"` | Add a decision | `/sniper-memory --add decision "Use Zod" --rationale "Type-safe validation"` |
|
|
34
|
+
| `--remove {id}` | Remove an entry by ID | `/sniper-memory --remove conv-003` |
|
|
35
|
+
| `--promote {id}` | Promote candidate to confirmed | `/sniper-memory --promote ap-002` |
|
|
36
|
+
| `--export` | Export memory as portable YAML | `/sniper-memory --export` |
|
|
37
|
+
| `--import {file}` | Import memory from file | `/sniper-memory --import memory-pack.yaml` |
|
|
38
|
+
| `--retro` | Manually trigger retrospective | `/sniper-memory --retro` |
|
|
39
|
+
|
|
40
|
+
If no arguments provided, default to showing the summary.
|
|
41
|
+
|
|
42
|
+
If unrecognized flags, show usage guide and STOP.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Step 2: Read Memory State
|
|
47
|
+
|
|
48
|
+
1. Read `.sniper/memory/conventions.yaml` — parse the `conventions` array
|
|
49
|
+
2. Read `.sniper/memory/anti-patterns.yaml` — parse the `anti_patterns` array
|
|
50
|
+
3. Read `.sniper/memory/decisions.yaml` — parse the `decisions` array
|
|
51
|
+
4. Read `.sniper/memory/estimates.yaml` — parse calibration data
|
|
52
|
+
5. Scan `.sniper/memory/retros/` for retro files — count them, find the latest
|
|
53
|
+
|
|
54
|
+
If any file is missing or empty, treat it as an empty array/object.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Step 3: Execute Operation
|
|
59
|
+
|
|
60
|
+
### 3a: Summary (no flags)
|
|
61
|
+
|
|
62
|
+
Display a formatted summary:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
============================================
|
|
66
|
+
SNIPER Memory
|
|
67
|
+
============================================
|
|
68
|
+
|
|
69
|
+
Conventions: {N} confirmed, {M} candidates
|
|
70
|
+
Anti-Patterns: {N} confirmed, {M} candidates
|
|
71
|
+
Decisions: {N} active, {M} superseded
|
|
72
|
+
|
|
73
|
+
Estimation:
|
|
74
|
+
Velocity Factor: {factor}
|
|
75
|
+
Sprints Analyzed: {count}
|
|
76
|
+
|
|
77
|
+
Retrospectives:
|
|
78
|
+
Total: {count}
|
|
79
|
+
Latest: Sprint {N} ({date})
|
|
80
|
+
|
|
81
|
+
============================================
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 3b: List Operations (--conventions, --anti-patterns, --decisions)
|
|
85
|
+
|
|
86
|
+
For each entry, display in a readable format:
|
|
87
|
+
|
|
88
|
+
**Conventions:**
|
|
89
|
+
```
|
|
90
|
+
[conv-001] (confirmed) enforcement: both
|
|
91
|
+
Rule: All API routes use Zod validation middleware
|
|
92
|
+
Applies to: backend-engineer, api-designer
|
|
93
|
+
Source: review_gate (sprint-2-review, 2026-02-15)
|
|
94
|
+
|
|
95
|
+
[conv-002] (candidate) enforcement: spawn_prompt
|
|
96
|
+
Rule: Use named exports for React components
|
|
97
|
+
Applies to: frontend-engineer
|
|
98
|
+
Source: retro (sprint-3-retro, 2026-02-18)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Similar format for anti-patterns (include severity) and decisions (include status).
|
|
102
|
+
|
|
103
|
+
### 3c: Add Operations (--add)
|
|
104
|
+
|
|
105
|
+
**Add convention:**
|
|
106
|
+
1. Determine the next convention ID: find the highest `conv-XXX` number and increment
|
|
107
|
+
2. Create the entry:
|
|
108
|
+
```yaml
|
|
109
|
+
- id: conv-{NNN}
|
|
110
|
+
rule: "{provided rule}"
|
|
111
|
+
rationale: ""
|
|
112
|
+
source:
|
|
113
|
+
type: manual
|
|
114
|
+
ref: "user-added"
|
|
115
|
+
date: "{today ISO 8601}"
|
|
116
|
+
applies_to: []
|
|
117
|
+
enforcement: both
|
|
118
|
+
scope: project
|
|
119
|
+
status: confirmed
|
|
120
|
+
examples:
|
|
121
|
+
positive: ""
|
|
122
|
+
negative: ""
|
|
123
|
+
```
|
|
124
|
+
3. Ask the user which roles this applies to (suggest common roles: backend-engineer, frontend-engineer, architect, etc.)
|
|
125
|
+
4. Append to `.sniper/memory/conventions.yaml`
|
|
126
|
+
5. Confirm addition
|
|
127
|
+
|
|
128
|
+
**Add anti-pattern:**
|
|
129
|
+
Similar flow — next `ap-XXX` ID, ask for severity (high/medium/low), ask for fix_pattern, ask for applies_to roles.
|
|
130
|
+
|
|
131
|
+
**Add decision:**
|
|
132
|
+
Similar flow — next `dec-XXX` ID, require `--rationale` flag, ask for applies_to roles, set status to active.
|
|
133
|
+
|
|
134
|
+
### 3d: Remove Operation (--remove {id})
|
|
135
|
+
|
|
136
|
+
1. Determine which file the ID belongs to (conv- → conventions, ap- → anti-patterns, dec- → decisions)
|
|
137
|
+
2. Find the entry by ID
|
|
138
|
+
3. If not found, error: `Entry {id} not found in memory.`
|
|
139
|
+
4. Show the entry and ask for confirmation: `Remove this entry? (y/n)`
|
|
140
|
+
5. If confirmed, remove from the YAML array and rewrite the file
|
|
141
|
+
6. Confirm removal
|
|
142
|
+
|
|
143
|
+
### 3e: Promote Operation (--promote {id})
|
|
144
|
+
|
|
145
|
+
1. Find the entry by ID (check all three files)
|
|
146
|
+
2. If not found or already confirmed/active, error with appropriate message
|
|
147
|
+
3. Change `status` from `candidate` to `confirmed` (for conventions/anti-patterns) or to `active` (for decisions)
|
|
148
|
+
4. Rewrite the file
|
|
149
|
+
5. Confirm promotion
|
|
150
|
+
|
|
151
|
+
### 3f: Export Operation (--export)
|
|
152
|
+
|
|
153
|
+
1. Create a combined export YAML:
|
|
154
|
+
```yaml
|
|
155
|
+
exported_from: "{project.name}"
|
|
156
|
+
exported_at: "{today ISO 8601}"
|
|
157
|
+
version: "1.0"
|
|
158
|
+
|
|
159
|
+
conventions:
|
|
160
|
+
# Strip source.ref and project-specific fields
|
|
161
|
+
# Keep: rule, applies_to, enforcement, examples
|
|
162
|
+
|
|
163
|
+
anti_patterns:
|
|
164
|
+
# Keep: description, fix_pattern, severity, applies_to
|
|
165
|
+
|
|
166
|
+
decisions: [] # Decisions excluded by default (project-specific)
|
|
167
|
+
```
|
|
168
|
+
2. Write to `sniper-memory-export.yaml` in the project root
|
|
169
|
+
3. Report: exported {N} conventions, {M} anti-patterns
|
|
170
|
+
|
|
171
|
+
### 3g: Import Operation (--import {file})
|
|
172
|
+
|
|
173
|
+
1. Read the specified file
|
|
174
|
+
2. Validate it has the expected export format
|
|
175
|
+
3. For each entry, check for duplicates by content similarity (exact rule/description match)
|
|
176
|
+
4. Add non-duplicate entries with `source.type: imported`, `status: candidate`
|
|
177
|
+
5. Report: imported {N} conventions, {M} anti-patterns, {K} skipped (duplicates)
|
|
178
|
+
|
|
179
|
+
### 3h: Retro Operation (--retro)
|
|
180
|
+
|
|
181
|
+
1. Read `.sniper/config.yaml` to get the current sprint number
|
|
182
|
+
2. Read `.sniper/teams/retro.yaml` for the team definition
|
|
183
|
+
3. Print instructions for running the retro:
|
|
184
|
+
```
|
|
185
|
+
To run a sprint retrospective:
|
|
186
|
+
|
|
187
|
+
1. The retro team will analyze sprint {N} output
|
|
188
|
+
2. Findings will be written to .sniper/memory/retros/sprint-{N}-retro.yaml
|
|
189
|
+
3. High-confidence findings will be auto-added to memory
|
|
190
|
+
|
|
191
|
+
Compose the retro-analyst spawn prompt:
|
|
192
|
+
/sniper-compose --process retro-analyst --cognitive systems-thinker --name "Retro Analyst"
|
|
193
|
+
|
|
194
|
+
Then spawn the retro agent with context from:
|
|
195
|
+
- docs/stories/ (completed stories)
|
|
196
|
+
- docs/reviews/ (review gate results)
|
|
197
|
+
- .sniper/memory/ (existing memory for dedup)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Step 4: Display Results
|
|
203
|
+
|
|
204
|
+
After executing the operation, display a final summary showing:
|
|
205
|
+
- What changed (if anything)
|
|
206
|
+
- Current memory counts
|
|
207
|
+
- Any warnings or suggestions
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## IMPORTANT RULES
|
|
212
|
+
|
|
213
|
+
- Never delete memory files entirely — always preserve the YAML structure with empty arrays
|
|
214
|
+
- When modifying YAML files, preserve comments and formatting where possible
|
|
215
|
+
- Convention IDs use `conv-XXX`, anti-pattern IDs use `ap-XXX`, decision IDs use `dec-XXX` (zero-padded to 3 digits)
|
|
216
|
+
- Always ask for confirmation before destructive operations (remove)
|
|
217
|
+
- The `--retro` flag provides instructions but does not directly spawn agents (that requires team orchestration)
|
|
218
|
+
- Memory files use standard YAML format — no managed section markers (those are for markdown templates)
|
|
219
|
+
- If workspace memory exists (check config for `workspace.workspace_path`), mention it in the summary but don't modify it from this command
|
|
@@ -24,19 +24,31 @@ Check that the following files exist and are non-empty:
|
|
|
24
24
|
2. `docs/risks.md` -- Recommended but not blocking. If missing, print a warning.
|
|
25
25
|
3. `docs/personas.md` -- Recommended but not blocking. If missing, print a warning.
|
|
26
26
|
|
|
27
|
-
### 0c.
|
|
27
|
+
### 0c. Config Migration Check
|
|
28
28
|
|
|
29
|
-
1. Read `
|
|
30
|
-
2.
|
|
31
|
-
3. **If `current_phase` is `plan`:** Already in progress or was interrupted.
|
|
32
|
-
- Ask the user: "The plan phase appears to be in progress. Do you want to restart it? This will overwrite planning artifacts. (yes/no)"
|
|
33
|
-
- If no, STOP.
|
|
34
|
-
4. **If `current_phase` is `solve` or `sprint`:** Project has progressed past planning.
|
|
35
|
-
- Ask the user: "The project is in the '{current_phase}' phase. Re-running plan will reset progress. Are you sure? (yes/no)"
|
|
36
|
-
- If no, STOP.
|
|
37
|
-
5. **If `current_phase` is `null`:** No phase has run. Check if artifacts exist anyway (manual creation). If `docs/brief.md` exists, proceed with a warning. Otherwise STOP.
|
|
29
|
+
1. Read `schema_version` from `.sniper/config.yaml`.
|
|
30
|
+
2. If `schema_version` is absent or less than 2, run the v1→v2 migration as defined in the Config Reader Protocol. Write the updated config before proceeding.
|
|
38
31
|
|
|
39
|
-
### 0d. Verify
|
|
32
|
+
### 0d. Verify Phase State
|
|
33
|
+
|
|
34
|
+
1. Determine the current active phase: find the last entry in `state.phase_log` where `completed_at` is null.
|
|
35
|
+
2. **If no active phase:** Good -- proceed. Re-running plan after sprint is normal iteration.
|
|
36
|
+
3. **If active phase is `plan`:** Already in progress.
|
|
37
|
+
- Ask the user: "A plan phase is already in progress ({context}). Options: (a) Resume it (b) Start a new plan with a different context"
|
|
38
|
+
4. **If active phase is something else:**
|
|
39
|
+
- Ask the user: "You have an active {phase} phase ({context}) that hasn't completed. Options: (a) Pause it and start planning (b) Complete {phase} first"
|
|
40
|
+
|
|
41
|
+
### 0e. Amendment Detection
|
|
42
|
+
|
|
43
|
+
1. Check if the target artifact files already exist and are non-empty:
|
|
44
|
+
- `docs/prd.md`
|
|
45
|
+
- `docs/architecture.md`
|
|
46
|
+
- `docs/ux-spec.md`
|
|
47
|
+
- `docs/security.md`
|
|
48
|
+
2. **If ANY exist:** Enter **amendment mode**. Note which files exist and their current version numbers. Agents will be instructed to amend rather than create.
|
|
49
|
+
3. **If NONE exist:** Normal create mode.
|
|
50
|
+
|
|
51
|
+
### 0f. Verify Framework Files
|
|
40
52
|
|
|
41
53
|
Check that these files exist:
|
|
42
54
|
- `.sniper/teams/plan.yaml`
|
|
@@ -64,10 +76,10 @@ Report any missing files as warnings. Continue if the team YAML and key personas
|
|
|
64
76
|
|
|
65
77
|
Edit `.sniper/config.yaml`:
|
|
66
78
|
|
|
67
|
-
1.
|
|
68
|
-
2. Append to `state.phase_history`:
|
|
79
|
+
1. Append to `state.phase_log`:
|
|
69
80
|
```yaml
|
|
70
81
|
- phase: plan
|
|
82
|
+
context: "{from --context argument, or 'initial' for first run, or 'iteration-N' for re-runs}"
|
|
71
83
|
started_at: "{current ISO timestamp}"
|
|
72
84
|
completed_at: null
|
|
73
85
|
approved_by: null
|
|
@@ -147,7 +159,7 @@ For each teammate, compose a spawn prompt by reading persona layer files and ass
|
|
|
147
159
|
- **Description:** {project.description}
|
|
148
160
|
- **Stack:** {summary of stack section}
|
|
149
161
|
|
|
150
|
-
## Instructions
|
|
162
|
+
## Instructions (Create Mode — when docs/prd.md does NOT exist)
|
|
151
163
|
1. Read ALL the required reading files listed above.
|
|
152
164
|
2. Read the template at `.sniper/templates/prd.md` for expected output format.
|
|
153
165
|
3. Synthesize the discovery artifacts into a coherent PRD.
|
|
@@ -155,6 +167,15 @@ For each teammate, compose a spawn prompt by reading persona layer files and ass
|
|
|
155
167
|
5. User stories must reference the personas from `docs/personas.md`.
|
|
156
168
|
6. Write the complete output to `docs/prd.md`.
|
|
157
169
|
7. When complete, message the team lead. Other teammates are waiting on your output.
|
|
170
|
+
|
|
171
|
+
## Instructions (Amendment Mode — when docs/prd.md already exists)
|
|
172
|
+
1. Read the EXISTING `docs/prd.md` first. Note its current version number.
|
|
173
|
+
2. Read ALL the required reading files listed above.
|
|
174
|
+
3. AMEND the existing PRD: add new requirements, update changed sections, mark removed items as deprecated. Preserve content outside managed sections (<!-- sniper:managed --> markers).
|
|
175
|
+
4. Every P0 requirement MUST have testable acceptance criteria.
|
|
176
|
+
5. Increment the version number and add a changelog entry describing what changed.
|
|
177
|
+
6. Set Status back to "Draft".
|
|
178
|
+
7. When complete, message the team lead. Other teammates are waiting on your output.
|
|
158
179
|
```
|
|
159
180
|
|
|
160
181
|
### Teammate: architect
|
|
@@ -539,11 +560,12 @@ Update state with `approved_by: "rejected"` and STOP.
|
|
|
539
560
|
|
|
540
561
|
Edit `.sniper/config.yaml`:
|
|
541
562
|
|
|
542
|
-
1.
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
563
|
+
1. Update artifact tracking (increment version if amendment mode):
|
|
564
|
+
- Set `state.artifacts.prd.status: draft` and increment `state.artifacts.prd.version`
|
|
565
|
+
- Set `state.artifacts.architecture.status: draft` and increment `state.artifacts.architecture.version`
|
|
566
|
+
- Set `state.artifacts.ux_spec.status: draft` and increment `state.artifacts.ux_spec.version`
|
|
567
|
+
- Set `state.artifacts.security.status: draft` and increment `state.artifacts.security.version` (if produced)
|
|
568
|
+
2. Update the plan entry in `state.phase_log`:
|
|
547
569
|
- Set `completed_at: "{current ISO timestamp}"`
|
|
548
570
|
- Set `approved_by: "human"` (since this is a strict gate)
|
|
549
571
|
|
|
@@ -7,16 +7,17 @@ You are executing the `/sniper-review` command. Your job is to evaluate the curr
|
|
|
7
7
|
## Step 0: Pre-Flight -- Determine Current Phase
|
|
8
8
|
|
|
9
9
|
1. Read `.sniper/config.yaml`
|
|
10
|
-
2.
|
|
11
|
-
3. If
|
|
10
|
+
2. Determine the current active phase: find the last entry in `state.phase_log` where `completed_at` is null.
|
|
11
|
+
3. If no active phase (all completed or empty log):
|
|
12
12
|
```
|
|
13
|
-
ERROR: No active phase. The SNIPER lifecycle has not been started.
|
|
13
|
+
ERROR: No active phase. The SNIPER lifecycle has not been started or all phases are complete.
|
|
14
14
|
|
|
15
15
|
Current state:
|
|
16
16
|
Phase: not started
|
|
17
17
|
Sprint: 0
|
|
18
18
|
|
|
19
19
|
To begin, run one of these phase commands:
|
|
20
|
+
/sniper-ingest -- Ingest an existing codebase
|
|
20
21
|
/sniper-discover -- Start Phase 1: Discovery & Analysis
|
|
21
22
|
/sniper-plan -- Start Phase 2: Planning & Architecture
|
|
22
23
|
/sniper-solve -- Start Phase 3: Epic Sharding & Story Creation
|
|
@@ -24,7 +25,7 @@ You are executing the `/sniper-review` command. Your job is to evaluate the curr
|
|
|
24
25
|
```
|
|
25
26
|
Then STOP.
|
|
26
27
|
|
|
27
|
-
4. Store the current phase name. It must be one of: `discover`, `plan`, `solve`, `sprint`
|
|
28
|
+
4. Store the current phase name. It must be one of: `ingest`, `discover`, `plan`, `solve`, `sprint`
|
|
28
29
|
|
|
29
30
|
---
|
|
30
31
|
|
|
@@ -34,6 +35,7 @@ Use this mapping to determine which checklist to load and what gate mode to enfo
|
|
|
34
35
|
|
|
35
36
|
| Phase | Checklist File | Config Gate Key |
|
|
36
37
|
|-----------|-------------------------------------------|-----------------------|
|
|
38
|
+
| `ingest` | `.sniper/checklists/ingest-review.md` | `review_gates.after_ingest` |
|
|
37
39
|
| `discover` | `.sniper/checklists/discover-review.md` | `review_gates.after_discover` |
|
|
38
40
|
| `plan` | `.sniper/checklists/plan-review.md` | `review_gates.after_plan` |
|
|
39
41
|
| `solve` | `.sniper/checklists/story-review.md` | `review_gates.after_solve` |
|
|
@@ -41,6 +43,7 @@ Use this mapping to determine which checklist to load and what gate mode to enfo
|
|
|
41
43
|
|
|
42
44
|
1. Read the gate mode from `config.yaml` using the appropriate key
|
|
43
45
|
2. Read the checklist file
|
|
46
|
+
3. Check for domain pack checklists: scan `.sniper/packs/*/checklists/` for any `.md` files. If found, these will be evaluated as additional checklist items after the framework checklist (Step 3b).
|
|
44
47
|
|
|
45
48
|
If the checklist file does not exist:
|
|
46
49
|
```
|
|
@@ -55,6 +58,13 @@ Then STOP.
|
|
|
55
58
|
|
|
56
59
|
Based on the current phase, identify which artifact files need to be reviewed:
|
|
57
60
|
|
|
61
|
+
### Phase: ingest
|
|
62
|
+
| Artifact | Expected Path |
|
|
63
|
+
|---------------------|-------------------------|
|
|
64
|
+
| Project Brief | `docs/brief.md` |
|
|
65
|
+
| System Architecture | `docs/architecture.md` |
|
|
66
|
+
| Coding Conventions | `docs/conventions.md` |
|
|
67
|
+
|
|
58
68
|
### Phase: discover
|
|
59
69
|
| Artifact | Expected Path |
|
|
60
70
|
|---------------------|---------------------|
|
|
@@ -138,6 +148,72 @@ Be thorough but fair:
|
|
|
138
148
|
|
|
139
149
|
---
|
|
140
150
|
|
|
151
|
+
## Step 3c: Memory Compliance Checks
|
|
152
|
+
|
|
153
|
+
After evaluating the phase checklist, check project memory for compliance if memory files exist.
|
|
154
|
+
|
|
155
|
+
### 3c-1: Load Memory
|
|
156
|
+
|
|
157
|
+
Check if `.sniper/memory/` directory exists. If not, skip this step entirely.
|
|
158
|
+
|
|
159
|
+
Read:
|
|
160
|
+
- `.sniper/memory/conventions.yaml` — filter for entries with `enforcement: review_gate` or `enforcement: both`
|
|
161
|
+
- `.sniper/memory/anti-patterns.yaml` — all entries
|
|
162
|
+
- `.sniper/memory/decisions.yaml` — active entries only
|
|
163
|
+
|
|
164
|
+
If workspace memory exists (check config), also load workspace-level files.
|
|
165
|
+
|
|
166
|
+
### 3c-2: Convention Compliance
|
|
167
|
+
|
|
168
|
+
For each convention with review gate enforcement:
|
|
169
|
+
1. Read the convention's `rule` and `detection_hint` (if present)
|
|
170
|
+
2. Examine the sprint output / artifacts being reviewed
|
|
171
|
+
3. Check whether the convention was followed
|
|
172
|
+
4. Report as PASS (compliant) or WARN (violation with details)
|
|
173
|
+
|
|
174
|
+
### 3c-3: Anti-Pattern Scanning
|
|
175
|
+
|
|
176
|
+
For each anti-pattern:
|
|
177
|
+
1. Read the `detection_hint`
|
|
178
|
+
2. If a detection hint is present, search the changed files for matches
|
|
179
|
+
3. If matches found, report as WARN with file locations
|
|
180
|
+
4. If no detection hint, skip automated detection (will be caught in manual review)
|
|
181
|
+
|
|
182
|
+
### 3c-4: Decision Consistency
|
|
183
|
+
|
|
184
|
+
For each active decision:
|
|
185
|
+
1. Check if the sprint output contradicts the decision
|
|
186
|
+
2. Example: if decision says "Use PostgreSQL" but new code imports MongoDB, flag it
|
|
187
|
+
3. Report any contradictions
|
|
188
|
+
|
|
189
|
+
### 3c-5: Report Memory Compliance
|
|
190
|
+
|
|
191
|
+
Add a "Memory Compliance" section to the review output:
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
## Memory Compliance
|
|
195
|
+
|
|
196
|
+
### Convention Checks
|
|
197
|
+
PASS conv-001: Zod validation — all new routes use validation middleware
|
|
198
|
+
WARN conv-003: Barrel exports — 2 new directories missing index.ts
|
|
199
|
+
|
|
200
|
+
### Anti-Pattern Checks
|
|
201
|
+
PASS ap-001: No direct DB queries in handlers — clean
|
|
202
|
+
WARN ap-002: Silent error catch found in lib/webhook-delivery.ts:42
|
|
203
|
+
|
|
204
|
+
### Decision Consistency
|
|
205
|
+
PASS All decisions consistent
|
|
206
|
+
|
|
207
|
+
### Summary
|
|
208
|
+
{N} conventions checked, {M} violations
|
|
209
|
+
{N} anti-patterns checked, {M} matches found
|
|
210
|
+
{N} decisions checked, {M} contradictions
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
If there are violations, these count as review findings but do NOT block the gate by themselves (memory compliance is advisory unless the gate mode is strict AND the convention enforcement is review_gate).
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
141
217
|
## Step 4: Present Results
|
|
142
218
|
|
|
143
219
|
Print a formatted review report:
|
|
@@ -240,56 +316,44 @@ Based on the gate mode and results, take the appropriate action:
|
|
|
240
316
|
When a phase is approved for advancement:
|
|
241
317
|
|
|
242
318
|
1. Read the current `.sniper/config.yaml`
|
|
243
|
-
2.
|
|
244
|
-
- `discover` -> `plan`
|
|
245
|
-
- `plan` -> `solve`
|
|
246
|
-
- `solve` -> `sprint`
|
|
247
|
-
- `sprint` -> `sprint` (remains in sprint phase, increment sprint number)
|
|
248
|
-
|
|
249
|
-
3. Update the `state` section:
|
|
319
|
+
2. Find the active phase_log entry (the one where `completed_at` is null) and update it:
|
|
250
320
|
```yaml
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
phase_history:
|
|
254
|
-
- phase: {completed_phase}
|
|
255
|
-
started_at: {start_date_if_known_or_today}
|
|
256
|
-
completed_at: {today's date in YYYY-MM-DD format}
|
|
257
|
-
approved_by: {human or auto}
|
|
258
|
-
gate_mode: {strict|flexible|auto}
|
|
259
|
-
pass_count: {number}
|
|
260
|
-
warn_count: {number}
|
|
261
|
-
fail_count: {number}
|
|
262
|
-
# ... (preserve existing history entries)
|
|
263
|
-
current_sprint: {increment by 1 if completing a sprint, else keep}
|
|
264
|
-
artifacts:
|
|
265
|
-
# Update artifact statuses based on what was reviewed:
|
|
266
|
-
# If all items for an artifact passed -> "approved"
|
|
267
|
-
# If any items warn but no fails -> "draft"
|
|
268
|
-
# If the artifact exists but has fails -> "draft"
|
|
269
|
-
# Keep existing values for artifacts not reviewed in this phase
|
|
321
|
+
completed_at: "{current ISO timestamp}"
|
|
322
|
+
approved_by: "{human or auto-flexible or auto}"
|
|
270
323
|
```
|
|
271
324
|
|
|
272
|
-
|
|
325
|
+
3. Update artifact statuses based on what was reviewed:
|
|
326
|
+
- If all items for an artifact passed -> set status to `approved`
|
|
327
|
+
- If any items warn but no fails -> keep status as `draft`
|
|
328
|
+
- If the artifact exists but has fails -> keep status as `draft`
|
|
329
|
+
- Keep existing values for artifacts not reviewed in this phase
|
|
330
|
+
|
|
331
|
+
4. If the completed phase is `sprint`, increment `state.current_sprint` by 1.
|
|
273
332
|
|
|
274
|
-
5.
|
|
333
|
+
5. Write the updated config back to `.sniper/config.yaml`
|
|
334
|
+
|
|
335
|
+
6. Suggest the next command based on what was just completed:
|
|
336
|
+
|
|
337
|
+
| Completed Phase | Suggested Next Commands |
|
|
338
|
+
|----------------|------------------------|
|
|
339
|
+
| `ingest` | `/sniper-feature`, `/sniper-discover`, `/sniper-audit` |
|
|
340
|
+
| `discover` | `/sniper-plan` |
|
|
341
|
+
| `plan` | `/sniper-solve` |
|
|
342
|
+
| `solve` | `/sniper-sprint` |
|
|
343
|
+
| `sprint` | `/sniper-sprint` (next sprint), `/sniper-review` |
|
|
344
|
+
|
|
345
|
+
7. Print the completion confirmation:
|
|
275
346
|
```
|
|
276
347
|
============================================
|
|
277
|
-
Phase
|
|
348
|
+
Phase Review Complete
|
|
278
349
|
============================================
|
|
279
350
|
|
|
280
|
-
Completed: {phase}
|
|
281
|
-
Advanced to: {next_phase}
|
|
351
|
+
Completed: {phase} ({context})
|
|
282
352
|
Artifacts updated in config.yaml
|
|
283
353
|
|
|
284
|
-
|
|
354
|
+
Suggested next: {next_command}
|
|
285
355
|
```
|
|
286
356
|
|
|
287
|
-
Where `next_command` maps to:
|
|
288
|
-
- `plan` -> `/sniper-plan`
|
|
289
|
-
- `solve` -> `/sniper-solve`
|
|
290
|
-
- `sprint` -> `/sniper-sprint`
|
|
291
|
-
- staying in `sprint` -> `/sniper-sprint` (next sprint cycle)
|
|
292
|
-
|
|
293
357
|
---
|
|
294
358
|
|
|
295
359
|
## IMPORTANT RULES
|
|
@@ -35,16 +35,30 @@ Check that the following files exist and are non-empty. Read each file to verify
|
|
|
35
35
|
- If no, STOP.
|
|
36
36
|
- If yes, proceed with a note in the output.
|
|
37
37
|
|
|
38
|
-
### 0d.
|
|
38
|
+
### 0d. Config Migration Check
|
|
39
39
|
|
|
40
|
-
1. Read `
|
|
41
|
-
2.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
1. Read `schema_version` from `.sniper/config.yaml`.
|
|
41
|
+
2. If `schema_version` is absent or less than 2, run the v1→v2 migration. Write the updated config before proceeding.
|
|
42
|
+
|
|
43
|
+
### 0e. Verify Phase State
|
|
44
|
+
|
|
45
|
+
1. Determine the current active phase from `state.phase_log`.
|
|
46
|
+
2. **If no active phase:** Good -- proceed.
|
|
47
|
+
3. **If active phase is `solve`:** Already in progress.
|
|
48
|
+
- Ask the user: "A solve phase is already in progress ({context}). Options: (a) Resume it (b) Start a new solve with a different context"
|
|
49
|
+
4. **If active phase is something else:**
|
|
50
|
+
- Ask the user: "You have an active {phase} phase ({context}). Options: (a) Pause it and start solving (b) Complete {phase} first"
|
|
51
|
+
|
|
52
|
+
### 0f. Amendment Detection for Stories
|
|
53
|
+
|
|
54
|
+
1. Check if `docs/epics/` and `docs/stories/` directories exist and contain files.
|
|
55
|
+
2. **If story files exist:**
|
|
56
|
+
- Scan each story file for a `> **Status:** Complete (Sprint {N})` marker.
|
|
57
|
+
- **Completed stories** are NEVER overwritten. They are preserved as-is.
|
|
58
|
+
- **Draft stories** (no completion marker) can be amended: updated acceptance criteria, refreshed embedded context.
|
|
59
|
+
- **New requirements** (from amended PRD) generate new stories with the next available story number.
|
|
60
|
+
- **Removed requirements** — stories for removed PRD items are marked `> **Status:** Deprecated` rather than deleted.
|
|
61
|
+
3. **If no story files exist:** Normal create mode.
|
|
48
62
|
|
|
49
63
|
---
|
|
50
64
|
|
|
@@ -52,10 +66,10 @@ Check that the following files exist and are non-empty. Read each file to verify
|
|
|
52
66
|
|
|
53
67
|
Edit `.sniper/config.yaml`:
|
|
54
68
|
|
|
55
|
-
1.
|
|
56
|
-
2. Append to `state.phase_history`:
|
|
69
|
+
1. Append to `state.phase_log`:
|
|
57
70
|
```yaml
|
|
58
71
|
- phase: solve
|
|
72
|
+
context: "{from --context argument, or 'initial' for first run, or 'iteration-N' for re-runs}"
|
|
59
73
|
started_at: "{current ISO timestamp}"
|
|
60
74
|
completed_at: null
|
|
61
75
|
approved_by: null
|
|
@@ -293,9 +307,10 @@ If the self-review identified any issues:
|
|
|
293
307
|
|
|
294
308
|
Edit `.sniper/config.yaml`:
|
|
295
309
|
|
|
296
|
-
1.
|
|
297
|
-
|
|
298
|
-
|
|
310
|
+
1. Update artifact tracking:
|
|
311
|
+
- Set `state.artifacts.epics.status: draft` and increment `state.artifacts.epics.version`
|
|
312
|
+
- Set `state.artifacts.stories.status: draft` and increment `state.artifacts.stories.version`
|
|
313
|
+
2. Update the solve entry in `state.phase_log`:
|
|
299
314
|
- Set `completed_at: "{current ISO timestamp}"`
|
|
300
315
|
- Set `approved_by: "auto-flexible"` (this is a flexible gate)
|
|
301
316
|
|
|
@@ -359,6 +374,24 @@ Print a formatted summary:
|
|
|
359
374
|
|
|
360
375
|
---
|
|
361
376
|
|
|
377
|
+
## Feature-Scoped Mode
|
|
378
|
+
|
|
379
|
+
If `$ARGUMENTS` contains `--feature SNPR-{XXXX}`:
|
|
380
|
+
|
|
381
|
+
1. **Skip Steps 0b and 0c** (no need to check for main PRD or plan approval).
|
|
382
|
+
2. **Step 3:** Instead of reading main PRD/architecture/UX-spec, read:
|
|
383
|
+
- `docs/features/SNPR-{XXXX}/spec.md` (replaces PRD as primary input)
|
|
384
|
+
- `docs/features/SNPR-{XXXX}/arch-delta.md` (replaces architecture for feature scope)
|
|
385
|
+
- `docs/architecture.md` (for broader system context)
|
|
386
|
+
- `docs/conventions.md` (if exists, for coding patterns)
|
|
387
|
+
3. **Step 5:** Create stories in `docs/features/SNPR-{XXXX}/stories/` instead of `docs/stories/`.
|
|
388
|
+
4. **Step 6:** Skip epic creation. Feature stories don't need epics (the feature IS the epic).
|
|
389
|
+
5. **Step 7:** Number stories as S01, S02, etc. within the feature directory. Target 3-8 stories.
|
|
390
|
+
6. **Step 7 context embedding:** Embed context from the feature spec and arch-delta, NOT the main PRD.
|
|
391
|
+
7. **Step 11:** Update `state.features[].stories_total` with the count.
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
362
395
|
## IMPORTANT RULES
|
|
363
396
|
|
|
364
397
|
- This phase runs as a SINGLE AGENT. Do NOT create a team or spawn teammates.
|