Projects.How each one works.

VESTIGE.GO

Production AI agents fail in ways unit tests don't catch: a prompt edit changes tone, a tool call returns something unexpected, and nobody notices until a customer does. Vestige instruments every LLM call, tool call, and transitive HTTP request in an agent run via OpenTelemetry, then lets you promote any recorded run into a regression test. Replay reconstructs that failure from content-hashed fixtures instead of live model calls, so a full test suite re-run costs nothing and never touches a real provider. Replays run in a Docker sandbox with no network, a read-only filesystem, and none of the worker's credentials. A GitHub Actions gate runs this on every pull request and blocks the merge on regression, and when an output changes, an LLM judge tells the reviewer whether it is a rewording or a real difference without ever passing the test itself.

Go ingest takes 30K+ agent spans/sec and lost none of them through a ClickHouse outage

Replays a 50-span agent failure from recorded fixtures in under 5s, with zero model calls

Gates PRs on replayed regression tests in a no-network sandbox, with a 100-pair test proving tenants stay isolated

PIPELINE.LOG
how it works
  1. Capture

    OpenTelemetry SDK

    Auto-instruments OpenAI and Anthropic calls via OTel GenAI semantic conventions and patches httpx/requests at the transport layer to capture every hidden HTTP call inside a tool function, the signal that makes replay possible at all.

  2. Ingest

    Go + ClickHouse

    A Go OTLP receiver normalizes spans and writes them to a ClickHouse schema partitioned by day and ordered by trace for fast single-trace reads. Concurrent requests share grouped inserts, which about doubles throughput at 32 senders (roughly 30,000 spans/sec on a laptop). A write-ahead log covers database outages: stopping ClickHouse for 15 seconds mid-run lost none of 229,800 acknowledged spans.

  3. Promote

    content-hashed fixtures

    Any recorded trace can be frozen into a regression test. Every external request/response pair captured during that run is content-hashed and stored, forming a deterministic manifest keyed by request hash.

  4. Replay

    pg-boss worker + Docker sandbox

    A Postgres-backed job re-runs the agent with the same code path, but every outbound call is intercepted and served from the recorded fixture by hash instead of hitting a real model. The agent runs in a container with no network and a read-only filesystem; the worker mounts the fixtures in and forwards the spans it buffered to disk. Zero LLM calls, zero cost.

  5. Diff & gate

    GitHub Actions + LLM judge

    The replayed output is canonicalized and compared to the original by hash, with a token-level diff for the reviewer. A GitHub App posts a check on every pull request and blocks the merge if any promoted test regresses. The judge only explains a change; it never turns a failure into a pass.

vestige / replay trace

SELECT REGRESSION

↑ pick a regression to trace the replay

RATE_CASE.PDF

A single rate case is hundreds of PDFs and tens of thousands of pages: pre-filed evidence, interrogatories from intervenors and OEB staff, the utility's responses, settlements and decisions. Answering "what is the utility proposing and why" means finding the right exhibit, tab, schedule and page and quoting it exactly. This project ingests whole cases, retrieves at page level, and answers with an agent that must cite pages it actually read or say the evidence isn't there. The eval takes its ground truth from the case itself: the utility's interrogatory responses point to the evidence that answers them, and a leakage control keeps those responses out of the index, since without it the answer is in the top 5 for 66% of questions. It runs locally, since it needs the ~1.2 GB of downloaded filings, Postgres, Temporal and a Claude login; the results, transcripts and a demo recording are committed to the repo.

Ingests two full rate cases, 340 PDFs and 41,867 pages from Toronto Hydro and Hydro One, through a Temporal workflow into Postgres + pgvector

On 470 questions taken from the utility's own interrogatory responses, the cited section is in the top 5 for 68% of questions against 16% for random chunks

On 20 held-out questions the agent cited the section the utility itself cited for 18, and made 0 citations to pages it never retrieved

