docs/MULTI_REPO_AGENTS.md
This guide covers multi-repo workflow patterns specifically for AI agents working with beads.
For humans, see MULTI_REPO_MIGRATION.md for interactive wizards and detailed setup.
AI agents should use one MCP server instance that automatically routes to per-project Dolt servers:
{
"beads": {
"command": "beads-mcp",
"args": []
}
}
The MCP server automatically:
Architecture (default):
MCP Server (one instance)
↓
Per-Project Dolt Servers (one per workspace)
↓
Dolt Databases (complete isolation)
With shared server mode enabled (BEADS_DOLT_SHARED_SERVER=1), all projects
use a single Dolt server at ~/.beads/shared-server/. Database isolation is
maintained via per-project database names (based on project prefix).
Agents can configure multi-repo behavior via bd config:
# Auto-routing (detects role: maintainer vs contributor)
bd config set routing.mode auto
bd config set routing.maintainer "."
bd config set routing.contributor "~/.beads-planning"
# Explicit routing (always use default)
bd config set routing.mode explicit
bd config set routing.default "."
# Multi-repo aggregation (hydration)
bd config set repos.primary "."
bd config set repos.additional "~/repo1,~/repo2,~/repo3"
Check current config:
bd config get routing.mode
bd config get repos.additional
bd info --json # Shows all config
When routing.mode=auto, beads detects user role and routes new issues automatically:
Maintainer (SSH push access):
# Git remote: [email protected]:user/repo.git
bd create "Fix bug" -p 1
# → Creates in current repo (source_repo = ".")
Contributor (HTTPS or no push access):
# Git remote: https://github.com/fork/repo.git
bd create "Fix bug" -p 1
# → Creates in planning repo (source_repo = "~/.beads-planning")
Role detection priority:
git config beads.role maintainer|contributorAlways available regardless of routing mode:
# Force creation in specific repo
bd create "Issue" -p 1 --repo /path/to/repo
bd create "Issue" -p 1 --repo ~/my-planning
Issues with discovered-from dependencies automatically inherit parent's source_repo:
# Parent in current repo
bd create "Implement auth" -p 1
# → Created as bd-abc (source_repo = ".")
# Discovered issue inherits parent's repo
bd create "Found bug" -p 1 --deps discovered-from:bd-abc
# → Created with source_repo = "." (same as parent)
Override if needed:
bd create "Issue" -p 1 --deps discovered-from:bd-abc --repo /different/repo
Agents working in multi-repo mode see aggregated issues from multiple repositories:
# View all issues (current + additional repos)
bd ready --json
bd list --json
# Filter by source repository
bd list --json | jq '.[] | select(.source_repo == ".")'
bd list --json | jq '.[] | select(.source_repo == "~/.beads-planning")'
How it works:
source_repo field for provenanceSetup: Human runs bd init --contributor (wizard handles config)
Agent workflow:
# All planning issues auto-route to separate repo
bd create "Investigate implementation" -p 1
bd create "Draft RFC" -p 2
# → Created in ~/.beads-planning (never appears in PRs)
# View all work (upstream + planning)
bd ready
bd list --json
# Complete work
bd close plan-42 --reason "Done"
# Git commit/push - no .beads/ pollution in PR ✅
Setup: Human runs bd init --team (wizard handles config)
Agent workflow:
# Shared team planning (committed to repo)
bd create "Implement feature X" -p 1
# → Created in current repo (visible to team)
# Optional: Personal experiments in separate repo
bd create "Try alternative" -p 2 --repo ~/.beads-planning-personal
# → Created in personal repo (private)
# View all
bd ready --json
Setup: Multiple repos for different phases
Agent workflow:
# Phase 1: Planning repo
cd ~/projects/myapp-planning
bd create "Design auth" -p 1 -t epic
# Phase 2: Implementation repo (views planning + impl)
cd ~/projects/myapp-implementation
bd ready # Shows both repos
bd create "Implement auth backend" -p 1
bd dep add impl-42 plan-10 --type blocks # Link across repos
Symptom: bd create routes to unexpected repo
Check:
bd config get routing.mode
bd config get routing.maintainer
bd config get routing.contributor
bd info --json | jq '.role'
Fix:
# Use explicit flag
bd create "Issue" -p 1 --repo .
# Or reconfigure routing
bd config set routing.mode explicit
bd config set routing.default "."
Symptom: bd list only shows current repo
Check:
bd config get repos.additional
Fix:
# Add missing repos
bd config set repos.additional "~/repo1,~/repo2"
# Force sync
bd dolt push
bd list --json
Symptom: Issues with discovered-from appear in wrong repo
Explanation: This is intentional - discovered issues inherit parent's source_repo
Override if needed:
bd create "Issue" -p 1 --deps discovered-from:bd-42 --repo /different/repo
Symptom: ~/.beads-planning changes appear in upstream PRs
Verify:
# Planning repo should be separate
ls -la ~/.beads-planning/.git # Should exist
# Fork should NOT contain planning issues
cd ~/projects/fork
bd list --json | jq '.[] | select(.source_repo == "~/.beads-planning")'
# Should be empty
# Check routing
bd config get routing.contributor # Should be ~/.beads-planning
Symptom: MCP operations affect wrong project
Cause: Using multiple MCP server instances (not recommended)
Fix:
// RECOMMENDED: Single MCP server
{
"beads": {
"command": "beads-mcp",
"args": []
}
}
The single MCP server automatically routes based on workspace directory.
Symptom: Commands fail right after a bd upgrade
Fix:
bd version # Confirm active CLI version
bd doctor quick # Validate local installation health
~/.beads-planning.beads/ in PRs to upstreambd ready to see all work (upstream + planning)bd dolt push to sync the shared Dolt databasebd dolt push to ensure changes are committed/pushed.beads/ - you lose all issue dataplanning, impl, maint)blocks dependenciesbd list --json to filter by source_repobd info --json to verify workspace statebd dolt push at end of sessionMulti-repo mode is fully backward compatible:
Without multi-repo config:
bd create "Issue" -p 1
# → Creates in local Dolt database (single-repo mode)
With multi-repo config:
bd create "Issue" -p 1
# → Auto-routed based on config
# → Old issues in local database still work
Disabling multi-repo:
bd config unset routing.mode
bd config unset repos.additional
# → Back to single-repo mode
# Auto-detect role (maintainer vs contributor)
bd config set routing.mode auto
bd config set routing.maintainer "." # Where maintainer issues go
bd config set routing.contributor "~/.beads-planning" # Where contributor issues go
# Explicit mode (always use default)
bd config set routing.mode explicit
bd config set routing.default "." # All issues go here
# Check settings
bd config get routing.mode
bd config get routing.maintainer
bd config get routing.contributor
bd config get routing.default
# Set primary repo (optional, default is current)
bd config set repos.primary "."
# Add additional repos to aggregate
bd config set repos.additional "~/repo1,~/repo2,~/repo3"
# Check settings
bd config get repos.primary
bd config get repos.additional
# Show all config + database path + server status
bd info --json
# Sample output:
{
"database_path": "/Users/you/projects/myapp/.beads/dolt",
"config": {
"routing": {
"mode": "auto",
"maintainer": ".",
"contributor": "~/.beads-planning"
},
"repos": {
"primary": ".",
"additional": ["~/repo1", "~/repo2"]
}
},
"server": {
"running": true,
"pid": 12345,
"mode": "server"
}
}