Skip to content

Guide8 min read

The decision lives in the API repo, the agent opened in the frontend: what Claude Code and Codex read across repositories

The API team freezes an endpoint and writes it into AGENTS.md. The next day, the agent opened in the frontend repository calls the endpoint again and the tests pass. We measured four ways to carry that line from one repository to another in Claude Code and Codex, where the decision has to live, and the gate that stops the call.

ValorBrain Team
Dark background. On the left, a light file panel with one line highlighted in green. Four dotted lines leave it and end at four red X marks before a dark terminal panel on the right, where a red line sits next to a green badge. Below, a band with a folder, an arrow, a badge with a green dot, another with a red dot and an empty dashed frame.

The API team freezes /v1/orders. The pull request that does it adds a line to api/AGENTS.md: "/v1/orders is frozen since 2026-11-20; new callers use /v2/orders." Reviewed, merged.

The next morning someone opens Claude Code in the web repository and asks for an order history page. The agent finds /v1/orders in the existing client code, adds one more call, and the tests pass. Nobody did anything wrong. The agent in web never read a file in api.

Card: The decision lives in api. The agent opened in web. Left, the file api/AGENTS.md, marked “reviewed, merged”, with its highlighted line: /v1/orders is frozen since 2026-11-20; new callers use /v2/orders. Four dotted lines leave it and stop at a red X before the window on the right: Claude Code 2.1.329 opened in web with claude -p, on 2026-12-01, under the question “did the api line arrive?”. The four tries: --add-dir ../api, no; plus CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1, no; @../api/AGENTS.md in web/CLAUDE.md, no; a symlink in .claude/rules/ to api/AGENTS.md, no. Below: next morning, in web, one more call to /v1/orders, the tests pass, nobody did anything wrong. In a dark band, the folder above both: ~/work/AGENTS.md, Claude Code reads it, Codex 0.156.1 doesn’t, and it is in no repository.
The four tries and the parent folder were measured on 2026-12-01, with no model call. The endpoint and the two repositories are the guide's example.

Every coding agent reads instructions starting from the repository you launch it in. A team with a frontend, an API and an infra repository has decisions that belong to two or three of them at once: an API contract, a deprecated endpoint, a shared environment, a library everyone must stop using. Those are the decisions that get left behind.

What the documentation already says

  • Claude Code. It reads CLAUDE.md "from your current working directory and every directory above it", and AGENTS.md when there is no CLAUDE.md there. On a directory added with --add-dir: "By default, CLAUDE.md files from these directories are not loaded." With CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 its CLAUDE.md loads, and "Their AGENTS.md doesn't load". An import that points outside the working directory is external, and the first time it opens an approval dialog.
  • Codex. "Starting at the project root (typically the Git root), Codex walks down to your current working directory." --add-dir is described as directories "writable alongside the primary workspace", and the AGENTS.md page lists no other source.
  • Cursor. It reads .cursor/rules and the project's AGENTS.md. Rules for every repository are Team Rules, "managed from the dashboard. Available on Team and Enterprise plans".

In all three, what reaches several repositories is a machine-level file (one per laptop, per CI runner, per tool) or a vendor dashboard.

What we measured

On one Linux machine, on December 1, 2026, with Claude Code 2.1.329 and codex-cli 0.156.1. Each case builds two fresh git repositories side by side, api and web, with the frozen-endpoint line in api/AGENTS.md, and starts a headless run from web. Neither tool was signed in, so no model call ran. We did not need one: both tools assemble the instructions before the first request. In Claude Code, every loaded file was recorded by an InstructionsLoaded hook and by the debug log.

  • --add-dir ../api. Nothing from api loaded.
  • The same with CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1. Nothing, because api only had AGENTS.md. The repository that moved to AGENTS.md so every tool reads one file is exactly the one that disappears.
  • @../api/AGENTS.md inside web/CLAUDE.md. It loaded web/CLAUDE.md and not the imported file.
  • A symlink in web/.claude/rules/ pointing to api/AGENTS.md. Nothing.
  • An AGENTS.md or CLAUDE.md in the folder above both. Claude Code read it. Codex did not: it starts at the git root and walks down.
  • Codex with AGENTS.md in web, in the parent folder and in api, plus --add-dir ../api. It read web/AGENTS.md only. Without that file it read nothing.

The agent that misses the decision is the one nobody watches

The import and the symlink fail for the same reason: they point outside the working directory, and Claude Code treats what comes from outside as external. At a keyboard, the first session asks whether you approve. In claude -p there is nobody to approve it, and the session transcript confirms the text never arrived. The one that calls the frozen endpoint is the scheduled run, the CI job, the one that runs at night.

The parent folder, which worked in Claude Code, has another problem. It is in no repository: nobody reviews it, it has no history, and it exists only on the machines where someone created it, which rarely includes the runner. And even the cases that load read whatever is on disk. An api checkout cloned three weeks ago hands over the rule as it was three weeks ago, with no date on the line to say so.

Where the decision has to live

