Commit Graph

24 Commits

Author SHA1 Message Date
Steve Yegge
f04cc6fe15 feat: add template system for role contexts and messages
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>
2025-12-17 16:59:40 -08:00
Steve Yegge
f7b0c11157 Merge polecat/Toast: doctor framework (gt-f9x.4)
Adds health check framework with Check interface, Doctor runner,
and gt doctor CLI command.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2025-12-17 16:14:26 -08:00
Steve Yegge
135fb9323b feat: add gt mail check command and update prime for GGT cutover
- 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>
2025-12-17 16:13:06 -08:00
Steve Yegge
b6f2281f13 feat: add gt mayor restart command
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>
2025-12-17 15:50:18 -08:00
Steve Yegge
d0f3ad9140 feat(doctor): add health check framework (gt-f9x.4)
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>
2025-12-17 15:48:13 -08:00
Steve Yegge
17593844ce feat: add gt mayor commands for Mayor session management
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>
2025-12-17 15:36:56 -08:00
Steve Yegge
542bc32b00 fix(polecat): code review fixes
- 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>
2025-12-17 14:59:04 -08:00
Steve Yegge
fb4c71692a Merge polecat/Rictus: polecat CLI commands 2025-12-17 14:55:42 -08:00
Steve Yegge
ce7ca52e98 feat(refinery): implement MR state transition validation (gt-h5n.3)
- 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>
2025-12-17 14:54:52 -08:00
Steve Yegge
2af8e6d190 feat: add polecat CLI commands (list, add, remove, wake, sleep)
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>
2025-12-17 14:52:26 -08:00
Steve Yegge
e1c041f3b0 fix: spawn and swarm bug fixes from MVP testing
- 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>
2025-12-16 22:07:13 -08:00
Steve Yegge
59921d52c8 feat: refactor mail system to use bd mail backend
- 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>
2025-12-16 21:45:42 -08:00
Steve Yegge
b56977218b feat: add gt crew commands (list, attach, remove, refresh, status)
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>
2025-12-16 20:57:26 -08:00
Steve Yegge
887c0f19d1 feat: add gt crew add command for user-managed workspaces
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>
2025-12-16 20:46:52 -08:00
Steve Yegge
f8c177e17b feat: add witness swarm landing protocol
- 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>
2025-12-16 14:22:52 -08:00
Steve Yegge
e984a55fe5 feat: add mail system and CLI commands
- 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>
2025-12-16 14:19:15 -08:00
Steve Yegge
d3d929105e feat: add refinery package and CLI commands
- 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>
2025-12-16 14:16:36 -08:00
Steve Yegge
b26e9aa308 feat: add CLI spawn command for polecat work assignment
- gt spawn <rig/polecat> --issue <id>: Assign issue and start session
- gt spawn <rig> --issue <id>: Auto-select idle polecat
- gt spawn -m task: Free-form task assignment
- --create: Create polecat if does not exist
- --no-start: Assign without starting session
- Fetches issue details from beads for rich context
- Auto-selects idle polecats when polecat not specified

Closes gt-u1j.19

Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 14:14:02 -08:00
Steve Yegge
d92c67629e feat: add CLI swarm commands (create, start, status, list, land, cancel)
- 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>
2025-12-16 14:11:57 -08:00
Steve Yegge
f7a0b4045c feat: add gt stop --all emergency shutdown command
- 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>
2025-12-16 13:58:03 -08:00
Steve Yegge
29e4436891 fix: code review fixes from gt-2tp and gt-y0t
- Replace custom contains() with strings.Contains in init.go
- Make session stop --force flag actually work
- Update session.Manager.Stop() to accept force parameter

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:56:32 -08:00
Steve Yegge
eef28f3ee5 feat: add CLI session commands (start, stop, at, list, capture, inject)
- start: Create tmux session and launch claude for polecat
- stop: Graceful shutdown with optional --force
- at: Attach to running session
- list: Show all active sessions with --json support
- capture: Get recent terminal output
- inject: Send message to session via tmux send-keys

Closes gt-u1j.11

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:51:37 -08:00
Steve Yegge
a5023c633b feat: add CLI core commands (status, prime, init)
- status: Show town status with rig/polecat/witness counts (--json supported)
- prime: Output role context based on current directory
- init: Initialize a git repo as a Gas Town rig

Closes gt-u1j.10

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:49:48 -08:00
Steve Yegge
7217b34a90 feat: add Cobra CLI scaffolding with Lipgloss styles
- cmd/gt/main.go: Entry point using Cobra
- internal/cmd/root.go: Root command with description
- internal/cmd/version.go: Version command with build info
- internal/style/style.go: Lipgloss styles for terminal output

Closes gt-u1j.1

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:19:27 -08:00