@sniper.ai/core 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +73 -0
  2. package/framework/checklists/code-review.md +33 -0
  3. package/framework/checklists/discover-review.md +33 -0
  4. package/framework/checklists/doc-review.md +39 -0
  5. package/framework/checklists/plan-review.md +52 -0
  6. package/framework/checklists/sprint-review.md +41 -0
  7. package/framework/checklists/story-review.md +30 -0
  8. package/framework/claude-md.template +37 -0
  9. package/framework/commands/sniper-compose.md +237 -0
  10. package/framework/commands/sniper-discover.md +397 -0
  11. package/framework/commands/sniper-doc.md +441 -0
  12. package/framework/commands/sniper-init.md +372 -0
  13. package/framework/commands/sniper-plan.md +608 -0
  14. package/framework/commands/sniper-review.md +305 -0
  15. package/framework/commands/sniper-solve.md +375 -0
  16. package/framework/commands/sniper-sprint.md +601 -0
  17. package/framework/commands/sniper-status.md +276 -0
  18. package/framework/config.template.yaml +117 -0
  19. package/framework/personas/cognitive/devils-advocate.md +30 -0
  20. package/framework/personas/cognitive/mentor-explainer.md +29 -0
  21. package/framework/personas/cognitive/performance-focused.md +30 -0
  22. package/framework/personas/cognitive/security-first.md +29 -0
  23. package/framework/personas/cognitive/systems-thinker.md +29 -0
  24. package/framework/personas/cognitive/user-empathetic.md +29 -0
  25. package/framework/personas/domain/.gitkeep +0 -0
  26. package/framework/personas/process/analyst.md +29 -0
  27. package/framework/personas/process/architect.md +30 -0
  28. package/framework/personas/process/developer.md +32 -0
  29. package/framework/personas/process/doc-analyst.md +63 -0
  30. package/framework/personas/process/doc-reviewer.md +62 -0
  31. package/framework/personas/process/doc-writer.md +42 -0
  32. package/framework/personas/process/product-manager.md +32 -0
  33. package/framework/personas/process/qa-engineer.md +31 -0
  34. package/framework/personas/process/scrum-master.md +31 -0
  35. package/framework/personas/process/ux-designer.md +31 -0
  36. package/framework/personas/technical/ai-ml.md +33 -0
  37. package/framework/personas/technical/api-design.md +32 -0
  38. package/framework/personas/technical/backend.md +32 -0
  39. package/framework/personas/technical/database.md +32 -0
  40. package/framework/personas/technical/frontend.md +33 -0
  41. package/framework/personas/technical/infrastructure.md +32 -0
  42. package/framework/personas/technical/security.md +34 -0
  43. package/framework/settings.template.json +6 -0
  44. package/framework/spawn-prompts/_template.md +22 -0
  45. package/framework/teams/discover.yaml +57 -0
  46. package/framework/teams/doc.yaml +76 -0
  47. package/framework/teams/plan.yaml +86 -0
  48. package/framework/teams/solve.yaml +48 -0
  49. package/framework/teams/sprint.yaml +68 -0
  50. package/framework/templates/architecture.md +72 -0
  51. package/framework/templates/brief.md +52 -0
  52. package/framework/templates/doc-api.md +53 -0
  53. package/framework/templates/doc-guide.md +35 -0
  54. package/framework/templates/doc-readme.md +49 -0
  55. package/framework/templates/epic.md +33 -0
  56. package/framework/templates/personas.md +118 -0
  57. package/framework/templates/prd.md +69 -0
  58. package/framework/templates/risks.md +64 -0
  59. package/framework/templates/security.md +90 -0
  60. package/framework/templates/sprint-review.md +32 -0
  61. package/framework/templates/story.md +37 -0
  62. package/framework/templates/ux-spec.md +54 -0
  63. package/framework/workflows/discover-only.md +39 -0
  64. package/framework/workflows/full-lifecycle.md +56 -0
  65. package/framework/workflows/quick-feature.md +44 -0
  66. package/framework/workflows/sprint-cycle.md +47 -0
  67. package/package.json +30 -0
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # @sniper.ai/core
2
+
3
+ Framework core for SNIPER — provides personas, team compositions, templates, checklists, workflows, and spawn prompts as raw YAML and Markdown files.
4
+
5
+ ## Overview
6
+
7
+ This package contains no executable code. It ships the framework content that the CLI scaffolds into target projects and that Claude Code agents consume at runtime. Everything lives in the `framework/` directory.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @sniper.ai/core
13
+ ```
14
+
15
+ ## Contents
16
+
17
+ ```
18
+ framework/
19
+ ├── personas/ # Agent persona layers
20
+ │ ├── cognitive/ # Thinking styles (analytical, creative, security-first, etc.)
21
+ │ ├── domain/ # Domain knowledge (from packs or built-in)
22
+ │ ├── process/ # Process roles (architect, implementer, reviewer, etc.)
23
+ │ └── technical/ # Technical expertise (frontend, backend, infra, etc.)
24
+ ├── teams/ # Team compositions per phase
25
+ │ ├── discover.yaml # Discovery phase team
26
+ │ ├── plan.yaml # Planning phase team
27
+ │ ├── solve.yaml # Story sharding (sequential)
28
+ │ ├── sprint.yaml # Implementation sprint team
29
+ │ └── doc.yaml # Documentation team
30
+ ├── workflows/ # Phase workflow definitions
31
+ │ ├── full-lifecycle.md
32
+ │ ├── discover-only.md
33
+ │ ├── quick-feature.md
34
+ │ └── sprint-cycle.md
35
+ ├── templates/ # Artifact templates (PRD, architecture, stories, etc.)
36
+ ├── checklists/ # Quality gate checklists for review
37
+ ├── spawn-prompts/ # Pre-composed spawn prompts for agent roles
38
+ ├── commands/ # Slash command definitions
39
+ ├── config.template.yaml
40
+ ├── claude-md.template
41
+ └── settings.template.json
42
+ ```
43
+
44
+ ## Usage
45
+
46
+ Import framework files directly via the `./framework/*` export:
47
+
48
+ ```js
49
+ import { readFileSync } from 'fs';
50
+ import { createRequire } from 'module';
51
+
52
+ // Resolve the path to a framework file
53
+ const require = createRequire(import.meta.url);
54
+ const teamPath = require.resolve('@sniper.ai/core/framework/teams/sprint.yaml');
55
+ const teamYaml = readFileSync(teamPath, 'utf-8');
56
+ ```
57
+
58
+ ## Persona Layers
59
+
60
+ Agents are composed from four persona layers:
61
+
62
+ | Layer | Purpose | Example |
63
+ |-------|---------|---------|
64
+ | **Cognitive** | Thinking style and approach | `analytical`, `security-first` |
65
+ | **Process** | Role in the workflow | `architect`, `implementer`, `reviewer` |
66
+ | **Technical** | Technical expertise area | `frontend`, `backend`, `infra` |
67
+ | **Domain** | Project-specific knowledge | Provided by domain packs |
68
+
69
+ The `/sniper-compose` command combines these layers into a complete spawn prompt for an agent.
70
+
71
+ ## License
72
+
73
+ MIT
@@ -0,0 +1,33 @@
1
+ # Per-Story Code Review Checklist
2
+
3
+ Used by QA engineer and team lead to review individual story implementations.
4
+
5
+ ## Functionality
6
+ - [ ] All acceptance criteria from the story are implemented
7
+ - [ ] Error cases are handled (not just the happy path)
8
+ - [ ] Edge cases considered (empty input, max values, concurrent access)
9
+
10
+ ## Code Quality
11
+ - [ ] Code is readable — another developer can understand it without explanation
12
+ - [ ] No dead code, commented-out code, or TODO items left behind
13
+ - [ ] Functions are focused — each does one thing
14
+ - [ ] Naming is clear and consistent with codebase conventions
15
+ - [ ] No unnecessary complexity — simplest solution that works
16
+
17
+ ## Testing
18
+ - [ ] Unit tests cover the public API of new modules
19
+ - [ ] Integration tests verify end-to-end behavior
20
+ - [ ] Tests are deterministic (no timing dependencies, no flakiness)
21
+ - [ ] Test names describe the behavior being tested
22
+
23
+ ## Security
24
+ - [ ] User input is validated before processing
25
+ - [ ] SQL queries use parameterized statements
26
+ - [ ] No secrets in code or config
27
+ - [ ] Auth checks in place for protected endpoints
28
+
29
+ ## Performance
30
+ - [ ] No N+1 query patterns
31
+ - [ ] Database queries are indexed appropriately
32
+ - [ ] Large datasets use pagination
33
+ - [ ] No blocking operations on the main thread
@@ -0,0 +1,33 @@
1
+ # Discovery Review Checklist
2
+
3
+ Gate mode: **FLEXIBLE** (auto-advance, async review)
4
+
5
+ ## Project Brief (`docs/brief.md`)
6
+ - [ ] Problem statement is specific and evidence-based
7
+ - [ ] At least 3 direct competitors identified with features and pricing
8
+ - [ ] Unique value proposition clearly differentiates from competitors
9
+ - [ ] Target market segment is defined with size estimates
10
+ - [ ] Key assumptions are listed explicitly
11
+ - [ ] Technical constraints are identified
12
+ - [ ] v1 scope recommendation separates in-scope from out-of-scope
13
+ - [ ] Open questions are documented for planning phase
14
+
15
+ ## Risk Assessment (`docs/risks.md`)
16
+ - [ ] Technical feasibility risks are identified with specifics
17
+ - [ ] Integration risks are assessed (third-party APIs, services)
18
+ - [ ] Compliance and regulatory risks are documented
19
+ - [ ] Scalability concerns are noted with thresholds
20
+ - [ ] Each risk has a mitigation strategy
21
+ - [ ] Assumptions are challenged — at least 2 devil's advocate findings
22
+
23
+ ## User Personas (`docs/personas.md`)
24
+ - [ ] At least 2 distinct user personas defined
25
+ - [ ] Each persona has: role, goals, pain points, workflows
26
+ - [ ] Primary user journey mapped for each persona
27
+ - [ ] Key friction points identified
28
+ - [ ] Personas are realistic (not idealized)
29
+
30
+ ## Overall
31
+ - [ ] All three artifacts are internally consistent
32
+ - [ ] No critical contradictions between brief, risks, and personas
33
+ - [ ] Sufficient depth for planning phase to begin
@@ -0,0 +1,39 @@
1
+ # Documentation Review Checklist
2
+
3
+ Gate mode: **FLEXIBLE** (auto-advance, async review)
4
+
5
+ ## README.md
6
+ - [ ] Has a clear one-line project description
7
+ - [ ] Quick-start instructions use real commands that work from project root
8
+ - [ ] Prerequisites list actual runtime requirements with versions
9
+ - [ ] Features list matches actual project capabilities
10
+ - [ ] Tech stack table is accurate
11
+ - [ ] Project structure tree matches actual directory layout
12
+ - [ ] No placeholder text or unfilled template sections
13
+
14
+ ## Setup Guide (`docs/setup.md`)
15
+ - [ ] Installation steps produce a running environment
16
+ - [ ] Environment variables documented with descriptions
17
+ - [ ] Database setup instructions are complete (if applicable)
18
+ - [ ] All referenced scripts and commands exist
19
+
20
+ ## Architecture Overview (`docs/architecture.md`)
21
+ - [ ] Component diagram or description matches actual codebase
22
+ - [ ] Data flow description is accurate
23
+ - [ ] Technology choices listed match actual stack
24
+ - [ ] Directory structure matches reality
25
+
26
+ ## API Reference (`docs/api.md`)
27
+ - [ ] All public endpoints are documented
28
+ - [ ] Request/response examples use realistic data
29
+ - [ ] Authentication method is accurately described
30
+ - [ ] Error codes match actual API behavior
31
+
32
+ ## General Quality
33
+ - [ ] All code examples are syntactically valid
34
+ - [ ] All internal links between docs resolve correctly
35
+ - [ ] Consistent terminology across all documentation
36
+ - [ ] No contradictions between docs
37
+ - [ ] No TODO markers or placeholder text remaining
38
+ - [ ] Managed section tags (`<!-- sniper:managed -->`) are properly formed
39
+ - [ ] Documentation is concise — no filler or marketing language
@@ -0,0 +1,52 @@
1
+ # Planning Review Checklist
2
+
3
+ Gate mode: **STRICT** (human MUST approve before Phase 3)
4
+
5
+ ## PRD (`docs/prd.md`)
6
+ - [ ] Problem statement includes evidence (not just assertions)
7
+ - [ ] User stories follow "As a [persona], I want, so that" format
8
+ - [ ] P0 requirements are minimal — only what's critical for v1
9
+ - [ ] Every requirement has testable acceptance criteria
10
+ - [ ] Non-functional requirements have specific measurable targets
11
+ - [ ] Success metrics have numbers (not vague "improve X")
12
+ - [ ] Out-of-scope explicitly names features users might expect
13
+ - [ ] No duplicate requirements
14
+
15
+ ## Architecture (`docs/architecture.md`)
16
+ - [ ] Every technology choice includes: what, why, alternatives considered
17
+ - [ ] Component diagram shows clear boundaries and interfaces
18
+ - [ ] Data models include field types, constraints, indexes, relationships
19
+ - [ ] API contracts are specific enough for independent frontend/backend implementation
20
+ - [ ] Infrastructure specifies sizing, scaling triggers, cost estimates
21
+ - [ ] Cross-cutting concerns addressed (auth, logging, errors, config)
22
+ - [ ] Non-functional targets have implementation strategies
23
+ - [ ] Security architecture aligns with `docs/security.md`
24
+
25
+ ## UX Specification (`docs/ux-spec.md`)
26
+ - [ ] Information architecture maps all pages/views
27
+ - [ ] Screen inventory covers all user-facing screens
28
+ - [ ] User flows include error paths, not just happy paths
29
+ - [ ] Component specs include all states (default, hover, active, disabled, loading, error)
30
+ - [ ] Responsive breakpoints specify actual layout changes
31
+ - [ ] Accessibility requirements name specific WCAG criteria
32
+ - [ ] UX flows align with PRD user stories
33
+
34
+ ## Security Requirements (`docs/security.md`)
35
+ - [ ] Authentication model specified (OAuth, JWT, session, etc.)
36
+ - [ ] Authorization model specified (RBAC, ABAC, etc.)
37
+ - [ ] Data encryption strategy covers at-rest and in-transit
38
+ - [ ] Compliance requirements name specific regulations
39
+ - [ ] Threat model identifies top attack vectors
40
+ - [ ] Security testing requirements are defined
41
+
42
+ ## Cross-Document Consistency
43
+ - [ ] Architecture API contracts match UX component data needs
44
+ - [ ] Security requirements are implementable within architecture choices
45
+ - [ ] PRD requirements are fully coverable by architecture design
46
+ - [ ] No orphaned requirements (in PRD but not in architecture)
47
+
48
+ ## Approval
49
+ **Reviewer:** _______________
50
+ **Date:** _______________
51
+ **Decision:** APPROVED / NEEDS REVISION
52
+ **Feedback:**
@@ -0,0 +1,41 @@
1
+ # Sprint Review Checklist
2
+
3
+ Gate mode: **STRICT** (human MUST review code before merge)
4
+
5
+ ## Code Quality
6
+ - [ ] All code passes linting (no warnings or errors)
7
+ - [ ] All code passes static type checking (language-appropriate strict mode)
8
+ - [ ] No type escape hatches introduced (e.g. `any` in TS, `Any` in Python, `interface{}` in Go)
9
+ - [ ] No hardcoded secrets, API keys, or credentials
10
+ - [ ] Error handling on all async operations
11
+ - [ ] Follows existing codebase patterns and conventions
12
+
13
+ ## Testing
14
+ - [ ] All stories have corresponding tests
15
+ - [ ] Tests pass (0 failures)
16
+ - [ ] Test coverage meets project minimum threshold
17
+ - [ ] Integration tests cover API endpoints
18
+ - [ ] Edge cases and error paths are tested
19
+ - [ ] No flaky tests introduced
20
+
21
+ ## Acceptance Criteria
22
+ - [ ] Every acceptance criterion from every sprint story is verified
23
+ - [ ] Deviations from acceptance criteria are documented and justified
24
+
25
+ ## Architecture Compliance
26
+ - [ ] Code follows the architecture patterns from `docs/architecture.md`
27
+ - [ ] API contracts match the spec (endpoints, payloads, status codes)
28
+ - [ ] Data models match the schema design
29
+ - [ ] File ownership boundaries respected (no cross-boundary edits)
30
+
31
+ ## Security
32
+ - [ ] No new security vulnerabilities introduced (OWASP Top 10)
33
+ - [ ] Input validation on all user-facing endpoints
34
+ - [ ] Authentication and authorization enforced where required
35
+ - [ ] Sensitive data encrypted and handled properly
36
+
37
+ ## Approval
38
+ **Reviewer:** _______________
39
+ **Date:** _______________
40
+ **Decision:** APPROVED / NEEDS REVISION
41
+ **Feedback:**
@@ -0,0 +1,30 @@
1
+ # Story Review Checklist
2
+
3
+ Gate mode: **FLEXIBLE** (auto-advance, async review)
4
+
5
+ ## Epic Structure (`docs/epics/*.md`)
6
+ - [ ] Epics number between 6-12 (enough granularity, not too fragmented)
7
+ - [ ] No overlap between epics — each requirement maps to exactly one epic
8
+ - [ ] Epic dependencies form a DAG (no circular dependencies)
9
+ - [ ] Each epic has clear scope boundaries (in/out)
10
+ - [ ] Architecture context is EMBEDDED in each epic, not just referenced
11
+ - [ ] Complexity estimates are realistic
12
+
13
+ ## Story Quality (`docs/stories/*.md`)
14
+ - [ ] Each story is self-contained — a developer can implement from the story file alone
15
+ - [ ] PRD context is EMBEDDED (copied), not just referenced
16
+ - [ ] Architecture context is EMBEDDED (data models, API contracts, patterns)
17
+ - [ ] UX context is EMBEDDED for frontend stories
18
+ - [ ] Acceptance criteria use Given/When/Then format
19
+ - [ ] Every acceptance criterion is testable
20
+ - [ ] Test requirements are specified (unit, integration, e2e)
21
+ - [ ] File ownership is assigned (which directories the story touches)
22
+ - [ ] Dependencies on other stories are declared
23
+ - [ ] Complexity estimate (S/M/L/XL) is assigned
24
+ - [ ] No story is XL — if so, it should be split
25
+
26
+ ## Coverage
27
+ - [ ] All P0 PRD requirements are covered by stories
28
+ - [ ] All P1 PRD requirements are covered by stories
29
+ - [ ] All architecture components have at least one implementing story
30
+ - [ ] Story dependency chains allow reasonable sprint planning
@@ -0,0 +1,37 @@
1
+ # SNIPER Project
2
+
3
+ ## Framework
4
+ This project uses SNIPER (Spawn, Navigate, Implement, Parallelize, Evaluate, Release).
5
+ See `.sniper/config.yaml` for project settings.
6
+
7
+ ## Quick Reference
8
+ - Framework workflows: `.sniper/workflows/`
9
+ - Persona layers: `.sniper/personas/`
10
+ - Team definitions: `.sniper/teams/`
11
+ - Artifact templates: `.sniper/templates/`
12
+ - Quality gates: `.sniper/checklists/`
13
+ - Project artifacts: `docs/`
14
+ - Domain context: `.sniper/domain-packs/{pack-name}/`
15
+
16
+ ## Commands
17
+ - `/sniper-init` — Initialize SNIPER in a new project
18
+ - `/sniper-discover` — Phase 1: Discovery & Analysis (parallel team)
19
+ - `/sniper-plan` — Phase 2: Planning & Architecture (parallel team)
20
+ - `/sniper-solve` — Phase 3: Epic Sharding & Story Creation (sequential)
21
+ - `/sniper-sprint` — Phase 4: Implementation Sprint (parallel team)
22
+ - `/sniper-review` — Run review gate for current phase
23
+ - `/sniper-compose` — Create a spawn prompt from persona layers
24
+ - `/sniper-status` — Show lifecycle status and artifact state
25
+
26
+ ## Agent Teams Rules
27
+ When spawning teammates, always:
28
+ 1. Read the relevant team YAML from `.sniper/teams/`
29
+ 2. Compose spawn prompts using `/sniper-compose` with the layers specified in the YAML
30
+ 3. Assign file ownership boundaries from `config.yaml` ownership rules
31
+ 4. Create tasks with dependencies from the team YAML
32
+ 5. Enter delegate mode (Shift+Tab) — the lead coordinates, it does not code
33
+ 6. Require plan approval for tasks marked `plan_approval: true`
34
+ 7. When a phase completes, run `/sniper-review` before advancing
35
+
36
+ ## Code Standards
37
+ See `.sniper/config.yaml` → stack section for language/framework specifics.
@@ -0,0 +1,237 @@
1
+ # /sniper-compose -- Compose a Spawn Prompt from Persona Layers
2
+
3
+ You are executing the `/sniper-compose` command. Your job is to assemble a teammate spawn prompt by merging persona layers into the template. Follow every step below precisely.
4
+
5
+ The user's arguments are provided in: $ARGUMENTS
6
+
7
+ ---
8
+
9
+ ## Step 0: Parse Arguments
10
+
11
+ Parse the following flags from `$ARGUMENTS`:
12
+
13
+ | Flag | Required | Description | Example |
14
+ |----------------|----------|------------------------------------------------|------------------------|
15
+ | `--process` | YES | Process persona layer name | `architect` |
16
+ | `--technical` | NO | Technical persona layer name (null if omitted) | `backend` |
17
+ | `--cognitive` | NO | Cognitive persona layer name (null if omitted) | `security-first` |
18
+ | `--domain` | NO | Domain context name from active domain pack | `telephony` |
19
+ | `--name` | YES | Display name for the teammate | `"Backend Architect"` |
20
+ | `--ownership` | NO | Ownership key from config.yaml | `backend` |
21
+
22
+ **If `--process` is missing**, print an error:
23
+ ```
24
+ ERROR: --process is required. This specifies the process persona layer.
25
+ Usage: /sniper-compose --process architect --technical backend --cognitive security-first --name "Backend Architect"
26
+ Available process layers: analyst, product-manager, architect, ux-designer, scrum-master, developer, qa-engineer
27
+ ```
28
+ Then STOP.
29
+
30
+ **If `--name` is missing**, print an error:
31
+ ```
32
+ ERROR: --name is required. This is the display name for the teammate.
33
+ Usage: /sniper-compose --process architect --technical backend --name "Backend Architect"
34
+ ```
35
+ Then STOP.
36
+
37
+ If no arguments are provided at all, print a usage guide:
38
+ ```
39
+ SNIPER Compose -- Assemble a spawn prompt from persona layers
40
+
41
+ Usage:
42
+ /sniper-compose --process <layer> --name <name> [--technical <layer>] [--cognitive <layer>] [--domain <context>] [--ownership <key>]
43
+
44
+ Required:
45
+ --process Process persona layer (analyst, product-manager, architect, ux-designer, scrum-master, developer, qa-engineer)
46
+ --name Display name for the teammate (quoted if spaces)
47
+
48
+ Optional:
49
+ --technical Technical persona layer (backend, frontend, infrastructure, security, ai-ml, database, api-design)
50
+ --cognitive Cognitive persona layer (systems-thinker, security-first, performance-focused, user-empathetic, devils-advocate, mentor-explainer)
51
+ --domain Domain context from the active domain pack
52
+ --ownership Ownership key from config.yaml (backend, frontend, infrastructure, tests, docs)
53
+
54
+ Examples:
55
+ /sniper-compose --process architect --technical backend --cognitive security-first --name "Backend Architect" --ownership backend
56
+ /sniper-compose --process developer --technical frontend --cognitive user-empathetic --name "Frontend Dev" --ownership frontend
57
+ /sniper-compose --process analyst --cognitive systems-thinker --name "Business Analyst"
58
+ ```
59
+ Then STOP.
60
+
61
+ ---
62
+
63
+ ## Step 1: Read the Template
64
+
65
+ Read the spawn prompt template from:
66
+ ```
67
+ .sniper/spawn-prompts/_template.md
68
+ ```
69
+
70
+ If it does not exist, print an error:
71
+ ```
72
+ ERROR: Spawn prompt template not found at .sniper/spawn-prompts/_template.md
73
+ Run /sniper-init to set up the framework.
74
+ ```
75
+ Then STOP.
76
+
77
+ Store the template content for merging in Step 4.
78
+
79
+ ---
80
+
81
+ ## Step 2: Read Each Persona Layer
82
+
83
+ For each specified layer, read the corresponding file. Track which layers were found and which were not.
84
+
85
+ ### 2a: Process Layer (required)
86
+ Read: `.sniper/personas/process/{process_name}.md`
87
+
88
+ If the file does not exist, print an error listing available process layers:
89
+ ```
90
+ ERROR: Process persona '{process_name}' not found.
91
+ Available process layers:
92
+ ```
93
+ Then list all `.md` files in `.sniper/personas/process/` (without the extension). Then STOP.
94
+
95
+ ### 2b: Technical Layer (optional)
96
+ If `--technical` was provided, read: `.sniper/personas/technical/{technical_name}.md`
97
+
98
+ If the file does not exist, print a warning:
99
+ ```
100
+ WARNING: Technical persona '{technical_name}' not found. Skipping technical layer.
101
+ Available technical layers:
102
+ ```
103
+ Then list all `.md` files in `.sniper/personas/technical/`. Set the technical layer content to:
104
+ ```
105
+ No specific technical expertise assigned. Apply general engineering best practices.
106
+ ```
107
+
108
+ ### 2c: Cognitive Layer (optional)
109
+ If `--cognitive` was provided, read: `.sniper/personas/cognitive/{cognitive_name}.md`
110
+
111
+ If the file does not exist, print a warning and list available cognitive layers. Set the cognitive layer content to:
112
+ ```
113
+ No specific cognitive style assigned. Apply balanced analytical thinking.
114
+ ```
115
+
116
+ ### 2d: Domain Layer (optional)
117
+ If `--domain` was provided:
118
+ 1. Read `.sniper/config.yaml` to get the active `domain_pack` value
119
+ 2. If `domain_pack` is null, print an error:
120
+ ```
121
+ ERROR: No domain pack is configured. Set domain_pack in .sniper/config.yaml or run /sniper-init.
122
+ ```
123
+ Set the domain layer content to `No domain-specific context available.`
124
+ 3. If `domain_pack` is set, read: `.sniper/domain-packs/{domain_pack}/context/{domain_name}.md`
125
+ 4. If the file does not exist, print a warning and list available contexts in that domain pack directory.
126
+ Set the domain layer content to `No domain-specific context available.`
127
+
128
+ If `--domain` was NOT provided, set the domain layer content to:
129
+ ```
130
+ No domain-specific context loaded. Refer to project documentation for domain knowledge.
131
+ ```
132
+
133
+ ---
134
+
135
+ ## Step 3: Read Ownership Rules
136
+
137
+ Read `.sniper/config.yaml` and extract the `ownership` section.
138
+
139
+ If `--ownership` was provided:
140
+ 1. Look up the ownership key in the config (e.g., `backend`, `frontend`, `infrastructure`, `tests`, `docs`)
141
+ 2. Extract the list of directory patterns for that key
142
+ 3. Format them as a comma-separated string for the template
143
+
144
+ If `--ownership` was NOT provided:
145
+ 1. Try to infer ownership from the `--technical` flag:
146
+ - `backend` technical -> `backend` ownership
147
+ - `frontend` technical -> `frontend` ownership
148
+ - `infrastructure` technical -> `infrastructure` ownership
149
+ - `security` technical -> `backend` ownership (security spans backend)
150
+ - `ai-ml` technical -> `backend` ownership
151
+ - `database` technical -> `backend` ownership
152
+ - `api-design` technical -> `backend` ownership
153
+ 2. If no technical layer was specified, set ownership to: `"No specific ownership assigned -- coordinate with team lead"`
154
+
155
+ Format the ownership value as a readable list, for example:
156
+ ```
157
+ src/backend/, src/api/, src/services/, src/db/, src/workers/
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Step 4: Merge Layers into Template
163
+
164
+ Take the template content from Step 1 and perform these replacements:
165
+
166
+ | Placeholder | Replace With |
167
+ |-------------------|-----------------------------------------------|
168
+ | `{name}` | The `--name` value |
169
+ | `{process_layer}` | Full content of the process persona file |
170
+ | `{technical_layer}`| Full content of the technical persona file (or default text) |
171
+ | `{cognitive_layer}`| Full content of the cognitive persona file (or default text) |
172
+ | `{domain_layer}` | Full content of the domain context file (or default text) |
173
+ | `{ownership}` | Formatted ownership directories from Step 3 |
174
+
175
+ The merged result is the complete spawn prompt.
176
+
177
+ ---
178
+
179
+ ## Step 5: Write the Composed Prompt
180
+
181
+ Generate a slug from the `--name` value:
182
+ - Lowercase
183
+ - Replace spaces with hyphens
184
+ - Remove special characters
185
+ - Example: `"Backend Architect"` -> `backend-architect`
186
+
187
+ Write the composed prompt to:
188
+ ```
189
+ .sniper/spawn-prompts/{slug}.md
190
+ ```
191
+
192
+ If a file already exists at that path, overwrite it silently (spawn prompts are regenerated as needed).
193
+
194
+ ---
195
+
196
+ ## Step 6: Display Preview and Summary
197
+
198
+ Print a summary of what was composed:
199
+
200
+ ```
201
+ ============================================
202
+ Spawn Prompt Composed
203
+ ============================================
204
+
205
+ Name: {name}
206
+ Saved to: .sniper/spawn-prompts/{slug}.md
207
+
208
+ Layers Used:
209
+ Process: {process_name} (.sniper/personas/process/{process_name}.md)
210
+ Technical: {technical_name or "none"}
211
+ Cognitive: {cognitive_name or "none"}
212
+ Domain: {domain_name or "none"}
213
+
214
+ Ownership: {ownership_dirs}
215
+
216
+ ============================================
217
+ ```
218
+
219
+ Then print a preview of the composed prompt. Show the FULL content of the generated file so the user can review it.
220
+
221
+ After the preview, print:
222
+ ```
223
+ This spawn prompt is ready to use. It will be loaded when a teammate is created with this persona configuration.
224
+ ```
225
+
226
+ ---
227
+
228
+ ## IMPORTANT RULES
229
+
230
+ - Do NOT modify any persona layer source files -- they are read-only inputs.
231
+ - Do NOT modify the template file -- it is a read-only input.
232
+ - The composed output goes ONLY to `.sniper/spawn-prompts/{slug}.md`.
233
+ - If any required layer file is missing, STOP with a clear error. Do not generate placeholder content for required layers.
234
+ - For optional layers that are missing, use the default text specified above and continue.
235
+ - Always show the full preview so the user can verify before using the prompt.
236
+ - Preserve all markdown formatting from the persona layer files when merging.
237
+ - Do not add any extra content beyond what is in the template and layers.