KeiSeiKit-1.0/skills/compose-solution/phase-3-prior-art.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

1.5 KiB

Phase 3 — Prior-art grep sweep (parallel)

For EACH component from Phase 2, run three independent searches in parallel (single message, multiple Bash tool calls).

3a — KeiSeiKit reuse

# Replace <keywords> with the component's 3-5 distinctive keywords as an
# ERE alternation like (foo|bar|baz).
grep -rinlE '<keywords>' _blocks/ _manifests/ skills/ _bridges/ hooks/ 2>/dev/null

3b — Personal bundle reuse (conditional, skip on missing)

if [ -d ~/Projects/KeiSeiBundle ]; then
  grep -rinlE '<keywords>' ~/Projects/KeiSeiBundle/ 2>/dev/null | head -20
else
  echo "KeiSeiBundle: absent — skipping layer B"
fi

Document absence in the report — do NOT fabricate a hit.

3c — External docs (delegate)

For any component that involves an external API, framework, or third-party library, delegate a tiny research task to a kei-researcher subagent: one WebSearch call, one WebFetch of the top hit, one-paragraph summary. Skip if the component is entirely internal.

3d — Classify + evidence-grade

For each component produce ONE row:

Component N: <one-line>
  Keywords:  (foo|bar|baz)
  3a reuse:  <path1>, <path2>   or  NONE
  3b reuse:  <path> (bundle)    or  ABSENT / NONE
  3c ext:    <URL summary>      or  INTERNAL
  Class:     [REUSE | ADAPT | CREATE | EXTERNAL]
  Evidence:  [E1-E6]

Verify-criterion

  • Every component has a classification.
  • Every cited file path exists on disk (RULE 0.4 — no fabricated paths).
  • If grep returns nothing, class is CREATE and the report says so — no phantom matches.