{"slug": "i-had-4-days-to-tackle-a-29-page-issue-document-here-s-how-i-ran-parallel-ai-git", "title": "I Had 4 Days to Tackle a 29-Page Issue Document. Here's How I Ran Parallel AI Agents with Git Worktrees", "summary": "A developer ran roughly 10 Git branches and multiple worktrees to parallelize several OpenCode AI coding agents against a 29-page requirements document containing more than 30 issues, finishing within a four-day deadline. The approach isolated each agent in its own worktree and branch, with tasks split by functional independence, code ownership and dependencies, and agent briefs written as implementation contracts with acceptance criteria. The developer framed it as a practical account rather than a benchmark, noting that isolation comes from explicit worktree assignment, not from running multiple sessions.", "body_md": "Software development doesn't always come with comfortable timelines.\n\nRecently, I was handed a **29-page requirement document containing 30+ issues**, ranging from existing bugs and functional problems to improvements and entirely new features.\n\nHandling everything sequentially with a single AI coding agent wasn't practical. Some tasks required investigating existing implementations, others involved changes across multiple modules, and a few required developing entirely new functionality.\n\nI needed a way to increase development throughput without turning the codebase into a collection of conflicting AI-generated changes.\n\nSo, I experimented with **running multiple AI coding agents in parallel using Git branches and worktrees**.\n\nAcross the workflow, I used approximately 10 branches, multiple Git worktrees, and several OpenCode sessions running parallelly. I also experimented with assigning the same feature to two different agents to compare their implementations.\n\nHere's how I approached task distribution, isolated agent environments, branch management, integration, and verification.\n\nThis is a practical account of my experience, not a benchmark claiming that more agents automatically mean faster development.\n\nI used three primary components:\n\nIt's important to understand how these components work together.\n\nA Git branch represents an independent line of development. A Git worktree provides a separate working directory associated with a branch. An AI agent performs the actual implementation inside that directory.\n\nInstead of making multiple agents work inside the same project directory, I could give each one its own workspace.\n\nOne advantage of Git worktrees is that you don't need to clone the entire repository multiple times.\n\nYou can create separate working directories directly from your existing repository:\n\n```\ngit worktree add ../project-task-a -b feature/task-a\n\ngit worktree add ../project-task-b -b feature/task-b\n\ngit worktree add ../project-task-c -b fix/task-c\n```\n\nEach command creates a new branch and checks it out in a separate directory.\n\nYou can verify your worktrees using:\n\n```\ngit worktree list\n```\n\nNow, launch separate OpenCode sessions from each directory:\n\n```\ncd ../project-task-a\nopencode\n```\n\nRepeat this for the other worktrees.\n\nEach session now operates on its own working directory, branch, and uncommitted changes.\n\n**One important distinction:** Running multiple OpenCode sessions doesn't automatically isolate them. The isolation comes from explicitly assigning each session to a separate Git worktree.\n\nCreating multiple worktrees is relatively easy. Deciding what should run inside them is the more important engineering decision.\n\nBefore assigning tasks, I considered three things:\n\n**Functional independence:** Can the task be implemented without waiting for another task?\n\n**Code ownership:** Which modules, directories, or files will the agent modify? Are multiple agents likely to touch the same files?\n\n**Dependencies:** Does the implementation depend on another feature, API contract, database schema, or shared component?\n\nFor example, implementing a new backend API and building an unrelated frontend component can happen concurrently.\n\nHowever, if a frontend feature depends on an API that hasn't been defined yet, both implementations need coordination.\n\nI also treated agent instructions as implementation contracts rather than simple prompts.\n\nEach task brief needed to communicate the actual problem, expected behaviour, relevant modules, implementation boundaries, existing functionality that must remain unaffected, dependencies, and testing expectations.\n\nA vague instruction such as \"fix the dashboard\" leaves too much room for interpretation. A task with defined expected behaviour and acceptance criteria gives the agent a much clearer direction.\n\nThe objective wasn't to maximize the number of running agents. It was to maximize independent execution while minimizing overlapping changes.\n\nOne of the more interesting experiments involved assigning the same issue to two different AI coding agents.\n\nI had two approaches in mind, so instead of choosing one immediately, I assigned each approach to a separate agent.\n\nBoth received the same requirement but worked independently in separate Git worktrees, exploring their respective approaches and producing different implementations.\n\nI deliberately didn't share one agent's implementation with the other.\n\nWhy?\n\nI wanted to see how differently the same problem could be approached without one implementation influencing the other.\n\nOnce both implementations were ready, I compared them based on:\n\nRather than automatically choosing one agent's output, I reviewed both solutions and selected the approach better suited to the existing application.\n\nThis gave me the opportunity to explore alternative solutions before committing to one implementation.\n\nThe experiment looked like this:\n\n``` php\nflowchart TD\n    A[\"Same Feature Requirement\"] --> B[\"Shared Task Brief\"]\n    B --> C[\"Agent A\"]\n    B --> D[\"Agent B\"]\n    C --> E[\"Implementation A\"]\n    D --> F[\"Implementation B\"]\n    E --> G[\"Comparative Review\"]\n    F --> G\n    G --> H[\"Tests and Code Review\"]\n    H --> I[\"Select Implementation\"]\n    I --> J[\"Integration\"]\n```\n\nHowever, this isn't something I'd recommend for every issue. Running two agents on the same task increases implementation and review effort.\n\nIt's more useful for complex features or architectural decisions where comparing alternatives is worth the additional cost.\n\nIn an ideal parallel development workflow, every task would have its own branch created directly from `master`.\n\nMy actual Git history was more complicated.\n\nOnly two lines of work started directly from `master`. Several other branches were created on top of existing feature branches.\n\nThis resulted in a stacked branch structure.\n\nFor example:\n\n```\nmaster\n |\n +--- feature/base\n       |\n       +--- feature/extension-a\n       |      |\n       |      +--- feature/extension-b\n       |\n       +--- fix/integration\n```\n\nStacked branches are useful when one implementation depends on another.\n\nInstead of duplicating unfinished changes or waiting for everything to merge into `master`, a dependent branch can build on an existing implementation.\n\nHowever, this also introduces dependencies between branches. If an upstream branch changes, dependent branches may need to be rebased or updated.\n\nI also used `git cherry-pick` to selectively move commits between development branches:\n\n```\ngit cherry-pick <commit-hash>\n```\n\nRather than merging every branch wholesale, I could select the commits that were actually useful and bring them into my integration branch.\n\nThis gave me more control over what entered the final codebase.\n\nOut of all commits I authored during this period, around six were set aside or replaced. One documentation commit was dropped completely.\n\n**Parallel development doesn't mean accepting every agent's output. An implementation is a candidate, not an automatic contribution to the final codebase.**\n\nWorktrees solve the problem of multiple agents modifying the same local working directory. They don't eliminate integration conflicts.\n\nTwo agents can independently modify different worktrees and still produce incompatible changes.\n\nFor example, two features might modify the same API service, shared TypeScript interface, database model, application state, or common UI component.\n\nTheir changes won't overwrite each other's local files, but they may conflict when combined.\n\nDuring integration, I encountered three merges that required conflict resolution. The largest conflict involved **17 files**, because two competing implementations had modified several of the same areas.\n\nI used a combination of Git commands to understand and manage these changes.\n\n**Inspect changes between branches:**\n\n```\ngit diff main...feature/task-a\n```\n\n**Understand the commit history:**\n\n```\ngit log --oneline --graph --all\n```\n\n**Check the working tree:**\n\n```\ngit status\n```\n\n**Integrate a branch:**\n\n```\ngit merge feature/task-a\n```\n\nWhen conflicts occurred, I resolved them by understanding what each implementation was trying to achieve rather than blindly accepting one side.\n\nGit can identify conflicting changes, but it cannot determine which implementation is architecturally correct.\n\nThat decision still requires engineering judgment.\n\nOne of the biggest mistakes in multi-agent development is assuming that if every agent reports successful implementation, the application is ready.\n\nAn agent can successfully implement and test its own changes without guaranteeing that the combined application works.\n\nAfter integration, I still needed follow-up commits to fix TypeScript errors and update test snapshots.\n\nThese fixes were completed within approximately half an hour of merging.\n\nThe complete integration process, from creating the integration branch to pushing it, took roughly 40 minutes.\n\nAfter the fixes, the project's test run showed:\n\n| Result | Count | \n|---|---|\n| Passing tests | ~4,000 | \n| Existing failures | 28 | \n\nThe 28 failures were already present before this work.\n\nThis is why having a known testing baseline matters. Without it, pre-existing failures can easily be mistaken for regressions introduced by new changes.\n\nMy verification process involved reviewing the integrated Git diff, resolving implementation and type errors, checking test snapshots, running the project's test suite, and distinguishing existing failures from newly introduced issues.\n\n**Agent-level verification and system-level verification are two different things.**\n\nAn agent can verify its assigned task. The developer still needs to verify the application as a whole.\n\nThe workflow worked, but there are several things I'd approach differently in the next iteration.\n\n**Establish file ownership earlier.** Before launching agents, I'd define which modules and files each task is expected to modify. This would reduce overlapping changes.\n\n**Define shared interfaces before implementation.** For tasks involving frontend, backend, and database changes, I'd establish API contracts and shared types before parallel execution.\n\n**Integrate incrementally.** Waiting until multiple implementations are complete increases integration complexity. I'd merge smaller changes more frequently and run regression tests after each meaningful integration.\n\n**Maintain a central task registry.** I'd maintain a single place containing task descriptions, branch names, worktree paths, dependencies, ownership, status, and verification results.\n\n**Use competing implementations selectively.** Running two agents on the same issue was useful, but it also increased review and integration work. I'd reserve it for high-impact features.\n\nFour days, a 29-page requirement document pushed me to experiment with a different approach to AI-assisted development.\n\nUsing OpenCode sessions alongside Git branches and worktrees gave me a way to distribute implementation across independent environments while retaining control over integration.\n\nThe two-agent experiment also showed me that parallel coding can be useful beyond implementation speed. It can help explore alternative solutions before committing to an architectural direction.\n\nBut parallel execution doesn't eliminate engineering responsibility. It shifts where that responsibility sits.\n\nThe agents can investigate, implement, and test. Someone still needs to decide how the work fits together, which implementation is worth keeping, and whether the final application actually works.\n\nIf you're experimenting with multi-agent coding, I'd suggest starting with two or three independent tasks, giving each a separate worktree, defining clear boundaries, and integrating changes incrementally.\n\nScale the number of agents only when your ability to coordinate and verify their output can keep up.\n\n**The next evolution of AI-assisted development isn't necessarily one agent that writes more code. It's a coordinated system of agents that can work independently without losing control of the engineering process.**\n\n*This article documents one practical development experience, not a controlled performance benchmark. The numbers reflect my project and workflow and shouldn't be interpreted as guaranteed productivity improvements.*", "url": "https://wpnews.pro/news/i-had-4-days-to-tackle-a-29-page-issue-document-here-s-how-i-ran-parallel-ai-git", "canonical_source": "https://dev.to/kishanmn/i-had-4-days-to-tackle-a-29-page-issue-document-heres-how-i-ran-parallel-ai-agents-with-git-3a8l", "published_at": "2026-11-18 07:38:17+00:00", "updated_at": "2026-11-18 07:43:48.710440+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "ai-tools"], "entities": ["OpenCode", "Git"], "also_reported_by": [], "takeaway": "Assign each parallel coding agent its own Git worktree and branch rather than sharing one directory, and split tasks by file ownership and dependencies to avoid conflicting AI-generated changes.", "recommendation": {"advice": "Give each parallel coding agent a dedicated Git worktree and branch, and write task briefs with expected behaviour, file boundaries and acceptance criteria before launching sessions.", "playbook": "coding-agents", "playbook_url": "https://wpnews.pro/playbooks/coding-agents"}, "alternates": {"html": "https://wpnews.pro/news/i-had-4-days-to-tackle-a-29-page-issue-document-here-s-how-i-ran-parallel-ai-git", "markdown": "https://wpnews.pro/news/i-had-4-days-to-tackle-a-29-page-issue-document-here-s-how-i-ran-parallel-ai-git.md", "text": "https://wpnews.pro/news/i-had-4-days-to-tackle-a-29-page-issue-document-here-s-how-i-ran-parallel-ai-git.txt", "jsonld": "https://wpnews.pro/news/i-had-4-days-to-tackle-a-29-page-issue-document-here-s-how-i-ran-parallel-ai-git.jsonld"}}