One Repository, Three Agents
Setting up git and GitHub for a project, then Antigravity, Claude Code and ChatGPT’s Codex on the same repository — what each installs, reads and isolates, and what happened when all three were asked the same question here
Three companies now sell you an agent that will edit your code: Google’s Antigravity, Anthropic’s Claude Code, OpenAI’s Codex inside ChatGPT. They are not interchangeable, and you do not have to choose. All three are installed on the machine this was written on, and all three have worked on the repository this site lives in. What makes that possible is not any of the three. It is the two tools underneath — git and gh — and one habit: the rules live in the repository, not in the agent.
This article is the setup, in the order it has to happen: git and GitHub first, then each agent with the same five questions asked of it — install, sign in, open the project, isolate, what it reads — on whichever of macOS, Ubuntu or Windows the machine runs. It ends with the three command-line agents asked one read-only question about this repository, and with what two of them did before they would answer at all — on the one machine, an M4 Mac, that ran all three.
Pick your platform once, here, and every install step below follows it. Windows keeps its two terminals apart rather than folding them together — native PowerShell and WSL are different shells with different commands, and the article says which one each command is for.
gitandghare the plumbing. Every agent here uses Git worktrees for parallel sessions, because a branch can only be checked out in one place at a time; Claude Desktop’s pull-request monitoring will not work without an authenticatedgh. Set them up before any agent.- Update before you judge. Two of the three CLIs refused the first question on this machine until updated — Codex because its configured model “requires a newer version,” Antigravity because its build was “no longer supported.” All three ship weekly.
codex update,agy update,claude update. - Each agent reads a different file.
CLAUDE.mdfor Claude Code,AGENTS.mdfor Codex,.agents/for Antigravity. Keep one set of rules in the repository and point the others at it. - Headless means deny-by-default. Asked from a script, Antigravity auto-denied every command and file read it could not prompt for, through four configurations, and answered on the fifth — the documented sandbox setting; Codex needed
--sandbox read-only; Claude answered in 16 s under--permission-mode plan. That is the permission model, not a bug, and it is the thing to configure first. - Isolate by default. Antigravity’s New Worktree Mode, Claude’s worktree option, Codex’s Worktree under the composer — same mechanism, three names. Use it for anything you would not want on your branch half-done.
First, git and GitHub
This is the part every agent assumes and none of them does for you. git itself is rarely the problem — Xcode’s command-line tools on macOS, already there or one line away on Ubuntu, its own installer on Windows. gh is worth installing deliberately on all three:
brew install git gh # git 2.52, gh 2.98 on the machine used heresudo apt install git ghUbuntu’s own package trails: apt-cache policy gh on a stock 24.04 image offers 2.45 out of universe, two years of releases behind the 2.98 on the macOS machine — the same “update before you judge” lesson as the agents themselves, one layer down. GitHub’s own repository is the fix, added once:
sudo mkdir -p -m 755 /etc/apt/keyrings
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
| sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
| sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update && sudo apt install ghPowerShell (native Windows):
winget install --id Git.Git
winget install --id GitHub.cliWSL (Ubuntu inside Windows): the same command as the Ubuntu tab, run inside the WSL terminal, not PowerShell — sudo apt install git gh, with the same stale-gh caveat.
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
git config --global init.defaultBranch main
gh auth login # browser flow; the token lands in the system credential storegh auth login asks two questions that matter later. Git protocol: choose SSH, and let gh upload a key for you (gh ssh-key add ~/.ssh/id_ed25519.pub) — the agents will push branches, and a password prompt in the middle of an agent’s run is a session lost. Scopes: the browser flow grants what gh needs; if you paste a token instead, the minimum is repo, read:org and gist. gh auth status confirms the account, the protocol and where the token is stored — Keychain on macOS, Credential Manager on Windows, whatever keyring Ubuntu’s desktop offers, a plain file if there isn’t one.
Two things about gh that were true before agents and matter more now. gh repo create --source . --push turns a folder into a repository on GitHub in one line, which is the moment an agent’s work stops being local. And gh pr create, gh pr checks --watch and gh pr merge --squash are the three commands the desktop apps run for you when they open, watch and merge a pull request — Claude Desktop’s docs say plainly that PR monitoring “requires the GitHub CLI to be installed and authenticated.” gh 2.98 also carries the platform’s own agent era in two subcommands: gh copilot runs the Copilot CLI, and gh agent-task creates and tracks tasks for GitHub’s coding agent. They are not covered here; they are the fourth and fifth agents you could add to the same repository.
A branch can be checked out in one working directory at a time. A Git worktree is a second checkout of the same repository in another folder, sharing history but with its own files and its own branch. All three agents use worktrees to run sessions in parallel without touching your working directory — Antigravity calls it New Worktree Mode, Claude Code the worktree option, Codex simply Worktree. git worktree list shows every one of them, whichever tool made it.
Antigravity
Google’s is the newest and the most sprawling: four surfaces, one account. Antigravity 2.0 is the desktop “command center” — it manages agents, not files. Antigravity IDE is the editor, a VS Code-family application (its user directory is ~/.antigravity/, and on this machine the Claude Code extension is installed inside it). Antigravity CLI is agy. And there are extensions for VS Code, JetBrains, Zed, Xcode and Visual Studio. Free for individuals — the model list on the free tier is Gemini 3.8, 3.7 and 3.6 Flash, Gemini 3.1 Pro, Claude Sonnet and Opus 4.6, and gpt-oss-120b, with weekly rate limits; Google AI Pro and Ultra buy more quota. No bring-your-own-key.
Install. The app from antigravity.google/download. Requirements and the CLI install both differ by platform:
macOS 12 or newer — in the docs’ words, “X86 is not supported,” though the download page still lists an Intel build.
curl -fsSL https://antigravity.google/cli/install.sh | bash # installs ~/.local/bin/agyglibc 2.28+ and glibcxx 3.4.25+ — in practice Ubuntu 20.04+ (also Debian 10+, Fedora 36+, RHEL 8+). The CLI installs with the same script as macOS:
curl -fsSL https://antigravity.google/cli/install.sh | bash # installs ~/.local/bin/agyWindows 10 (64-bit) or newer, x64 or ARM64.
PowerShell (native Windows):
irm https://antigravity.google/cli/install.ps1 | iex # installs to %LOCALAPPDATA%\agy\binWSL (Ubuntu inside Windows): the same curl … | bash script as the Ubuntu tab, run inside the WSL terminal. Pick one side and stay there — agy from the native Windows installer is not on WSL’s PATH, and the Linux script run inside WSL needs its own symlink to reach it from the Windows side.
agy # first run signs you in with your Google account
Open the project. In 2.0, agents work inside Projects, “which define the boundaries of the folders and repositories they can access”: the folder icon with a +, New Project, Add Folder — several folders give an agent cross-repository context. In the CLI, agy starts in a default project; agy --new-project makes one; --add-dir adds a directory to the workspace, which matters below.
Isolate. When you start an agent in 2.0 you choose Local Mode (“operates directly in your active folders”) or New Worktree Mode (“an isolated Git worktree”). Subagents can inherit the workspace, branch into a worktree, or share.
Permissions. This is where Antigravity is most explicit. Every sensitive act is a resource — read_file(path), write_file(path), command(prefix), read_url(domain), mcp(server/tool) — evaluated against three lists, deny, ask, allow, with deny winning. Reads and writes inside the workspace are auto-allowed; everything else defaults to ask. The CLI adds three execution modes cycled with Shift+Tab — default pauses for a diff review before every write, accept-edits does not, plan outlines first — and an optional OS sandbox, no VM: sandbox-exec on macOS, namespaces on Linux, with no network unless a domain is allowed.
What it reads. Custom subagents live in .agents/agents/<name>.md in the repository or ~/.gemini/config/agents/ globally; the docs list Rules, Skills, Hooks and Plugins under Customizations. CLI settings are in ~/.gemini/antigravity-cli/settings.json.
Claude Code, in Claude Desktop
Claude Code is a terminal program that also lives as the Code tab in the Claude Desktop app — same engine, same files, a graphical front. Sessions are sidebar tabs; each has a project folder, an environment (Local, Cloud, SSH, WSL), a model, and a permission mode.
Install. The desktop app from claude.ai (macOS universal, Windows, Linux in beta); sign in; click Code. The CLI, if you want both:
curl -fsSL https://claude.ai/install.sh | bash # or: brew install --cask claude-codecurl -fsSL https://claude.ai/install.sh | bashDebian, Ubuntu, Fedora, RHEL and Alpine also each get a signed apt/dnf/apk repository as an alternative to the script.
PowerShell (native Windows):
irm https://claude.ai/install.ps1 | iex # or: winget install Anthropic.ClaudeCodeGit for Windows is the one thing worth adding here: with it, Claude Code gets the same Bash tool as macOS and Linux; without it, it shells out to PowerShell instead.
WSL (Ubuntu inside Windows): the same script as the Ubuntu tab, run inside the WSL terminal — no Git for Windows needed there.
claude # signs in; `claude update` keeps it current
Open the project. Start a session, pick the folder. Type the task.
Isolate. The worktree option next to the branch name at session start gives the session “its own isolated copy of your project using Git worktrees,” under <project>/.claude/worktrees/ by default. A .worktreeinclude file at the repository root lists gitignored files — .env is the usual one — that each worktree should receive a copy of. On the CLI the same thing is --worktree.
Permissions. Five modes in the selector, remembered per folder: Manual (asks before edits and commands), Accept edits, Plan (no source edits), Auto (runs with background safety checks), and Bypass permissions, which has to be enabled in Settings. The CLI’s --permission-mode maps onto the same names.
Pull requests. When Claude opens one, a CI status bar appears with two toggles — Auto-fix re-runs on failing checks, Auto-merge squashes once they pass — and the session can auto-archive when the PR closes. All of it through gh.
What it reads. CLAUDE.md at the repository root (and in subdirectories), CLAUDE.local.md for your private additions, .claude/rules/ for path-scoped rules, ~/.claude/CLAUDE.md for you everywhere, and .claude/skills/ for procedures. Desktop and CLI read the same files, the same ~/.claude/settings.json, the same .mcp.json; /desktop in a terminal moves that session into the app.
ChatGPT, and Codex
OpenAI’s naming takes a sentence to untangle. ChatGPT desktop is the app; its docs call it “your command center for complex work” and the composer offers a choice: ChatGPT or Codex. Codex is the coding agent, and it has four surfaces — inside the ChatGPT desktop app for local work, the Codex CLI, the IDE extension (openai.chatgpt, for VS Code, Cursor and Windsurf; Xcode and JetBrains have their own), and Codex cloud, which runs in OpenAI’s containers against a repository connected on GitHub. Sign in with a ChatGPT plan or, for the local surfaces, an API key; cloud needs the plan.
Install. The app from chatgpt.com/download. The CLI:
curl -fsSL https://chatgpt.com/codex/install.sh | sh # or: npm install -g @openai/codexcurl -fsSL https://chatgpt.com/codex/install.sh | sh # or: npm install -g @openai/codexPowerShell (native Windows): OpenAI shipped a native installer in early 2026, which it still labels experimental while it hardens the Windows sandbox.
WSL (Ubuntu inside Windows): the same script as the Ubuntu tab, under the same Linux sandbox Codex runs on Ubuntu — the safer default until the native label lifts.
codex login # browser flow
codex update # see below for why this is not optionalOpen the project. In the desktop app: open a folder or a project, choose Codex, New chat. In a terminal: codex in the directory.
Isolate. Under the composer, select Worktree and a base branch; Codex creates a worktree in a detached HEAD state. Handoff moves a chat and its code between Local and Worktree — the docs explain the reason in the same words as the callout above: Git only allows a branch in one place, so the app does the checkout dance for you. Create branch here turns a worktree into a branch you can push and open a pull request from.
Permissions. Two layers: a sandbox mode — what Codex can technically touch (by default no network, writes only inside the workspace, enforced by the OS) — and an approval policy — when it stops to ask. The read-only look is codex --sandbox read-only --ask-for-approval on-request; the working preset is Auto, --sandbox workspace-write with on-request. The old untrusted policy is gone and stops the client from starting if it is still in a config file.
Review. /review in the app, the CLI or the extension reviews against a base branch or the uncommitted changes without touching the tree. On GitHub, @codex review in a PR comment posts a review, and a ## Code Review Rules section in AGENTS.md tells it what to check.
What it reads. AGENTS.md, with a documented precedence: ~/.codex/AGENTS.md (or AGENTS.override.md) for you, then every directory from the Git root down to where you are, later files overriding earlier, 32 KiB in all. Its own advice on what to put there is the best short guide to any of these files: build and test commands, review expectations, the conventions you keep re-explaining — and when the agent makes the same mistake twice, tell it to add the rule itself.
The files, and the one habit
| Agent | Reads | For you, everywhere |
|---|---|---|
| Claude Code | CLAUDE.md, CLAUDE.local.md, .claude/rules/, .claude/skills/ |
~/.claude/CLAUDE.md |
| Codex, ChatGPT | AGENTS.md (and AGENTS.override.md), walked from the Git root |
~/.codex/AGENTS.md |
| Antigravity | .agents/agents/ for subagents; Rules, Skills, Hooks under Customizations |
~/.gemini/config/ |
Three agents, three filenames, one repository. The way to keep them from diverging is to refuse to write the rules three times. Put them in one file — this site’s video projects keep AGENTS.md and CLAUDE.md identical, which is the cheap version — or keep the rules in AGENTS.md and make CLAUDE.md one line: read AGENTS.md. What goes in it is what all three vendors say goes in it: how to build, how to test, what never to commit. This repository’s rule is the third kind — nothing about a real person’s money goes into git — and it is the rule every agent working here has to know before its first command.
Three agents, one question
The same read-only question, asked of the three CLIs in this repository’s root, on an M4 with 24 GB, on 13 September 2026:
Which files at the root of this repository (or in
.claude/) are instructions for AI agents, and what is the one rule they most insist on?
| Command | First attempt | Then | |
|---|---|---|---|
| Claude Code 2.1.266 | claude -p "…" --permission-mode plan |
Answered in 16 s: the only instruction file is .claude/skills/okf/SKILL.md, and its rule is run, do not quote — derive figures from attested computations. Correct. |
— |
| Codex 0.132.0 → 0.154.0 | codex exec --sandbox read-only "…" |
Refused: “The ‘gpt-6-astra’ model requires a newer version of Codex.” | codex update (8 s), then answered in 23 s, 12,119 tokens: the same file, the same rule, in its own words. Correct. |
| Antigravity CLI 1.2.2 | agy --add-dir "$PWD" --print "…" |
Refused: “This version… is no longer supported. Please run agy update.” | Updated; then “a tool required the command permission that headless mode cannot prompt for, so it was auto-denied” — and again with --sandbox, with allow-rules for ls, cat, find, grep, and with the repository added by --add-dir. On the fifth configuration — enableTerminalSandbox: true, toolPermission: "proceed-in-sandbox" in settings.json, plus --add-dir — it answered in 54 s: the same file, the same rule. Correct. |
Read the third row as the permission model doing its job. Headless, with no one to ask, Antigravity denies everything not explicitly allowed, and an allow-list has to name the exact commands an agent will choose — which is the wrong side of the problem. The configuration that worked is the one its docs describe for exactly this: the OS sandbox on, and proceed-in-sandbox, under which commands that stay inside the sandbox run without asking and only an escape from it would prompt. The blunt alternative is --dangerously-skip-permissions, whose name is the warning. Interactively, none of this arises: it asks, you press y. The lesson is not that one agent is better — all three ended with the same correct answer. It is that update and permissions are the first two things to settle on a new machine, and that a script is the only honest way to find out you have not.
Working the same repository
What the setup buys, once it is done:
- One agent per worktree, never two in one directory. Antigravity in a New Worktree, Claude with worktree on, Codex on Worktree — three sessions on three branches of one repository, and
git worktree listto see them all. Merge through pull requests, which is whatghis for. - Let the repository carry the rules.
AGENTS.mdandCLAUDE.md, checked in;CLAUDE.local.mdand~/.codex/AGENTS.mdfor the parts that are only yours. - Use each for what it is shaped for. Antigravity’s scheduled tasks and Remote Control for the long unattended run; Claude Desktop’s diff review and CI toggles for the pull request you are going to merge; Codex’s
/reviewand@codex reviewfor the second pair of eyes; the CLIs for anything you would put in a script. - Keep secrets out of all of them. Every one of these tools can read what the workspace can read.
.gitignoreis not a boundary an agent respects unless its permissions say so; the OWL Planner’s rule — personal files outside the tree — is the durable version.
What to do this week
gh auth loginwith SSH, thengh auth status. Before any agent.- Update all three —
codex update,agy update,claude update— and make it the first line of your setup notes, because next week it will be true again. - Write one
AGENTS.md: build, test, never-commit. MakeCLAUDE.mdpoint at it. - Start every non-trivial task in a worktree, and delete the worktree when the PR merges.
- Ask each agent one read-only question from a script before you trust it with a write. What refuses, and why, is your permission model, spelled out.
Sources
Research notes — the pages read, the versions on this machine, the probe’s full output, and the pages that could not be fetched — are in the accompanying folder.
- git and GitHub. GitHub CLI manual;
gh auth login --help;git worktreein the Git documentation. - Antigravity. Getting Started with Antigravity 2.0; CLI installation, execution modes, projects, permissions, sandbox; agent permissions, subagents, models, plans, Remote Control; pricing.
- Claude Code. Claude Code in the Claude Desktop app; CLAUDE.md and memory; Advanced setup — platforms, package managers, Windows and WSL.
- ChatGPT and Codex. ChatGPT desktop app; Codex CLI; Codex cloud; IDE extension; Worktrees; AGENTS.md; Authentication; Code review; Agent approvals and security; Review GitHub pull requests with Codex.