Skip to main content

Agent-Native Temporal Graph Management System (bi-temporal property graph + validated temporal operator algebra + PEV agent layer)

Project description

TGMS — Agent-Native Bi-Temporal Graph Management System

CI License: Apache-2.0 Coverage: temporal/ 96%

A temporal graph database whose query surface is built for LLM agents — and whose answers can be audited claim by claim.

Project page & blog: https://zxf-work.github.io/tgms/ · Paper: paper/main.pdf

LLM agents are unreliable at exactly the things temporal graph analytics requires: arithmetic, identifiers, and asserting only what the evidence shows. TGMS's answer is architectural — give the model no opportunity to do any of them:

  • a bi-temporal property graph (valid time × transaction time) that distinguishes evolution ("the edge ended") from correction ("we were wrong"), so agents can answer "what did we believe on March 1?" — a question no snapshot or RAG system can express;
  • 13 verified temporal operators (reachability over time-respecting paths, δ-motifs, snapshot diffs, burst detection, interval joins, …) — typed, deterministic, bounded, cost-guarded, exposed as tools (MCP or in-process); identifiers must come from a resolver, arithmetic from a compute operator;
  • a Planner–Executor–Verifier loop: the LLM only plans and reports; plans are statically validated (including a grounding rule that makes fabricated identifiers impossible and output-field contracts that reject invented result paths), executed deterministically with content-addressed traces, and every claim in the written answer is machine-checked against the trace that produced it — including truncation taint, so "correct arithmetic over incomplete evidence" is caught too.

Does it work?

Dev-split campaign (CollegeMsg, open-source models served locally on one 24 GB GPU; details + receipts in docs/TECHNICAL_REPORT.md):

pooled EM, Qwen2.5-14B TGMS vector-RAG static-graph RAG text-to-Cypher
all task families 0.41 0.09 0.05 0.18
correction probes ("as of tt…") 0.67 0.00 0.00 0.00
  • vs static-graph RAG: +36 points, paired-bootstrap 95% CI [0.18, 0.59]
  • verifier fault injection: 500/500 injected false claims caught, 0 false positives; emitted answers carry an unsupported-claim rate of 0.000
  • operators meet all latency targets at 1M events (snapshot 98 ms, diff 163 ms, reachability 63–244 ms)

Quickstart

# macOS note: if this repo sits in an iCloud-synced folder, keep the venv
# outside it (iCloud sets the hidden flag on .pth files and Python 3.12+
# silently skips them):  export UV_PROJECT_ENVIRONMENT=$HOME/.venvs/tgms
uv sync --extra agent
make test                     # 81 tests: property, oracle, metamorphic, e2e

# build a real store + task suite (downloads CollegeMsg from SNAP)
make data-collegemsg suite-collegemsg

# call one verified operator — no LLM needed
uv run tgms call temporal_reachability \
  '{"src": "n9", "window": {"t_a": 1082040961000000, "t_b": 1088000000000000}}' \
  --store stores/collegemsg

# verifier acceptance experiment (deterministic, no LLM)
uv run tgms eval c2 --store stores/collegemsg \
  --suite stores/suite-collegemsg/suite.json --mutants 500

With any OpenAI-compatible LLM endpoint (e.g. vllm serve Qwen/Qwen2.5-7B-Instruct):

uv run tgms ask "How many nodes can n9 reach between ... and ...?" \
  --store stores/collegemsg --model openai/Qwen/Qwen2.5-7B-Instruct \
  --api-base http://localhost:8000/v1 --html trace.html   # auditable trace page

bash scripts/run_webapp.sh    # interactive guided demo at localhost:8080

Interfaces

Surface Entry point What it's for
Python library tgms.open(...), Agent(store, model=…).ask(…) research code, notebooks
MCP server tgms serve --store PATH hand the verified toolbox to any MCP-capable agent
CLI tgms ingest/synth/tasks/call/ask/bench/memory/eval reproducibility
Trace viewer tgms ask … --html trace.html ask → answer → audit the evidence (static, self-contained HTML)
Demo GUI tgms webapp … / scripts/run_webapp.sh guided tour: operators → agent → tamper demo → time travel

Correctness

Every operator is verified against an independent brute-force oracle (500 randomized cases per operator; 96% line coverage in tgms/temporal/), plus metamorphic properties — diff composition and bi-temporal immutability: any result pinned to a past belief state is byte-identical before and after later corrections. The write path is property-tested over random assert/retract/correct interleavings, and the append-only event log replays into either backend with identical store digests. Process rules (test ownership, decision log, determinism receipts) are enforced in CI — see CONTRIBUTING.md and docs/DECISIONS.md.

Layout

tgms/core       clock, bi-temporal data model, error taxonomy
tgms/storage    StorageAdapter ABC, Kùzu + DuckDB backends, event log, TCSR index
tgms/temporal   operator algebra O1–O13 + brute-force oracle
tgms/tools      tool schemas, MCP server / ToolRouter, trace viewer, demo GUI
tgms/agent      plan IR, planner, executor, verifier, reporter, memory
tgms/data       dataset loaders (SHA-256 pinned) + synthetic generator
tgms/eval       task suites, baselines, matrix harness, metrics, fault injection

Datasets are never bundled: loaders download from source (SNAP) and pin SHA-256 manifests. See docs/TECHNICAL_REPORT.md for design, positioning, measurements, and roadmap.

License

Apache-2.0 — see LICENSE. Cite via CITATION.cff.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tgms-0.4.0.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tgms-0.4.0-py3-none-any.whl (138.0 kB view details)

Uploaded Python 3

File details

Details for the file tgms-0.4.0.tar.gz.

File metadata

  • Download URL: tgms-0.4.0.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for tgms-0.4.0.tar.gz
Algorithm Hash digest
SHA256 3989eea7e6c24caf1ac4b6a02aff0e6f9dcd25aec19fe8844e2cc864149b3c5d
MD5 98c676ec84c4f98e070163e4df9e9fe1
BLAKE2b-256 2df606aa4a52cfa8de5a77c3b8904220ba84e4636b5c8c80658a201be23d6292

See more details on using hashes here.

Provenance

The following attestation bundles were made for tgms-0.4.0.tar.gz:

Publisher: publish.yml on zxf-work/tgms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tgms-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: tgms-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 138.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for tgms-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18385c75a0011b9c29c44deb8e679d5deff1675b1b6729f19392c79382a00079
MD5 a9d4d166a34126095764d4bc1222b8e6
BLAKE2b-256 0e481f2a162646c54816045b5d25fde9a0fbd538b2e093f394dbef9ac646973a

See more details on using hashes here.

Provenance

The following attestation bundles were made for tgms-0.4.0-py3-none-any.whl:

Publisher: publish.yml on zxf-work/tgms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page