Commit Graph

19 Commits

Author SHA1 Message Date
Steve Yegge
8e96e12e37 Remove stats from .runtime/*.json observable state (gt-lfi2d)
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>
2025-12-30 02:05:54 -08:00
Steve Yegge
5e9ca4c618 Standardize warning output to use style.PrintWarning (gt-g6kor)
- Add PrintWarning helper in internal/style/style.go
- Update 35 warning message outputs across 16 files to use consistent format
- All warnings now display as "⚠ Warning: <message>" in yellow/bold

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 16:38:04 -08:00
Steve Yegge
5b719b2f60 Make gt witness attach infer rig from cwd when no arg provided
Align witness attach command with crew at and refinery attach by using
MaximumNArgs(1) instead of ExactArgs(1) and inferring the rig from the
current working directory when no argument is provided.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 00:52:41 -08:00
Steve Yegge
34b5a3bb8d Document intentional error suppressions with comments (gt-zn9m)
All 156 instances of _ = error suppression in non-test code now have
explanatory comments documenting why the error is intentionally ignored.

Categories of intentional suppressions:
- non-fatal: session works without these - tmux environment setup
- non-fatal: theming failure does not affect operation - visual styling
- best-effort cleanup - defer cleanup on failure paths
- best-effort notification - mail/notifications that should not block
- best-effort interrupt - graceful shutdown attempts
- crypto/rand.Read only fails on broken system - random ID generation
- output errors non-actionable - fmt.Fprint to io.Writer

This addresses the silent failure and debugging concerns raised in the
issue by making the intentionality explicit in the code.

Generated with Claude Code https://claude.com/claude-code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 23:14:29 -08:00
Steve Yegge
9afd6c5572 feat: Set BD_ACTOR env var when spawning agents (gt-rhfji)
When gt spawns agents (polecats, crew, patrol roles), it now sets the
BD_ACTOR env var so that bd commands (like `bd hook`) know the agent
identity without coupling to gt.

Updated spawn points:
- gt up (mayor, deacon, witness via ensureSession/ensureWitness)
- gt deacon start
- gt witness start
- gt start refinery
- gt mayor start
- Daemon deacon restart
- Daemon lifecycle restart
- Handoff respawn
- Refinery manager start

BD_ACTOR uses slash format (e.g., gastown/witness, gastown/crew/max)
while GT_ROLE may use dash format internally.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 13:26:38 -08:00
Steve Yegge
f86a73c2f0 feat: Add gcloud-style command grouping to gt help output
Organize 43 commands into 7 logical groups using cobra's built-in
AddGroup/GroupID feature:

- Work Management: spawn, sling, hook, handoff, done, mol, mq, etc.
- Agent Management: mayor, witness, refinery, deacon, polecat, etc.
- Communication: mail, nudge, broadcast, peek
- Services: daemon, start, stop, up, down, shutdown
- Workspace: rig, crew, init, install, git-init, namepool
- Configuration: account, theme, hooks, issue, completion
- Diagnostics: status, doctor, prime, version, help

Also renamed molecule to mol as the primary command name
(molecule is now an alias).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 02:32:01 -08:00
Steve Yegge
c483602231 refactor: remove Go patrol logic from witness manager (gt-kh6q)
Patrol logic is now handled by mol-witness-patrol molecule executed by Claude.
Removed ~985 lines of Go code:
- run(), checkAndProcess(), healthCheck()
- handleStuckPolecat(), getNudgeCount(), recordNudge(), clearNudgeCount()
- processShutdownRequests(), verifyPolecatState()
- autoSpawnForReadyWork(), getActivePolecatCount(), isAlreadySpawned(), spawnPolecat()
- Plus all helper functions

Kept: NewManager(), stateFile(), loadState(), saveState(), Status(), Start(), Stop()

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 23:44:54 -08:00
Steve Yegge
5e093dadff Fix witness session to start in witness directory
The witness session was starting in the rig root (e.g., /gt/gastown)
instead of the witness directory (e.g., /gt/gastown/witness/rig).
This caused gt prime to detect the Mayor role instead of Witness role.

Now ensureWitnessSession uses the same pattern as ensureRefinerySession:
1. Try <rig>/witness/rig/ first (for rigs with worktree setup)
2. Fall back to <rig>/witness/ (for simpler setups)
3. Last resort: use rig root (shouldn't happen normally)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 16:07:23 -08:00
Steve Yegge
5f2e16f789 refactor: remove shell respawn loops from witness and deacon (gt-zxgu)
Shell loops bypassed the proper lifecycle architecture. Now:

- Witness: Launches Claude directly, daemon/deacon health-scan handles restart
- Deacon: Launches Claude directly, daemon detects exit and restarts
- Daemon: ensureDeaconRunning() now checks if Claude is running (pane cmd)
         and restarts it if session exists but Claude has exited
- gt deacon restart: Now does stop+start instead of Ctrl-C

This enforces proper lifecycle flow through LIFECYCLE mail and daemon
heartbeat rather than bypassing it with shell loops.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 04:02:17 -08:00
Steve Yegge
46a5e38fa2 feat: add restart subcommands to witness and refinery (gt-9kc2)
- Add `gt witness restart <rig>` command (stop + start)
- Add `gt refinery restart [rig]` command (stop + start)
- Add self-cycling documentation to refinery template
- Clarify that restarts are daemon-managed, not shell loops

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 03:56:31 -08:00
Steve Yegge
3d3227fe4d Fix witness tmux session naming to match gt-<rig>-<role> pattern 2025-12-22 20:11:05 -08:00
Steve Yegge
59d656470e Add Claude settings templates for autonomous roles (gt-6957)
- Create internal/claude package with embedded settings templates
- settings-autonomous.json: gt prime && gt mail check --inject (SessionStart)
- settings-interactive.json: gt prime only (SessionStart)

- Update witness.go: EnsureSettings before session, remove broken gt prime injection
- Update refinery/manager.go: EnsureSettings before session, remove broken NudgeSession
- Update session/manager.go: EnsureSettings for polecats, remove broken issue injection

All autonomous roles (polecat, witness, refinery) now get proper SessionStart hooks
automatically when their sessions are created. No more timing-based gt prime injection.
2025-12-22 17:51:15 -08:00
Steve Yegge
887e2f25e4 refactor(cmd): extract common manager creation boilerplate
Add getRig() helper in rig_helpers.go that encapsulates the common
boilerplate for finding town root, loading rigs config, and retrieving
a rig. This reduces duplication across 5 get*Manager functions:
- getPolecatManager
- getSessionManager
- getCrewManager
- getRefineryManager
- getWitnessManager

Closes gt-7sqi.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 21:46:10 -08:00
Steve Yegge
0dab88e8bf feat(icons): centralize agent icons and add to all displays
- Mayor: 🎩 (top hat)
- Deacon: 🦉 (owl)
- Witness: 👁 (eye)
- Refinery: 🏭 (factory)
- Crew: 🧑‍💻 (technologist)
- Polecat: 😺 (happy cat)

Icons now show in:
- tmux status lines for all agent types
- gt status rig indicators
- gt witness status output
- gt agents popup menu
2025-12-21 16:10:20 -08:00
Steve Yegge
6cfab58e86 feat(witness): Implement Witness MVP for automated polecat lifecycle
Implements the core Witness functionality:

- gt witness start: Creates tmux session with Claude, theming, auto-priming
- gt witness stop: Kills tmux session and updates state
- gt witness status: Shows session state reconciled with tmux
- Shutdown handler: Verifies git clean state before cleanup, sends nudges
- Auto-spawn: Spawns polecats for ready work up to configurable capacity
- Health checks: Monitors polecat activity, nudges stuck workers, escalates

Also updates handoff to include polecat name in lifecycle requests.

Closes: gt-53w6, gt-mxyj, gt-5wtw, gt-cpm2, gt-es1i

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 16:52:02 -08:00
Steve Yegge
bc8a33a028 feat(witness): Implement Witness as Claude agent (gt-xicq)
Convert the Witness from a Go polling loop to a Claude agent with:

- Enhanced witness.md.tmpl with detailed agent instructions:
  - Startup protocol for checking handoffs and polecat status
  - Lifecycle request processing (verify git state, cleanup)
  - Health check protocol for detecting stuck polecats
  - Nudge protocol with 3-strike escalation
  - Escalation protocol for unresolvable issues
  - Session cycling with handoff mail

- Updated gt witness attach to:
  - Create sessions in <rig>/witness/ directory for proper role detection
  - Ensure witness directory exists

- Added startup directive for Witness role in gt prime

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 23:24:51 -08:00
Steve Yegge
4d0492fdf6 feat(tmux): add per-rig color themes and dynamic status line (gt-vc1n)
Add tmux status bar theming for Gas Town sessions:

- Per-rig color themes auto-assigned via consistent hashing
- 10 curated dark themes (ocean, forest, rust, plum, etc.)
- Special gold/dark theme for Mayor
- Dynamic status line showing current issue and mail count
- Mayor status shows polecat/rig counts

New commands:
- gt theme --list: show available themes
- gt theme apply: apply to running sessions
- gt issue set/clear: agents update their current issue
- gt status-line: internal command for tmux refresh

Status bar format:
- Left: [rig/worker] role
- Right: <issue> | <mail> | HH:MM

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 14:17:39 -08:00
Steve Yegge
557d0c6745 feat(gt): Complete command parity for GGT
Add missing gt commands to match PGT functionality:
- gt session restart: Restart polecat session (stop + start)
- gt session status: Show detailed session status with uptime
- gt rig shutdown: Gracefully stop all agents in a rig
- gt mail reply: Convenience command for replying to messages
- gt witness attach: Attach to witness tmux session

Closes: gt-hw6, gt-99m, gt-6db, gt-e76, gt-hzr, gt-sqi

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:43:28 -08:00
Steve Yegge
9bf2e91dea feat(witness): add gt witness start/stop/status commands
Add the witness monitoring agent command with start, stop, and status
subcommands. The witness monitors polecats for stuck/idle states and
can nudge blocked workers.

Closes gt-kcee

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

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