Commit Graph

102 Commits

Author SHA1 Message Date
Steve Yegge
71d313ed60 Fix mail read auto-ack and add Mayor startup directive
- Remove auto-ack on mail read so handoff messages persist
- Add STARTUP PROTOCOL directive for Mayor and Polecat roles
- Agents now get explicit instructions to check in on startup

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 22:38:10 -08:00
Steve Yegge
900a440ce8 feat(namepool): Add themed name pools for polecats
Polecats now get themed names from the Mad Max universe by default
(furiosa, nux, slit, etc.) instead of generic polecat-01, polecat-02.

Changes:
- Add NamepoolConfig to config/types.go for per-rig theme configuration
- Update namepool.go with three built-in themes:
  - mad-max (default): furiosa, nux, imperator, etc.
  - minerals: obsidian, quartz, ruby, etc.
  - wasteland: rust, chrome, fury, etc.
- Add gt namepool commands: themes, set, add, reset
- Update manager.go to load namepool config from rig settings

Configuration in .gastown/config.json:
```json
{
  "namepool": {
    "style": "minerals",
    "max_before_numbering": 50
  }
}
```

Issue: beads-rs0

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 21:59:03 -08:00
Steve Yegge
c7e83b1619 Add persistent theme config and fix crew session theming
- Fix crew sessions missing theme application (ConfigureGasTownSession)
- Add theme persistence to .gastown/config.json
- gt theme <name> now saves to config
- gt theme apply reads from config, falls back to hash-based default
- Improve rig detection using GT_RIG env var and path parsing
- gt theme shows whether theme is configured or default

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 20:43:34 -08:00
Steve Yegge
ac16446f83 Remove duplicate DeleteRemoteBranch method
Duplicate introduced during rebase.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 19:15:13 -08:00
Steve Yegge
caef0e04b2 Unify gt prime to call bd prime and mail check
gt prime now internally runs:
- bd prime (beads workflow context)
- gt mail check --inject (mail injection)

This allows a single SessionStart hook to provide complete agent context.
Also added PreCompact and UserPromptSubmit hooks to settings.json.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 19:13:19 -08:00
Steve Yegge
6f0d838939 Merge remote-tracking branch 'origin/main' 2025-12-19 18:28:38 -08:00
Steve Yegge
6e0f1a96d1 Merge remote-tracking branch 'origin/polecat/Nux' 2025-12-19 18:28:02 -08:00
Steve Yegge
23cf29df9c Merge remote-tracking branch 'origin/polecat/Slit'
# Conflicts:
#	internal/daemon/lifecycle_test.go
#	internal/refinery/engineer.go
2025-12-19 18:27:12 -08:00
Steve Yegge
3dca0eb4c9 Add mol-bootstrap molecule for Gas Town installation
Defines a multi-step workflow for bootstrapping a new Gas Town installation:
- locate-harness: Interactive harness location selection
- create-harness: Directory structure creation
- setup-rigs: Rig configuration and cloning
- build-gt: Go binary compilation
- install-paths: PATH configuration
- init-beads: Beads database initialization
- sync-beads: Remote sync and doctor fixes
- verify: Installation verification

Note: Requires bd to support 'molecule' issue type (see gt-qn4l)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 18:26:24 -08:00
Steve Yegge
4cecebd91e Merge remote-tracking branch 'origin/polecat/Ace-deacon' 2025-12-19 18:10:17 -08:00
Steve Yegge
f54162eae3 bd sync: 2025-12-19 18:09:46 2025-12-19 18:09:46 -08:00
Steve Yegge
9ac76f9b3f feat: add Deacon role context template
Creates deacon.md.tmpl for the health-check orchestrator role:
- Architecture position (between daemon and Mayor/Witnesses)
- Wake cycle instructions (heartbeat, mail check, health scan)
- Session patterns for all agent types
- Lifecycle request handling (cycle, restart, shutdown)
- Responsibilities and escalation protocols

