Back to all articles
TutorialDecember 4, 2026·11 min read

Antigravity vs Claude Code - How Each Handles Rules, Memory, and Resumed Sessions (2026)

Your repository already has an AGENTS.md that Antigravity follows. A teammate starts Claude Code in the same folder, adds a CLAUDE.md with two lines about test commands, and the next morning Claude Code no longer seems to know the naming rules everyone agreed on. Nothing errored. The two tools simply read the folder differently.

The short answer: Antigravity combines every AGENTS.md, GEMINI.md, and .agents/rules/ file it finds and says plainly that "Agents don't remember conversations" unless a lesson is written into a rule or skill. Claude Code reads CLAUDE.md files, reads AGENTS.md only when no CLAUDE.md is present by default, and keeps an auto memory that is on by default in local sessions.

This guide covers where each tool reads instructions, how each one turns past work into memory, what happens when a long session is compacted, how each resumes a session, where the two differ, where they work the same way, and how to keep one set of project context steady across both.

Antigravity vs Claude Code at a glance

DimensionAntigravityClaude Code
Project instruction filesAGENTS.md or GEMINI.md in any directory, plus .agents/rules/*.mdCLAUDE.md, .claude/CLAUDE.md, CLAUDE.local.md, plus .claude/rules/
Reading AGENTS.mdAlways on for its directory scope, alongside GEMINI.mdRead when there's no CLAUDE.md or CLAUDE.local.md at or above the working directory, unless Project instructions is set to claude-md-and-agents-md
Scoping rules to filestrigger frontmatter required in rules/: always_on, model_decision, glob, or manualOptional paths frontmatter; rules without it load at launch
Memory from past chats"Agents don't remember conversations"; /learn drafts a rule or skill for your approvalAuto memory, on by default in local sessions, saves notes Claude decides are useful
Where learned context is storedRule and skill files you approve~/.claude/projects/<project>/memory/, with a MEMORY.md index
When a long session fills upOlder turns are compacted into checkpoint summariesProject-root CLAUDE.md is re-read from disk after /compact
Resuming in the terminalagy -c for the latest session in the workspace, /resume picker, /forkclaude --continue for the latest in the directory, --resume by ID or name, --fork-session

Checked against each vendor's documentation on December 4, 2026.

How Antigravity handles your context

Antigravity's documentation describes rules as "persistent instructions, coding standards, and architectural constraints that shape how Antigravity behaves in your codebase." Everything it keeps between sessions lives in files.

Instructions

Antigravity loads rules at three levels: global files under ~/.gemini/, workspace files, and directory-scoped files in any subdirectory. "Whenever Antigravity reads or edits a file, it walks up the directory tree from that file's folder to the workspace root, loading rules at each level".

Two file shapes behave differently. AGENTS.md and GEMINI.md use no frontmatter and stay active for their directory. Every file inside .agents/rules/ needs YAML frontmatter with a valid trigger. If it's missing, or written as alwaysOn instead of always_on, "Antigravity silently discards the rule."

Rules add up rather than replace each other. The documentation says "Rules are cumulative rather than replacement-based", and "When instructions conflict, more specific directory rules take priority."

There are size limits. A rule file over 24,000 bytes is truncated, and all active global and always_on rules share a 20,000-token budget. Over that budget, Antigravity turns the largest files into pointers the agent can read on demand.

Memory from past chats

Antigravity doesn't keep an automatic memory of conversations. The /learn page puts it directly: "Agents don't remember conversations." Knowledge from a session "disappears when the conversation ends, unless it's written down as a customization."

/learn is the bridge. It reviews the recent conversation, decides whether a lesson is a rule or a skill, and drafts a learning_proposal.md. The agent "never edits configuration files immediately", and files change "only after you explicitly approve".

Resumed sessions and compaction

In the CLI, conversation history is scoped to the directory where you launch agy. agy -c resumes the most recent conversation for the workspace, /resume opens a picker where you can search, rename, or delete conversations, and /fork copies the conversation into a new session. The fork note is worth reading: "Forking clones the conversation thread, not your local Git checkout."

When a conversation grows, Antigravity "automatically compacts older turns into checkpoint summaries". The /context panel shows how many checkpoints exist.

How Claude Code handles your context

Claude Code describes two systems side by side: CLAUDE.md files that you write and auto memory that Claude writes. Its documentation adds that both are context, not enforcement: "They aren't enforced configuration."

Instructions

Claude Code loads CLAUDE.md and CLAUDE.local.md from the working directory and every directory above it at launch. Files in subdirectories load once Claude reads, writes, or edits a file there. "All discovered files are concatenated into context rather than overriding each other." Files closer to where you launched are read last.

.claude/rules/ holds modular rules, discovered recursively, so subfolders like frontend/ work. A rule without paths frontmatter loads at launch; a rule with paths loads when Claude works with a matching file.

AGENTS.md is conditional. "By default, Claude reads AGENTS.md only when you have no CLAUDE.md in your working directory or above it." A CLAUDE.local.md counts for that check too. The Project instructions setting has a claude-md-and-agents-md value that loads both, CLAUDE.md first.

For size, Claude gets each launch-time CLAUDE.md in full up to 4 MiB. Subdirectory files and path-scoped rules have a smaller per-file limit tied to the context window; past it, Claude receives only the start of the file.

Memory from past chats

Auto memory "lets Claude accumulate knowledge across sessions without you writing anything." It's on by default in local sessions, and you can turn it off with the /memory toggle or the autoMemoryEnabled setting.

Claude saves four kinds of notes (user, feedback, project, and reference) and "doesn't save something every session." Notes go into ~/.claude/projects/<project>/memory/, shared across worktrees of the same repository and kept on that machine. At the start of a session, the first 200 lines or 25KB of MEMORY.md load; topic files are read when needed.

Resumed sessions and compaction

claude --continue resumes the most recent conversation in the current directory. claude --resume takes a session ID or name, or opens a picker, and --fork-session starts a new session ID from a resumed one.

After /compact, Claude Code says "Project-root CLAUDE.md survives compaction" because it is re-read from disk. Nested CLAUDE.md files and path-scoped rules load again when Claude next touches matching files. An instruction given only in chat may not survive.

Where they differ

Which file wins when both exist

Antigravity reads AGENTS.md and GEMINI.md together and combines them with any .agents/rules/ files. Claude Code, by default, reads its CLAUDE.md files instead of AGENTS.md once any CLAUDE.md or CLAUDE.local.md sits at or above the working directory. That's the scene from the opening: one new file on the Claude Code side changed what Claude Code read, while Antigravity kept reading the same AGENTS.md.

How rule files activate

Antigravity requires a trigger in every file under rules/ and silently drops files without one. Claude Code treats frontmatter as optional: a file in .claude/rules/ with no paths field loads at launch. Antigravity scans only the top level of .agents/rules/ unless you register subfolders in .agents/rules.json; Claude Code discovers .claude/rules/ files recursively.

What happens to lessons from a session

Antigravity keeps nothing automatically and asks you to approve a /learn proposal before any file changes. Claude Code writes auto memory notes on its own while auto memory is on, and you review them through /memory or by editing the markdown files.

How each one handles a long session

Antigravity compacts older turns into checkpoint summaries and lists them in /context. Claude Code compacts with /compact and re-reads the project-root CLAUDE.md from disk afterward, while nested files and path-scoped rules reload on demand.

How resuming is scoped

Antigravity's agy -c looks up the last conversation for the absolute workspace path in a local cache and starts fresh if that conversation was deleted. Claude Code's --continue picks the most recent conversation in the current directory, and --resume with a session ID searches the current project and its worktrees, then other projects on the machine.

Where they work the same way

  • Plain markdown files. Both keep project instructions in files you can read, edit, and commit.
  • Walking up the tree. Both load instructions from directories above the working location and pick up subdirectory files as the agent works there.
  • Closer files matter more. Antigravity gives priority to more specific directory rules; Claude Code reads files closer to the launch directory last.
  • Directory-scoped history. Both resume the latest conversation for the folder you start in.
  • Forking copies the conversation, not your files. Antigravity says so in its fork note; Claude Code's --fork-session creates a new session ID for the same conversation.
  • Compaction keeps files, not chat-only instructions. Both summarize long conversations, and rules written to disk are the durable part.

Which one fits which job

  • If your repository already relies on AGENTS.md and GEMINI.md, Antigravity reads them as they are.
  • If you want the agent to keep notes without being asked, Claude Code's auto memory does that by default.
  • If you'd rather approve every lasting change, Antigravity's /learn proposal step is built around that.
  • If your rules are organized in nested folders, Claude Code discovers them recursively; Antigravity needs a rules.json entry for nested files.
  • If you need instructions to survive compaction, both work from files on disk, and Claude Code documents that the project-root CLAUDE.md is re-read.

Using both

On a repository where both tools run, context ends up in several places:

  • A root AGENTS.md that Antigravity always reads and Claude Code reads only under its conditions.
  • Antigravity-only files: GEMINI.md, .agents/rules/, and ~/.gemini/ globals.
  • Claude Code-only files: CLAUDE.md, CLAUDE.local.md, .claude/rules/, and auto memory under ~/.claude/projects/.
  • Conversation history in each tool, scoped to the directory.

Nothing syncs between them. A rule Antigravity saves through /learn stays in an Antigravity file, and a Claude Code memory note stays on that machine. For moving a whole setup from one to the other, see how to migrate from Antigravity to Claude Code.

What people try first

Adding a CLAUDE.md next to AGENTS.md. By default, Claude Code then reads the CLAUDE.md instead. Import @AGENTS.md from it, or choose claude-md-and-agents-md.

Copying .claude/rules/ files into .agents/rules/. Without a trigger field, Antigravity drops them.

Expecting Antigravity to recall yesterday's correction. Run /learn before closing the session and approve the proposal.

Expecting Claude Code memory on a second computer. Auto memory stays on the machine where it was written.

Forking to test a risky change. In both tools the conversation forks, and your working files don't.

The Fix: Keep one source of truth for project context

Step 1: Put shared rules in the root AGENTS.md

Write the conventions both agents need there.

Step 2: Make Claude Code read it

If the repository has a CLAUDE.md, add an @AGENTS.md import to it, or set Project instructions to claude-md-and-agents-md. Check with /memory that AGENTS.md appears in the list.

Step 3: Keep tool-only rules small

Put Antigravity-specific rules in .agents/rules/ with a valid trigger, and Claude Code-specific rules in .claude/rules/.

Step 4: Write the cross-tool context in your own words

Rules files hold conventions. Decisions, rejected approaches, and open blockers can end up only in chat. Write them down in a short note you control.

Setting this up in MemoryLake

Instruction files cover rules. The reasons behind them, such as why a library was chosen, what a reviewer flagged, and what's still blocked, stay inside one tool's conversation unless you write them down somewhere else.

MemoryLake is a memory layer for that context, kept in one place you maintain. It connects to ChatGPT, Claude Code, and Codex. For Antigravity, paste the same written context into a conversation yourself, or turn the parts that are rules into AGENTS.md entries.

You write the entries yourself. Nothing is read out of, written to, or deleted from Antigravity's rule files, skills, or conversations, or from your CLAUDE.md files and Claude Code sessions. Antigravity and Claude Code each work the way Google and Anthropic describe them.

Step 1: Create an API key

Sign in and generate a key from the dashboard. Keep it somewhere private.

The MemoryLake console showing the API keys screen, where a new key is created and copied for use in an agent
The MemoryLake console showing the API keys screen, where a new key is created and copied for use in an agent

Step 2: Upload your first memories

Start with the note from Step 4 of the fix: decisions, rejected approaches, and open blockers.

The MemoryLake workspace with the first documents uploaded, listing each file as it becomes searchable memory
The MemoryLake workspace with the first documents uploaded, listing each file as it becomes searchable memory

Step 3: Connect your AI & agents

Connect Claude Code and the other assistants you use, so the same project context is there when you switch.

The MemoryLake integrations screen listing the AI clients and agent frameworks that can be connected to the memory layer
The MemoryLake integrations screen listing the AI clients and agent frameworks that can be connected to the memory layer

What this changes in practice

The first difference is fewer silent gaps. Shared rules live in one file both tools read, and you've confirmed Claude Code loads it.

The second is that lessons don't depend on one tool. A correction approved in Antigravity and a note Claude Code saved both trace back to context you wrote once.

The third is cleaner handoffs. Starting the other tool on the same branch doesn't mean re-explaining the last day of work.

Best practices for using Antigravity and Claude Code together

Check what each tool loaded. Use /memory in Claude Code and the Customizations panel in Antigravity.

Use valid triggers. Write always_on, not alwaysOn.

Keep CLAUDE.local.md in mind. It counts toward the check that stops Claude Code from reading AGENTS.md.

Review auto memory. The notes are plain markdown you can edit or delete.

Run /learn before closing important Antigravity sessions. Otherwise the lesson stays in the conversation.

Name sessions you'll come back to. Claude Code accepts claude --resume <name>, and Antigravity lets you rename conversations in the picker.

Conclusion

Antigravity keeps context in files. It reads AGENTS.md, GEMINI.md, and triggered rules from every level it touches, combines them, and keeps nothing from a conversation unless you approve a /learn proposal. Sessions resume per workspace, and long ones are compacted into checkpoint summaries.

Claude Code keeps context in files plus its own notes. It reads CLAUDE.md files and .claude/rules/, reads AGENTS.md under conditions you can change, and writes auto memory on its own by default. Sessions resume per directory or by name, and the project-root CLAUDE.md is re-read after compaction.

Frequently asked questions

Does Antigravity share memory with Claude Code?

No. Neither tool's documentation describes sharing memory with the other. A shared root AGENTS.md is the closest overlap, and Claude Code reads it only under its conditions.

Is Antigravity or Claude Code better for keeping project rules?

It depends on your setup. Antigravity combines AGENTS.md, GEMINI.md, and triggered rules. Claude Code reads CLAUDE.md files and recursive .claude/rules/, and reads AGENTS.md when no CLAUDE.md is present or when you choose both.

Does Claude Code read AGENTS.md?

Yes, from v2.1.277, when there's no CLAUDE.md, .claude/CLAUDE.md, or CLAUDE.local.md at or above the working directory. The claude-md-and-agents-md setting loads both.

Does Antigravity remember past conversations?

Not automatically. Its documentation says "Agents don't remember conversations." Use /learn to save a lesson as a rule or skill.

Is Claude Code auto memory on by default?

Yes, in local sessions. You can turn it off with the /memory toggle or autoMemoryEnabled.

How do I resume a session in each CLI?

In Antigravity, run agy -c or /resume. In Claude Code, run claude --continue or claude --resume.

Why does Antigravity ignore my rule file?

Files in .agents/rules/ need frontmatter with a valid trigger. Without it, the rule is discarded.