KeiSeiKit-1.0/skills/compose-solution/phase-6-block-augment.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

2.7 KiB

Phase 6 — Block augmentation (conditional)

Only runs if GAPS from Phase 4 is non-empty. For EACH CREATE or ADAPT entry in GAPS, run this sub-phase in sequence (NOT in parallel — user must approve each before the next).

6a — Draft the block

Template (follow the shape of _blocks/baseline.md or _blocks/rule-math-first.md — short, single-concern, imperative voice):

# <HEADING — pattern name in short caps>

<One-line purpose statement.>

## When to include

<1-3 bullets describing which manifests should list this block in
their `blocks = [...]` array.>

## What it declares

<3-8 imperative bullets. Constructor Pattern: one concern only.>

## References

- <link to upstream rule or external doc, if any>
- <evidence grade [E1-E6]>

Target length: 20-40 LOC markdown. Hard ceiling: 60 LOC — above that, SPLIT into two blocks before continuing.

Slug: kebab-case, 2-4 words. Must not collide with existing _blocks/*.md. Verify via:

ls _blocks/<slug>.md 2>/dev/null && echo "COLLISION" || echo "free"

If collision: append a disambiguator (<slug>-v2, or a domain suffix like <slug>-patent).

6b — Preview + per-block click (AskUserQuestion)

Emit the draft inline in chat, then:

{
  "questions": [
    {
      "question": "Write this block?",
      "header": "Block",
      "multiSelect": false,
      "options": [
        {"label": "Write to _blocks/<slug>.md", "description": "Save permanently — enriches the kit for all future sessions"},
        {"label": "Edit (free-text)",           "description": "Reply with one free-text message describing changes; I regenerate"},
        {"label": "Skip this block",            "description": "Don't save this one; proceed to next gap"},
        {"label": "Abort session",              "description": "Stop the whole skill; nothing else gets written"}
      ]
    }
  ]
}

Resolution:

  • Write → use Write tool to create _blocks/<slug>.md under the repo root (~/Projects/KeiSeiKit/_blocks/ when running against the kit repo; or wherever $PWD's _blocks/ lives when invoked from another KeiSeiKit fork).
  • Edit → single free-text prompt, regenerate, re-preview.
  • Skip → move to next gap.
  • Abort → stop; no writes Phase 6 onward.

6c — After all gaps processed

Report the block-count delta:

ls _blocks/ | wc -l

Show before → after count so the user sees the kit got N blocks smarter this session. This is the feedback-loop signal — make it visible in every session that touched Phase 6.

Verify-criterion

Every block written passes two sanity checks:

  • File exists on disk after Write.
  • No {{placeholder}} literals remain (the assembler's validator.rs rejects those; same hygiene applies here).