You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`strace` for AI agents. Capture and replay every tool call, prompt, and response from Claude Code, Cursor, or any MCP client.
9
+
`strace` for AI agents. Capture and replay every tool call, prompt, and response from Claude Code, Cursor, or any MCP client — then analyse, diff, audit, and share what happened.
10
10
11
11

12
12
@@ -115,6 +115,7 @@ agent-strace hook <event> Handle a Claude Code hook event
115
115
agent-strace record -- <command> Record an MCP stdio server session
116
116
agent-strace record-http <url> [--port N] Record an MCP HTTP/SSE server session
117
117
agent-strace replay [session-id] Replay a session (default: latest)
118
+
agent-strace replay --format html [-o file] Export a self-contained HTML replay viewer
118
119
agent-strace replay --expand-subagents Inline subagent sessions under parent tool_call
119
120
agent-strace replay --tree Show session hierarchy without full replay
120
121
agent-strace list List all sessions
@@ -126,15 +127,23 @@ agent-strace export <session-id> Export as JSON, CSV, NDJSON, or
126
127
agent-strace import <session.jsonl> Import a Claude Code JSONL session log
127
128
agent-strace cost [session-id] Estimate token cost for a session
128
129
agent-strace diff <session-a> <session-b> Compare two sessions structurally
130
+
agent-strace diff --compare <a> <b> Side-by-side table with verdict
129
131
agent-strace diff --semantic <a> <b> Compare sessions by outcome, not event order
130
132
agent-strace why [session-id] <event-number> Trace the causal chain for an event
131
133
agent-strace audit [session-id] [--policy] Check tool calls against a policy file
134
+
agent-strace audit-tools [--repo .] [--approved] Scan a repo for shadow AI tool usage
132
135
agent-strace policy [--output file] Generate .agent-scope.json from observed traces
133
136
agent-strace dashboard [--last N] [--html file] Aggregate stats and trends across sessions
134
137
agent-strace annotate <session-id> <offset> Add notes, labels, or bookmarks to events
135
138
agent-strace token-budget <session-id> Check token usage against model context limit
136
-
agent-strace watch [--max-context-pct N] Watch a live session with per-operation limits
139
+
agent-strace watch [--rules file] Watch a live session; kill/pause on rule breach
137
140
agent-strace share <session-id> [-o file] Export a self-contained HTML report
141
+
agent-strace standup [--session id] Standup report from session trace (no LLM)
142
+
agent-strace freshness [--scope glob] Context freshness check vs last session
143
+
agent-strace oncall --rotation-start DATE On-call readiness for agent-modified files
144
+
agent-strace curve [--export csv] Personal agent cost-efficiency curve
145
+
agent-strace inflation [--compare m1,m2] Token inflation calculator across model versions
`--compare` produces a structured table across cost, duration, tool calls, redundant reads, context resets, files modified, and errors — with a deterministic verdict requiring no LLM.
684
+
685
+
```bash
686
+
agent-strace diff SESSION_A SESSION_B --compare
687
+
```
688
+
689
+
New metrics: **redundant reads** (files read more than once), **context resets** (LLM requests separated by >120s), **approach divergence** (first phase pairs where behaviour differs). Useful for asserting on in CI.
690
+
691
+
### Kill switch for runaway sessions
692
+
693
+
Add a declarative rules file to `agent-strace watch` to pause, kill, or alert when a session crosses a threshold.
694
+
695
+
```bash
696
+
agent-strace watch --rules .watch-rules.json
697
+
agent-strace watch --rules .watch-rules.json --dry-run # evaluate without acting
-`pause` — SIGSTOP the agent process (resume with SIGCONT)
704
+
-`kill` — SIGTERM, then SIGKILL after 5s; auto-generates a postmortem
705
+
-`alert` — log only, no interruption
706
+
707
+
### Shadow AI detection
708
+
709
+
Scan a repository for AI tool usage signatures — no network calls, no API keys.
710
+
711
+
```bash
712
+
agent-strace audit-tools
713
+
agent-strace audit-tools --repo . --since "90 days ago" --approved cursor,copilot
714
+
```
715
+
716
+
Detected tools: Claude Code, Cursor, GitHub Copilot, Codex/ChatGPT, Windsurf, Aider — identified via file signals (`.cursorrules`, `CLAUDE.md`, `.github/copilot-instructions.md`, etc.) and commit message patterns. Flags unapproved tools, unknown LLM API endpoints in `.env` history, and PII patterns in recently committed files.
717
+
718
+
### HTML session replay viewer
719
+
720
+
Generate a single-file HTML viewer for any session. No server, no dependencies — open in any browser.
721
+
722
+
```bash
723
+
agent-strace replay --format html
724
+
agent-strace replay --format html --output review.html SESSION_ID
725
+
```
726
+
727
+
The viewer includes an animated event timeline, scrubber bar, running cost counter, click-to-expand event detail, color-coded event types, and dark theme. All event data is embedded as a JSON constant — useful for attaching to PR reviews.
728
+
729
+
### Standup report
730
+
731
+
Generate a structured standup from a session trace — no LLM call required.
732
+
733
+
```bash
734
+
agent-strace standup
735
+
agent-strace standup --session SESSION_ID
736
+
```
737
+
738
+
Report covers: files read and modified, approaches tried (including abandoned ones detected from retry patterns), new dependencies added, TODO/FIXME comments written, large changes and auth/migration patterns to review, and session stats (tool calls, retries, errors).
739
+
740
+
### Context freshness check
741
+
742
+
Before handing a task to an agent, check how stale its last view of the codebase is.
Reports files changed since the last session, per-file change type and line count, a freshness score 0–100, and estimated catch-up reading time. Scope is auto-detected from `CLAUDE.md` / `AGENTS.md`, or overridden with `--scope`.
750
+
751
+
### On-call readiness
752
+
753
+
Cross-reference agent-modified files against git history to surface cognitive gaps before a rotation.
For each file the agent has written in the last N days: how long ago it was modified, lines changed, estimated reading time, and total catch-up time before rotation.
761
+
762
+
### Cost-efficiency curve
763
+
764
+
Analyse stored session history to see which task types are worth delegating to an agent.
765
+
766
+
```bash
767
+
agent-strace curve
768
+
agent-strace curve --min-sessions 10 --export csv
769
+
```
770
+
771
+
Sessions are classified into 10 task types (unit tests, debugging, refactoring, architecture, etc.) and compared against a community sweet-spot benchmark. Verdict per type: **efficient / over sweet spot / do this yourself**. Potential monthly savings are calculated for types running above 1.5× their sweet spot.
772
+
773
+
### Token inflation calculator
774
+
775
+
Measure the tokenizer cost impact of switching model versions before committing to an upgrade — no API calls required.
Applies per-model inflation factors to stored session content and breaks down the impact by content type (system prompt, tool definitions, user messages, assistant messages). Projects per-session, daily, and monthly cost delta.
783
+
784
+
| Model | Factor |
785
+
|---|---|
786
+
| claude-opus-4-7 | 1.38× (community median: 1.3–1.47×, April 2026) |
787
+
| gpt-4o | 1.05× (cl100k_base → o200k_base) |
788
+
789
+
### A2A protocol support
790
+
791
+
First-class support for agent-to-agent calls following the Google A2A spec. A2A calls are captured as `TOOL_CALL` events with `event_subtype=a2a_call` — backward-compatible with all existing replay and export tooling.
792
+
793
+
```bash
794
+
agent-strace a2a-tree
795
+
agent-strace a2a-tree SESSION_ID --format json
796
+
```
797
+
798
+
Builds the full agent call graph by following `sub_session_id` links and `parent_session_id` back-references. Renders as an ASCII tree or exports as OTLP-compatible spans for Jaeger, Tempo, or any OpenTelemetry backend.
799
+
672
800
## Production tracing (OTLP export)
673
801
674
802
Export sessions as OpenTelemetry spans to your existing observability stack. Sessions become traces. Tool calls become spans with duration and inputs. Errors get exception events. Zero new dependencies.
0 commit comments