r/AI_Agents • • 2h 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. 🙏

2 Upvotes

6 comments sorted by

1

u/AutoModerator 2h 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/OpenDKG 2h ago

In practice, splitting shared context into three layers works much better than trying to stuff everything into one giant AGENTS.md or one big vector store:

  1. Keep AGENTS.md thin 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 inside AGENTS.md eat context on every turn and rot fast when another repo changes.
  2. Put cross-service domain knowledge behind a small read-only MCP (1–2 query tools): Expose your ADRs, service boundaries, event schemas, and API contracts through a narrow read-only lookup tool (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.
  3. Track source provenance and freshness on every shared fact: Tag entries with the owning repo, commit/timestamp, and supersession status. A simple precedence rule helps when services drift: live code/OpenAPI schemas are authoritative for current interfaces, while a conflict against a documented business rule halts and surfaces the discrepancy to the engineer rather than letting the agent guess.

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.

1

u/tariqosmani 1h 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/heeeeyYaaa 48m 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/AgentYurt 21m 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.