Repository navigation
Releases
v0.3.0
Full Changelog: v0.2.3...v0.3.0
Precedent v0.2.3: citable on Zenodo
Precedent now has a citable DOI: 10.5281/zenodo.24087058
This is the first release archived on Zenodo. The DOI above always points at the latest version; GitHub's "Cite this repository" button and the README give APA and BibTeX. No code changes.
pip install -U precedent-aiFull diff: v0.2.2...v0.2.3
Precedent v0.2.2: docs refresh
Docs-only release: the package description on PyPI is refreshed from the current README. No code changes.
pip install -U precedent-aiFull diff: v0.2.1...v0.2.2
Precedent v0.2.1: on PyPI as precedent-ai
Precedent is now on PyPI.
pip install precedent-aiThe package is precedent-ai; you import it and run it as precedent. Releases publish through PyPI Trusted Publishing (no stored token), and every build ships with signed provenance.
Fixes
precedent ask --dry-runandprecedent replayprinted a gap id to answer, but dry runs never save gaps, soprecedent gaps answeron that id failed. Dry runs no longer report a gap id.- The Anthropic tool use and LangGraph examples now register
check_actionnext toconsult_rulebook, so agents built from them re-check each step and halt.
New in 0.2 (the execution gate that halts a running action): see v0.2.0.
Full diff: v0.2.0...v0.2.1
Precedent v0.2.0: halt a running action, not just the next one
Approving the start of an action isn't enough. Precedent now halts a run that's already going.
v0.1.0 gated the next action: act, needs approval or escalate. It could not stop an action already running, and it never re-checked after Done. This release adds that second gate, and every halt now records which rule, which run, and who halted it.
🛑 The execution gate
While acting, the agent calls check_action (MCP), kb.check() (Python) or precedent check (CLI) before each step, and once more after Done. Every call returns continue or halt. No model is involved. It halts when:
- the step uses an amount, or a high-risk word (bank, refund, delete…), that's in neither the decision nor its rules
- a cited rule was retired, re-versioned or edited mid-run
- a NEEDS APPROVAL decision has no sign-off from a person
- the decision has expired (
runtime.decision_ttl_minutes, default 60) or was already used - the decision was ESCALATE, or the agent cites a decision that was never issued
> check: Refunding 5000 to the customer's card
[HALT] H-20261109T1428-e1f2fb8921 D-20261109T1428-2ed8117143 during run run-cake
why : out_of_scope: the step uses 5000, which the decision did not authorise
🧾 Halt records
Each halt is saved in logs/events.jsonl with the decision, the run, the cited rule versions, the stage (during or after Done), the reason, and who created it: precedent:check, a person, or mcp:<monitor>. precedent halts lists them. Halts are final: once a run is halted, every later step in it halts too.
🔌 Bring your own monitor
When an outside monitor halts a run, it calls report_outcome with verdict: "halt", or runs precedent halt D-… "why" --fix "…". Precedent records the halt, stops the run, opens a gap and drafts the rule fix. Approving the fix adds a regression test.
Also new
run_idonresolve,consult_rulebookandprecedent ask --runprecedent signofffor NEEDS APPROVAL decisions (CLI and Python only: there is no way for an agent to sign off over MCP)- Drift counts out-of-scope and external halts against a rule; the weekly digest reports halts
- SECURITY.md lists each new protection with its test, and its limits
139 tests, CI green on Linux, macOS and Windows (Python 3.10 to 3.13). Full list: CHANGELOG.
pip install "git+https://github.com/burhan-mujahid/precedent@v0.2.0"Full diff: v0.1.0...v0.2.0
Precedent v0.1.0: human-approved rules and action gates for AI agents
Precedent turns how your team already works into rules your AI agents follow, and keeps those rules true.
It mines "how do we handle X?" threads from WhatsApp or Slack into draft rules linked to their source messages. A person approves every rule. Every agent action then goes through five deterministic gates outside the model: 🟢 ACT, 🟡 NEEDS APPROVAL or 🔴 ESCALATE. Every escalation becomes next week's rule and a regression test.
pip install "git+https://github.com/burhan-mujahid/precedent@v0.1.0"
git clone https://github.com/burhan-mujahid/precedent && cd precedent && pip install -e . && bash examples/demo.shHighlights
- Mine: WhatsApp (Android/iOS, all common locales, Urdu and other RTL chats), Slack exports, JSONL. Every draft cites the messages it came from.
- Gate: coverage → judgement → grounding → risk-tiered confidence → risk. Fails closed on model errors, invented citations, prompt-injected amounts and weak high-risk matches.
- Learn: gaps clustered into a weekly digest; answers become draft rules and regression tests; confirm/override feedback; session wraps.
- Stay true: drift detection (stale, overridden, unused, duplicate, coverage), regression evals and evidence-based threshold calibration, point-in-time replay.
- Plug in anywhere: Python API, CLI (
--json), MCP server, function-calling tool spec; exports to Agent Skills, AGENTS.md, Parlant. - Models: Gemini, Kimi, Anthropic, OpenAI, OpenRouter, Groq, Ollama, or fully offline. Live results with Gemini and Kimi.
- Secure by default: secrets and PII redacted before anything is stored or sent; signed build provenance; threat model.
116 tests on Linux (Python 3.10–3.13), macOS and Windows. One runtime dependency (PyYAML). MIT.
Full changelog: CHANGELOG.md