TTemporalStore.AI GitHub

Flagship data model

Context Management: replayable short-term and long-term memory for AI agents.

Context is the reason TemporalStore exists. It keeps everything agents, teams, and devices need to remember as time-indexed records — so the model gets the right short-term and long-term context at the right moment, and you can replay exactly why any decision was made.

What agent context is

Cross-session, cross-agent, cross-device memory in one temporal record type.

An agent's memory is not one blob of text. It is a stream of distinct, timestamped facts that each age differently across sessions, agents, devices, users, and teams. Context Management stores all of them as the same time-indexed primitive, so short-term working memory and long-term team memory can be filtered, summarized, and replayed together.

  • Session and device memory — user goals, messages, edits, files, device context, and long-running task state.
  • Cross-agent team memory — shared decisions, project facts, handoffs, and preferences that survive across agents and sessions.
  • Tool traces — commands, tool calls, approvals, generated artifacts, and failures, so an agent can resume with evidence instead of guessing.
  • Retrieval evidence — source-backed memories with timestamps and relevance signals, packed into a compact context pack.
  • Summaries — rolled-up L0/L1 digests that keep long histories small while staying source-linked.
  • Safety counters & replayable decisions — rate limits, policy events, and escalation history beside the memory stream, so you can reconstruct the exact context an agent had when it answered.

How it works

Events flow in; a fresh, bounded context pack flows out.

Every message, tool call, and decision is appended as an event — a cheap, ordered write. At request time the engine assembles a context pack: it pulls the relevant streams, drops superseded and duplicate records, folds old history into summaries, and trims to a token budget.

Because assembly happens in the store rather than in your prompt buffer, the pack is fresh (reflects the latest event), de-duplicated, source-backed (each memory carries its origin), and replayable (ask for the pack as-of any past moment). The result is fewer tokens spent on stale or repeated context, and better answers grounded in evidence.

Write path
Messagesgoals & edits
Tool callstraces & approvals
Decisionswith source refs
↓ append as time-indexed events ↓
In the store
Dedupe & supersededrop stale copies
SummarizeL0/L1 rollups
↓ assemble to token budget ↓
Read path
Context packfresh · source-backed · replayable

The store does the assembly, so the agent receives evidence instead of an ever-growing transcript.

In practice

Build context, write a memory, and block stale reads.

Build agent context for a request
context = ts.context(
  entity="workspace_7",
  streams=["tool_calls", "decisions"],
  since="24h",
  summarize=True,
  include_evidence=True,
)
Write a memory event
ts.put_event(
  table="agent_memory",
  entity="workspace_7",
  ts_ms=now_ms,
  attrs={"kind": "decision", "text": "...", "source_ref": "pr#42"},
)
Block stale context — drop superseded records, cap the budget
pack = ts.context(
  entity="workspace_7",
  as_of="request_time",
  drop_superseded=True,
  token_budget=4096,
)

When to use it

Reach for Context Management when memory has to be defensible.

Use it whenever an agent must remember across turns or sessions, resume a long task, or justify a decision after the fact. It beats stuffing history into the prompt (which grows unboundedly and repeats itself), a plain vector index (no time order, no supersession, no audit trail), and a cache (no replay, no evidence links).

Context composes the supporting primitives below: ordered history from Long Sequence Feature, safety counters and distinct sets from Control State, and rollups from Aggregated Feature.

SequencesLong Sequence FeatureOrdered tool-call and behavior history. Counters & setsControl StateSafety counters, frequency caps, distinct sets. All data modelsData ModelsThe complete temporal data models catalog.