How I run 10 role-scoped Claude Code sessions (coordinated via MCP) to maintain a 290k-line repo in 1 hour a night
retained text
I build and maintain [https://open-todo.app/](https://open-todo.app/) (an [open-source](https://github.com/OpenTodoApp/OpenTodo), self-hosted task manager) in the 1 to 1.5 hours I have late at night after family routines. Once the codebase grew past the point where a single Claude session could hold the architecture in context - it now sits at \~290,000 net lines of production code (149k Go, 130k TypeScript, 9.6k Kotlin/Swift) plus 254,000 lines of tests and stories - a single [`CLAUDE.md`](http://CLAUDE.md) and ad-hoc prompting completely broke down. Without hard boundaries, sessions bleed context, duplicate logic, and hallucinate across layers. To scale Claude Code across a codebase this size without babysitting every tool call, I built a 5-layer multi-agent setup: * **10 Role-Scoped Claude Sessions:** Separate sessions for Core Lead, Web Dev, Mobile Dev, Security, CTO, CPO, etc. The C-suite titles sound like corporate theater, but in practice they are strict context and file-system boundaries - the Web Dev session literally cannot touch Go migrations, and the Security agent only audits and blocks. * **Dogfooding MCP as the State Machine:** Instead of fragile wrapper scripts, the sessions coordinate through OpenTodo's own MCP server. They pull tasks, log rejection artifacts, and hand off work across domains autonomously. * **OpenSpec Before Code:** No Claude session is allowed to write implementation code until a spec is drafted, challenged, and ratified. * **Hybrid Cloud + Local Execution:** Ephemeral cloud containers handle lightweight text/spec tasks, while a local Linux mini-PC on my home server runs persistent Claude loops that need warm caches, Docker stacks, and mobile emulators. * **49 CI Checks & Ratchets:** Claude never gets the benefit of the doubt. Every PR hits 49 deterministic checks and strict ratchets (coverage, complexity, lint) that automatically bounce bad code back to the agent loop before I ever look at it. I wrote up the full architecture, how the governance files are structured, and real examples of Claude sessions rejecting each other's PRs: [https://pixari.dev/posts/the-system-behind-opentodo/](https://pixari.dev/posts/the-system-behind-opentodo/) How are you all structuring [`CLAUDE.md`](http://CLAUDE.md) files and context boundaries once your repos pass 100k+ lines?
document fetched 2026-11-19 00:41 · canonical https://reddit.com/r/ClaudeCode/comments/1xzg2kr/how_i_run_10_rolescoped_claude_code_sessions