@sniper.ai/core 4.0.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 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 velocity). Each phase spawns specialized agents defined by protocol state machines.
12
+ A full lifecycle runs through: **Discover** (research and analysis), **Define** (PRD and requirements), **Design** (architecture), **Solve** (story sharding), **Implement** (code with worktree isolation), **Review** (multi-faceted code review), and **Retro** (learnings and 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 (11 agents)
27
+ ├── agents/ # Agent definitions (13 agents)
28
28
  ├── personas/
29
29
  │ └── cognitive/ # Cognitive mixins (3 mixins)
30
- ├── skills/ # Slash command definitions (4 skills)
30
+ ├── skills/ # Slash command definitions (5 skills)
31
31
  ├── protocols/ # Protocol state machines (7 protocols)
32
- ├── templates/ # Artifact templates (14 templates)
33
- ├── checklists/ # Quality gate checklists (9 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
- 11 agent definitions, each with YAML frontmatter specifying write scope or isolation mode:
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 velocity tracking |
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
- 4 slash commands available in Claude Code:
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 and cost |
96
+ | `/sniper-status` | Show current protocol progress |
94
97
 
95
98
  ## Templates
96
99
 
@@ -110,11 +113,11 @@ Domain-specific knowledge is provided separately by domain packs (e.g., `@sniper
110
113
  | `knowledge-manifest.yaml` | YAML | Knowledge base manifest |
111
114
  | `checkpoint.yaml` | YAML | Protocol checkpoint state |
112
115
  | `live-status.yaml` | YAML | Live protocol status |
113
- | `signal-record.yaml` | YAML | Signal event record |
116
+ | `signal-record.yaml` | YAML | Signal event record (deprecated) |
114
117
 
115
118
  ## Checklists
116
119
 
117
- 11 quality gate checklists:
120
+ 13 quality gate checklists:
118
121
 
119
122
  | Checklist | Used by |
120
123
  |-----------|---------|
@@ -122,9 +125,10 @@ Domain-specific knowledge is provided separately by domain packs (e.g., `@sniper
122
125
  | `define` | full, feature protocols |
123
126
  | `design` | full, feature protocols |
124
127
  | `solve` | full, feature protocols |
125
- | `plan` | (deprecated — use define + design) |
126
128
  | `implement` | full, feature, patch, refactor, hotfix protocols |
127
129
  | `review` | full, feature, patch, refactor protocols |
130
+ | `retro` | full, feature, refactor protocols |
131
+ | `plan` | (deprecated — use define + design + solve) |
128
132
  | `multi-faceted-review` | Multi-model review mode |
129
133
  | `ingest-scan` | ingest protocol (scan phase) |
130
134
  | `ingest-document` | ingest protocol (document phase) |
package/agents/analyst.md CHANGED
@@ -27,3 +27,10 @@ You are a SNIPER analyst agent. You research, analyze, and produce discovery art
27
27
  - Flag unknowns as open questions rather than guessing
28
28
  - Do NOT make architectural decisions — surface options with tradeoffs for the architect
29
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -25,8 +25,9 @@ The orchestrator provides you with the `protocol_id` (e.g., `SNPR-20260307-a3f2`
25
25
  1. Read `.sniper/checkpoints/{protocol_id}-*` for the completed protocol's checkpoint history
26
26
  2. Read `.sniper/gates/` for gate results (pass/fail patterns)
27
27
  3. Read `.sniper/artifacts/{protocol_id}/meta.yaml` for protocol metadata
28
- 4. Analyze: Which gates failed first? Were there re-runs?
29
- 5. Write retro report to `.sniper/retros/{protocol_id}.yaml`
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?
30
+ 6. Write retro report to `.sniper/retros/{protocol_id}.yaml`
30
31
 
31
32
  ## Retro Report Schema
32
33
 
@@ -107,6 +108,33 @@ After extracting new learnings, check effectiveness of previously applied learni
107
108
  Flag for human review by adding to findings.
108
109
  5. If confidence drops below 0.2 after adjustment, set `status: deprecated`.
109
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
+
110
138
  ## Signal Analysis
111
139
 
112
140
  During the retrospective, analyze external signals from both legacy and new stores:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sniper.ai/core",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "SNIPER framework core — agents, skills, protocols, checklists, templates, and hooks",
5
5
  "type": "module",
6
6
  "exports": {
@@ -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.
@@ -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
@@ -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. **Write metadata:** Create `.sniper/artifacts/{protocol_id}/meta.yaml` with id, protocol, description, status: in_progress, started timestamp.
50
- 4. **Append to registry:** Add a row to `.sniper/artifacts/registry.md`. If registry doesn't exist, create it with a header row first.
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
 
@@ -133,6 +134,7 @@ For each agent in the phase, build the full prompt by layering these sources. Ea
133
134
  | 3. Domain knowledge | `.sniper/knowledge/manifest.yaml` → referenced files (from agent's `knowledge_sources` frontmatter) | SKIP — no knowledge section |
134
135
  | 4. Workspace conventions | `.sniper-workspace/config.yaml` → `shared.conventions` and `shared.anti_patterns` | SKIP — no workspace section |
135
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 |
136
138
 
137
139
  **Learning Composition (Layer 5):**
138
140
 
@@ -151,7 +153,7 @@ After composing learnings into the prompt, record the current protocol ID in eac
151
153
 
152
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."
153
155
 
154
- 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).
155
157
 
156
158
  Replace all `{protocol_id}` placeholders in the composed prompt with the actual protocol ID.
157
159
 
@@ -189,16 +191,51 @@ For agents working in worktrees (after all implementation agents complete):
189
191
  When a phase has `interactive_review: true`:
190
192
 
191
193
  1. Read produced artifacts from `.sniper/artifacts/` or `.sniper/artifacts/{protocol_id}/` as appropriate
192
- 2. Present a structured summary appropriate to the phase:
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:
193
196
  - **discover:** findings, constraints, codebase landscape, open questions
194
197
  - **define:** requirements, success criteria, scope boundaries, out-of-scope items
195
198
  - **design:** key architectural decisions, component overview, data model, trade-offs
196
199
  - **solve:** story list, dependencies, acceptance criteria summary
197
- 3. Offer options:
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:
198
202
  - **Approve** — continue to next phase
199
203
  - **Request changes** — describe changes (architect/PM will revise, then re-present)
200
204
  - **Edit directly** — user modifies plan files, says "done", re-validate via gate
201
- 4. Only advance after explicit user approval
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.
202
239
 
203
240
  ## Reference: Retrospective (Legacy)
204
241
 
@@ -0,0 +1,5 @@
1
+ # Decision log for protocol {protocol_id}
2
+ # Agents append to this file when a Structured Decision Prompt (SDP) is resolved.
3
+ # Downstream agents read this file to understand constraints already established.
4
+
5
+ decisions: []