Split by audience. How the repository builds, tests and deploys, the code's conventions and "never edit generated files" stay in the repository's own file. A contract between repositories, a deprecation, a shared environment's state and the decision itself, with its date and who made it, go somewhere every repository reads. For that place there are three honest options:

  1. Machine-level files. A managed CLAUDE.md, a ~/.codex/AGENTS.md and Cursor Team Rules. That is three places to edit for one decision, none of them carries a date, and the first two need the same copy on every laptop and every runner.
  2. One decisions repository, read fresh. A small repository with one line per key and a date, and a line in every repository's AGENTS.md telling the agent to read it with git show origin/main:decisions.md from a clone the job updates first. It needs no product. It depends on the agent following the line, and nothing stops a second line for the same key.
  3. A shared memory over MCP. The decision is written once, by key, and every agent in every repository reads the same current value through the same server.

Whichever you pick, what must not happen becomes a CI check. A sentence, in a file or in a memory, warns. This, in the web repository, is what stops the merge:

#!/bin/sh
# scripts/check-v1-orders.sh: fail when the change adds a reference to /v1/orders
diff=$(git diff -U0 origin/main...HEAD -- . ':(exclude)scripts/check-v1-orders.sh') || exit 2
if printf '%s\n' "$diff" | grep -E '^\+[^+]' | grep -F '/v1/orders'; then
  echo "New call to /v1/orders: frozen since 2026-11-20, use /v2/orders." >&2
  exit 1
fi

It only looks at added lines, so the old call that still exists fails nobody, and it leaves the script itself out, otherwise the pull request that adds it would fail on its own lines. The job's clone needs origin/main fetched: without it, as in a shallow clone, git diff fails and the script exits 2 instead of passing green.

Check what your agents load

Ten minutes per repository. Save this as instructions-log.json:

{
  "hooks": {
    "InstructionsLoaded": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "jq -c '{file_path, load_reason, parent_file_path}' >> /tmp/instructions-loaded.log"
          }
        ]
      }
    ]
  }
}

Then run it the way your CI starts the agent, with the same flags and the same environment:

rm -f /tmp/instructions-loaded.log
claude -p "List the decisions you were given about other repositories." \
  --settings /path/to/instructions-log.json --debug-file /tmp/cc-debug.log
cat /tmp/instructions-loaded.log
grep -o 'AGENTS.md loaded: .*' /tmp/cc-debug.log

The log lists every CLAUDE.md, rule and import that loaded. The grep shows the AGENTS.md files, which the hook does not report. In Codex, ask the same question in a codex exec run and compare the answer with the files you expected. Then write down, for each decision that crosses repositories, which repositories can see it. Every empty cell is a frozen endpoint waiting to be called.

What ValorBrain does and doesn't do

ValorBrain is the third option. The frozen endpoint becomes a keyed fact, written once by whoever records the decision:

{
  "tool": "upsert_keyed_fact",
  "arguments": {
    "fact_key": "api.orders.v1",
    "fact_value": "frozen since 2026-11-20; new callers use /v2/orders",
    "as_of": "2026-11-20",
    "evidence": "API team decision, the PR that froze /v1/orders",
    "authority": "agent"
  }
}
  • One value per key. A newer value for the same key replaces the old one, and keyed_facts_as_of returns what held on any past date.
  • Authority. A person writing with their own token records it as "human", with their own words in human_order, and then a lower-authority write to the same key waits as a proposal instead of replacing it.
  • The same pointer in both repositories. The AGENTS.md in api and the one in web say to call memory_prepare at the start and search memory for the subject before calling another repository's API.
  • Search needs the right words. memory_prepare returns about a dozen keyed facts that share words with the request. "Build an order history page" may not bring api.orders.v1. A search for /v1/orders, before the call is added, does.
  • Hooks on the developer's machine. npx -y @valorbrain/connect@latest --token <vbm_…> --harness <claude-code|codex|cursor> adds the server, writes the memory rules and installs hooks. In Claude Code and Codex the hook searches at session start and on every prompt; in Cursor, only at session start.

What it doesn't do:

  • It doesn't reach a harness that isn't connected to it. A CI runner gets none of the hooks: it needs the MCP entry and a few lines in the job's prompt.
  • It doesn't stop the call. The fact warns the agent; the CI check blocks the merge. Keep both.
  • It doesn't know a decision nobody wrote down. The API pull request has to record the fact, the same way it updated AGENTS.md.
  • It doesn't replace the repository's own file. Build steps, conventions and code rules stay next to the code.

What we ran and what we didn't

Nine cases in Claude Code and two in Codex, one run each, on one Linux machine, with throwaway repositories and test text. No model call ran. Three of the Claude Code cases were also checked in the session transcript. We did not test the interactive approval dialog, so we don't know whether an approval given once at the keyboard carries over to later headless runs on that machine. We did not run Cursor: what is here about it is documentation. Whether the model follows an instruction once it loads is another question, which this lab doesn't answer. The CI check above ran in a test repository: it exited 0 on the pull request that adds the script itself and on a change that only called /v2/orders, 1 when the change added a call to /v1/orders, and 2 in a shallow clone without origin/main.

Both full tables, the lab and the checklist are in the guide: A decision in one repo, an agent in another.

ValorBrain works over MCP, in Claude Code, Codex, Cursor and any compatible client. The free plan needs no card: valorbrain.com.br.

Sources, read on December 1, 2026: Claude Code, How Claude remembers your project; Codex, Custom instructions with AGENTS.md and codex --help; Cursor, Rules. The tests are from December 1, 2026, with Claude Code 2.1.329 and codex-cli 0.156.1.

Next step

Less starting over. More continuity

Bring a real project. In one conversation we map where context gets lost between the people and agents on your team, and where to start.

Start with a project