# agent-trace
[](https://pypi.org/project/agent-strace/)
[](https://pypi.org/project/agent-strace/)
[](https://github.com/Siddhant-K-code/agent-trace/actions/workflows/test.yml)
[](https://github.com/marketplace/actions/agent-trace-eval)
[](https://open-vsx.org/extension/Siddhant-K-code/agent-strace)
[](https://marketplace.visualstudio.com/items?itemName=Siddhant-K-code.agent-strace)
[](LICENSE)
[](https://pepy.tech/projects/agent-strace)
[](https://siddhant-k-code.github.io/agent-trace/)
**Before you merge an agent's pull request, see what its session did and did not prove.**
Used by Meta, ByteDance, Zama.ai & more
`agent-strace` records a coding agent's session as local files, then reads that recording for the pull request.
- [`review`](docs/review.md) posts findings on the pull request.
- [`share`](docs/commands.md#share) writes a privacy-minimized evidence packet for the reviewer.
- [`cognitive-debt`](docs/cognitive-debt.md) shows how much agent-written code merged without review.
`agent-strace` is not the [Agent Trace](https://agent-trace.dev/) spec from Cursor and Cognition, but `review` and `cognitive-debt` [read its records and git-ai notes](docs/git-ai-and-agent-trace.md).
[Entire](https://github.com/entireio/cli) records agent sessions and can review them with LLM agents. agent-strace grades what a session proved, with no model, and can [read Entire checkpoints](docs/review.md#review-prs-from-entire-users).
> [!WARNING]
> Experimental. Do not treat it as a production security boundary without your own threat model, controls, and testing.
## Quick start
```bash
uv tool install agent-strace
agent-strace setup --cli copilot # or claude, codex, gemini, cursor
```
Restart the agent and do one task on a branch. Then:
```bash
agent-strace replay # the latest session, in order
agent-strace health # what the capture recorded and what it missed
agent-strace review # findings for this branch
```
For Claude Code, `setup` prints the hooks to merge into `~/.claude/settings.json`. A [plugin](#agents) installs the hooks instead: use one or the other, not both.
New here? [Get started](https://siddhant-k-code.github.io/agent-trace/get-started/) covers uv, pipx and pip installs and each agent's setup.
Or let your coding agent install it
Paste this into Claude Code, Copilot CLI, Codex, Gemini CLI, or Cursor; it lists the commands before running them:
```text
Set up agent-strace (https://github.com/Siddhant-K-code/agent-trace) to record this coding agent's sessions as local traces. First, say which agent you are and list the commands you'll run. Never use sudo or hand-edit config files; if a step fails, stop and show me the error. 1. Install or upgrade the CLI: `uv tool install --upgrade agent-strace` (no uv: use pipx). If `agent-strace --version` fails, run `uv tool update-shell` (or `pipx ensurepath`), since the hooks call it from PATH. 2. Connect only this agent's capture path: Claude Code: `claude plugin marketplace add Siddhant-K-code/agent-trace`, then `claude plugin install agent-strace@agent-trace`. Copilot CLI: `copilot plugin marketplace add Siddhant-K-code/agent-trace`, then `copilot plugin install agent-strace@agent-trace`. Codex: `codex plugin marketplace add Siddhant-K-code/agent-trace`, then `codex plugin add agent-strace@agent-trace`. Gemini CLI: `agent-strace setup --cli gemini`. Cursor: `agent-strace setup --cli cursor`. Other agents: stop and point me to the agent-trace docs/setup.md guide. 3. Tell me to restart this agent from a new terminal (in Codex, trust the agent-strace hooks in /hooks), do one task, then run `agent-strace replay` and `agent-strace health`. Traces stay local in .agent-traces/; `agent-strace telemetry disable` turns off anonymous telemetry.
```
See it on a real session
## On the pull request
The GitHub Action posts this comment (from a [demo pull request](https://github.com/Siddhant-K-code/agent-trace-demo/pull/1)) and uploads the evidence packet as an artifact. It reads `.agent-traces/`, so the branch has to carry the traces.
```yaml
on: pull_request
permissions:
contents: read
pull-requests: write
jobs:
reviewability:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: Siddhant-K-code/agent-trace@v0.132.0
with:
review-commits: origin/${{ github.base_ref }}..HEAD
```
With the defaults, the Action reviews on every run and comments on `pull_request` events. A comment it cannot post is a warning, not a failure.
On GitLab, Azure Pipelines, Bitbucket Pipelines or Jenkins, `agent-strace review --junit FILE` writes the findings as a JUnit test report, and the job's exit code gates the merge. `--change-record FILE` also writes a JSON record of the change for change-management evidence. On GitLab, the [`agent-review` CI/CD component](docs/review.md#gitlab-component) adds the job. See [gate merges on any forge](docs/review.md#gate-merges-on-any-forge).
No CI? Paste `agent-strace review --format markdown` into the pull request body. That is the author's own claim, so the Action is the stronger path. See the [pull request evidence workflow](docs/ai-agent-pr-evidence.md) and the [Action reference](docs/review.md#github-action).
## What review checks
With no linked session, every finding is `inconclusive` at `low` confidence. By default the check fails only on `missing` at `medium` confidence or higher ([threshold](docs/review.md#threshold)). A session picked by commit time, or as the latest one, is a [weak link](docs/review.md#how-sessions-are-linked). [How to read the findings](docs/review.md#findings). It can also compare the AI assistance a pull request [declares](docs/review.md#disclosure) with that evidence.
## Share and team view
```bash
agent-strace share --dry-run # what it would disclose; writes nothing
agent-strace share # writes session-.html
agent-strace cognitive-debt --since 30d --by repository
```
The packet leaves out prompts, responses, commands, paths, and tool values unless you pass `--include-content`. Do not commit it. See the [disclosure preview](docs/share-disclosure-preview.md).
`cognitive-debt` keeps reviewed, unreviewed, and unknown lines apart; unknown never counts as reviewed. It is a workflow metric, not a code quality score. See [cognitive debt](docs/cognitive-debt.md), and the Action's [weekly team view](docs/cognitive-debt.md#team-view-in-ci).
## Agents
| Agent | What its hooks record |
|---|---|
| Claude Code | Prompts, the final response, tool calls, failed tools. No model or tokens. |
| OpenAI Codex | Prompts, responses, tool calls; tokens from 0.164.0. A failed shell command is a result. |
| GitHub Copilot CLI | Prompts and tool calls. No response text, model, or tokens. |
| Copilot cloud agent | Partial and unverified, only through a [collector](docs/copilot-cloud-agent.md). |
| OpenCode | A [plugin](docs/setup.md#opencode): prompts, tool calls, final replies, subagents. Unverified. |
| Gemini CLI, Cursor | Hooks via [setup](docs/setup.md); not in the capture matrix yet. |
Details: [capture matrix](docs/capture-matrix.md). Plugins install the hooks plus a skill that runs `review` before a pull request opens:
```bash
claude plugin marketplace add Siddhant-K-code/agent-trace && claude plugin install agent-strace@agent-trace
copilot plugin marketplace add Siddhant-K-code/agent-trace && copilot plugin install agent-strace@agent-trace
codex plugin marketplace add Siddhant-K-code/agent-trace && codex plugin add agent-strace@agent-trace
```
In Codex, trust the hooks in `/hooks`. Guides: [Claude Code](docs/claude-code-plugin.md) · [Copilot CLI](docs/copilot-plugin.md) · [Codex](docs/codex-plugin.md). Also: an [MCP server](docs/mcp.md) (`agent-strace mcp`), a [VS Code extension](docs/vscode.md), [machine-wide installs](docs/platform-install.md), and a Python library for your own agent:
```python
from agent_trace import trace_tool, start_session, end_session
```
## Privacy and telemetry
Traces stay local in `.agent-traces/`, with secret redaction on by default ([security](docs/security.md)). Anonymous CLI telemetry is on after a [one-time notice](docs/telemetry.md#when-sending-starts) and off in CI and test environments. It never sends prompts, arguments, paths, repository data, or trace contents. Turn it off with `agent-strace telemetry disable` or `DO_NOT_TRACK=1`.
## Labs
`agent-strace --help` shows the core commands. Experimental and specialist ones are in [labs](docs/labs.md) (`agent-strace labs`), including [OpenTelemetry export](docs/production.md), the [collector server](docs/server.md), [auto-instrumentation](docs/integrations.md), `eval` gates, and `watch`. The Action runs `eval` only when `.agent-evals.yaml` exists, or with `run-eval: "true"`.
## Docs
Read the docs at **[siddhant-k-code.github.io/agent-trace](https://siddhant-k-code.github.io/agent-trace/)**, or browse them in [`docs/`](docs/index.md).
[Get started](docs/get-started.md) · [Review](docs/review.md) · [Command reference](docs/commands.md) · [Setup](docs/setup.md) · [Capture matrix](docs/capture-matrix.md) · [Action inputs](action.yml)
Run the tests with `python -m unittest discover -s tests -v`.
## License
MIT. Use it however you want.
---
[Sponsor](https://github.com/sponsors/Siddhant-K-code) · [ADRs](ADRs/) · [Security](SECURITY.md) · [Contributing](CONTRIBUTING.md) · [Share your use case](docs/index.md#share-your-use-case) · [Release guide](docs/releases.md) · [PyPI](https://pypi.org/project/agent-strace/)