PIPELINE.LOG
how it works
  1. Crawl

    OEB RDS JSON API

    Lists each case through the regulator's document search API and downloads every record through one polite fetcher: at most one request every 1.1 s per host, every response cached on disk. RDS silently truncates large files by exactly 80 KiB, so files are fetched in 8 MiB ranges and the total must match the size the server reports.

  2. Ingestion

    Temporal workflows

    One child workflow per document runs download, parse and chunk, then embed. Each activity is idempotent, so re-running a case skips finished documents, and network-bound and CPU-bound work run on separate task queues so a slow download never blocks parsing.

  3. Parse & Chunk

    PyMuPDF + pdfplumber

    Extracts text per page and turns each page's header block (Exhibit / Tab / Schedule / Page) into its citation. Chunks follow headings, target 500–800 tokens, never cross an exhibit boundary, and keep their page range; embeddings use bge-small locally.

  4. Retrieval

    full-text · vector · hybrid (RRF)

    Postgres full-text search, cosine search over pgvector, and reciprocal rank fusion of the two. Utilities re-file updated exhibits, so 16% of Toronto Hydro's chunks are verbatim copies; exact and near copies are collapsed so re-filings don't crowd out other passages.

  5. Cited Agent

    Claude Code headless + MCP

    The agent's only tools come from an MCP server: search, fetch_page, and read-only SQL over two table views. Every claim must carry a citation token copied from a tool result, and tokens are checked against the pages the agent actually saw.

  6. Figure Check

    source panel

    If none of a claim's figures appear on the cited page, the UI says so and checks the pages on either side. It caught off-by-page citations the citation check alone passed, such as p. 92 instead of p. 94 in Toronto Hydro's capital expenditure plan.

  7. Evaluation

    interrogatory-based IR eval

    470 labelled questions parsed from the utility's interrogatory responses, scored at section/schedule level against random-chunk and label-prior baselines. Retrieval runs on pre-filed evidence only, record locations are stripped from the questions, and an ablation shows what the leak would do.

oeb / citation check

SELECT ANSWER

↑ pick an answer to follow its citations

LEASES.SQL

Contributors record scripted audio in the browser, and each script should get exactly one good recording, so while someone is recording a script nobody else may get it. But a browser can vanish at any moment without telling the server, so a held script has to come back on its own. Every claim is a lease with a fresh claim token, taken in one atomic FOR UPDATE SKIP LOCKED statement; the browser heartbeats to extend it, and expired leases count as free inside the claim query itself, so recovery never waits on a background job. The claim token is a fencing token: heartbeat, upload and submit all have to present it, so a stale tab can't touch a script that is now someone else's. After submit, QA workers check the audio and transcribe it with whisper.cpp to confirm the contributor read the right sentence, and an /ops page draws every recent lease as a timeline with heartbeat ticks and how each one ended.

0 scripts handed out twice across 7,267 leases while 300 simulated contributors closed tabs, refreshed, opened second tabs and stalled

Handing out never-held scripts first cut contributor time lost to rejected late takes from ~93 to ~13 hours per 3 simulated hours

A local Whisper check rejects 90% of wrong readings and wrongly rejects 0.6% of correct ones; QA as a whole leaves 3% of takes for a person

PIPELINE.LOG
how it works
  1. Claim

    FOR UPDATE SKIP LOCKED

    One atomic statement picks a free or expired script in the contributor's language and leases it with a new random token. SKIP LOCKED means concurrent claimers each take a different row instead of queueing on one. Never-held scripts go first, which gives a stalled contributor's expired script time to come back.

  2. Heartbeat & Expiry

    lease_expires_at + Postgres now()

    The browser heartbeats every 30 s to extend a 10-minute lease. Tab-close events are unreliable, so lease expiry is the real guarantee; every time comparison uses the database clock, never the browser's.

  3. Fencing

    claim token

    Heartbeat, upload URL and submit must present the token. A refresh or second tab gets the same script and token back; a contributor back from a long stall gets theirs revived if nobody took it, and is fenced off with a 409 if someone did.

  4. Upload & Submit

    presigned PUT + partial unique indexes

    Audio goes straight to object storage, then submit copies it to a key no URL can write and marks the script submitted. Submit is idempotent per token, and the database itself enforces one claimed script per contributor and one live recording per script.

  5. Automatic QA

    whisper.cpp + audio checks

    Workers check length against the script's expected reading time, silence, level, clipping, padding, cut-off endings and duplicate audio, then compare a Whisper transcript with the script by character error rate. Clear passes and fails skip the human; borderline takes go to review.

  6. Ops & Simulation

    /ops lease timeline + 300-contributor sim

    The ops view recomputes "handed out twice" from the audit log every 1.5 s and draws each script's leases with heartbeat ticks. The simulation drives the real HTTP API at 60x time with seven contributor behaviours, from tab vanishes to double submits.

