Implement daemon auto-start with comprehensive improvements (bd-124)
- Auto-starts daemon on first bd command (unless --no-daemon or BEADS_AUTO_START_DAEMON=false) - Exponential backoff on failures: 5s, 10s, 20s, 40s, 80s, 120s (max) - Lockfile prevents race conditions when multiple commands start daemon simultaneously - Stdio redirected to /dev/null to prevent daemon output in foreground - Uses os.Executable() for security (prevents PATH hijacking) - Socket readiness verified with actual connection test - Accepts multiple falsy values: false, 0, no, off (case-insensitive) - Working directory set to database directory for local daemon context - Comprehensive test coverage including backoff math and concurrent starts Fixes: - Closes bd-1 (won't fix - compaction keeps DBs small) - Closes bd-124 (daemon auto-start implemented) Documentation updated in README.md and AGENTS.md Amp-Thread-ID: https://ampcode.com/threads/T-b10fe866-ab85-417f-9c4c-5d1f044c5796 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -53,6 +53,8 @@ bd daemon --global
|
||||
# MCP server automatically discovers and uses the global daemon
|
||||
```
|
||||
|
||||
**Note:** As of v0.9.11, the daemon **auto-starts automatically** when you run any `bd` command. You typically don't need to manually start it. To disable auto-start, set `BEADS_AUTO_START_DAEMON=false`.
|
||||
|
||||
Your MCP config stays simple:
|
||||
```json
|
||||
{
|
||||
@@ -67,6 +69,7 @@ The MCP server will:
|
||||
1. Check for local daemon socket (`.beads/bd.sock`)
|
||||
2. Fall back to global daemon socket (`~/.beads/bd.sock`)
|
||||
3. Automatically route requests to the correct database based on your current working directory
|
||||
4. Auto-start the daemon if it's not running (with exponential backoff on failures)
|
||||
|
||||
**Option 2: Multiple MCP Server Instances**
|
||||
Configure separate MCP servers for each major project:
|
||||
|
||||
Reference in New Issue
Block a user