Architecture
Audience: someone changing the viewer or the session reading. Session reading (discovery, detection, parsing, summaries) is @rivus/agent-kit's; packages/server imports it at runtime to read sessions, and apps/cli imports only its redaction and Node platform entries at runtime. The kernel is the one other runtime importer, of the kit's import-free /cost and /cost/prices only (Cost). Other packages may use its types with import type, such as SessionSummary from @rivus/agent-kit/transcript and SessionRef ({ agent, path, sessionId? }) from @rivus/agent-kit/sessions. Trace names the agent agent everywhere, as the kit does: in SessionRef, the canonical Trace.agent, the wire rows, and the index.
Shape
agent roots
-> kit adapter.discover (head/tail, 64 KB each end) -> rows
-> session index (index.sqlite, trace id + size + mtime) -> cached numbers
-> kit summarize pass, 4 at a time, newest first -> summary updates
-> DevFrame list-sessions + shared state `sessions` -> session browser
agent log
-> kit session adapter (platform fs, onProgress, AbortSignal)
-> Trace { schema: estela, events[] with source pointers }
-> rpc TraceStore (traceId -> session catalog): last 3 traces, originals dropped
-> kernel toView / fold / reconstruct / projections
-> DevFrame load-trace (progress stream) + get-trace-view + get-event
-> Solid workspace: header, SVG timeline, virtualized ledger, inspector
one session (build <path>, or export-report on the dev server)
-> buildReport: view trace + summary + first events in full, always redacted
-> DevFrame static build baking report-trace
-> packForFile: one index.html (report JSON, script, styles, fonts inlined)
-> the same SPA in report mode, opened from file://events[] is the archive. Every event can return its original: the store keeps each event's source pointer and get-event(traceId, id) reads it again through the platform — a byte range in a plain file, the kit's reader for a compressed log or a SQLite row, which resolves the pointer to the decompressed offset or the stored record. The store records each source file's size and mtime at load and a fingerprint of each record (the whole stored record for a SQLite row); if the file changed since (a live session appends), the record read now must still match that fingerprint, else the event comes back with originalUnavailable and the reason. A canonical JSON file keeps originals inside the file, so get-event reloads it once per cached entry; a report decompresses a compressed log once for all of its events.
packages/server/src/sessions/conformance.test.ts runs the kit's sessionAdapterConformance for each builtin adapter on fixtures/sessions/<agent>/conformance. It holds the reading rules this viewer relies on: every input record becomes one or more events or one skipped entry with a reason, a second load gives the same event ids in the same order, every source pointer reads back its original, and a trace lists systemPrompt and toolSchemas exactly when its files record that content (every other capability means the agent records that kind of data, not that the session has any).
Event payloads and parsing
TraceEvent (packages/schema/src/types.ts) is the kit's TranscriptEvent, a union discriminated by kind, with the fields a view trace adds on each payload: $truncated, and systemPromptSameAs / toolsSameAs on system. The kernel and the web app narrow on event.kind and read typed fields; a field an agent adds of its own stays in the payload, read as unknown, and the Input tab shows it. Unknown data is parsed once where it enters, and the code after that reads typed values:
| Input | Where | Check |
|---|---|---|
| Agent records | kit adapters | the kit's zod/mini schemas; transcriptToTrace puts the kit's events into the Trace as they are |
| Canonical JSON file | packages/server loadSession | isTrace, every payload against its kind; a file that fails is read through the kit like any other file |
| View trace | kernel toView / fitView | assertTrace once on the view returned (not on every cap fitView measures); a view that is not a Trace throws |
| Report JSON | web shell/report.ts | the trace schema, the kit's SessionSummary, and the event detail; throws with the first issue |
| RPC inputs (browser) | each rpc handler | a zod/mini schema whose error texts are the messages clients see |
| MCP tool inputs | packages/server agent-tools/inputs.ts | one strict zod/mini schema per tool, also its advertised JSON Schema; errors name the tool and the field |
Index rows, caught errors, emitWarning arguments | runtime-node | one row schema per SELECT; z.object for errcode and EEXIST; Node's overload types |
| DevFrame dump files, package manifests | packages/server (dump files), apps/cli (package manifests) | zod/mini schemas |
The per-kind payload schemas are loose objects over the kit's declared fields. satisfies ties each one's output to the kit's payload type and payloads.test.ts checks that every payload of that type passes, so a declared field cannot drift from the kit's type and a required field the kit adds fails the type check. A new optional kit field passes both: the loose object keeps it, unchecked until the schema declares it. The schemas have no defaults or transforms, and callers keep the checked value through a guard rather than the parse output, so identity and key order stay as recorded and the canonical fixture loads equal to its file. Live RPC results are not parsed again in the browser: both ends ship in one tarball, and the server checked the value at one of the points above. Handlers parse their own input rather than through DevFrame's args option, which would advertise positional arg0 on the MCP surface (devframe#420). The MCP tools (below) are registered with ctx.agent.registerTool, whose inputSchema is generated from the same strict zod/mini schema that parses the call, so the advertised schema and the check cannot drift.
The index is a cache: a stored row whose head does not parse is deleted with its prompts and search row, and the next discover pass writes it again; a summary that does not parse is not served; a damaged context_shape loses only the shape. Walks over arbitrary JSON, where a schema per value costs too much (the source-record fingerprint, the view's string cap), use es-toolkit's isPlainObject and isPrimitive.
Session index and session catalog
packages/server/src/catalog/session-catalog.ts is the session catalog. For each builtin kit adapter it calls roots(home) and discover, stats each file for the cache key, and serves the rows through list-sessions. A root that does not exist yields an agent entry with count: 0 and the checked path. A file that discover or summarize cannot read is a row with error (reason, file, line). A root whose stat fails (an agent folder the process cannot reach) is such a row for the root, and so is a root the kit reports it cannot list; the other roots and agents are still listed, and the entry point says the root on the terminal. Two kinds of reader are exceptions to the second case. OpenCode, ZCode, and DimCode report a folder they cannot enter against its database file rather than the folder, so the row is made without the terminal line; a folder they can enter but not list costs them nothing, since they read that file directly. Kimi Code and Antigravity CLI report a folder they cannot read as empty, so neither is made. A failure that ends the pass is raised once every agent's pass has ended, so the roots that could not be read are all known by then. Claude Code subagent files are folded into their parent by the kit adapter.
Summaries run 4 at a time, newest activity first; list-sessions({ first }) moves the rows on screen to the front, and a file of 64 MB or more runs alone. Each summary is the kit's summarizeSession: the adapter's bounded pass when it has one (numbers and the main agent's user prompts for search, without holding the transcript), else the folded load. The prompts are the user's own: the kit's rule skips compact summaries, meta notes, slash-command wrappers, interruptions, and agent-injected text. Finished summaries are written in one transaction per batch and announced through the DevFrame shared state estela:sessions ({ revision, pending }); the browser then asks list-sessions({ since }) for the rows that changed. Search is list-sessions({ query }) and runs in the index; with --no-index, an unavailable index, or a busy one, the same substring rule runs in memory over titles and first prompts.
packages/runtime-node/src/session-index.ts owns index.sqlite ($XDG_CACHE_HOME/rivus-estela/, else ~/.cache/rivus-estela/, mode 0600) through node:sqlite: sessions (head fields, summary numbers, cache key), prompts (first 200 prompts, 500 characters each), and search, an FTS5 trigram table with one row per session. Queries of 3 or more characters use FTS5; shorter ones are a substring match over titles and prompts, with one JavaScript case fold (a registered casefold() function) on both sides, so Über and Добро match in any case. Each summary row stores the shell's INDEX_SUMMARY_VERSION = SESSION_SUMMARY_VERSION + HOST_ERA_OFFSET + INDEX_CONTENT_REVISION; a row from another version is recomputed. The components are defined in packages/server/src/catalog/session-catalog.ts. The index runs in WAL mode with a 200 ms busy timeout (node:sqlite is synchronous, so a longer wait would block the server): readers never wait for another process, and a write that cannot get the lock is skipped. The schema is created inside BEGIN IMMEDIATE, so several processes can open a fresh cache at once; a broken or other-layout file is rebuilt only by the process holding index.sqlite.lock; an index that cannot be opened (for example a read-only cache directory) is skipped with one warning. PRAGMA user_version records the layout; a different version or an unreadable file is deleted and rebuilt. On a second launch the rows come from the index at once and the discover pass reconciles them in the background. --no-index opens nothing. Because the first screen needs only discover and index reads, rows are meant to appear within 2 s even with thousands of sessions and gigabytes of logs. node scripts/check-budgets.mjs measures it on 5,000 synthetic sessions (Claude Code and Codex, about 190 MB), from process start to the first list-sessions response with every row: when the budgets were set, 1.0 to 1.8 s cold and 0.2 to 0.4 s warm on an Apple-silicon laptop. CI enforces generous ceilings for an order-of-magnitude regression on a slower runner, and fails a warm start that does not serve its rows from the index; the budgets and their reasons live in scripts/budgets/budgets.mjs.
A session is addressed by its trace id (traceId), a hash of agent and path. OpenCode list rows always include the session id, even when the database contains one session; open them with estela <path>#<sessionId>. Other agents include it when several sessions share one file (the path#id form), so a single-session file opened with estela <path> keeps its list-row trace id. On the command line a path or path#id string is parsed once into the kit's SessionTarget (parseSessionTarget); a discovered session is the kit's SessionRef. Titles, projects, and prompts in the list and the --pick labels are redacted like the workspace (home directories and token patterns) as the server's redacts option says (Server composition); the dev server passes false only with ESTELA_REDACT=0. The catalog keeps the trace id → target map and is the TraceStore's resolver: every list row resolves, and so does a session opened from the command line (by path or --pick), which also becomes current. URLs carry only the trace id (#/s/<traceId>). The CLI opens ?s=<traceId>, because DevFrame's one-time code takes the URL fragment; the SPA moves the id to #/s/<traceId> once its first connection attempt ends, whether or not it succeeds.
View trace, loading, and reconstruct
get-trace-view(traceId) returns toView(trace): no original, every string and key capped at 4,096 UTF-16 units (never splitting a surrogate pair) with the shortened paths in payload.$truncated as key/index arrays, source files interned in sourceFiles, and skipped merged per file and reason. fitView lowers the cap, in steps of 0.75, only when the view would exceed the 12 MB budget; the view records the cap in view.maxString, and view.withinBudget: false (also logged once on the server) when even the 256 floor does not fit. The workspace shows a notice when the cap is below 4,096 or the view is over budget. The view keeps each distinct prompt-snapshot system prompt and non-empty tool list once, on the first snapshot that has it; a later snapshot with the same content names that one in systemPromptSameAs / toolsSameAs and lists the field in payload.$truncated, so get-event returns it in full and reconstruct gives the same result on the view. Codex event ids are L<line> (one file per trace) to keep per-event overhead low.
Loading: the browser calls load-trace(traceId), subscribes to the load-progress stream with the returned id (bytes read of file size), then calls get-trace-view(traceId). It takes two calls because DevFrame rejects a subscription to a stream id that does not exist yet (DF0030). Loads are shared per session. Cancelling the stream, disconnecting, not subscribing within 5 s, or a newer load-trace from the same connection releases the hold; the last release aborts the load. That connection's get-trace-view rides on its hold; any other reader (another tab, an MCP tool) takes its own, so one browser's navigation never cancels another reader. Holds do not reach the loaded trace, so an evicted trace is collectable. Error messages leave the store redacted. traceId is opaque and resolved by the shell: on the dev server through the session catalog (the TraceStore's cache key is the trace id, so current and the launch session's list row share one entry); under mcp <path> and build only current resolves, keyed by the launch session's path#id string; mcp without a path runs the catalog like the dev server. The workspace route shows that progress (bytes read of file size), calls get-trace-view(traceId), and calls get-event(traceId, id) for the Raw tab and for the full text of a shortened event. DevFrame treats a closed client as final and never reconnects it, by design, so when the socket drops the workspace and the session browser say "Lost the connection to the Estela server" and offer Reload; a loaded workspace stays readable under that notice.
Projections, all pure over Trace: projectRequests (one entry per request, recorded numbers only), projectLanes (main lane plus one per subagent, with requests and prompt, failed-tool, and compaction markers), projectTurns (turns start at main-lane prompts; hook runs fold into one row; per-turn totals), and hiddenAfterCompaction (from shadowedBy). fold adds session summary numbers only for capabilities the agent declares.
reconstruct(trace, eventId) works on the event's lane (a subagent lane without a prompt record starts its turn at the lane start; its system prompt counts only if that lane records one). It returns the visible ids, the events a compaction removed, the slots (system prompt, tools, summary, messages, current turn) with present / empty / unavailable; when the trace has prompt snapshots (system events with type: 'prompt_snapshot'), the system prompt and tools come from the latest snapshot at or before the event on its lane (slot.recordedBy), and tokens[], the counts the agent recorded with the slots each covers: the request's input tokens, and the compaction's postTokens for the first request after it. It never estimates a slot and does not invent messages.
diffContext(trace, firstId, secondId) (packages/kernel/src/context-diff.ts) compares two reconstruct results of one lane, from the earlier event to the later: per slot the event ids added, removed, and unchanged (a slot unavailable on either side is not compared), the events that entered and left the context, compacted (the later result's removedIds minus the earlier one's: exactly the events a compaction between them hid through shadowedBy), the lane's compactions between them, the system prompt and tool list compared by content (following systemPromptSameAs / toolsSameAs in a view; a value the view cut is never called equal by its text; tool names come from { name } or { function: { name } } definitions, else they are reported as not recorded), and the delta of the recorded input tokens when both are recorded. A pair on different lanes is rejected (different-lanes): each lane is its own conversation. Agents record one input-token total per request and, at a compaction, the totals before and after it, but no split by slot, so neither the diff nor the workspace shows a per-slot token split: one would have to be estimated from text length. The timeline's bar heights are the recorded totals over time, and the diff counts events per slot, labeled as events (Compare).
The reconstruct RPC takes { traceId?, eventId }; without a trace id it reads current, the launch session. Its result is presented (redacted) like get-event. It is not an agent tool: estela_reconstruct is one of the MCP tools below.
Packages
| Package | Role |
|---|---|
packages/schema (@rivus/estela-schema) | Canonical Trace (schema: 'estela'), kinds, capabilities, shadowedBy, event payload types built on the kit's, and the zod/mini schemas that check JSON traces |
packages/kernel (@rivus/estela-kernel) | canonical-file head check, SessionFs read shape, fold, reconstruct, diffContext, toView / fitView, projections, list-price cost |
packages/runtime-node (@rivus/estela-runtime-node) | home directory, session index (node:sqlite) |
packages/rpc (@rivus/estela-rpc) | list-sessions over an injected session service; load-trace, get-trace-view, get-event, reconstruct over TraceStore with an injected resolver; export-report over an injected writer; buildReport; report-trace, registered only in DevFrame's build mode |
packages/server (@rivus/estela-server) | createEstelaCore (./core): the DevFrame-free hardened platform, TraceStore over Node reads, and redaction without the session catalog; createEstelaServer: adds the session catalog, per-instance RPC definitions, the report writer, the MCP agent tools (src/agent-tools/), and the DevFrame definition whose setup registers and starts them; session reading through the kit |
apps/web (@rivus/estela-web) | Solid SPA: hash routes #/ (session browser) and #/s/<traceId> (workspace), report mode, <estela-workspace> custom element (./embed), design tokens, en / zh-CN dictionaries |
apps/cli (@rivus/estela) | The command line, terminal output, browser opening, and the ATIF and OTLP exports; starts dev, build, and mcp from createEstelaServer; published as @rivus/estela |
apps/dsh-plugin (@rivus/dsh-estela) | DeepSeek Harness plugin: host half (src/host/) over createEstelaCore, client half (src/client/) over <estela-workspace>, channel contract (src/contract/), manifest and cordis.patch.yml, and the two bundles (dist/host.mjs, dist/client.js); published as @rivus/dsh-estela |
apps/e2e (@rivus/estela-e2e) | Private: CLI smoke and Playwright suites against the installed tarball |
Server composition
createEstelaCore(options) (packages/server/src/core/estela-core.ts, exported at @rivus/estela-server/core) builds the DevFrame-free core of one instance without the session catalog: the hardened platform, the TraceStore (reading from @rivus/estela-rpc/trace-store), seed, and a text redactor that follows redacts; the entry also exports traceIdOf for hosts that make their own keys. createEstelaServer(options) (packages/server/src/composition/estela-server.ts) wraps createEstelaCore with the session catalog, per-instance RPC function definitions, a session publisher, and a report queue, and returns the DevFrame definition that registers and starts them. The options are the package's identity and built SPA (app), the platform (reads, home directory, environment; the Node platform by default), the catalog ({ index } on the dev server and mcp without a path, absent for mcp <path> and build), the launch session target, the redaction flag (redacts), the report directory (reportDir, optional), and a log line sink for the TraceStore's warnings. In dev mode the definition's setup loads the launch session and makes it current, starts the catalog, resumes the catalog's summaries, registers the MCP agent tools on ctx.agent, and binds the instance's session publisher to shared state; in build mode (a report) it registers the functions only. Each step runs once: the CLI runs the launch load, the catalog start, and --pick's open before the server listens, to show its spinner, index progress, and picker, and setup then finds them done. A DevFrame host that runs only setup gets the same server. Each server closes over its own services, publisher, and report queue, so several instances can coexist in one process. apps/cli/src/server.ts fills in app from the published package (its name, version, and dist/web/); dev, build, and mcp all start there. The factory and its modules throw their own errors; apps/cli/src/entry/failure.ts maps them.
redacts is the one switch for session text: what the trace RPCs return, and the titles, projects, and prompts of list rows and --pick labels. No server code reads ESTELA_REDACT; each entry point computes the flag (apps/cli/src/entry/app.ts): the dev server passes false only with ESTELA_REDACT=0, and mcp and build pass true. Whatever the flag says, reports, MCP tool results and errors, a row's working directory and read errors, the roots that were checked, and the index's own failure reason stay redacted (Trust).
close() stops the catalog before it closes the index: the summaries that wait never run, one still running ends with its result dropped (no index write, no flush timer, no session push). A caller of whenIdle() that waits for the summaries resolves at once; one that waits for the discover pass, which close() does not stop, resolves when that pass ends. Call it after the server stops.
MCP agent tools
packages/server/src/agent-tools/ holds the tools listed with their inputs, results, bounds, and errors in the MCP tools reference: estela_list_sessions, estela_search_sessions, estela_session_summary, estela_list_turns, estela_list_requests, estela_get_event, and estela_reconstruct. registerAgentTools registers them on DevFrame's agent host in the definition's setup (the list and search tools only with a catalog), as ids estela:<name>; DevFrame's MCP adapters serve them as estela_<name> over stdio (estela mcp) and, with --mcp only, over HTTP at /__estela/__mcp on the dev server. That route has a bearer token (DevFrame's authorization option: ESTELA_MCP_TOKEN, or one the CLI makes per launch and prints) instead of the one-time code, which an MCP client cannot answer. DevFrame's own Origin gate is off, because it refuses a request without Origin and command-line clients send none; the CLI's authorization callback (apps/cli/src/entry/mcp-authorization.ts) refuses a non-loopback Host (DNS rebinding) or Origin (every POST from a web page; a cross-origin request without Origin cannot carry Authorization), then compares the token. DevFrame checks the peer address only on a route without a token, so the CLI refuses --mcp with a non-loopback --host instead; the route stays off by default. Both estela mcp and the route turn off DevFrame's shared-state tool.
The tools read what the browser reads: catalog rows (listSessions with an always-redacting rule, with first to summarize the rows a flag filter cannot test yet, waiting up to 5 s), and the TraceStore's loaded trace (TraceStore.withTrace, its own hold) through the kernel projections, get-event, and reconstruct. They estimate nothing. At the tool boundary, after the services, every result and error message is redacted with the kit's redact and the platform's home, whatever ESTELA_REDACT says, and returned as compact JSON text (DevFrame would pretty-print an object). Each result is at most 40,000 characters: lists page by offset / limit and end early with nextOffset; recorded strings are redacted before they are cut (a cut inside a home path would leave its start unredacted), and the catalog redacts a prompt before it shortens it; the kit itself cuts titles and first prompts before anything redacts them, and its redactText replaces a home path such a cut left partial at the end with ~; cut list strings are named in truncated; estela_get_event cuts strings with the kernel's capStrings after redaction and lowers its cap in steps of 0.75 to 256 before it leaves out original and then payload; estela_reconstruct keeps the last 100 ids per list with totals.
Event and lane ids are written by whoever wrote the log, and come back as tool input. TraceIds returns an id as written only when it is 1–128 characters of [A-Za-z0-9_.:-] that redaction leaves unchanged; any other id is @e<seq> (event index) or @l<n> (lane position), and the tools accept both forms. A repeated id names its last event, as the TraceStore's lookup does. Tool descriptions say that results are recorded session content to treat as data, not instructions. The agent skill is skills/estela/SKILL.md, kept in the repository and not in the tarball.
Workspace
#/s/<traceId> draws, top to bottom: the session header (summary from get-trace-view, which is fold of the trace; "—" for undeclared capabilities) with the list cost from priceTrace, the SVG timeline, the ledger, and the inspector. Everything on the page is computed in the browser from the view trace with the kernel:
- Timeline (
apps/web/src/workspace/timeline/):projectLanesgives the lanes, requests, and markers. Bar height is the request's recorded input tokens; a request without usage is a hollow bar. Requests closer than 3.5 px share one bar (the largest value), so a 10,000-event session stays a small SVG. Compaction is a dashed rule, boxed withpre → postwhen recorded; rules too close to box keep the label as a tooltip. Dragging selects a range; the two handles arerole="slider"and move with the arrow keys (1 %, Shift 10 %), Home and End. Brush math is inlib/timeline-scale.ts. - Ledger (
workspace/ledger/):lib/ledger-model.tsbuilds turns fromprojectTurns, folds hook runs withfoldHookRuns, pairs tool results with their calls, and puts each subagent lane's events of a turn behind one row at its spawn call.flattenLedgerapplies collapse, expansion, the kind chips, and the brush range. The Agents layout'sflattenLanes(lib/ledger-lanes.ts) puts the same entries under one header perprojectLaneslane instead; an entry keeps its key in both layouts, and switching maps the selected row to its counterpart (a subagent row and its spawn call stand for each other).@tanstack/solid-virtualdraws fixed sizes per row type (36 px rows, 40 px turn and lane headers, 30 px hook fold, 44 px compaction), so the DOM holds about 40 rows at any scroll position. The dim toggle useshiddenAfterCompaction. - Inspector (
workspace/inspector/): Input and Output show normalized fields; a shortened event (payload.$truncated) loads its full text throughget-eventon selection. Model saw is kernelreconstructon the view trace: slots with their status, the recorded token counts with the slots each covers, and the removed events. Compare is kerneldiffContextbetween the selected request and another request of its lane (lib/context-compare.tspicks the previous request by default, offers "Before the last compaction" when a compaction precedes it, and takes a Shift-click on a timeline bar, which the timeline then draws with a dashed ring); slot changes are event counts, the token numbers are the recorded input tokens and each compaction's pre → post. The inspector tab and the compare pick live in the workspace state, so the timeline can open the tab. Raw isget-event's original record.
A failed load shows the reason, the agent, file, and line when the error names them, a retry, and a link back to the session browser. The timeline and the session browser's context shape are SVG drawn from kernel projections; there is no chart library.
The theme follows prefers-color-scheme until the user picks dark or light, which localStorage keeps (apps/web/src/shell/theme.ts). The UI is English or Simplified Chinese (apps/web/src/i18n/locale.ts): zh-CN when the browser's first preferred language starts with zh, else en; a manual switch is kept in localStorage, and <html lang> follows the active locale. Dates, times, durations, and numbers go through apps/web/src/lib/format.ts (Intl for the locale); token counts keep the k and M abbreviations in both languages. Session content is shown as recorded and never translated.
Cost
priceTrace(trace, pricing) (packages/kernel/src/price-trace.ts) prices every request event with the kit's priceRecord and returns per-request costs, the trace total, and one total per lane; costOfEvents sums a turn. snapshotPricing() (snapshot-pricing.ts) is the kit's LiteLLM snapshot (litellmPrices, litellmPricesVersion) as a lookup, built on first use so a bundle that never prices drops the table. The kernel imports these two kit entries at runtime because they import nothing; the web app gets them through the kernel, which puts about 55 KB (8 KB gzip) into the web bundle, and the file:// report prices the same view trace the same way with no server.
A request is priced only when every part of it (one per model when the agent splits an aggregate by model) records input and output tokens, names a model, and that model has a price; otherwise it is unpriced with the first reason that applies (no-usage, incomplete-usage, no-model, no-price, with the models). A request that records 0 input and 0 output tokens costs $0 whatever its model. A missing granularity counts as one request, as the adapters write it, so the long-context tier applies per request. A CostTotal keeps the priced sum (usd absent when nothing is priced, never 0), the unpriced counts by reason, the token-class shares when every priced request has them, and the cache hit rate (cache reads over input tokens across requests that record both). Shares come from the kit's own price: with a part's input fixed (so the tier is decided as for the whole part) the cost is linear in each class, and three probes give the input, cache-read, and cache-write rates; the shares add up to the kit's total.
The workspace shows the total in the header (label: hit rate, or "N of M requests unpriced", or the reason when nothing is priced; the tooltip names the snapshot and the shares), per turn in the turn header, per lane in the Agents layout's lane header, and per request in the inspector. Amounts go through formatUsd (two significant digits below a cent, <$0.0001 below that). The cost is the list price of recorded tokens, not a bill. A request's pricingMultiplier (2 on Codex's priority tier, which the kit reads from the rollout's thread settings) multiplies it, since that tier's list price is the multiple. An amount an agent logged itself (opencode, Pi, Grok, ZCode) is not applied: only the kit's usage decoders report it. DimCode's request events do carry its logged amount (costUsd); the kernel does not read it, so DimCode is priced the same way. A request is priced from its billed fields alone (model, usage, granularity, modelCalls, usageByModel, pricingMultiplier), so the session browser prices a session from the fields the kit's bounded summary pass returns (requestUsage), which equal the loaded transcript's request events, with the same rule (priceRequestUsage), and its total matches the header's. index.sqlite stores that cost with the snapshot version; a summary priced at another snapshot is summarized again.
toAtif(trace, { pricing }) writes metrics.cost_usd on each step whose request is priced, final_metrics.total_cost_usd only when every request of that trajectory's lane is priced (for the root: the whole trace, subagents included, as ATIF defines it; requests a compaction hid count though they produce no step), and extra.estela.pricing = { version, unpricedRequests } on the root; export-atif passes snapshotPricing(). The OTLP export has no cost attribute to fill in the pinned semconv and stays unchanged.
Report
A report is one session's workspace as a static page that opens from file:// with no server. build <path> --out-dir <dir> and the workspace's "Export report" (export-report(traceId, locale)) run the same pipeline in packages/server/src/report/report.ts:
buildReport(packages/rpc/src/report.ts) takes the view trace and summary asget-trace-viewreturns them, and the full events (payload and original record) of the first events in order, until 2,000 events or 20 MB of serialized events, whichever comes first. Everything passes throughredactwith the home directory, whateverESTELA_REDACTsays.buildtakes the full events from the trace it already loaded (the file is read once); the export reads them throughTraceStore.withEvents, which reads source pointers a few at a time, or reloads a canonical file once for the whole report.- DevFrame's
createBuildruns the definition'ssetupin build mode, which registers one extra argument-free snapshot query,report-trace, bound to that payload, and bakes it into__rpc-dump/. Build mode skips the session push, so an export inside the dev server leaves the live server's shared state alone. Exports run one at a time; each creates its own newestela-report-<traceId>-<time>directory under the server's report directory (reportDir; the working directory when the server was given none) before writing, and its error message is redacted before it reaches the browser. A plainmkdirclaims the name, so a taken one gets-2,-3, … and nothing is written into a directory that was there; that is why the export needs none of thebuild --out-dirrules in Trust. packForFile(packages/server/src/report/report-site.ts) makes the build open from disk. Chromium refusesfetch(), module scripts, and fonts fromfile://, so the bakedreport-traceoutput moves intoindex.htmlas<script type="application/json" id="report-trace">, the module script (the web build is one chunk; any other script fails the build) and the stylesheet are inlined (woff2fonts as data URIs), andassets/,__rpc-dump/, and__connection.jsonare removed. The result is a singleindex.html.
The SPA starts in report mode when it finds that element (apps/web/src/shell/report.ts): no DevFrame connection, no session browser, no Export button. The workspace reads the view trace from the report; get-event becomes a lookup in the included events, and any other event shows its view with "not included in this report" in Raw. Model saw and Compare run reconstruct and diffContext in the browser as on the dev server. A banner says that session text and file contents remain, and how many originals are included when the report holds fewer than all events. The report opens in the UI locale recorded at export time (build records none, so the browser's language decides) and keeps the language and theme switches.
Exports
export-atif <path> [--out <file>] and export-otlp <path> [--out <file>] (apps/cli/src/export/write-export.ts) load a session once and write one file: an ATIF v1.8 trajectory (toAtif, packages/kernel/src/export-atif.ts) or an OTLP/JSON ExportTraceServiceRequest (toOtlp, packages/kernel/src/export-otlp.ts). Both projections are pure functions over a checked Trace with no node:* import; the CLI redacts and writes. Both mappings are listed field by field in Export formats. ATIF: one step per user event, per requestId group, and per compaction (a system step with extra.context_management), subagent lanes as embedded subagent_trajectories referenced from the spawn step, fields ATIF has no place for under extra.estela with the canonical event ids. OTLP pins the semconv version named by OTLP_SEMCONV_VERSION (gen-ai-dev/1.42.0-dev; the GenAI conventions have no release yet, so a new pin is a deliberate change): one invoke_agent span per lane, one chat span per request with the gen_ai.usage.* counts and the model-visible surface from reconstruct as gen_ai.input.messages / gen_ai.output.messages / gen_ai.system_instructions / gen_ai.tool.definitions, and one execute_tool span per tool call. An ATIF export of a trace with nothing a step can hold (no user, agent, or system-prompt content) fails with that reason, and an ATIF export leaves out a subagent lane with no exportable events, its spawn ref with it. Exports are redacted like the server unless ESTELA_REDACT=0: a dataset or a tracing backend may need the unredacted bytes, so unlike a report an export can opt out. node scripts/validate-exports.mjs exports every agent's fixtures and runs Harbor's validator (uv run --python 3.12 --with harbor); it needs uv and the network, so CI runs only the structural ATIF check in apps/cli/src/export/write-export.test.ts.
Bundle
apps/cli builds with vp pack into dist/bin.mjs (Node version check, then a dynamic import) and dist/cli.mjs (the CLI with every @rivus/* package bundled; devframe and @devframes/agentic stay runtime dependencies). The web build is copied into dist/web/, and src/paths.ts finds it there through the build-time constant ESTELA_BUNDLE. The web bundle includes zod/mini and the trace schemas for the report check (about 8 KB gzip) and the kit's pricing and LiteLLM price snapshot (about 8 KB gzip). node scripts/check-budgets.mjs checks the sizes against the budgets in scripts/budgets/budgets.mjs. When the budgets were last set, the web JS and CSS were 426.1 kB raw and 124.2 kB gzip, dist/cli.mjs 1,023.6 kB, and the packed tarball 654.7 kB; the same check opened a 100 MB Codex session to its get-trace-view in 0.5 to 0.9 s with a peak RSS of 400 to 500 MB. apps/e2e tests the packed tarball from outside: test:smoke (CLI, S2, S10, S13, S15, S16, and the MCP tools' S17 and S18) and test:e2e (Playwright, the browser scenarios).
Terminal
apps/cli/src/entry/ is the CLI's entry layer. routes.ts declares every command and option for @bomb.sh/router, which parses the command line once and rejects any token a route does not take before a session is read; app.ts hands the selected route to one module in commands/ (dev.ts, build.ts, mcp.ts, export.ts), and failure.ts maps each expected failure to its message, fix line, and exit code (1 for every failure). Only entry/ reads the command line, writes to the terminal, opens the browser, and sets the exit code; export/ and packages/server throw their own errors. The dev server starts through DevFrame's createDevServer and mcp through its createMcpServer, both on the definition from createEstelaServer. In a terminal the CLI draws with @clack/prompts (apps/cli/src/entry/ui/terminal.ts, index-progress.ts): a start line with name and version, index progress per agent, a load spinner, the build steps, the URL in a box when it fits the terminal width (an OSC 8 link where the terminal supports it) and otherwise one Ready: <url> line, and errors as the cause plus one line on how to fix it. When stdout is not a terminal or NO_COLOR is set, the same moments are plain lines, and escape sequences are stripped from every line, DevFrame's own [devframe] lines included (they print color codes even with NO_COLOR). mcp writes only protocol messages to stdout and everything else to stderr. --pick without an interactive stdin exits 1. CLI and MCP output are English only.
Trust
Session files stay on disk. The dev server binds localhost. The index holds titles, user prompts (500 characters each), paths, and numbers, in the user's cache directory with mode 0600. build, "Export report", and every MCP tool result and error always redact (home directory and token patterns), whatever ESTELA_REDACT says; a report still holds session text and file contents, and says so. The ATIF and OTLP exports are redacted like the server, with ESTELA_REDACT=0 writing the unredacted bytes. Redaction is the kit's (@rivus/agent-kit/redact, imported by packages/server and apps/cli): it replaces the home directory wherever it appears in a string (also inside a/<home>/… in a git diff header), without its leading / (Users/<name>/…), JSON-escaped (\/Users\/<name>), and in Claude's dash slug and Grok's %2F form, ignoring case, in values and keys; a longer name (/Users/<name>x, /Users/<name>.bak) stays. Its token patterns are a fixed list of prefixes (sk-, AKIA/ASIA, GitHub, Slack, npm) and PEM private keys; other secret shapes pass through, and the user docs say so (Privacy). The server hides two homes when they differ (packages/server/src/sessions/redaction.ts): the platform's home (platform.home: the agent roots, the index, and what a session recorded, such as a working directory, a title, or a prompt) and the process home (os.homedir(): what the server itself produces, such as a report build's error message or an export path, and what a session recorded of the server user's paths). The CLI's platform home is the process home, so its output goes through once. build --out-dir replaces an existing directory only when it is empty or holds an earlier Estela report (refusing /, the working directory, the home directory, symlinks, non-directories, and other non-empty directories before DevFrame's createBuild removes it); "Export report" always creates a new one. The dev server redacts the view trace, get-event, error messages, and list rows alike, unless ESTELA_REDACT=0. Do not put machine paths or live secrets into fixtures.
Compatibility
Public interface lists what semver covers and what it does not. The canonical trace file format, the index, the RPC between the bundled server and web app, and the workspace packages' exports are not stable: they change in place, with no compatibility layer or reader for an older shape. Names from before the rename to Estela (@rivus/agent-trace, AGENT_TRACE_*, schema: 'agent-trace', the rivus-agent-trace cache) are not read; they remain only in the released apps/cli/CHANGELOG.md entries, .changeset/ledger.yaml, and the v0.1.0 tag.
@rivus/estela exports no programmatic API: createEstelaServer and createEstelaCore are reachable only inside the workspace.
Out of the current viewer
Not built: the ⌘K jump palette (the Go to events button only focuses the ledger) and a composer overlay.
Not supported:
- agents outside the supported agents;
- live follow of a running session, and editing or replaying a session;
- search over session content beyond titles and the user's prompts;
- amounts an agent logs itself (Cost);
- a per-slot token composition over time (Workspace);
- an MCP tool for the context diff or for cost;
- UI languages other than English and Simplified Chinese;
- accounts, upload, or a hosted service.