script #412 / lease timeline
t = 0 min · lease 10 min

PLAY A SCENARIO

contrib A
contrib B
0m10m20m30m40m

↑ play a scenario, or claim, heartbeat and advance time yourself

MACHINE.TS

Barge-in is one of the hardest parts of a real-time voice agent: the first words of the interruption get dropped, the greeting replays, timestamps come from the wrong moment, or the bot remembers text the user never heard. Here the bot reads a multi-sentence reply aloud one streamed sentence at a time, and you can cut it off by speaking, typing, or pressing Interrupt. Events from three independent sources arrive late, out of order, and sometimes twice, so instead of reacting to each callback where it lands, every event goes through reduce(state, event). The browser code only translates callbacks into events and effects into API calls, the reducer never reads the clock or sets a timer itself, and a phase strip, event log and transcript show each decision live. There is no backend, LLM or API key; scripted scenarios fake the user's side so it runs without a microphone.

Every event from the reply stream, the voice and the mic goes through one pure reducer that returns the next state, the effects to run, and a named transition

Keeps only the words you actually heard, so the next reply never builds on sentences that were cut off

A 300 ms noise gate tells a cough from an interrupt without stopping the voice, and each awkward event ordering has a named test

PIPELINE.LOG
how it works
  1. Events In

    speech recognition + speechSynthesis

    Adapters turn the streaming responder, the voice's word-boundary callbacks and the browser recognizer into plain events stamped with a time. Events sent while another is being handled are queued, so the reducer always sees one at a time.

  2. Reducer

    (state, event) → { state, effects, transition }

    Five phases: idle, processing, bot_speaking, overlap and user_speaking. All decisions live in one file with no browser APIs, so every tricky ordering is a unit test written as a list of fake events.

  3. Overlap & Noise Gate

    300 ms gate

    Stopping speech isn't reversible, so sound over the bot enters overlap while the voice keeps talking. It becomes an interrupt only after 300 ms with a non-empty transcript; a cough or click drops back to bot_speaking with nothing to recover.

  4. Interrupt

    delivered-only history

    The bot turn freezes at the characters the voice actually played, and only that delivered text goes into the next reply's history. The user turn is stamped at speech start, not when recognition finished, and words heard during overlap are buffered rather than dropped.

  5. Stale Checks

    turn ids

    Every reply carries a turn id, and only the awaited reply or the active bot turn is accepted. Late chunks, the end event fired by cancelling the voice, and old noise-gate timers are all rejected, so a rapid double interrupt still yields one user turn and one reply.

interrupt-lab / reducer
no mic, silent voice
idleprocessingbot_speakingoverlapuser_speaking

the interrupt buttons work while the bot is speaking

↑ start the conversation, then cut the bot off

EVENT LOG

ENGINE.CU

A small serving engine for Llama-architecture models (Qwen2.5-0.5B, TinyLlama-1.1B) built from the same parts production engines use. Weights are read straight from safetensors, the tokenizer parses tokenizer.json directly, and the CPU forward pass is checked layer by layer against Hugging Face on 22 prompts. The CUDA backend keeps the whole forward pass on the device, with hand-written kernels for embedding, RMSNorm, RoPE, the KV cache write, and paged decode attention, and is gated against the CPU path as its oracle. On an A40, continuous batching cuts time to first token 53x over static batching and prefix caching cuts it 14.4x on a shared system prompt. Every published number names the machine it was measured on, and CI fails if a figure quoted in the docs disagrees with the benchmark data.

