When slinging work from town beads (hq-*) to a polecat whose agent bead
is in rig beads (gt-*), the hook_bead update was silently failing because
bd couldn't find the cross-beads reference.
Changes:
- sling.go: Use town root for routing instead of cwd, enabling cross-beads
resolution via routes.jsonl. Log warnings on failure instead of silent ignore.
- done.go: Use townRoot (already available) instead of cwd for beads client.
Log warnings on failure for both state and cleanup status updates.
Root cause: The beads client was created from current working directory,
which may not have access to routes.jsonl for cross-prefix resolution.
Town root always has routes.jsonl for proper prefix → rig directory mapping.
(gt-ohqxq)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add heartbeat checking to Boot degraded triage: detects stale Deacon
heartbeat (>15min nudges, >30min restarts)
- Add checkDeaconHeartbeat to daemon heartbeat cycle as fallback
- This ensures the Deacon is monitored continuously, not just at startup
The mol-deacon-patrol formula was also updated separately to use
gt deacon health-check instead of ephemeral context memory tracking.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The refinery was checking git branches instead of the beads merge queue.
This caused MRs to pile up when branches were deleted but MR beads remained.
- manager.go: Queue() now queries beads for type=merge-request issues
- refinery.md.tmpl: Updated queue-scan to use gt mq list
- mol-refinery-patrol.formula.toml: Updated queue-scan step instructions
- Add docs/hanoi-demo.md with full execution instructions
- Add scripts/gen_hanoi.py for generating larger formulas
- Include pre-generated 7-disk formula (127 moves)
- 9 and 10 disk formulas already committed
Speed test results: 127 issues close in 14 sec (~109ms each)
Expected 1K run time: ~2 minutes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- towers-of-hanoi-9: 511 moves (2^9 - 1)
- towers-of-hanoi-10: 1023 moves (2^10 - 1)
These are fully pre-computed move sequences for durability testing.
The 10-disk version creates 1026 beads issues when poured.
For million-step (20 disks), would need 163MB formula file.
Starting with 1K steps to prove the machinery works.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add title field to all steps (required by cook)
- Use hardcoded 3-disk solution (9 steps) as working proof
- Remove pseudo-syntax generate block (not implemented)
- Version bump to 2
Tested: bd cook --dry-run passes, mol pour creates valid molecule,
execution loop works (all 9 steps can be closed in sequence).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add comprehensive execution protocol to formula description:
- EXECUTION LOOP: find ready step, close it, repeat
- ON RESUME: same as fresh start, molecule IS the state
- DO/DO NOT guidelines for autonomous execution
- MONITORING guidance for mega-molecules
This enables agents to execute Hanoi autonomously through restarts,
proving nondeterministic idempotence at scale.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Major redesign based on design review:
1. REMOVED: Claude Code internal parsing (ZFC violation)
- Deleted internal/claude/sessions.go (parsed ~/.claude/projects/)
- This coupled us to Claude Code's undocumented internal format
2. ADDED: Event-based session discovery
- gt prime now emits session_start events to ~/gt/.events.jsonl
- Events include role, session_id, topic, cwd
- Discovery reads our own event stream (ZFC-compliant)
3. ADDED: --talk flag for actual seances
- gt seance --talk <session-id> spawns: claude --fork-session --resume <id>
- --fork-session creates a new session (read-only, no grave disturbance)
- You literally talk to your predecessor: "Where did you put X?"
4. ADDED: One-shot prompt mode
- gt seance --talk <id> -p "Where is the config?"
- Uses claude --print for quick questions
The name "seance" is now literal - you commune with the dead (past sessions).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add Step 3a to survey-workers that automatically nukes idle polecats
with clean git state. Only escalates to Mayor when uncommitted or
unpushed work is detected.
This reduces mail noise - idle polecats without work are pure overhead
and can be safely cleaned up without human intervention.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changed table entry from 'Skip (no action needed)' to 'Auto-nuke if clean (Step 3a)'.
TODO: Add Step 3a section with full auto-nuke logic:
- Check git status for uncommitted changes
- Check for unpushed commits
- If clean: gt polecat nuke <name>
- If dirty: escalate to Mayor for recovery decision
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The runSlingFormula function was calling bd wisp which does not exist.
The correct command is bd mol wisp for creating ephemeral molecules.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Parses Claude Code ~/.claude/projects/ to find Gas Town sessions.
Sessions are identified by the [GAS TOWN] beacon in startup messages.
Features:
- Filter by role (crew, polecat, witness, etc.)
- Filter by rig name
- Show recent N sessions
- JSON output for scripting
- Sorts by most recent first
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
getTrackedIssues was spawning a separate bd show subprocess for each
tracked issue. With 10 convoys x 5 issues = 50+ subprocesses per poll.
Solution: Use bd show batch capability (bd show id1 id2 id3 --json)
to fetch all issue details in a single call. Falls back to individual
lookups if the batch fails (e.g., invalid IDs).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds context timeouts to bd and sqlite3 calls in the convoy panel TUI.
If these commands hang, the TUI will no longer freeze - it will timeout
after 5 seconds and return empty/error state.
Functions updated:
- listConvoys: bd list with context timeout
- getTrackedIssueStatus: sqlite3 query with context timeout
- getIssueStatus: bd show with context timeout
(gt-14xej)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Instead of hardcoding the rig list (gastown, beads), now loads rigs
from mayor/rigs.json using config.LoadRigsConfig. Falls back gracefully
to just checking global agents if the config cannot be loaded.
(gt-mmp0q)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds a third panel to the feed TUI showing:
- In-progress convoys with progress bars (completed/total)
- Recently landed convoys (last 24h) with time since landing
Features:
- Panel cycles with tab: tree -> convoy -> feed
- Direct access via 1/2/3 number keys
- Auto-refresh every 10 seconds
- Styled progress indicators (●●○○)
The convoy panel bridges the gap between "WHO is working" (agent tree)
and "WHAT is happening" (event feed) by showing "WHAT IS SHIPPING".
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add RuntimeConfig type to RigSettings allowing per-rig LLM runtime
configuration. This moves hardcoded "claude --dangerously-skip-permissions"
invocations to configurable settings.
Changes:
- Add RuntimeConfig type with Command, Args, InitialPrompt fields
- Add BuildCommand() and BuildCommandWithPrompt() methods
- Add helper functions: LoadRuntimeConfig, BuildAgentStartupCommand,
BuildPolecatStartupCommand, BuildCrewStartupCommand
- Update startup paths in up.go and mayor.go to use new config
- Add comprehensive tests for RuntimeConfig functionality
Remaining hardcoded invocations can be updated incrementally.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The getCleanupStatus function in witness/handlers.go and crew removal
in cmd/crew_lifecycle.go were constructing agent bead IDs with hardcoded
"gt-" prefix. This failed for rigs that use a different prefix like "bd-".
Now uses beads.GetPrefixForRig to look up the correct prefix from
routes.jsonl, enabling support for the beads rig and any future rigs
with custom prefixes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The command now refuses to nuke a polecat unless it passes safety checks:
1. Worktree has no unpushed/uncommitted changes
2. Polecat has no open merge request beads
3. Polecat has no work on its hook
Use --force to bypass these checks (loses work).
Use --dry-run to see safety check status before nuking.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Creates internal/session/startup.go with StartupNudgeConfig struct
and StartupNudge function. Format becomes session title in /resume picker:
[GAS TOWN] recipient <- sender • timestamp • topic[:mol-id]
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
SendKeys has an Enter-concatenation bug that causes the nudge to fail.
NudgeSession is the canonical way to message Claude and works reliably.
Fixes cold starts of crew workers (gt crew start).
(gt-7swyi)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add NudgeChannels field to MessagingConfig struct in types.go
- Initialize NudgeChannels map in NewMessagingConfig()
- Add validation in validateMessagingConfig(): channel names must be
non-empty and each channel must have at least one recipient
- Add tests for valid nudge channels and empty recipient validation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds explicit priming commands at the start of workspace assessment:
- gt prime: Load gt/mol context
- bd prime: Load beads context
Critical for fresh sessions, post-compaction, or context clear scenarios.
Also updates exit criteria to reflect priming requirement.
(gt-0xhuz)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements queue message delivery in internal/mail/router.go:
- Validates queue exists via expandQueue()
- Creates single message (no fan-out unlike lists)
- Stores in town-level beads with queue metadata label
- Uses queue:name as assignee for inbox filtering
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds actual git merge functionality to ProcessMR and ProcessMRFromQueue:
- Fetch source branch from origin
- Checkout target branch and pull latest
- Check for merge conflicts using test merge
- Run configured tests with retry support
- Perform --no-ff merge with descriptive message
- Push to origin
- Return detailed ProcessResult with success/conflict/test status
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When adding a dog, creates an agent bead with role_type:dog label.
When removing a dog, deletes the corresponding agent bead.
This enables @dogs group resolution in the mail router by allowing
queries like `bd list --type=agent --label=role_type:dog`.
Changes:
- Add DogBeadID(), DogRoleBeadID() helper functions
- Add CreateDogAgentBead() for creating dog agent beads with labels
- Add FindDogAgentBead() and DeleteDogAgentBead() for cleanup
- Add Labels field to Issue struct for label parsing
- Update ParseAgentBeadID() to handle dog bead IDs (gt-dog-<name>)
- Update IsAgentSessionBead() to include "dog" as valid role
(gt-qha0g)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
After confirming remote branch exists via ls-remote, fetch to ensure
the local origin/branch ref exists before using it in rev-list comparison.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When Mayor creates a convoy, automatically default --notify to 'mayor/'
since the Mayor dispatched the work and should be notified when it lands.
This reduces flag boilerplate for the common case.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The `bd slot` command is for agent beads only. Convoy beads aren't agents,
so the slot set failed with exit status 1. The notify address is already
stored in the convoy's description, which is the intended persistence
mechanism.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
gt nudge now accepts role shortcuts that expand to session names:
- mayor → gt-mayor
- witness → gt-<rig>-witness (uses current rig)
- refinery → gt-<rig>-refinery (uses current rig)
This makes it easier to nudge common targets without needing to
remember the full session naming conventions.
(gt-w1te9)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add queue expansion to internal/mail/router.go following the expandList() pattern:
- Add ErrUnknownQueue error for unknown queue names
- Add expandQueue() method to look up QueueConfig from messaging.json
- Add TestExpandQueue and TestExpandQueueNoTownRoot tests
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add State (idle/processing/blocked) and Health (healthy/stale/empty) fields to MQSummary
- Display state indicator (● for processing, ○ for idle/blocked)
- Show [stale] warning when queue has >10 pending items with no processing
- Include new fields in JSON output for automation
(gt-hpcyt)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Set Spawned=true when DispatchToDog creates a new dog, allowing
callers to distinguish between reusing an existing dog vs spawning.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add bidirectional cross-references between MR beads and agent beads:
1. MRFields.AgentBead - tracks which agent created the MR
2. AgentFields.ActiveMR - tracks agent's current MR
In gt done:
- Include agent_bead in MR description when creating
- Update agent bead with active_mr pointing to the new MR
In refinery merge handling:
- Clear agent bead's active_mr after successful merge
Benefits:
- Given MR, find which polecat created it
- Given polecat, find their active MR
- Orphan detection: MR without agent = stale
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update placeholder comments in engineer.go to clarify that:
- ProcessMR and ProcessMRFromQueue are not used in production
- Refinery agent uses git commands per role prompt
- Removes references to tombstoned gt-3x1.2 and gt-3x1.4 issues
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add configurable build_command and test_command variables to the
mol-sync-workspace formula. Previously hardcoded to Go commands,
now supports any project type via variable configuration.
- Add build_command variable (default: go build ./...)
- Add test_command variable (default: go test ./...)
- Update verify-build step to use {{ build_command }}
- Update run-tests step to use {{ test_command }}
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add verifyCommitOnMain() check in HandleMerged to ensure the polecat's
commit is actually on main before allowing cleanup. This prevents work
loss when:
- MERGED signal is for a stale MR
- Merge attempt failed after signal was sent
- MR was already merged via different path
The verification uses git merge-base --is-ancestor to confirm the
polecat's HEAD is reachable from main.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Agent bead ID validation was hardcoded to only accept "gt-" prefix, which
caused errors when spawning beads polecats (which use "bd-" prefix):
Error: invalid agent ID: agent ID must start with 'gt-' (got "bd-beads-polecat-pearl")
Changed ParseAgentBeadID to accept any 2-3 character prefix (gt-, bd-, hq-)
instead of hardcoding "gt-". Updated tests to cover other prefixes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The --json flag was only registered on the status subcommand, not the
parent hook command. When running `gt hook --json` (no args), it would
fail with "unknown flag". Now the flag is registered on both.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>