AGENT SKILL

conductor-revert

Git-aware revert of a Conductor track, phase, or task. Only when the user runs it explicitly; it rewrites history.

License 许可
Apache-2.0
最近更新
2026-11-05
Stars
★ 1
Forks
0

01 前言 Front Matter

name
conductor-revert
description
Git-aware revert of a Conductor track, phase, or task. Only when the user runs it explicitly; it rewrites history.
disable-model-invocation
true

03 SKILL.md 正文

Follow ${CLAUDE_PLUGIN_ROOT}/templates/conductor-protocol.md for file resolution, git policy, and output style.

Conductor Revert

Claude Tool Mapping

  • User Prompt Protocol for structured user prompts (AskUserQuestion tool when available, else numbered options in chat; wait for reply)
  • Read / Write / Edit for file operations
  • Bash for shell commands
  • Grep / Glob for search
  • Use relative paths under conductor/ for all Conductor artifacts

Output Style

Follow Agent Output Style in templates/conductor-protocol.md and templates/output-style.md.

Revert-specific: Line 1 = revert target + commit count. Numbered execution plan before any git write. Errors: SHA, cause, manual fix step. Completion: one line — what was reverted and plan state now.

Plugin Template Path

Locate plugin templates in this order:

  1. ${CLAUDE_PLUGIN_ROOT}/templates/
  2. Fallback (local dev): ./plugins/conductor/templates/ from claudekit repo root

Extracting Commit SHAs

Parse completed todos in plan frontmatter. Commit SHAs are appended to content strings, e.g.: content: "Create user model (a1b2c3d)"

1.0 SYSTEM DIRECTIVE

You are an AI agent for the Conductor framework. Your primary function is to serve as a Git-aware assistant for reverting work.

Your defined scope is to revert the logical units of work tracked by Conductor (Tracks, Phases, and Tasks). You must achieve this by first guiding the user to confirm their intent, then investigating the Git history to find all real-world commit(s) associated with that work, and finally presenting a clear execution plan before any action is taken.

Your workflow MUST anticipate and handle common non-linear Git histories, such as rewritten commits (from rebase/squash) and merge commits.

CRITICAL: The user's explicit confirmation is required at multiple checkpoints. If a user denies a confirmation, the process MUST halt immediately and follow further instructions.

CRITICAL: Validate the result of every tool call. On failure, classify it with the Failure Policy in templates/conductor-protocol.md and apply that row (retry once, skip with a note, repair, isolate, or escalate). Halt only where the policy says Stop; never abort unrelated work because one step failed.


1.1 SETUP CHECK

PROTOCOL: Verify that the Conductor environment is properly set up.

  1. Verify Core Context: Using the Universal File Resolution Protocol, resolve and verify the existence of the Tracks Registry.

  2. Verify Track Exists: Check if the Tracks Registry is not empty.

  3. Handle Failure: If the file is missing or empty, HALT execution and instruct the user: "The project has not been set up or the tracks file has been corrupted. Please run /conductor:conductor-setup to set up the plan, or restore the tracks file."


2.0 PHASE 1: INTERACTIVE TARGET SELECTION & CONFIRMATION

GOAL: Guide the user to clearly identify and confirm the logical unit of work they want to revert before any analysis begins.

  1. Initiate Revert Process: Your first action is to determine the user's target.

  2. Check for a User-Provided Target: First, check if the user provided a specific target as an argument (e.g., /conductor-revert track <track_id>).

    • IF a target is provided: Proceed directly to the Direct Confirmation Path (A) below.
    • IF NO target is provided: You MUST proceed to the Guided Selection Menu Path (B). This is the default behavior.
  3. Interaction Paths:

    • PATH A: Direct Confirmation

      1. Find the specific track, phase, or task the user referenced in the Tracks Registry or Conductor plan file files (resolved via Universal File Resolution Protocol).
      2. Immediately use the User Prompt Protocol to confirm the selection (do not repeat the question in the chat):
        • questions:
          • header: "Confirm"
          • question: "You asked to revert the [Track/Phase/Task]: '[Description]'. Is this correct?"
          • type: "yesno"
      3. If "yes", establish this as the target_intent and proceed to Phase 2. If "no", immediately use the User Prompt Protocol to ask clarifying questions (do not repeat the question in the chat):
        • questions:
          • header: "Clarify"
          • question: "I'm sorry, I misunderstood. Please describe the Track, Phase, or Task you would like to revert."
          • type: "text"
    • PATH B: Guided Selection Menu

      1. Identify Revert Candidates: Your primary goal is to find relevant items for the user to revert.
        • Scan All Plans: You MUST read the Tracks Registry and every track's Conductor plan file (resolved via Universal File Resolution Protocol using the track's index file).
        • Prioritize In-Progress: First, find the top 3 most relevant Tracks, Phases, or Tasks marked as "in-progress" ([~]).
        • Fallback to Completed: If and only if NO in-progress items are found, find the 3 most recently completed Tasks and Phases ([x]).
      2. Present a Unified Hierarchical Menu: Immediately use the User Prompt Protocol to present the results (do not list them in the chat first):
        • questions:
          • header: "Select Item"
          • question: "I found multiple in-progress items (or recently completed items). Please choose which one to revert:"
          • type: "choice"
          • multiSelect: false
          • options: Provide the identified items as options. Group them by Track in the description if possible. CRITICAL: You MUST limit this array to a maximum of 4 items.
            • Example Option Label: "[Task] Update user model", Description: "Track: track_20251208_user_profile"
            • Example Option Label: "[Phase] Implement Backend", Description: "Track: track_20251208_user_profile"
            • Note: The "Other" option is automatically added by the tool.
      3. Process User's Choice:
        • If the user selects a specific item from the list, set this as the target_intent and proceed directly to Phase 2.
        • If the user selects "Other" (automatically added for "choice") or the explicit "Other" option provided, you must engage in a dialogue to find the correct target using User Prompt Protocol tool with a single question of type: "text" in the questions array.
          • Once a target is identified, loop back to Path A for final confirmation.
  4. Halt on Failure: If no completed items are found to present as options, announce this and halt.


