AGENT SKILL

sp-clarify

Use when an existing specification package has planning-critical gaps, weak analysis, or new constraints that should be absorbed before planning.

License 许可
MIT
最近更新
2026-08-07
Stars
★ 0
Forks
0

01 前言 Front Matter

name
sp-clarify
metadata
{ "author": "github-spec-kit", "source": "templates/commands/clarify.md" }
description
Use when an existing specification package has planning-critical gaps, weak analysis, or new constraints that should be absorbed before planning.
argument-hint
Describe what in the current spec package needs deeper analysis or correction
compatibility
Requires spec-kit project structure with .specify/ directory
user-invocable
true

02 资源文件 2

03 SKILL.md 正文

Invocation Syntax

  • In this integration, invoke workflow skills with /sp-plan-style syntax.
  • References such as /sp.plan, /sp.tasks, or next_command: /sp.plan are canonical workflow-state identifiers and handoff values.
  • Preserve those canonical state tokens exactly in artifacts and workflow state; do not rewrite them to this integration's invocation syntax.

Workflow Contract Summary

  • When to use: The current spec package exists, but planning-critical ambiguity or new evidence makes /sp-plan unreliable.
  • Primary objective: Strengthen the existing spec package without rerunning the entire sp-specify flow from scratch.
  • Primary outputs: Updated spec.md, alignment.md, context.md, references.md, workflow-state.md, clarification/handoffs/<lane-id>.json, clarification/evidence-index.json, and clarification/checkpoints.ndjson inside the active FEATURE_DIR.
  • Default handoff: /sp-plan if the package becomes planning-ready; otherwise continue clarification, run another repair pass, or route unproven feasibility through /sp-deep-research.
  • Execution note: This summary is routing metadata only. Follow the full contract below end-to-end rather than inferring behavior from the description alone.

Blocked Exit Contract

If blocked after safe recovery, read and follow .specify/templates/workflow-blocker-template.md and its JSON schema. Never return only an error or “ask a human”; preserve state and keep agent-capable repair agent-owned. Set human_action_required: true only for authority, credentials, protected systems, human decisions/reviews, or physical access. Tailor steps, expected results, failure paths, evidence, and resume action to CI, visual review, or product decisions. Never claim completion.

User Input

$ARGUMENTS

You MUST consider the user input before proceeding (if not empty).

Objective

Strengthen the current specification package just enough to remove planning-critical gaps and make the next planning decision better grounded.

Context

  • Primary inputs: the existing spec package, any newly supplied requirements or references, and the current repository context.
  • The active working set is spec.md, alignment.md, context.md, references.md, workflow-state.md, clarification/handoffs/, clarification/evidence-index.json, and clarification/checkpoints.ndjson inside the current FEATURE_DIR.
  • This command is enhancement-oriented. It should improve the package already on disk rather than restart the workflow from zero.

Process

  • Identify the specific planning-critical gaps or weak analysis that need improvement.
  • Deepen the relevant parts of the specification package through targeted analysis or bounded research.
  • Update the artifact set in place and reassess planning readiness.

Output Contract

  • Write the improved spec package back to disk.
  • Persist clarification lane evidence before artifact updates: every delegated clarification lane writes clarification/handoffs/<lane-id>.json, the leader updates clarification/evidence-index.json, and checkpoint records go to clarification/checkpoints.ndjson.
  • Consume every accepted clarification handoff before final artifact updates: each accepted handoff must be integrated into spec.md, alignment.md, context.md, references.md, or explicitly recorded as deferred or blocked with a reason.
  • Report what changed, what risks remain, and whether the package is ready for /sp-plan.
  • Keep unresolved uncertainty explicit instead of implying false readiness.

Guardrails

  • Prefer targeted enhancement over a full restatement.
  • Do not imply planning readiness if planning-critical ambiguity still remains.
  • Do not rerun the whole sp-specify flow unless the current package is unusably wrong.

Senior Consequence Analysis Gate

Run this gate whenever the request, artifact set, defect, or planned change can affect lifecycle operations, running objects, concurrent work, destructive behavior, shared state, downstream consumers, compatibility, security-sensitive behavior, or multiple plausible product behaviors.

Project cognition first. Use the project cognition runtime to identify ownership, consumers, state surfaces, change-propagation facts, verification routes, conflicts, known unknowns, and coverage gaps. Senior consequence analysis second. Turn those facts into explicit product and implementation obligations instead of treating the graph as the decision-maker.

