TL;DR
LongHarness is a harness for an agent that answers questions over a huge folder of documents (tens of millions of tokens). Instead of one long conversation history, the agent keeps two separate lists. The first is an "evidence bank": short claims, each with a link to a source it actually read and a status (active / superseded / retracted). The second is the "conclusion state": what the agent currently believes is true and which gaps still stand in the way of an answer. The next search targets the gaps strictly, and every new fact immediately triggers a review of the conclusion.
A regular agent loses the thread. It finds "supplier A will deliver on Monday," goes off searching further, and that condition evaporates from its head. Or it searches forever until the budget runs out and ends up guessing. The reason is simple: conclusions live "somewhere in the chat history" or in free-form notes, and the model can't see what's settled and what isn't. The result: direct reading gets 15.8% exact answers, while the same agent with explicit lists gets 60.2%. The Claude Code and Codex harnesses on the same model scored 48.1% and 46.6%.
The method runs as a loop of three actions. The agent searches and reads for the current gap. Then it records what it found in the evidence bank with a source, marking stale entries "superseded" or "retracted." After that it revisits the conclusions and gaps. Before the final answer, it checks whether the remaining gaps could change the decision.
Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.
Method Blueprint
STATE 1: Evidence bank → [id | claim | source | status: active/superseded/retracted]
STATE 2: Conclusion state → [conclusion | which ids it rests on | open gaps]
LOOP (many turns, states persist between turns):
STEP 1: Pick a gap → search/read only what closes it
STEP 2: Record the fact in the bank (always with a link to the source you read)
Correction = new entry, old one → "superseded"; error → "retracted"
STEP 3: Revisit conclusions against active evidence → update the gaps
STEP 4: Before answering: add anything missed, check whether gaps could change the decision
STOP: budget exhausted → answer with no guarantees
This is a harness with a controller program: it checks format, links, and budget. You can reproduce the idea in an agent with instruction files (see the template), but then you'll have to check links and budget yourself.
Example
Task: You're launching a line of thermoses on Amazon. The shipment has to be at the warehouse by Friday. The folder holds 300 emails, packing slips, and invoices from two factories. First impression: factory A is faster and cheaper. The agent has to pick a supplier and show what the choice rests on.
Prompt: (for an agent in Claude Code or Cursor with access to the /supply folder)
Question: which supplier (A or B) can get the shipment to the Amazon fulfillment center in Joliet by Friday 6:00 PM?
Follow the rules in CLAUDE.md: maintain the files EVIDENCE.md and CONCLUSIONS.md.
Initial conclusion: "A is faster and cheaper." This is a hypothesis, not a fact.
For every conclusion, immediately list the gaps: what you need to find to confirm or refute it.
Search only for what closes the gaps. Limit: 40 searches.
Result: The agent creates two files and updates them at every step. EVIDENCE.md gets entries like "A: ships Monday" with a link to the email. CONCLUSIONS.md holds the starting hypothesis and the gap "when does B arrive?". Once it finds B's shipping notice, the agent adds an entry, revisits the conclusion, and closes the gap. The old entry gets the status "superseded." At the end you get an answer with links to active evidence. If the search limit runs out first, the answer comes with a list of unclosed gaps instead of a silent fallback to the first hypothesis.
Why It Works
The weakness. The model is bad at holding on to "what's been established and what hasn't" as the history grows. Early findings drown in later ones, corrections never reach the final conclusion, and search turns into wandering. Free-form notes barely help: conclusions, facts, and questions are all jumbled together.
The strength. The model is good at local operations: read a chunk, write down a claim with a link, compare it to a conclusion, spell out what's missing. These are all short, well-defined tasks.
How the method uses this. Facts and conclusions are split into two lists, and a gap becomes a "search assignment." That gives search a goal, and it stops when there are no gaps left. The "superseded" and "retracted" statuses keep stale facts out of the reasoning. Ablations confirm it: structured conclusions beat free-form notes by 6.8 and 7.8 points. An "append-only" list with no replacement lost 3.8 and 10 points.
Control levers: - Search and read limits → lower them for simple questions, raise them for complex compound ones. - The "gaps" field → without it the agent goes back to wandering. The explicit instruction "search by gaps" also added a gain in the ablation. - Mandatory source link → remove it and entries turn into "retelling from memory." - Pre-answer check ("could the gaps change the decision?") → swap in your own stopping criterion, e.g. "all gaps closed or marked unavailable."
Prompt Template
For an agent instructions file (CLAUDE.md / AGENTS.md) or a system prompt. The structure keeps the method's logic: two states, statuses, a loop over gaps.
<Role>
You are a research agent. You answer a question over a large folder of documents {folder}.
You can't read everything, so you work through two working files.
</Role>
<State>
EVIDENCE.md — the evidence bank. Only facts from sources you've read.
Entry format: [e{number}] | {claim} | {file / page / paragraph} | status: active | superseded by e{N} | retracted
Rules:
- An entry without an exact link to a source you actually read is forbidden.
- Correcting a fact = a new entry; the old one gets the status "superseded by e{N}".
- If a fact turns out to be wrong and there's no replacement — status "retracted".
- Delete nothing. Change only statuses.
CONCLUSIONS.md — the conclusion state. Only your interpretations.
Format:
Conclusion c{number}: {current judgment} | rests on: e{..}, e{..} | confidence: confirmed / hypothesis
Gap g{number}: {what needs to be found to confirm, refine, or refute conclusion c{..}}
Don't mix facts and conclusions: facts go only in EVIDENCE, judgments only in CONCLUSIONS.
</State>
<ReasoningLogic>
Before you start: state a first hypothesis for the answer and list the gaps.
While there are open gaps and the limit isn't exhausted ({search_limit} searches, {read_limit} reads):
1. Pick the gap that matters most for the decision.
2. Find and read what could close it. Don't search "just in case."
If there are several hypotheses, look for what tells them apart.
3. Record what you found in EVIDENCE.md per the rules above.
4. Show the updated entries, then revisit CONCLUSIONS.md:
is the conclusion still confirmed, does it need refining, or has it changed?
Update the evidence links and the list of gaps.
5. If the gap didn't close, rephrase the query or widen the reading scope.
If a piece of evidence is superseded or retracted, conclusions don't change on their own: revisit them manually.
</ReasoningLogic>
<FinalCheck>
Before answering:
- Account for every relevant active entry not yet reflected in the conclusions.
- Check: could the remaining gaps change the answer to the question?
- In the answer, cite the active entries e{..} and their sources.
- If the limit is exhausted and gaps remain, say plainly what data was missing. Don't silently fall back to the first hypothesis.
</FinalCheck>
Fill in: {folder} — where the documents live, {search_limit} and {read_limit} — the budget for the task.
🚀 Quick start — paste into a chat:
Here's a template for an agent that tracks evidence and conclusions. Adapt it to my task: [your task].
Ask me questions to fill in the fields.
[paste the template above]
The LLM will ask where the documents live, what the question is, and what deadlines and deal-breakers apply. It will also check the search budget and whether strict source links are required. That's how the template gets statuses, a gap format, and a stopping point tailored to your task.
Limitations
⚠️ You need a harness, not just a prompt: In the paper, a controller program checks links, budget, and format. A regular agent working with files has none of that. The agent alone is responsible for each entry faithfully reflecting its source, and there's no controller.
⚠️ No evidence for simple tasks: The method was tested on hard questions over huge corpora, where values have to be gathered from many documents. For "find one number in one file," two state files are just extra overhead.
⚠️ The gain depends on the model: With one model the edge over the best competing harness is 12–19 points; with another, on the hard set, about one point. Don't expect the same lift everywhere.
⚠️ Single runs: The main comparisons use one run per configuration. Triple runs are in the appendix, but only for one model.
⚠️ No automatic recompute: When evidence is superseded or retracted, conclusions don't update automatically. The agent has to revisit them itself, and the instructions must say so explicitly.
How They Studied It
The researchers used four question sets. The main one is OfficeQA Pro: questions over hundreds of U.S. Treasury documents. For the first version that's about 100 million tokens; in the second the corpus is twice as large and the questions are compound: you have to gather and reconcile values from different sources. Agents aren't handed the "right" documents; search is part of the task. To test on a given context they added two more sets: AA-LCR and the long portion of LongBench v2.
They compared three things. First, "bare" models fed search-retrieved fragments in a 256K-token window. That worked poorly: at most 23.2% on the first version and 5.6% on the second. Second, off-the-shelf harnesses (Codex, Claude Code, RLM) on the same model. Third, LongHarness. The models were identical across all comparisons, so the difference came only from the harness.
The result on GLM-5.3-Flash: 60.2% vs. 48.1% for Claude Code on the first version, and 61.1% vs. 42.2% for Codex on the second. Then they broke down where agents lose: finding the evidence, holding on to it until the answer, or turning it into a correct answer. LongHarness won at all three stages, especially at search and at final answer assembly. Ablations switched off one component at a time. The biggest drop came from removing structured conclusions, and "append-only" accumulation turned out almost as bad. Interestingly, on the harder second version every ablation hurt more. The more values you have to reconcile, the more it matters to keep your evidence in order.
Adaptations and Extrapolations
🔧 Technique: add a "what would change the answer" field to each gap → search gets even more targeted
Gap g3: when does B arrive? | if the date is after Friday → choose A; if before → choose B
This way the agent knows up front why it needs a fact and doesn't collect extras.
🔧 Technique: remove the opacity → see the drift
Add to the rule: "after each step, show the changes to EVIDENCE and CONCLUSIONS as a list of 'added / superseded / retracted'." You'll immediately spot where the agent dropped a condition.
Extrapolation: the same principle in a regular chat without documents. For a long decision analysis ("which job offer to take," "where to invest $50,000"), you can ask the model to end every reply with two blocks: "Facts (what you've told me, with dates)" and "Current conclusion + what's missing." When you correct a fact, it marks the old one as superseded and revisits the conclusion. This is a transfer of the idea; the paper didn't test this scenario.
Resources
- LongHarness: Advancing Agentic Reasoning over 100M-Token Corpora via Stateful Evidence Management — the main paper.
- Benchmarks: OfficeQA Pro V1/V2 (Opsahl-Ong et al., 2026), AA-LCR (Artificial Analysis), LongBench v2 (Bai et al., 2024).
- Compared against Codex (OpenAI), Claude Code (Anthropic), RLM (Zhang et al., 2025).
- Author names and universities aren't listed in the input data.