agentcov
agentcov tracks which lines in a repository were read by AI coding agents. It
maps AI read counts onto LCOV and textual .gcov reports, and it also writes a
native JSON format with per-line read counts, search hits, commands, and task
metadata.
Install
From this repository:
uv tool install .
From a published package, use the same shape:
uv tool install agentcov
For local development:
uv sync --dev
uv run agentcov --help
Quickstart
Install Codex hooks:
agentcov install-codex-hooks --user
For a repo-local install instead:
agentcov install-codex-hooks --repo
Backfill an existing session:
agentcov backfill --agent auto --session-id <session-id>
agentcov backfill --agent auto --path ~/.codex/sessions/<session>.jsonl
agentcov backfill --agent pi --path ~/.pi/agent/sessions/<encoded-cwd>/<session>.jsonl
Import ranges recorded by another tool:
agentcov import agent-coverage.json
import accepts agent-coverage-style hierarchical JSON, or a plain array of
{"cmd": "...", "ranges": ["src/app.ts:1:20"]} entries.
Generate reports:
agentcov report --format lcov --counts full --out agentcov.info
agentcov report --format gcov --counts binary --out-dir coverage-gcov
agentcov html --out agentcov.html
agentcov summary
agentcov unread --limit 20
Render LCOV with standard tooling:
genhtml agentcov.info --output-directory coverage-html
What It Captures
- Codex hook payloads from
Bash,apply_patch, and MCP tools. - Codex, Claude Code, and Pi transcript backfill from session id or JSONL path.
Pi child sessions linked by
parentSessionare included when backfilling a Pi session path. - Common shell reads:
sed,head,tail,cat,awk, andnl|sed. rgandgrepoutput assearch_seen, separate from direct reads. Match lines and context lines are counted separately in the native JSON and HTML.- Git-tracked text files that were never read, so untouched files show up with zero coverage.
Unsupported read-like shell shapes are recorded as unknown events rather than being guessed as full-file reads.
Outputs
.agentcov/events.jsonl: append-only observed read events..agentcov/coverage.json: native per-file and per-line coverage data.agentcov.info: LCOV tracefile compatible withgenhtml.coverage-gcov/*.gcov: textual gcov-style files.agentcov.html: self-contained heatmap report.
--counts full writes observed read counts into LCOV/gcov output. --counts binary writes 1 for read lines and 0 for unread lines.
The native JSON and HTML include compact attribution for read lines and ranges: agent, session id, source, tool name, command, task path, timestamp, and confidence when available. Unknown events are also surfaced so unsupported commands can be audited instead of silently disappearing.
Configuration
Create .agentcov.toml at the repo root when defaults need adjustment:
storage_dir = ".agentcov"
exclude = [".agentcov/", "node_modules/", "vendor/", "dist/", "build/", ".git/"]
include_lockfiles = true
auto_reports = ["json"]
auto_reports controls extra reports written on Codex Stop. JSON coverage is
always refreshed; add lcov, gcov, or html to write shareable reports under
.agentcov/reports/.
Recommended local ignore rules:
.agentcov/
Commit or archive .agentcov/coverage.json, LCOV, gcov, or HTML outputs only when
you want a durable audit artifact.
Privacy
By default, agentcov stores commands, paths, line ranges, timestamps, session and
tool ids, agent names, and task attribution. Backfilled transcripts may include
the agent's prompt or task label in task_path so reports can explain why a
line was inspected. It does not store raw tool output or source snippets in the
event log.
The native coverage JSON and HTML report include attribution from the event log. The HTML report also embeds source lines because it is a source viewer; share those files with the same care as the repository and transcript metadata.
Roadmap
Not shipped yet:
- Richer HTML views: task and subagent filtering, a recency mode, and a directory treemap.
- Optional user-level storage, so coverage history can span repositories.
- Transcript backfill for agents beyond Codex, Claude Code, and Pi.
- Opt-in range repair for command shapes that are currently recorded as unknown, with inferred ranges marked as lower confidence.
Development
make dev # install the dev dependency group
make test # pytest
make lint # ruff format --check, ruff check, ty check
make format # ruff format and ruff check --fix
make check # lint and test
See AGENTS.md for the module layout, contribution notes, and the release process.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentcov-0.1.0.tar.gz.
File metadata
- Download URL: agentcov-0.1.0.tar.gz
- Upload date:
- Size: 40.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eea1087446e435316a70e6b2df1bce8a08a83442fce2f423f9165deb1026e7ec
|
|
| MD5 |
118ac1c28ae7fc037960302b9512f171
|
|
| BLAKE2b-256 |
49862f0b8e89bd372569389bf11f9dcac4e3f764d60d30c9b82a32f56cc2deb0
|
Provenance
The following attestation bundles were made for agentcov-0.1.0.tar.gz:
Publisher:
release.yml on trailofbits/agentcov
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentcov-0.1.0.tar.gz -
Subject digest:
eea1087446e435316a70e6b2df1bce8a08a83442fce2f423f9165deb1026e7ec - Sigstore transparency entry: 2365105497
- Sigstore integration time:
-
Permalink:
trailofbits/agentcov@f566c6edb8933e0acf4ff0f85624f86ae09be2f3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/trailofbits
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f566c6edb8933e0acf4ff0f85624f86ae09be2f3 -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file agentcov-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agentcov-0.1.0-py3-none-any.whl
- Upload date:
- Size: 48.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb1d2c2076e96d99073bd919f858d72d43ab477973cce16ff0881b0b11889a21
|
|
| MD5 |
f09e3240b895e36a0c06f859d0c449ef
|
|
| BLAKE2b-256 |
ffb8309931e461d0db6a97c07c923ce0f5a2d3e3665feaad0f10fd35bcfd1d33
|
Provenance
The following attestation bundles were made for agentcov-0.1.0-py3-none-any.whl:
Publisher:
release.yml on trailofbits/agentcov
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentcov-0.1.0-py3-none-any.whl -
Subject digest:
bb1d2c2076e96d99073bd919f858d72d43ab477973cce16ff0881b0b11889a21 - Sigstore transparency entry: 2365105580
- Sigstore integration time:
-
Permalink:
trailofbits/agentcov@f566c6edb8933e0acf4ff0f85624f86ae09be2f3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/trailofbits
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f566c6edb8933e0acf4ff0f85624f86ae09be2f3 -
Trigger Event:
pull_request
-
Statement type: