One Repo for Process, Docs and CI Rules Your Agents Read

How do you give every coding agent the same rules across many projects? Put your development process, documentation, definitions and CI instructions in one separate git repository. Check it out next to every project. Make each project's AGENTS.md or CLAUDE.md tell the agent to read a short routing file in that repo first, and then only the pages the task needs. Project facts stay in the project. Team rules live once, get reviewed once, and change for every repo with one merge.
This post sketches the layout, the routing rules, the exact wiring for Claude Code and Codex, and the CI side. It also explains why the cleanup comes first.
Why a Separate Process Repo
Copying the same AGENTS.md into thirty repositories works until the first change. Then thirty copies drift, and each agent follows a different version of "how we ship."
The obvious shortcut does not cover it. GitHub's organization .github repository supplies defaults only for community health files such as CONTRIBUTING.md, SECURITY.md and issue templates, and it "must be public." Agent instructions and internal definitions need their own home.
A process repo gives you three things a copied file cannot:
- One review path. A change to the release process is one pull request with one owner.
- One commit to point at. "Which rules did this agent follow?" has an answer: the handbook commit.
- Docs and enforcement together. The text the agent reads and the CI that checks its work come from the same repository.
Step 1: Clean Code and Docs Before the AI-Native Rollout
An agent treats what it reads as true. A wiki page that describes last year's deploy flow is a nuisance for a human, who knows it is stale. For an agent it is an instruction. Anthropic's memory docs put it plainly: "Longer files consume more context and reduce adherence." Stale pages cost context and point the agent in the wrong direction.
So clean before you connect:
- Delete or archive docs that no longer match production. A missing page is safer than a wrong one.
- Give every page an owner in its front matter.
- Write definitions once. "Done", "hotfix", "breaking change" and "customer data" each get one page, and other pages link to it.
- Make the build and test commands in docs match the ones CI runs. If they differ, the agent passes locally and fails in CI.
- Remove dead code paths that look live. Agents copy patterns they find.
This is the part most teams skip, and it is the part that decides whether the rollout helps. Our post on context rot and compaction covers what happens when too much low-value text enters a session.
Step 2: Lay Out the Process Repo
Keep the tree shallow and named by task, not by department:
eng-handbook/
AGENTS.md # 20 lines: read ROUTING.md, never edit this repo from a project session
ROUTING.md # task type -> files to read
definitions/
done.md
severity.md
breaking-change.md
process/
branching.md
code-review.md
release.md
incident.md
ci/
RULES.md # what CI checks, and the local commands that match
stacks/
go-service.md
vue-frontend.md
.github/workflows/
service-ci.yml # reusable workflow, see Step 5
Reusable workflows have to sit in .github/workflows. GitHub's reuse docs say "Subdirectories of the workflows directory are not supported."
Step 3: Write the Routing File
The routing file is the only page every agent reads in full. It maps a task type to a short reading list:
# ROUTING.md
Read this file first. Then read only the files listed for your task.
| Task | Read |
|-------------------------------|---------------------------------------------------|
| Bug fix | definitions/done.md, ci/RULES.md |
| New feature | definitions/done.md, process/code-review.md, ci/RULES.md, stacks/<stack>.md |
| Dependency or API change | definitions/breaking-change.md, process/release.md |
| Release or hotfix | process/release.md, definitions/severity.md |
| Incident follow-up | process/incident.md, definitions/severity.md |
Rules:
- If the project's own AGENTS.md disagrees with this repo, follow the project file and say so in the PR.
- If two handbook pages disagree, stop and name both files.
- Record the handbook commit (`git -C ../eng-handbook rev-parse HEAD`) in the PR description.
Keep it short. The Claude Code docs set a target "under 200 lines per CLAUDE.md file," and the same logic applies to any file loaded into every session.
Step 4: Point Each Project at the Process Repo
Clone the handbook next to your projects once, and update it before each session:
git clone --depth 1 [email protected]:acme/eng-handbook.git ~/work/eng-handbook
git -C ~/work/eng-handbook pull --ff-only
--depth 1 creates a "shallow clone with a history truncated to the specified number of commits" (git-clone). --ff-only will "only update to the new history if there is no divergent local history" (git-pull), so a stray local commit fails loudly.
Claude Code
Option A, an import in the project's CLAUDE.md:
@AGENTS.md
@../eng-handbook/ROUTING.md
Per the memory docs, relative paths "resolve relative to the file containing the import," imports nest up to "four hops," and an import outside the working directory is external: "The first time Claude Code encounters external imports in a project, it shows an approval dialog listing the files." Import only the routing file. Imports "don't reduce its context cost," so importing the whole handbook defeats the routing.
Option B, an additional directory:
CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 claude --add-dir ../eng-handbook
With the variable set, Claude Code loads that directory's CLAUDE.md, .claude/CLAUDE.md, CLAUDE.local.md and .claude/rules/*.md. Without it, "CLAUDE.md files from these directories are not loaded."
For rules that must reach every session on a machine, Claude Code also reads a managed file at /etc/claude-code/CLAUDE.md on Linux and /Library/Application Support/ClaudeCode/CLAUDE.md on macOS.
Codex
The Codex AGENTS.md guide describes two scopes. Codex reads AGENTS.override.md or AGENTS.md from ~/.codex (or CODEX_HOME), then walks from the project root down to the working directory and "concatenates files from the root down." Put a short global file in ~/.codex/AGENTS.md that names the handbook path and the routing rule. Then check what loaded:
codex --cd services/payments --ask-for-approval never "List the instruction sources you loaded."
The guide's expected result: "Codex reports the global file first, the repository root AGENTS.md second, and the payments override last."
Step 5: Keep CI Rules in the Same Repo
Text tells the agent what CI expects. A reusable workflow makes CI actually expect it. In the handbook:
# eng-handbook/.github/workflows/service-ci.yml
on:
workflow_call:
jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: make lint test
In each project:
on: pull_request
jobs:
ci:
uses: acme/eng-handbook/.github/workflows/service-ci.yml@<commit-sha>
The reusable workflows reference says "Using the commit SHA is the safest option for stability and security." Limits to plan around: up to ten levels of workflows, counting the top-level caller, and "a maximum of 50 unique reusable workflows from a single workflow file." Write the same make lint test into ci/RULES.md, so the agent runs locally what CI runs remotely.
What Goes Where
| Content | Home | Why |
|---|---|---|
| Team process, definitions, review rules | Handbook | One owner, one version |
| Build commands, service quirks, local env | Project AGENTS.md |
Changes with the code |
| Checks that must pass | Reusable workflow in the handbook | Enforced, not advisory |
| Actions that must never happen | Hooks or tool permissions | Instructions are not enforcement |
| Task-specific deep docs | Handbook, listed in ROUTING.md |
Loaded only when needed |
The fourth row matters. The memory docs say "CLAUDE.md instructions shape Claude's behavior but are not a hard enforcement layer." We cover where hard limits belong in agent drift guardrails.
Troubleshooting
Claude Code ignores the project AGENTS.md. By default Claude reads AGENTS.md "only when you have no CLAUDE.md in your working directory or above it," and reading it directly needs v2.1.277 or later. Add @AGENTS.md to the CLAUDE.md.
The handbook import never loads. Someone declined the external import dialog. The docs say "the imports stay disabled and the dialog doesn't appear again." Use Option B with --add-dir instead.
Handbook rules with paths frontmatter do not apply. Rules loaded from an additional directory skip files that set a paths field. Keep path-scoped rules in the project.
Codex drops the deepest instructions. Codex "stops adding files once the combined size reaches the limit defined by project_doc_max_bytes (32 KiB by default)." Shorten the chain or raise the limit in config.toml.
A project cannot call the reusable workflow. For a private handbook, the Access policy in the handbook's Actions settings must allow the caller repositories, and the caller's Actions permissions must allow reusable workflows.
git pull --ff-only fails. An agent or a person committed to the local handbook clone. It "fails if your local branch has diverged from the remote branch." Reset the clone and move the change into a handbook pull request.
Where Akmatori Fits
Akmatori uses the same read-before-you-act order for incident agents. Per the architecture docs, Akmatori writes AGENTS.md for each run with the incident workflow, the memory manifest and the list of context files, and the workflow requires a runbook search, a memory search and a check of recent change events before infrastructure tools. The skills docs keep reference documents in Context Files and procedures in Runbooks, so each piece of context has one home.
Conclusion
A process repo turns "how we work" into something an agent can load, a reviewer can diff and CI can enforce. Clean the docs first, keep the routing file short, wire each tool to it, and pin CI to a handbook commit.
If your team wants AI-assisted incident workflows that read your runbooks before they touch production, Akmatori helps SRE teams investigate alerts, coordinate response, and automate safe infrastructure actions. Powered by Gcore for global infrastructure reliability.
