@sniper.ai/core 2.0.0 → 3.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.
Files changed (210) hide show
  1. package/README.md +87 -98
  2. package/agents/analyst.md +29 -0
  3. package/agents/architect.md +38 -0
  4. package/agents/backend-dev.md +43 -0
  5. package/agents/code-reviewer.md +72 -0
  6. package/agents/doc-writer.md +60 -0
  7. package/agents/frontend-dev.md +43 -0
  8. package/agents/fullstack-dev.md +44 -0
  9. package/agents/gate-reviewer.md +72 -0
  10. package/agents/lead-orchestrator.md +51 -0
  11. package/agents/product-manager.md +40 -0
  12. package/agents/qa-engineer.md +37 -0
  13. package/agents/retro-analyst.md +104 -0
  14. package/checklists/discover.yaml +23 -0
  15. package/checklists/implement.yaml +28 -0
  16. package/checklists/ingest-document.yaml +18 -0
  17. package/checklists/ingest-extract.yaml +13 -0
  18. package/checklists/ingest-scan.yaml +18 -0
  19. package/checklists/multi-faceted-review.yaml +57 -0
  20. package/checklists/plan.yaml +36 -0
  21. package/checklists/refactor-analyze.yaml +19 -0
  22. package/checklists/review.yaml +29 -0
  23. package/claude-md.template +42 -0
  24. package/config.template.yaml +156 -0
  25. package/hooks/settings-hooks.json +40 -0
  26. package/hooks/signal-hooks.json +16 -0
  27. package/package.json +23 -5
  28. package/personas/cognitive/devils-advocate.md +24 -0
  29. package/personas/cognitive/performance-focused.md +23 -0
  30. package/personas/cognitive/security-first.md +24 -0
  31. package/protocols/explore.yaml +21 -0
  32. package/protocols/feature.yaml +47 -0
  33. package/protocols/full.yaml +65 -0
  34. package/protocols/hotfix.yaml +19 -0
  35. package/protocols/ingest.yaml +42 -0
  36. package/protocols/patch.yaml +30 -0
  37. package/protocols/refactor.yaml +43 -0
  38. package/schemas/checkpoint.schema.yaml +133 -0
  39. package/schemas/cost.schema.yaml +97 -0
  40. package/schemas/dependency-graph.schema.yaml +37 -0
  41. package/schemas/gate-result.schema.yaml +101 -0
  42. package/schemas/knowledge-manifest.schema.yaml +39 -0
  43. package/schemas/live-status.schema.yaml +122 -0
  44. package/schemas/protocol-meta.schema.yaml +58 -0
  45. package/schemas/protocol.schema.yaml +100 -0
  46. package/schemas/retro.schema.yaml +95 -0
  47. package/schemas/revert-plan.schema.yaml +40 -0
  48. package/schemas/signal.schema.yaml +39 -0
  49. package/schemas/velocity.schema.yaml +52 -0
  50. package/schemas/workspace-lock.schema.yaml +34 -0
  51. package/schemas/workspace.schema.yaml +82 -0
  52. package/skills/sniper-flow/SKILL.md +196 -0
  53. package/skills/sniper-init/SKILL.md +102 -0
  54. package/skills/sniper-review/SKILL.md +49 -0
  55. package/skills/sniper-status/SKILL.md +79 -0
  56. package/templates/architecture.md +23 -0
  57. package/templates/checkpoint.yaml +27 -0
  58. package/templates/codebase-overview.md +19 -0
  59. package/templates/cost.yaml +23 -0
  60. package/templates/custom-protocol.yaml +98 -0
  61. package/templates/knowledge-manifest.yaml +32 -0
  62. package/templates/live-status.yaml +26 -0
  63. package/templates/multi-faceted-review-report.md +28 -0
  64. package/templates/registry.md +4 -0
  65. package/templates/review-report.md +25 -0
  66. package/templates/signal-record.yaml +37 -0
  67. package/templates/spec.md +28 -0
  68. package/templates/story.md +19 -0
  69. package/templates/velocity.yaml +9 -0
  70. package/templates/workspace-config.yaml +44 -0
  71. package/framework/checklists/code-review.md +0 -33
  72. package/framework/checklists/debug-review.md +0 -34
  73. package/framework/checklists/discover-review.md +0 -33
  74. package/framework/checklists/doc-review.md +0 -39
  75. package/framework/checklists/feature-review.md +0 -42
  76. package/framework/checklists/ingest-review.md +0 -42
  77. package/framework/checklists/memory-review.md +0 -30
  78. package/framework/checklists/perf-review.md +0 -33
  79. package/framework/checklists/plan-review.md +0 -52
  80. package/framework/checklists/refactor-review.md +0 -33
  81. package/framework/checklists/security-review.md +0 -34
  82. package/framework/checklists/sprint-review.md +0 -41
  83. package/framework/checklists/story-review.md +0 -30
  84. package/framework/checklists/test-review.md +0 -32
  85. package/framework/checklists/workspace-review.md +0 -34
  86. package/framework/claude-md.template +0 -37
  87. package/framework/commands/sniper-audit.md +0 -1549
  88. package/framework/commands/sniper-compose.md +0 -323
  89. package/framework/commands/sniper-debug.md +0 -337
  90. package/framework/commands/sniper-discover.md +0 -423
  91. package/framework/commands/sniper-doc.md +0 -441
  92. package/framework/commands/sniper-feature.md +0 -515
  93. package/framework/commands/sniper-ingest.md +0 -506
  94. package/framework/commands/sniper-init.md +0 -388
  95. package/framework/commands/sniper-memory.md +0 -219
  96. package/framework/commands/sniper-plan.md +0 -630
  97. package/framework/commands/sniper-review.md +0 -369
  98. package/framework/commands/sniper-solve.md +0 -408
  99. package/framework/commands/sniper-sprint.md +0 -716
  100. package/framework/commands/sniper-status.md +0 -481
  101. package/framework/commands/sniper-workspace-feature.md +0 -267
  102. package/framework/commands/sniper-workspace-init.md +0 -252
  103. package/framework/commands/sniper-workspace-status.md +0 -112
  104. package/framework/commands/sniper-workspace-validate.md +0 -138
  105. package/framework/config.template.yaml +0 -196
  106. package/framework/personas/cognitive/devils-advocate.md +0 -30
  107. package/framework/personas/cognitive/mentor-explainer.md +0 -29
  108. package/framework/personas/cognitive/performance-focused.md +0 -30
  109. package/framework/personas/cognitive/security-first.md +0 -29
  110. package/framework/personas/cognitive/systems-thinker.md +0 -29
  111. package/framework/personas/cognitive/user-empathetic.md +0 -29
  112. package/framework/personas/domain/.gitkeep +0 -0
  113. package/framework/personas/process/analyst.md +0 -29
  114. package/framework/personas/process/architect.md +0 -30
  115. package/framework/personas/process/architecture-cartographer.md +0 -25
  116. package/framework/personas/process/code-archaeologist.md +0 -22
  117. package/framework/personas/process/code-investigator.md +0 -29
  118. package/framework/personas/process/code-reviewer.md +0 -26
  119. package/framework/personas/process/contract-designer.md +0 -31
  120. package/framework/personas/process/convention-miner.md +0 -27
  121. package/framework/personas/process/coverage-analyst.md +0 -24
  122. package/framework/personas/process/developer.md +0 -32
  123. package/framework/personas/process/doc-analyst.md +0 -63
  124. package/framework/personas/process/doc-reviewer.md +0 -62
  125. package/framework/personas/process/doc-writer.md +0 -42
  126. package/framework/personas/process/flake-hunter.md +0 -30
  127. package/framework/personas/process/impact-analyst.md +0 -23
  128. package/framework/personas/process/integration-validator.md +0 -29
  129. package/framework/personas/process/log-analyst.md +0 -22
  130. package/framework/personas/process/migration-architect.md +0 -24
  131. package/framework/personas/process/perf-profiler.md +0 -27
  132. package/framework/personas/process/product-manager.md +0 -32
  133. package/framework/personas/process/qa-engineer.md +0 -31
  134. package/framework/personas/process/release-manager.md +0 -23
  135. package/framework/personas/process/retro-analyst.md +0 -30
  136. package/framework/personas/process/scrum-master.md +0 -31
  137. package/framework/personas/process/threat-modeler.md +0 -30
  138. package/framework/personas/process/triage-lead.md +0 -23
  139. package/framework/personas/process/ux-designer.md +0 -31
  140. package/framework/personas/process/vuln-scanner.md +0 -27
  141. package/framework/personas/process/workspace-orchestrator.md +0 -30
  142. package/framework/personas/technical/ai-ml.md +0 -33
  143. package/framework/personas/technical/api-design.md +0 -32
  144. package/framework/personas/technical/backend.md +0 -32
  145. package/framework/personas/technical/database.md +0 -32
  146. package/framework/personas/technical/frontend.md +0 -33
  147. package/framework/personas/technical/infrastructure.md +0 -32
  148. package/framework/personas/technical/security.md +0 -34
  149. package/framework/settings.template.json +0 -6
  150. package/framework/spawn-prompts/_template.md +0 -25
  151. package/framework/teams/debug.yaml +0 -56
  152. package/framework/teams/discover.yaml +0 -57
  153. package/framework/teams/doc.yaml +0 -76
  154. package/framework/teams/feature-plan.yaml +0 -61
  155. package/framework/teams/ingest.yaml +0 -85
  156. package/framework/teams/perf.yaml +0 -33
  157. package/framework/teams/plan.yaml +0 -86
  158. package/framework/teams/refactor.yaml +0 -34
  159. package/framework/teams/retro.yaml +0 -30
  160. package/framework/teams/review-pr.yaml +0 -73
  161. package/framework/teams/review-release.yaml +0 -70
  162. package/framework/teams/security.yaml +0 -59
  163. package/framework/teams/solve.yaml +0 -48
  164. package/framework/teams/sprint.yaml +0 -68
  165. package/framework/teams/test.yaml +0 -59
  166. package/framework/teams/workspace-feature.yaml +0 -69
  167. package/framework/teams/workspace-validation.yaml +0 -27
  168. package/framework/templates/arch-delta.md +0 -74
  169. package/framework/templates/architecture.md +0 -95
  170. package/framework/templates/brief.md +0 -73
  171. package/framework/templates/bug-report.md +0 -55
  172. package/framework/templates/contract-validation-report.md +0 -68
  173. package/framework/templates/contract.yaml +0 -60
  174. package/framework/templates/conventions.md +0 -59
  175. package/framework/templates/coverage-report.md +0 -67
  176. package/framework/templates/doc-api.md +0 -53
  177. package/framework/templates/doc-guide.md +0 -35
  178. package/framework/templates/doc-readme.md +0 -49
  179. package/framework/templates/epic.md +0 -47
  180. package/framework/templates/feature-brief.md +0 -54
  181. package/framework/templates/feature-spec.md +0 -53
  182. package/framework/templates/flaky-report.md +0 -64
  183. package/framework/templates/investigation.md +0 -49
  184. package/framework/templates/memory-anti-pattern.yaml +0 -16
  185. package/framework/templates/memory-convention.yaml +0 -17
  186. package/framework/templates/memory-decision.yaml +0 -16
  187. package/framework/templates/migration-plan.md +0 -47
  188. package/framework/templates/optimization-plan.md +0 -59
  189. package/framework/templates/performance-profile.md +0 -64
  190. package/framework/templates/personas.md +0 -118
  191. package/framework/templates/postmortem.md +0 -69
  192. package/framework/templates/pr-review.md +0 -50
  193. package/framework/templates/prd.md +0 -92
  194. package/framework/templates/refactor-scope.md +0 -52
  195. package/framework/templates/release-readiness.md +0 -66
  196. package/framework/templates/retro.yaml +0 -44
  197. package/framework/templates/risks.md +0 -64
  198. package/framework/templates/security.md +0 -111
  199. package/framework/templates/sprint-review.md +0 -32
  200. package/framework/templates/story.md +0 -53
  201. package/framework/templates/threat-model.md +0 -71
  202. package/framework/templates/ux-spec.md +0 -71
  203. package/framework/templates/vulnerability-report.md +0 -56
  204. package/framework/templates/workspace-brief.md +0 -52
  205. package/framework/templates/workspace-plan.md +0 -50
  206. package/framework/workflows/discover-only.md +0 -39
  207. package/framework/workflows/full-lifecycle.md +0 -56
  208. package/framework/workflows/quick-feature.md +0 -44
  209. package/framework/workflows/sprint-cycle.md +0 -47
  210. package/framework/workflows/workspace-feature.md +0 -71
