Implements gt-f9x.3: Create Gas Town workspace structure.
The install command creates a new harness (workspace) with:
- config/town.json - Town configuration with name and version
- config/rigs.json - Empty rigs registry
- mayor/ - Mayor agent home with:
- CLAUDE.md - Mayor role context from template
- config.json - Distinguishes town-level mayor
- mail/inbox.jsonl - Empty inbox
- state.json - Initial state
- .beads/redirect - Placeholder for default beads location
Usage:
gt install ~/gt # Create at path
gt install . --name mytown # Current dir with name
gt install ~/gt --no-beads # Skip beads setup
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fixes gt-e5o: When a rig has its own mayor/ directory, workspace
detection now continues searching upward for primary markers.
Changes:
- Add AlternativePrimaryMarker (mayor/config.json) to distinguish
town-level mayor from rig-level mayor clones
- Continue searching after finding secondary marker (mayor/) to
prefer primary matches higher in the tree
- Return the first secondary match only if no primary is found
This fixes role detection for polecats/refinery/witness when running
from within a rig that has its own mayor/ clone.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements gt-u1j.20: Prompt templates using go:embed.
- Add internal/templates package with embedded .md.tmpl files
- Role templates: mayor, witness, refinery, polecat, crew
- Message templates: spawn, nudge, escalation, handoff
- Update gt prime to use templates with fallback to hardcoded output
- Add crew role detection for <rig>/crew/<name>/ paths
- Include Gas Town architecture overview in all role contexts
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds health check framework with Check interface, Doctor runner,
and gt doctor CLI command.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
- Add 'gt mail check' with --inject flag for Claude Code hooks
- Update Mayor prime output to include mail commands and startup info
- Enables full cutover from PGT 'town' commands to GGT 'gt' commands
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Complete the mayor command set for GGT cutover.
Now have: start, stop, attach, status, restart.
Skipped wake-queue as it's part of the pooling model
being deprecated in favor of ephemeral polecats (gt-7ik).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add doctor package with:
- Check interface for implementing health checks
- CheckContext for passing context to checks
- CheckResult and CheckStatus types
- Report with summary and pretty printing
- Doctor runner with Run() and Fix() methods
- BaseCheck and FixableCheck for easy check implementation
- CLI command: gt doctor [--fix] [--verbose] [--rig <name>]
Built-in checks will be added in:
- gt-f9x.5: Town-level checks (config, state, mail, rigs)
- gt-f9x.6: Rig-level checks (refinery, clones, gitignore)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add four new commands for managing the Mayor tmux session:
- gt mayor start - Start the Mayor session
- gt mayor attach - Attach to running session
- gt mayor stop - Stop the session
- gt mayor status - Check if session is running
This allows full replacement of PGT's town mayor commands.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use errors.Is() instead of direct error comparison
- Add warning output when listing polecats fails for a rig
- Remove extra blank line
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update MRStatus to use beads-style statuses (open, in_progress, closed)
- Add CloseReason enum for tracking why MRs were closed
- Implement ValidateTransition() to enforce valid state transitions:
- open → in_progress (Engineer claims MR)
- in_progress → closed (merge success or rejection)
- in_progress → open (failure, reassign to worker)
- open → closed (manual rejection)
- closed → anything is blocked (immutable once closed)
- Add convenience methods: Claim(), Close(), Reopen(), SetStatus()
- Add status check methods: IsClosed(), IsOpen(), IsInProgress()
- Update ProcessMR and completeMR to use new state transition methods
- Update display code to handle new status values
- Add comprehensive tests for state transitions
Reference: docs/merge-queue-design.md#state-machine
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements gt polecat subcommands for managing polecats in rigs:
- list: Show polecats with state, issue, and session status
- add: Create new polecat with clone and work branch
- remove: Delete polecat (checks for running session, uncommitted changes)
- wake: Transition idle → active
- sleep: Transition active → idle (checks for running session)
Resolves: gt-u1j.17
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement GenerateMRID(prefix, branch) to generate merge request IDs
following the convention: <prefix>-mr-<hash>
- Hash derived from branch name + timestamp + random bytes for uniqueness
- Example output: gt-mr-abc123
- Includes deterministic variant for testing (GenerateMRIDWithTime)
Closes: gt-h5n.2
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Gas Town is for grownups. Polecats now start Claude with full
permissions to enable autonomous operation without prompts.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The previous implementation passed Enter as an argument to send-keys,
but this doesn't work reliably with long pasted text or Claude Code's
paste detection. Now uses -l flag for literal text and sends Enter
as a separate command.
Fixes gt-1su.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
New issues filed during GGT testing:
- gt-1su: Spawn inject Enter not submitted (P1 bug)
- gt-0pl: Polecat auto-approve config needed (P1 task)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- spawn.go: Parse bd show --json as array, fix issue_type json tag
- session/manager.go: Check filesystem directly in hasPolecat()
to handle newly-created polecats
- swarm/manager.go: Use bd show to get children via dependents field
instead of non-existent bd list --parent flag
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Mail commands (send/inbox/read/delete) now wrap bd mail CLI
- Address translation: mayor/ → mayor, rig/polecat → rig-polecat
- Beads stores messages as type=message issues
- Legacy JSONL mode retained for crew workers (local mail)
- Refinery notifications use new mail interface
- Swarm landing notifications use new mail interface
Closes gt-u1j.6, gt-u1j.12
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- Close gt-r01: Beads mail now available (bd mail commands)
- Close gt-u1j.14: Merge queue already implemented
- Update gt-u1j.6: Refactor to wrap bd mail
- Update gt-u1j.12: CLI commands to wrap bd mail
- Add gt-u1j.6/12 as dependencies for gt-b1g
- Demote gt-u1j.9 to P1 (not a cutover blocker)
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
Add remaining crew subcommands for user-managed workspaces:
- gt crew list: List crew workspaces with session/git status
- gt crew at/attach: Start or attach to tmux session
- gt crew remove: Remove workspace with safety checks
- gt crew refresh: Context cycling with mail-to-self handoff
- gt crew status: Show detailed workspace status with mail info
All commands support --rig flag for explicit rig selection and
--json output where appropriate.
Closes: gt-cik.9
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements gt-cik.2: Create crew workspace command with:
- internal/crew/types.go: CrewWorker type definition
- internal/crew/manager.go: Manager for crew lifecycle
- internal/crew/manager_test.go: Unit tests
- internal/cmd/crew.go: CLI command with --rig and --branch flags
Crew workers are user-managed persistent workspaces that:
- Clone repo into <rig>/crew/<name>/
- Create optional feature branch (crew/<name>)
- Set up mail directory for delivery
- Initialize CLAUDE.md with crew worker prompting
- Are NOT registered with witness (user-managed)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create prompts/roles/crew.md template for crew workers
- Document crew worker role as overseer's personal workspace
- Include mail-to-self handoff instructions for context cycling
- Document gt crew refresh command usage
- Explain no witness monitoring (user-managed lifecycle)
- Include conditional beads usage when BEADS_DIR configured
- Update docs/prompts.md with crew role documentation
Closes: gt-cik.8
Generated with Claude Code
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add crew/ directory support to rig structure for user-managed
persistent workspaces. Crew workers are separate from polecats
(AI-managed) and can have optional custom BEADS_DIR configuration.
- Add internal/crew package with Worker type and Manager
- Update rig types to include Crew slice and CrewCount in summary
- Update rig manager to scan for crew workers
- Add crew/ to AgentDirs for rig initialization
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace stub "Future: Federation" with comprehensive section
- Add Outpost interface and Worker interface definitions
- Document Cloud Run workers with persistent connections
- Document SSH/VM outposts for long-running work
- Add configuration example (outposts.yaml)
- Add architecture diagram showing outpost hierarchy
- Add Key Design Decision #14: Outpost Abstraction
Also reopened gt-u1j.6 and gt-u1j.12 (mail tasks) since beads
mail support (bd-kwro) is not yet complete.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Comprehensive analysis of Gas Town federation via "Outposts" abstraction:
- LocalOutpost: current tmux model
- SSHOutpost: full Gas Town clone on VM
- CloudRunOutpost: elastic container workers
Key insights:
- Persistent HTTP/2 connections solve Cloud Run cold start
- ~$0.017 per 5-min worker session vs $50-200/mo VM
- Git remains source of truth for code and beads
- Local-first, remote for overflow/burst
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Key Decision #11 renamed from "Beads as Swarm State" to "Work is a Stream
(No Swarm IDs)". Work flows through the system as a continuous stream:
- The epic IS the grouping (no separate swarm ID)
- The merge queue IS the coordination (no batch boundaries)
- Workers process issues independently (add/remove anytime)
- Dependencies provide sequencing (multi-wave emerges naturally)
Updated sections:
- Introduction: Added key insight about stream model
- Work Dispatch: Renamed from "Swarm Dispatch", updated diagram
- Multi-Wave Work Processing: Renamed from "Multi-Wave Swarms"
- Key Decision #11: Full rewrite explaining stream model
- Various terminology updates throughout
This aligns with the vision that Gas Town manages work as a stream,
not as discrete batches requiring explicit start/end boundaries.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Crew workspaces are the overseer's (human's personal workspaces within
a rig. Unlike polecats which are witness-managed and ephemeral, crew
workers are:
- Persistent (not auto-garbage-collected)
- User-managed (overseer controls lifecycle)
- Long-lived identities (dave, emma, fred)
- Gas Town integrated (mail, handoff mechanics)
- Tmux optional
See gt-cik for implementation epic.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
EOF
)
- notifyWorkerConflict: Mail worker with rebase instructions on conflict
- notifyWorkerMerged: Mail worker on successful merge
- findTownRoot: Walk up to find workspace for mail routing
- High priority notification for conflicts
- Integrates with mail system for agent communication
This completes the semantic merge handling for MVP - conflicts
are intelligently handled by notifying workers rather than
silently failing.
Closes gt-kmn.4
Generated with Claude Code
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- ExecuteLanding: Full landing protocol for swarms
- Phase 1: Stop all polecat sessions
- Phase 2: Git audit (uncommitted/unpushed detection)
- Phase 3: Branch cleanup
- Phase 4: Mail notification to Mayor
- Code at risk detection with escalation
- Beads-only changes considered safe
- Updated gt swarm land to use full protocol
Closes gt-kmn.6
Generated with Claude Code
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- internal/mail: Message types with priority support
- internal/mail: Mailbox JSONL operations (list, get, append, delete)
- internal/mail: Router for address resolution and delivery
- gt mail send: Send messages to agents
- gt mail inbox: List messages (--unread, --json)
- gt mail read: Read and mark messages as read
- Address formats: mayor/, rig/, rig/polecat, rig/refinery
- High priority messages trigger tmux notification
- Auto-detect sender from GT_RIG/GT_POLECAT env vars
Closes gt-u1j.6, gt-u1j.12
Generated with Claude Code
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- internal/refinery: Types for Refinery, MergeRequest, queue items
- internal/refinery: Manager with start/stop/status/queue operations
- gt refinery start: Start refinery for a rig (--foreground option)
- gt refinery stop: Stop running refinery
- gt refinery status: Show refinery state and statistics
- gt refinery queue: Show pending merge requests
- Auto-discover polecat work branches as queue items
- JSON output support for status and queue commands
Closes gt-rm3
Generated with Claude Code
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- gt swarm create: Create swarm from beads epic with workers
- gt swarm start: Activate a created swarm
- gt swarm status: Show detailed swarm info with task progress
- gt swarm list: List swarms with filtering by rig/status
- gt swarm land: Manually trigger landing to target branch
- gt swarm cancel: Cancel an active swarm
- SwarmStore: JSON-based persistence for swarm state
- Support for --json output on status and list commands
Closes gt-kmn.7
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- CreateIntegrationBranch: create from BaseCommit, push to origin
- MergeToIntegration: merge worker branch with conflict detection
- LandToMain: merge integration to target branch
- CleanupBranches: remove all swarm branches after landing
- Helper functions for branch naming conventions
Closes gt-kmn.3
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create/Start/Cancel swarm lifecycle methods
- State transition validation (Created->Active->Merging->Landed)
- Task assignment and state tracking
- GetReadyTasks/GetActiveTasks queries
- IsComplete check for swarm completion
- Integration with beads CLI for task loading
Closes gt-kmn.2
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- gt stop --all: Kill all sessions across all rigs
- gt stop --rig <name>: Kill sessions in specific rig
- gt stop --graceful: Try graceful shutdown before force kill
- Captures session output before stopping
- Reports success/failure summary
Closes gt-u1j.22
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>