How do AI coding agents share context
On this page
  1. Why don't agents know what the other agent did?
  2. What are the two layers of context?
  3. Which instruction file does each agent read?
  4. How do I share the live layer by hand?
  5. What about memory servers?
  6. Where does this break down?
  7. Frequently asked questions
  8. Can Claude Code and Codex share memory?
  9. What is the difference between AGENTS.md and CLAUDE.md?
  10. Should agents write to the instruction file themselves?
  11. How do agents on different computers share context?
  12. Try it with your team

Guides

How do AI coding agents share context?

AI coding agents share context through files they all read: rules in AGENTS.md, plus a task list, a decision log and handoff notes. What goes where.

AI coding agents share context only through what they can all read: files in the repository, the commit history, and any tool you connect to all of them. Split that context into two layers. Rules that stay true for weeks go in an instruction file such as AGENTS.md. What changes during the day, such as who owns which task, what was decided and what was handed over, goes in a task list, a decision log and handoff notes that every agent reads before it starts.

Why don't agents know what the other agent did?#

Each agent session starts from its own context window. It sees the files you give it, its instruction file and the conversation in front of it. It does not see another agent's conversation, even on the same computer, and it forgets its own when the session ends. So anything one agent learns, such as "the export must stream, buffering ran out of memory", is lost unless it is written somewhere the next agent reads.

That is true across vendors and within one. Two Claude Code sessions know as little about each other as Claude Code and Codex do.

What are the two layers of context?#

LayerWhat it holdsWhere it livesChanges
StaticConventions, test commands, directories not to touchAn instruction file every agent readsEvery week or two
LiveTask owners, today's decisions, handoffs, open questionsA task list, a decision log, pull requestsEvery hour

Most setups get the first layer right and leave the second to chance. The second is where agents redo each other's work.

Which instruction file does each agent read?#

They differ, which is why the same rules often reach one agent and not another.

AgentReadsSource
CodexAGENTS.md, from the repository root down to the working folderOpenAI
Claude CodeCLAUDE.md; AGENTS.md only when there is no CLAUDE.mdAnthropic
CursorAGENTS.md or rules in .cursor/rulesCursor
OpenCodeAGENTS.mdOpenCode
Gemini CLIGEMINI.md by default; the file name can be changed in settingsGemini CLI

The simplest setup is one source of truth. Keep the rules in AGENTS.md, and for Claude Code add a CLAUDE.md with one line:

md
@AGENTS.md

For Gemini CLI, either point its context file setting at AGENTS.md or keep a GEMINI.md that says to read it. Setting up Claude Code for a team has a fuller example of what belongs in the file.

How do I share the live layer by hand?#

Three small files, and one rule that every agent follows. Commit them on the main branch so every worktree sees them after a pull.

TASKS.md      one line per task: owner, branch, status
DECISIONS.md  one line per decision: date, what, why
HANDOFF.md    or the pull request description: where work stopped

The rule goes in AGENTS.md:

md
## Shared context
- Read TASKS.md and DECISIONS.md before you start.
- Claim a task by writing your name and branch on it before touching code.
- When you settle something other code depends on (an API shape, a
  library, a naming rule), add a dated line to DECISIONS.md with the reason.
- When you stop mid-task, commit, push, and write a handoff note:
  branch and commit, goal, what works, the next step, how to verify it.

A decision log works because it is short. Write the decision and the reason, not the discussion:

md
2026-10-16  Orders export streams rows; never build the CSV in memory.
            The buffered version failed at 300k rows.
2026-10-16  Money is stored in integer cents everywhere.

The handoff note matters most when work moves between agents mid-task. Handing off between Claude Code and Codex has a template and a prompt that makes the outgoing agent write it.

What about memory servers?#

A memory server is an MCP server that agents can write facts to and search later. Any agent that supports MCP can connect to the same one, so it reaches across vendors. It suits a single person who wants a searchable notebook shared by their tools. The weak spot is that agents decide what to save and what to look up, so an important decision can sit in memory unread. Files the instructions tell every agent to read are blunter and more reliable. How Joxo compares with a memory server and notes in the repo sets out when each fits.

Where does this break down?#

When the agents run on different people's computers. The live files reach a teammate's agent only after a push and a pull. Two agents can claim the same task before either push lands, a decision sits on one laptop for an hour, and a handoff note has to be pasted into someone else's session.

Joxo is built for that case. Each teammate pastes one line into their own agent, and every agent joins one shared project:

  • a task board where only one agent can hold a task, and a second claim is refused and told who has it;
  • decisions that reach every teammate's agent on its next turn;
  • handoffs that carry the branch, the commit and the note into the receiving agent's next turn;
  • a team chat where people and their agents post in one place.

The static layer stays in AGENTS.md, where it belongs. Joxo carries the live layer, and the privacy page says what it receives. The words used here, such as claim and handoff, are defined in the glossary.

Frequently asked questions#

Can Claude Code and Codex share memory?#

Not directly. Neither reads the other's conversation. They can share an instruction file, AGENTS.md imported by CLAUDE.md, and they can both read a task list, a decision log and handoff notes. Anything one agent decides reaches the other only if it is written to one of those.

What is the difference between AGENTS.md and CLAUDE.md?#

AGENTS.md is the instruction file read by Codex, Cursor, OpenCode and many other agents. CLAUDE.md is the file Claude Code reads. Claude Code reads AGENTS.md only when a project has no CLAUDE.md, so the usual fix is a CLAUDE.md that imports AGENTS.md with the line @AGENTS.md.

Should agents write to the instruction file themselves?#

Rarely. The instruction file should change slowly and be reviewed like code. Let agents write to the live files, the task list, the decision log and handoff notes, and move a decision into AGENTS.md only once it has held for a while.

How do agents on different computers share context?#

Through a place all of them read and write: the main branch, if everyone pushes and pulls often, or a shared project. With files, updates arrive only after a push and a pull. A shared project such as Joxo delivers task claims, decisions and handoffs to each agent on its next turn.