RunLedger GitHub

Recording every run

The black box recorder for AI coding agents.

A receipt for every run, and a guard that stops risky commands before they execute.

Star on GitHub
  • Apache-2.0
  • Python 3.9+
  • No runtime dependencies
  • Local first, no telemetry
A real receipt from the repository's sample session. Open the full receipt

The problem

Your agent just ran two hundred commands. You got a diff and a feeling.

A diff hides the run

A diff shows what ended up on disk. It does not show the files the agent read, the commands it ran or the tests it deleted along the way.

Risk lands before review

By the time you read the log, the force push, the .env read or the rm -rf has already happened.

Nobody can say what it cost

Tokens are spread across models and steps. It is hard to tell which step used the budget, or whether a cheaper model would have done.

How it works

Record. Receipt. Guard. Review.

RunLedger reads the session logs your agent already writes. No wrapper, no proxy, nothing between you and your tools.

Read the session

Point RunLedger at a folder where an agent ran. It finds the newest session and parses every step: tool calls, files, models and token usage.

› runledger receipt --open
reads the agent's own session log
writes runledger-7f3c2a10.html

One page, every fact

Files changed with lines added and removed, each step in plain language, the model and tokens per step, an estimated cost, a risk score from 0 to 100 and a quality grade. Known secret formats are masked.

3 files changed+18 −1
10 steps · 79.7k tokensSonnet 4.5, Haiku 4.5
Quality scoreB · 74/100
Risk score80 high

Stop it before it runs

Native hooks for Claude Code, Codex CLI and Factory Droid check every tool call against the same rules as the receipt. They deny, ask or allow before anything executes.

rm -rf /deny
cat .envask
supabase delete_projectask
npm testallow

Ask for a second opinion

Optionally, --review has Claude mark each finding as confirmed, false positive or uncertain. The rule-based score never changes. In CI, --fail-on 60 fails the job on high scores.

Verdictsopt-in, sends redacted content to Anthropic
confirmedfalse positiveuncertain

Features

Everything a run leaves behind, on one page.

Receipts

Shareable receipts in HTML, Markdown or JSON

Files changed with lines added and removed, every step in plain language, the model and tokens for each step, and the reason behind each risk finding.

Risk

A score from 0 to 100

Each point has a reason a reviewer can check.

Cost

Tokens and estimated cost per step

Estimated from public list prices, with tips on where a cheaper model would do.

Quality

A grade from A to F

Tests run, retries, scope and unfinished work, all listed with their points.

Masking

Secrets masked

Known token formats and key assignments are hidden. Pattern-based, so treat receipts like transcripts.

CI gate

Fail the build on risk

Exit with a non-zero code when the score reaches your threshold.

Team server

A shared dashboard you host

API keys with roles, audit log, approvals, budgets and compliance exports.

Insights

See the trend across runs

Quality over time, model and agent comparison, and the top cost tips in the team dashboard.

Rollback

Checkpoint before, undo after

Save the working tree before an agent edits it. Restore everything, or one file or folder with --path, with a safety checkpoint each time and automatic pruning of old checkpoints.

Stats

Cost, tokens and risk in one command

runledger stats totals sessions, steps, tokens and cost by agent, model, day or project, with the risk and quality spread and the top findings.

Diagnostics

Know when the guard is not working

runledger doctor checks the installed hooks for each agent, the config, the approval server and the price table, and exits 1 or 2 when something is wrong.

Guard

A native guard for every agent

One install command writes the hook for Claude Code, Codex CLI or Factory Droid in that agent's own format. Codex has no prompt, so ask becomes a deny with the reason.

MCP

MCP tools judged by their verb

Model Context Protocol calls are rated by what they do, not by their name: read tools pass, tools that delete, drop or destroy ask first, and SQL passed to a query tool is inspected before it runs.

Rules

Your policy, on top of ours

Around twenty more dangerous commands are known by default, and your own command_rules and tool_rules add to them. A project can only tighten the rules, never loosen them.

Open format

Any agent can write receipts

A documented session format means no adapter is needed to get scores and pushes.

Local first

Nothing leaves your machine

No telemetry and no runtime dependencies. Network calls happen only when you ask for them.

Supported agents

Same receipt, whichever agent ran.

Each adapter turns the agent's own log into common steps, so risk rules and receipts work the same everywhere.

Claude Code stable

--agent claude-code

Reads ~/.claude/projects/. Real-time guard hook, with deny, ask and allow decisions.

Codex CLI beta

--agent codex

