Skip to main content
aspex trace reads the native log files that Claude Code, Claude Desktop, Cursor, Windsurf, Cline, and Roo write to disk, normalizes every MCP tool call into one event stream, and runs 85+ detection rules over it. Nothing sits in the request path, nothing changes in your config, and it works on last month’s sessions as well as today’s.

Flags

Commands

Every command accepts --since, --client, and --no-color; session, killchain, provenance, and export also accept --json.

Kill chains

A single suspicious call is a hint. A sequence is evidence. killchain correlates events into known attack patterns and reports each chain with its MITRE ATT&CK reference.
Every chain is confined to one agent session (Claude Code’s session id, or a 30-minute idle gap for clients that record none), so a file read in one conversation and an outbound call in another are never joined. Each chain reports its evidence in three labels, so a fact is never dressed up as a conclusion:
  • OBSERVED - the event is in the log. filesystem.read_file read ~/.aws/credentials at 14:23.
  • INFERRED - a relationship drawn from order and timing. “These calls are 30s apart in the same session; the ordering matches the pattern, but the log does not prove one caused the other.”
  • POSSIBLE - what the composition would allow, and what the log cannot show. “The file’s contents could have left in the outbound call; payloads are not captured, so exfiltration is not proven.”
--json adds evidence (level + text) and same_session to each chain.

Provenance

When something bad happened, the next question is what made the agent do that? provenance links each HIGH or CRITICAL finding backward to the ingestion event most likely to have carried the instruction: a file read, a URL fetch, a resource load.

Sessions

Behavioral baseline

Learn what your agents normally do, then get told only about what changed: new tools called for the first time, new outbound hosts, new file path prefixes, unusual hours, oversized arguments.
The default baseline path is ~/.config/aspex/aspex trace-baseline.json.

Live monitoring

Polls the log files (default every 5 seconds) and prints new findings. --notify posts HIGH and CRITICAL findings to a Slack or generic JSON webhook.

Export for your SIEM

--format is jsonl (default) or csv; without --output it writes to stdout.

CI

Exit code 1 means a finding at or above the threshold. See the CI guide.

What it detects (85+ rules)

The full list with rule IDs is in the rules reference.

Which clients

Detection depth depends on how much each client logs. Claude Code and Claude Desktop log full tool calls with arguments, which enables every rule; some clients log less.

Reproduction bundles

Package a suspicious investigation so someone else can analyze it offline, safely:
A bundle holds the redacted trace events, the environment model, and the findings, kill chains and provenance at export time. Secret-shaped values (tokens, keys, Authorization headers, PEM blocks) are removed with their prefix kept, content bodies are dropped, and credential-file contents never leave; the environment model carries no secret values by construction. Review events.json before sharing.
Replay re-runs Aspex’s analysis over the bundle and reports whether current rules still agree. It is an analysis replay: no recorded tool, command or network call is ever executed. Bundles are read with fixed file names only; symlinks, path traversal and oversized files are refused. Turn a bundle into a regression test: aspex-scan corpus import ./repro writes a scenario skeleton (with your home directory anonymized) for the corpus.