Writing

Notes from the middle layer.

Essays on AI agents, the engineering around them, and the design choices that make software feel calm.

Progressive disclosure for agent tools

Binding every tool on every turn wasted a third of our input budget. Here is the index-based design we replaced it with, why we rejected the search-based version, and what an index entry has to contain.

Engineering
The index is a prompt, and I never designed it

Progressive disclosure cut our input tokens by a third. It also quietly stopped the model from reaching a tool it needed — and the failure looked like a good answer, not an error.

Engineering
Character engineering has six layers, and the prompt is only one

Persona prompts govern what the model generates. But most of what a user reads never passes through the model — and nothing owned it. Six layers, what each one buys, and the failure direction that decides where each belongs.

Engineering
The persona sets the floor, the model sets the ceiling

Five models, one persona, one script. The prompt made every model competent on the easy turns. What separated them was three edge moments — and one of the gaps turned out to be the gateway, not the model.

Engineering
Graphs are made of loops

Loop engineering was coined in June, graph engineering in July, and the obituary landed six weeks after the birth. Both labels name real work — the funeral is a category error.

Engineering
Hand-roll the kernel, borrow everything else

A build order for a general-purpose agent in 2026: the one layer worth writing yourself, the layers to standardize on, and the sequence that keeps you from building your harness twice.

Engineering
Reading WorkBuddy without the source

Tencent's desktop agent workbench, reconstructed from engineering retrospectives: full autonomy on the path, zero trust at the verdict, and a gate on every side effect.

Engineering
The second digital employee

The first digital employee is a project. The second is a pricing decision — extract the harness into a platform, or pay the 0-to-1 cost on every agent forever.

Engineering
Honesty is a harness feature

A sequel to the day my agent lied — you can't prompt a model into honesty, but you can bolt an evidence check onto the loop and make the lie impossible to ship.

Engineering
Inside Kimi Code: a teardown of its agent engine

I cloned a shipping coding agent and read it the way I read a paper — to see which design decisions survive contact with production. Here are the ones worth stealing.

Engineering
Don't put symptoms in the prompt

When an agent misses a case, the reflex is to teach it that case in the system prompt. That's whack-a-mole. The fix is structural.

Engineering
The verifier is the hard part

Loop engineering took off in coding because coding ships with a free oracle. Everywhere else, you have to build one.

Engineering
The day my agent lied about its job

A daily digest agent reported "all sources fetched" — while quietly dropping one. The bug wasn't the fetch. It was the missing guardrail.

Engineering
From context to loop engineering

The thing worth getting right keeps moving up a level — prompt, context, harness, loop. The hard part was never the while-loop.

Engineering
The agentic composition stack

Stop adding a tool for every request. Autonomy is a stack of composition types with two layers of glue, not a single trick.

Engineering
Why my agent runtime stays in-process

I migrated a production agent onto a server runtime, ran the whole playbook, then rolled it all back. Sometimes the senior move is not adopting the thing.

Engineering
Code-action: write code, don't collect tools

Standard tool-calling can't express composition. So stop picking tools — let the model write the code that calls them.

Engineering
Designing for the model's mistakes

Reliable agent UX isn't about preventing errors — it's about making the wrong answer cheap to notice and undo.

Design
The four layers of agent memory

Everyone treats agent memory as one framework, and compares the options as if they're rivals. They answer different questions — here's the map.

Engineering
Six ways to give a model knowledge — and what each is for

Vector RAG, RAGFlow, GraphRAG, PageIndex, an LLM wiki, Obsidian — they get lumped together as rivals. They aren't even at the same layer. A field guide to which one fits which job.

Engineering
There's no best agent framework, only yours

I scored two agent frameworks across eleven dimensions. Strip the weights and they tie. The gap was never about quality — it was about who I am.

Engineering
Your knowledge base wants to be a notebook, not a warehouse

Everyone is racing to build a smarter index. The labs that build the models quietly went the other way — toward plain text the agent reads and tidies itself.

Essay
Why agents need memory, not just context

A bigger context window buys you a better goldfish. Persistence is a different problem — and most of the work happens between the prompts.

Essay
The quiet cost of tool-use loops

Every retry feels free in isolation. Stacked across a session, they are where latency, cost, and confusion quietly accumulate.

Engineering