Running a Multi-Repo Product with Parallel AI Agents (Claude Code)
Описание и применение
Внедрена система, где один рабочий каталог управляет семью независимыми репозиториями, каждый из которых имеет собственный агент Claude Code, работающий в изолированном git‑worktree. Хуки и папка contracts/ гарантируют, что изменения не попадают в чужие репозитории, а параллельные задачи выполняются без конфликтов.
Задача
Managing multiple independent repositories in a single workspace while ensuring isolated AI agent work, preventing cross-repo contamination, and executing parallel tasks without interference.
Результат
The workflow enables safe, parallel AI-driven development across seven independent repositories, preventing accidental cross‑repo commits, ensuring consistent rules, and automating PR creation and auditing.
Рабочий процесс
- Create a small workspace root repo with an allowlist .gitignore and clone-all.sh
- Add a concise CLAUDE.md to each repo describing purpose, stack, commands, and a pointer to root rules
- Create a root CLAUDE.md mapping all repos, connections, routing rule, git workflow, and parallel rules
- Define one agent type per repo in .claude/agents/, each agent runs in its own git worktree
- Implement a read‑only test auditor that checks coverage and edge cases
- Set up contracts/ folder for cross‑repo specifications, with owner, consumers, status, and shape
- Add hooks: PreToolUse repo guard, .env guard, PostToolUse formatter, and fast pre‑push lint/format checks
- Run tasks: main session plans, starts agent copies per repo, builds in parallel, audits, pushes PRs, and reports results
- Scale to multiple tasks by running agent copies in waves and managing token cost
- Iterate lessons learned to refine hooks, formatting, and workflow constraints
Доказательства
The workspace root is its own small git repo holding only the shared pieces: a root CLAUDE.md (map of all repos + shared rules), a contracts/ folder (the only place cross-repo changes are agreed), .claude/agents/ (one agent per repo + a read-only test auditor), .claude/hooks/ (guards that enforce the rules), and a clone-all.sh script.
Each copy works in its own git worktree (_wt/backend-task-name), never in your main checkout.
PreToolUse repo guard: a repo agent may edit only its own worktrees, contracts/, and its notes file.
10 tasks (8 full-stack, 2 backend-only) = 18 agent copies, each isolated.
- Дата записи: 2026-10-05T08:55:58.106Z