diff --git a/TROUBLESHOOTING.md b/TROUBLESHOOTING.md index 1577e532..04c06079 100644 --- a/TROUBLESHOOTING.md +++ b/TROUBLESHOOTING.md @@ -334,6 +334,36 @@ ps aux | grep "bd daemon" See [integrations/beads-mcp/README.md](integrations/beads-mcp/README.md) for MCP-specific troubleshooting. +### Claude Code sandbox mode + +**Issue:** Claude Code's sandbox restricts network access to a single socket, conflicting with bd's daemon and git operations. + +**Solution:** Use the `--sandbox` flag: + +```bash +# Sandbox mode disables daemon and auto-sync +bd --sandbox ready +bd --sandbox create "Fix bug" -p 1 +bd --sandbox update bd-42 --status in_progress + +# Or set individual flags +bd --no-daemon --no-auto-flush --no-auto-import +``` + +**What sandbox mode does:** +- Disables daemon (uses direct SQLite mode) +- Disables auto-export to JSONL +- Disables auto-import from JSONL +- Allows bd to work in network-restricted environments + +**Note:** You'll need to manually sync when outside the sandbox: +```bash +# After leaving sandbox, sync manually +bd sync +``` + +**Related:** See [Claude Code sandboxing documentation](https://www.anthropic.com/engineering/claude-code-sandboxing) for more about sandbox restrictions. + ## Platform-Specific Issues ### Windows: Path issues diff --git a/cmd/bd/main.go b/cmd/bd/main.go index 3c910ebb..1974c7d6 100644 --- a/cmd/bd/main.go +++ b/cmd/bd/main.go @@ -88,6 +88,13 @@ var rootCmd = &cobra.Command{ return } + // If sandbox mode is set, enable all sandbox flags + if sandboxMode { + noDaemon = true + noAutoFlush = true + noAutoImport = true + } + // Set auto-flush based on flag (invert no-auto-flush) autoFlushEnabled = !noAutoFlush @@ -1341,6 +1348,7 @@ func flushToJSONL() { var ( noAutoFlush bool noAutoImport bool + sandboxMode bool ) func init() { @@ -1350,6 +1358,7 @@ func init() { rootCmd.PersistentFlags().BoolVar(&noDaemon, "no-daemon", false, "Force direct storage mode, bypass daemon if running") rootCmd.PersistentFlags().BoolVar(&noAutoFlush, "no-auto-flush", false, "Disable automatic JSONL sync after CRUD operations") rootCmd.PersistentFlags().BoolVar(&noAutoImport, "no-auto-import", false, "Disable automatic JSONL import when newer than DB") + rootCmd.PersistentFlags().BoolVar(&sandboxMode, "sandbox", false, "Sandbox mode: disables daemon and auto-sync (equivalent to --no-daemon --no-auto-flush --no-auto-import)") } // createIssuesFromMarkdown parses a markdown file and creates multiple issues