# How to Fix the "Your conversation got too long" Error in Google Antigravity: Context Compaction, Limits and Switching to Gemini

> AI Release · @ai_releaseorg · https://ai-release.org/guides/kak-ispravit-oshibku-vash-razgovor-stal-slishkom-dlinny_en.html

## TL;DR

- **Time to complete:** 15 minutes
- **Difficulty:** Basic
- **You will need:** Google Antigravity installed and signed in, a Git repository for the project the agent is working on, a terminal with Git 2.x, and the conversation that currently shows the length error.

## What you will get

- A `HANDOFF.md` file at the root of your repository (under 100 lines) that carries the goal, finished work, open decisions and next steps of the interrupted session.
- A new Antigravity conversation running on Gemini, seeded only with that file, that continues the same task instead of blocking on the context limit.
- A short checklist you can reuse before every long agent session, so the error stops coming back.

## Quick start

```bash
cd <your-project>
git switch -c chore/handoff-$(date +%Y%m%d)
git status --short
git diff --stat
printf '# Handoff\n\n## Goal\n\n## Done\n\n## Next\n\n## Files\n' > HANDOFF.md
git add HANDOFF.md && git commit -m "chore: context handoff"
```

Details and verification are in the steps below.

## Prompt for copying

```prompt
You are compacting an interrupted working session so a fresh conversation can continue it.

Do not write or modify application code in this turn. Produce one file named HANDOFF.md in the repository root and nothing else.

Use exactly these sections, in this order:

# Handoff
## Goal
One paragraph: what the user is trying to ship, in their own terms.
## Done
A bullet list of changes already applied. For each item give the file path and one line on what changed. Do not paste file contents.
## Decisions
A bullet list of choices made and the reason for each, including rejected options.
## Open questions
Anything unresolved, ambiguous, or blocked, with the exact question that needs an answer.
## Next
A numbered list of the next three actions, each small enough to finish in one turn. Each action names the file or command involved.
## Files
A bullet list of files the next session must read first, in priority order. Mark the one file where the work resumes with the word START.
## Reproduce
The exact shell commands needed to rebuild the current state from a clean checkout, in order, one command per line.

Rules:
- Never invent a file path, command, version number or test result. If you do not know a value, write "check the docs" next to it.
- Do not paste logs or tool output longer than five lines. Give the command that regenerates the output instead.
- Keep the whole file under 100 lines.
- Write in the language the user has been using in this conversation.

After writing the file, reply with the single line: HANDOFF READY.
```

Replace before use: `<your-project>` — the folder where the repository lives; `<task-name>` — a short slug for the task, used in branch names.

