Commit Graph

112 Commits

Author SHA1 Message Date
Steve Yegge
04dd267492 feat: gt mail send now sends tmux notification to recipients
- Add DisplayMessage/DisplayMessageDefault to tmux package for non-disruptive
  status line notifications
- Change mail send to always notify recipients (not just high priority)
- Use display-message instead of send-keys to avoid disrupting agent input
- Support notifications for mayor, polecat, and refinery sessions

Closes gt-7lt

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:10:10 -08:00
Steve Yegge
915594c44c Add crew rename, pristine commands and status integration
- gt crew rename: Rename crew workspace (kills session, renames dir)
- gt crew pristine: Sync crew workspaces with git pull + bd sync
- gt status: Show crew workers per rig with 👤 indicator

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 19:20:41 -08:00
Steve Yegge
e91a15396b bd sync: 2025-12-18 19:02:39 2025-12-18 19:02:39 -08:00
Steve Yegge
47fc5062e7 beads: normalize dependency metadata 2025-12-18 18:51:28 -08:00
Steve Yegge
1385041e48 feat: mayor respawn loop - session survives restarts 2025-12-18 18:50:24 -08:00
Steve Yegge
dc09b0987e feat: swarm worker spawning, mail routing improvements, beads sync 2025-12-18 18:49:54 -08:00
Steve Yegge
b760a3fe22 bd sync: 2025-12-18 18:44:02 2025-12-18 18:46:46 -08:00
Steve Yegge
21cf8b3b1b bd sync: 2025-12-18 18:32:36 2025-12-18 18:46:46 -08:00
Steve Yegge
87b069bd38 bd sync: 2025-12-18 18:18:39 2025-12-18 18:46:46 -08:00
Steve Yegge
e8c139c598 Add Beads as Universal Data Plane to architecture docs
- Document molecule concept (composable workflow beads)
- Add OS metaphor mapping (daemon=kernel, molecules=templates, etc.)
- Table of bead categories: work, mail, MR, molecules, timed, pinned, resources
- Created beads: gt-aqm (epic), gt-4nn (molecules), gt-caz/8h4/b3p (P2)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 18:12:38 -08:00
Steve Yegge
ed64ab44ff fix: use correct bd mail send syntax 2025-12-18 14:27:23 -08:00
Steve Yegge
cf895aaa11 feat: add gt handoff command for agent lifecycle
Implements the agent-side lifecycle request command (gt-gby):

- Detects agent role via GT_ROLE env, tmux session, or directory
- Pre-flight checks (git clean) before retirement
- Sends handoff mail to self for context preservation
- Sends lifecycle request to manager (daemon/ for Mayor/Witness)
- Sets requesting_cycle state and waits for retirement

Usage:
  gt handoff           # Role-appropriate default
  gt handoff --cycle   # Restart with handoff mail
  gt handoff --restart # Fresh restart
  gt handoff --shutdown # Terminate without restart

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 13:51:04 -08:00
Steve Yegge
1265df70f9 feat: add gt daemon for town-level background service
Implements the town daemon (gt-99m) that handles:
- Periodic heartbeat to poke Mayor and Witnesses
- Lifecycle request processing (cycle, restart, shutdown)
- Session management for agent restarts

Commands:
- gt daemon start: Start daemon in background
- gt daemon stop: Stop running daemon
- gt daemon status: Show daemon status and stats
- gt daemon logs: View daemon log file

The daemon is a "dumb scheduler" - all intelligence remains in agents.
It simply pokes them on schedule and executes lifecycle requests.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 13:06:20 -08:00
Steve Yegge
7f29a048a5 chore: set version to 0.0.1
Starting fresh to avoid the Beads versioning mistake.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 12:47:24 -08:00
Steve Yegge
5b39fa8bbd bd sync: 2025-12-18 12:31:19 2025-12-18 12:31:19 -08:00
Steve Yegge
6208f6659c bd sync: 2025-12-18 11:51:57 2025-12-18 11:51:57 -08:00
Steve Yegge
50f7351bf0 bd sync: 2025-12-18 11:51:20 2025-12-18 11:51:50 -08:00
Steve Yegge
815b62d2a3 docs: unify daemon and agent lifecycle protocol
- ONE daemon for all Gas Town (not per-rig)
- Daemon pokes Mayor and all Witnesses (heartbeat)
- Unified gt handoff command for all agent types
- Lifecycle hierarchy: daemon → mayor/witnesses, witness → polecats/refinery
- Context-aware defaults: polecats shutdown, others cycle

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 11:51:13 -08:00
Steve Yegge
ca67f7e779 docs: add polecat shutdown protocol, update streaming model
- Add "Polecat Shutdown Protocol (Bottom-Up)" section
- Clarify polecats are ephemeral (no idle pool)
- Add gt handoff command documentation
- Deprecate gt wake/sleep (polecats not pooled)
- Emphasize bottom-up lifecycle: polecat requests shutdown, Witness executes

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 11:41:44 -08:00
Steve Yegge
730700c1ef bd sync: 2025-12-18 11:41:01 2025-12-18 11:41:01 -08:00
Steve Yegge
7d6f2dce6d bd sync: 2025-12-18 11:34:10 2025-12-18 11:35:59 -08:00
Steve Yegge
0947d0d04d Add 'gt git-init' command and --git flag for harness setup (gm-otp)
Adds git repository initialization for Gas Town harnesses:

