Miguel Sanz

How to share context across Claude Code, Codex, Cursor and OpenCode

A practical architecture for letting several agents read common rules without mixing personal memory, team judgment or execution evidence.

Cuatro corrientes de herramientas convergen en un grafo común de repositorio con puntos de control.

Using four agents does not require maintaining four versions of the truth. The problem starts when each tool receives a different prompt, stores decisions in a different place and leaves incompatible evidence.

The answer is not copying everything everywhere. It is separating layers with clear owners.

The four layers

1. Repository rules

Architecture, commands, security limits and the definition of “done”. They should live close to the code and travel with the repository.

An AGENTS.md file at the root sets the common contract. Deeper files refine instructions for a folder without duplicating the whole document.

2. Reusable team judgment

A rule explains what to respect. A skill explains how to execute a class of task well: what to read, which steps to follow, which errors to avoid and how to verify.

That judgment belongs to the team. It is reviewed in pull requests and versioned in git.

3. Personal memory

Developer preferences, communication habits or context that crosses repositories. This layer stays local on the developer's machine and should not end up in the team's git history.

Confusing personal memory with shared knowledge creates two risks: leaking private information or hiding critical decisions on one computer.

4. Execution evidence

Tests, builds, screenshots, logs and the task result contract. This layer makes it possible to review whether two agents actually applied the same standard.

A minimal topology

local personal memory
        │
        ▼
AGENTS.md ── shared rules
        │
        ├── skills/ ── versioned team judgment
        │
        └── verify ── evidence for every run
             ▲
             │
 Claude Code · Codex · Cursor · OpenCode

Each tool keeps its interface and model. The repository keeps authority.

Avoid copy-based synchronization

Manually copying rules into tool-specific files looks fast. Then a command, path or restriction changes and four incompatible contracts appear.

Use one canonical document and generate adapters only when a tool needs one. The adapter should stay small and make its source explicit.

Route before loading

Sharing context does not mean injecting the entire repository into every prompt. It means locating the relevant subgraph first:

  1. classify the task: UI, API, domain, release or diagnosis;
  2. query the file and dependency map;
  3. load the nearby rules;
  4. activate the skills that cover different axes;
  5. drop to exact lines only when needed.

That routing reduces noise and prevents a frontend guide from contaminating a data migration.

Define who can change what

A shared architecture needs governance:

  • each developer controls personal memory;
  • the team reviews project rules;
  • skills have an owner and a version;
  • verify is not skipped for convenience;
  • secrets never enter a versioned layer.

An agent can propose a new rule. It should not turn an inference into team policy without review.

Compatibility test

The check is not “all four tools open the repo”. Use one small but demanding task:

  1. ask each agent to identify the same rule;
  2. require the same verification path;
  3. compare opened files, decision and result;
  4. record any tool-specific adapter;
  5. fix the shared source, not four prompts.

Limit

Products change their instruction formats. This architecture avoids depending on only one, but it still needs adapters maintained and tested against real versions.

Portability does not mean identical behavior. It means everyone starts from the same standard and leaves comparable evidence.

Traceability

Sources and scope

  1. Cursor Rules

    Describes persistent, versionable repository rules that provide context to Cursor.

  2. Adding repository custom instructions for GitHub Copilot

    Confirms the pattern of reusable repository instructions consumed by a coding agent.

  3. AGENTS.md — an open format for guiding agents

    Defines an open instruction convention by tree that different agents can consume.

  4. Cardumen documentation

    Explains how Cardumen connects local memory, rules, skills and verification in the repository.