KeiSeiKit-1.0/skills/spawn-agent/phase-1-role.md
Parfii-bot eac6a7e58c feat(w9c): /spawn-agent Claude Code skill — click-only wizard for kei-spawn
5-phase skill wrapping kei-spawn CLI: role pick → task desc → scope
preset → confirm → emit composed Agent-tool invocation.

Pattern matches existing skills/site-create + skills/new-agent.
4 AskUserQuestion minimum, sole free-text is task description.

RULE 0.13 / 0.12 / 0.5 / ZERO enforced. Ready for /spawn-agent
invocation once kei-spawn binary built via install.sh.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 13:32:01 +08:00

3 KiB

Phase 1 — Role selection

Goal: pick the agent role (capability tier). This single choice resolves subagent_type + isolation + Bash/Write permissions via kei-spawn. Verify criterion: ROLE set to one of the four fixed labels.


1.a — Single AskUserQuestion

Send ONE AskUserQuestion call. multiSelect: false. Do NOT fall through to a default — the user must click.

{
  "questions": [
    {
      "question": "Agent role / capability tier?",
      "header": "Role",
      "multiSelect": false,
      "options": [
        {
          "label": "read-only",
          "description": "Researcher. Read + Grep + Glob only. No Bash. No writes. Shared worktree. Use for: literature lookup, prior art, code exploration reports."
        },
        {
          "label": "explorer",
          "description": "Researcher + read-only Bash (ls, cat, rg, git log — no state changes). Shared worktree. Use for: audits, diagnostics, benchmark snapshots."
        },
        {
          "label": "edit-local",
          "description": "Code-implementer with worktree isolation. Can Write/Edit within a narrow whitelist (usually one module). Bash limited to cargo/test runners. Use for: single-crate changes, localized refactors."
        },
        {
          "label": "edit-shared",
          "description": "Code-implementer with worktree isolation + broader whitelist (multiple modules / cross-cutting). Bash limited to cargo/test. Use for: workspace-wide refactors, feature-slice work touching ≥2 crates."
        }
      ]
    }
  ]
}

Store the clicked label verbatim as ROLE.


1.b — Guidance (for the user, shown WITH the question)

Before sending the question, print one short paragraph:

Pick the capability tier. Read-only and explorer never modify disk and are cheap to spawn. Edit-local and edit-shared get their own git worktree (per RULE 0.12) and inherit a Bash allowlist restricted to test runners. If unsure, pick explorer — it's the safest writeable-ish tier and covers most audit / diagnostic requests.


1.c — Verify criterion

ROLE ∈ {read-only, explorer, edit-local, edit-shared}. If the user dismissed the question or picked something else, loop back. Do NOT proceed to Phase 2 without ROLE set.

Emit a single-line confirmation: Role locked: <ROLE>. Proceed to Phase 2.


1.d — Failure paths (NO DOWNGRADE)

If the user wants a role outside the four fixed tiers (e.g. "I want a writer with full Bash"):

  • (A) Explain that the 4 tiers are the full capability grid in kei-spawn — anything else would need a new role added to the CLI. Offer to open a task for that.
  • (B) Suggest the closest existing tier (usually edit-shared with a broader whitelist covers 90% of "I need more power" requests).
  • (C) Abort this skill invocation and escalate to /new-agent if the user actually needs a new agent manifest, not a new role tier.

Never invent a fifth tier. kei-spawn will reject any ROLE not in the fixed set.