docs: Document multi-repo workflow with global daemon

Implements bd-122: Document how to use beads across multiple projects

Added comprehensive multi-repo documentation:
- README.md: Global daemon section with architecture diagram
- AGENTS.md: MCP multi-repo configuration (global daemon + per-project)
- integrations/beads-mcp/README.md: BEADS_WORKING_DIR usage
- Mermaid diagram showing one daemon serving multiple repos

Documentation covers:
- Global daemon (bd daemon --global) for system-wide usage
- Per-project MCP instances with BEADS_WORKING_DIR
- Comparison table (local vs global)
- When to use each approach
- Example workflows for multi-project setups

Benefits of global daemon:
- One daemon process for all repos
- Automatic socket discovery (local -> global fallback)
- Better resource usage
- Per-request context routing to correct database

Amp-Thread-ID: https://ampcode.com/threads/T-ea606216-b886-4af0-bba8-56d000362d01
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-17 22:49:22 -07:00
parent 958bbc0853
commit 0795797bac
4 changed files with 220 additions and 2 deletions

View File

@@ -59,11 +59,73 @@ Then use in Claude Desktop config:
- `BEADS_USE_DAEMON` - Use daemon RPC instead of CLI (default: `1`, set to `0` to disable)
- `BEADS_PATH` - Path to bd executable (default: `~/.local/bin/bd`)
- `BEADS_DB` - Path to beads database file (default: auto-discover from cwd)
- `BEADS_WORKING_DIR` - Working directory for bd commands (default: `$PWD` or current directory)
- `BEADS_WORKING_DIR` - Working directory for bd commands (default: `$PWD` or current directory). Used for multi-repo setups - see below
- `BEADS_ACTOR` - Actor name for audit trail (default: `$USER`)
- `BEADS_NO_AUTO_FLUSH` - Disable automatic JSONL sync (default: `false`)
- `BEADS_NO_AUTO_IMPORT` - Disable automatic JSONL import (default: `false`)
## Multi-Repository Setup
**New in v0.9.11:** Work across multiple beads projects seamlessly!
### Option 1: Global Daemon (Recommended)
Start a single daemon to serve all your projects:
```bash
# Start global daemon (serves all repos)
bd daemon --global
```
The MCP server automatically detects the global daemon and routes requests based on your working directory. No configuration changes needed!
**How it works:**
1. MCP server checks for local daemon socket (`.beads/bd.sock`)
2. Falls back to global daemon socket (`~/.beads/bd.sock`)
3. Routes requests to correct database based on working directory
4. Each project keeps its own database at `.beads/*.db`
**Simple config - works for all projects:**
```json
{
"mcpServers": {
"beads": {
"command": "beads-mcp"
}
}
}
```
### Option 2: Per-Project MCP Instances
Configure separate MCP servers for specific projects using `BEADS_WORKING_DIR`:
```json
{
"mcpServers": {
"beads-webapp": {
"command": "beads-mcp",
"env": {
"BEADS_WORKING_DIR": "/Users/yourname/projects/webapp"
}
},
"beads-api": {
"command": "beads-mcp",
"env": {
"BEADS_WORKING_DIR": "/Users/yourname/projects/api"
}
}
}
}
```
Each instance will discover and use the database in its `BEADS_WORKING_DIR` path.
**Which should you use?**
-**Global daemon**: 3+ projects, better resource usage, automatic routing
-**Per-project instances**: 1-2 main projects, explicit control
-**Hybrid**: Run global daemon for convenience + per-project for main projects
## Features
**Resource:**