Read Bigger Threads

tosh1 pts0 comments

Amp

Threads outgrew read_thread, so we rewrote it.

read_thread is the tool that lets Amp pull context out of other Amp threads when you mention them. Before the rewrite, it would fetch the whole thread and extract the relevant parts in a single call to another LLM.

That used to work when threads were shorter and contained a single context window. Then we added compaction and now a single thread can run for weeks. Our longest thread has been compacted over 68 times — without compaction, it would be over 21 million tokens long.

A 21-million-token thread doesn't fit into a single context window, so asking another LLM to extract relevant parts doesn't work anymore. And even threads with 1 million tokens that fit gave bad answers: one giant prompt over-weights whatever the thread ended with or started with and ignores the information in the middle.

read_thread is now a subagent tuned to extract information from long threads. The subagent takes a thread and a question, searches the thread, reads the messages, and checks whether later work revised or reverted what it found.

Our first version of the read_thread subagent answered from the first plausible hit. In a long thread, the first hit is often an attempt that was later revised or reverted. We switched the model to GLM 5.2 from Gemini 3.5 Flash and tuned its prompt to optimize for correctness over speed:

"Do not stop at the first relevant hit; check for newer messages that revise, supersede, revert, or contradict it."

"Tool calls record attempted actions, not outcomes." It checks whether an edit actually succeeded before believing it.

"Use compactions for orientation, but inspect original messages when exact requirements, wording, code, commands, chronology, edits, or verification matter."

It also works on the thread you're in. When the agent needs something from three weeks ago — a decision, an error, the original plan — it goes back and looks instead of trusting the compaction.

Nothing changes on your end. Either tell Amp what you're looking for and let it find the thread, or give it a thread explicitly: paste a URL, or @-mention it. And when you open a new thread, hit Enter twice to reference the thread you just left.

Mention a thread and ask a question, just like before, except it now works with big threads too:

"Implement the plan from https://ampcode.com/threads/T-…"

"What did we implement for the visibility submenu in https://ampcode.com/threads/T-…? Which files changed, and how does it work now?"

"Summarize the requirements, implementation decisions, and known caveats from https://ampcode.com/threads/T-… before you review this."

"Find the thread where we debugged the executor connection timeout and summarize the fix."

"Hey, I know it's a lot, I know I should've stopped way earlier, but can you look at this thread in which we went for 271 rounds and extract that bootstrap script? https://ampcode.com/threads/T-…"

AlsoofInterest<br>Amp Now Reads Threads<br>Reference and let Amp read other Amp threads

Read

thread threads from read_thread before extract

Related Articles