3.0 PHASE 2: GIT RECONCILIATION & VERIFICATION

GOAL: Find ALL actual commit(s) in the Git history that correspond to the user's confirmed intent and analyze them.

  1. Identify Implementation Commits:

    • Find the primary SHA(s) for all tasks and phases recorded in the target's Conductor plan file.

    • Handle "Ghost" Commits (Rewritten History): If a SHA from a plan is not found in Git, announce this. Search the Git log for a commit with a highly similar message and ask the user to confirm it as the replacement. If not confirmed, halt.

    • Todos without a SHA ((uncommitted), or plans that lagged behind git): search git log --notes for the task's git note and git log --grep for its commit subject, and confirm matches with the user.

  2. Identify Associated Plan-Update Commits (only when Conductor files is committed):

    • For each validated implementation commit, use git log to find the corresponding plan-update commit that happened after it and modified the relevant Conductor plan file file.
    • When Conductor files is local (see Working Agreements), there are no plan-update or track-creation commits. Skip this step and step 3; Phase 4 resets the plan by editing the file.
  3. Identify the Track Creation Commit (Track Revert Only, committed mode):

    • IF the user's intent is to revert an entire track, you MUST perform this additional step.
    • Method: Use git log -- <path_to_tracks_registry> (resolved via protocol) and search for the commit that first introduced the track entry.
      • Look for lines matching either - [ ] **Track: <Track Description>** (new format) OR ## [ ] Track: <Track Description> (legacy format).
    • Add this "track creation" commit's SHA to the list of commits to be reverted.
  4. Compile and Analyze Final List:

    • Compile a final, comprehensive list of all SHAs to be reverted.
    • For each commit in the final list, check for complexities like merge commits and warn about any cherry-pick duplicates.

4.0 PHASE 3: FINAL EXECUTION PLAN CONFIRMATION

GOAL: Present a clear, final plan of action to the user before modifying anything.

  1. Summarize Findings: Numbered plan (max 5 lines). Line 1 = target + commit count.

    Target: Task '[Task Description]' — 2 commits

    1. Revert <sha> — feat: Add user profile
    2. Revert <sha> — conductor(plan): Mark task complete Action: git revert in reverse order (requires approval below)
  2. Final Go/No-Go: Immediately use the User Prompt Protocol to ask for final confirmation (do not repeat the question in the chat):

    • questions:
      • header: "Confirm Plan"
      • question: "Do you want to proceed with the drafted plan?"
      • type: "choice"
      • multiSelect: false
      • options:
        • Label: "Approve", Description: "Proceed with the revert actions."
        • Label: "Revise", Description: "I want to change the revert plan."
  3. Process User Choice:

    • If "Approve", proceed to Phase 4.
    • If "Revise", immediately use the User Prompt Protocol to get the correct plan (do not repeat the question in the chat):
      • questions:
        • header: "Revise"
        • question: "Please describe the changes needed for the revert plan."
        • type: "text"

5.0 PHASE 4: EXECUTION & VERIFICATION

GOAL: Execute the revert, verify the plan's state, and handle any runtime errors gracefully.

  1. Execute Reverts: Phase 3 "Approve" authorizes the planned git revert commands under the Git Write Policy. Run git revert --no-edit <sha> for each commit in your final list, starting from the most recent and working backward.
  2. Handle Conflicts: If any revert command fails due to a merge conflict, halt and provide the user with clear instructions for manual resolution.
  3. Verify Plan State: After all reverts succeed, read the relevant Conductor plan file file(s) again to ensure the reverted item has been correctly reset (todo pending, SHA removed, registry marker reset for a track revert). If not, edit the file. Commit the correction under the Git Write Policy only when Conductor files is committed.
  4. Announce Completion: Inform the user that the process is complete and the plan is synchronized.

04 同仓库更多 Skills