--- name: agent-strace description: Trace and investigate Claude Code, GitHub Copilot CLI, or OpenAI Codex sessions with agent-strace. Use when the user wants to capture an agent session, replay activity, explain a decision, diagnose repeated tool calls or failures, inspect cost, audit a recorded session, or check or review an agent's pull request before opening it. --- # agent-strace Use the local `agent-strace` executable. The plugin contributes lifecycle hooks, but the Python package must also be installed and available on `PATH`. ## Prerequisite check Run `agent-strace --version`. If it is unavailable, stop and provide one of: ```bash uv tool install agent-strace pip install agent-strace ``` Do not silently substitute another tracing tool. ## Capture Installed plugin hooks automatically record new Claude Code, Copilot CLI, or Codex sessions to `.agent-traces/`. Codex runs plugin hooks only after the user reviews and trusts them in `/hooks`, and again after each plugin update; until then it records nothing. Do not also install provider-specific manual hooks with a different redaction mode because both handlers can run. With the Codex plugin, do not run `agent-strace setup --cli codex` at all: Codex runs the same command from both sources, so every event would be recorded twice. ## Investigate Choose the smallest command set that answers the request: ```bash agent-strace list agent-strace inspect agent-strace replay agent-strace explain agent-strace timeline agent-strace why agent-strace lint agent-strace audit agent-strace cost agent-strace diff agent-strace compare ``` Resolve an omitted session ID with `agent-strace list`. Prefer text output for interactive analysis and JSON only when structured processing is necessary. Report exact session IDs and event numbers for material findings. ## Before you open a PR Check what the sessions linked to this branch did and did not prove, and put the result in the PR body: ```bash agent-strace review --format markdown ``` It reports rationale, scope, validation, stewardship, and evidence health from captured evidence only: validation counts checks run inside the session, not CI results, and no LLM writes or judges any of it. Paste the output as printed. If a finding is `missing` or `partial`, fix the gap or say why in the PR. If CI runs the agent-trace Action with `review`, publish the findings for it after the last commit, and push the note when you push the branch: ```bash agent-strace review --publish-note git push origin refs/notes/agent-strace ``` The trace directory stays local. The note holds the findings, session IDs and event hashes, not prompts or tool content. CI shows its findings as reported by your machine. Before handing evidence to a reviewer, preview what the packet would include, then write it: ```bash agent-strace share --dry-run agent-strace share ``` `share` uses the latest session; pass an ID from a `Session:` line of `agent-strace review` to pick another. The packet is written to `session-.html` and omits prompts, responses, commands, paths, and tool values. Do not commit it. Never paste raw prompts or tool output into the PR. ## Safety - Treat trace storage as read-only unless the user requests retention, import, anonymization, or another mutating operation. - Preserve secret redaction. - Do not claim causal intent from proximity alone; use `why` or clearly label the conclusion as an inference.