chore(gastown): scorched-earth SQLite removal from codebase

Remove all bd sync references and SQLite-specific code from gastown:

**Formulas (agent priming):**
- mol-polecat-work: Remove bd sync step from prepare-for-review
- mol-sync-workspace: Replace sync-beads step with verify-beads (Dolt check)
- mol-polecat-conflict-resolve: Remove bd sync from close-beads
- mol-polecat-code-review: Remove bd sync from summarize-review and complete-and-exit
- mol-polecat-review-pr: Remove bd sync from complete-and-exit
- mol-convoy-cleanup: Remove bd sync from archive-convoy
- mol-digest-generate: Remove bd sync from send-digest
- mol-town-shutdown: Replace sync-state step with verify-state
- beads-release: Replace restart-daemons with verify-install (no daemons with Dolt)

**Templates (role priming):**
- mayor.md.tmpl: Update session end checklist to remove bd sync steps
- crew.md.tmpl: Remove bd sync references from workflow and checklist
- polecat.md.tmpl: Update self-cleaning model and session close docs
- spawn.md.tmpl: Remove bd sync from completion steps
- nudge.md.tmpl: Remove bd sync from completion steps

**Go code:**
- session_manager.go: Remove syncBeads function and call
- rig_dock.go: Remove bd sync calls from dock/undock
- crew/manager.go: Remove runBdSync, update Pristine function
- crew_maintenance.go: Remove bd sync status output
- crew.go: Update pristine command help text
- polecat.go: Make sync command a no-op with deprecation message
- daemon/lifecycle.go: Remove bd sync from startup sequence
- doctor/beads_check.go: Update fix hints and Fix to use bd import not bd sync
- doctor/rig_check.go: Remove sync status check, simplify BeadsConfigValidCheck
- beads/beads.go: Update primeContent to remove bd sync references

With Dolt backend, beads changes are persisted immediately to the sql-server.
There is no separate sync step needed.

Part of epic: hq-e4eefc (SQLite removal)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
mayor
2026-01-25 14:06:13 -08:00
committed by Steve Yegge
parent 1d260d377b
commit b316239d12
21 changed files with 598 additions and 243 deletions

View File

@@ -46,6 +46,7 @@ type Daemon struct {
cancel context.CancelFunc
curator *feed.Curator
convoyWatcher *ConvoyWatcher
doltServer *DoltServerManager
// Mass death detection: track recent session deaths
deathsMu sync.Mutex
@@ -93,6 +94,15 @@ func New(config *Config) (*Daemon, error) {
logger.Printf("Loaded patrol config from %s", PatrolConfigFile(config.TownRoot))
}
// Initialize Dolt server manager if configured
var doltServer *DoltServerManager
if patrolConfig != nil && patrolConfig.Patrols != nil && patrolConfig.Patrols.DoltServer != nil {
doltServer = NewDoltServerManager(config.TownRoot, patrolConfig.Patrols.DoltServer, logger.Printf)
if doltServer.IsEnabled() {
logger.Printf("Dolt server management enabled (port %d)", patrolConfig.Patrols.DoltServer.Port)
}
}
return &Daemon{
config: config,
patrolConfig: patrolConfig,
@@ -100,6 +110,7 @@ func New(config *Config) (*Daemon, error) {
logger: logger,
ctx: ctx,
cancel: cancel,
doltServer: doltServer,
}, nil
}
@@ -219,6 +230,10 @@ func (d *Daemon) heartbeat(state *State) {
d.logger.Println("Heartbeat starting (recovery-focused)")
// 0. Ensure Dolt server is running (if configured)
// This must happen before beads operations that depend on Dolt.
d.ensureDoltServerRunning()
// 1. Ensure Deacon is running (restart if dead)
// Check patrol config - can be disabled in mayor/daemon.json
if IsPatrolEnabled(d.patrolConfig, "deacon") {
@@ -292,6 +307,18 @@ func (d *Daemon) heartbeat(state *State) {
d.logger.Printf("Heartbeat complete (#%d)", state.HeartbeatCount)
}
// ensureDoltServerRunning ensures the Dolt SQL server is running if configured.
// This provides the backend for beads database access in server mode.
func (d *Daemon) ensureDoltServerRunning() {
if d.doltServer == nil || !d.doltServer.IsEnabled() {
return
}
if err := d.doltServer.EnsureRunning(); err != nil {
d.logger.Printf("Error ensuring Dolt server is running: %v", err)
}
}
// DeaconRole is the role name for the Deacon's handoff bead.
const DeaconRole = "deacon"
@@ -666,6 +693,15 @@ func (d *Daemon) shutdown(state *State) error { //nolint:unparam // error return
d.logger.Println("Convoy watcher stopped")
}
// Stop Dolt server if we're managing it
if d.doltServer != nil && d.doltServer.IsEnabled() && !d.doltServer.IsExternal() {
if err := d.doltServer.Stop(); err != nil {
d.logger.Printf("Warning: failed to stop Dolt server: %v", err)
} else {
d.logger.Println("Dolt server stopped")
}
}
state.Running = false
if err := SaveState(d.config.TownRoot, state); err != nil {
d.logger.Printf("Warning: failed to save final state: %v", err)