Skip to main content

Bug Ledger

Bug Ledger

Never fix the same bug twice.
A local MCP server that gives AI coding agents a permanent memory of the bugs you already fixed.

PyPI Python CI License

What it does

Your agent fixes a bug. You confirm the record. From then on, every session on that project checks the ledger before writing code in that area and can search it while debugging.

  • Before coding, the agent calls get_patterns and sees the past bugs for that feature area.
  • While debugging, it calls search_bugs with the error text.
  • After a fix, you run /logbug. The agent drafts the record, you approve, it is stored.

Everything stays on your machine: one SQLite file in ~/.bugledger/. No account, no cloud, no telemetry.

Install

Requires uv. It downloads Python if needed.

Claude Code

claude mcp add bugledger -- uvx bugledger-mcp

Cursor, in .cursor/mcp.json:

{ "mcpServers": { "bugledger": { "command": "uvx", "args": ["bugledger-mcp"] } } }

Any other MCP client: command uvx, argument bugledger-mcp, transport stdio.

Whole team: commit that JSON as .mcp.json (Claude Code) or .cursor/mcp.json (Cursor) in the repo. Everyone who opens the project gets the server.

Restart the client. /mcp lists bugledger as connected and /mcp__bugledger__logbug is available.

Use

  1. Fix a bug as usual.
  2. Run /mcp__bugledger__logbug. The agent checks that the session really contained a bug fix, drafts the symptom, root cause, feature area, and stack, shows you the draft, and stores it only after you say yes. Feature work and refactors are refused.
  3. Keep working. On connect, the server tells the agent to call get_patterns before coding and search_bugs while debugging. Nothing else to set up.

To make the check a hard rule, add one line to CLAUDE.md or .cursorrules:

Before implementing anything in a feature area, call bugledger get_patterns with that area and this project's name, and account for every returned bug. After fixing a bug, run /mcp__bugledger__logbug.

Tools

Tool Purpose
get_patterns(feature_area, project) Past bugs for an area, one line each, capped at 30 lines
search_bugs(query) Full-text search over symptoms and root causes; paste the error as is
record_bug(...) Store a confirmed bug with its root cause and fix diff
list_areas() Existing feature areas and projects, so names stay consistent
update_bug / delete_bug Correct or remove a record
resolve_bug(id, project) Hide a bug from get_patterns for one project once a guardrail covers it
get_guardrails(stack) Starter Semgrep rules and the CI workflow that installs them

Guardrails

get_guardrails returns hand-written Semgrep rules for the classic mistakes agents make: SQL and shell injection, hardcoded secrets, unsafe deserialization, eval, open CORS, debug mode, insecure random, plain HTTP. The agent writes them to .bugledger/ in your repo and adds one workflow file. Existing CI files are never touched. ERROR rules block the pull request, WARNING rules only report. Delete a rule file to drop it.

Data and privacy

  • The ledger is ~/.bugledger/ledger.db. Set BUGLEDGER_HOME to move it. Delete it any time; it is recreated on next start.
  • record_bug runs git show <commit> locally to store the fix diff. Diffs are never returned by get_patterns and never leave your machine.
  • The server makes no network calls.

Contributing

Bug reports, new rules, and pull requests are welcome. Setup, tests, and the release process are in CONTRIBUTING.md.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bugledger_mcp-0.1.1.tar.gz (32.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bugledger_mcp-0.1.1-py3-none-any.whl (45.1 kB view details)

Uploaded Python 3

File details

Details for the file bugledger_mcp-0.1.1.tar.gz.

File metadata

  • Download URL: bugledger_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 32.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for bugledger_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0c3bff81777057dd7a787338ccbff389c6d056eac7c44db2906398cea70cc08c
MD5 fbf72bdbdd6aeeed068730f3a408739c
BLAKE2b-256 296fd6609543e3eb6197023a02a4a2b064047980c44d34647dd30b1426c9c36b

See more details on using hashes here.

File details

Details for the file bugledger_mcp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bugledger_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 45.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for bugledger_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8d54351c05baa312553513c4f5e739bf293bc0457e1a2166155afb4037fddcf6
MD5 226f7066c1cf393e061be0c9ed2ccac7
BLAKE2b-256 6737d6380a1c9b37be516b102160d39241aac70913c6e448f54beada1aa91422

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page