Implements @group address resolution for mail routing:
- @rig/<rigname>: All agents in a rig
- @town: All town-level agents (mayor, deacon)
- @witnesses, @dogs, @refineries: Role-based groups
- @crew/<rig>, @polecats/<rig>: Role+rig scoped groups
- @overseer: Human operator (uses overseer.json)
Resolution uses `bd list --type=agent` queries with
description filtering. Fan-out at send time creates
individual messages for each resolved recipient.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements dog management commands:
- gt dog add <name>: Create dog in kennel with multi-rig worktrees
- gt dog remove <name>: Retire dog, cleanup worktrees
- gt dog list: Show the pack with status
- gt dog call [name]: Wake idle dog(s)
- gt dog status [name]: Show detailed dog state
Dogs are reusable workers managed by the Deacon for infrastructure tasks.
Each dog gets worktrees into all configured rigs (gastown, beads, etc.).
Includes internal/dog package with Manager and state handling (from gt-0x5og.2).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add protocol message parsing and handlers for polecat→witness communication:
- POLECAT_DONE: Parse completion messages, create cleanup wisps
- HELP: Parse help requests, assess if Witness can help or escalate to Mayor
- MERGED: Parse refinery merge confirmations
- LIFECYCLE:Shutdown: Handle daemon-triggered shutdowns
- SWARM_START: Parse batch work initialization
Files added:
- internal/witness/protocol.go: Message classification and parsing
- internal/witness/handlers.go: Handler implementations with wisp/mail integration
- internal/witness/protocol_test.go: Unit tests for all parsing functions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add events.LogFeed calls to the following gt commands:
- nudge.go: Log TypeNudge events when nudging agents
- unsling.go: Log TypeUnhook events when removing work from hooks
- up.go: Log TypeBoot events when starting Gas Town services
- down.go: Log TypeHalt events when stopping Gas Town services
- stop.go: Log TypeKill events when stopping polecat sessions
- polecat_spawn.go: Log TypeSpawn events when spawning polecats
Also add helper functions to events package:
- UnhookPayload: Creates payload for unhook events
- KillPayload: Creates payload for kill events
- HaltPayload: Creates payload for halt events
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add comprehensive documentation for the gt swarm feature:
- New docs/swarm.md with full guide to swarm lifecycle, commands, and workflows
- Update reference.md with swarm CLI commands in "Swarm Management" section
- Add architecture note explaining swarm coordination model
The swarm package was fully implemented but undocumented.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Create five formulas for dog-executed infrastructure tasks:
- mol-convoy-cleanup: Archive convoy, notify overseer
- mol-dep-propagate: Cross-rig dependency resolution
- mol-digest-generate: Daily digest for overseer
- mol-orphan-scan: Find and reassign orphaned work
- mol-session-gc: Clean stale sessions
Each formula follows the standard TOML structure with:
- Description and dog contract
- Step-by-step workflow with dependencies
- Variable definitions
- Squash configuration for digests
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Dogs are reusable workers managed by the Deacon for cross-rig infrastructure
tasks. Unlike polecats (single-rig, ephemeral), dogs have worktrees into
multiple rigs and persist between tasks.
Key components:
- internal/dog/types.go: Dog struct, State enum, DogState JSON schema
- internal/dog/manager.go: Manager with Add/Remove/List/Get/Refresh operations
- internal/dog/manager_test.go: Unit tests
Features:
- Multi-rig worktrees: Each dog gets a worktree per configured rig
- State tracking: .dog.json with idle/working state, last-active, work assignment
- Worktree refresh: Recreate stale worktrees with fresh branches
- Branch cleanup: Remove orphaned dog branches across all rigs
Directory structure: ~/gt/deacon/dogs/<name>/
- <rig>/ (worktree into each rig: gastown/, beads/, etc.)
- .dog.json (state file)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements structured escalation channel for Gas Town:
- gt escalate command with CRITICAL/HIGH/MEDIUM severity levels
- Mayor startup check for pending escalations
- Escalation beads with tag for audit trail
- Mail routing to overseer with priority mapping
- Documentation in docs/escalation.md
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds comprehensive design for how wisps squash to digests:
- Cadences: patrol wisps squash per-cycle, work wisps on completion
- Templates: structured formats for patrol and work digests, formula-defined
- Retention: 30d active, 1yr archive, weekly/monthly rollups
- Activity feed integration for observability
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement static mailing list expansion for the mail system:
- Add list:name address syntax (e.g., list:oncall)
- Load lists from ~/gt/config/messaging.json
- Fan-out delivery: each list member gets their own message copy
- Clear error handling for unknown list names
- Add tests for list detection, parsing, and expansion
- Update gt mail send help text with list:name documentation
- Show recipients in output when sending to a list
Example:
gt mail send list:oncall -s "Alert" -m "System down"
# Expands to: mayor/, gastown/witness
# Creates 2 message copies
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements role-based lifecycle configuration where agent types self-register
via role beads instead of hardcoded identity string parsing in the daemon.
Changes:
- Add RoleConfig struct with lifecycle fields (session_pattern, work_dir_pattern,
needs_pre_sync, start_command, env_vars)
- Add ParseRoleConfig/FormatRoleConfig/ExpandRolePattern to beads package
- Add role bead ID helpers (RoleBeadID, MayorRoleBeadID, etc.)
- Refactor daemon to use single parseIdentity function as ONLY place where
identity strings are parsed
- Daemon now looks up role beads to get lifecycle config, with fallback to
defaults when role bead is missing or has no config
- Updated all role beads (mayor, deacon, witness, refinery, crew, polecat)
with structured lifecycle configuration fields
- Add comprehensive unit tests for RoleConfig parsing and expansion
This makes the daemon ZFC-compliant by trusting what agents self-report in
their role beads rather than encoding agent-specific knowledge in Go code.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove decision-making logic from Go code and document agent responsibility:
- ProcessMR() now returns error indicating agent handles processing
- Foreground mode deprecated with message directing to background mode
- Retry() no longer calls ProcessMR (agent picks up retried MRs)
- Added ZFC compliance section to refinery role template
- Marked unused helper functions as deprecated (runTests, getMergeConfig, pushWithRetry)
The Refinery agent (Claude) now:
- Runs git commands directly (fetch, checkout, merge, push)
- Detects conflicts and decides: retry, notify polecat, escalate
- Runs tests and decides: proceed, rollback, retry
- Makes all engineering decisions based on command output
Go code provides only primitives: queue listing, status, mail notifications.
(gt-sxa64)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements the feed daemon goroutine that:
- Tails ~/gt/.events.jsonl for raw events
- Filters by visibility tag (keeps feed/both, drops audit)
- Deduplicates repeated done events from same actor
- Aggregates sling events when multiple occur in window
- Writes curated events to ~/gt/.feed.jsonl with summaries
The curator runs as a goroutine in the gt daemon, starting when
the daemon starts and stopping gracefully on shutdown.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove Stats fields from witness and refinery types that tracked
observable metrics (total counts, today counts). These are now
handled by the activity stream/beads system instead.
Removed:
- WitnessStats type and Stats field from Witness
- RefineryStats type and Stats field from Refinery
- LastCheckAt field from Witness
- Stats display from gt witness status
- Stats display from gt refinery status
- Stats increment code from refinery.completeMR()
Kept minimal process state:
- RigName, State, PID, StartedAt (both)
- MonitoredPolecats, Config, SpawnedIssues (witness)
- CurrentMR, PendingMRs, LastMergeAt (refinery)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Shows merge queue status under the Refinery section:
- pending: Open MRs ready to merge (no blockers)
- in-flight: MRs currently being processed
- blocked: MRs waiting on dependencies
Output appears as: MQ: 4 pending, 1 in-flight
Also adds MQ summary to JSON output in RigStatus.mq field.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add support for displaying gt events (from ~/gt/.events.jsonl) in the
gt feed TUI, including witness patrol activity:
- Add event symbols for patrol events (patrol_started, patrol_complete,
polecat_checked, polecat_nudged, escalation_sent), merge events, and
general gt events (sling, hook, handoff, mail, spawn, etc.)
- Create GtEventsSource that parses .events.jsonl format with proper
extraction of rig/role from actor paths and human-readable message
generation from event payloads
- Create CombinedSource that merges multiple event sources (bd activity
and gt events) using fan-in pattern
- Update feed command to use combined source for TUI mode
- Add appropriate styling for new event types (nudges/escalations in
red, patrol complete in green, etc.)
Example gt feed output now shows:
09:45 ✓ witness: All polecats healthy
09:44 ⚡ witness: nudged nux (idle 10m)
09:40 🎯 mayor: slung gt-rbncw to furiosa
(gt-rbncw)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add MQ event types and logging in mrqueue/events.go
- Have refinery emit merge_started, merged, merge_failed, merge_skipped events
- Create MQEventSource to read from mq_events.jsonl
- Add MultiSource to combine events from bd activity and MQ events
- Add color coding: green for merged, red for failed
- Update feed help with MQ event symbols
Events are stored in .beads/mq_events.jsonl and displayed in the feed TUI
with appropriate symbols and colors.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When spawning polecats in non-gastown rigs like beads, the agent bead ID
was incorrectly using the hardcoded "gt-" prefix instead of the rig's
configured prefix (e.g., "bd-" for beads).
Changes:
- Add GetPrefixForRig() in routes.go to look up prefix from routes.jsonl
- Update agentIDToBeadID() in sling.go to use rig's prefix via the new
*WithPrefix functions instead of hardcoded "gt"
- Add unit tests for the new functionality
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The mrqueue package was aspirational 'beads-based MR automation' that was
never completed. The Refinery agent is prompt-driven and uses beads/mail
for coordination, not a Go-based polling queue.
Removed:
- internal/mrqueue/mrqueue.go (entire package)
- internal/cmd/mq_migrate.go (migration command for mrqueue)
- mrqueue submission from done.go and mq_submit.go
- Engineer.ProcessMRFromQueue() and related queue handlers
- Engineer.Run(), Stop(), processOnce() methods
- mrQueue field and stopCh from Engineer struct
- stopCh assertion from TestNewEngineer
Kept:
- Bead creation for merge-requests (audit record)
- Engineer struct and NewEngineer for potential future use
- Engineer.ProcessMR() (works with beads.Issue)
- Manager.ProcessMR() which is the working implementation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Several files were setting cmd.Stderr = nil, which hides potentially
critical error messages:
- prime.go: bd prime, gt mail check, and bd show commands now log
stderr on failure for debugging
- orphans.go: git fsck now includes stderr in error messages
- patrol_helpers.go: bd list/show/catalog commands now log stderr
Daemon launch cases (up.go, daemon.go, daemon_check.go) correctly
use nil for I/O detachment but now have clarifying comments.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added three new patrol steps for convoy orchestration:
- check-convoy-completion: Watch for tracked issue closures, auto-close convoys
- resolve-external-deps: Propagate cross-rig dependency resolution
- fire-notifications: Notify Overseer/Witnesses of convoy and dep events
Updated health-scan to depend on fire-notifications (runs after convoy steps).
(gt-wthcc)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The witness template previously instructed using raw git commands:
- git worktree remove polecats/<name>
- git branch -d polecat/<name>
This failed because git worktree operations must run from the repo
that created the worktree (mayor/rig or .repo.git), not the rig root.
Now uses `gt polecat nuke` which handles repo base detection via
the repoBase() function and properly cleans up worktrees.
Fixes gt-gp6i
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added multiple layers of protection against circular redirects:
1. ResolveBeadsDir now detects when a redirect points back to itself
and auto-removes the errant redirect file with a warning
2. ensureBeadsRedirect now includes safety checks:
- Prevents creating redirects inside mayor/rig/ (the canonical location)
- Validates that the redirect target is not the same as the beads dir
3. Added test case for circular redirect detection
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>