Updates templates package to include deacon in role list.

Closes: gt-5af.1

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 18:09:35 -08:00
Steve Yegge
b69520b911 bd sync: 2025-12-19 18:00:52 2025-12-19 18:00:52 -08:00
Steve Yegge
89520a5854 Merge remote-tracking branch 'origin/polecat/Scabrous'
# Conflicts:
#	docs/architecture.md
#	docs/harness.md
#	internal/beads/builtin_molecules.go
#	internal/cmd/mail.go
#	internal/cmd/molecule.go
#	internal/cmd/mq.go
#	internal/git/git.go
#	internal/mail/router.go
2025-12-19 17:59:36 -08:00
Steve Yegge
316b134553 bd sync: 2025-12-19 17:53:01 2025-12-19 17:53:01 -08:00
Steve Yegge
d0ac62230b bd sync: 2025-12-19 17:49:22 2025-12-19 17:49:22 -08:00
Steve Yegge
a8df0ac93b bd sync: 2025-12-19 17:42:46 2025-12-19 17:42:46 -08:00
Steve Yegge
3a5f542cc9 Merge remote-tracking branch 'origin/polecat/Doof' 2025-12-19 17:42:05 -08:00
Steve Yegge
869d6fbffb bd sync: 2025-12-19 17:35:51 2025-12-19 17:35:51 -08:00
Steve Yegge
50accc9cb2 feat(mail): add deacon/ identity support
Add deacon/ as a town-level mail identity alongside mayor/.
Both addressToIdentity() and identityToAddress() now handle
deacon/deacon/ consistently with trailing slash preservation.

Tested with bd mail send deacon/ and bd mail inbox --identity deacon/

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 17:26:54 -08:00
Steve Yegge
33455e6d9c feat(deacon): add heartbeat mechanism for daemon coordination (gt-5af.6)
Add deacon package with heartbeat read/write helpers:
- Heartbeat struct with Timestamp, Cycle, LastAction, health counts
- WriteHeartbeat/ReadHeartbeat for persistence to deacon/heartbeat.json
- IsFresh/IsStale/IsVeryStale for age checks
- ShouldPoke to determine if daemon should wake the Deacon
- Touch/TouchWithAction convenience functions

The Deacon writes heartbeat on each wake cycle. The Go daemon reads it
to decide whether to poke the Deacon (only if very stale >5 minutes).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 17:26:53 -08:00
Steve Yegge
178bebee40 refactor: update lifecycle mail targets from daemon/ to deacon/ (gt-5af.5)
Update all code and documentation to use deacon/ instead of daemon/
for lifecycle mail targets:

- internal/cmd/handoff.go: getManager() returns deacon/ for Mayor/Witness
- internal/daemon/lifecycle.go: ProcessLifecycleRequests uses deacon/ inbox
- docs/architecture.md: update all references in lifecycle docs
- scripts/mayor-respawn-daemon.sh: use BD_IDENTITY=deacon for mail commands

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 17:26:16 -08:00
Steve Yegge
5102cee9ad feat(cmd): add gt deacon start/stop/status commands (gt-5af.2)
Add CLI commands for managing the Deacon session, following the same
pattern as the Mayor commands:
- gt deacon start: Start the Deacon tmux session
- gt deacon stop: Stop the session with graceful shutdown
- gt deacon status: Check if session is running
- gt deacon attach: Attach to session (auto-starts if needed)
- gt deacon restart: Restart Claude within the session

The Deacon is the hierarchical health-check orchestrator that monitors
Mayor and Witnesses, handles lifecycle requests, and keeps Gas Town running.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 17:25:24 -08:00
Steve Yegge
88c6279906 Improve crew resume prompt with gt prime reminder
Add explicit "Run gt prime" to the crew resume prompt and mention
checking in-progress issues for better context recovery.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 17:22:52 -08:00
Steve Yegge
d8f01171c8 feat(deacon): design and beads for Deacon health orchestrator
- Update gt-5af with full Deacon design (AI agent, not just Go daemon)
- Create 8 implementation tasks as children of gt-5af
- Add AGENTS.md for agent onboarding
- Fix crew restart timing (add debounce, delay for Claude init)
- Add SendKeysDelayedDebounced to tmux for better prompt injection

