CRUX / BLOG
Notes from the harness
Engineering deep-dives, release notes, and the occasional opinion — from the team building the blocks around the model call.
// ecosystemWhere a harness layer fits: AI SDK, LangChain, Mastra, and Crux
The TypeScript AI stack is usually framed as a framework choice. A harness layer is a different axis: it composes over the SDK you already picked. An honest map of what each tool owns, and when you'd add (or skip) Crux.
fn safety()Guardrails that compose: practical LLM safety boundaries in TypeScript
Prompt injection can't be solved with a wrapper function and a regex. Model safety as typed boundaries (input, output, tool calls, memory writes) with declared actions, streaming semantics, and evidence for every decision.
fn routing()Cut your AI bill with a routing policy you can prove
Vendors promise 40–85% savings from model routing. The claims are plausible, and unverifiable without two things most routing setups lack: a declared policy and a receipt per request.
fn retrieval()The RAG freshness problem is a harness problem
Vector similarity has no concept of time: a stale chunk at 0.92 outranks the current one at 0.87, every time. Why freshness can't be fixed inside the index, and what it looks like as a first-class, testable property of the turn.
fn routing()Shipping a model migration without breaking production
Every model deprecation email starts the same fire drill. A migration playbook built on baselines, side-by-side variants, provider adaptations, and canary splits, so 'upgrade the model' becomes a reviewable change.
fn context()Silent truncation: the context your model never saw
When a prompt outgrows its budget, something gets cut, and most stacks cut silently. What actually gets dropped, why 'lost instructions' bugs are so hard to diagnose, and how to make dropping a declared policy.
fn evals()Test the harness, not just the output
Output evals tell you that something regressed. They can't tell you what. Assert what your harness did (context decisions, routing, freshness) and CI starts failing with causes instead of symptoms.
// contextContext engineering is missing correctness
The discipline taught us to curate what the model sees. It never gave us a way to verify the curation. That second half is where production reliability actually lives.
fn memory()Adding memory to the Vercel AI SDK
The AI SDK deliberately leaves memory open. How to add typed, budgeted, observable memory to an AI SDK app: recent messages, working state, and long-term facts, without switching frameworks.
fn observability()What did the model actually see? Anatomy of a bad AI answer
A debugging walkthrough of one bad model turn: from wrong answer, to the context that never made it into the prompt, to a regression test that keeps it fixed.