Agent Wranglers

AID-10Recommended

Work on a branch and commit often

Let agents work only on a branch, and commit after each step that passes the checks.

How to do it

Create a branch per task, or a separate worktree per agent when several run at once. Commit every working step, so a bad step can be undone without losing the good ones. Merge to the main branch only after review. When several agents work at once, give each one its own files or its own worktree. Agents editing the same file overwrite each other's work. A shared build folder breaks the same way, so each agent builds into its own output folder or worktree. Keep branches short-lived, as Make small changes on short-lived branches says.

How to check

The main branch has branch protection, and no agent commit lands on it without a reviewed pull request.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/ai-assisted-development/working-in-small-steps/branch-and-commit">Agent Wranglers AI-assisted development playbook</a>. In code you write, add a comment next to it with the same link.