Route to the correct beads location based on whether the source repo
has .beads/ tracked in git:
- If source has .beads/ tracked: route to mayor/rig/.beads
- Otherwise: route to rig root .beads/ (created by initBeads)
Updates both route registration in rig.go and polecat manager's
NewManager/setupSharedBeads to use consistent conditional logic.
When adding a rig from a source repo that has .beads/ tracked in git,
detect and use the project's existing prefix instead of generating a
new one. This prevents prefix mismatch errors when accessing existing
issues via bd commands.
Adds detectBeadsPrefixFromConfig() which reads the prefix from either
config.yaml or by parsing the first issue ID from issues.jsonl.
Add --exit flag to `gt done` that terminates the Claude session
immediately after submitting the MR to the merge queue. This prevents
polecats from sitting idle (and wasting money) while waiting for the
Witness to kill them.
Changes:
- Rename existing --exit flag to --status (for exit type)
- Add new --exit boolean flag for session self-termination
- Update docs and help text to reflect new flag names
Usage: gt done --exit
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Updated `gt costs record` to create session.ended events in beads
- Updated `gt costs --today/--week` queries to use bd instead of JSONL
- Removed JSONL ledger support (getLedgerPath, readLedger, WriteLedgerEntry)
- Session costs now stored with event_kind, actor, target, and payload fields
- Filed bd-xwvo for beads bug where --rig flag loses event fields
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changed command signature from `gt crew start [name...]` to
`gt crew start <rig> [name]` with --all flag support:
- Takes rig as first required positional argument
- Optional crew member name(s) as subsequent arguments
- --all flag to start all crew members in the rig
- Validates that either name or --all must be provided
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds a new doctor check that verifies all settings.json files in the
town use session-start.sh wrapper for SessionStart and PreCompact hooks.
Without this wrapper, session_id passthrough fails, which breaks
gt seance discovery of sessions.
The check:
- Scans all settings.json files across town, rigs, crew, and polecats
- Warns if any file uses bare 'gt prime' without session-start.sh
- Provides fix hint pointing to the correct wrapper configuration
(gt-77fhi)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add new `gt rig stop <rig>...` command that supports stopping multiple rigs
with the same shutdown semantics as `gt rig shutdown`:
- Stops all polecat sessions
- Stops the refinery (if running)
- Stops the witness (if running)
- Checks for uncommitted work before shutdown (unless --nuclear)
Includes --force flag for immediate shutdown and --nuclear flag to bypass
safety checks. (gt-lhitf)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add new 'gt rig start <rig>...' command that starts witness and refinery
on patrol for one or more rigs. Similar to 'gt rig boot' but supports
multiple rigs in a single invocation.
- Iterates over all provided rig names
- Skips already-running agents with clear output
- Reports success/failure per-rig with summary
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Shows detailed status for a specific rig including all workers:
- Rig info (name, path, beads prefix)
- Witness status (running/stopped, uptime)
- Refinery status (running/stopped, uptime, queue size)
- Polecats (name, state, assigned issue, session status)
- Crew members (name, branch, session status, git status)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The status line was counting rigs based on tmux session names without
validating they were actually registered in mayor/rigs.json. This could
cause incorrect rig counts when session names matched the pattern but
were not real rigs.
Now loads registered rigs from rigs.json and only counts:
- Rigs that are actually registered
- Polecats belonging to registered rigs
Fixes#17🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add repo-fingerprint check to gt doctor that verifies beads databases have
valid repository fingerprints. Missing or empty fingerprints can cause daemon
startup failures and sync issues.
The check:
- Uses bd doctor --json to check fingerprint status
- Runs on town-level and rig-level beads directories
- Can fix by running bd migrate --update-repo-id
- Restarts daemon after migration if it was running
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add validation in Manager.AddRig() to reject rig names containing
characters that break agent ID parsing. Agent IDs use format
<prefix>-<rig>-<role>[-<name>] with hyphens as delimiters, so
hyphenated rig names like op-baby cause parsing failures.
The validation rejects hyphens, dots, and spaces, and suggests a
sanitized alternative in the error message.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add a new doctor check that verifies the bd (beads) daemon is running
and healthy. When the daemon fails to start, the check:
- Surfaces specific error messages (legacy database, repo mismatch)
- Provides one-liner fix commands
- Auto-fixes by running bd migrate --update-repo-id when appropriate
This addresses GH #25: gt status slow when bd daemon not running.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Change polecat contract from wait-for-termination to ephemeral
- Rename close-issue → prepare-for-review (Refinery closes after merge)
- Rename signal-complete → submit-and-exit (polecat recyclable after gt done)
- Bump formula version to 4
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add bd daemon health check at the start of gt status:
- Check daemon health via bd daemon health --json
- Attempt restart if daemons are unhealthy (version mismatch, stale, unresponsive)
- Show warning at end of status output if daemons could not be started
- Non-blocking: status display continues regardless of daemon state
This prevents the 39+ second slowdown when bd daemons are not running
properly, as each bd command falls back to slow direct mode.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements cost tracking v1 for Gas Town agents:
- `gt costs` shows live costs scraped from running tmux sessions
- `gt costs --today/--week` shows historical costs from ledger
- `gt costs --by-role/--by-rig` shows cost breakdowns
- `gt costs record` for Stop hook integration to record final costs
Cost ledger stored at ~/.gt/costs.jsonl with JSONL entries per session.
Ref: gt-nrpiq
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Town beads should use 'hq-' prefix to match documented architecture:
- Town beads (~/gt/.beads/): hq-* prefix for mayor mail, coordination
- Rig beads: project-specific prefix
The 'gm' prefix was causing convoy creation failures due to prefix
mismatch.
Fixes#19🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add internal/deps package for dependency management
- Check for bd before gt install and gt rig add
- Auto-install bd via go install if missing
- Version check warns if bd is too old (min: 0.43.0)
Closes#22🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Change tmux from "optional" to "recommended for the full experience"
- Add "Enter the Mayor's office" step after gt rig add
- Explain Mayor role upfront in Core Concepts
- Reorder workflows to put Full Stack (Recommended) first
- Add example of conversational interaction with Mayor
- Document gt agents for session navigation
Closes#21🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add GetAllRoleTemplates tests (basic and content validity)
- Add FixMultipleRigs test for multi-rig fix scenario
- Add DetailsFormat test verifying rig:template prefix format
- Add MalformedRigsJSON test for error handling
- Add EmptyRigsConfig test for edge case
- PatrolRolesHavePromptsCheck now verifies templates exist in each rig's
mayor clone at <rig>/mayor/rig/internal/templates/roles/
- Track missing templates by rig using missingByRig map
- Fix copies embedded templates to each rig's location
- Add GetAllRoleTemplates helper to templates package
- Add tests for no-rigs case and multiple-rigs scenarios
When the Refinery Engineer detects a merge conflict during rebase,
it now creates a dispatchable task bead for conflict resolution.
Task format:
- Title: Resolve merge conflicts: <original-issue-title>
- Type: task
- Priority: boosted from original (P2 -> P1, P1 -> P0)
- Description includes: original MR ID, branch, conflict SHA,
source issue, retry count, and step-by-step instructions
The task appears in bd ready and can be dispatched to available
polecats by the Witness. After resolution and force-push, the
Refinery will automatically retry the merge.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- CHANGELOG.md: Initial release notes for v0.1.0
- .golangci.yml: Linter configuration adapted from beads
- RELEASING.md: Release process documentation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
initAgentBeads and crew_add were looking for beads at mayor/rig/.beads/
but during initial creation, beads is at rig root. The redirect
mechanism to mayor/rig/.beads/ gets set up later.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement ScoreMR function for merge queue priority ordering with:
- Convoy age factor (prevents starvation of old convoys)
- Priority factor (P0 beats P4)
- Retry penalty (prevents thrashing on conflict-prone MRs)
- MR age tiebreaker (FIFO within same priority)
Added fields to MR struct:
- RetryCount for conflict retry tracking
- ConvoyID and ConvoyCreatedAt for convoy linkage
Includes comprehensive unit tests and documentation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
buildAgentIdentity was returning 2-part format (rig/name) while
sling.go sets assignee using 3-part format (rig/polecats/name) from
session.AgentIdentity.Address(). This mismatch caused gt hook to
fail when querying for hooked beads by assignee.
Changes:
- buildAgentIdentity: Return rig/polecats/name for polecats
- buildAgentBeadID: Handle both 2-part and 3-part formats
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update mol-refinery-patrol formula v4:
- Rename process-branch to "Mechanical rebase"
- Add robust conflict detection via exit codes
- Create conflict-resolution task on rebase failure
- Track conflict metadata (main SHA, branch SHA)
- Update loop-check with conflict-skip entry path
- Update generate-summary with conflict tracking
On conflicts: abort rebase, create task, preserve branch for resolution.
MR beads remain open until conflicts resolved and reprocessed.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use conditional bindings (if-shell) to check if session name starts
with "gt-" before running Gas Town commands. For non-GT sessions:
- C-b n/p fall back to default next-window/previous-window
- C-b a shows a help message
This prevents Gas Town from hijacking keybindings in unrelated tmux
sessions that happen to share the same tmux server.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The TUI query used 'dependency_type' but the actual column is 'type'.
This caused expand to show nothing when pressing Enter on a convoy.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements announce channel delivery in router.go:
- Add isAnnounceAddress() and parseAnnounceName() helpers
- Add ErrUnknownAnnounce error variable
- Add expandAnnounce() to load AnnounceConfig from messaging.json
- Add sendToAnnounce() for bulletin board delivery (single copy, no claiming)
- Add pruneAnnounce() for retention-based message cleanup
- Integrate announce routing in Send()
Announce channels store ONE copy of each message (unlike lists which fan-out).
Messages persist until retention limit is reached, with oldest messages
pruned automatically when limit is exceeded.
Also includes address helpers (gt-pn2fq dependency).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add announces subcommand to internal/cmd/mail.go that provides:
- gt mail announces: Lists all announce channels from messaging.json
- gt mail announces <channel>: Reads messages from a specific channel
The command queries beads for messages with announce_channel label and
displays them in reverse chronological order. Messages are NOT marked
as read or removed, preserving bulletin board semantics.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Show ✓ for closed, ▶ for in_progress/hooked, ○ for other statuses
- Display assignee name in brackets instead of issue type
- Falls back to issue type when no assignee, or "unassigned" when neither
Closes gt-cbstf
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add announce address detection to internal/mail/router.go following
the same pattern as isListAddress/parseListName and isQueueAddress/
parseQueueName.
Added:
- isAnnounceAddress(address string) bool - returns true for 'announce:' prefix
- parseAnnounceName(address string) string - extracts channel name
- ErrUnknownAnnounce error variable
(gt-pn2fq)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
New outputSessionMetadata() function prints a structured line at prime start:
[GAS TOWN] role:mayor pid:12345 session:abc-uuid-123
This enables gt seance to discover sessions from Claude transcripts,
complementing the existing event emission to .events.jsonl.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>