TTemporalStore.AI GitHub

Data model

Long Sequence Feature: ordered history at scale.

Store long, ordered behavior histories per entity and serve them with tail reads, time windows, and filters — the input rankers, agents, and investigation tools need without scanning a warehouse at request time.

What it is

The last N events for an entity, in order, ready to read.

A Long Sequence Feature is a per-entity, event-time-ordered log the engine understands as a first-class object. Each entity — a user, device, merchant, or agent session — owns its own sequence, and the store keeps the recent tail hot.

Reads come in three shapes: a tail read for the most recent N events, a windowed slice over a time range or count, and either with filters on type, source, or dimension. Older events stay recoverable but out of the hot path.

Because the store keeps the recent tail warm and reconstructs full history from WAL plus snapshots, a tail read stays sub-millisecond even when the entity has millions of events behind it.

One entity's sequence (recent → old)
Taillast N, hot cache
Windowrange / count slice
HistoryWAL + snapshots

Sharded across millions of sparse entity keys; each key keeps its own ordered tail warm.

In practice

Append events, then read a recent slice.

Append an event to an entity's sequence
ts.append(
  table="user_events",
  entity="user_42",
  ts_ms=event.ts_ms,
  attrs={"kind": "view", "item": "sku_812"},
)
Read the recent slice a ranker needs
seq = ts.sequence(
  table="user_events",
  entity="user_42",
  last=50,
  since="24h",
  where={"kind": "view"},
)

When to use it

When you need recent-first history, not a warehouse scan.

Reach for a sequence whenever a request depends on what this entity did lately, in order. It replaces per-feature stream jobs and request-time warehouse queries with a single bounded, replay-friendly read.

Use caseSequence readWhy it fits
Ranking & recommendationLast 200 interactions per userFeeds a ranker the ordered behavior signal without a feature pipeline.
Agent tool historyOrdered tool calls per sessionBacks Context Management with the exact action trail behind a decision.
Investigation trailsWindowed slice with filtersReconstructs what happened, in order, after failover or migration.
Shopping & content journeysTail read since last sessionServes the recent path without scanning cold history.

Related models

Combine sequences with the rest of the store.

FlagshipContext ManagementAgent memory built on sequences. AggregatesAggregated FeatureRollups over the same events. Counters & setsControl StateCaps and distinct sets alongside history.