@@ -0,0 +1,95 @@
1
+ $schema: "https://json-schema.org/draft/2020-12/schema"
2
+ $id: "https://sniper.ai/schemas/retro"
3
+ title: Retrospective Report
4
+ description: Schema for SNIPER retrospective reports generated after a lifecycle run completes.
5
+ type: object
6
+ required:
7
+ - protocol
8
+ - completed_at
9
+ properties:
10
+ protocol:
11
+ type: string
12
+ description: The SNIPER protocol version identifier.
13
+ completed_at:
14
+ type: string
15
+ format: date-time
16
+ description: ISO 8601 timestamp of when the lifecycle run completed.
17
+ duration_phases:
18
+ type: array
19
+ description: Per-phase duration and execution summary.
20
+ items:
21
+ type: object
22
+ required:
23
+ - phase
24
+ - agents
25
+ - gate_attempts
26
+ - gate_result
27
+ properties:
28
+ phase:
29
+ type: string
30
+ description: Phase name.
31
+ agents:
32
+ type: integer
33
+ minimum: 0
34
+ description: Number of agents that participated in this phase.
35
+ gate_attempts:
36
+ type: integer
37
+ minimum: 0
38
+ description: Number of times the gate review was attempted.
39
+ gate_result:
40
+ type: string
41
+ enum:
42
+ - pass
43
+ - fail
44
+ description: Final gate review outcome for this phase.
45
+ metrics:
46
+ type: object
47
+ description: Aggregate metrics for the entire lifecycle run.
48
+ properties:
49
+ total_tokens:
50
+ type: integer
51
+ minimum: 0
52
+ description: Total tokens consumed across all phases.
53
+ total_agents_spawned:
54
+ type: integer
55
+ minimum: 0
56
+ description: Total number of agents spawned across all phases.
57
+ gate_pass_rate:
58
+ type: number
59
+ minimum: 0
60
+ maximum: 1
61
+ description: Fraction of gate reviews that passed on the first attempt.
62
+ findings:
63
+ type: object
64
+ description: Retrospective findings and action items.
65
+ properties:
66
+ went_well:
67
+ type: array
68
+ description: Things that went well during the lifecycle run.
69
+ items:
70
+ type: string
71
+ needs_improvement:
72
+ type: array
73
+ description: Areas that need improvement.
74
+ items:
75
+ type: string
76
+ action_items:
77
+ type: array
78
+ description: Concrete action items for future runs.
79
+ items:
80
+ type: string
81
+ velocity:
82
+ type: object
83
+ description: Velocity metrics for this execution, used for budget calibration.
84
+ properties:
85
+ wall_clock_seconds:
86
+ type: number
87
+ minimum: 0
88
+ description: Total wall clock time for the protocol execution in seconds.
89
+ tokens_per_phase:
90
+ type: object
91
+ description: Token usage broken down by phase name.
92
+ additionalProperties:
93
+ type: integer
94
+ minimum: 0
95
+ additionalProperties: false
@@ -0,0 +1,40 @@
1
+ $schema: "https://json-schema.org/draft/2020-12/schema"
2
+ $id: "https://sniper.ai/schemas/revert-plan"
3
+ title: Revert Plan
4
+ description: Schema for SNIPER logical revert plans that track which commits to revert.
5
+ type: object
6
+ required:
7
+ - protocol
8
+ - commits_to_revert
9
+ - backup_branch
10
+ - target_state
11
+ properties:
12
+ protocol:
13
+ type: string
14
+ description: Protocol ID being reverted.
15
+ phase:
16
+ type: string
17
+ description: Optional specific phase being reverted.
18
+ commits_to_revert:
19
+ type: array
20
+ items:
21
+ type: object
22
+ required: [sha, message, agent]
23
+ properties:
24
+ sha: { type: string }
25
+ message: { type: string }
26
+ agent: { type: string }
27
+ description: Commits to revert in reverse chronological order.
28
+ backup_branch:
29
+ type: string
30
+ description: Branch name for backup before revert.
31
+ target_state:
32
+ type: string
33
+ description: Description of the target state after revert.
34
+ created_at:
35
+ type: string
36
+ format: date-time
37
+ dry_run:
38
+ type: boolean
39
+ description: Whether this was a dry run only.
40
+ additionalProperties: false
@@ -0,0 +1,39 @@
1
+ $schema: "https://json-schema.org/draft/2020-12/schema"
2
+ $id: "https://sniper.ai/schemas/signal"
3
+ title: External Signal Record
4
+ description: Schema for SNIPER signal records that capture learnings from CI failures, PR reviews, and production errors.
5
+ type: object
6
+ required:
7
+ - type
8
+ - source
9
+ - timestamp
10
+ - summary
11
+ properties:
12
+ type:
13
+ type: string
14
+ enum: [ci_failure, pr_review_comment, production_error, manual]
15
+ description: Signal type classification.
16
+ source:
17
+ type: string
18
+ description: Where the signal came from (e.g., "github-actions", "pr-42", "datadog").
19
+ timestamp:
20
+ type: string
21
+ format: date-time
22
+ summary:
23
+ type: string
24
+ description: One-line summary of the signal.
25
+ details:
26
+ type: string
27
+ description: Full details (error message, review comment text, etc.).
28
+ learning:
29
+ type: string
30
+ description: Extracted learning or pattern to apply in future.
31
+ relevance_tags:
32
+ type: array
33
+ items: { type: string }
34
+ description: Tags for matching against agent context.
35
+ affected_files:
36
+ type: array
37
+ items: { type: string }
38
+ description: File paths affected by this signal.
39
+ additionalProperties: false
@@ -0,0 +1,52 @@
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
@@ -0,0 +1,34 @@
1
+ $schema: "https://json-schema.org/draft/2020-12/schema"
2
+ $id: "https://sniper.ai/schemas/workspace-lock"
3
+ title: Workspace File Lock
4
+ description: Schema for advisory file locks in SNIPER workspace coordination.
5
+ type: object
6
+ required:
7
+ - file
8
+ - locked_by
9
+ - since
10
+ properties:
11
+ file:
12
+ type: string
13
+ description: Relative file path being locked.
14
+ locked_by:
15
+ type: object
16
+ required: [project, agent, protocol]
17
+ properties:
18
+ project:
19
+ type: string
20
+ description: Project name that holds the lock.
21
+ agent:
22
+ type: string
23
+ description: Agent that acquired the lock.
24
+ protocol:
25
+ type: string
26
+ description: Protocol execution that holds the lock.
27
+ since:
28
+ type: string
29
+ format: date-time
30
+ description: When the lock was acquired.
31
+ reason:
32
+ type: string
33
+ description: Why the lock was acquired.
34
+ additionalProperties: false
@@ -0,0 +1,82 @@
1
+ $schema: "https://json-schema.org/draft/2020-12/schema"
2
+ $id: "https://sniper.ai/schemas/workspace"
3
+ title: Workspace Configuration
4
+ description: Schema for SNIPER workspace config files that coordinate multi-project orchestration.
5
+ type: object
6
+ required:
7
+ - name
8
+ - projects
9
+ properties:
10
+ name:
11
+ type: string
12
+ description: Human-readable workspace name.
13
+ projects:
14
+ type: array
15
+ description: List of projects managed by this workspace.
16
+ items:
17
+ type: object
18
+ required:
19
+ - name
20
+ - path
21
+ properties:
22
+ name:
23
+ type: string
24
+ description: Project identifier within the workspace.
25
+ path:
26
+ type: string
27
+ description: Relative directory path from workspace root to the project.
28
+ type:
29
+ type: string
30
+ description: Optional project type label (e.g. api, frontend, library).
31
+ shared:
32
+ type: object
33
+ description: Shared conventions and decisions applied across all workspace projects.
34
+ properties:
35
+ conventions:
36
+ type: array
37
+ description: Coding conventions enforced across all projects.
38
+ items:
39
+ type: string
40
+ anti_patterns:
41
+ type: array
42
+ description: Patterns to avoid across all projects.
43
+ items:
44
+ type: string
45
+ architectural_decisions:
46
+ type: array
47
+ description: Architecture Decision Records shared across the workspace.
48
+ items:
49
+ type: object
50
+ required:
51
+ - id
52
+ - title
53
+ - decision
54
+ - rationale
55
+ - date
56
+ properties:
57
+ id:
58
+ type: string
59
+ description: Unique ADR identifier (e.g. ADR-001).
60
+ title:
61
+ type: string
62
+ description: Short title of the decision.
63
+ decision:
64
+ type: string
65
+ description: The decision that was made.
66
+ rationale:
67
+ type: string
68
+ description: Why this decision was made.
69
+ date:
70
+ type: string
71
+ format: date
72
+ description: Date the decision was recorded (YYYY-MM-DD).
73
+ additionalProperties: false
74
+ memory:
75
+ type: object
76
+ description: Configuration for shared workspace memory.
77
+ properties:
78
+ directory:
79
+ type: string
80
+ description: Path to the shared memory directory relative to workspace root.
81
+ additionalProperties: false
82
+ additionalProperties: false
@@ -0,0 +1,196 @@
1
+ ---
2
+ name: sniper-flow
3
+ description: Execute a SNIPER protocol — the core execution engine
4
+ arguments:
5
+ - name: protocol
6
+ description: Protocol to run (full, feature, patch, ingest, explore, refactor, hotfix). Auto-detected if omitted.
7
+ required: false
8
+ - name: resume
9
+ description: Resume from last checkpoint
10
+ required: false
11
+ type: boolean
12
+ - name: phase
13
+ description: Start from a specific phase (skips earlier phases)
14
+ required: false
15
+ ---
16
+
17
+ # /sniper-flow
18
+
19
+ You are the SNIPER protocol execution engine. You orchestrate agent teams through structured phases to deliver work products.
20
+
21
+ ## 1. Select Protocol
22
+
23
+ ```
24
+ --protocol given? → Use it directly
25
+ --resume given? → Read latest checkpoint from .sniper/checkpoints/, resume from that phase
26
+ --phase given? → Use auto-detected protocol, skip to specified phase
27
+ Otherwise → Auto-detect (see below), confirm with user before proceeding
28
+ ```
29
+
30
+ **Auto-detection** — match user intent, no file reads needed:
31
+ | Keywords | Protocol |
32
+ |----------|----------|
33
+ | "critical", "urgent", "production down", "hotfix" | `hotfix` |
34
+ | Bug fix, small change (< 5 files) | `patch` |
35
+ | New feature, significant enhancement | `feature` |
36
+ | New project, major rework, multi-component | `full` |
37
+ | Understand, document existing codebase | `ingest` |
38
+ | "what is", "how does", "analyze", research | `explore` |
39
+ | "refactor", "clean up", "improve", "reorganize" | `refactor` |
40
+
41
+ After auto-detection, check trigger tables: run `git diff --name-only` and match against `.sniper/config.yaml` `triggers` section. Trigger overrides take precedence.
42
+
43
+ **Protocol resolution order:** `.sniper/protocols/<name>.yaml` (custom) → `@sniper.ai/core/protocols/<name>.yaml` (built-in).
44
+
45
+ ## 2. Initialize Protocol
46
+
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
+ 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.
51
+
52
+ ## 3. Phase Execution Loop
53
+
54
+ For each phase in the protocol, execute these 5 steps:
55
+
56
+ ### Setup
57
+
58
+ 1. Read protocol YAML for the current phase definition
59
+ 2. Read `.sniper/config.yaml` for agent config, ownership, commands
60
+ 3. Check `.sniper/memory/velocity.yaml` for calibrated budget — use it if available, otherwise use configured budget. Log which source is used.
61
+ 4. Compose agents per [Reference: Agent Composition](#reference-agent-composition)
62
+
63
+ ### Execute
64
+
65
+ 1. Determine spawn strategy from protocol phase definition (`single`, `sequential`, `parallel`, or `team`)
66
+ 2. Spawn agents per [Reference: Spawn Strategies](#reference-spawn-strategies)
67
+ 3. Monitor via TaskList — if an agent is blocked, investigate and guide via SendMessage
68
+ 4. If an agent crashes: note the failure, continue with remaining agents
69
+ 5. After all parallel agents complete: coordinate worktree merges per [Reference: Merge Coordination](#reference-merge-coordination)
70
+
71
+ ### Checkpoint
72
+
73
+ Write checkpoint to `.sniper/checkpoints/{protocol_id}-{phase}-{timestamp}.yaml`:
74
+ ```yaml
75
+ protocol: <name>
76
+ protocol_id: <SNPR-YYYYMMDD-XXXX>
77
+ phase: <phase>
78
+ timestamp: <ISO 8601>
79
+ status: completed | failed
80
+ agents: [status per agent]
81
+ token_usage: [phase + cumulative]
82
+ commits: [git SHAs produced]
83
+ ```
84
+
85
+ Update `.sniper/live-status.yaml` with current phase, agent statuses, and cost percentage.
86
+
87
+ ### Gate
88
+
89
+ 1. Write `.sniper/pending-gate.yaml` with phase name and checklist reference
90
+ 2. Spawn gate-reviewer agent with the `{protocol_id}` for path resolution
91
+ 3. Read gate result from `.sniper/gates/`
92
+ 4. **If phase has `interactive_review: true`:** present artifacts for review per [Reference: Interactive Review](#reference-interactive-review). User must explicitly approve before advancing.
93
+ 5. **Gate pass + `human_approval: false`:** advance
94
+ 6. **Gate pass + `human_approval: true` + not already approved via interactive review:** present results, wait for approval
95
+ 7. **Gate pass + `human_approval: true` + already approved via interactive review:** advance (don't ask twice)
96
+ 8. **Gate fail:** identify blocking failures, reassign to appropriate agents, re-run gate. After 3 failures: escalate to user.
97
+
98
+ ### Advance
99
+
100
+ 1. If phase has `doc_sync: true`: spawn `doc-writer` agent to update `CLAUDE.md`, `README.md`, and `docs/architecture.md` based on the git diff from this phase. Use `Edit` for surgical updates.
101
+ 2. Move to next phase. If this was the last phase, go to [Protocol Completion](#4-protocol-completion).
102
+
103
+ ## 4. Protocol Completion
104
+
105
+ 1. Write final checkpoint
106
+ 2. Update `.sniper/live-status.yaml` with `status: completed`
107
+ 3. Update `.sniper/artifacts/{protocol_id}/meta.yaml` with final status, token usage, commits, agents used
108
+ 4. Update `.sniper/artifacts/registry.md` entry from `in_progress` to `completed`
109
+ 5. Present summary: phases completed, gate results, token usage
110
+ 6. If `auto_retro: true` in protocol: spawn `retro-analyst` as background task (see [Reference: Retrospective](#reference-retrospective))
111
+
112
+ ## Cost Tracking
113
+
114
+ Maintain `.sniper/cost.yaml` throughout execution. At each checkpoint:
115
+ - `warn_threshold` → log warning, continue
116
+ - `soft_cap` → pause, ask user whether to continue
117
+ - `hard_cap` → checkpoint and stop gracefully
118
+
119
+ Read thresholds from `.sniper/config.yaml` cost section.
120
+
121
+ ## Rules
122
+
123
+ - ALWAYS generate a protocol ID and create `.sniper/artifacts/{protocol_id}/` before spawning any agent
124
+ - ALWAYS checkpoint between phases
125
+ - ALWAYS respect token budgets
126
+ - ALWAYS present the plan for interactive review when `interactive_review: true`
127
+ - NEVER skip a gate — every phase transition goes through its gate
128
+ - NEVER advance past a failed blocking gate check
129
+ - NEVER implement code yourself — delegate all work to agents
130
+ - When `human_approval` is required, present clear options and wait
131
+
132
+ ---
133
+
134
+ ## Reference: Agent Composition
135
+
136
+ For each agent in the phase, build the full prompt by layering these sources. Each layer is optional except the base.
137
+
138
+ | Layer | Source | If missing |
139
+ |-------|--------|------------|
140
+ | 1. Base agent | `.claude/agents/<name>.md` | FATAL — abort phase |
141
+ | 2. Mixins | `.claude/personas/cognitive/<mixin>.md` (from `config.agents.mixins.<agent>`) | WARN — skip mixin, continue |
142
+ | 3. Domain knowledge | `.sniper/knowledge/manifest.yaml` → referenced files (from agent's `knowledge_sources` frontmatter) | SKIP — no knowledge section |
143
+ | 4. Workspace conventions | `.sniper-workspace/config.yaml` → `shared.conventions` and `shared.anti_patterns` | SKIP — no workspace section |
144
+ | 5. Signals | `.sniper/memory/signals/` → top 10 most relevant by `affected_files` and `relevance_tags` | SKIP — no signals section |
145
+
146
+ The composed prompt = base definition + concatenated mixin content + `## Domain Knowledge` section + `## Workspace Conventions` section + `## Anti-Patterns (Workspace)` section + `## Recent Learnings` section (formatted as `- [<type>] <summary> (<affected_files>)`).
147
+
148
+ Replace all `{protocol_id}` placeholders in the composed prompt with the actual protocol ID.
149
+
150
+ Truncate domain knowledge content to stay within `config.knowledge.max_total_tokens` (default: 50000 tokens).
151
+
152
+ ## Reference: Spawn Strategies
153
+
154
+ **`single`** — One agent via Task tool. No team overhead.
155
+ ```
156
+ Task tool: prompt = composed agent prompt + task assignment
157
+ mode: "plan" if plan_approval is true, else "bypassPermissions"
158
+ isolation: "worktree" if agent has isolation: worktree
159
+ ```
160
+
161
+ **`sequential`** — Agents run one-after-another via Task tool. Output from each feeds into the next as context.
162
+
163
+ **`parallel`** — Agents run concurrently via Task tool with `run_in_background: true`. Each agent works in its own worktree. Wait for all to complete.
164
+
165
+ **`team`** — Full Agent Team via TeamCreate + shared task list + messaging. Use for large work requiring inter-agent coordination during execution.
166
+ ```
167
+ TeamCreate → create team for this phase
168
+ TaskCreate → create tasks with dependencies from protocol
169
+ Task tool → spawn each teammate with team_name
170
+ ```
171
+
172
+ ## Reference: Merge Coordination
173
+
174
+ For agents working in worktrees (after all implementation agents complete):
175
+ 1. Attempt to merge each worktree
176
+ 2. If merge conflicts: identify conflicting files, assign resolution to the file owner, re-run tests after resolution
177
+ 3. The orchestrator coordinates merges — agents never merge their own worktrees
178
+
179
+ ## Reference: Interactive Review
180
+
181
+ When a phase has `interactive_review: true`:
182
+
183
+ 1. Read produced artifacts from `.sniper/artifacts/{protocol_id}/` (e.g., `plan.md`, `prd.md`, `stories/`)
184
+ 2. Present a structured summary: key architectural decisions, component overview, story count, open questions
185
+ 3. Offer options:
186
+ - **Approve** — continue to next phase
187
+ - **Request changes** — describe changes (architect/PM will revise, then re-present)
188
+ - **Edit directly** — user modifies plan files, says "done", re-validate via gate
189
+ 4. Only advance after explicit user approval
190
+
191
+ ## Reference: Retrospective
192
+
193
+ When `auto_retro: true`, after protocol completion:
194
+ 1. Spawn `retro-analyst` as a background Task with: protocol ID, checkpoint history, gate results, cost data
195
+ 2. The retro-analyst writes a report to `.sniper/retros/{protocol_id}.yaml`, updates `.sniper/memory/velocity.yaml` with execution metrics, and calculates calibrated budgets if 5+ data points exist
196
+ 3. Runs in background — user doesn't wait for it
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: sniper-init
3
+ description: Initialize SNIPER v3 in a new or existing project
4
+ arguments:
5
+ - name: language
6
+ description: Primary language (auto-detected if omitted)
7
+ required: false
8
+ ---
9
+
10
+ # /sniper-init
11
+
12
+ Initialize SNIPER v3 framework in the current project.
13
+
14
+ ## Process
15
+
16
+ ### 1. Check Existing State
17
+
18
+ - If `.sniper/config.yaml` exists, ask user: "SNIPER is already initialized. Reinitialize? (existing config will be backed up)"
19
+ - If reinitializing, copy `.sniper/config.yaml` to `.sniper/config.yaml.bak`
20
+
21
+ ### 2. Auto-Detect Project
22
+
23
+ Scan the project directory to detect:
24
+
25
+ **Language** (check in order):
26
+ - `tsconfig.json` or `*.ts` files → TypeScript
27
+ - `package.json` → JavaScript
28
+ - `pyproject.toml` or `requirements.txt` → Python
29
+ - `go.mod` → Go
30
+ - `Cargo.toml` → Rust
31
+ - `pom.xml` or `build.gradle` → Java
32
+ - Fall back to `--language` argument or ask user
33
+
34
+ **Package Manager**:
35
+ - `pnpm-lock.yaml` → pnpm
36
+ - `yarn.lock` → yarn
37
+ - `bun.lockb` → bun
38
+ - `package-lock.json` → npm
39
+ - `uv.lock` → uv
40
+ - `poetry.lock` → poetry
41
+
42
+ **Framework**:
43
+ - `next.config.*` → Next.js
44
+ - `nuxt.config.*` → Nuxt
45
+ - `vite.config.*` → Vite
46
+ - `angular.json` → Angular
47
+
48
+ **Test Runner**:
49
+ - `vitest.config.*` → Vitest
50
+ - `jest.config.*` → Jest
51
+ - `pytest.ini` or `conftest.py` → Pytest
52
+
53
+ **Commands** (from package.json scripts or Makefile):
54
+ - Look for `test`, `lint`, `build`, `typecheck` scripts
55
+
56
+ ### 3. Gather User Input
57
+
58
+ Ask the user (with auto-detected defaults pre-filled):
59
+ 1. Project name (default: directory name)
60
+ 2. Project type (saas, api, mobile, cli, library, monorepo)
61
+ 3. One-line description
62
+ 4. Max concurrent teammates (default: 5)
63
+ 5. Confirm detected stack
64
+
65
+ ### 4. Scaffold Structure
66
+
67
+ Create the following directory structure:
68
+ ```
69
+ .sniper/
70
+ config.yaml ← Generated from template + user input + auto-detection
71
+ checkpoints/
72
+ gates/
73
+ retros/
74
+ self-reviews/
75
+ checklists/ ← Copied from @sniper.ai/core/checklists/
76
+ .claude/
77
+ agents/ ← Copied from @sniper.ai/core/agents/
78
+ settings.json ← Merge hooks from @sniper.ai/core/hooks/
79
+ CLAUDE.md ← Generated from template
80
+ ```
81
+
82
+ ### 5. Apply Plugins
83
+
84
+ If plugins are configured (or auto-detected):
85
+ 1. Read each plugin's `plugin.yaml`
86
+ 2. Merge plugin commands into config
87
+ 3. Copy plugin mixins to `.claude/personas/cognitive/`
88
+ 4. Merge plugin hooks into `.claude/settings.json`
89
+
90
+ ### 6. Confirm
91
+
92
+ Display summary:
93
+ - Files created/modified
94
+ - Detected stack
95
+ - Suggested next step: "Run `/sniper-flow` to start your first protocol"
96
+
97
+ ## Rules
98
+
99
+ - NEVER overwrite existing project source files
100
+ - ALWAYS back up existing config before reinitializing
101
+ - ALWAYS show the user what will be created before doing it
102
+ - Respect `.gitignore` — add `.sniper/checkpoints/` and `.sniper/gates/` if not present
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: sniper-review
3
+ description: Manually trigger a review gate for the current phase
4
+ arguments:
5
+ - name: phase
6
+ description: Phase to review (defaults to current phase from live-status)
7
+ required: false
8
+ ---
9
+
10
+ # /sniper-review
11
+
12
+ Manually trigger a quality gate review. Use this when you want to run gate checks outside of the normal protocol flow.
13
+
14
+ ## Process
15
+
16
+ ### 1. Determine Phase
17
+
18
+ - If `--phase` is specified, use it
19
+ - Otherwise, read `.sniper/live-status.yaml` for the current phase
20
+ - If no active phase, ask the user which phase checklist to run
21
+
22
+ ### 2. Load Checklist
23
+
24
+ Read the checklist from `.sniper/checklists/<phase>.yaml` (or from `.claude/` if scaffolded there).
25
+
26
+ ### 3. Run Checks
27
+
28
+ Spawn a gate-reviewer agent to execute the checklist:
29
+ - Use the Task tool with the gate-reviewer agent definition
30
+ - Pass the checklist path and phase name
31
+ - Wait for the gate result
32
+
33
+ ### 4. Present Results
34
+
35
+ Display the gate result:
36
+ - Overall: PASS or FAIL
37
+ - Each check with status and any output
38
+ - Blocking failures highlighted
39
+ - Suggestions for fixing failures
40
+
41
+ ### 5. Write Result
42
+
43
+ Save the gate result to `.sniper/gates/<phase>-<timestamp>.yaml`.
44
+
45
+ ## Rules
46
+
47
+ - This is a manual trigger — it does NOT advance the protocol phase
48
+ - Always write results to `.sniper/gates/` for audit trail
49
+ - If checks reference commands that don't exist in config, skip with a warning