Antigravity vs Codex at a glance
| Dimension | Antigravity | Codex |
|---|---|---|
| Project instruction files | AGENTS.md or GEMINI.md in any directory, plus .agents/rules/*.md | AGENTS.override.md or AGENTS.md, one per directory from project root to working directory |
| Global instructions | ~/.gemini/AGENTS.md, ~/.gemini/GEMINI.md, or modular rules in ~/.gemini/config/rules/ | ~/.codex/AGENTS.override.md or ~/.codex/AGENTS.md, first non-empty file |
| How layers combine | Cumulative; more specific directory rules take priority | Concatenated root-down; files closer to the working directory appear later and override |
| Size limits | 24,000 bytes per rule file; 20,000-token budget for global and always-on rules | 32 KiB combined by default, set by project_doc_max_bytes |
| Memory from past chats | "Agents don't remember conversations"; /learn proposes a rule or skill for approval | Local memories generated from eligible chats; off by default |
| Where learned context is stored | Rule and skill files you approve | Under ~/.codex, in memories/ or memories_v2/ |
| Resuming in the CLI | Scoped to the working directory; agy -c or /resume | codex resume scoped to the current directory unless you pass --all |
| Reviewing and removing | Rename or delete conversations in the /resume picker; edit rule files | /memories per chat; Delete Codex memories in the desktop app |
Checked against each vendor's documentation on December 3, 2026.
How Antigravity keeps your context
Antigravity runs as an app, a CLI called agy, and an IDE. Its rules documentation applies to all three.
Instructions
Antigravity's rules page calls rules "persistent instructions, coding standards, and architectural constraints that shape how Antigravity behaves in your codebase." It looks for them in several places:
- Directory files. An
AGENTS.mdorGEMINI.mdfile, or a.agents/rules/folder, in any subdirectory. When the agent reads or edits a file, it walks up from that file's folder to the workspace root and loads rules at each level. - Global files.
~/.gemini/AGENTS.mdor~/.gemini/GEMINI.mdapply to all projects on your machine, and modular global rules go in~/.gemini/config/rules/.
Files in a rules/ folder need YAML frontmatter with a trigger value: always_on, model_decision, glob, or manual. The documentation warns that if a rule file omits frontmatter or uses an unrecognized trigger, "Antigravity silently discards the rule."
Memory from past chats
The /learn documentation starts with a clear statement: "Agents don't remember conversations." It continues that a lesson you teach the agent disappears when the conversation ends, "unless it's written down as a customization."
/learn is how you write it down. The agent reviews recent messages for corrections, decides whether the lesson is a rule or a skill, and drafts a learning_proposal.md file. The documentation says the agent "never edits configuration files immediately." It applies the change only after you approve it.
Past sessions
In the CLI, conversation history is scoped to your working directory. Run agy -c to resume the most recent conversation for that workspace, or /resume to open a picker. The picker lets you search, rename with F2, and delete with F4. A separate tab lists conversations started in the Antigravity App, which you can import into the CLI.
/fork copies the conversation into a new session. The documentation notes that it "clones the conversation thread, not your local Git checkout."
How Codex keeps your context
Codex runs in the ChatGPT desktop app, the Codex CLI, and an IDE extension. Its instruction and memory documentation covers all three.
Instructions
OpenAI's documentation says: "Codex reads AGENTS.md files before doing any work." It builds an instruction chain when it starts:
- Global. In
~/.codex, Codex readsAGENTS.override.mdif it exists, otherwiseAGENTS.md, and uses only the first non-empty file. - Project. Starting at the project root, Codex walks down to your working directory and includes at most one file per directory:
AGENTS.override.md, thenAGENTS.md, then any fallback names you configure.
Files closer to your working directory appear later in the combined prompt, so they override earlier guidance. The documentation adds that "Codex stops searching once it reaches your current directory".
Memory from past chats
Codex can turn useful context from eligible past chats into local memory files. The documentation says it skips active or short-lived sessions, redacts secrets from generated memory fields, and updates memories in the background.
The feature starts off. The documentation says: "Local Codex memories are off by default." You turn it on in the ChatGPT desktop app under Settings > Personalization, or with a feature flag in config.toml. Memories are stored under ~/.codex, in memories_v2/ for a fresh profile or memories/ if that store already exists. For a longer walkthrough, see does Codex have memory.
Past sessions
codex resume reopens a saved chat. The documentation says it "scopes --last to the current working directory unless you pass --all." codex fork copies a previous session into a new chat, and /fork does the same inside a session.
Where they differ
Which instruction files each one reads
Antigravity reads AGENTS.md and GEMINI.md, plus .agents/rules/*.md files with frontmatter triggers. Codex reads AGENTS.override.md and AGENTS.md, plus any fallback filenames you list in its config. A shared AGENTS.md in the repository root is read by both. A file in .agents/rules/ is read by Antigravity. The Codex documentation doesn't list .agents/rules/ among the places Codex reads instructions from.
How far each one looks
Antigravity walks up from each file it reads or edits to the workspace root, so a rule in a deep subdirectory loads when the agent touches a file there. Codex walks down from the project root to the directory you start in, and stops there. In Codex, a rule file in a subdirectory below your working directory isn't part of the starting chain. The Codex documentation suggests placing overrides close to specialized work and starting Codex from that directory.
How conflicts resolve
Antigravity's rules are "cumulative rather than replacement-based", and when instructions conflict, more specific directory rules take priority. Codex concatenates files from the root down, and files closer to the working directory override earlier guidance because they appear later. Both favor the more specific location, through different mechanisms.
What happens to lessons from a chat
In Antigravity, a lesson persists only if it becomes a rule or skill file, and /learn drafts that file for your approval. In Codex, local memories, once enabled, are generated in the background from eligible chats, and you control them per chat with /memories. The Codex documentation also says to treat memories as "a helpful recall layer, not as the only source for rules that must always apply."
How each one limits size
Antigravity truncates any single rule file over 24,000 bytes and gives global and always-on rules a shared 20,000-token budget; over the budget, the largest files become pointers the agent reads on demand. Codex stops adding instruction files once the combined size reaches project_doc_max_bytes, 32 KiB by default.
Where they work the same way
Both read AGENTS.md. A root AGENTS.md is a shared starting point for either tool.
Both have a global layer. Each reads a personal file from its own home directory before project files.
Both scope CLI history to the working directory. Antigravity scopes conversation history to your working directory, and codex resume --last picks from the current directory by default.
Both can fork a conversation. Neither fork copies your files. Antigravity says so directly, and Codex offers a managed Git worktree option for isolation.
Both package workflows as skills. Antigravity stores workspace skills in .agents/skills/. In Codex, a skill packages instructions and supporting resources for a specific task.
Which one fits which job
If your repository already uses directory-level rule files with triggers, Antigravity reads them as written, including glob and model_decision rules.
If you want context from past chats to carry forward automatically, Codex's local memories do that once enabled, with per-chat control.
If you want every persistent lesson reviewed before it's saved, Antigravity's /learn drafts a proposal and writes only after approval.
If you work from many subdirectories of one repository, note that Antigravity loads rules as it touches files, while Codex builds its chain from where you start.
If you need team rules that always apply, both point to checked-in instruction files rather than memory.
Using both
If you use both tools on the same repository, your context ends up in several places:
- A root
AGENTS.mdthat both read. - Antigravity-only files:
GEMINI.md,.agents/rules/,.agents/skills/, and your~/.geminiglobal files. - Codex-only files and state:
AGENTS.override.md,~/.codex/AGENTS.md, and local memories in~/.codex. - Conversation history in each tool, scoped to the working directory.
Nothing syncs between them. A lesson Antigravity saves through /learn goes into an Antigravity rule file, and a Codex memory stays in ~/.codex. To keep them aligned, put shared rules in the root AGENTS.md, and copy anything else by hand.
What people try first
Putting everything in .agents/rules/ and expecting Codex to read it. Codex reads AGENTS.md-style files per directory.
Starting Codex at the repository root and expecting subdirectory overrides. Codex stops at the directory you start in.
Using camelCase triggers in Antigravity. Values like alwaysOn are discarded without warning.
Expecting Codex memories to work out of the box. They're off by default.
Expecting Antigravity to remember yesterday's correction. Run /learn and approve the proposal.
The Fix: Keep one source of truth for project context
Step 1: Put shared rules in the root AGENTS.md
Write rules both tools must follow in the repository root AGENTS.md, without frontmatter.
Step 2: Keep tool-specific files small
Use .agents/rules/ for Antigravity triggers and AGENTS.override.md for Codex overrides, and keep each one focused.
Step 3: Review what each tool learned
Approve or edit /learn proposals in Antigravity, and check /memories settings in Codex before relying on them.
Step 4: Write the cross-tool context in your own words
Decisions, constraints, and reasons that aren't rules belong in a short note you maintain and can paste into either tool.
Setting this up in MemoryLake
Instruction files cover rules. The rest of your project context, such as why an approach was chosen, what's blocked, and what a reviewer asked for, ends up in chat when it isn't written down, and chat history stays with each tool.
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 Codex's AGENTS.md files, local memories, or sessions. Each tool works the way its vendor describes.
Step 1: Create an API key
Sign in and generate a key from the dashboard. Keep it somewhere private.

Step 2: Upload your first memories
Start with the note from Step 4 of the fix: decisions, constraints, and the reasons behind them.

Step 3: Connect your AI & agents
Connect Codex, Claude Code, and ChatGPT, so the same context is available in each one.

What this changes in practice
The first difference is fewer repeated explanations. The reasons behind your rules are written down once.
The second is easier switching. Moving a task from one tool to the other means pasting or connecting the same note, not reconstructing it from chat.
The third is cleaner instruction files. When background context lives elsewhere, AGENTS.md can stay short and rule-focused.
Best practices for using Antigravity and Codex together
Start with a root AGENTS.md. Both tools read it.
Use valid trigger values in Antigravity. Check spelling against the documented list.
Start Codex in the directory you're working in. That's where its instruction chain ends.
Decide whether you want Codex memories. Turn them on deliberately and review them.
Run /learn after a correction in Antigravity. Otherwise the lesson ends with the conversation.
Keep rule files under the size limits. Antigravity truncates large files, and Codex stops adding files at its cap.
Resume from the directory you started in. Both tools scope history to the working directory, so that's where your earlier sessions show up.
Conclusion
Antigravity keeps your context in rule and skill files. It reads AGENTS.md, GEMINI.md, and .agents/rules/ from any directory it touches, combines them cumulatively, and turns lessons into files only through /learn with your approval. Its CLI scopes conversations to your working directory, with resume, rename, delete, and fork.
Codex keeps your context in AGENTS.md files read from the project root to your working directory, and, if you turn them on, in local memories generated from past chats under ~/.codex. Its CLI scopes codex resume --last to the current directory unless you pass --all, with fork available too. A shared root AGENTS.md, plus a written note for everything that isn't a rule, keeps both tools working from the same context.