1. New 'gt git-init' command for existing harnesses:
   - Creates comprehensive .gitignore for Gas Town
   - Initializes git repository if not present
   - Optionally creates GitHub repo with --github flag

2. New flags on 'gt install':
   - --git: Initialize git with .gitignore during install
   - --github=owner/repo: Create and push to GitHub repo
   - --private: Make GitHub repo private

The .gitignore properly excludes:
- Polecats and rig clones (recreated with gt spawn/rig add)
- Runtime state files (state.json, *.lock, registry.json)
- OS and editor files

And tracks:
- Role contexts (CLAUDE.md)
- .beads/ configuration and issues
- hop/ directory

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 11:35:59 -08:00
Steve Yegge
437ab24056 feat: add 'polecats' as alias for polecat command
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 11:35:01 -08:00
Steve Yegge
6e29231094 feat: add command aliases for PGT parity (may, sess, ref, sp, cat, stat)
Add Cobra aliases to match PGT abbreviation support:
- mayor → may (gt may at now works)
- session → sess
- refinery → ref
- spawn → sp
- polecat → cat
- status → stat

This enables the same abbreviated commands that worked in PGT, like
"gt may at" to attach to the Mayor session.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 00:31:35 -08:00
Steve Yegge
0703835ce9 Fix gt mayor attach to mirror Python behavior
- Auto-start Mayor session if not running (matches town mayor attach)
- Send `gt prime` after Claude starts to initialize context
- Use `exec claude` so /exit closes tmux session (no shell to return to)
- Add "may" alias for mayor command

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 22:46:16 -08:00
Steve Yegge
a5a03bb9ca feat: gt mayor at auto-starts and restarts Claude if needed
- Auto-start Mayor session if not running (no need for gt mayor start first)
- Restart Claude if it has exited (detects shell in pane)
- Prime with gt prime after start/restart
- Refactor: extract startMayorSession helper

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 20:37:12 -08:00
Steve Yegge
c4b942b7e9 fix: gt crew at restarts Claude if it has exited
- Check pane_current_command to detect if Claude is still running
- If shell is detected (bash, zsh, etc.), Claude exited - restart it
- Re-prime after restart with gt prime

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 20:10:05 -08:00
Steve Yegge
3b1ce3afe1 refactor: Mayor's per-rig clone is canonical for beads and worktrees
- Mayor has <rig>/mayor/rig/ clone (decentralized, discoverable)
- Rig .beads/ symlinks to mayor/rig/.beads (Mayor is beads authority)
- Polecats are worktrees from Mayor's clone (not Refinery)
- Updated architecture.md with new structure

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 20:00:28 -08:00
Steve Yegge
691971a16a feat: crew attach auto-detection, worktree polecats, beads mail
- gt crew at: auto-detect crew from cwd, run gt prime after launch
- Polecats now use git worktrees from refinery (faster than clones)
- Updated architecture.md for two-tier beads mail model
- Town beads (gm-*) for Mayor mail/coordination
- Rig .beads/ symlinks to refinery/rig/.beads

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 19:51:36 -08:00
Steve Yegge
cb04302e7b Revert "fix: use 'bd message' instead of 'bd mail' for agent messaging"
This reverts commit 56d30e1896.
2025-12-17 19:45:47 -08:00
Steve Yegge
56d30e1896 fix: use 'bd message' instead of 'bd mail' for agent messaging
The beads command for messaging is 'bd message', not 'bd mail'.
Fixed 4 locations:
- mailbox.go: inbox, read, ack commands
- router.go: send command (also fixed arg order to match bd API)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 19:42:46 -08:00
Steve Yegge
41609e8def feat: add gt rig add command with container-based structure
- Implement AddRig with container-based approach (rig root is NOT a clone)
- Create internal/cmd/rig.go with add/list/remove subcommands
- Clone repo into refinery/rig/, mayor/rig/, crew/main/
- Initialize rig-level .beads/ with derived prefix
- Update docs/architecture.md to match implementation
- File gt-jpt epic for town-level beads redesign

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 19:14:37 -08:00
Steve Yegge
d38cd3d03d feat: add gt install command for harness creation
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>
2025-12-17 17:20:17 -08:00
Steve Yegge
3f3c7f82b2 fix: improve workspace detection for nested rig structures
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>
2025-12-17 17:03:01 -08:00
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
74febe77df chore(beads): sync issue gt-f9x.4 closed 2025-12-17 15:48:37 -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
7aea3c5f65 chore: sync beads issues 2025-12-17 15:03:39 -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
fe8187dae7 Merge polecat/Morsov: MR state transitions 2025-12-17 14:55:42 -08:00
Steve Yegge
33c645c1f3 Merge polecat/Slit: MR ID generation 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
1e422eb6bd chore: close gt-u1j.17 polecat CLI commands 2025-12-17 14:52:45 -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
f011e9bc80 feat(beads): add MR field parsing for merge-request issues
Implement ParseMRFields and SetMRFields helper functions to extract
and update structured fields in merge-request issue descriptions.

Fields supported: branch, target, source_issue, worker, rig,
merge_commit, close_reason.

Features:
- Case-insensitive key matching
- Alternate key formats (snake_case, kebab-case)
- Preserves non-MR prose content
- Handles mixed MR fields and prose
- Round-trip safe (parse then format preserves data)

Closes: gt-h5n.1

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 14:50:34 -08:00