The verifier for coding agents. Your agent ships features. CodeCop finds optimizations.
CodeCop reads a repository, finds the code that talks to a database or does other costly work, and asks one question of each place: is there a cheaper way that gives the same result? It does not take a guess for an answer:
- it finds every database call (and regular expressions, transactions, outbound calls) in the source;
- it ranks them by how much they cost, from the code or from a read-only pull of production's own statistics;
- it lets an agent propose a change, then builds a sandbox database (PostgreSQL, ClickHouse or SQLite) and measures the change against the original on the same data;
- it reports a change as a fix only when the sandbox shows the same rows and less work, and says why when it cannot.
pipx install codecop
codecop scan .Sandboxes need Docker or Podman. pip install 'codecop[postgres]' adds the driver for reading statistics from a real
PostgreSQL. The report is report.html in the out dir (.codecop/ by default).
- Query rewrites: the same result with fewer rows or bytes read.
- Indexes and table layout: indexes, sorting keys, projections and partitions, with the cost on the insert side.
- Writes: inserts, updates and deletes benchmarked like reads.
- Queries in loops: one statement per item where one batched statement would do.
- Transactions and locks: contention, lost updates, deadlocks.
- Regular expressions: patterns that backtrack on hostile or long input.
- Outbound calls: a client made per call, blocking calls in async code, calls with no timeout.
Each finding ends in one of four states: Fixed, Needs another fix, Could not be judged, Nothing to gain.
codecop scan . # the whole repository
codecop scan . --changed-since main # what a branch changes
codecop mcp --print-config # evidence for the agent over MCP (Claude Code, Cursor, any MCP client)
codecop ci compare . --base-branch main # new and worse findings against the base branch, for CIcodecop mcp is a local, read-only MCP server over the last scan: what production runs most, what a change measured
in the sandbox, what a table holds. See docs/mcp.md. For GitHub Actions, see
docs/ci-github-actions.md.
| Path | What |
|---|---|
cli/ |
the codecop command (PyPI: codecop) |
runner/ |
codecop-runner, the self-hosted runner: docs/hosted-runner.md |
.github/actions/codecop-scan |
the GitHub Action; an example workflow is in examples/github-actions |
docs/ |
kinds of finding, query tags, MCP, CI, the runner |
schemas/ |
the run bundle, run events and runner job documents |
The console at https://app.codecop.dev (team view, history, pull-request comments, the queue the runner takes jobs from) is a hosted service and is not in this repository. The CLI works without it.
- Home: https://codecop.dev
- Showcase, scans of public repositories: https://app.codecop.dev/showcase
MIT. See LICENSE.