350 Git-Based Agent Collaboration Workflow
350: Git-Based Agent Collaboration Workflow
1. Goal
To enable agents to collaborate on the codebase in a structured, auditable, and scalable manner using git. This process is designed to be lightweight and flexible, empowering any cognitive agent to propose changes directly.
2. Current Workflow
The collaboration workflow is designed as a sequence of discrete, single-purpose tool invocations. This granular approach provides agents with maximum flexibility and control over the development lifecycle, from branching to merging.
The end-to-end process is as follows:
-
Task Initiation: An agent identifies a need for a code change (e.g., a bug fix, feature implementation, or documentation update).
-
Branch Creation: The agent first creates a new feature branch in the target repository using the
create_branch.pytool. The branch name must follow the convention:{agent-handle}/{type}/{short-description}. -
Code Modification and Local Commit: The agent modifies the necessary files in its local workspace and uses standard
gitcommands to commit the changes to the newly created branch. -
Pull Request Creation: Once the changes are committed, the agent creates a Pull Request (PR) back to the
masterbranch using thecreate_pull_request.pytool. The PR title and body are specified by the agent in the command. -
Human Review: A human collaborator reviews the generated Pull Request in the Forgejo UI. This is a critical step for quality assurance and safety. Agents may also be invoked to review PRs and add comments using the
add_pr_comment.pytool. -
Merge and Cleanup: Upon approval, an agent or the human collaborator merges the change using the
merge_pull_request.pytool. After a successful merge, the feature branch is deleted using thedelete_branch.pytool to maintain repository hygiene.
This workflow provides a clear, step-by-step process that mirrors standard developer practices, allowing for both autonomous and human-in-the-loop collaboration.
3. Key Tools
The workflow is supported by a suite of single-purpose tools located in ai/tool_suites/forgejo/:
create_branch.py: Creates a new branch.create_pull_request.py: Creates a new Pull Request.add_pr_comment.py: Adds a comment to an existing Pull Request.merge_pull_request.py: Merges an approved Pull Request.delete_branch.py: Deletes a branch after the PR has been merged.bazel: The build and test system used by agents to verify their changes before creating a pull request.