rollback

rollback is a command for coding agents from studioKjm/ai-harness-template. It costs 39 tokens per session (578 once invoked), scanned A, original, MIT.

A rollback command for undoing part or all of a multi-step code change. It uses Git, a tool that records code versions, to choose a safer recovery method based on what failed.

In plain words
What is it for?
Use it after a failed run, a serious mismatch with the specification, or an evaluation that says the implementation should be undone.
Why use it?
It helps restore a clean working state after an implementation stops halfway or fails checks. It can preserve parts that were completed successfully.

Command

Part of the harness plugin — 44 commands, 11 agents shipped together

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/studiokjm/ai-harness-template/rollback
Clone the repo
git clone --depth 1 https://github.com/studioKjm/ai-harness-template

Or install harness, the plugin that ships this one along with the rest of its 44 commands, 11 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rollback

README.md
[![agentmods](https://agentmods.dev/badge/commands/studiokjm/ai-harness-template/rollback.svg)](https://agentmods.dev/commands/studiokjm/ai-harness-template/rollback)
Your own site
<a href="https://agentmods.dev/commands/studiokjm/ai-harness-template/rollback"><img src="https://agentmods.dev/badge/commands/studiokjm/ai-harness-template/rollback.svg" alt="Measured on agentmods" height="20"></a>
Per session 39 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 578 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.00039 $0.00578
Opus 5 $0.00019 $0.00289
Sonnet 5 $0.00008 $0.00116
Haiku 4.5 $0.00004 $0.00058

Measured 5d ago against content hash 81fb4f53d023, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

rollback 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 5d ago.

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.

commands/rollback.md · 75 lines

What it actually says

/rollback — Saga Rollback

멀티스텝 코드 생성 실패 시 안전하게 롤백합니다.

Instructions

You are the Rollback Guardian. When a multi-step implementation fails partway through, you restore the codebase to a clean state.

When to Use

  • /run 중 게이트 실패로 중단된 경우
  • /evaluate 결과가 FAIL이고 되돌려야 하는 경우
  • 구현 도중 spec과 심각한 drift가 발견된 경우

Rollback Strategy

1. Checkpoint Detection

현재 작업의 시작점을 식별합니다:

# 최근 커밋 확인
git log --oneline -5

# 작업 시작 전 커밋 해시 확인
git log --oneline --before="$(cat .harness/ouroboros/sessions/current-start-time 2>/dev/null || echo 'now')" -1

2. Scope Assessment

롤백 범위를 결정합니다:

Full Rollback:    모든 변경 취소 → git stash 또는 git reset
Partial Rollback: 실패한 AC만 취소 → 파일별 선택적 복원
Layer Rollback:   특정 레이어만 취소 → Presentation만 리셋, Logic은 유지

3. Safe Rollback Execution

# Option A: Stash (비파괴적 — 권장)
git stash push -m "rollback: [reason]"

# Option B: 파일별 선택적 복원
git checkout HEAD -- src/presentation/
git checkout HEAD -- specific-file.ts

# Option C: 새 브랜치에서 재시작
git checkout -b retry/feature-name

Rollback Rules

  1. 절대 git reset --hard를 먼저 시도하지 않는다git stash를 우선
  2. 롤백 전에 현재 상태를 기록한다 — 무엇이 실패했고 왜 롤백하는지
  3. 부분 롤백을 선호한다 — 성공한 레이어는 유지
  4. 롤백 후 게이트를 재실행한다 — 클린 상태 확인

Output

롤백 완료 시 보고:

═══ Rollback Complete ════════════════════════════
  Scope:    {full|partial|layer}
  Method:   {stash|checkout|branch}
  Restored: {file list}
  Retained: {file list}
  Stash ID: {if applicable}

  Next: Fix the issue and re-run /run
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. 5d ago First seen · 75 lines · 39 tokens per session scan A 81fb4f53d023

Subscribe to this mod's changes

rollback is a command published in the GitHub repository studioKjm/ai-harness-template (43 stars, last pushed 3mo ago), licensed MIT. It adds 39 tokens to every session and 578 once invoked, about $0.0002 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.