Skip to main content
SenseLab doesn’t just store what agents know — it records how they used it. Every read, external input, action, failed attempt and outcome in a run forms a decision trace. The trace is the raw material of the loop: it is what an outcome is credited against, what the briefing is compiled from, what judges grade, and what a model is eventually trained on. One record, four jobs.

The Problem

AI agents are stateless. Each session starts from scratch with no memory of past decisions, patterns, or mistakes. When something goes wrong, there’s no way to answer:
  • What information did the agent have when it decided?
  • What external sources did it consult, and what did it do?
  • Has a similar decision been made before, and what happened?
Traditional systems of record (CRMs, ERPs, ticketing systems) store the final state — the deal was closed, the ticket was resolved, the deploy succeeded. The reasoning that connected data to action was never treated as data, so nothing could learn from it.

Decision Traces

A decision trace is a structured record of how an agent turned context into action:
A decision trace in four layers: what the agent knew, what it consulted, what it decided, and what happened
This trace is queryable. The next agent — or a human auditor — can replay exactly what happened and why.

How SenseLab Captures Decision Traces

SenseLab’s existing primitives map directly to each component of a decision trace:

1. What the agent knew

Every read() call is automatically logged by the ReadTracker. When the agent later commits an outcome, SenseLab knows exactly which entries informed the decision.

2. What external inputs were gathered

record_context() captures tool calls, API responses, and other external inputs without writing to storage. These appear in the causal chain alongside SenseLab reads.

3. What the agent decided

The agent’s decision is written as a versioned, provenanced entry:

4. What the agent did

Consequential actions — deploys, rollbacks, edits, refunds — are recorded as they happen, failures included. When a remembered approach did not work, the attempt is closed before the next one starts, so the entries behind it receive the failure rather than the credit for the recovery:

5. What happened next

The outcome closes the loop. Confidence moves on the causal entries, and the request and the answer travel with the trace so a judge can grade the run later:

6. Why did we do that?

explain() returns the complete causal chain:
Returns:

From Traces to Graphs

Individual decision traces accumulate into a context graph: entities connected by decision events with “why” links.
A context graph: one entry read by three agent sessions, each with what else it consulted, what it wrote, and how its outcome fed back into confidence
Over time, this graph captures institutional knowledge that no single agent or person holds:
  • Precedent — “The last time we saw this pattern, we rolled back and it worked.”
  • Exception logic — “We always check for open incidents before deploying changes to retry logic.”
  • Cross-system synthesis — “The decision combined SenseLab memory, open incidents, and git history.”

The Knowledge Graph

A persisted knowledge graph complements the session-scoped decision trace. The two layers serve different purposes: Both layers are always on — the graph materializes from normal reads and writes, and traces are recorded as agents work. Neither needs to be enabled or configured.

How Edges Are Created

The knowledge graph is populated automatically — no manual graph construction needed: Each edge carries confidence, evidence_count, first_seen, and last_seen. Repeated materializations increment the evidence count rather than creating duplicate edges.

Querying the Graph

Agents can explore the knowledge graph via the SDK or MCP:
Via MCP:
The Memory Cortex also compiles CONNECTION_MAP digests from graph edges, surfacing the most important relationships for an entity during amfs_briefing().

The Feedback Loop

Decision traces compound through SenseLab’s outcome system:
The feedback loop: an agent decides, the outcome lands, confidence adjusts on the causal entries, the next agent sees the precedent and makes a better decision
Entries that led to good outcomes are reinforced and decay slower; entries correlated with failures lose confidence and sink out of results. The system learns which decisions lead to good outcomes without any explicit training. The same traces feed the two slower loops. Behavior grades them with judges, opens an incident when a failure recurs, and proposes a fix to the learning itself — tested by replaying the failing traces against the fixed memory before it ships. Managed Models take the traces whose outcomes were good as a labelled training set. Both improve what the next run starts from, which is what makes the improvement recursive.

Enriched Decision Traces

When commit_outcome() is called, SenseLab automatically captures a rich snapshot of the session:
The resulting trace includes:

Per-Agent Memory Graph

SenseLab tracks which agents interact with which entities, enabling per-agent memory views:
The agent memory graph shows every entity an agent has read from or written to, with entry counts and relationship types — giving you a complete picture of any agent’s knowledge footprint.

Immutability and Replay

Because SenseLab uses Copy-on-Write versioning, decision traces are immutable. You can reconstruct the exact state of the world at any past decision point:
This is the difference between a system of record (stores the current state) and a context graph (stores the decision lineage). SenseLab preserves both.

Immutable Decision Trace Store

SenseLab extends the traces in SenseLab Open Source with cryptographic guarantees and advanced telemetry:
  • HMAC-SHA256 signing — every trace is signed with content_hash and chained to the previous trace via parent_hash, forming a Merkle chain that detects tampering
  • LLM call spans — record model, provider, prompt/completion tokens, cost, latency, temperature, and finish reason for every LLM call during a session
  • Write events, tool calls, agent interactions — full audit trail of every action
  • OpenTelemetry export — export traces as OTel spans following GenAI semantic conventions, compatible with Jaeger, Grafana Tempo, Datadog, and Honeycomb
  • Auto entity extraction — LLM-powered extraction of entities (services, people, tools) and relationships (depends_on, uses, manages) from trace data
  • Immutability enforcement — updates and deletes are blocked at the storage layer, so a sealed trace cannot be edited or removed even by an administrator

MCP Integration

Via the MCP server, AI coding agents can build decision traces automatically:
The causal chain builds itself from the normal workflow. To add nested steps, LLM calls and cost from an agent you run yourself, see Instrument your agent.