A read-only inspector for pi-durable storage

Point it at the SQLite file or JSONL directory of a harness, running or not, and see the transcript, the task graph, the documents, and what every turn cost and how long it took, on one timeline.

$ npx durable-lens ./session.sqlite

Needs Node.js 22.13 or later. No runtime dependencies.

It never runs your harness and never writes to your store, so you can point it at one a live process owns.

Demo

durable-lens walking through a session: timeline, task graph, a parked task, document rewind, fork comparison, usage.
A tour of one session: timeline, task graph, a parked task, document rewind, fork comparison and usage.

What it shows

One page per store. It follows the store: when the files change, it rereads them.

  • Timeline of a conversation: a strip of bars for each model generation and tool call above the entries, in order.

    Timeline

    Every entry in order, with its time and the gap since the one before. Assistant turns show model, latency, tokens and cost; thinking is collapsed. Tool calls link to their results, their tasks and the subagent conversations they started. A strip above shows each generation and tool call as a bar on the same clock.

  • Task graph with a parked task selected, showing its input, checkpoint and restart count.

    Task graph

    Every task with its owner edges: waiting on which tasks and with which policy, sleeping until when, pending after a crash, parked after crashing restartLimit times in a row, and the outcome and error of finished ones. Input, checkpoint and outcome are one click away.

  • The app.notes document with a slider that rewinds it through its revisions.

    Documents

    pi-durable's own (pi.agent, pi.usage, pi.inbox, and so on) and yours, materialized from their stored bases and deltas. Rewindable documents get a slider that steps back through their revisions.

  • Usage and cost: totals, then tables by model and by conversation with cost bars.

    Usage

    Cost and tokens by model, by tool and by conversation, from each conversation's pi.usage, which also counts failed and aborted attempts.

  • Two branches after a fork point, side by side: the parent's continuation and the fork's.

    Forks side by side

    A fork shows where it branched and what it inherited; compare branches puts the parent's continuation and the fork's next to each other.

  • An assistant message rendered with a table and code, and a pasted script tag shown as plain text.

    Untrusted content stays text

    Transcripts carry prompts, tool output and whatever a model wrote. Markdown is rendered by a small renderer that builds DOM nodes, raw HTML stays literal, and links show their target without becoming clickable.

Safe on a live store

durable-lens opens nothing of yours for writing. That takes more care than a read-only flag: the usual ways of opening a store read-only still write beside it, or miss the latest commits.

Ways to open a pi-durable store

Way to open Writes beside the store? Sees the latest commits?
SQLite, readOnly: true or mode=ro yes: creates -wal and -shm on an idle database, rewrites -shm on a live one yes
SQLite, immutable=1 no no: skips the WAL, so a crashed or running store looks stale
pi-durable's storage with HarnessOptions.readOnly (main) yes: migrates a schema v1 database to v2, checkpoints the WAL into the database file, truncates a torn JSONL line yes
durable-lens no yes

SQLite

durable-lens copies the database and its WAL into a private temporary directory (a reflink where the filesystem has them) and opens the copy. The copy is accepted when the WAL header is the same before and after it, since a WAL reset in between could tear the copy, and, if there is no WAL with frames, the database's size and mtime are the same too; otherwise it copies again.

JSONL

It reads the files, skips a last line still being appended, and reads again if the owner reclaimed a sidecar in between. It takes no locks, so it never slows the owner's checkpoints.

Tested, not promised

The tests hash every file of every fixture before and after reading it, also while a pi-durable process holds the store open, and read 25 times while an owner commits every few milliseconds.

Your transcripts stay yours

The copy is a full copy of your transcripts: it lives in a directory only you can read, is deleted after each read, on exit and on Ctrl-C, and a later run deletes copies a killed process left behind.

Read the measurements behind this

Supported versions

Tested against pi-durable 1.2.0, 1.3.0, 1.4.0 and the unreleased main. Each cell is a committed fixture, generated by the real release with pi-ai's faux provider (no model calls), in two states: closed cleanly, and right after the owner crashed (for SQLite, with its WAL still live).

pi-durable SQLite JSONL
1.2.0 schema v1 format 1
1.3.0 schema v1 format 1
1.4.0 schema v2 (sleeping tasks, restart counts) format 1
main (36be9c6, 2026-10-23) schema v2 format 1

The header of the page names the release range that could have written the store, such as pi-durable 1.2–1.3. Fields and kinds it does not know are shown as JSON rather than dropped. Table prefixes (pi-durable 1.3.0 and later) are tested with stores that the tests write themselves. IndexedDB, Cloudflare Durable Object, Postgres and CouchDB stores are not read.

Quick start

  1. durable-lens needs Node.js 22.13 or later and has no runtime dependencies. Try it on a store that a real pi-durable 1.4.0 wrote, which the repository includes:

    git clone --depth 1 https://github.com/dggc/durable-lens.git
    npx durable-lens durable-lens/fixtures/stores/1.4.0/sqlite/session.sqlite --restart-limit 3 --open
  2. Then point it at your own store: a SQLite file, or a JSONL storage directory (the one with main.jsonl). It is the path your harness passes to openNodeSqliteStorage(path) or openNodeJsonlStorage(path). It serves the page on 127.0.0.1.

    npx durable-lens ./session.sqlite
    npx durable-lens ./session --open
  3. Leave it running: the page rereads the store when the files change. Use --no-watch to read once.

  4. Script against the same normalized view the page uses. As a library, openLens(path) returns it and readStore(path) returns the raw records.

    npx durable-lens ./session.sqlite --json > session.json

Options

-p, --port <n>
port on 127.0.0.1 (default: a free one)
--open
open the page in your browser
--json
print the store as JSON and exit, without a server
--decoder <file>
module that decodes payloads an adapter encrypted or compressed; durable-lens never handles your keys
--prefix <p>
SQLite table prefix, when several storages share one database
--restart-limit <n>
the host's settings.restartLimit, to mark parked tasks (default 5)
--no-watch
read once; do not follow changes

The full list, the library API and the limits are in the README and the docs.