AgentSkillsCN

Close Loop

闭环

SKILL.md

Skill: Close Loop

Description

Verifies task completion by checking produced artifacts against the original acceptance criteria, runs quality checks, and closes the feedback loop between requesting and producing personas. If all criteria pass, the task is marked complete and downstream consumers are notified. If criteria fail, the task is returned to the producer with specific, actionable failure reasons. This skill enforces the quality contract that keeps the autonomous team reliable.

Trigger

  • Invoked automatically when a persona marks a task as complete.
  • Invoked by the /close-loop slash command for on-demand status verification.
  • Called programmatically by the orchestration layer after artifact production.

Inputs

InputTypeRequiredDescription
task_idStringYesIdentifier of the task being verified (e.g., TASK-007-implement-api)
task_specFile pathYesThe original task specification containing acceptance criteria
produced_artifactsFile listYesPaths to every output artifact claimed by the producing persona
persona_outputs_mdFile pathYesThe producing persona's outputs.md defining quality bar references

Process

  1. Load the task specification and its acceptance criteria -- Parse the task file, extract each acceptance criterion as a discrete checkable item.
  2. Inventory the produced artifacts -- Confirm every claimed artifact exists on disk, is non-empty, and has the expected file type.
  3. Verify each acceptance criterion against the artifacts -- Evaluate every criterion as pass, fail, or partial. Record evidence for each judgment.
  4. Check artifacts against the quality bar -- Compare outputs to the standards defined in the producing persona's outputs.md (formatting, completeness, depth).
  5. Run automated quality checks -- Execute any applicable automated validation: linting, test suites, format checks, schema validation. Record results.
  6. Generate a verification report -- Produce a structured report listing each criterion, its status, and supporting evidence or failure reasons.
  7. If all criteria pass -- Mark the task as complete. Identify downstream tasks that were blocked and notify the consuming persona(s) that the dependency is satisfied.
  8. If any criteria fail -- Mark the task as returned. Send the verification report back to the producing persona with specific, actionable failure descriptions.

Outputs

OutputTypeDescription
verification_reportMarkdown fileDetailed pass/fail/partial status per acceptance criterion
task_statusEnum: complete, returned, blockedUpdated state of the task after verification
handoff_notificationTextMessage to downstream persona(s) if task is complete; includes artifact locations

Quality Criteria

  • Every acceptance criterion from the task spec is explicitly evaluated -- none are skipped.
  • Each criterion verdict includes evidence (file path, line reference, test output) rather than bare assertions.
  • Partial verdicts explain exactly what is missing and what would move the criterion to pass.
  • The verification report is actionable: a producer who receives a returned status can fix every issue without asking clarifying questions.
  • Automated checks (lint, test, format) are run when applicable tooling is available; their absence is noted in the report.
  • The handoff notification includes the exact artifact paths that downstream consumers need.
  • Status transitions are idempotent: re-running close-loop on an already-complete task produces the same result.

Error Conditions

ErrorCauseResolution
TaskNotFoundThe task_id does not match any known task fileVerify the task_id and ensure the task file exists
TaskSpecMissingCriteriaThe task spec has no acceptance criteria definedAdd at least one testable criterion to the task spec
ArtifactMissingA claimed artifact path does not exist on diskEnsure the producing persona wrote all outputs to the correct paths
ArtifactEmptyAn artifact file exists but is zero bytesRe-produce the artifact; empty files do not satisfy criteria
PersonaOutputsNotFoundThe persona's outputs.md file cannot be locatedCheck the persona directory in the library for outputs.md
AutomatedCheckFailedA linter, test suite, or formatter returned errorsFix the reported issues and re-submit the artifacts
DownstreamPersonaUnknownA dependent task references a persona not in the teamUpdate the team composition or reassign the downstream task

Dependencies

  • Seed Tasks skill (tasks must exist before they can be closed)
  • Access to the producing persona's outputs.md for quality bar definitions
  • Access to the task file generated by the Seed Tasks skill
  • Automated tooling (linters, test runners) when available in the project environment
  • Dependency graph from Seed Tasks to identify downstream consumers for handoff