An agent handoff file so Claude and Gemini stop restarting work
Switching between Claude Code and Gemini on the same project meant each agent started cold. One small file carries the state across now.
I run two coding agents on the same projects: Claude Code and Gemini inside Antigravity. Sometimes I switch deliberately. Sometimes a session hits a token limit mid-work and the choice gets made for me.
Until this week, neither agent knew the other existed. Each one opened the project cold, re-read the same files, and sometimes started redoing work the other had already finished. I would catch it halfway and have to talk the second agent out of its plan.
What I built
One file at the root of each project: AGENT-HANDOFF.md. Four fields.
status:idle,in-progress, orblocked.current task: one line of what the work is.progress so far: what has already been done this session.next step: one concrete action the next agent can take without re-reading anything else.
Both agents’ startup rules point at this file first. My vault’s root CLAUDE.md has it as a step before anything else. The project’s GEMINI.md imports the same rule so Gemini runs the same logic. If status is in-progress, resume. If it is idle, treat the project as a fresh start.
Why fields and not a free-form note
A free-form log would drift. I would end up writing paragraphs for me to read later, not short notes for an agent to act on. Four fields force the writer to make the choice: what is the one next action.
The next step field is the one that matters. It has to be specific enough that an agent reading it cold can act. “Finish the OCC fix” is useless. “Add the same findOneAndUpdate retry loop to the orders route and run npm run test:master:fast” is the shape I need. If the handoff cannot be written that specifically, the work was never at a checkpoint, it was just paused.
The thing I almost got wrong
The temptation is to only update the file at the end of a session, on the way out. That assumes sessions end gracefully. They do not. A token limit kills the session with no warning, in the middle of whatever the agent was writing.
So the rule is: update after every meaningful checkpoint, not at the end. Push a commit, update the handoff. Finish a test run, update the handoff. The file is live state, not an exit note.
How it sits next to the practice loop
I have a separate pattern for cross-session memory, the practice loop. That one answers “what has worked on this kind of task before.” It lives in Resources/playbooks/ and in each tool’s NOTES.md.
The handoff file answers a different question: “where did I stop, minutes ago.” Different scope. The practice loop is permanent memory. The handoff is a baton. On a normal finish, I reset status to idle and fold any lasting lesson into the practice loop.
What I would do differently
Build the handoff file before splitting work across two agents, not after the second collision. The cost of writing four fields is a minute. The cost of catching an agent redoing finished work, and talking it off its plan, is the whole rest of the session.
The other piece worth stealing is the import pattern. Both CLAUDE.md and GEMINI.md at the project root pull from the same vault rule file with an @-import, not a copy. One source of truth, one place to edit when the rule changes. If I had copy-pasted, I would be out of sync by now.