KeiSeiKit-1.0/skills/compose-solution/phase-2-decompose.md
Parfii-bot 5c2dc98d54 feat(compose-solution): meta-orchestrator skill for 7-phase artefact creation
Adds a pure-click meta-composer that converts a free-text task description
into the right durable KeiSeiKit artefact — agent, skill, hook, rule, or
block — by composing existing primitives:

- Phase 1 intake (one free-text DESC + target-type click)
- Phase 2 wave-based decomposition (delegates to /research for heavy tasks)
- Phase 3 prior-art grep sweep across _blocks/, _manifests/, skills/,
  _bridges/, hooks/ + optional PROJECT-E + external docs
- Phase 4 gap analysis (AskUserQuestion multi-select)
- Phase 5 math-first architecture proposal (derive-first, "what is
  unnecessary" pass, Constructor-Pattern check)
- Phase 6 block augmentation — drafts + persists new _blocks/<slug>.md
  on user click; kit gets smarter each session
- Phase 7 recipe assembly — branches by type, hands off to /new-agent
  (agent) or /escalate-recurrence (hook / rule)

Split into SKILL.md (121-LOC index) + seven phase-*.md files (each <160
LOC) to stay under the 500-LOC/file Constructor-Pattern limit. Minimum 6
AskUserQuestion calls per session enforced by the pipeline; every
referenced block / skill / manifest / bridge path verified to exist on
disk before commit (RULE 0.4 — no fabricated references).

Writes only to _blocks/<slug>.md and skills/<slug>/SKILL.md;
handoffs to /new-agent and /escalate-recurrence own their own files.
2026-04-21 18:22:00 +08:00

49 lines
1.9 KiB
Markdown

# Phase 2 — Wave-based decomposition
Goal: break `DESC` into 2-5 orthogonal components that can each be
independently researched and composed.
## 2a — Choose path (heavy vs lightweight)
For heavy / patent-scale / unfamiliar-domain tasks, delegate to the
`research` skill (`skills/research/SKILL.md`, Variant C "Deep decomposition"
is the pattern — Wave 0 decomposition, then Wave 1 per-component
exploration). Invoke via the Agent tool with `subagent_type: kei-researcher`
(or `researcher` if that agent is present in the user's global fleet). Pass
`DESC` as the research question with the constraint:
> Decompose into 2-5 orthogonal components, each with a 1-line description
> and 3-5 distinctive keywords suitable for grep prior-art search.
For lighter tasks (single-feature, obvious stack), do **inline lightweight
decomposition**: emit 3-5 components as a plain markdown bullet list in
chat — one line each — with 3-5 grep keywords per component in parentheses.
## 2b — Confirm decomposition (AskUserQuestion)
```json
{
"questions": [
{
"question": "Decomposition OK?",
"header": "Decomposition",
"multiSelect": false,
"options": [
{"label": "Confirm", "description": "Proceed to Phase 3 prior-art sweep with this decomposition"},
{"label": "Merge / split", "description": "You want to merge two components or split one — reply with one free-text line"},
{"label": "Add component", "description": "A necessary component is missing — reply with one free-text line"},
{"label": "Abort", "description": "Stop — nothing gets written"}
]
}
]
}
```
On `Merge / split` or `Add component` → single free-text prompt, regenerate,
re-ask. Do NOT silently adjust.
## Verify-criterion
- User clicked `Confirm`.
- Each component has ≥ 3 grep keywords (for Phase 3 search).
- Components are orthogonal (no circular dependency between two components).