How does Irene keep big results out of the conversation?

When a tool returns something huge (a long web page, a big file, a mailbox), Irene saves it to your computer and puts a short pointer in the conversation instead. The agent then reads back only the lines or fields it needs, or passes the whole thing straight to another tool. It only does this when it actually saves money, a rule measured on real turns rather than guessed.

What makes it different

what it does the primitive behind it what that buys you
Big results don't pile up A pointer replaces the payload before it enters the conversation Every later step doesn't re-send pages nobody needs
Read back only what matters offloaded reads matching lines, chosen fields from every row, or a line range The agent sees the 30 lines it needs, not 30,000
Move data without reading it @file_id passes a stored result straight into another tool Data can travel from one tool to the next without ever entering the conversation
Only when it pays A break-even rule: the payload must be at least 3× the size of its pointer No false savings that cost an extra paid step
Learns what you look for Patterns the agent searched for are remembered per tool, and pulled out automatically next time The answer is often already in the pointer. No model is used for this
The cached prefix stays intact The swap happens before the result is added, and nothing earlier is rewritten Prompt caching keeps working, so every turn stays cheap

How it works

The pointer

When a tool result is over the limit, the conversation gets a short pointer instead: - an id like read_file_001, with the result's size in characters and lines - a map of its structure (the keys and shape, with sample rows) - for tables and lists, the field names of each row - any error lines, plus lines matching patterns the agent has looked for before, pulled out up front and marked as authoritative - a hint on how to read more, or move the whole thing with @file_id

The full result is saved in ~/.irene/context/<chat>/.

Reading it back

One tool, offloaded, reads back:

how gets
grep="pattern" matching lines (up to 30, each up to 2,000 characters)
fields="name,price" those fields from every row, lined up as a table
offset / limit a range of lines; a negative offset reads from the end

Or the agent skips reading entirely and passes @file_id (or a slice of it) into another tool's arguments.

When it happens: the break-even rule

  • Most tools: results under about 2,000 tokens always stay in the conversation. Above that, a tool's threshold rises on its own (up to 8,000) if the agent keeps reading its results back.
  • Web pages and files read whole: stay in the conversation up to 20,000 tokens.
  • Always: a result is only moved out if it's at least 3× the size of its pointer. Otherwise it stays, and nothing is written to disk.

Why so careful: a pointer is only cheap if the agent never has to read it back. Each read-back is a whole extra step, and that step re-sends the entire conversation. A pointer costs about 1,240–1,640 tokens. A read-back step can cost 50,000–200,000. Moving out a 2,600-token result "saves" about 1,200 tokens and risks a far bigger bill.

Measured on 30 real turns with everything moved out: the conversation shrank by 41%, but billed input rose by 64% and the number of steps nearly doubled (+93%), because the agent kept reading things back. One turn took 43 steps where 8 would have done. So the floors went up, and the rule became "only when it pays".

It learns

  • When the agent searches a stored result and finds what it needed, that pattern is remembered for that tool (the best 8 per tool and content type, in ~/.irene/context/keep_rules.json). Next time, those lines are pulled out into the pointer before the agent asks. Patterns that stop being useful fade out.
  • How often each tool's results get read back is tracked too (~/.irene/context/offload_stats.json), and that sets the tool's threshold.
  • No model is involved. It's counting and matching on your computer.

Restarts and clean-up

  • Stored results survive a restart: pointers and @file_id keep working after Irene reopens.
  • Stored results for chats untouched for 7 days are deleted. Learned patterns are kept.

What else trims results

  • Empty fields and duplicate HTML copies are stripped from tool results.
  • Pictures are shrunk to a sensible size before the model sees them.

What was tried and turned off

A "reducer" that kept only the most relevant sentences of a big result is switched off. In testing the agent read the full result back anyway, which cost about 4 times more. On tables and lists, where every line matters, the shortened text was wrong, not just shorter.

Where you see it

  • You don't, mostly. The tool card in the chat always shows the real, full result. The pointer is only what the model sees, and the agent's read-backs are hidden from the chat.
  • /context shows what the chat is holding.

What it costs

Nothing extra. Saving, matching and cleaning up run on your computer. The rule exists to cut model usage, and the break-even check makes sure it does.

Limits

  • A read-back is a model step. Sometimes keeping a result in the conversation is cheaper, which is why mid-sized results stay.
  • Pictures, video and audio are never moved out.
  • Very long single lines are cut at 2,000 characters when read back.

[Ask Irene about this]

Updated