Skip to content

Multi-Repo Agent Context: The Hub Pattern vs. Segregated Projects Across Antigravity, Claude Code, Codex, and Beyond

Dark isometric architectural illustration of a luminous gold central hub monolith radiating light conduits into modular frosted-glass sapphire and teal repository nodes

If you maintain more than a handful of related repositories—apps, shared libraries, design systems, infrastructure, documentation—and you regularly bounce between AI coding harnesses, you eventually hit an architectural question that nobody's quickstart guide answers well:

Where should your AGENTS.md files, skills, and subagents actually live?

At first glance, the answer seems obvious: put each repository's instructions in that repository. Clean separation of concerns, right?

Not so fast. Once you actually trace how Antigravity, Claude Code, Codex CLI, Kimi Code CLI, MiniMax (mcode), OpenCode / Oh My Pi (omp), and Grok Build discover and merge context across folders, you realize they do not share a single mental model. Designing your workspace for one harness can quietly handicap you in another—unless you understand the exact mechanics under the hood.


Three Very Different Mental Models for Multi-Folder Context

The industry has mostly converged on two file conventions: AGENTS.md (or CLAUDE.md) for always-on behavioral rules, and SKILL.md (YAML frontmatter + Markdown body) for progressive-disclosure workflows. Where harnesses still diverge sharply is how they walk the filesystem when your work spans multiple repositories.

1. Antigravity (App & CLI): First-Class Multi-Folder Projects

