Temporal Intelligence gives your knowledge graph a complete understanding of when — not just what is true, but when it was true in the real world, when it was recorded, and how facts have evolved over time. Shipped across v0.3.0 (context temporal validity) and v0.4.0 (full temporal stack), the system covers five layers:
Bi-temporal model
Valid time + transaction time on every fact
Point-in-time queries
Reconstruct any historical graph state in one call
Allen interval algebra
All 13 temporal relations, deterministic reasoning
NL temporal parsing
Zero LLM calls — pure regex + dateutil

Exported Classes

Quick Start

1

Build a time-aware graph

Attach valid_from / valid_until to any relationship at construction time:
2

Query the graph at a point in time

TemporalGraphQuery takes constructor args; pass the graph into each query call:
3

Reconstruct a subgraph at a specific timestamp

reconstruct_at_time() is the low-level primitive — returns a full graph dict with only nodes and edges that were valid at the given moment:
4

Create versioned snapshots

The Bi-Temporal Model

Most systems track only one timeline: when something is currently true. Bi-temporal graphs track two independent timelines simultaneously:
When was the fact true in the real world?
  • valid_from — date the fact became true
  • valid_until — date the fact ceased to be true. Omit (or use TemporalBound.OPEN) for currently-active facts

TemporalGraphQuery — Reference

Constructed once; the graph is passed into each method call:

Core Methods

time_axis Parameter

All query methods accept a time_axis parameter controlling which timestamps are used for filtering:

Range Query Example

Evolution Analysis

Temporal Path Finding

Consistency Validation

Error types reported: inverted_interval, invalid_temporal_fields, missing_source_entity, missing_target_entity, source_lifetime_mismatch, target_lifetime_mismatch. Warning types: overlapping_same_edge, gap_after_restart.

TemporalPatternDetector

Detect recurring temporal patterns across graph edges. Accessed directly or via TemporalGraphQuery.query_temporal_pattern():
Each pattern dict has: pattern_type, signature (tuple of node IDs), frequency, occurrences (list with nodes, edges, start_time, end_time).

Allen Interval Algebra

TemporalReasoningEngine operates on TemporalInterval objects — a frozen dataclass with start: datetime and end: datetime | TemporalBound:

All 13 Relations

Additional Engine Methods

Advanced: Interval Operations

TemporalNormalizer — NL Temporal Parsing

Converts natural-language temporal phrases into (valid_from, valid_until) datetime tuples. Zero LLM calls. Pure regex + dateutil.relativedelta.

normalize(value)Optional[Tuple[datetime, datetime]]

normalize() returns None for unparseable input — it never raises an exception. For relative phrases ("last quarter", "this year", etc.), reference_date must be set at construction time, otherwise ValueError is raised at call time.

normalize_phrase(phrase)Optional[Dict]

Look up a domain-specific temporal phrase in the phrase map:
Built-in domain phrases cover: General/Policy, Healthcare, Cybersecurity, Supply Chain, Finance, and Energy.

Custom Phrase Map

Supported Expressions

TemporalQueryRewriter

Extract temporal intent from a natural-language query so downstream retrieval can apply deterministic temporal filtering. Two modes: regex-only (no LLM) or LLM-assisted for free-form phrasing.

rewrite(query, context=None)TemporalQueryResult

TemporalQueryResult Fields

Supported intent keywords: before / prior to / until / up to, after / since / following, during / in / within, as of / at / on, between … and ….

TemporalVersionManager

Create and manage versioned graph snapshots with SHA-256 integrity checking. Supports both in-memory (default) and SQLite persistent storage.

Methods

Snapshot & Diff Example

Temporal Revision

Apply a revision to specific fact IDs — the originals are superseded (not deleted), preserving full audit history:

Integrity & Migration

Context Graph Temporal Features (v0.3.0)

The ContextGraph exposes temporal awareness directly on graph nodes and decisions, available since v0.3.0:

Temporal Decision Windows

Real-World Patterns

Configuration