diff --git a/.beads/PRIME.md b/.beads/PRIME.md index 64b684da..5b88122e 100644 --- a/.beads/PRIME.md +++ b/.beads/PRIME.md @@ -28,16 +28,13 @@ This is physics, not politeness. Gas Town is a steam engine - you are a piston. - `gt mol status` - Check your hooked work - `gt mail inbox` - Check for messages - `bd ready` - Find available work (no blockers) -- `bd sync` - Sync beads changes ## Session Close Protocol Before saying "done": 1. git status (check what changed) 2. git add (stage code changes) -3. bd sync (commit beads changes) -4. git commit -m "..." (commit code) -5. bd sync (commit any new beads changes) -6. git push (push to remote) +3. git commit -m "..." (commit code) +4. git push (push to remote) -**Work is not done until pushed.** +**Work is not done until pushed.** Beads changes are automatically committed with Dolt. diff --git a/docs/INSTALLING.md b/docs/INSTALLING.md index 6170a920..5b98c22c 100644 --- a/docs/INSTALLING.md +++ b/docs/INSTALLING.md @@ -268,13 +268,13 @@ ssh -T git@github.com git config --global credential.helper cache ``` -### Beads sync issues +### Beads issues -If beads aren't syncing across clones: +If experiencing beads problems: ```bash cd ~/gt/myproject/mayor/rig -bd sync --status # Check sync status +bd status # Check database health bd doctor # Run beads health check ``` diff --git a/docs/reference.md b/docs/reference.md index 882b18b3..0469c7fb 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -626,7 +626,6 @@ bd create --title="..." --type=task bd update --status=in_progress bd close bd dep add # child depends on parent -bd sync # Push/pull changes ``` ## Patrol Agents diff --git a/internal/formula/formulas/mol-convoy-cleanup.formula.toml b/internal/formula/formulas/mol-convoy-cleanup.formula.toml index 04a9b0ae..ad688db1 100644 --- a/internal/formula/formulas/mol-convoy-cleanup.formula.toml +++ b/internal/formula/formulas/mol-convoy-cleanup.formula.toml @@ -135,12 +135,7 @@ bd show {{convoy}} # Status should reflect archived state ``` -**4. Sync to persist:** -```bash -bd sync -``` - -**Exit criteria:** Convoy archived, changes synced.""" +**Exit criteria:** Convoy archived.""" [[steps]] id = "notify-overseer" diff --git a/internal/formula/formulas/mol-deacon-patrol.formula.toml b/internal/formula/formulas/mol-deacon-patrol.formula.toml index c60be7b4..f293c2b3 100644 --- a/internal/formula/formulas/mol-deacon-patrol.formula.toml +++ b/internal/formula/formulas/mol-deacon-patrol.formula.toml @@ -419,114 +419,10 @@ gt mail send mayor/ -s "Health: unresponsive" \\ Reset unresponsive_cycles to 0 when component responds normally.""" -[[steps]] -id = "hung-session-detection" -title = "Detect and recover hung Gas Town sessions (SURGICAL)" -needs = ["health-scan"] -description = """ -Detect and surgically recover hung Gas Town sessions where the Claude API call is stuck. - -A hung session appears "running" (tmux session exists, Claude process exists) but -the API call has been stuck indefinitely. This breaks patrol chains - if witness -hangs, refinery never gets nudged about new MRs. - -**Why existing checks miss this:** -- zombie-scan only catches processes not in tmux sessions -- gt status shows "running" if tmux session exists -- Nudges queue but never get processed (Claude can't respond) - -## SURGICAL TARGETING - -**ONLY these session patterns are valid targets:** -- `gt--witness` (e.g., gt-kalshi-witness, gt-horizon-witness) -- `gt--refinery` (e.g., gt-kalshi-refinery) -- `hq-deacon` - -**NEVER touch sessions that don't match these patterns exactly.** - -## DETECTION (All checks must pass) - -For each Gas Town session, capture output and verify ALL of these: - -```bash -# Step 1: Get session output -output=$(tmux capture-pane -t -p 2>/dev/null | tail -10) -``` - -**Check 1: Session is in waiting state** -Must see one of: `Clauding`, `Deciphering`, `Marinating`, `Finagling`, `thinking` -```bash -echo "$output" | grep -qiE 'Clauding|Deciphering|Marinating|Finagling|thinking' -``` - -**Check 2: Duration exceeds threshold (30+ minutes)** -Parse duration from output like "21h 35m 20s" or "45m 30s": -```bash -# Extract hours and minutes -hours=$(echo "$output" | grep -oE '[0-9]+h' | head -1 | tr -d 'h') -minutes=$(echo "$output" | grep -oE '[0-9]+m' | head -1 | tr -d 'm') -total_minutes=$((${hours:-0} * 60 + ${minutes:-0})) -# Threshold: 30 minutes minimum -[ "$total_minutes" -ge 30 ] -``` - -**Check 3: Zero tokens received (definite hang) OR very long duration (>2 hours)** -```bash -# Definite hang: zero tokens received -echo "$output" | grep -qE '↓ 0 tokens' -# OR extremely long duration (>2 hours = 120 minutes) -[ "$total_minutes" -ge 120 ] -``` - -**Check 4: NOT showing active tool execution** -Active sessions show tool markers (⏺). If present, session is actually working: -```bash -# If tool markers present in recent output, DO NOT kill -echo "$output" | grep -qE '⏺|Read|Write|Bash|Edit' && continue -``` - -## RECOVERY (Only after ALL checks pass) - -**Log the action first:** -```bash -echo "[$(date)] RECOVERING HUNG: (${hours}h ${minutes}m, waiting state)" >> $GT_ROOT/logs/hung-sessions.log -``` - -**Kill and restart based on session type:** - -For witness: -```bash -tmux kill-session -t gt--witness 2>/dev/null -gt witness start -``` - -For refinery: -```bash -tmux kill-session -t gt--refinery 2>/dev/null -gt refinery restart -``` - -For deacon (self-recovery - use with caution): -```bash -# Deacon detecting itself is hung is a paradox -# Only kill if another deacon instance exists or human confirmed -gt mail send mayor/ -s "DEACON SELF-HUNG DETECTED" -m "Deacon appears hung. Human intervention required." -``` - -## VERIFICATION - -After restart, verify new session is healthy: -```bash -sleep 5 -tmux has-session -t && echo "Session restarted successfully" -``` - -**Exit criteria:** All hung Gas Town sessions detected and recovered (or escalated if recovery failed).""" - [[steps]] id = "zombie-scan" title = "Detect zombie polecats (NO KILL AUTHORITY)" -needs = ["hung-session-detection"] +needs = ["health-scan"] description = """ Defense-in-depth DETECTION of zombie polecats that Witness should have cleaned. diff --git a/internal/formula/formulas/mol-digest-generate.formula.toml b/internal/formula/formulas/mol-digest-generate.formula.toml index 0f4e0326..f77bfbbc 100644 --- a/internal/formula/formulas/mol-digest-generate.formula.toml +++ b/internal/formula/formulas/mol-digest-generate.formula.toml @@ -190,11 +190,6 @@ bd create --title="Digest: {{date}}" --type=digest \ --label=digest,{{period}} ``` -**3. Sync:** -```bash -bd sync -``` - **Exit criteria:** Digest sent to Mayor and archived as bead.""" [[steps]] diff --git a/internal/formula/formulas/mol-polecat-code-review.formula.toml b/internal/formula/formulas/mol-polecat-code-review.formula.toml index b4379e16..a3325967 100644 --- a/internal/formula/formulas/mol-polecat-code-review.formula.toml +++ b/internal/formula/formulas/mol-polecat-code-review.formula.toml @@ -270,11 +270,6 @@ Overall assessment: " ``` -**2. Sync beads:** -```bash -bd sync -``` - **Exit criteria:** Tracking issue updated with summary.""" [[steps]] diff --git a/internal/formula/formulas/mol-polecat-conflict-resolve.formula.toml b/internal/formula/formulas/mol-polecat-conflict-resolve.formula.toml index 127e5078..776e24ff 100644 --- a/internal/formula/formulas/mol-polecat-conflict-resolve.formula.toml +++ b/internal/formula/formulas/mol-polecat-conflict-resolve.formula.toml @@ -306,11 +306,6 @@ bd close --reason="merged via conflict resolution" The Refinery normally closes issues after merge, but since we pushed directly to main, we handle it here. -**3. Sync beads:** -```bash -bd sync -``` - **Exit criteria:** Original MR and source issue are closed.""" [[steps]] diff --git a/internal/formula/formulas/mol-polecat-review-pr.formula.toml b/internal/formula/formulas/mol-polecat-review-pr.formula.toml index d789152f..7d3a86b4 100644 --- a/internal/formula/formulas/mol-polecat-review-pr.formula.toml +++ b/internal/formula/formulas/mol-polecat-review-pr.formula.toml @@ -254,13 +254,11 @@ Signal completion and clean up. You cease to exist after this step. **Self-Cleaning Model:** Once you run `gt done`, you're gone. The command: -1. Syncs beads -2. Nukes your sandbox -3. Exits your session immediately +1. Nukes your sandbox +2. Exits your session immediately **Run gt done:** ```bash -bd sync gt done ``` @@ -271,7 +269,7 @@ gt done You are NOT involved in any of that. You're gone. Done means gone. -**Exit criteria:** Beads synced, sandbox nuked, session exited.""" +**Exit criteria:** Sandbox nuked, session exited.""" [vars] [vars.pr_url] diff --git a/internal/formula/formulas/mol-polecat-work.formula.toml b/internal/formula/formulas/mol-polecat-work.formula.toml index 442e23d6..fd15f86a 100644 --- a/internal/formula/formulas/mol-polecat-work.formula.toml +++ b/internal/formula/formulas/mol-polecat-work.formula.toml @@ -401,12 +401,7 @@ bd show {{issue}} bd update {{issue}} --notes "Implemented: " ``` -**3. Sync beads:** -```bash -bd sync -``` - -**Exit criteria:** Issue updated with completion notes, beads synced.""" +**Exit criteria:** Issue updated with completion notes.""" [[steps]] id = "submit-and-exit" diff --git a/internal/formula/formulas/mol-sync-workspace.formula.toml b/internal/formula/formulas/mol-sync-workspace.formula.toml index b3e81e11..f9810ced 100644 --- a/internal/formula/formulas/mol-sync-workspace.formula.toml +++ b/internal/formula/formulas/mol-sync-workspace.formula.toml @@ -69,7 +69,7 @@ git branch --show-current **2. Check beads state:** ```bash -bd sync --status +bd status ``` **3. Document starting state:** @@ -77,7 +77,7 @@ bd sync --status - Uncommitted changes (staged/unstaged) - Untracked files (list them) - Stash entries -- Beads sync status +- Beads database health This information guides decisions in subsequent steps. @@ -241,36 +241,23 @@ risk merging incorrectly. A resubmitted branch is better than a broken main. [[steps]] id = "sync-beads" -title = "Sync beads state" +title = "Verify beads state" needs = ["sync-git"] description = """ -Sync the beads database with remote. +Verify beads database is healthy. + +With Dolt backend, beads changes are automatically persisted - no manual sync needed. ```bash -bd sync +bd status # Check database health +bd list --status=in_progress # Verify active work is visible ``` -**If conflicts:** -Beads uses JSONL append-only format, so true conflicts are rare. -If they occur: -```bash -bd sync --status # Diagnose -``` +**If issues:** +- Check dolt sql-server is running +- Verify database connectivity -Likely causes: -- Two agents edited same bead simultaneously -- Corrupted beads-sync branch - -Resolution: -```bash -# Try pulling fresh -git fetch origin beads-sync -bd sync -``` - -If still failing, escalate to mayor. - -**Exit criteria:** Beads synced successfully.""" +**Exit criteria:** Beads database healthy and accessible.""" [[steps]] id = "run-doctor" diff --git a/internal/formula/formulas/mol-town-shutdown.formula.toml b/internal/formula/formulas/mol-town-shutdown.formula.toml index 0e76c72a..5d6c7ed5 100644 --- a/internal/formula/formulas/mol-town-shutdown.formula.toml +++ b/internal/formula/formulas/mol-town-shutdown.formula.toml @@ -137,15 +137,17 @@ Old logs are moved to `$GT_ROOT/logs/archive/` with timestamps. [[steps]] id = "sync-state" -title = "Sync beads and push" +title = "Verify beads state" needs = ["rotate-logs"] description = """ -Ensure all beads state is persisted. +Verify beads state is healthy. ```bash -bd sync +bd status ``` +With Dolt backend, beads changes are automatically persisted. + Note: We do NOT force-commit polecat work here. Their sandboxes are preserved with whatever state they had. They'll commit their own work when they resume. diff --git a/internal/templates/messages/nudge.md.tmpl b/internal/templates/messages/nudge.md.tmpl index bdb06843..8d49ff6c 100644 --- a/internal/templates/messages/nudge.md.tmpl +++ b/internal/templates/messages/nudge.md.tmpl @@ -21,7 +21,6 @@ Please either: 2. **If blocked**: File a blocking issue with `bd create --title="Blocked: " --type=task` 3. **If done**: Make sure to run: - `bd close {{ .Issue }}` - - `bd sync` - `gt done` ## Important diff --git a/internal/templates/messages/spawn.md.tmpl b/internal/templates/messages/spawn.md.tmpl index fb4e37e0..4a0ef742 100644 --- a/internal/templates/messages/spawn.md.tmpl +++ b/internal/templates/messages/spawn.md.tmpl @@ -21,7 +21,6 @@ You have been assigned to work on the following issue: 3. Commit changes regularly with clear messages 4. When complete, run: - `bd close {{ .Issue }}` - - `bd sync` - `gt done` ## Need Help? diff --git a/internal/templates/roles/crew.md.tmpl b/internal/templates/roles/crew.md.tmpl index 92d1a426..c15669a2 100644 --- a/internal/templates/roles/crew.md.tmpl +++ b/internal/templates/roles/crew.md.tmpl @@ -11,7 +11,6 @@ to commit." This breaks the Gas Town model. The system is designed for autonomou **When implementation is complete:** - Push your commits: `git push` -- Sync beads: `bd sync` - Either continue with next task OR cycle: `gt handoff` **Do NOT:** @@ -132,7 +131,7 @@ Town ({{ .TownRoot }}) **Key points:** - Mail ALWAYS uses town beads - `gt mail` routes there automatically - Project issues use your clone's beads - `bd` commands use local `.beads/` -- Run `bd sync` to push/pull beads changes via the `beads-sync` branch +- Beads changes are automatically persisted with Dolt - **GitHub URLs**: Use `git remote -v` to verify repo URLs - never assume orgs like `anthropics/` ## Prefix-Based Routing @@ -321,7 +320,6 @@ ONE exception where branches are created. But the rule still applies: - `bd update --status=in_progress` - Claim an issue - `bd show ` - View issue details - `bd close ` - Mark issue complete -- `bd sync` - Sync beads changes ### Communication - `gt mail send -s "Subject" -m "Message"` - Send mail (async, queued) @@ -420,7 +418,6 @@ Before ending your session: ``` [ ] git status (check for uncommitted changes) [ ] git push (push any commits) -[ ] bd sync (sync beads if configured) [ ] Check inbox (any messages needing response?) [ ] gt handoff (cycle to fresh session) # Or with context: gt handoff -s "Brief" -m "Details" diff --git a/internal/templates/roles/mayor.md.tmpl b/internal/templates/roles/mayor.md.tmpl index a6e80e3e..3159ee0a 100644 --- a/internal/templates/roles/mayor.md.tmpl +++ b/internal/templates/roles/mayor.md.tmpl @@ -295,12 +295,12 @@ cross-session continuity when work doesn't fit neatly into a bead. ``` [ ] git status (check what changed) [ ] git add (stage code changes) -[ ] bd sync (commit beads changes) [ ] git commit -m "..." (commit code) -[ ] bd sync (commit any new beads changes) [ ] git push (push to remote) [ ] HANDOFF (if incomplete work): gt mail send mayor/ -s "🤝 HANDOFF: " -m "" ``` +Note: Beads changes are automatically persisted with Dolt. + Town root: {{ .TownRoot }} diff --git a/internal/templates/roles/polecat.md.tmpl b/internal/templates/roles/polecat.md.tmpl index 5beefe84..4765986f 100644 --- a/internal/templates/roles/polecat.md.tmpl +++ b/internal/templates/roles/polecat.md.tmpl @@ -176,7 +176,7 @@ Town ({{ .TownRoot }}) **Key points:** - You're in a project git worktree - your `.beads/` is tracked in the project repo - The rig-level `{{ .RigName }}/.beads/` is **gitignored** (local runtime state) -- Run `bd sync` to push/pull beads changes via the `beads-sync` branch +- Beads changes are automatically persisted with Dolt - **GitHub URLs**: Use `git remote -v` to verify repo URLs - never assume orgs like `anthropics/` ## Prefix-Based Routing diff --git a/templates/polecat-CLAUDE.md b/templates/polecat-CLAUDE.md index 6e94a73e..fbadc675 100644 --- a/templates/polecat-CLAUDE.md +++ b/templates/polecat-CLAUDE.md @@ -156,7 +156,6 @@ gt mail send -s "Subject" -m "Body" bd show # View issue details bd close --reason "..." # Close issue when done bd create --title "..." # File discovered work (don't fix it yourself) -bd sync # Sync beads to remote ``` --- @@ -191,8 +190,7 @@ When your work is done, follow this EXACT checklist - **step 5 is REQUIRED**: - For Go projects: go test ./... && go vet ./... [ ] 2. Stage changes: git add [ ] 3. Commit changes: git commit -m "msg (issue-id)" -[ ] 4. Sync beads: bd sync -[ ] 5. Self-clean: gt done ← MANDATORY FINAL STEP +[ ] 4. Self-clean: gt done ← MANDATORY FINAL STEP ``` **Quality gates are not optional.** Git worktrees may not trigger pre-commit hooks