Deacon will monitor Mayor/Witnesses proactively and handle lifecycle
requests from Mayor/Witnesses/Crew reactively.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 17:19:28 -08:00
Steve Yegge
b3b99e55ef bd sync: 2025-12-19 16:58:10 2025-12-19 16:58:10 -08:00
Steve Yegge
0716c4d48a test(daemon): add unit tests for daemon package (gt-99a)
Add comprehensive unit tests for:
- Config and state serialization (DefaultConfig, LoadState, SaveState)
- Session name pattern matching (isWitnessSession)
- Lifecycle request parsing (parseLifecycleRequest)
- Identity to session mapping (identityToSession)

Tests document a bug where parseLifecycleRequest always matches 'cycle'
because "LIFECYCLE:" prefix contains "cycle". Filed as gt-rixa.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 16:18:01 -08:00
Steve Yegge
1c56eed44b beads: close gt-bxi8 (bd schema issue, not gt) 2025-12-19 16:17:36 -08:00
Steve Yegge
8b7fc4bbc6 chore: sync beads after closing gt-1qti 2025-12-19 16:03:39 -08:00
Steve Yegge
0c90aa5936 feat(beads): add mol-install-go-binary molecule (gt-g44u.2)
Add a single-step molecule for building and installing the gt binary.

The molecule contains one step:
- install: Build with `go build -o gt ./cmd/gt` and install with
  `go install ./cmd/gt`

Added InstallGoBinaryMolecule() function and test.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 16:02:51 -08:00
Steve Yegge
269dd9c0d3 bd sync: 2025-12-19 15:51:32 2025-12-19 15:51:32 -08:00
Steve Yegge
d1a63ffce6 bd sync: 2025-12-19 15:41:32 2025-12-19 15:41:32 -08:00
Steve Yegge
2e4d247f7d fix(mayor): remove respawn loop from mayor attach
The while true loop didn't work properly. Now gt mayor attach just runs claude directly.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 15:30:13 -08:00
Steve Yegge
06d8963318 fix(crew): improve Claude detection and add auto-prime hook
- IsClaudeRunning: remove UI marker check that caused false positives
  when Claude output remained in scrollback after exit
- Add .claude/settings.json with SessionStart hook for gt prime

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 15:28:14 -08:00
Steve Yegge
479baec64a feat(beads): update ReadyWithType to use bd --type flag (gt-ktf3)
Uses server-side filtering for merge-request type queries.
Also syncs beads updates from MQ swarm session.
2025-12-19 15:24:26 -08:00
Steve Yegge
f106752149 fix(crew): detect when already in target session, skip attach 2025-12-19 15:09:07 -08:00
Steve Yegge
8c51347b7c bd sync: closed gt-3x1 and children 2025-12-19 14:48:58 -08:00
Steve Yegge
e11bc92361 chore: sync beads after closing gt-3x1.4 2025-12-19 14:48:54 -08:00
Steve Yegge
7a6f87ebb7 feat(refinery): implement merge failure handling with labels and notifications
Add comprehensive failure handling for merge queue:
- Add FailureType enum with conflict, tests_fail, build_fail, flaky_test, push_fail
- Add handleFailure function that updates beads issue with labels and assignee
- Add notifyWorkerFailure for type-specific failure notifications
- Add retry logic for flaky tests (configurable via retry_flaky_tests)
- Add pushWithRetry with exponential backoff for transient push failures
- Add label support to beads UpdateOptions (AddLabels, RemoveLabels, SetLabels)

