Sensorium
Query recorded Sensorium execution traces over MCP to answer debugging questions without live stepping.
List recorded runs with IDs, exit status, event counts, commands, and rerun verdicts.
Summarize a trace’s recorder, language, capabilities, focus, redaction, and what was or was not recorded.
Inspect call-tree slices and individual frames, including arguments, returns/raises, and focused per-line locals.
Search events by name or rendered value, filtered by run, function, event kind, or resume point.
Analyze exceptions and classify raises as swallowed, uncaught, re-raised, propagated, or ambiguous with reasons.
Map failed tests to the frame and recorded assertion, panic, or crash.
Trace provenance of literal values or object identities through captured args, locals, and returns.
Evaluate watch predicates at focused recording sites, refusing when no site can be checked.
Diff two runs to find the first causal divergence or return MATCH/DIVERGED/REFUSED.
All tools shown are read-only and refuse by name when the trace lacks the required data or capability.
Records Python program execution with PEP 669/sys.monitoring, capturing calls, returns, exceptions, and optional line-level local-variable state for later debugging queries.
Records Rust workspace crates at build time via cargo sensorium, writing one trace per process for call-tree, exception, flow, and diff analysis.
Records TypeScript source execution at load time for Vitest or Node test runs, writing one trace per test-file process for debugging queries.
sensorium
Record one run of your program, then let a coding agent ask what actually happened: call trees, exceptions, and where a value came from, answered from the trace or refused.
A failing checkout, three queries, no edits. item_weight returned 1800 grams and shipping_cost took that number as weight_kg.
$ sensorium run -- pytest examples/test_shipping.py -q
F [100%]
E AssertionError: assert 5569.0 == 74.5
run: 20261116-104837-c926b7
$ sensorium exceptions last
raised (1):
e30 RAISE test_order_total_for_a_mug_and_kettle raise AssertionError("assert 5569.0 == 74.5\n + where 5569.0 = order_total([{'name': 'mug', 'price': 12.0, 'grams': 400}, {'name': 'kettle', 'price': 49.0, 'grams': 1800}])") L10
propagated (handler not in traced code)
$ sensorium flow last --value 1800
e22 CALL item_weight(item=dict[3]={'name': 'kettle', 'price': 49.0, 'grams': 1800}) [arg item.grams]
e23 RETURN item_weight -> 1800 [return]
e24 CALL shipping_cost(weight_kg=1800) [arg weight_kg]
sightings: 6 event(s), 6 capture(s)
$ sensorium refocus last --focus examples.shipping:shipping_cost --compact
refocus verdict: MATCH -- every recorded thread produced the identical CALL/RETURN/RAISE/HANDLED sequenceFrom a clone, with sensorium and pytest on PATH:
sensorium run -- pytest examples/test_shipping.py -qEvent ids move when the program does; last is the newest trace. The bug lives in examples/shipping.py.
What Sensorium is
Sensorium records one run (every call, return, and exception, with captured values) into a SQLite trace, and answers debugging questions from that trace in plain text. Four recorders write trace format 4. One command line, sensorium, reads all four.
Python:
sensorium run -- <command>uses PEP 669 (sys.monitoring). Python 3.12+, no runtime dependencies. A Python child (subprocess,multiprocessing, pytest-xdist) is recorded into that same run.--no-childrenorSENSORIUM_NO_CHILDREN=1records the parent only. A non-Python child is counted and not traced.Rust:
cargo sensorium testorcargo sensorium run. Stable rustc, Linux. rust/README.md.TypeScript:
sensorium ts run [--focus <spec>]… -- vitest run …or-- node --test …. Node 24, vitest 4.1. typescript/README.md.C:
sensorium c run -- <cmd>for a Linux x86-64 debug build (gcc or clang,-O0or-Og). c/README.md.
A query refuses by name when a recorder lacks a capability.
Two commitments run through all of it. The instrument never answers from data it does not have: truncated captures are marked, sites a predicate could not be evaluated at are counted, a recording that died is labelled, and a rerun that was a different execution says so. Nothing here guesses. Every answer is a deterministic function of the recorded trace, and where the trace cannot settle a question the output says so instead of inferring. refocus is the one command that executes anything: it re-runs the program and says whether what came back was the same execution. The per-command limits are docs/claims.md.
Related MCP server: backscroll
Answers from the trace, or refuses
Sensorium never guesses why a test failed. A well formed question whose recording cannot settle it is refused by name.
REFUSED. Printed
REFUSED: ...when a capability is missing, andrefocus verdict: REFUSED -- <run> was recorded and is queryable, but it could NOT be verified against <run>: treat it as a separate, UNVERIFIED executionwhen a rerun could not be checked.diffprintsverdict: REFUSED -- cannot issue a MATCH/DIVERGED verdict. Re-record.NOTHING WAS CHECKED.
watchprintsverdict: NOTHING WAS CHECKED -- the predicate could not be evaluated at any of the N recorded site(s)when no site had the names the predicate needs. The next line is'hits: 0' here means 'could not evaluate', NOT 'the invariant held'.DIVERGED. Two runs took different paths.
diffprintsverdict: DIVERGED at causal step N.refocusprintsrefocus verdict: DIVERGED -- .... The new trace is queryable and is a different execution.
Exit 3 means change the recording. Exit 2 means fix the call. Details: docs/claims.md.
Quickstart (Python 3.12+)
pip install sensorium-trace pytest
sensorium run -- pytest tests/test_something.py
sensorium exceptions lastuv tool install sensorium-trace puts the same sensorium command on PATH. Run these from your project root, in an environment that can import your code.
Connect your agent (MCP)
Use the absolute path to your project venv's sensorium. --allow-run lets the agent record and rerun; leave it off for read-only.
Cursor, .cursor/mcp.json, and Claude Desktop, claude_desktop_config.json:
{
"mcpServers": {
"sensorium": {
"command": "/abs/path/to/project/.venv/bin/sensorium",
"args": ["mcp", "--allow-run"]
}
}
}VS Code, .vscode/mcp.json:
{
"servers": {
"sensorium": {
"type": "stdio",
"command": "${workspaceFolder}/.venv/bin/sensorium",
"args": ["mcp", "--allow-run"]
}
}
}Claude Code:
claude mcp add sensorium -- /abs/path/to/project/.venv/bin/sensorium mcp --allow-runsensorium mcp serves the same store on stdio. Every query except redact is a tool. record, refocus, and record_c exist only with --allow-run. Tools, the result header, the cap, and the audit file: docs/mcp.md.
How this differs from live debuggers and LLM tracing
Live debuggers over MCP (DAP-based servers) make the agent step through a paused process, one breakpoint at a time. Sensorium records the whole run once, and the agent queries it afterward, as often as it likes, with stable event ids.
LLM tracing (LangSmith, Langfuse and similar) records the model's prompts and tool calls. Sensorium records the program under test: its calls, returns, exceptions and values.
Not sensorium-mcp. andriyshevchenko/sensorium-mcp is an unrelated Telegram and memory agent that shares the name.
Install
Python 3.12+. The CLI command is sensorium. The name sensorium on PyPI and npm is an unrelated project; these packages publish as sensorium-trace.
pip install sensorium-trace
uv tool install sensorium-traceRust recorder (Linux, rustc 1.96+):
cargo install cargo-sensoriumTypeScript recorder (Node 24):
npm install sensorium-tracePublished on PyPI, crates.io and npm; Linux binaries for cargo-sensorium are on GitHub Releases. The import and the CLI stay sensorium. The npm package is the recorder library; traces still report recorder: sensorium-ts.
From git:
uv venv .venv && uv pip install -p .venv/bin/python "sensorium-trace @ git+https://github.com/bricelancasterwcp-sudo/sensorium"Dev checkout: uv venv .venv && uv pip install -p .venv/bin/python -e ".[dev]". Details: docs/install.md.
The recorder is sys.monitoring and nothing else, so on 3.11 it refuses to start. Witnessing a multiprocessing spawn needs the _posixsubprocess.fork_exec audit event, which arrived in 3.14. Below that, such a spawn is unwitnessed, and refocus says so by withholding the "no child process witnessed" line (docs/claims.md).
Commands
sensorium run -- pytest tests/test_fog.py
sensorium runs
sensorium info last
sensorium tree last --depth 3
sensorium frame last --fn compute
sensorium grep last compute --kind RETURN
sensorium exceptions last
sensorium failures last
sensorium flow last --value 1800
sensorium flow last --object build_key:record
sensorium diff RUN_A RUN_B
sensorium refocus last --focus fog:compute
sensorium redact --all --dry-run
sensorium mcp --allow-runPer-line state is opt-in: sensorium run --focus fog:compute -- ..., then sensorium watch last --at fog:compute --expr '...'. Asked without that --focus, watch reports NOTHING WAS CHECKED and prints the re-record command. It does not report zero hits.
Traces land in ~/.sensorium/traces (or $SENSORIUM_DIR/traces), one SQLite file per run. Rust, TypeScript, and C write to the same directory, so one runs lists all four. A run reference is a full id, a unique prefix, or last. Events are eN and frames are fN, and those ids stay stable, so an answer from one command is an argument to the next. --fn matches a qualname exactly first, then as a substring, and refuses when more than one name matches. Asyncio frames, --window, and flow --object: docs/use.md.
Rust, TypeScript, and C
Rust.
rust/shipssensorium-rt0.7.3,sensorium-transform0.5.2, andcargo-sensorium0.8.4.cargo install cargo-sensorium, thencargo sensorium testorcargo sensorium runfrom a workspace. Linux, stable rustc. Panics show up infailures. rust/README.md. What it does not see: rust/HONESTY.md.TypeScript.
typescript/shipssensorium-ts0.6.2. A trace reportsrecorder: sensorium-ts. Node 24. From a checkout,npm ci --prefix typescript, thensensorium ts run -- vitest run …orsensorium ts run -- node --test …. A shell-freenpm testthat runs vitest ornode --testis expanded. jest is refused by name (no jest transformer). Inline vitest project objects are instrumented; a project named by a string or glob is refused.for awaitinside a function is recorded; top-levelawaitis not. typescript/README.md.C.
sensorium c run -- <cmd>records a Linux x86-64 debug build (-O0or-Og, gcc or clang). Crashes are whatexceptionsreads. c/README.md.
Recording follows code under the working directory the run started in, so sensorium run -- pytest ... traces your tests and your code, and not pytest's. --focus module:qualname adds line-level capture for the named code. --window QUALNAME limits that capture to what runs inside one function. The fog.py examples in docs/use.md were run as typed.
Exit statuses
The exit status is the caller's next action, not a health code:
exit | meaning | examples |
0 | the question was answered affirmatively. The trace says yes |
|
1 | the question was answered negatively. The trace says no, or none |
|
2 | the call is wrong, edit the command and ask again | an ambiguous |
3 | the trace cannot settle it, change the recording and re-record |
|
run exits with the target's own status. It never applies this table to itself.
Every invocation is appended to <trace root>/invocations.jsonl (default ~/.sensorium/invocations.jsonl, or under $SENSORIUM_DIR) as one JSON line with utc, argv, exit and error (the exception class name or null) and nothing else: never the environment, never the working directory. Set SENSORIUM_NO_INVOCATION_LOG to any non-empty value other than 0 to turn it off for one process, =0 leaves logging on. The same branch is docs/agent.md.
For agents
Install, record one run, query it, serve it over MCP: ten steps in docs/agent.md. After install, prove the path with .venv/bin/python -m pytest tests/test_agent_smoke.py -q.
Agent skill
skills/sensorium/SKILL.md is an Agent Skills file (name: sensorium). It tells an agent, when a test fails or output is wrong in Python, Rust, TypeScript, or C, to record one run and query the trace on the CLI or over MCP.
sensorium skill show
sensorium skill install
sensorium skill install --user --target claudeinstall copies that file. If a destination already exists, nothing is written unless --force is passed. With no --target it writes both .claude/skills/sensorium/SKILL.md (Claude Code: .claude/skills/ in the project, ~/.claude/skills/ for --user) and .agents/skills/sensorium/SKILL.md (Codex reads .agents/skills from the working directory up to the repo root, and ~/.agents/skills for a user skill). --target cursor, --target codex, and --target agents write the .agents/skills path. --target claude writes only the Claude Code path. A path argument is the skill directory itself. Cursor install guides also name .cursor/skills/<name>/, and older Codex pages still say .codex/skills/; pass that directory as a path to use it. The wheel ships the same file at sensorium/_skill/SKILL.md.
What the answers claim
Sensorium reports; the agent reading it reasons. Nothing in an answer is inferred from data the trace does not hold.
diffcompares the shape of two runs,(file, qualname, kind), not their values. A pure move reads DIVERGED unless--ignore-movescan pair the name uniquely.refocusre-runs, then issues MATCH, DIVERGED, or REFUSED. The licence lists only the checks that ran. A check that could not run withholds the licence. Exit 2 means nothing was re-run.treederives parentage from the caller frame, not from "the last frame on this thread".exceptionsclaims SWALLOWED only when the recording establishes it. Anything short of that isambiguous, with the reason printed.watchnever reads zero hits as "the invariant held". A site it could not evaluate is counted.flowis lineage over captured values, not static dataflow.infolabels an INCOMPLETE recording and does not print a0as proof that nothing happened.
The full wording is docs/claims.md. exceptions, watch, flow, and Rust refocus in detail are docs/query.md.
What a trace holds, and what it does not see
A trace holds the process environment (minus what rule v1 withheld), stdout and stderr, the command line, source digests, and captured values. It does not see children by an unlisted mechanism, non-Python threads, files the program read, code outside the run root, the clock, or the network. Treat a trace as a core dump. docs/visibility.md. Redaction: docs/redaction.md.
Overhead
Recording overhead and read-back cost are docs/overhead.md.
Measured with python corpus/run_corpus.py --bench.
The headline: 2.9× on the corpus's typical workloads, up to 194× on the call-dense one under --focus. Record failing tests, never benchmarks.
Corpus
python corpus/run_corpus.py # verify against seeded bugs
python corpus/run_corpus.py --show # print the questions and commands
python corpus/run_corpus.py --bench # report recording overhead
python corpus/run_corpus.py --require-driver # a skipped Rust or TypeScript case is exit 1
python corpus/run_corpus.py --via mcp --compare-cli # every tool question through the MCP server, diffed against the CLISmall programs with planted bugs, and questions registered before any output was looked at. 115 cases and 253 questions. A case whose recorder is not built is reported skipped by name. --bench reports; it never gates. Case by case: docs/corpus.md.
Not yet
What each slice deferred, and the ruling each deferral is waiting on, is docs/CARRIED-DEBT.md.
License
MIT, see LICENSE. Copyright © 2026 Brice Lancaster.
Versions after the Proprietary interlude are again under MIT (matching releases through 0.14.0).
Also
Available Tools
10 toolsdiffdiffBRead-onlyIdempotent
first causal divergence between two runs. Aligns the two causal streams and names the first event where they part, with drill-in commands; MATCH or DIVERGED, or REFUSED when no verdict exists.
Inputs: run_a (required), run_b (required), task, context, +1 more.
exceptionsexceptionsARead-onlyIdempotent
raises, handles, swallows. Every raise classified swallowed, uncaught, re-raised, propagated or ambiguous, with the reason; SWALLOWED is claimed only when the recording proves it.
Inputs: run, after, limit.
failuresfailuresARead-onlyIdempotent
failed tests and the frame they failed in. Each failed test mapped to the frame and the assertion, panic or exception recorded there. A vitest expect, a Rust panic, and a C crash or assert in a test_ frame are listed here; exceptions still judges throw and Err flow and does not list them.
Inputs: run, limit.
flowflowARead-onlyIdempotent
provenance of a value or an object. --value follows a literal by equality through captured arguments, locals and returns; --object follows one identity from the event that captured it; one of the two is required, and each refuses by name what the recording did not capture.
Inputs: run, after, limit, value, +1 more.
frameframeARead-onlyIdempotent
one activation in full. Arguments, return or raise, and the per-line locals timeline when the run was recorded with --focus; frame ids fN come from exceptions, tree and grep.
Inputs: fn, nth, run, frame.
grepgrepARead-onlyIdempotent
search events by name or value. Every CALL, RETURN, RAISE, HANDLED or LINE event whose name or rendered value contains the pattern; --after resumes from an event id a previous answer showed.
Inputs: pattern (required), fn, run, kind, +2 more.
infoinfoARead-onlyIdempotent
summarize one trace. Recorder, language, the capabilities the trace declares, what was recorded and what was not, focus, the redaction stamp; read it before any other question on a run.
Inputs: run.
runsrunsARead-onlyIdempotent
list recorded traces. One line per trace, oldest first: run id, exit, event count, the command; a refocus rerun names its original and its verdict.
Inputs: no named parameters.
treetreeARead-onlyIdempotent
call-tree slice. Parentage derived from the event stream; --around centres the slice on an event id, --root on a frame id; nested dict contents are elided, frame prints them.
Inputs: run, root, depth, limit, +1 more.
watchwatchARead-onlyIdempotent
predicate over captured state. A gdb-style watchpoint evaluated after the fact at every recorded site of one function; needs a --focus recording, and NOTHING WAS CHECKED is a refusal, never a pass.
Inputs: at (required), expr (required), run, after, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Each tool targets a distinct trace-analysis question: listing runs, summarizing a trace, searching events, inspecting frames/trees, following provenance, classifying exceptions, mapping failed tests, comparing runs, and evaluating watch predicates. The exceptions/failures boundary is explicitly clarified, and flow/frame/tree are differentiated by their scopes.
All names are lowercase single tokens with no mixed casing or underscores, giving a consistent surface style. However, they mix singular nouns, plurals (runs, exceptions, failures), and imperative verbs (grep, watch), so the convention is not fully uniform.
Ten tools is well-scoped for a trace-analysis server, and each tool maps to a meaningful investigation step rather than duplicating another. The set is neither thin nor bloated.
The surface covers the full trace-analysis lifecycle: discovery (runs, info), navigation (grep, tree, frame), provenance (flow), error analysis (exceptions, failures), comparison (diff), and state monitoring (watch). No obvious workflow dead ends are apparent.
Maintenance
Related MCP Connectors
Private-by-default, local-first memory/context/task orchestrator for MCP apps and agents.
Persistent, inspectable memory for AI agents with lineage, correction, and a hosted MCP endpoint.
Hosted MCP memory: save sessions/decisions once, search from Claude, Cursor, ChatGPT. EU-hosted, keyword search.
Self-hosted AI workspace: semantic RAG document search, long-term memory, and AI chat via MCP.
Related MCP Servers
- FlicenseNot gradedqualityAmaintenanceLocal MCP server that lets your AI coding agent query its own cross-tool project history - file/command freshness, past test failures, cost & token spend, cache status, and session handoff - over stdio, 100% local, no telemetry.62-
- AlicenseAqualityCmaintenanceRecords your terminal sessions per command (PTY + OSC 133) into local SQLite, so AI agents can search, retrieve, and diff what commands actually printed. Secret redaction is applied by default to everything served over MCP.47MIT
- FlicenseNot gradedqualityDmaintenanceA local-first MCP server that gives AI coding agents runtime visibility and AI-managed debug logging. It replaces blind print() debugging by turning runtime execution into causal chains, allowing agents to instantly locate bugs by finding missing .success events in Python and TypeScript code. Single binary with MCP, CLI, and HTTP interfaces.-
- AlicenseAqualityBmaintenanceEnables local-first observability for MCP agent workflows by recording tool calls, prompts, latency, and token usage in a local SQLite database, and provides tools for inspecting, comparing, exporting, and generating dashboards from traces.1369 npmMIT