Clarify spec

From ZaxbyHub/opencode-swarm · View interactive version

Clarify spec is an AI agent skill from the GitHub repository ZaxbyHub/opencode-swarm. Full execution protocol for MODE: CLARIFY-SPEC -- resolving spec clarification markers and maintaining spec/planning alignment.

How to use this skill

Skill file

Clarify Spec Protocol

This protocol is loaded on demand by the architect runtime. The architect prompt keeps only activation, action, and hard safety constraints; the full execution details live here.

MODE: CLARIFY-SPEC

Activates when: /swarm sdd status reports a single resolved EFFECTIVE spec (non-null) AND it contains [NEEDS CLARIFICATION] markers; OR user says "clarify", "refine spec", "review spec", or "/swarm clarify" is invoked; OR architect transitions from MODE: SPECIFY or MODE: BRAINSTORM with open markers.

/swarm sdd status reflects readEffectiveSpecSync, which returns null (NO effective spec) for: no sources at all, multiple competing sources (e.g. openspec/ AND .specify/), multi-feature Spec-Kit without a selected feature, or any other unresolvable state. CLARIFY-SPEC does NOT activate in these null cases — tell the user: "No resolved effective spec exists. Disambiguate with /swarm sdd project --source <source> (or set SWARM_SDD_SOURCE / sdd.source in the config — the flag wins over the env var, which wins over the config) or --feature <feature>, or run /swarm specify to generate one first." and stop.

CONSTRAINT: CLARIFY-SPEC must NEVER create a spec. Always consult /swarm sdd status to determine the effective spec source before proceeding.

  1. Read the effective spec resolved by /swarm sdd status (native .swarm/spec.md OR OpenSpec openspec/ OR Spec-Kit .specify/ — read the resolved spec FIRST before making any changes).
  2. Scan for ambiguities beyond explicit [NEEDS CLARIFICATION] markers:
  1. Present all spec modifications using delta format with ## ADDED/MODIFIED/REMOVED Requirements sections:
  1. Delegate to the active swarm's sme agent for domain research on ambiguous areas before presenting questions.
  2. Present questions to the user ONE AT A TIME (max 8 per session):
  1. After each accepted answer, write the resolution to the resolved effective source (source-aware write-back):
  1. Stop when: all critical ambiguities are resolved, user says "done" or "stop", or 8 questions have been asked.
  2. Report a ## Clarification Summary: total questions asked, requirements added/modified/removed, remaining open ambiguities (if any), and suggest next step (PLAN if spec is clear, or continue clarifying).

CLARIFY-SPEC RULES:

Scoped Funnel Protocol (CLARIFY-SPEC only)

CLARIFY-SPEC handles already-surfaced [NEEDS CLARIFICATION] markers and spec ambiguities — it does not perform open-ended discovery of new uncertainties. The full four-stage clarification funnel (inventory, classify, consult critic, surface) described in the clarify skill applies to MODE: CLARIFY and MODE: PLAN, not here.

However, before surfacing each marker question to the user, CLARIFY-SPEC MUST:

  1. Consult critic_sounding_board with the candidate marker question and surrounding spec context to check whether the question wording can be improved or the item can be resolved from existing context.
  2. Apply the Overconfidence guard: If the critic supplies a RESOLVE verdict with a default answer, but that default is not directly supported by user request, spec, or recorded context, classify the item as user_decision rather than self_resolved.
  3. Apply always-surface protection: If the marker belongs to an always-surface category (scope boundaries, destructive behavior, security/privacy, backward compatibility, breaking API changes, new dependencies, deprecations, cross-platform impact, cost/performance tradeoffs, user-visible UX, rollout strategy, QA gates), the item MUST NOT receive UNNECESSARY/DROP from the critic — override to APPROVED/ASK_USER.

Critic verdict mapping (SoundingBoardVerdict): UNNECESSARY→DROP, RESOLVE→RESOLVE, REPHRASE→REPHRASE, APPROVED→ASK_USER.

This scoped protocol is lighter than the full funnel because CLARIFY-SPEC starts from known markers rather than open uncertainty inventory, but it still protects against overconfident self-resolution and premature dropping of important questions.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.