Failure actions by type:
- conflict: needs-rebase label, assign to worker
- tests_fail/build_fail: needs-fix label, assign to worker
- flaky_test: retry once, then treat as tests_fail
- push_fail: retry with backoff, needs-retry label

Closes gt-3x1.4

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 14:48:30 -08:00
Steve Yegge
a216092c38 feat(refinery): implement Beads-native merge queue processing (gt-3x1)
Replace branch discovery with Beads queue in Engineer:
- ProcessMR: full merge execution (fetch, conflict check, merge, test, push)
- handleSuccess: close MR and source issue, notify worker
- handleFailure: reopen MR, assign to worker, send failure notification
- Helper functions: gitRun, gitOutput, runTests, pushWithRetry, checkConflicts

The Engineer now:
- Polls for merge-requests via bd ready --type=merge-request
- Claims MRs by setting status to in_progress
- Processes merges with conflict detection and test execution
- Closes MRs and source issues on success
- Assigns back to workers on failure with appropriate notifications

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 14:48:24 -08:00
Steve Yegge
8b853ac4d2 bd sync: merge queue swarm launched, molecules complete 2025-12-19 14:47:08 -08:00
Steve Yegge
959912b6d4 feat(refinery): implement merge execution with test and push retry (gt-3x1.3)
Implement the actual merge execution in Engineer.ProcessMR:
- ExecuteMerge function: checkout target, merge with --no-ff, run tests
- pushWithRetry: exponential backoff retry logic (3 retries, 1s base delay)
- runTests: execute configurable test command
- gitRun/gitOutput: helper methods for git operations

When tests fail, resets to HEAD~1 before returning failure.
When push fails after retries, resets to HEAD~1 before returning failure.
Conflict detection during merge triggers automatic merge --abort.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 14:46:39 -08:00
Steve Yegge
f37cae33df bd sync: 2025-12-19 14:45:05 2025-12-19 14:46:36 -08:00
Steve Yegge
5e563564e3 chore: sync beads after gt-vc1n close 2025-12-19 14:26:47 -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
e859938545 feat(polecat): add beads environment and sync for worktrees
CRITICAL FIX: Polecats (git worktrees) now get proper beads environment:
- BEADS_DIR: Points to rig canonical beads directory
- BEADS_NO_DAEMON=1: Prevents daemon from corrupting worktree beads
- BEADS_AGENT_NAME: Identity for beads conflict resolution

Also adds:
- bd sync on spawn (before and after issue assignment)
- bd sync on session stop (before killing)
- gt polecat sync command for manual beads sync
- Polecat role prompt explaining two-level beads architecture
2025-12-19 13:11:03 -08:00
Steve Yegge
8f1b7b0bc6 feat: add crew worker identity context for max
Updated CLAUDE.md to include:
- Crew worker role and identity (gastown/max)
- Gas Town architecture diagram showing crew position
- Key commands for mail, beads, and work management
- Session end checklist with handoff protocol

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:57:02 -08:00
Steve Yegge
8de4010d2c Merge polecat/Dementus: harness design documentation (gt-cr9) 2025-12-19 12:50:46 -08:00
Steve Yegge
9e66f1880c Merge polecat/Smeg: document harness concept (gt-1j6)
Kept existing harness.md from main as it is more comprehensive.
Polecat/Smeg version was redundant.
2025-12-19 12:45:42 -08:00
Steve Yegge
95ba8fcb6b fix(tmux): add debounce to SendKeys to prevent Enter racing paste
When sending keys via tmux send-keys, there is a race condition where the
Enter key can be processed before the pasted text completes. This causes
messages to appear in the prompt but not be submitted.

- Add SendKeysDebounced method with configurable delay between paste and Enter
- Update SendKeys to use 100ms default debounce
- Update Inject to scale debounce based on message size (100ms + 50ms/KB)

Fixes beads-62h
2025-12-19 01:57:02 -08:00