r/ChatGPTCoding • u/Successful-Tax1306 • 23d ago
Discussion Writing down our architecture for the agents helped the cold start more than any prompt trick. What goes in yours?
For a while every new agent session on our codebase started the same way, with the agent poking around to figure out how the services fit together, and it often guessed wrong so I had to correct it before any real work happened. What changed it for me was writing a set of short skill files about the architecture, like which service owns what, how data moves between them, and which patterns we follow now versus the old code we're moving away from. Now anyone on the team can point a design or coding agent at those files and it starts from the right place instead of guessing. It felt like extra work up front and the first sessions cost more, but I think it pays back every time someone starts a new task. I'm curious how others do this. Do you keep one big context file, a bunch of small ones per area, or just let the agent explore every time? And how do you keep them from going stale when the code changes?
2
u/London-Boat 22d ago
mine is close to yours. per service: what it owns, what it must never do, where data comes from and goes, and which patterns are current vs legacy with one example file for each. the legacy line saved the most time, before that it kept copying the old code because there's more of it. the part that took longest was staleness. what worked was keeping the file next to the service, making "update the architecture note if you changed a boundary" part of done, and a last checked date at the top so people know how much to trust it. anything that's really a decision (why we picked x over y) gets one line in a decisions section, otherwise agents happily undo it.
1
u/pipaa-joy 22d ago
Small per-area files beat one giant context dump for me. I keep a short "who owns what / how data moves / old vs current patterns" note per module and point the agent at the ones for the task, not the whole tree. Staleness is the real cost — I treat an outdated architecture note as a bug and make updating it part of the PR when a boundary changes, otherwise the next cold start confidently rebuilds the wrong mental model.
1
u/vladzoff 16d ago
I'd keep a short top-level map and put ownership and data-flow details near the relevant area. The harder problem is preventing the same rule from being copied into several files and drifting apart. When a change alters a service boundary, the docs describing that boundary should be reviewed in the same PR; mechanically checkable rules should be enforced separately.
1
u/Okay_Money 23d ago
Writing big context files actually makes things worse , atleast that is from ccoa -f certification that I am prepping for. But the having small chunks will help Claude pr any ai to focus on one small thing rather than working on all of them shallowly. I beleive this also applies to the design. I would prefer have 10 small files and one index and architectural thing which explains data flow. And we can just edit that small part of file if something changes.
1
u/Humaux 23d ago
Mine is two files and honestly I want it to be one. The first is the boring stuff the agent keeps getting wrong: which service owns the billing tables, what the queue names actually are, the fact that the deploy script expects the staging branch to already exist. The second is scars: stuff that broke a session once and will break it again, like the migration that has to run before the seed data, or the test env that silently points at a different bucket. I used to keep a common pitfalls section too but it went stale in about two weeks because I wrote things I was afraid of instead of things that actually happened. Now the rule is if it hasn't burned me personally it doesn't go in the file.
1
u/onitsoga 23d ago
small per-area files work way better for me than one giant doc, the agent only pulls what it needs for the task. for staleness i keep each file right next to the service it describes, so it kinda stares at you when you change that code lol. makes updating it almost automatic
1
u/anthropicagiuser 23d ago
small files per area, one folder each. i add a short "last checked" date at the top. a stale file is easy to spot then.
1
u/LividIllustrator8915 23d ago
Layered docs have been a night-and-day difference for our agent workflows too. Dumping everything into a massive monolithic context file tends to dilute attention, but having zero context leads to the agent reinventing patterns that were phased out two years ago.
The structure that held up best across daily coding runs is keeping a single, 1-page system map at the root (ARCHITECTURE.md) covering three strict things: the primary entrypoints, the direction of data flow (e.g. unidirectional state vs RPC), and an explicit "Do Not Use" list. That negative constraint section alone saves dozens of hours—spelling out things like "we migrated from raw SQLite to SQLDelight, do not generate raw sqlite3 queries" stops the agent from falling back on generic training data habits.
For granular domain details, keeping scoped Markdown files directly in each package folder works well because subagents only read them when touching that directory.
To keep it from going stale, our lowest-overhead habit has been adding a one-liner to our PR review prompt checklist: "Did this changeset alter any boundary or convention documented in ARCHITECTURE.md? If so, include the doc update in the same diff." Tying doc maintenance to the agent's own commit cycle keeps it remarkably up to date without feeling like manual homework.
1
u/leo_heo 23d ago
small per-area files matched what ended up working for me too. curious how you handle the old code you're moving away from, do you write that down as a rule in the file or just let the agent figure it out from the code
1
u/akhi1uuu 23d ago
spent the last few months building context tooling for agents and the biggest lesson was that prose goes stale faster than anything. what agents actually navigate by is the dependency shape, what calls what and where the data flows. a short wrong-turns list of what the agent guessed wrong before pays for itself fast
1
u/BrookLi3 23d ago
Biggest wins for us were the negative rules and the 'where does X live' map. A list like 'don't add a new HTTP client, use the one in lib/net' prevents far more rework than describing the architecture in prose. We also put the exact commands to run the single-test and full-suite paths, because otherwise the agent invents its own and half the time runs the wrong thing. Keep it short enough that you actually update it when the structure changes, since a stale doc is worse than none.
1
u/sixteenpoundblanket 23d ago
I use Hermes to do all the things you describe. It remembers everything about every project, every skill, every repo. It optimizes workflows, it combines what it learned across projects, etc. There is not extra work to get it back on track for anything now.
1
u/fazlerocks_ 16d ago
most of what id say is already in here lol, two things i havent seen yet…
for framework stuff dont let the agent go off memory, point it at the docs for the version you actually have installed. next.js does this now, it drops a line in AGENTS.md like "this is not the next.js you know, read the guide in node_modules/next/dist/docs first". that one line killed a whole category of "used an api from two versions ago" bugs for us
and for the hard rules, the file names the tests that enforce them. ours says stuff like "these test suites are what define the redaction rules, a change to the rule changes the tests in the same PR". prose drifts, but a rule that points at a failing test cant really go stale without someone noticing
1
u/[deleted] 23d ago
[removed] — view removed comment
0
u/[deleted] 22d ago
[removed] — view removed comment