Antigravity treats a Project not as a single Git checkout, but as a named collection of folders with its own isolated settings and permissions. When you add multiple folders to an Antigravity Project (or pass --add-dir / /add-dir in agy), every added folder is treated as a full workspace root:

  • Antigravity scans each folder (walking upward to its .git root) and loads its AGENTS.md, GEMINI.md, .agents/rules/*.md, .agents/skills/, .agents/agents/, hooks, plugins, and MCP configs.
  • Rules are cumulative, not overwriting—each rule is tagged with its resolved file path so the model knows which repo owns which constraint.
  • The first folder in the Project acts as your default shell working directory (CWD), making it natural to put a lightweight orchestration/hub folder at the top.
  • It does not scan downward into subfolders below a workspace root. If you open a parent directory, Antigravity will not automatically pick up subproject/AGENTS.md unless that subfolder is explicitly added to the Project.

One detail Antigravity gets notably right is surface unification: the Antigravity Desktop App and the agy CLI share the same project registrations, workspace rules, global rules (~/.gemini/AGENTS.md), and global skills (~/.gemini/config/skills/), while still respecting surface-specific subfolders (~/.gemini/antigravity-cli/) when CLI-only behavior is needed.

2. Claude Code: The Two-Way Tree (Eager Up, Lazy Down)

Claude Code takes a fundamentally different approach anchored to your starting directory:

  • Upward (Eager): At session startup, Claude Code walks up from your current working directory to the repository root, loading every CLAUDE.md / AGENTS.md it finds along the way.
  • Downward (Lazy): Any CLAUDE.md or AGENTS.md sitting in a subdirectory below your starting folder is invisible at startup—and then lazy-loaded on demand the moment Claude reads or writes a file inside that subfolder.
  • Additional Directories (--add-dir): Passing extra sibling folders primarily expands file access; pulling memory files from external directories requires explicitly opting in (CLAUDE_CODE_ADDITIONAL_DIRECTORIES_MEMORY=1), and it does not unify multi-repo project registrations, skills, and subagents the way Antigravity's Project model does.

That lazy downward loading is a quiet superpower if your workspace nests child checkouts or Git worktrees inside a single hub directory: you pay zero tokens for a subproject's rules until the agent actually steps into it.

3. OpenAI Codex CLI: Single-Chain Root-to-CWD Concatenation

Codex CLI builds a single deterministic instruction chain once per session:

  1. Global scope (~/.codex/): Loads AGENTS.override.md if present, otherwise AGENTS.md.
  2. Project scope (Git root → CWD): Walks down from the repository root to your current working directory, checking AGENTS.override.md then AGENTS.md at each level and concatenating them in order so deeper directories override broader ones.
  3. Hard cap: Combined instruction files are capped by project_doc_max_bytes (default 32 KiB); once hit, Codex stops appending.

While --add-dir lets Codex reach extra directories and skills (with optional openai.yaml metadata), its core AGENTS.md bootstrap remains anchored to a single root-to-CWD chain rather than composing multiple peer repositories into one unified project context.

4. The Rest of the Field: Kimi, MiniMax, OpenCode / OMP, and Grok

Zooming out beyond the big three reveals how quickly the open ecosystem is converging—and where the gaps still are:

  • Kimi Code CLI (Kimi K3): Quietly one of the most pragmatic multi-harness citizens. In multi-directory workspaces (--add-dir), Kimi merges project-level skills across the primary and additional folders (primary wins on name collision) and natively reads .agents/skills/, .claude/skills/, .codex/skills/, and .kimi-code/skills/ without forcing you to duplicate your library.
  • MiniMax (mcode): Pairs a clean TUI and headless mcode exec runner with AGENTS.md (mcode init .) and its open-sourced MCode Stack of SKILL.md packs—explicitly designed for progressive disclosure, context compaction, and cross-installation into other harnesses.
  • Oh My Pi (omp) & OpenCode: Standardize cleanly on AGENTS.md directory-walking (closest file wins) and agentskills.io (SKILL.md) progressive disclosure across .agents/skills/, user config directories, and plugin paths.
  • Grok Build (grok): On paper, Grok's CLI has strong compatibility—reading AGENTS.md, CLAUDE.md, .claude/rules/, .cursor/rules/, and .agents/skills/, plus a handy grok inspect command to audit token footprints. In practice, xAI's heavy shift toward Grokpod has left the standalone CLI feeling secondary compared to the pace of Antigravity, Claude Code, and Codex.

Side-by-Side Comparison

Harness Multi-Folder Project Bootstrapping Subfolder AGENTS.md Below CWD Skills & Agents Scope Key Size / Budget Cap Session History
Antigravity Native — every folder in a Project is a full root No downward scan .agents/skills/, .agents/agents/, JSON manifests 24 KB/file + 20k-token aggregate rules budget Proprietary (~/.gemini/antigravity-cli/)
Claude Code File access via --add-dir (memory opt-in) Yes — lazy-loaded on file read/write .claude/ & .agents/ (progressive disclosure) Context window; @ imports load eagerly Proprietary (~/.claude/projects/*.jsonl)
Codex CLI Single root-to-CWD chain; --add-dir for extra dirs/skills No lazy downward load .agents/skills/, skills/ (+ openai.yaml) 32 KiB (project_doc_max_bytes) Proprietary (~/.codex/sessions/)
Kimi Code CLI Merges skills & @ search across --add-dir Workspace ${agents_md} Reads .agents/, .claude/, .codex/, .kimi-code/ Progressive skill index Proprietary (~/.kimi-code/)
MiniMax (mcode) Single-repo TUI + headless mcode exec Project AGENTS.md .agents/skills/ (SKILL.md MCode Stack) Context compaction Proprietary local state
OMP / OpenCode Upward walk + nested subproject aggregation Closest AGENTS.md wins .agents/skills/, .opencode/skills/, plugins Progressive skill index Proprietary per harness
Grok Build Upward walk from CWD to Git root Deeper overrides parent .grok/skills/, .agents/skills/, plugins Auditable via grok inspect Proprietary (~/.grok/)

The Hidden Trap: Silent Truncation and Always-On Bloat

Before deciding where to put your files, there is a real-world failure mode worth calling out because it bites silently.

Every harness enforces hard ceilings on always-on rules. In Antigravity, any single rule file is capped at 24,000 bytes (24 KB), and all always-on rules combined share a 20,000-token budget (where the largest files get demoted to path pointers first, regardless of folder order). In Codex, the combined chain caps at 32 KiB.

If you manage a shared global AGENTS.md that combines personal workstation rules with a company CLI's managed context block, it is remarkably easy to cross 24 KB without noticing. When that happens, everything below the cutoff simply vanishes. In my own audit, a 51 KB personal global block sitting above a 5 KB company block meant Antigravity was silently dropping more than half of my personal rules and 100% of the company context block on every single turn.

The fix is straightforward and pays dividends on every harness:

  1. Keep global AGENTS.md lean (under ~12 KB). Keep only true always-on invariants in the global file, and move host tables, credential maps, and hardware reference specs into on-demand docs with one-line pointers.
  2. Trim skill frontmatter descriptions. Skills use progressive disclosure, which is great—except their name and description are injected on every turn. Tightening bloated 600–1,000 byte descriptions down to crisp 150–220 byte triggers easily cuts 50–60% of standing skill-index overhead.
  3. Audit stale personas and auto-imports. Dead agent definitions and retired skills accumulate fast across ~/.claude/, ~/.gemini/, ~/.codex/, and ~/.agents/ if your sync tooling doesn't actively prune them.

Choosing an Architecture: Segregated Per-Repo vs. The Single Hub

Once you see how these harnesses actually work, two clean architectures emerge—and the right choice depends entirely on whether you are single-harness or cross-harness.

Architecture A: Segregated Per-Repo (Best If You Live in Antigravity)

If you work exclusively (or primarily) inside Antigravity, its multi-folder Project model unlocks a genuinely clean segregation of concerns:

  • Every repository owns its own ultra-lean AGENTS.md (say 20–40 lines), its own repo-coupled .agents/skills/, and its own repo-coupled .agents/agents/.
  • Your primary (first) folder in the Project is a lightweight orchestration root that sets your default CWD and explains how the sibling repositories relate to one another.
  • Add the related repositories into the same Antigravity Project, and Antigravity automatically composes every repo's rules, skills, and subagents—while keeping each individual repository completely self-contained and razor-thin if you ever open it standalone.

The only discipline required is keeping each repo's AGENTS.md small enough that the sum of your Project's folders stays comfortably under the 20,000-token rules budget, prefixing skill/agent names so sibling repos don't collide, and sticking to Local Mode (since Antigravity's New Worktree Mode spins up worktrees for every Git checkout in a multi-folder Project at once).

Architecture B: The Single Hub Repository (The Cross-Harness Sweet Spot)

If you use Antigravity, Claude Code, Codex, and Kimi side-by-side—whether to hedge against vendor lockouts, match models to tasks, or avoid betting your workflow on a single provider—segregating skills and agents into 15 separate repositories immediately creates an asymmetry:

  • Antigravity's multi-folder Project sees all of them automatically.
  • Claude Code and Codex, started from a hub directory, do not automatically merge sibling repositories' skills and subagents.

That is why the Hub Pattern—a single primary hub repository holding your estate map, cross-repo decisions, shared .agents/skills/, and shared .agents/agents/, with product repositories checked out as isolated worktrees underneath—remains the strongest all-in-one cross-harness architecture today:

  • You start every session from the exact same folder in Antigravity, Claude Code, Codex, Kimi, or OpenCode, and get the exact same rules, skills, and subagents everywhere.
  • In Claude Code, nesting worktrees inside the hub gives you a bonus: Claude's lazy downward loading automatically pulls in a product repo's AGENTS.md the moment it starts editing files inside that worktree.
  • Private operational runbooks, fleet conventions, and internal deployment context stay safely inside your private hub repo rather than leaking into public product repositories.

You can always peel repo-specific skills out into standalone repositories later if a repo needs to be shared externally—without breaking your day-to-day multi-harness workflow in the meantime.


The Last Unstandardized Frontier: Session History

Step back and look at how far agentic tooling has come in a single year:

  • Instructions have largely converged on AGENTS.md.
  • Capabilities have largely converged on SKILL.md (agentskills.io).
  • Workspaces are getting smarter—Antigravity even shares project registrations, rules, skills, and agents cleanly between its Desktop App and CLI while respecting surface-specific subfolders.

Yet there is one layer that remains completely sharded and proprietary across every single vendor: session history.

Claude Code writes ~/.claude/projects/<slug>/*.jsonl. Codex writes ~/.codex/sessions/. Antigravity writes a local SQLite index plus protobuf summaries and artifact directories under ~/.gemini/antigravity-cli/. Kimi, Grok, and OpenCode each maintain their own private stores.

Your rules are now portable. Your skills are now portable. Even your models are swappable. Your continuity is still trapped inside whichever harness you opened that morning.

Until the ecosystem standardizes a portable conversation and decision log—or you externalize durable memory, architecture decisions, and handoff artifacts into your own repository or knowledge store—the real leverage isn't chasing the newest harness feature. It's keeping your context lean, keeping your hub portable across tools, and writing down every decision that matters in plain Markdown where every agent can read it tomorrow.