Project cognition readiness provides routing advice. If readiness is query_ready, read top-level minimal_live_reads first, then use lane-level first_pass_paths reasons. If readiness is review, inspect the returned minimal_live_reads before continuing and treat coverage_diagnostics as confidence and closeout signals. If readiness is needs_rebuild, continue with live repository evidence and recommend /sp-map-scan -> /sp-map-build only for brownfield first/missing/unusable baseline, schema failure, schema v1 or old broad-schema rebuild-required readiness, zero active-generation path_index rows outside greenfield_empty, missing or invalid alias_index, explicit_rebuild_requested, or baseline_identity_invalid. If readiness is blocked, report the blocked state and continue with live repository evidence unless the user's actual request is to fix cognition runtime state. If readiness is unsupported_runtime, continue with live evidence and record that compass intake was unavailable. If baseline_kind=greenfield_empty, continue with workflow artifacts and live requirements; do not recommend map-scan -> map-build solely because the graph has no paths. Carry relevant project cognition facts, returned minimal_live_reads, inference notes, and coverage gaps into the workflow's artifacts or durable state, but back consequence claims with live code, tests, scripts, configuration, or authoritative docs. Mutation closeout is separate from entry routing: entry stale may continue, but that does not allow source/runtime mutation workflows to defer closeout. Workflow-owned mutation closeout is not an external map-maintenance handoff; after changing project-related files or behavior, the workflow must run inline project cognition update from its changed paths, affected surfaces, and verification evidence, with project-cognition mark-dirty only as fallback when inline update cannot complete. sp-map-update is for manual/external maintenance and follow-up repair; it is external map maintenance, not routine closeout for this workflow's own changes. In shared routing summaries, sp-map-update is for manual/external maintenance and ordinary existing-baseline gaps.

Required output when the gate triggers:

  • Affected Object Map: name each object, record, worker, queue, artifact, command, API, file surface, user-visible state, or downstream consumer that can be affected.
  • State-Behavior Matrix: describe behavior for each important lifecycle state, including created, queued, running, paused, failed, cancelled, completed, resumed, archived, missing, stale, or partially refreshed states when relevant.
  • Dependency Impact Table: map direct dependencies, indirect consumers, shared state, compatibility surfaces, validation routes, and adjacent workflows that can break if semantics change.
  • Recovery And Validation Contract: state rollback, retry, idempotency, cleanup, migration, observability, and validation evidence required before handoff or completion.
  • Coverage Gaps: list what project cognition or live evidence cannot prove, who must resolve each gap, the latest safe resolve phase, the stop-and-reopen condition, and the routing decision: current workflow may continue with an assumption, must ask the user, must route to clarification or deep research, or must request map maintenance.
  • Consequence Obligations: assign stable CA-### IDs to every obligation that must survive downstream handoff, task generation, worker packets, verification, or debug closeout. Each CA-### must include claim, affected objects, owner workflow, latest resolve phase, status, and stop-and-reopen condition.

Stand down only for docs-only wording changes, trivial isolated fixes, or local refactors that cannot affect lifecycle operations, running state, destructive operations, shared state, downstream consumers, compatibility, security, or multiple behavior choices. Record the no-trigger reason or stand-down reason in the workflow's durable artifact or closeout before skipping the required outputs.

If the gate triggers and the current workflow cannot preserve the required outputs, stop and route to the workflow that can. Do not mark ready, resolved, handoff-ready, planning-ready, or complete while triggered consequence obligations remain unresolved, unmapped, or unsupported by validation evidence.

[AGENT] For project-cognition-backed semantic intake, routing, audit, resume, or final-claim gates, read references/semantic-work-contract.md.

Detailed References

Read Reference index before applying shared semantic contracts.

Mandatory Subagent Execution

All substantive tasks in ordinary sp-* workflows default to and must use subagents.

The leader orchestrates: route, split tasks, prepare task contracts, dispatch subagents, wait for structured handoffs, integrate results, verify, and update state.

Before dispatch, every subagent lane needs a task contract with objective, authoritative inputs, allowed read/write scope, forbidden paths, acceptance checks, verification evidence, and structured handoff format.

Use execution_model: subagent-mandatory. Use dispatch_shape: one-subagent | parallel-subagents. Use execution_surface: native-subagents.

Pre-Execution Checks

