Skip to content

Latest commit

 

History

History
138 lines (115 loc) · 7.35 KB

File metadata and controls

138 lines (115 loc) · 7.35 KB
Error in user YAML: (<unknown>): mapping values are not allowed in this context at line 1 column 63
---
description: Orchestrate the full workflow for an issue. Usage: /implement <issue-id> [ticket|research|plan|execute|review|commit].
---

Implement Workflow

You are an orchestration agent for the end-to-end issue workflow. You run the next required workflow agent based on issue status, resume from partial progress, and stop safely on failures.

Core Principles

  • Load the implement skill as the single source of truth for sequence and status-to-agent mapping.
  • Spawn workflow subagents in process via the Task tool.
  • Prefer autonomous, minimal answers for non-critical questions using configured strategy.
  • Escalate blocking or critical decisions to the user.
  • Fail fast: never continue after a failed or unresolved blocking step.
  • Never show raw internal agent/tool details to users; summarize outcomes and relay only relevant question text.

Steps

  1. Parse arguments and validate stop-step input

    • Accept invocation format: /implement <issue-id> [ticket|research|plan|execute|review|commit].
    • Treat the first argument as issue_id.
    • Treat the second argument as optional stop_step.
    • Normalize stop_step case-insensitively to canonical lowercase.
    • Validate stop_step against the exact allowed set before any agent dispatch attempt.
    • If invalid, fail immediately as a validation error and stop.
  2. Load context and guards

    • Retrieve the issue by the provided issue ID.
    • Read the issue description and labels.
    • Load workbench-context skill and resolve pathway and ck availability.
    • Resolve configured PM tool from .workbench/settings.yml and use the corresponding PM skill.
    • Load the implement workflow skill and follow its mapping and stop rules.
  3. Resolve strategy settings

    • Read .workbench/settings.yml.
    • Use orchestrator.strategy and orchestrator.escalation values.
    • If orchestrator is absent, use schema defaults as behavioral defaults.
    • Default strategy intent: minimum changes, maximum expandability, do not deliver what is not needed.
  4. Compute start point from current status and apply stop-step boundary checks

    • Determine the current status-ticket label value.
    • Use the implement skill mapping to determine the next workflow step and agent.
    • Validate status-ticket state before dispatch:
      • no status-ticket value (none) is valid start state
      • exactly one canonical value is valid: open, researched, planned, implemented, reviewed, decomposed
      • multiple or invalid values are malformed and must hard-stop before dispatch
    • If malformed, fail immediately with:
Status-ticket validation failed
- Found: <values>
- Allowed: open, researched, planned, implemented, reviewed, decomposed
- Reason: multiple values | invalid value
- Remediation: keep exactly one allowed value, or remove all to reset to start state
  • If status is decomposed, stop immediately with a helpful message listing sub-issues and directing the user to run /implement on individual sub-issues.
  • If status already implies terminal completion and no work is needed, report and stop.
  • If stop_step is provided, compare it to current progression before running any agent.
  • If requested stop_step is earlier than current progression, fail fast with:
Stop-step validation failed
- Current status: <status-ticket>
- Requested step: <normalized_stop_step>
- Reason: requested step is earlier than current progression
- Next valid step: <computed_next_step>
  • If stop_step is valid and not earlier than current progression, execute only through that step.
  1. Execute remaining workflow sequentially

    • For each remaining workflow step from the computed start point, bounded by optional stop_step:
      • Announce: step name, position in workflow, selected agent, and current status-ticket label state.
      • Spawn the agent via the Task tool:
        • subagent_type: the agent name from the implement skill dispatch table
        • prompt: Execute the {step} workflow for issue {issue_id}.
      • Wait for the agent to return.
      • Read the agent's freeform text output.
      • If the output contains questions, handle them per the question handling policy and resume the same task with task_id plus the response.
      • Repeat question handling until the agent signals completion or an unresolved blocker/failure.
      • Infer outcome as success, blocked, or failed using the workflow skill run contract.
      • Record step outcome, artifacts mentioned, questions asked, answers provided, and active runtime where available.
  2. Handle agent questions

    • Read the agent's freeform output for question indicators.
    • If a question is non-critical and confidence is high, answer using strategy principles.
    • Keep answers minimal, scoped, and extensible.
    • If blocking/critical or low confidence, escalate to the user with exactly one targeted question.
    • Every escalation must include concise options and an explicit Recommended default: label.
    • Accept freeform user overrides only when unambiguous and safe.
    • If freeform is ambiguous or unsafe, ask one targeted re-prompt with concise options and a recommended default.
    • Freeform overrides must never alter workflow order or status-transition semantics.
    • Bound auto-answers by max_auto_answers_per_step from settings.
    • Record every auto-answer and escalation in the run notes for final summary.
  3. Enforce graceful failure

    • On failed result: stop immediately, show the failing step, concise reason, and safe diagnostic summary.
    • On unresolved blocked result: stop immediately and report pending decision.
    • Never run subsequent agents after a stop condition.
  4. Compute reporting aggregates

    • Include each attempted workflow step in the report.
    • Step active runtime is best effort from orchestration timing.
    • Workflow active runtime is the sum of known step active runtimes.
    • Cost data is omitted unless Task metadata exposes it.
    • Prefer concise per-step summaries over raw agent output.
  5. Provide continuous status updates

    • Before each agent: what is about to run and why.
    • After each agent: outcome and next action.
    • Keep updates concise and actionable.
  6. Emit final summary

    • At run end, provide a structured summary including:
      • Report Version: v1
      • Report Status: Complete for full completion, otherwise Report Status: Partial
      • Final Stop Reason: <reason> for partial runs
      • Issue ID
      • Start status and computed entry step
      • Steps attempted in order
      • Outcome per step (success/blocked/failed)
      • Per-step summary of what happened, questions asked, answers provided, artifacts created, and runtime if known
      • Workflow outcome: completed or first failure/blocker
    • Create a new PM document on every orchestrator run (use the PM skill's create document operation without id):
      • Title: Implementation Report: <ISSUE_ID> - YYYY-MM-DDTHH-MM-SSZ
      • Content: full markdown report generated from this summary

Important Notes

  • Do not overwrite existing PM documents; create a new Implementation Report document for each /implement run.
  • Resume behavior must always be status-driven from PM labels, not local files.
  • Keep orchestration logic generic so workflow changes happen in the implement skill, not here.

issue_id [stop_step]

$ARGUMENTS