Matches PyTorch layer by layer across all 24 layers, on two model architectures

Continuous batching cuts time to first token 53x over static batching on an A40; paged KV cache lifts slot use from 55% to 99%

8 hand-written CUDA kernels; profiling put 88% of a decode step in attention, and sharing K/V across GQA groups made it 1.6x faster

Serves a live view of its own scheduler: requests joining a running batch, shared prefixes, preemption under memory pressure

PIPELINE.LOG
how it works
  1. Model Loading

    safetensors + tokenizer.json

    Reads weights from safetensors and parses the tokenizer file directly, with every dimension taken from the model config. A second architecture, TinyLlama-1.1B, passes the same verification unchanged.

  2. Paged KV Cache

    16-token blocks + block tables

    Each sequence owns a table of fixed-size blocks drawn from a free list, so a prompt allocates only what it uses: 99.0% slot utilization against 54.8% for a contiguous allocator with a declared output cap on the same workload.

  3. Continuous Batching

    iteration-level scheduler

    Finished sequences leave the batch on the step they finish and new ones join on the next, under a token budget. Long prompts are prefilled in chunks, and an admission watermark cuts preemption recompute waste from 17.1% to 4.7% of all token work.

  4. Prefix Caching

    chained block hashes

    Full blocks are hashed together with the previous block's hash and shared by refcount, so requests with the same system prompt skip its prefill. Unowned blocks sit in an LRU until memory pressure evicts them.

  5. CUDA Backend

    hand-written kernels + cuBLAS

    Activations stay on the device for the whole forward pass. The paged attention kernel walks the block table directly, and a test fragments the table on purpose so a kernel that computes slots arithmetically cannot pass. Sharing each K/V read across a grouped-query attention group made the attention kernel 1.62x faster.

  6. Streaming API

    OpenAI-compatible SSE

    Serves /v1/completions and /v1/chat/completions with streaming, so any OpenAI client works. Past a queue-depth limit it returns 429 with Retry-After, and SIGTERM flips readiness to 503, finishes in-flight sequences, then exits.

  7. Deploy & Metrics

    Prometheus + Helm + KEDA

    Exports queue depth, KV block usage, prefix hit ratio, TTFT and inter-token latency. The Helm chart requests one GPU per pod and a KEDA ScaledObject scales on queue depth; CI fails if a dashboard panel references a metric the server does not expose.

engine / benchmarks

SELECT EXPERIMENT

↑ pick an experiment to see what it measured

ROAM.PY

Give it a city, a starting point, a number of hours, and a list of interests; it returns a day plan with stops ordered and timed. Places come from OpenStreetMap, a LightGBM ranker picks which ones to visit, and an OR-Tools solver decides the order and arrival times. The LLM only writes prose keyed by stop number, which the server joins onto the route, so names, coordinates, and times never pass through model output. Every stage that depends on an outside service has a fallback, and each response lists the ones it used. Reworking the request path took median latency from 40.7 s to 17.7 s on a first request and 2.0 s on a repeat, and a tool-calling agent edits a saved trip in plain language.

The ranker and solver choose and order real places; the LLM only narrates, on 74% fewer tokens

Profiling showed 82% of a 41s request waiting on map queries; batching and caching brought repeat requests to 2s

Keeps serving through LLM and map outages, verified by 36 injected failures across 5 upstream APIs

