Finds what worked before
When you say "you did it before", it searches past sessions in every agent, shell history and git, and hands over the exact action that worked, with date and task. If there is none, it says so.
Finds a precedent in your own agent history before the agent gives up, and sends back any "done" that has no real check behind it.
You have seen it: the agent says "I can't do that", you reply "you did it before", and suddenly it works.
precedent finds that precedent automatically, from all your agents' history (Claude Code, OpenCode, Codex, Gemini CLI), plus shell history and git, before the agent gives up.
From the README’s “Install” section. Full options, requirements and troubleshooting are there too.
Open the README$ git clone https://github.com/juw12/precedent
$ cd precedent
$ python install.py # dry run: shows every change, writes nothing
$ python install.py --apply # install for every agent it finds
$ python install.py --uninstall --apply
Run python install.py to see every change it would make; nothing is written until you add --apply.
It installs hooks, an MCP server and rules for each agent it finds, and backs up every file it edits.
Give-ups, unchecked "done"s and risky commands are caught as they happen.
python install.py --uninstall --apply removes only what it added.
When you say "you did it before", it searches past sessions in every agent, shell history and git, and hands over the exact action that worked, with date and task. If there is none, it says so.
A give-up without evidence goes back with the precedent attached and a short loop: name the blocker, try three routes that differ in kind, verify. Safety refusals are left alone.
If nothing ran after the last edit, or the last check failed, the agent is sent back to verify. "Should work now" is not a check.
Commands cited on a Precedent: line are checked against real history. An invented one is flagged.
The same error twice and the agent is told to stop repeating that route; on the 3rd and 5th repeat it gets hypotheses and matching precedent.
Skipping tests, removing assertions, deleting test files, push --force, --no-verify, reset --hard and broad rm -r are stopped. Guessed default passwords and access-control changes are blocked too.
A quoted "permission denied" or 401/403 counts as a real blocker to report, not a reason to push harder. That rule came straight out of the A/B.
Everything runs locally: no network, no telemetry. Databases are opened read-only, and tokens, passwords and keys are redacted.
Straight from the README, so you know what you're getting before you try it.
36 files in the repo · last updated 7 Nov 2026.
Browse the codeV3.3.0: OpenCode plugin, measured agent A/B, access-wall and credential-guessing guardrails
V3.2.0: automatic hooks for Codex CLI and Gemini CLI, demo.py, defect fixes (incl. 3.1.0: Gemini reader, Codex code mode, invented-precedent check)
Works with every agent (OpenCode/Codex history, MCP server, installer)
Precedent finder, stop/prompt/failure/integrity hooks, Claude Code plugin
CLI, Python.
The commands in the “Install” box above come straight from the README. Paste them into a terminal; the README covers options and troubleshooting.
The search is keyword-based (IDF-weighted). Automatic enforcement covers Claude Code, Codex CLI, Gemini CLI, GitHub Copilot CLI and OpenCode.
Not yet: it's marked “live” and still changing. The README always has the current state.
The source is public on GitHub under the MIT licence.
Juwen Lie, an R&D mechanical engineer in Batam, Indonesia, as an independent personal project.
Stop false "I can't"s and unchecked "done"s in your AI coding agents.