Multi-agent Git Collaboration Rules¶
Multi-agent Git collaboration rules are a set of operational protocols designed to prevent concurrent agents from overwriting each other's work or causing repository instability when working within a shared codebase^[001-TODO__Pi_Monorepo_-_AI_Agent_开发工具包.md].
When multiple autonomous agents operate on the same repository simultaneously, standard "commit all" commands pose a significant risk, as an agent may indiscriminately stage and commit changes made by another active agent^[001-TODO__Pi_Monorepo_-AI_Agent_开发工具包.md]. These rules enforce strict boundaries regarding file ownership and staging behavior to ensure parallel integrity^[001-TODO__Pi_Monorepo-_AI_Agent_开发工具包.md]。
Core Principles¶
The fundamental goal of these rules is to establish clear lines of ownership and minimize merge conflicts^[001-TODO__Pi_Monorepo_-_AI_Agent_开发工具包.md]。
File Ownership¶
Agents must only interact with files they have explicitly created or modified^[001-TODO__Pi_Monorepo_-_AI_Agent_开发工具包.md]。 This creates a sandbox environment where an agent's workspace is isolated from the changes of others.
Selective Staging¶
The most critical rule is the prohibition of bulk staging commands^[001-TODO__Pi_Monorepo_-_AI_Agent_开发工具包.md]。
Execution Rules¶
The following restrictions must be enforced on the Git operations available to the agents:
-
Restricted
git add:- Agents MUST explicitly list specific files when staging (e.g.,
git add path/to/file.ts). - Agents MUST NOT use recursive or wildcard flags that stage all changes, such as
git add -A,git add ., orgit add -u^[001-TODO__Pi_Monorepo_-_AI_Agent_开发工具包.md]。
- Agents MUST explicitly list specific files when staging (e.g.,
-
Scope of Modification:
- Agents should only modify files within their designated task scope or newly created files^[001-TODO__Pi_Monorepo_-_AI_Agent_开发工具包.md]。
Applications¶
This protocol is utilized in development environments where agentic workflows are parallelized to increase throughput, such as the Pi Monorepo architecture^[001-TODO__Pi_Monorepo_-AI_Agent_开发工具包.md]。 By adhering to these rules, a system can safely run multiple coding agents (e.g., one for UI, one for backend logic) against the same Git repository without constant merge conflicts or data loss^[001-TODO__Pi_Monorepo-_AI_Agent_开发工具包.md]。
Related Concepts¶
- Pi Monorepo: The AI agent development toolkit where these specific collaboration rules are implemented and enforced^[001-TODO__Pi_Monorepo_-_AI_Agent_开发工具包.md]。
- [[Agent Runtime]]: The underlying system that manages the execution flow of agents.
Sources¶
001-TODO__Pi_Monorepo_-_AI_Agent_开发工具包.md