dibs

You

You fixed one line by hand.

The agent

It rewrote the file from memory.

dibs stops AI coding agents from undoing what you typed.

Agents don't see the edits you make between their turns, so they "fix" them back. dibs tells them what you changed, blocks the revert before it lands, and restores only your lines if one slips through.

Claude Code · Codex · Gemini CLI · Cursor · Copilot · aider

The arena a browser simulation of how dibs reacts; the agent's edits are scripted

  1. 1 Edit a line in api.py (try timeout=30)
  2. 2 Give the agent a task
  3. 3 Watch it try to write from memory
api.py your editor · type here
your lines agent's new lines
agent memory what it thinks api.py says

      

One turn, both sides of the seam

01

You edit by hand

Between turns you change timeout=10 to timeout=30. dibs records it as yours — with the lines, the time, and the file.

The agent gets a brief

[dibs] Since your last turn these files were
changed outside your session — by the human, by hand.
• api.py — edited by human (+1 −1, 2m ago)
    - r = requests.get(url, timeout=10)
    + r = requests.get(url, timeout=30)
02

It tries anyway

Before any edit runs, dibs checks whether it removes lines you added or brings back lines you deleted. Claude Code asks you; Codex, Gemini and Cursor get a denial that names your lines.

The edit bounces

dibs: this edit to api.py would undo changes the
human made by hand.
It removes lines the human added or changed:
  + r = requests.get(url, timeout=30)
Keep the human's version and make your change
around it.
03

Something slipped through?

A sed in a shell command, or an agent with no hooks. dibs sees it right after, tells the agent, blocks the commit, and puts back only your lines.

Your lines come back

$ git commit -m "add logging"
dibs: this commit contains files where an AI agent
undid lines you edited by hand:
  #7 api.py (claude): r = requests.get(url, timeout=30)
$ dibs restore api.py
✓ restored the human lines in api.py (undoing #7)

Verified with the real CLIs — honestly

Real agent binaries, real config parsing, real hook runners. Only the model's replies were scripted (no accounts were used).

AgentVersionGuard before editShell revert caughtBrief reaches model
Claude Code2.1.295✓ ask✓✓
Codex CLI0.162.0✓ deny✓✓
Gemini CLI0.63.0✓ deny✓✓
aider0.86.2after the run✓✓ --read
Cursor agent2026.10.01unit tests from its source · needs a Cursor login to run end to end
Copilot—not run · needs VS Code + a Copilot account

Call dibs in 20 seconds

Python 3.9+, no dependencies. Everything stays in .git/dibs/ on your machine.

# install (not on PyPI yet)
pipx install git+https://github.com/mrzroot/dibs@v0.1.1

# in each repo
dibs init      # wires your agents' hooks
dibs doctor    # checks they will really run
dibs status
Latest releaseآخرین نسخه

Ready to installآمادهٔ نصب

v0.1.1
Published 2026-10-09. Includes Python wheel.منتشرشده در 2026-10-09. شامل فایل wheel پایتون.
FAQ

Questions people askپرسش‌های پرتکرار

Which agents does it work with?با کدام ایجنت‌ها کار می‌کند؟
Claude Code, Codex, Gemini CLI, Cursor, Copilot and aider, through each agent's own hooks. Run dibs doctor after you upgrade an agent; it checks that the hooks still fire.Claude Code، Codex، Gemini CLI، Cursor، Copilot و aider، از راه هوک‌های خود هر ایجنت. بعد از به‌روزرسانی هر ایجنت، dibs doctor را اجرا کنید تا مطمئن شوید هوک‌ها هنوز کار می‌کنند.
Does my code leave my machine?کد من از کامپیوترم بیرون می‌رود؟
No. The journal lives in .git/dibs/ (or .dibs/ outside git). It is never committed and nothing is sent anywhere.نه. دفتر ثبت در .git/dibs/ (یا بیرون از گیت در .dibs/) می‌ماند، هیچ‌وقت کامیت نمی‌شود و چیزی به جایی فرستاده نمی‌شود.
What if the agent reverts my line with a shell command?اگر ایجنت با یک دستور شل خط مرا برگرداند چه؟
dibs checks after every command. A revert done with sed, cat > or a script is reported to the agent, shown in dibs status and stopped at git commit. dibs restore FILE puts back only your lines.dibs بعد از هر دستور بررسی می‌کند. برگرداندنی که با sed، cat > یا یک اسکریپت انجام شود به ایجنت گزارش می‌شود، در dibs status دیده می‌شود و پشت git commit می‌ماند. dibs restore FILE فقط خط‌های شما را برمی‌گرداند.
How is it different from Cursor checkpoints or Claude Code rewind?چه فرقی با checkpointهای Cursor یا rewind در Claude Code دارد؟
Those roll a whole file back after the damage, inside one tool. dibs tries to stop the revert before it lands, works with six agents, and its restore keeps the agent's other work.آن‌ها بعد از خرابی، کل فایل را عقب می‌برند و فقط داخل یک ابزار. dibs سعی می‌کند جلوی برگرداندن را پیش از اتفاق بگیرد، با شش ایجنت کار می‌کند و هنگام بازگردانی، بقیهٔ کار ایجنت را نگه می‌دارد.
Will it slow my agent down?ایجنت را کند می‌کند؟
Barely. On a 30,000-file repository dibs init takes about 1.2 s and each hook 0.1–0.4 s. Files over 2 MB and binaries are tracked by hash only.تقریباً نه. در مخزنی با ۳۰ هزار فایل، dibs init حدود ۱٫۲ ثانیه و هر هوک ۰٫۱ تا ۰٫۴ ثانیه طول می‌کشد. فایل‌های بزرگ‌تر از ۲ مگابایت و فایل‌های باینری فقط با هش دنبال می‌شوند.
What does it not catch?چه چیزی را نمی‌گیرد؟
If you edit a file while an agent's shell command is running, that edit is counted as the agent's. Matching is by whole lines and ignores whitespace, so a line rewritten into something new is not a “revert”.اگر وقتی دستور شل ایجنت در حال اجراست فایلی را ویرایش کنید، آن تغییر به حساب ایجنت نوشته می‌شود. مقایسه خط‌به‌خط است و فاصله‌ها را نادیده می‌گیرد؛ پس خطی که به چیز تازه‌ای بازنویسی شود «برگرداندن» حساب نمی‌شود.