feat: show redirect info in bd prime output (bd-kblo)

When beads is redirected (e.g., in Gas Town crew clones), bd prime now
shows a notice about the redirect. This helps agents understand why
they share issues with other clones.

CLI mode shows:
> ⚠️ **Redirected**: Local .beads → /path/to/target/.beads
> You share issues with other clones using this redirect.

MCP mode shows:
**Note**: Beads redirected to /path/to/target/.beads (shared with other clones)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-27 21:33:01 -08:00
parent aa3c4cb3eb
commit ba1c9d6b17
3 changed files with 106 additions and 2 deletions

View File

@@ -126,6 +126,22 @@ var isEphemeralBranch = func() bool {
return err != nil
}
// getRedirectNotice returns a notice string if beads is redirected
func getRedirectNotice(verbose bool) string {
redirectInfo := beads.GetRedirectInfo()
if !redirectInfo.IsRedirected {
return ""
}
if verbose {
return fmt.Sprintf(`> ⚠️ **Redirected**: Local .beads → %s
> You share issues with other clones using this redirect.
`, redirectInfo.TargetDir)
}
return fmt.Sprintf("**Note**: Beads redirected to %s (shared with other clones)\n\n", redirectInfo.TargetDir)
}
// outputPrimeContext outputs workflow context in markdown format
func outputPrimeContext(w io.Writer, mcpMode bool, stealthMode bool) error {
if mcpMode {
@@ -151,9 +167,11 @@ func outputMCPContext(w io.Writer, stealthMode bool) error {
closeProtocol = "Before saying \"done\": git status → git add → bd sync → git commit → bd sync → git push"
}
redirectNotice := getRedirectNotice(false)
context := `# Beads Issue Tracker Active
# 🚨 SESSION CLOSE PROTOCOL 🚨
` + redirectNotice + `# 🚨 SESSION CLOSE PROTOCOL 🚨
` + closeProtocol + `
@@ -238,12 +256,14 @@ bd sync # Push to remote
` + "```"
}
redirectNotice := getRedirectNotice(true)
context := `# Beads Workflow Context
> **Context Recovery**: Run ` + "`bd prime`" + ` after compaction, clear, or new session
> Hooks auto-call this in Claude Code when .beads/ detected
# 🚨 SESSION CLOSE PROTOCOL 🚨
` + redirectNotice + `# 🚨 SESSION CLOSE PROTOCOL 🚨
**CRITICAL**: Before saying "done" or "complete", you MUST run this checklist: