r/AI_Agents • u/Varnish6588 • 8d ago
Discussion Question about shared context
My company is currently young in the AI journey, as such I am currently looking to solve the problem of sharing large amounts of domain knowledge context across AI agents. Every time one of our engineers is looking to work on a task for their domain service, the complexity increases when they have to touch multiple repositories or even go across multiple domain services and business logic.
How are engineering teams out there tackling shared context across multiple domain service repositories when using AI coding agents?
Centralised knowledge bases, shared AGENTS.md files, MCP servers or something else?
Curious to hear what's actually working in practice. Thanks in advance for your comments and guidance. 🙏
3
u/OpenDKG 8d ago
In practice, splitting shared context into three layers works much better than trying to stuff everything into one giant
AGENTS.mdor one big vector store:AGENTS.mdthin and local (invariants, not domain encyclopedias): Use it only for repo-specific build/test commands, hard safety boundaries, and pointers to service owners. Large cross-service docs insideAGENTS.mdeat context on every turn and rot fast when another repo changes.search/get_doc/query) so agents pull cross-repo context on demand instead of preloading 50 schemas. Keeping that layer strictly read-only also ensures retrieved docs stay data, not executable instructions.Once you pass ~5–10 interacting services, structuring those service-to-service dependencies and domain terms in a lightweight queryable graph (rather than flat markdown chunks) makes multi-repo impact checks much more reliable.
2
u/AgentYurt 8d ago
The part that bit hardest for us wasn't where the shared context lived, it was how fast it went stale. A shared AGENTS.md or knowledge base works fine for the first month, then one repo changes an API and every agent keeps confidently citing the old version.
What held up for us: keep the shared layer small and decision-shaped, not a dump of docs. Each entry is a decision plus why it was made plus a date, with one named owner per service area. An agent reading 'we chose X because Y, decided 2026-11-10' can judge whether to trust it.
And build in a freshness check: the agent verifies the one or two facts it's about to act on against the actual repo before acting, instead of trusting the shared doc blindly. That one habit caught more drift than any tooling choice did.
MCP vs shared files matters less than that, in my experience — pick whichever your team will actually keep updated, because the moment updating it feels like a chore, it rots.
2
u/software_engineer_cs 8d ago
Great points here. My additions are two:
2
u/ARiftly 8d ago
I'd use each repo's AGENTS as a map to shared contracts, with each contract kept where its owning team can update it. Try that on one recent cross-repo change and see if the agent finds which service owns the rule and which ones consume it. Where does that trail usually break for your engineers?
1
u/tariqosmani 8d ago
Keep one home for each piece of domain knowledge. Copies are what break first. Once each repo keeps its own copy of the domain notes, they drift within a few weeks, and the agent reads whichever copy it finds first.
Give each piece one owner and one place, and have every repo point to it instead of copying it. A submodule or a linked folder works for coding agents. To start, a line in each AGENTS.md that says where the rule lives is enough.
The second thing I'd add is a question log. Every time someone has to ask a teammate how a service works, write the question and the answer into the shared doc that day. After a few weeks that file covers what people actually ask, which beats a doc written from the architecture diagram.
Which service gets the most cross-repo questions on your side?
1
u/gimalay 8d ago
What's worked for us: one shared repo of markdown notes, one note per decision or contract, each with frontmatter like
service: billing,owner:andstatus: current. Every service repo's AGENTS.md says where that repo lives and to query it, instead of copying docs in. When an agent touches billing it pulls onlyservice: billing, status: current, and a schema check in CI refuses a note without an owner, so nothing goes in unowned. (I work on iwe, an open-source CLI and MCP server that does that kind of markdown query.) How many services are you dealing with?1
u/Ok-Form1598 8d ago
skip the knowledge base for the cross-repo part and give the agent the other repos. clone them next to each other and start it with
claude --add-dir ../billing-serviceso it's reading the real code in both1
u/Kind-Atmosphere9655 8d ago
before anything goes in the shared doc we ask where that fact should live. a rule like "billing events always carry the tenant id" holds up better as a failing test in the repo that owns it than as a line in a kb, because the test breaks the day the code drifts
so the shared layer ends up holding only what code can't check.. why a decision was made, and who owns it
2
u/Embark_1 8d ago
Agree with the thin AGENTS.md and dated decisions above. One thing that helped me beyond docs: let the agents ask each other.
If each service has an agent that's been working in it, an agent in repo B can ask that one directly why something in repo A works the way it does, and get an answer grounded in what it actually decided, instead of reading a doc that may be a month stale.
Docs cover what's written down. Asking covers what isn't.
1
u/AutoModerator 8d ago
Thank you for your submission, for any questions regarding AI, please check out our wiki at https://www.reddit.com/r/ai_agents/wiki (this is currently in test and we are actively adding to the wiki)
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/[deleted] 8d ago
Claude Code supports @-file imports in CLAUDE.md, so you can point each repo at shared docs without copying them into every project file.
1
u/Anxious_Count_8728 8d ago
Cross-repo context also needs the repos' access rules. Can every engineer using the shared notes already read every repository they describe?
1
u/Obvious-Actuator-672 8d ago
Seriously not trying to shill, but I built Worktable for this. I'd connect the teams agents to one Worktable and keep the domain docs there instead of in each repo. When a service changes, the agent working on it updates the doc and everyone else's agents read the new version. Happy to set it up for your team, can DM you a link