Check for extension hooks (before clarification):

  • Check if .specify/extensions.yml exists in the project root.
  • If it exists, read it and look for entries under the hooks.before_clarify key.
  • If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally.
  • Filter out hooks where enabled is explicitly false. Treat hooks without an enabled field as enabled by default.
  • For each remaining hook, do not attempt to interpret or evaluate hook condition expressions:
    • If the hook has no condition field, or it is null/empty, treat the hook as executable.
    • If the hook defines a non-empty condition, skip the hook and leave condition evaluation to the HookExecutor implementation.
  • For each executable hook, output the following based on its optional flag:
    • Optional hook (optional: true):
      ## Extension Hooks
      
      **Optional Pre-Hook**: {extension}
      Command: `/{command}`
      Description: {description}
      
      Prompt: {prompt}
      To execute: `/{command}`
      
    • Mandatory hook (optional: false):
      ## Extension Hooks
      
      **Automatic Pre-Hook**: {extension}
      Executing: `/{command}`
      EXECUTE_COMMAND: {command}
      
      Wait for the result of the hook command before proceeding to the Outline.
      
  • If no hooks are registered or .specify/extensions.yml does not exist, skip silently.

Outline

Goal: Strengthen an existing spec package after /sp.specify by closing planning-critical gaps, correcting misunderstandings, absorbing reference material better, and writing the improved results back into spec.md, alignment.md, context.md, and references.md.

Project Learning

The CLI is the only agent-facing Learning read surface:

  1. Run uvx --from git+https://github.com/chenziyang110/spec-kit-plus.git@4a631657f75460886dbd12ebe48b14fc11cfe0bf specify learning start --command <classic-command-name> --format json before deeper non-trivial work.
  2. Select summaries by applicability and triggers; use uvx --from git+https://github.com/chenziyang110/spec-kit-plus.git@4a631657f75460886dbd12ebe48b14fc11cfe0bf specify learning list --command <classic-command-name> --format json only to filter or page.
  3. Execute one matching card's show_argv. Do not parse Learning storage.

start, list, and show are read-only. Current repository evidence, .specify/memory/constitution.md, and explicit user direction override stale or candidate Learning.

At closeout, corrections, retries, route changes, recovery, false leads, hidden dependencies, validation/tooling/state/cognition gaps, constraints, and near misses are capture signals. Prefer uvx --from git+https://github.com/chenziyang110/spec-kit-plus.git@4a631657f75460886dbd12ebe48b14fc11cfe0bf specify learning capture-auto from owning state; manual capture includes summary, problem, action, triggers, success criteria, avoid items, exceptions, and evidence.

  • fast: skip unless the task escalates.
  • accept, analyze, ask, auto, constitution, explain, implement-teams, taskstoissues, and team: consume-only; do not violate their write boundaries to capture.
  • Other non-trivial workflows: consume before deeper work; capture reusable signals at closeout or record a no-learning decision.