## Requirements and setup
![Illustration: Requirements and setup](https://ai-release.org/guides/img/kak-ispravit-oshibku-vash-razgovor-stal-slishkom-dlinny-en-1.jpg?v=1795423432)


- A desktop build of Google Antigravity, installed and signed in with your Google account. Supported operating systems and the exact download — check the official download page for your platform.
- The project folder the agent was editing, already a Git repository. If it is not, run `git init` inside it before Step 1.
- Git 2.x and a shell: `git --version` must print a version.
- The failing conversation still open, so you can copy out whatever is worth keeping before you close it.
- Network access to the model backend — the empty-response symptom in Troubleshooting is usually a network or session problem, not a length problem.

## Step 1. Freeze the state of the interrupted session

**What to do:** Before touching the model or the conversation, record what the agent already produced. Run these three commands inside the project folder:

```bash
cd <your-project>
git status --short
git diff --stat
git log --oneline -5
```

Then copy the agent's last useful message out of the conversation into a scratch note — the plan it proposed, or the list of files it said it would touch.

**Why:** A conversation that reports it is too long is a conversation whose working state lives only in that window. If you close it first, you will re-attach the same files to a new chat and hit the same wall within a few turns. Capturing the diff first turns "restart" into "continue".

**How to check:** `git status --short` prints either nothing or a short list of paths, and `git diff --stat` prints one line per touched file with an added/removed count, for example:

```
 src/api/client.ts   | 42 ++++++++++++++++----
 src/api/routes.ts   | 18 +++++----
 2 files changed, 47 insertions(+), 13 deletions(-)
```

If `git status --short` lists files you did not expect, commit or stash them now with `git stash push -m "pre-handoff"` — otherwise the next conversation cannot tell your edits from the agent's.

## Step 2. Write `HANDOFF.md` and cut the context weight
![Illustration: Step 2. Write HANDOFF.md and cut the context weight](https://ai-release.org/guides/img/kak-ispravit-oshibku-vash-razgovor-stal-slishkom-dlinny-en-2.jpg?v=1795423436)


**What to do:** Create the handoff file and, at the same time, remove from the working set everything the next session does not need.

1. Ask the current conversation to produce the file using the prompt in “Prompt for copying” above. If the conversation already refuses to answer because of the length error, write the file by hand using the same section list — it takes about five minutes.
2. Edit it down: keep one paragraph under `## Goal`, and no more than three numbered actions under `## Next`.
3. Close every editor tab and unpin every file that is not in the `## Files` list.
4. Remove from the conversation's working set any folder the task does not touch — build output, `node_modules`, datasets, generated assets. Antigravity is a workspace-scoped agent, so files inside the open workspace can be read and pulled into context even when you did not attach them explicitly.
5. Commit the file so the next session can open it with a single command.

```bash
git add HANDOFF.md
git commit -m "chore: context handoff"
wc -l HANDOFF.md
```

**Why:** The length limit is measured against everything the agent has accumulated — your messages, its replies, the file contents it read, and the output of the commands it ran. Tool output is the usual culprit: one `npm test` run or one large `cat` can spend more of the window than a hundred chat turns. A handoff file replaces all of that with a few hundred words the agent can act on.

**How to check:** `wc -l HANDOFF.md` prints a number below 100, for example:

```
48 HANDOFF.md
```

Then open `HANDOFF.md` and confirm that a colleague who has never seen the task could start from the `## Next` list. If a step there reads “fix the bug”, it is too vague — rewrite it as “change the timeout in `src/api/client.ts` to read from `API_TIMEOUT_MS`”.

Before you open the new chat, walk this checklist:

- [ ] `git status --short` is clean or contains only intentional work-in-progress
- [ ] `HANDOFF.md` exists, is committed, and is under 100 lines
- [ ] `## Files` lists the one file where work resumes, marked START
- [ ] `## Reproduce` contains commands that run from a clean checkout
- [ ] Tabs and pinned files unrelated to the task are closed
- [ ] Folders the task does not touch are outside the open workspace

## Step 3. Open a new conversation on Gemini and verify
![Illustration: Step 3. Open a new conversation on Gemini and verify](https://ai-release.org/guides/img/kak-ispravit-oshibku-vash-razgovor-stal-slishkom-dlinny-en-3.jpg?v=1795423442)


**What to do:** Start a new conversation, select Gemini in the model picker of the agent panel, and seed it with the handoff file only.

```text
Read HANDOFF.md. Do not read any other file yet.
Reply with: the goal in one line, the START file path, and the first action from ## Next.
```

**Why:** A new conversation starts with an empty window, so the length budget is spent only on what you give it. Selecting Gemini matters because the model picker changes which backend answers, and different models in the picker carry different limits — the exact limit for each model is not fixed in the UI and must be checked against the current documentation. What you are doing here is not “a bigger model”, it is a clean window plus a smaller payload.

**How to check:** The agent's reply names the goal, the START path and one action, and nothing else — if it starts summarising the whole repository, the handoff prompts it to explore too much; tighten `## Next`. Then confirm the selected model on screen: the model name is displayed next to the input box, and it must read Gemini, not the model that produced the original error. Send one real task from `## Next` and confirm the answer streams normally with no length warning.

Use this table to pick the right fix instead of guessing:

| Action | Fixes | Does not fix |
|---|---|---|
| Same conversation, shorter message | nothing — the accumulated window is already spent | the length error |
| New conversation, no handoff | a stuck window | you re-attach the same files and hit the limit again |
| New conversation + `HANDOFF.md` + Gemini | a stuck window with the task preserved | very large single-file reads, which still fill the window |
| Switching models inside the old conversation | response quality | the length error, which is per conversation |

## Troubleshooting

**Problem. The error appears after only three or four messages.**
- Error: `Your conversation has become too long`
- Cause: the window was not filled by chat text but by one large read — a lockfile, a bundled build, a log file, or the full output of a test run the agent executed.
- Solution: in the old conversation, delete or unpin that file, then start a new conversation from `HANDOFF.md`. Check what is heavy before you re-attach anything: `du -sh * | sort -h | tail -5` shows the largest items in the workspace, and anything above a few megabytes should stay out of the agent's scope.

**Problem. The new conversation still shows the length warning on the first message.**
- Error: `Your conversation has become too long`
- Cause: the new chat inherited a large working set — a pinned file, a workspace rule file, or a folder that the agent auto-reads on start. This is common when the project root is the home directory or a monorepo root.
- Solution: reopen the folder one level down, at the package you are actually editing (`cd packages/<package-name>` and reopen it), and retry. If the warning survives, the build or the account session is at fault — sign out and back in, then check the documentation for the current per-model limit.

**Problem. After the switch, the agent "forgets" the plan and re-proposes work that is already done.**
- Error: no error text — the agent answers confidently with steps from the start of the task.
- Cause: the handoff file lists files but not decisions, so the new session has no reason to skip the finished work. Artifacts produced in the previous conversation are not carried over implicitly.
- Solution: add a `## Decisions` entry for each rejected option with one line of reasoning, re-commit, and start again. For a comparison of how other agentic coding tools handle this same problem, see [Claude Code Desktop: setup, limits and how it differs from the CLI](https://ai-release.org/guides/claude-code-desktop-ustanovka.html?utm_source=tg&utm_medium=channel&utm_campaign=guide_inline&utm_content=guide_to_guide).

## Summary and next steps

You now have a committed `HANDOFF.md` and a clean Gemini conversation that continues the same task. Keep the handoff file updated at the end of each long session, and when you need to choose between assistants before committing to one, use the [AI assistant comparison](https://ai-release.org/guides/sravnenie-ii-assistentov.html?utm_source=tg&utm_medium=channel&utm_campaign=guide_inline&utm_content=guide_to_guide).

## FAQ

**Does starting a new conversation delete my code or my files?**
No. A conversation is chat history plus context; the files on disk are untouched. That is exactly why Step 1 commits or stashes first — the only real loss is uncommitted work.

**Why does the error appear when my chat looks short?**
Because the limit counts everything the agent has read and every command output it has received, not just the visible messages. A single large file read or a verbose test run can consume the window in one turn.

**Does switching to Gemini keep my previous conversation?**
No. The model picker changes which model answers; the previous conversation keeps its own accumulated history. Switching inside an old conversation does not free the window — you need a new conversation seeded with `HANDOFF.md`.

**Can I raise the context limit instead of compacting?**
Not from the app settings. The limit is set per model by the provider, and available models change between releases — check the documentation for the current list and limits before planning a long session around one model.
