precedent Read the README
CLI · Pythonlive

Stop false "I can't"s and unchecked "done"s in your AI coding agents.

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.

CLI · Python
precedent · previewscreenshot
precedent screenshot
2platforms: CLI, Python
106automated tests
9agents supported
6/6guardrail trials held (baseline 4/6)
Why it exists

"I can't" needs evidence. "Done" needs proof.

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.

Run it yourself

Install it for every agent you have.

From the README’s “Install” section. Full options, requirements and troubleshooting are there too.

Open the README
shell
$ 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
How it works

How it runs

  1. 1

    See the plan

    Run python install.py to see every change it would make; nothing is written until you add --apply.

  2. 2

    Install

    It installs hooks, an MCP server and rules for each agent it finds, and backs up every file it edits.

  3. 3

    Work as usual

    Give-ups, unchecked "done"s and risky commands are caught as they happen.

  4. 4

    Remove any time

    python install.py --uninstall --apply removes only what it added.

What's inside

What it checks before you trust the reply.

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.

Sends back empty give-ups

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.

"Done" needs a check

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.

Catches invented precedent

Commands cited on a Precedent: line are checked against real history. An invented one is flagged.

Breaks error loops

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.

Stops corner-cutting

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.

Access walls are evidence

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.

Private

Everything runs locally: no network, no telemetry. Databases are opened read-only, and tokens, passwords and keys are redacted.

Good to know

Honest limits.

Straight from the README, so you know what you're getting before you try it.

  • The search is keyword-based (IDF-weighted).
  • Automatic enforcement covers Claude Code, Codex CLI, Gemini CLI, GitHub Copilot CLI and OpenCode.
  • Surfaced precedent comes from your real history, so it can point an agent at things it would not otherwise touch (in the A/B it led one run to read the test machine's mailbox while looking for an…
  • In OpenCode the end-of-turn send-back needs a long-lived session (the TUI or opencode serve).
  • Codex rollouts older than 7 days may be zstd-compressed (.jsonl.zst); those are skipped (no standard-library decoder).
Under the hood

How it's built.

Built with

Language
PythonJavaScript
Testing
Automated tests

36 files in the repo · last updated 7 Nov 2026.

Browse the code

Recently shipped

  1. V3.3.0: OpenCode plugin, measured agent A/B, access-wall and credential-guessing guardrails

  2. 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)

  3. Works with every agent (OpenCode/Codex history, MCP server, installer)

  4. Precedent finder, stop/prompt/failure/integrity hooks, Claude Code plugin

Full history on GitHub
Questions

Good questions.

What does it run on?

CLI, Python.

How do I get it running?

The commands in the “Install” box above come straight from the README. Paste them into a terminal; the README covers options and troubleshooting.

What doesn't it do yet?

The search is keyword-based (IDF-weighted). Automatic enforcement covers Claude Code, Codex CLI, Gemini CLI, GitHub Copilot CLI and OpenCode.

Is it finished?

Not yet: it's marked “live” and still changing. The README always has the current state.

Is it free?

The source is public on GitHub under the MIT licence.

Who made it?

Juwen Lie, an R&D mechanical engineer in Batam, Indonesia, as an independent personal project.

Keep exploring

More from the same workbench.

Read the A/B results.

Stop false "I can't"s and unchecked "done"s in your AI coding agents.