/sniper-compose -- Compose a Spawn Prompt from Persona Layers
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.
The user's arguments are provided in: $ARGUMENTS
Step 0: Parse Arguments
Parse the following flags from $ARGUMENTS:
| Flag | Required | Description | Example |
|---|---|---|---|
--process | YES | Process persona layer name | architect |
--technical | NO | Technical persona layer name (null if omitted) | backend |
--cognitive | NO | Cognitive persona layer name (null if omitted) | security-first |
--domain | NO | Domain context name from active domain pack | telephony |
--name | YES | Display name for the teammate | "Backend Architect" |
--ownership | NO | Ownership key from config.yaml | backend |
If --process is missing, print an error:
ERROR: --process is required. This specifies the process persona layer.
Usage: /sniper-compose --process architect --technical backend --cognitive security-first --name "Backend Architect"
Available process layers: analyst, product-manager, architect, ux-designer, scrum-master, developer, qa-engineerThen STOP.
If --name is missing, print an error:
ERROR: --name is required. This is the display name for the teammate.
Usage: /sniper-compose --process architect --technical backend --name "Backend Architect"Then STOP.
If no arguments are provided at all, print a usage guide:
SNIPER Compose -- Assemble a spawn prompt from persona layers
Usage:
/sniper-compose --process <layer> --name <name> [--technical <layer>] [--cognitive <layer>] [--domain <context>] [--ownership <key>]
Required:
--process Process persona layer (analyst, product-manager, architect, ux-designer, scrum-master, developer, qa-engineer)
--name Display name for the teammate (quoted if spaces)
Optional:
--technical Technical persona layer (backend, frontend, infrastructure, security, ai-ml, database, api-design)
--cognitive Cognitive persona layer (systems-thinker, security-first, performance-focused, user-empathetic, devils-advocate, mentor-explainer)
--domain Domain context from the active domain pack
--ownership Ownership key from config.yaml (backend, frontend, infrastructure, tests, docs)
Examples:
/sniper-compose --process architect --technical backend --cognitive security-first --name "Backend Architect" --ownership backend
/sniper-compose --process developer --technical frontend --cognitive user-empathetic --name "Frontend Dev" --ownership frontend
/sniper-compose --process analyst --cognitive systems-thinker --name "Business Analyst"Then STOP.
Step 1: Read the Template
Read the spawn prompt template from:
.sniper/spawn-prompts/_template.mdIf it does not exist, print an error:
ERROR: Spawn prompt template not found at .sniper/spawn-prompts/_template.md
Run /sniper-init to set up the framework.Then STOP.
Store the template content for merging in Step 4.
Step 2: Read Each Persona Layer
For each specified layer, read the corresponding file. Track which layers were found and which were not.
2a: Process Layer (required)
Read: .sniper/personas/process/{process_name}.md
If the file does not exist, check pack personas: .sniper/packs/*/personas/process/{process_name}.md
If found in a pack, use that file. If a pack persona has the same name as a framework persona, append the pack content after the framework content (pack extends framework).
If not found anywhere, print an error listing available process layers:
ERROR: Process persona '{process_name}' not found.
Available process layers:Then list all .md files in .sniper/personas/process/ AND .sniper/packs/*/personas/process/ (without the extension). Then STOP.
2b: Technical Layer (optional)
If --technical was provided, read: .sniper/personas/technical/{technical_name}.md
If the file does not exist, print a warning:
WARNING: Technical persona '{technical_name}' not found. Skipping technical layer.
Available technical layers:Then list all .md files in .sniper/personas/technical/. Set the technical layer content to:
No specific technical expertise assigned. Apply general engineering best practices.2c: Cognitive Layer (optional)
If --cognitive was provided, read: .sniper/personas/cognitive/{cognitive_name}.md
If the file does not exist, print a warning and list available cognitive layers. Set the cognitive layer content to:
No specific cognitive style assigned. Apply balanced analytical thinking.2d: Domain Layer (optional)
If --domain was provided:
- Read
.sniper/config.yamlto get the activedomain_packvalue - If
domain_packis null, print an error:Set the domain layer content toERROR: No domain pack is configured. Set domain_pack in .sniper/config.yaml or run /sniper-init.No domain-specific context available. - If
domain_packis set, read:.sniper/domain-packs/{domain_pack}/context/{domain_name}.md - If the file does not exist, print a warning and list available contexts in that domain pack directory. Set the domain layer content to
No domain-specific context available.
If --domain was NOT provided, set the domain layer content to:
No domain-specific context loaded. Refer to project documentation for domain knowledge.Step 3: Read Ownership Rules
Read .sniper/config.yaml and extract the ownership section.
If --ownership was provided:
- Look up the ownership key in the config (e.g.,
backend,frontend,infrastructure,tests,docs) - Extract the list of directory patterns for that key
- Format them as a comma-separated string for the template
If --ownership was NOT provided:
- Try to infer ownership from the
--technicalflag:backendtechnical ->backendownershipfrontendtechnical ->frontendownershipinfrastructuretechnical ->infrastructureownershipsecuritytechnical ->backendownership (security spans backend)ai-mltechnical ->backendownershipdatabasetechnical ->backendownershipapi-designtechnical ->backendownership
- If no technical layer was specified, set ownership to:
"No specific ownership assigned -- coordinate with team lead"
Format the ownership value as a readable list, for example:
src/backend/, src/api/, src/services/, src/db/, src/workers/Step 4: Merge Layers into Template
Take the template content from Step 1 and perform these replacements:
| Placeholder | Replace With |
|---|---|
{name} | The --name value |
{process_layer} | Full content of the process persona file |
{technical_layer} | Full content of the technical persona file (or default text) |
{cognitive_layer} | Full content of the cognitive persona file (or default text) |
{domain_layer} | Full content of the domain context file (or default text) |
{memory_layer} | Memory layer content from Step 4b (or default text) |
{ownership} | Formatted ownership directories from Step 3 |
The merged result is the complete spawn prompt.
Step 4b: Read Memory Layer
Read the project memory to inject relevant conventions, anti-patterns, and decisions into the spawn prompt.
4b-1: Check for Memory Files
Check if these files exist:
.sniper/memory/conventions.yaml.sniper/memory/anti-patterns.yaml.sniper/memory/decisions.yaml
If none exist, set the memory layer content to:
No project memory available. This is either a new project or memory has not been initialized.Skip to Step 5.
4b-2: Check for Workspace Memory
Read .sniper/config.yaml and check if workspace.enabled is true and workspace.workspace_path is set.
If workspace memory exists, also read:
{workspace_path}/memory/conventions.yaml{workspace_path}/memory/anti-patterns.yaml{workspace_path}/memory/decisions.yaml
4b-3: Filter by Role
Determine the target agent's role from the --process flag value. Map process personas to agent roles:
developer-> includes backend-engineer, frontend-engineer (based on--technical)architect-> includes architectanalyst-> includes analystqa-engineer-> includes qa-engineerretro-analyst-> includes retro-analyst
Filter all memory entries where applies_to includes the mapped role(s).
4b-4: Format Memory Layer
Format the filtered entries as a readable markdown section:
## Project Memory — Conventions You Must Follow
- **conv-001:** {rule}
Example: {positive_example}
NOT: {negative_example}
## Anti-Patterns — Do NOT Do These
- **ap-001 ({severity}):** {description}. Instead: {fix_pattern}
## Key Decisions
- **dec-001:** {title} — {decision}If workspace conventions exist, label them with [WORKSPACE]:
- **conv-005 [WORKSPACE]:** {rule}4b-5: Apply Token Budget
Read memory.token_budget from config (default: 2000).
If the formatted memory layer exceeds the token budget, truncate by priority:
- High-severity anti-patterns (always include)
- Conventions with
enforcement: bothorenforcement: review_gate - Active decisions
- Medium-severity anti-patterns
- Conventions with
enforcement: spawn_promptonly - Low-severity anti-patterns
Add a note at the end if truncated:
Note: Memory layer truncated to fit token budget. Full memory available at .sniper/memory/Step 5: Write the Composed Prompt
Generate a slug from the --name value:
- Lowercase
- Replace spaces with hyphens
- Remove special characters
- Example:
"Backend Architect"->backend-architect
Write the composed prompt to:
.sniper/spawn-prompts/{slug}.mdIf a file already exists at that path, overwrite it silently (spawn prompts are regenerated as needed).
Step 6: Display Preview and Summary
Print a summary of what was composed:
============================================
Spawn Prompt Composed
============================================
Name: {name}
Saved to: .sniper/spawn-prompts/{slug}.md
Layers Used:
Process: {process_name} (.sniper/personas/process/{process_name}.md)
Technical: {technical_name or "none"}
Cognitive: {cognitive_name or "none"}
Domain: {domain_name or "none"}
Ownership: {ownership_dirs}
============================================Then print a preview of the composed prompt. Show the FULL content of the generated file so the user can review it.
After the preview, print:
This spawn prompt is ready to use. It will be loaded when a teammate is created with this persona configuration.IMPORTANT RULES
- Do NOT modify any persona layer source files -- they are read-only inputs.
- Do NOT modify the template file -- it is a read-only input.
- The composed output goes ONLY to
.sniper/spawn-prompts/{slug}.md. - If any required layer file is missing, STOP with a clear error. Do not generate placeholder content for required layers.
- For optional layers that are missing, use the default text specified above and continue.
- Always show the full preview so the user can verify before using the prompt.
- Preserve all markdown formatting from the persona layer files when merging.
- Do not add any extra content beyond what is in the template and layers.
