rollback.v1

A command for undoing changes made earlier in an agent session, including edited files and cloud or infrastructure resources.

In plain words
What is it for?
Discovering rollback candidates, selecting files or infrastructure to reverse, and confirming destructive rollback actions.
Why use it?
It provides a controlled way to review and reverse earlier work before anything is removed or changed back.

Command

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/stakpak/agent/rollback.v1
Clone the repo
git clone --depth 1 https://github.com/stakpak/agent
Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,429 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.00016 $0.02429
Opus 5 $0.00008 $0.01215
Sonnet 5 $0.00003 $0.00486
Haiku 4.5 $0.00002 $0.00243

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

Security

Grade A, and why

rollback.v1 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.

libs/api/src/commands/rollback.v1.md · 197 lines

How it starts

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

You are undoing changes you made earlier in this session — files you edited and cloud/infra you provisioned. Do it in four phases: discover, ask, confirm, execute.


Input: {input}


Interpreting the Input

Treat {input} as a filter:

  • empty — discover everything, then ask.
  • all — discover everything, skip the selection prompt, still run the destructive-action confirmation.
  • files — files only.
  • infra — cloud/infra only.
  • anything else — case-insensitive substring filter applied during discovery (e.g. ec2, src/, my-bucket).

Use best judgement on ambiguous input.


Phase 1 — Discover

Build one flat list of rollback candidates. Each candidate has:

  • id — stable value you will pass to ask_user (e.g. file:/abs/path or aws:ec2-instance:i-0abc123:us-east-1)
  • label — one line describing what the reversal will do
  • reverse — the exact command or tool call you will run
  • notes — anything the user should know (e.g. "bucket non-empty", "no ID in transcript")

1.1 Files (skip if {input} is infra)

Every create, str_replace, and remove you ran in this session returned a <file_backups> XML block pairing original_path with backup_path. Walk back through your session output and collect those pairs.

Example of what you saw when you removed a file:

<file_backups>
    <file
        original_path="/Users/alice/project/src/app.py"
        backup_path=".stakpak/session/backups/525963a3.../app.py"
        location="local"
    />
</file_backups>

From that entry, emit a candidate:

  • id: file:/Users/alice/project/src/app.py
  • label: Restore src/app.py from .stakpak/session/backups/525963a3.../app.py
  • reverse: copy the backup back to the original path (use the create tool if the original is gone, str_replace otherwise — whichever applies)

For files you created this session, the reversal is remove on the original path. The remove tool backs the file up again, so the undo is itself reversible.

Read the full file on GitHub · 197 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 · 197 lines · 16 tokens per session scan A 829eeac22eef

Subscribe to this mod's changes

rollback.v1 is a command published in the GitHub repository stakpak/agent (1,759 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 16 tokens to every session and 2,429 once invoked, about $0.0001 per session on Opus 5. 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.