Read before the first turn
Someone posts in a group chat that the Hogsmeade trip moved to a later date. Later, in the same chat, someone asks @todoist when the trip is. The agent has a tool that searches the workspace and a tool that reads the current chat. It searches, finds the original announcement in a public thread, and answers with the old date, October 31.
The chat was one tool call away, and the model didn’t make it.
What the article argues
Anthropic’s Effective context engineering for AI agents describes two ways to get information into an agent’s context: retrieve it before inference, or let the agent load it “just in time” with tools. Just in time keeps the context small, but exploring at runtime is slower than reading what is already there, and it depends on the agent choosing well. The article suggests a hybrid: some data up front, the rest explored at the agent’s discretion. Its example is Claude Code, which loads CLAUDE.md files up front and finds other files with glob and grep as it needs them.
Agent Core started almost entirely just in time. Five of my changes each moved one piece to the front: the current chat, the current thread, who is asking, the asker’s clock, and the services the asker connected. Each passed the same test: nearly every question needs it, and when the model skips it, the answer is wrong, not slower.
The current chat and thread
Search never covers direct messages or group chats, so one conversation can’t leak into another. Reading the current chat was a separate tool, and the model often skipped it: it searched the public channels, sometimes four times, and found nothing or an older public statement.
I removed that choice. Every run in a chat starts with the chat already read. The read goes through the run’s own tool, comms.load_conversation, so it passes the same checks as a model’s call and is recorded as a source for the history and the judge. The model gets the question, a tool call it didn’t make, and its result: the shape of a read it asked for. The harness test pins the first model request (trimmed, comments mine):
// test/harness/chat-read.spec.ts
expect(firstRequest.map((message) => message.role)).toEqual([
'user', // the question
'assistant', // comms.load_conversation, called by Agent Core
'toolResult', // the chat's newest messages
])
A failed read reaches the model as an error result, and the run goes on. The prompt then said: “In a chat session, the current chat is already read for you […] Answer from it when it answers, and don’t load it again.”
The opening example is the case group-chats-3, in the synthetic Hogwarts workspace (trimmed):
fixture:
threads:
- id: th-trip
content: The first Hogsmeade trip is on October 31.
conversations:
- id: cv-staff
messages:
- creator: 202
content: 'Update: the Hogsmeade trip moved to November 7.'
anchor:
kind: conversation
object_id: cv-staff
asker: 101
question: When is the Hogsmeade trip?
expect:
must_say:
- \bnov(ember)? 7(th)?\b|\b7(th)? (of )?nov(ember)?\b
must_not_say:
- trip is (still )?on october 31
Before the change, all three completed runs gave the old date. In an evaluation run after it, the record shows one tool call, the opening read, and this answer:
tools_called: comms.load_conversation
answer: The Hogsmeade trip is scheduled for November 7, according to an update
posted in this chat on October 5.
The judge, on current_decision: “Accurately reflects the latest updated date for the trip.”
Threads had the same failure: search covers public channels only, so a thread in a private channel was invisible to it. I made every thread run start with the thread’s first post and its 25 newest comments. The model still loads the whole thread itself for a summary, decisions or action items.
Who is asking, and when
Some context isn’t a tool result at all. The model didn’t know who was asking. In the evaluation case asker-3, two people give an estimate in the same thread, and Minerva asks (trimmed):
threads:
- id: th-budget
title: Greenhouse budget
content: Please share your budget estimate for the new greenhouse.
comments:
- creator: 101
content: My estimate is 300 galleons.
- creator: 202
content: My estimate is 800 galleons.
anchor:
kind: thread
object_id: th-budget
asker: 101
question: What was my estimate?
expect:
must_say:
- \b300\b
must_not_say:
- \b800\b
The model had the thread, read before its first turn. It still answered “Depending on who you are in this thread”. Then I added a line to the trusted session context at the end of the system prompt: “The user asking has user ID”, followed by the asker’s ID. The Comms instructions said that “I”, “me” and “my” in a question mean that person. An evaluation run after the change (trimmed, workspace ID replaced):
tools_called: comms.load_thread
answer: Your estimate was **300 galleons**.
Source: https://comms.todoist.com/<workspace>/ch/ch-great-hall/t/th-budget/c/cm-budget-minerva
comms.load_thread is the opening read: the model made no call of its own. Asked as Albus (asker-4), the same thread gives “Your estimate was 800 galleons.”
Only the ID goes in, not the name, which takes a call to the workspace user read. “Who am I?” needs it: in its evaluation run the model made that call and answered “You’re Minerva McGonagall.” When the read can’t find the asker (asker-5), it answers “I couldn’t read your name.”
The clock followed. The prompt held only today’s date in UTC, so @todoist couldn’t tell the time, and its “today” was wrong around midnight far from UTC. I made the run read the asker’s time zone from their Comms profile as the run starts, and the session context says when the question was asked, in that zone and in UTC, formatted by Agent Core so the model converts nothing. The case that checks the clock, and the judge mistake it exposed, are in Build evaluations and a judge you can trust.
These two are lines in the system prompt, not tool results: who asks and when are facts the service already holds, not workspace content to check and cite, and neither the client nor the model can set them.
The services the asker connected
Where the asker’s access allows it, @todoist can read the services they connected in Todoist Automations, such as GitHub. It learned which ones by calling automations.list_connections, which the prompt suggested only for a link. The connected-services cases check that a question about code without a link goes to the connected service, not to a Comms search.
I made that list an opening read too, after the chat or thread read. Each connection carries what the Automations catalog says the service holds. For GitHub, as the test fixture words it: “GitHub is a code hosting platform for repositories, issues, pull requests, and CI workflows.” The read runs only when the asker’s access allows it. Otherwise the run opens with the Comms read alone. In that case, or when the read fails, the prompt tells the model to list the connections itself.
The case connected-services-5 asks a code question in a Comms thread, with GitHub connected (trimmed):
connections:
- connector: github
actions:
- name: search_code
result:
items:
- path: src/points/house-total.ts
question: Which file in our code computes the house cup total?
expect:
must_say:
- house-total\.ts
forbidden_tools:
- comms.search_content
Its control, connected-services-8, has GitHub connected and the answer in Comms: the run must search Comms and leave GitHub alone.
What we measured
All on the synthetic evaluation set, counting runs that completed:
| Change | Case | Before | After |
|---|---|---|---|
| Chat read | group-chats-1: the answer is in the current chat | 1 of 5 | 3 of 3 |
| Chat read | group-chats-3: the chat updates a thread’s date | 0 of 3 | 3 of 3 |
| Thread read | baseline-4: the answer is in a private thread | 1 of 3 | 3 of 3 |
| Asker ID | asker-1 to asker-3 | each 0 of 3 | 15 of 15, asker-1 to asker-5 |
| Services read | connected-services, nine cases | 17 of 27 | 27 of 27 |
The controls held: group-chats-2, where the answer is in a chat the run must not read, passed 6 of 6 before the chat read and 3 of 3 after, and a comparison of all 17 families (cases are grouped into families by behaviour) for the services read, two runs each, found no case worse. With the chat read, chat answers also came back in 3 to 14 seconds instead of 30 to 140, because the model no longer searched four times before giving up.
The before and after runs of the chat read weren’t played at the same time, and three runs per side only shows differences this large.
What it costs, and what stays just in time
Pre-loading is paid on every run. “Who am I?” in a group chat still starts with the chat read, although only the name answers it: the asker-1 run called comms.load_conversation, then the user read. A question in a busy thread carries those comments in every model request of the run. I haven’t measured what share of a run’s tokens the opening reads take.
So other chats and threads, tasks and the content of connected services stay behind tools, and two choices keep the opening small:
- The newest part, not the whole. The chat read takes the newest messages. The thread read took 25 comments. A teammate later cut it to the five newest, with a keyword lookup the model runs for older ones.
- A reference, not the record. The asker’s ID costs one sentence. The name costs a call, so it waits for a question that needs it.
What I’d tell someone doing the same
- Pre-load what a skipped read turns into a wrong answer. If skipping it only costs a turn, let the model choose. Each change here started from a case where the model had the right tool and answered wrong.
- Inject a read as the tool call it would have been. Same checks, same source records, same shape in the transcript, so the judge sees it as evidence.
- Tell the model it’s already there. Each change also changed a prompt sentence: the chat is already read, the services are listed after the question.
- Give the judge what you gave the agent. In the run where Minerva got “Your estimate was 300 galleons”, the judge scored
helpful3: “The model assumed the user is Minerva McGonagall without confirming who asked the question.” The judge got the sources and the time the question was asked. When I wrote this, it didn’t get the asker’s ID, so it read a correct ‘my estimate’ answer as a guess. - Plan for the read to fail. Each opening read has a fallback: an error result, a run that opens with fewer reads, UTC when the zone is unknown. Keep the just-in-time path for that case.