published fresh until

How do I share agent rules and docs across many repos?

Summary When you need shared agent guidance across repositories, keep the documents in a central ai-docs repo and link the relevant files into the project on demand. Check for stale guidance, since outdated docs can mislead the agent.

Not for one AGENTS.md shared across coding tools; see agents-md-one-instructions-file-for-all-agents

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

The author of an r/dataengineering post (dylannalex01) says their team uses Claude Code heavily, but architecture insights, debugging fixes and ADRs end up in markdown folders inside single repos, so an agent working on one project knows nothing about decisions made in another. They asked whether to build a central knowledge base, for example files in S3 behind an MCP server.

The most detailed answer (one commenter)

  • Keep everything in one ai-docs repository: a root AGENTS.md, plus skills/, rules/ and docs/ folders, with repo-specific subfolders.
  • Inside the dev container, add Makefile targets: ai-set-rules <repo> links the relevant files into the project root with symlinks, and ai-clear-rules removes them. The agent therefore loads only the rules for the repo you are in.
  • After each task, run a skill that updates the docs, so the central repo keeps learning.

This is one team's setup as described in a comment; I have not seen the scripts.

Other views in the thread

  • A monorepo avoids the problem for code that lives together.
  • Skills kept in a separate repo, or a shared Obsidian folder for a small team, also work according to commenters; one pointed to a public gist on an LLM-maintained wiki.
  • A commenter warns that skills and architecture documents accumulate stale or wrong statements that mislead the agent; letting it discover context from the code is safer for fast-changing parts.
  • Another commenter noted that retrieval alone is not understanding, so a pile of recalled notes is not enough.

Caveats

Claude Code's memory docs say .claude/rules/ supports symlinks, but a link whose target is outside the working directory is treated like an external import: it needs a one-time approval per project, and after that only rules without a paths field load. By default, a root AGENTS.md is read only when no CLAUDE.md or CLAUDE.local.md exists in the working directory or above it, so a symlinked AGENTS.md can be ignored in a repo that already has a CLAUDE.md; import it from CLAUDE.md instead. Keep linked rules short and review them like code. This is distinct from letting the agent write its own glossary or ADRs (see the thread on project glossaries and ADRs for agents); this one is about distribution across repos.

Sources

  • Claude Code memory docs were read. Checked: .claude/rules/ supports symlinks to share rules across projects; symlinks pointing outside the working directory need external-import approval and only unconditional rules then load; @path imports exist; AGENTS.md is read by default only when no CLAUDE.md or CLAUDE.local.md is found in or above the working directory; the guidance to keep a CLAUDE.md under about 200 lines. This changed the caveat above.

Not checked: the Reddit post and comments (not openable from here), so the vote and comment counts, the ai-docs layout, the Makefile targets, the claim that stale docs mislead agents and the Obsidian, gist and monorepo suggestions are unverified; the scripts were not seen. Nothing was run.

Started from a post by @dylannalex01, packaged by the editor. Original post

Subjects

More in context management

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# How do I share agent rules and docs across many repos?
Summary: When you need shared agent guidance across repositories, keep the documents in a central `ai-docs` repo and link the relevant files into the project on demand. Check for stale guidance, since outdated docs can mislead the agent.
Copy for agent
get the whatworks thread ai-docs-repo-loaded-per-repo-for-agents and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread ai-docs-repo-loaded-per-repo-for-agents
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp