This project uses a sophisticated branch hierarchy optimized for parallel AI agent development using git worktrees.
main # Production releases only
├── develop # Integration and beta testing
├── feat/feature-name-hub # Feature coordination branch
├── feat/feature-name/agent-task-1 # Agent 1 isolated work
├── feat/feature-name/agent-task-2 # Agent 2 parallel work
└── feat/feature-name/agent-task-3 # Agent 3 parallel work
-
main
- Production-ready releases only
- Only receives squash-merged features from
develop - Never contains granular commits
- Tagged for version releases
-
develop
- Integration branch for completed features
- Runs full test suite before merging to
main - Used for beta/latest builds
- All features must pass CI here
For each feature, create a hub branch and agent branches:
-
Feature Hub Branch
- Name:
feat/feature-name-hub - Purpose: Coordination point for parallel agent work
- Branch from:
develop - Merge to:
develop(squash merge)
- Name:
-
Agent Work Branches
- Name:
feat/feature-name/specific-task - Purpose: Isolated workspace for individual agents
- Branch from:
feat/feature-name-hub - Merge to:
feat/feature-name-hub(regular merge)
- Name:
Each agent operates in its own worktree for true parallel development:
# Create feature hub
git checkout -b feat/tool-registry-hub develop
# Agent 1 creates worktree
git worktree add ../mcp-funnel-agent1 -b feat/tool-registry/docs-update feat/tool-registry-hub
# Agent 2 creates worktree
git worktree add ../mcp-funnel-agent2 -b feat/tool-registry/api-impl feat/tool-registry-hub
# Agent 3 creates worktree
git worktree add ../mcp-funnel-agent3 -b feat/tool-registry/tests feat/tool-registry-hubAgent branches → Feature hub → Develop → Main
↓ ↓ ↓ ↓
Isolated Coordinated Tested Released
# In hub worktree
git checkout feat/tool-registry-hub
git merge feat/tool-registry/docs-update- Preserves agent's granular commits for context
- Allows tracking individual agent contributions
- Maintains development history during active work
git checkout develop
git merge --squash feat/tool-registry-hub
git commit -m "feat: implement tool registry with GitHub discovery
- Added registry interface definitions
- Implemented GitHub-based discovery
- Created comprehensive test suite
- Updated documentation
Closes #123"- Creates single atomic commit in
develop - Clean, searchable history
- Easy to revert if needed
Feature branches may contain temporary coordination files that should not reach develop. Use the .feature/ folder for such files:
.feature/
├── TASK.md # Agent coordination
├── NOTES.md # Development notes
├── hub-status.json # Merge planning
└── agent-logs/ # Debug outputsImplementation Options:
-
Primary Method - Automated Script:
# Use the provided squash script scripts/squash-merge.sh feat/your-feature-hub -
GitHub Integration:
- Branch protection blocks PRs containing
.feature/files - Comment
/mergeon PR to trigger automated squash via GitHub Action - Provides audit trail and eliminates human error
- Branch protection blocks PRs containing
Benefits:
- Deterministic: Clear
.feature/convention - Error prevention: Automated filtering prevents typos/missed steps
- Hybrid safety: Multiple methods ensure files never leak to develop
- Audit trail: GitHub Actions provide better logs than local troubleshooting
git checkout main
git merge --squash develop
git commit -m "release: v1.2.0
Features:
- Tool registry with GitHub discovery
- Enhanced validation system
- Performance improvements
See CHANGELOG for details"IMPORTANT: Follow these exact patterns. AI agents must use deterministic branch names.
- Feature Hub:
feat/{feature-name}-hub - Task Hub:
feat/{feature-name}/{task-name}-hub - Agent Branch:
feat/{feature-name}/{task-name}/{specific-work}-agent-{id}
{feature-name}: Kebab-case feature identifier (e.g.,github-discovery,tool-registry){task-name}: Task category (e.g.,documentation,implementation,tests){specific-work}: What the agent is doing (e.g.,api-docs,core-logic,e2e-tests){id}: Sequential agent number (1, 2, 3...)
Feature: GitHub Discovery with 2 parallel task streams and 3 agents per task.
# Level 1: Feature coordination
feat/github-discovery-hub
# Level 2: Task coordination (branches from feature hub)
feat/github-discovery/documentation-hub
feat/github-discovery/implementation-hub
# Level 3: Agent work (branches from respective task hub)
# Documentation agents:
feat/github-discovery/documentation/api-docs-agent-1
feat/github-discovery/documentation/user-guide-agent-2
feat/github-discovery/documentation/examples-agent-3
# Implementation agents:
feat/github-discovery/implementation/core-logic-agent-1
feat/github-discovery/implementation/api-endpoints-agent-2
feat/github-discovery/implementation/validation-agent-3Agent branches → Task hub → Feature hub → Develop
↓ ↓ ↓
(regular) (regular) (squash)
Specifically:
api-docs-agent-1 → documentation-hub → github-discovery-hub → develop
Each agent:
- Works in their own worktree
- Makes granular commits
- Creates PR against their task hub (NOT feature hub)
- Task hub coordinator merges agent work
- Feature hub coordinator merges task hubs
-
Agent branches: Delete immediately after merging to hub
git branch -d feat/tool-registry/docs-update git push origin --delete feat/tool-registry/docs-update
-
Hub branches: Delete after squash-merging to develop
git branch -d feat/tool-registry-hub git push origin --delete feat/tool-registry-hub
-
Worktree cleanup:
git worktree remove ../mcp-funnel-agent1 git worktree prune
-
Create hub branch:
git checkout develop git pull origin develop git checkout -b feat/your-feature-hub
-
Agents create worktrees:
git worktree add ../mcp-funnel-task -b feat/your-feature/task feat/your-feature-hub cd ../mcp-funnel-task
-
Agent work:
- Make granular, logical commits
- Keep branch updated with hub:
git fetch origin git rebase feat/your-feature-hub
-
Hub coordination:
- Review and merge agent PRs
- Resolve conflicts between agent work
- Ensure feature completeness
- Store coordination files in
.feature/folder (excluded from develop)
-
Run validation (in each worktree):
yarn validate yarn test -
Update from hub (for agents):
git fetch origin git rebase feat/your-feature-hub
-
Update from develop (for hub):
git fetch origin git rebase develop
- Title:
feat(feature-name): specific task description - Target branch:
feat/feature-name-hub - Review focus: Task completion and integration
- Merge method: Regular merge (preserves commits)
- Title:
feat: complete feature description - Target branch:
develop - Review focus: Feature completeness and quality
- Merge method: Use
scripts/squash-merge.shor comment/mergefor automated squash - Description should include:
- All agent contributions
- Testing performed
- Breaking changes (if any)
- Important: Ensure
.feature/files are excluded from final merge
- Title:
release: vX.Y.Z - Target branch:
main - Review focus: Release readiness
- Merge method: Squash and merge
- Include CHANGELOG updates
- Strict mode enabled
- No
anytypes without justification - Use generics appropriately
- Follow existing patterns in codebase
- Write tests for new features
- Update tests when modifying existing code
- E2E tests for critical paths
- Unit tests for utilities and pure functions
Use conventional commits:
feat:New featurefix:Bug fixdocs:Documentation onlystyle:Formatting, no code changerefactor:Code change that neither fixes nor addstest:Adding missing testschore:Maintenancerelease:Version releases (main branch only)
When working in agent branches, prefix commits with your task:
feat(api):for API-related workfeat(ui):for UI-related worktest(e2e):for E2E test workdocs(api):for API documentation
When multiple agents modify the same files:
- Hub coordinator identifies conflicts early
- Agents rebase their branches on updated hub
- Resolution happens at hub level, not develop
- Communication through PR comments
Open an issue for discussion about development process or architecture decisions.