Time travel visualizer for Minigraf bi-temporal databases.
Minigraf keeps two kinds of time for every fact:
- Transaction time: when the fact was written. You query the past with
:as-of N. - Valid time: when the fact was true in the real world. You query it with
:valid-at.
Choose a transaction and set valid time to Now, a date, or Any to see that view of the graph. Queries run in your browser using the @minigraf/browser WebAssembly build, without a database server.
- Scrub transaction time. Step, drag or press play. The graph shows what a query at that transaction sees. Green marks what the transaction added. Red marks what it removed.
- Scrub valid time. Pick Now, a date, or Any. The slider snaps to the dates where facts start and stop.
- Read the bitemporal map. Each fact version is a box: valid time across, transaction time up. A box that stops below the top was retracted. Drag in the map to move both cursors at once.
- Inspect an entity. See the entity's facts and incoming links at the selected transaction and valid time. The inspector also lists all loaded versions and the transactions that wrote or removed them. Click a version to jump there.
- Run Datalog. The console can pin each query to the time cursor. It adds
:as-ofand:valid-atfor you. Writes become new transactions and the history is rebuilt. - Open and save
.graphfiles. Files are byte-compatible with native Minigraf. Open a file made by the Rust, Python or other bindings (checkpoint it first so no.walsidecar is pending). - Share a view. The address bar holds the sample, cursor, selection and view, for example
#sample=careers&tx=6&vt=2023-06-01T00:00:00Z&e=:alice&view=map. A link can also carry its own Datalog script (see Linking to the visualizer).
Your workspace is kept in the browser (IndexedDB) and comes back when you reload.
- Load data. Start with a sample, open a
.graphfile, or press New and write facts in the Query tab. - Find the change you care about. Read the transaction log on the left. Each row shows how many fact versions it added (
+) and removed (−). Click a row, or press play, and watch the graph. Green is new at that transaction. Red is gone. - Look at one entity or attribute over time. Click a node. The inspector lists every version with its valid range and the transactions that wrote and removed it. Open the Bitemporal map and filter by entity or attribute to see the valid-time intervals as boxes.
- Set transaction time and valid time. Drag in the map or use the sliders to choose a transaction and a valid-time setting.
- Ask a question at that point. In the Query tab, keep Run at the time cursor on. Your query runs with the cursor's
:as-ofand:valid-atadded, and the console shows the exact query it ran. Clauses you write yourself are kept. - Keep or share it. Save the database as a
.graphfile, or copy the address bar link (built-in samples only).
| Sample | Shows |
|---|---|
| Careers & corrections | Back-dated jobs, a wrong salary that is corrected, a job that ends, a future-dated promotion |
| Agent memory | An AI agent's beliefs, a retracted belief, and the audit trail behind a recommendation |
| Order state machine | Transitions stored as facts; an order moving through its states |
| Dependency upgrades | A dependency graph across releases, with a recursive rule for transitive dependencies |
| Corestore catalog | The Minigraf tutorial store: a category tree and prices that change over time |
| Corestore tutorial (wiki) | The exact dataset from wiki tutorial sections 1 to 3. Transaction numbers match the text. |
The samples follow the recipes in the Minigraf wiki cookbook and the scenarios in minigraf-examples.
| Key | Action |
|---|---|
← / → |
Previous / next transaction |
Space |
Play / pause |
Esc |
Clear the selection |
Ctrl+Enter |
Run the query in the console |
Docs and examples can link straight to a view. Everything goes after #, so it never leaves the reader's browser.
| Parameter | Meaning |
|---|---|
sample |
A built-in sample: careers, agent-memory, order-fsm, dependencies, catalog or corestore-tutorial |
data |
A Datalog script, as base64url of its UTF-8 text. Use instead of sample. |
title |
Name shown in the header for a data link |
tx |
Transaction-time cursor (:as-of). Default: the latest transaction. |
vt |
Valid-time cursor: now, any, or a date such as 2023-06-01 |
e |
Entity to select, as a keyword (:alice) or a UUID |
view |
graph (default), map or facts |
Examples:
- The corrected salary on the bitemporal map:
#sample=careers&tx=7&vt=now&e=:alice&view=map - What the agent believed when it made its recommendation:
#sample=agent-memory&tx=3&vt=any&e=:user-ana
To make a data link from a script file:
node scripts/make-link.mjs recipe.dl --title "Retroactive correction" --tx 3 --e :alice --view mapIf a reader has edited their own workspace, the app asks before a link replace 9452 s it. If a linked script fails to run, the app says so and keeps the previous workspace.
Minigraf does not expose its fact log directly. The visualizer rebuilds it with ordinary Datalog:
- It finds the last transaction number. It copies the database into a scratch in-memory instance (
exportGraph/importGraph), writes one probe fact there, and reads the probe's:db/tx-count. - For each transaction
N, it runs one query with:as-of Nand:any-valid-time. The query binds each fact's metadata through the pseudo-attributes:db/tx-count,:db/tx-id,:db/valid-fromand:db/valid-to. - It compares each snapshot with the one before. A fact version that appears at
Nwas asserted byN. One that disappears atNwas removed byN. Usually that is aretract. It can also be atransactthat writes the same fact with the same valid-time window again: Minigraf then keeps only the newest copy.
A fact version never reappears after it is superseded or retracted, so comparing successive snapshots finds every change. When you write through the console, only the new transactions are read.
Moving the cursors filters the loaded history without running another database query. The filters use the same rules as the engine: a fact is visible when tx-asserted ≤ N < tx-retracted and valid-from ≤ t < valid-to. The test suite compares these filters with the Minigraf engine at every transaction and every valid-time boundary of every sample.
Minigraf stores :alice as a UUID (v5 of the keyword in the OID namespace). The app computes the same UUID, so a value like :bob becomes an edge to the entity :bob. It also remembers the keywords used in the scripts it runs, so nodes keep readable names. In an opened .graph file, entities that no keyword refers to are labelled by a name, title or label attribute, or by a short id.
- Opening a database takes one query per transaction, and each query reads every fact. As a guide, 500 transactions with 1,500 facts take about 4 seconds. A progress bar shows while it runs. The app reads at most 5,000 transactions and shows a notice if a file has more.
- Rules are not stored in
.graphfiles. The app replays rules for its own workspace, but not for opened files. - Minigraf 2.x can merge two values of the same attribute on one entity if they are written in one
transactorretract(minigraf#371). Write each value in its own call. The samples do this. - The wall-clock time of a retraction-only transaction is not queryable, so the log shows "retract" instead of a time.
- All times are shown and entered in UTC. Minigraf's
:valid-attakes whole seconds, so a pinned query rounds the valid-time cursor down to the second. - An opened
.graphfile does not record the keywords used to write it. Entities are named from keyword values that point at them, or from aname,titleorlabelattribute. Other entities show a short id. - Queries run in Minigraf. The graph, map and tables use the history reconstructed from Datalog snapshots.
- The app runs in the browser only and needs WebAssembly. Your workspace stays in that browser.
Needs Node.js 22 or newer.
npm install
npm run dev # start the dev server
npm test # unit tests, using the real WASM engine in Node
npm run typecheck # TypeScript, strict
npm run build # production build in dist/
npm run test:e2e # Playwright tests against a production buildTo run the end-to-end tests with a Chromium you already have, set CHROMIUM_PATH=/path/to/chrome.
The build uses relative paths, so dist/ works from any sub-path. The Deploy to GitHub Pages workflow publishes it on each push to main (enable Pages with "GitHub Actions" as the source in the repository settings).
@minigraf/browser2.0.2: the Minigraf engine compiled to WebAssembly- React 19, TypeScript 7, Vite 8
- d3-force, d3-zoom and d3-scale for layout, pan/zoom and time axes
- Vitest and Playwright for tests
src/lib/ engine wrapper, history rebuild, time filters, graph model (no React)
src/app/ React hooks: workspace, time cursor, view model
src/components/ graph, bitemporal map, facts table, inspector, console, time controls
src/samples/ built-in datasets
tests/ unit tests (run the WASM engine in Node)
e2e/ Playwright tests
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.