pipeline-undo

Instructions for an undo command that removes the isolated branch and worktree created by a pipeline run, rather than reverting the user’s current files.

In plain words
What is it for?
Use them when undoing the latest pipeline result or a specified run, checking its ledger, branch, commit, and whether it was pushed remotely.
Why use it?
They describe how to identify the correct run and show what will be removed before asking for confirmation.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/theastrelo/claude-pipeline/pipeline-undo
Clone the repo
git clone --depth 1 https://github.com/TheAstrelo/Claude-Pipeline

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 730 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00730
Opus 5 $0.00000 $0.00365
Sonnet 5 $0.00000 $0.00146
Haiku 4.5 $0.00000 $0.00073

Measured yesterday against content hash 0a38a146c589, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

pipeline-undo scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/pipeline-undo.md · 78 lines

How it starts

The opening of the file, as written. The whole thing — 78 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Pipeline Undo Command

Undo a pipeline run's result. With worktree isolation (the current engine), this is clean and low-risk: a run never touches your checkout — its result lives only on a pipeline/<session> branch (and, for a --push run, on the remote). "Undo" therefore means deleting that branch and its worktree, not reverting your working tree.

Arguments

  • $ARGUMENTS — optional session ID to undo. Defaults to the most recent run.

Instructions

1. Find the run

  • Read .pipeline/artifacts/current.txt for the most recent session directory (or resolve the directory matching the $ARGUMENTS session ID under .pipeline/artifacts/).
  • The session's ledger.jsonl is authoritative. Find:
    • the run_started event → the run's baseline and branch;
    • a commit_published event and commit.sha → whether a commit was made;
    • a branch_published event → whether it was pushed, and to which remote.
  • The run branch is pipeline/<session-id>.

2. Report what will be removed

Show the user, and ask to confirm (y/n):

  • Session ID and task (from the run_started payload).
  • The run branch pipeline/<session-id> and whether it holds a commit.
  • Whether a worktree exists at .pipeline/worktrees/<session-id>.
  • Whether the branch was pushed to a remote.
  • Confirm explicitly that your current checkout will not change — only the run branch/worktree are removed.

3. Execute (only after confirmation)

# Remove the run worktree if it is still present (review-only / halted runs).
git worktree remove --force ".pipeline/worktrees/<session-id>" 2>/dev/null || true
git worktree prune

# Delete the local run branch.
git branch -D "pipeline/<session-id>"

# Remove the per-run checkpoint ref, if any.
git update-ref -d "refs/pipeline-checkpoints/<session-id>" 2>/dev/null || true

If the branch was pushed and the user wants the remote branch removed too (ask separately — this affects shared state):

git push <remote> --delete "pipeline/<session-id>"

Read the full file on GitHub · 78 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 78 lines · 0 tokens per session scan A 0a38a146c589

Subscribe to this mod's changes

pipeline-undo is a command published in the GitHub repository TheAstrelo/Claude-Pipeline (44 stars, last pushed 29d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 730 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.