When this fires
User has Phase 10 research (or skips scout) and wants spec + plan artifacts before dispatching work. Produces docs/matilha/specs/<slug>-spec.md + docs/matilha/plans/<slug>-plan.md.
Preconditions
- None. matilha-plan lazy-bootstraps project structure as needed.
Execution Workflow
- Lazy bootstrap: Check for
project-status.md and docs/matilha/. If absent, create minimally:
mkdir -p docs/matilha/specs docs/matilha/plans docs/matilha/research
- If
project-status.md missing, write a minimal stub with frontmatter current_phase: 10, phase_status: in_progress, project_slug: <derived from cwd or user-provided>, next_action: "matilha-plan in progress". User can later run matilha-init for fuller bootstrap.
- Then read
project-status.md and any existing research in docs/matilha/research/.
- Pack-aware brainstorming delegation (see
matilha-compose for canonical template):
- (a) If
superpowers:brainstorming is available, inspect the ambient skill list for skills with plugin namespace matching matilha-*-pack (installed companion packs). Group by plugin namespace.
- (b) Classify user intent semantically against each installed pack's domain using the pack skills' descriptions visible in the ambient list. Err inclusive — prefer injecting a marginally-relevant pack over omitting it.
- (c) Build preamble using the canonical template documented in
skills/matilha-compose/SKILL.md Step 4 (per-pack mini-synthesis + skill list + guidance paragraph for the receiving skill).
- (d) Emit the preamble in the current turn output, then invoke
superpowers:brainstorming via the Skill tool.
- (e) Fallback: if
superpowers:brainstorming is absent OR zero packs are detected, run the condensed clarifying flow inline (existing behavior — ask 3–5 questions drawing on detected pack skills if any, else use methodology-core heuristics).
- Write
docs/matilha/specs/<slug>-spec.md with: purpose, context, design principles, target deliverables, architecture, data flow, open questions, exit criteria.
- If
superpowers:writing-plans available, invoke via Skill tool to generate the task-by-task plan. Otherwise, write the plan inline following methodology/40-execucao.md conventions.
- Plan output lands at
docs/matilha/plans/<slug>-plan.md with: goal, architecture, SPs, per-task steps, exit gates.
- Update project-status.md:
current_phase: 30, phase_status: complete, feature_artifacts appended, next_action: "Run /matilha-hunt <slug>".
Rules: Do
- Delegate to superpowers when present (their brainstorming + writing-plans are battle-tested).
- Validate plan against
planSchema before writing.
Rules: Don't
- Skip the spec (even for small features — the spec is the contract).
- Advance
current_phase past 30 without user approval.
Expected Behavior
User gets two artifacts ready for hunt/gather. Plan must be directly executable via subagent-driven-development or manual hunt.
Quality Gates
- Spec exists at
docs/matilha/specs/<slug>-spec.md.
- Plan exists at
docs/matilha/plans/<slug>-plan.md and parses against planSchema.
current_phase: 30 in project-status.md.
feature_artifacts entry added.
Companion Integration
Companion-pack awareness is handled via the pack-aware preamble-injection logic in Step 2 of the Execution Workflow. See skills/matilha-compose/SKILL.md for the canonical pack detection, intent classification, and preamble template.
- superpowers:brainstorming — invoked in step 2 with pack-aware preamble emitted in the current turn output (when installed companion packs classify as intent-relevant).
- superpowers:writing-plans — invoked in step 4 for task-by-task plan generation. No preamble needed here (plan-generation is post-spec; pack context is already embedded in the spec).
- Any skill with plugin namespace
matilha-*-pack (e.g., matilha-harness-pack:*, matilha-ux-pack:*, matilha-growth-pack:*) — detected at runtime via ambient skill list, referenced by name in the preamble, available for direct invocation downstream.
- Otherwise: run the clarifying + drafting inline using methodology-core heuristics.
Output Artifacts
docs/matilha/specs/<slug>-spec.md
docs/matilha/plans/<slug>-plan.md
- Updated
project-status.md
Example Constraint Language
- Use "must" for: spec and plan both exist; plan conforms to
planSchema.
- Use "should" for: invoke superpowers when available; validate disjunction across intra-wave SPs.
- Use "may" for: skip research if user has a clear mental model.
Troubleshooting
- "planSchema fails": Check frontmatter shape vs
methodology/40-execucao.md.
- "research missing": Run matilha-scout first, or acknowledge the skip explicitly.
CLI shortcut (optional)
If matilha CLI is installed (matilha --version succeeds), you can run
matilha plan <slug> to execute this deterministically. The plugin path
above works without any CLI installation.
1---2name: matilha-plan3description: Use when user wants to plan a feature with multiple subprojects or parallel work — generates phase-gated spec.md and plan.md with waves, SPs, merge_order, and exit gates.4---56## When this fires78User has Phase 10 research (or skips scout) and wants spec + plan artifacts before dispatching work. Produces `docs/matilha/specs/<slug>-spec.md` + `docs/matilha/plans/<slug>-plan.md`.910## Preconditions1112- None. matilha-plan lazy-bootstraps project structure as needed.1314## Execution Workflow15161. **Lazy bootstrap**: Check for `project-status.md` and `docs/matilha/`. If absent, create minimally:17 - `mkdir -p docs/matilha/specs docs/matilha/plans docs/matilha/research`18 - If `project-status.md` missing, write a minimal stub with frontmatter `current_phase: 10`, `phase_status: in_progress`, `project_slug: <derived from cwd or user-provided>`, `next_action: "matilha-plan in progress"`. User can later run matilha-init for fuller bootstrap.19 - Then read `project-status.md` and any existing research in `docs/matilha/research/`.202. **Pack-aware brainstorming delegation** (see `matilha-compose` for canonical template):21 - (a) If `superpowers:brainstorming` is available, inspect the ambient skill list for skills with plugin namespace matching `matilha-*-pack` (installed companion packs). Group by plugin namespace.22 - (b) Classify user intent semantically against each installed pack's domain using the pack skills' descriptions visible in the ambient list. Err inclusive — prefer injecting a marginally-relevant pack over omitting it.23 - (c) Build preamble using the canonical template documented in `skills/matilha-compose/SKILL.md` Step 4 (per-pack mini-synthesis + skill list + guidance paragraph for the receiving skill).24 - (d) Emit the preamble in the current turn output, then invoke `superpowers:brainstorming` via the Skill tool.25 - (e) Fallback: if `superpowers:brainstorming` is absent OR zero packs are detected, run the condensed clarifying flow inline (existing behavior — ask 3–5 questions drawing on detected pack skills if any, else use methodology-core heuristics).263. Write `docs/matilha/specs/<slug>-spec.md` with: purpose, context, design principles, target deliverables, architecture, data flow, open questions, exit criteria.274. If `superpowers:writing-plans` available, invoke via Skill tool to generate the task-by-task plan. Otherwise, write the plan inline following `methodology/40-execucao.md` conventions.285. Plan output lands at `docs/matilha/plans/<slug>-plan.md` with: goal, architecture, SPs, per-task steps, exit gates.296. Update project-status.md: `current_phase: 30`, `phase_status: complete`, `feature_artifacts` appended, `next_action: "Run /matilha-hunt <slug>"`.3031## Rules: Do3233- Delegate to superpowers when present (their brainstorming + writing-plans are battle-tested).34- Validate plan against `planSchema` before writing.3536## Rules: Don't3738- Skip the spec (even for small features — the spec is the contract).39- Advance `current_phase` past 30 without user approval.4041## Expected Behavior4243User gets two artifacts ready for hunt/gather. Plan must be directly executable via subagent-driven-development or manual hunt.4445## Quality Gates4647- Spec exists at `docs/matilha/specs/<slug>-spec.md`.48- Plan exists at `docs/matilha/plans/<slug>-plan.md` and parses against `planSchema`.49- `current_phase: 30` in project-status.md.50- `feature_artifacts` entry added.5152## Companion Integration5354Companion-pack awareness is handled via the pack-aware preamble-injection logic in Step 2 of the Execution Workflow. See `skills/matilha-compose/SKILL.md` for the canonical pack detection, intent classification, and preamble template.5556- **superpowers:brainstorming** — invoked in step 2 with pack-aware preamble emitted in the current turn output (when installed companion packs classify as intent-relevant).57- **superpowers:writing-plans** — invoked in step 4 for task-by-task plan generation. No preamble needed here (plan-generation is post-spec; pack context is already embedded in the spec).58- **Any skill with plugin namespace `matilha-*-pack`** (e.g., `matilha-harness-pack:*`, `matilha-ux-pack:*`, `matilha-growth-pack:*`) — detected at runtime via ambient skill list, referenced by name in the preamble, available for direct invocation downstream.59- Otherwise: run the clarifying + drafting inline using methodology-core heuristics.6061## Output Artifacts6263- `docs/matilha/specs/<slug>-spec.md`64- `docs/matilha/plans/<slug>-plan.md`65- Updated `project-status.md`6667## Example Constraint Language6869- Use "must" for: spec and plan both exist; plan conforms to `planSchema`.70- Use "should" for: invoke superpowers when available; validate disjunction across intra-wave SPs.71- Use "may" for: skip research if user has a clear mental model.7273## Troubleshooting7475- **"planSchema fails"**: Check frontmatter shape vs `methodology/40-execucao.md`.76- **"research missing"**: Run matilha-scout first, or acknowledge the skip explicitly.7778## CLI shortcut (optional)7980> If matilha CLI is installed (`matilha --version` succeeds), you can run81> `matilha plan <slug>` to execute this deterministically. The plugin path82> above works without any CLI installation.