The policy returned by the CLI is authoritative when prompt wording drifts.

  1. Run .specify/scripts/powershell/check-prerequisites.ps1 -Json -PathsOnly from repo root once (--json --paths-only / -Json -PathsOnly). Parse:

    • If FEATURE_DIR is not already explicit, prefer uvx --from git+https://github.com/chenziyang110/spec-kit-plus.git@4a631657f75460886dbd12ebe48b14fc11cfe0bf specify lane resolve --command clarify --ensure-worktree before guessing from branch-only context.
    • When lane resolution returns a materialized lane worktree, continue clarification from that isolated worktree context so the repaired spec package stays bound to the active feature lane.
    • FEATURE_DIR
    • FEATURE_SPEC
    • optional downstream paths if returned
    • If JSON parsing fails, abort and instruct the user to verify the feature branch environment.
    • Set ALIGNMENT_FILE to FEATURE_DIR/alignment.md.
    • Set CONTEXT_FILE to FEATURE_DIR/context.md.
    • Set REFERENCES_FILE to FEATURE_DIR/references.md.
    • Set WORKFLOW_STATE_FILE to FEATURE_DIR/workflow-state.md.
  2. Create or resume the workflow state:

    • Read .specify/templates/workflow-state-template.md.
    • If WORKFLOW_STATE_FILE already exists, read it first and preserve still-valid next_action, exit_criteria, and next_command details instead of relying on chat memory alone.
    • Treat WORKFLOW_STATE_FILE as the stage-state source of truth for sp-clarify.
    • Persist at least these fields for the active pass:
      • active_command: sp-clarify
      • phase_mode: planning-only
      • allowed_artifact_writes: spec.md, alignment.md, context.md, references.md, clarification/handoffs/*.json, clarification/evidence-index.json, clarification/checkpoints.ndjson, workflow-state.md
      • forbidden_actions: edit source code, edit tests, fix build/tooling, implement behavior, run implementation-oriented fix loops
      • authoritative_files: spec.md, alignment.md, context.md, references.md, clarification/handoffs/*.json, clarification/evidence-index.json
    • When resuming after compaction, re-read WORKFLOW_STATE_FILE before proceeding.
  3. Load the current spec package and repo context:

    • FEATURE_SPEC

    • FEATURE_DIR/alignment.md if present

    • FEATURE_DIR/context.md if present

    • FEATURE_DIR/references.md if present

    • .specify/memory/constitution.md if present

    • .specify/memory/project-rules.md if present

    • compact learning start --command clarify results and only selected learning show records

    • Project cognition gate: query the active project's runtime before broad repository reads.

      Run or emulate:

      C:\Users\11034\.specify\bin\project-cognition.exe compass --intent plan --query=\"$ARGUMENTS\" --format json
      

      After the default compass packet, run the advanced lexicon -> semantic_intake -> query path only when compass_state, coverage diagnostics, localization, or live evidence requires explicit concept decisions. In that escalation, use project-cognition lexicon --mode catalog as the alias catalog, write agent-authored semantic_intake and concept_decisions, then run project-cognition query --query-plan "<query_plan_json>"; include query_plan, semantic_intake, concept_decisions, covered_facets, missing_facets, match_sources, lexicon_generation_id, repository_search_terms, project-language search terms, and facet coverage; do not search only the raw user words before source search. Agent-owned semantic normalization remains mandatory: agent_normalization and raw lexicon ranking are bootstrap signals only; if agent_normalization is omitted, treat it as required=false; use write_semantic_intake_from_alias_catalog when needed. Raw lexicon ranking is only a bootstrap; CJK or mixed CJK/ASCII input still requires agent-owned normalization even when positive raw lexical matches exist. The agent still owns translation. Readiness values are query_ready, review, needs_rebuild, blocked, and unsupported_runtime.

      Use the returned readiness:

      • query_ready: read top-level minimal_live_reads first, then use lane-level first_pass_paths reasons.
      • review: perform only the returned minimal_live_reads before continuing and inspect coverage_diagnostics.
      • blocked: report the blocking runtime issue and continue with live evidence only where this workflow allows degraded navigation.
      • CARRY FORWARD: Use project-cognition facts to decide whether an apparent requirement gap is already answered by repository truth. Preserve selected ownership, boundary, ambiguity, and verification facts in the clarified spec package before routing back to planning.
    • relevant repository documentation and design artifacts when they materially affect the requested change

  4. Identify what needs enhancement:

    • shallow or surface-level capability analysis
    • missing scenarios or usage paths
    • unresolved contradictions
    • underused reference material
    • newly provided requirements or constraints
    • unresolved gray areas that still change plan structure
    • unproven feasibility or implementation-chain links that make /sp.plan guess
    • missing locked decisions, canonical references, or deferred-scope notes
    • gaps that would make /sp.plan less reliable
  5. Classify findings by severity:

    • high-impact gaps that require user confirmation
    • lower-risk gaps that can be safely converted into a validated artifact-update subagent lane from current context
  6. Clarification loop for high-impact gaps:

    • Ask only the minimum number of questions required to make planning reliable again.
    • Do not use scope minimization as a shortcut to resolve ambiguity. Preserve the user's confirmed product scope; scope reduction requires user confirmation or a named constraint that blocks reliable planning.
    • Present exactly one unresolved high-impact question at a time.
    • Prefer questions that lock behavior, boundary handling, compatibility, or acceptance proof rather than reopening broad ideation.
    • Use the user's current language for user-visible questions and confirmations.
    • If repository evidence or retained references can answer the gap safely, packetize the artifact update as a validated subagent lane instead of asking the user to restate codebase facts.
  7. When justified, use multi-agent research or analysis to deepen the spec:

    • parallelize only when the work naturally separates into independent research tracks
    • examples: external references, local codebase context, risk analysis, comparison of alternatives
    • keep the final output synthesized back into the main spec package instead of returning raw research noise
    • before dispatching any clarification lane, persist a clarification_checkpoint record to clarification/checkpoints.ndjson with the lane id, lane type, authoritative inputs, expected handoff path, and current workflow-state summary
    • each delegated clarification lane must persist the lane's structured handoff to clarification/handoffs/<lane-id>.json before the leader accepts the lane, waits at a join point, or updates spec.md, alignment.md, context.md, or references.md
    • update clarification/evidence-index.json after each accepted lane handoff with lane id, handoff path, source artifacts inspected, questions or constraints resolved, affected artifact sections, blocker status, and integration status
    • consume clarification/evidence-index.json before final artifact updates: for every accepted handoff, mark the handoff as integrated, deferred, or blocked, and name the target spec.md, alignment.md, context.md, or references.md section that consumed it
    • do not update spec.md, alignment.md, context.md, or references.md from chat-only lane results; if a lane reports only prose, idle state, or an unwritten handoff, mark subagent-blocked, write the blocker to workflow-state.md, and stop or re-dispatch with a valid handoff path
    • when resuming after compaction, re-read workflow-state.md, clarification/checkpoints.ndjson, clarification/evidence-index.json, and all accepted clarification/handoffs/<lane-id>.json files before continuing clarification synthesis

7a. Decide whether a separate feasibility gate is needed:

  • If the remaining issue is "what should the system do?", keep clarifying in this command.
  • If the remaining issue is "can this capability work with the available APIs, libraries, platform behavior, performance envelope, or integration boundary?", update alignment.md and workflow-state.md to recommend /sp.deep-research.
  • Prefer /sp.deep-research when a disposable demo under FEATURE_DIR/research-spikes/ would prove the implementation chain before planning.
  • Record that /sp.deep-research must return a Planning Handoff with findings, demo evidence, constraints, rejected options, and recommended approach for /sp.plan.
  • Do not require /sp.deep-research for minor changes to existing capabilities that already have a clear implementation path in the repository.

7b. Consequence Clarification Lane:

  • If existing artifacts contain a triggered Senior Consequence Analysis Gate, preserve every CA-### consequence obligation from spec.md, alignment.md, context.md, references.md, and workflow-state.md.
  • Use clarification questions to resolve product semantics for affected objects, lifecycle states, dependency impact, recovery behavior, validation proof, and coverage gaps that still block planning.
  • For every clarified consequence obligation, record whether the obligation is resolved, deferred with a latest safe resolve phase, or converted into a stop-and-reopen condition.
  • Must not drop CA-### consequence obligations, stop-and-reopen conditions, stand-down reasons, or coverage gaps just because the current clarification pass focuses on another requirement.
  • If a consequence obligation cannot be answered from repository evidence or user clarification, preserve it as open and route to /sp.deep-research or /sp.plan only when that downstream workflow can carry the unresolved obligation safely.
  1. Delegate artifact enhancements through a validated subagent lane:

    • Build one bounded WorkerTaskPacket for the artifact update lane when the write scope is safe and packetized.
    • Allowed writes are limited to spec.md, alignment.md, context.md, references.md, workflow-state.md, and the clarification evidence files under clarification/ inside FEATURE_DIR.
    • The packet must list authoritative inputs, exact artifact sections to strengthen, allowed writes, forbidden actions, acceptance checks, verification evidence, and structured handoff format.
    • The subagent updates spec.md, alignment.md, context.md, references.md, and workflow-state.md as needed.
    • The subagent strengthens Locked Decisions, Claude Discretion, Canonical References, and Deferred / Future Ideas in spec.md when relevant.
    • The subagent strengthens Locked Decisions For Planning, Outstanding Questions, and Planning Gate Recommendation in alignment.md.
    • The subagent strengthens feasibility / deep research gate status when an implementation-chain proof is needed before planning.
    • The subagent strengthens Locked Decisions, Claude Discretion, Canonical References, Existing Code Insights, Specific User Signals, and Outstanding Questions in context.md.
    • The leader owns coordination, packet validation, user-question decisions, structured-handoff review, acceptance, final status, and state consistency.
    • Each accepted artifact-update lane handoff must be referenced from clarification/evidence-index.json, and the final artifact updates must name the handoff paths that shaped resolved questions, retained risks, or escalations.
    • Do not mark clarification complete while clarification/evidence-index.json contains an accepted handoff without an explicit consuming artifact section, deferral, or blocker reason.
    • If the artifact update lane cannot be safely packetized or delegated, record subagent-blocked in workflow-state.md with the escalation or recovery reason and stop instead of making the artifact edits.
  2. Maintain a clean output contract:

    • preserve confirmed facts
    • expand low-risk inferences only when they are useful for planning
    • clearly identify what remains unresolved
    • do not imply the spec package is planning-ready if planning-critical gaps still remain
  3. Report completion with:

  • sections touched
  • whether multi-agent research was used
  • updated paths
  • clarification evidence paths: clarification/evidence-index.json, clarification/checkpoints.ndjson, and accepted clarification/handoffs/<lane-id>.json files
  • remaining planning risks
  • recommended next command
  • whether the spec package is now ready for /sp.plan, still needs more clarification, or needs /sp.deep-research feasibility proof first
  • whether another /sp.specify or /sp.clarify pass is still justified before planning
  • updated workflow-state.md path
  • cognition follow-up: if artifact-only clarification work proves later implementation should refresh ownership, workflow, integration boundary, or verification-surface cognition, record that as an advisory in workflow-state.md, alignment.md, or context.md; do not mark project cognition dirty or require a refresh until actual source/runtime changes make the runtime truth out of date.
  • If this workflow makes actual source/runtime/template/config/test/generated-asset changes in the current run, follow the shared inline closeout contract:

Inline Project Cognition Update

Workflow-owned mutation closeout is not an external map-maintenance handoff and is not external map maintenance. It is the workflow-local form of /sp-map-update. If this workflow changed project-related source, runtime, templates, generated assets, config, tests, state contracts, shared surfaces, or behavior-bearing docs, closeout MUST run inline project cognition update for the workflow-owned changed paths and affected surfaces before claiming clean completion.

Call the planner first:

project-cognition closeout-plan --workflow "$ACTIVE_WORKFLOW" --format json

When DELTA_SESSION_ID exists, pass it into the planner:

project-cognition closeout-plan --workflow "$ACTIVE_WORKFLOW" --delta-session "$DELTA_SESSION_ID" --format json

Consume workflow_canonical, update_mode, payload_draft, required_agent_fields, unknown_paths, unknown_path_dispositions, delta_append_draft, display-only delta_append_command, update_argv, display-only update_command, and recommended_next_command.

Before running update, fill the fields listed in required_agent_fields from live evidence from this workflow. Supported agent-owned evidence fields include:

  • verification
  • behavior_surfaces
  • generated_surfaces
  • state_contracts
  • known_unknowns
  • confidence_notes
  • user_decisions
  • boundary

If a field appears in required_agent_fields, provide live-evidence-backed content for it. Fields not listed by required_agent_fields, such as known_unknowns and boundary, are populated only when live evidence supports them; do not invent them to satisfy the shape. Use known_unknowns only for blockers that make the cognition update unsafe to trust. If the working tree contains unrelated dirty/untracked paths and the workflow uses explicit workflow-owned paths, record that as confidence_notes or boundary.initial_dirty_paths, not as a blocking known_unknowns item.

For each unknown_path_dispositions[] item, set agent_disposition to exactly one allowed value:

  • adoptable: verified new path inside this workflow-owned scope; it may be recorded in changed/scope paths and verified adoptable paths do not become blocking known_unknowns.
  • review_only: path informed review but is not adopted into changed coverage.
  • ignored: path remains excluded and must not enter payloads, records, route indexes, evidence, aliases, or minimal live reads.
  • blocking_known_unknown: record it as a known unknown and report partial or blocked cognition closeout.

agent_disposition=adoptable is an agent accounting decision, not proof that runtime indexing already succeeded. Runtime adoption still requires a usable active project-cognition DB, at least one passing verification evidence item, and no blocking known_unknowns. After update_argv runs, inspect result_state, adopted_paths, review_paths, minimal_live_reads, and partial_refresh_reasons; do not explain a remaining partial_refresh as "path_index missing" until those fields show which adoption gate failed.

If update_mode=delta_session, complete delta_append_draft.argv_prefix with agent-owned repeatable flags such as --behavior-surface, --generated-surface, --verification, and accepted --known-unknown values from delta_append_draft.argv_placeholders. Then append the delta event and run update_argv. delta_append_command and update_command are display-only placeholders, not execution strings.

If update_mode=payload_file, write the completed payload_draft to the planner's payload_path. Then run update_argv. update_command is a display-only placeholder, not an execution string.

Completed payload drafts preserve the planner-owned changed_paths and scope_paths and add agent-owned evidence fields before recording.

Structured update invalidates related claims and returns their stable IDs in affected_graph_claims. This is separate from update readiness: generic workflow verification and result_state=ready must not re-promote stale or contradicted graph claims. Only when this workflow already has decisive claim-specific bounded live evidence for an exact returned claim ID may it submit semantic reconciliation intent and run:

project-cognition claim-reconcile prepare --input <intent.json> --format json
project-cognition claim-reconcile apply --input <prepared_packet_path> --format json

Provide only reconciliation intent: workflow, stable claim_id, reason, and evidence containing repository-relative source_path, bounded line span, and supporting or contradicting role. Add verification only when it is claim-specific. The runtime owns the contract version, active generation, expected state and revision, UTC observation and expiry, source kind, content hashes, repository snapshot, IDs, and prepared packet path. Do not author or edit those integrity fields; execute the returned apply_argv exactly. If no such evidence exists, leave the claim stale. If reconciliation returns ready, rerun Compass once so later routing consumes the current evidence basis; partial or blocked reconciliation remains withheld and follows recommended_next_action.

For compatibility with worker handoffs and delta packets, the runtime also accepts verification_evidence as an alias for verification and generated_surface_notes as an alias for generated_surfaces. Verification evidence may be an array of objects (command, result, artifact) or an array of command-result strings, but clean closeout still requires passing verification evidence; failed verification cannot produce a clean ready closeout.

Clean closeout keys on result_state, not status=ok, update_id, last_update_id, or freshness alone:

  • ready or no_op: project cognition closeout may be clean when ordinary verification also passed.
  • partial_refresh: useful update data was written, but the final workflow state must report partial cognition closeout, partial_refresh_reasons, and the returned minimal_live_reads. If partial_refresh_reasons includes missing_passing_verification_result, repair the payload or delta evidence and rerun update_argv before final closeout; do not route that to sp-map-update. If verified workflow-owned paths still remain in review_paths after the update, report implementation completion separately from project-cognition maintenance and name /sp-map-update as follow-up repair.
  • needs_rebuild: report the exact rebuild condition and route to /sp-map-scan, then /sp-map-build.
  • blocked: report the runtime or validation blocker and the exact recovery command.
  • recorded: legacy recorded-only output; treat it as partial or blocked, never as clean completion.

Never run the complete-refresh or clear-dirty helper after result_state=partial_refresh, needs_rebuild, blocked, or legacy recorded; those helpers are only for states that the runtime and validation prove ready.

Dirty fallback command shape: C:\Users\11034\.specify\bin\project-cognition.exe mark-dirty --reason \"<reason>\" --format json. Use C:\Users\11034\.specify\bin\project-cognition.exe mark-dirty --reason \"workflow-closeout-failed\" --format json only when inline update cannot complete: when the planner or update command is unavailable, cannot record useful update data, cannot identify workflow-owned scope, or cannot be trusted because verification/workflow completion is not trustworthy. Dirty only when inline update cannot complete.

sp-map-update is for manual/external maintenance and follow-up repair. /sp-map-update remains the external/manual workflow for user edits, interrupted workflow repair, explicit map maintenance, and follow-up repair. It is not routine cleanup for changes this workflow just made. If sp-map-update already ran project-cognition update --reason map-update for the same changed paths, do not run a second workflow-finalize closeout update for those paths.

Presentation Contract

When communicating findings and completion, use a structured terminal presentation built from open blocks with:

  • a stage header that identifies clarify and the current repair state
  • a status block that summarizes whether the spec package was strengthened, partially strengthened, or is waiting on user confirmation
  • an explanation block that explains what changed, which planning-critical gaps were reduced, and why it matters for planning
  • a risk block that lists unresolved planning risks, remaining contradictions, or evidence gaps
  • a next-step block that gives the recommended next command and whether more enhancement work is still needed before /sp.plan
  • when the package is still not planning-ready, the next-step block must avoid implying an automatic handoff to /sp.plan

Rules

  • Use the user's current language for user-visible output unless literal command names, file paths, or fixed status values must remain unchanged.
  • Do not re-run the entire specify flow from scratch unless the current spec is unusably wrong.
  • Prefer targeted enhancement over full restatement.
  • If new information materially changes scope or alignment, update alignment.md in the same pass.
  • Treat /sp.clarify as the default rescue lane and repair lane when planning-critical ambiguity remains after /sp.specify.
  • If high-impact ambiguity remains after enhancement, recommend another clarification pass instead of implying that /sp.plan is now safe.
  • If requirements are clear but feasibility is unproven, recommend /sp.deep-research instead of implying that /sp.plan is now safe.

Post-Execution Checks

Check for extension hooks (after clarification):

  • Check if .specify/extensions.yml exists in the project root.
  • If it exists, read it and look for entries under the hooks.after_clarify key.
  • If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally.
  • Filter out hooks where enabled is explicitly false. Treat hooks without an enabled field as enabled by default.
  • For each remaining hook, do not attempt to interpret or evaluate hook condition expressions:
    • If the hook has no condition field, or it is null/empty, treat the hook as executable.
    • If the hook defines a non-empty condition, skip the hook and leave condition evaluation to the HookExecutor implementation.
  • For each executable hook, output the following based on its optional flag:
    • Optional hook (optional: true):
      ## Extension Hooks
      
      **Optional Hook**: {extension}
      Command: `/{command}`
      Description: {description}
      
      Prompt: {prompt}
      To execute: `/{command}`
      
    • Mandatory hook (optional: false):
      ## Extension Hooks
      
      **Automatic Hook**: {extension}
      Executing: `/{command}`
      EXECUTE_COMMAND: {command}
      
  • If no hooks are registered or .specify/extensions.yml does not exist, skip silently.

Claude Code Subagent Capability Discovery

  • Execution model: preserve the workflow's existing subagent-mandatory, subagents-first, adaptive, or subagent-assisted policy.
  • Dispatch shape: preserve the workflow's existing dispatch shape; use subagent-blocked only after the discovery step below fails or is unsafe.
  • Execution surface: prefer native-subagents when the current runtime supports it; use none only after recording the unavailable or unsafe surface.
  • Native subagent capability discovery: Before recording subagent-blocked, check the active tool surface for the integration-native subagent or task-dispatch entrypoint and record the exact missing surface if unavailable.
  • Do not record subagent-blocked until this capability discovery step is complete and the exact unavailable or unsafe surface is recorded.
  • Native subagent dispatch: Dispatch subagents through the integration's native subagent support using the shared prompt contract.
  • Join behavior: Use the integration-native join point, then integrate results back on the leader path.
  • Preserve this workflow's existing packet, handoff, artifact, and result schema; this section only governs capability discovery before dispatch or blocked-state recording.

Claude Code Structured Question Preference

  • If this command was routed by sp-auto with auto_default_recommendation: true, evaluate the automatic recommended/default continuation gate before any question path.
  • When that gate has one safe recommended/default answer, you must auto-resolve the question or confirmation, record the accepted recommendation in the workflow state or summary, continue the workflow, and do not invoke the native structured question tool only to ask for that approval.
  • If the automatic gate is not safe, write the blocker and self-unblock recommendation before using the normal question path.
  • If the runtime's native structured question tool is available for the current turn and the sp-auto automatic gate did not resolve the question, you must use it.
  • Do not render the textual fallback block when the native tool is available.
  • Do not self-authorize textual fallback because the question seems simple, short, or easy to phrase manually.
  • Treat the template's textual question format as fallback-only guidance; use it to shape the question content, but do not render the textual block unless the native tool is unavailable in the current runtime or the tool call fails.
  • Keep native-tool availability, runtime mode, and fallback mechanics backstage. Do not tell the user that a structured question tool is unavailable, that the current runtime/mode lacks a tool, or that a fallback is being used; ask the user-facing question directly when a question is genuinely required.
  • Ask only the minimum number of questions required by this workflow's existing contract.
  • Keep the user-visible question text in the user's current language and keep option labels short.
  • Do not emit both a native tool question and the textual fallback block in the same turn. The user should see the active question exactly once.
  • If the native tool is unavailable in the current runtime or the tool call fails, ask one concise plain-text confirmation question and continue with the existing enhancement flow.
  • In clarify, use this preference for:
    • high-impact gap confirmation
    • scope or constraint confirmation when enhancement changes planning readiness
  • Native tool target: AskUserQuestion
  • When this native tool target is listed for the integration and the runtime does not signal otherwise, assume it is available by default in normal interactive sessions.
  • Question count: 1-4 questions per call
  • Option count: 2-4 options per question
  • Required question fields: question, header, options, multiSelect
  • Option fields: label, description, preview (optional)
  • Use multiSelect: false unless the workflow explicitly needs multiple selections.
  • Use metadata only when tracking or analytics context adds value; otherwise keep the call minimal.

04 同仓库更多 Skills

chenziyang110
chenziyang110/launchdeck

launchdeck-agent

Codex host adapter contract fixture for Launchdeck.

★ 0
chenziyang110
chenziyang110/launchdeck

launchdeck-agent

Claude host adapter contract fixture for Launchdeck.

★ 0
chenziyang110
chenziyang110/launchdeck

launchdeck-agent

Use this skill aggressively for local project lifecycle operations even when the user does not mention Launchdeck: start this project, run the dev server, dev, build, test, restart service, stop service, show logs, inspect ports, port is occupied, clean cache; and when the user explicitly asks to configure this local project for Launchdeck or create or generate a project-adapted `.launchdeck.yml`, including 为这个项目生成 Launchdeck 配置. Do not use for ordinary code edits, docs-only work, general explanations, API design discussion, or production deployment unless the user also asks to operate or configure a local project or service.

★ 0
chenziyang110
chenziyang110/launchdeck

zig-testing

Use ONLY when user explicitly requests Zig test code, built-in test runner configuration, test failure diagnosis, or coverage for Zig projects. Triggers: "write test zig", "zig test", "testing.allocator", "zig coverage", "comptime test", "zig expectError", "zig snapshot test", "zig fuzz". Do NOT activate for: general Zig coding without test context, build.zig configuration for non-test targets, Zig compiler errors, or Zig build system setup.

★ 0
chenziyang110
chenziyang110/launchdeck

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

★ 0
chenziyang110
chenziyang110/launchdeck

verification-before-completion

Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always

★ 0