PIPELINE.LOG
how it works
  1. RAG Retrieval

    FAISS + sentence-transformers

    Wikivoyage and Reddit trip reports for 10 cities, embedded with all-MiniLM-L6-v2 into a FAISS index. Retrieval runs on a worker thread alongside geocoding and the POI fetch, and the request continues without context if it fails.

  2. POI Fetch

    Overpass API (OpenStreetMap)

    One batched Overpass query covers every category. Mirrors are hedged and each has its own circuit breaker; results are cached in memory for an hour, and a stored copy up to 7 days old is served when every mirror is down. This stage was 82% of request time before the rework.

  3. Preference Ranking

    LightGBM LambdaRank

    Scores each place against the traveller's goals using 14 features, trained on 4,785 relevance pairs graded by an LLM judge. In leave-one-city-out evaluation it reaches NDCG@10 of 0.725 against 0.636 for cosine similarity alone on the pool the app actually ranks. CI fails if the model stops beating that baseline.

  4. Route Optimization

    OR-Tools

    Each day is solved as an open path from the start location, with a penalty for reaching a stop outside its preferred time of day. Soft windows mean a packed day always has an answer; against the earlier heuristic the solver travels 3.1% less and spends 7.3% less time off-window.

  5. LLM Writing

    Groq · model failover

    Receives the finished route as a numbered list and returns prose keyed by stop number, using 74% fewer tokens than echoing every stop as JSON. If no model answers, the same itinerary is returned with text written from OpenStreetMap tags.

  6. Trip Editing

    tool-calling agent

    A plain loop with six tools edits a saved trip from a request like "swap the museum for a park". Guardrails live in the session, not the prompt: a place can be added only if a search returned it, and the result is saved as a new trip. It passes 14 of 17 eval cases.

roam / live demo
DOTHRAKI.IPYNB

Dothraki was invented by linguist David J. Peterson for HBO's Game of Thrones. It has a documented phonology and a 4,000-word lexicon, but zero representation in any ASR training set. This project tests whether multilingual Whisper can produce useful output when run zero-shot on Dothraki audio, and whether that output can be mapped back to real Dothraki words via phoneme matching.

PIPELINE.LOG
how it works
  1. Vocal Isolation

    Demucs

    Game of Thrones scenes mix Dothraki dialogue with film score and SFX. Demucs separates the vocal stem from the audio before anything else runs.

  2. Zero-Shot ASR

    mlx-whisper

    Whisper (Apple Silicon optimized) transcribes the isolated vocal. It has never seen Dothraki; the output is phonetically plausible English/gibberish that approximates what it hears.

  3. IPA Conversion

    espeak-ng + gruut

    The Whisper output is converted to International Phonetic Alphabet. This decouples the matching step from Whisper's specific romanization choices.

  4. Phoneme Matching

    custom engine

    The IPA sequence is matched against a phonemicized Dothraki lexicon using edit distance with language-specific substitution costs. Returns candidate Dothraki words per phrase segment.

  5. Translation

    lexicon lookup

    Matched Dothraki words are looked up in the Peterson lexicon to produce an English gloss.

dothraki-asr / pipeline trace

SELECT PHRASE

↑ pick a phrase to trace the pipeline

FLAME.PY

Alberta wildfire records (fire location, cause, weather, spread rate, ~22,900 rows) broken down by FSA region to find the areas most vulnerable to severe fires, then modeled to predict final burned area. Linear and ridge regression collapsed on this data (R² = -0.14, essentially no signal); the team swept SVR, Random Forest, and Kernel Ridge before landing on a tuned XGBoost regressor validated with repeated k-fold cross-validation, cutting mean squared error by roughly 97% over the linear baseline.

PIPELINE.LOG
how it works
  1. Data Cleaning

    pandas + z-score filtering

    ~22,900 Alberta wildfire records: geography, cause, weather, and spread data. Rows more than 2 standard deviations from the mean on any numeric feature are dropped before modeling.

  2. Regional Analysis

    pandas + seaborn

    Heatmaps and stacked bar charts break down fire count and size class by FSA region, cause, and origin, weighted by population, to surface the regions most vulnerable to severe fires.

  3. Feature Engineering

    NumPy + datetime

    Derives total burn duration (extinguish time minus start time) and fire spread rate as the primary predictors of final fire size.

  4. Model Benchmarking

    scikit-learn

    Linear and ridge regression collapse on this data (R² = -0.14). The team swept SVR, Random Forest, and Kernel Ridge, cutting MSE by roughly 97% over the linear baseline.

  5. Final Model

    XGBoost

    An XGBRegressor tuned via repeated k-fold cross-validation (6 folds × 3 repeats) predicts final burned area from spread rate and duration.