Reads rollout files in ~/.codex/sessions/. Real-time guard hook, where ask maps to deny.

Factory Droid beta

--agent droid

Reads transcripts in ~/.factory/sessions/, with model and token usage. Real-time guard hook.

Aider beta

--agent aider

Reads .aider.chat.history.md in your project.

Any agent open format

--agent native

Write a .runledger.json file and get the same receipts. Read the format

Real-time guard

Block the command, not the post-mortem.

The guard installs as a native hook in Claude Code, Codex CLI and Factory Droid. Before each tool call runs, it decides deny, ask or allow. Pick a call to see the default policy at work.

runledger guardPreToolUse hook
tool: Bash
rm -rf /
denycommand · high

Recursive force delete (rm -rf)

The call is blocked. Claude Code is told why and the command never runs.

Install with runledger guard install --agent claude-code|droid|codex|all, remove with runledger guard uninstall, and check what is installed with runledger doctor. If the guard cannot evaluate a call it fails open by default, or closed if you set it. Guard docs

GitHub Action

A receipt on every pull request.

One sticky comment per pull request, updated on every push. Add a threshold and the job fails when a run is too risky.

name: RunLedger receipt
on: pull_request
permissions:
  contents: read
  pull-requests: write
jobs:
  receipt:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: kodji7202-code/runledger@v0.7.0
        with:
          fail-on: "60"  # fail at 60 or above

Commit the sessions you want reviewed to .runledger/sessions/. Review them first: a session file can contain secrets. Action docs

Self-host

A team server you run yourself.

Developers push receipts, the team reads them in one dashboard. The server uses only the Python standard library and a single SQLite file, with a Docker Compose setup for HTTPS.

  • Dashboard
  • API keys with roles
  • Audit log
  • Approvals
  • Slack and webhooks
  • Team budgets
  • Compliance exports
  • Retention and backups

Self-hosting guide

  1. runledger team create myteam --db runledger.dbcreate the team, prints its API key once
  2. runledger serve --db runledger.dbstart the server on 127.0.0.1:8787
  3. open http://127.0.0.1:8787/?key=YOUR_KEYsign in to the dashboard once
  4. export RUNLEDGER_SERVER=http://127.0.0.1:8787on each developer's machine, with RUNLEDGER_API_KEY
  5. runledger push --user "ana@example.com"push the latest run

Open source

Apache-2.0, all the way down.

The CLI, the guard, the Action and the team server are all open source. Read the code, run the tests, send a patch.

Apache-2.0License
0Runtime dependencies
0Telemetry
3.9+Python

FAQ

Questions, answered.

Does my code leave my machine?
Not by default. receipt, list and the guard run locally, and RunLedger has no telemetry. The network is used only when you ask: pushing to your team server, webhooks you set, the GitHub API in the Action, and the Anthropic API when you use --ai or --review.
What is in a receipt?
The first prompts, each step (the first line of a command, file paths, line counts, the model, tokens and estimated cost), the risk findings with reasons, and the files changed. It does not include file contents or command output, only test pass and fail counts.
Are secrets masked?
Known token formats, assignments such as API_KEY=..., --token flags and passwords in URLs are masked in receipts, pushes and PR comments. Masking is pattern-based, so an unusual secret can get through. Treat a receipt like the transcript it came from.
Which agents work?
Claude Code is stable. Codex CLI, Factory Droid and Aider are in beta. Any other agent can write the open RunLedger format and get the same receipts and risk scores. The real-time guard installs as a native hook in Claude Code, Codex CLI and Factory Droid.
What does the guard block?
By default it denies hardcoded secrets written to files and high-severity commands such as rm -rf, force pushes, curl | sh, DROP TABLE, npm publish and kubectl apply. It asks before sudo, reading a .env file, writing outside the project, deleting a test, and MCP tools that delete, drop or destroy. You can change the policy in ~/.runledger/config.json.
Is the AI review required?
No. The risk score comes from deterministic rules. --review and --ai are opt-in and send redacted session content to Anthropic using your own API key.
Are the cost numbers real?
They are estimates from public API list prices for the tokens used, not a bill. Read them as what the run would cost on the API.
Is it open source?
Yes. RunLedger is licensed under Apache-2.0, including the self-hosted team server. No account is needed. --ai and --review are optional and use your own Anthropic API key.
How do I remove it?
Run runledger guard uninstall (add --global for every project) to remove the hook and keep your other Claude Code settings, then pip uninstall runledger-ai.

Start recording

Know what your agent did.

Install, run your agent, then open the receipt. It takes about a minute.

Star on GitHub