Lameh AI · Specula · AI financial research

A read path for a workspace that never stops writing.

Specula keeps a research workspace open and inspectable while agents are still working in it. The engagement: make every read fast and correct while the harness keeps writing, without changing the harness.

Client
Lameh AI
Scope
Read path · live events · rollout
Stack
FastAPI · GCS · Memcached · SSE · PostHog
Out of scope
Harness and Temporal runtime

01 · Context

The work product is visible while it’s being made.

A Specula session has a root question and a graph of nodes: each with an owner, a status, dependencies, a workpaper and evidence pointers, sometimes a chart. Specialists write workpapers while a scheduler settles dependencies. All of it mirrors to object storage, and the browser renders it as a live graph, a final report, a file tree and a deck.

Every view was assembled from storage on demand. First paint waited on listings, open sessions polled, and large files hydrated whether anyone looked at them or not, all while the harness kept writing underneath.

02 · Constraints

Six rules the read path had to keep.

  • Don’t touch the harness

    Reads fit the existing writer, its workspace layout and its durable runtime.

  • Access before bytes

    Organisation and conversation access is checked before any cached or persisted data returns.

  • Generations are truth

    A stable object name with a new generation invalidates everything derived from its bytes.

  • Bounded everything

    Per-process memory and mirror disk have budgets; eviction means recompute, never loss.

  • Slow reads can’t block

    A long download must not hold a session-wide lock while newer reads wait.

  • Keep an escape hatch

    The legacy path stays available, per organisation, until the new one has earned trust.

03 · Design

Versioned views, served from a mirror, announced by events.

harness writesplatform teamworkspaceobject storage · generationslist generationsmiss → sync changedfingerprint · ETagencoded cacheread mirrorread pathfingerprint · cache · mirror200 · 304client viewsgraph · final · files · deck
  • client viewsgraph · final · files · deck
  • read pathfingerprint · cache · mirror
  • workspaceobject storage · generations
Fig. 3 — Three planes. The workspace changes underneath; the read path fingerprints each view from object generations and syncs only changed files into its mirror; clients fetch a view only when its version moves.
InterfaceClient use
Snapshot · graph · finalFirst paint and targeted refresh, with validators and version checks.
Batch nodes · warmFetch selected node detail together; warm a snapshot before a session opens.
Deck thread · messagesLocate the deck conversation and page through its messages.
EventsA shared watcher emits versions and run state; data is fetched separately.

04 · Decisions

Every choice, with what it cost.

DecisionWhyCost
Fingerprint views from object generationsCheap to derive from listings; correct across rewrites of the same name.Listing freshness bounds staleness.
Two-tier encoded cacheA bounded process LRU in front of shared Memcached reuses encoded responses across processes.Keys must carry every visibility dimension.
Isolated read mirrorRead projections without touching the harness workspace.Disk budget and concurrency control.
Generation-pinned lazy filesLarge files hydrate only when opened.A separate validation path for hydration.
Release the lease before bytesNewer reads proceed during slow downloads.A download serves its pinned generation.
Versions over pollingThe browser fetches only views that changed.The watcher interval sets a latency floor.
Cache positive ownership, not streamsLower read latency for repeat access.A bounded revocation window on reads; streams re-check.

05 · Rollout and failure

Flagged by organisation, tested by breaking it.

Capability flags

Fast reads
Legacy-route optimisation
Read API
Versioned snapshot, graph, final
Lazy files
Generation-pinned hydration
Live events
Shared watcher + SSE
Frontend switch
Client adopts the new path

Evaluated per organisation; code defaults off.

Failure cases tested

Slow PDF during a node change
The download keeps its original generation; the graph read sees the new version.
Bucket failure, warm mirror
Stale data is served only with an explicit signal, under a defined fallback policy.
Revoked access
Stream admission and renewal re-check access; cached positives expire on a bound.
Finished graph
Skips unnecessary workflow queries entirely.

06 · Measurement

What gets measured before anyone claims it’s faster.

  • Server-Timing phases

    Listing, sync, encode and serve, per request.

  • Mirror counters

    Listings and downloads per session open.

  • Cold vs warm

    First paint and reconnect on a real session.

  • Acceptance journey

    Open, follow progress, reload, open a citation, verify the save.

Scope, stated plainly: the read path, live events and rollout were this engagement. The harness, the research graph and the durable runtime belong to the platform team; the read path was built to fit them unchanged.

Have a workspace that slows down as it fills up?

Start with a two-week architecture review of one journey.