Commit Graph

143 Commits

Author SHA1 Message Date
Steve Yegge
dfae2a9401 Merge remote-tracking branch 'origin/polecat/Scabrous' 2025-12-19 01:30:40 -08:00
Steve Yegge
19a36d7744 Merge remote-tracking branch 'origin/polecat/Rictus' 2025-12-19 01:30:38 -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
Steve Yegge
e799fe5491 fix: normalize mayor identity to 'mayor/' for mail routing
The addressToIdentity function was stripping the trailing slash from
'mayor/' addresses, causing a mismatch with beads messages that have
assignee 'mayor/'. This fix ensures mayor addresses always use 'mayor/'
for consistent mail routing.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 23:30:24 -08:00
Steve Yegge
2edf2358dd fix: session start timing and MR type issues
- Add 200ms delay after NewSession before sending keys to fix race
  condition where shell is not ready (mayor.go, crew.go)
- Use merge-request type instead of task for gt mq submit (mq.go)

Fixes gt-tulx

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 22:17:13 -08:00
Steve Yegge
5f92183843 fix(mail): add crew worker detection in detectSender()
detectSender() only detected polecats, not crew workers. Crew workers
like Emma at /Users/stevey/gt/beads/crew/emma were incorrectly
defaulting to mayor/ instead of getting their proper address.

Added /crew/ directory pattern matching parallel to the existing
/polecats/ detection, extracting rig/crewName address format.

Fixes: gt-70b3

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 21:55:49 -08:00
Steve Yegge
ce6fecbc57 bd sync: 2025-12-18 21:41:14 2025-12-18 21:41:14 -08:00
Steve Yegge
4fb0d55975 bd sync: 2025-12-18 21:32:17 2025-12-18 21:32:17 -08:00
Steve Yegge
1229b98bdf fix(tmux): add debounce delay between paste and Enter
Fixes race condition where Enter key arrives before paste is fully
processed, causing workers to sit idle at prompts.

- SendKeys now uses 100ms default debounce
- New SendKeysDebounced allows configurable delay
- Inject scales delay 100-500ms based on message size

Closes: gt-w3bu

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 21:08:23 -08:00
Steve Yegge
bc8e7e66ea Merge polecat/Coma: gt mq status + Engineer main loop 2025-12-18 20:49:46 -08:00
Steve Yegge
4685308393 bd sync: close gt-svi.3, gt-3x1.1 2025-12-18 20:44:50 -08:00
Steve Yegge
c1954b3431 fix(crew): use strings.Split instead of filepath.SplitList for path parsing
filepath.SplitList is for PATH-like env vars (colon/semicolon separated),
not for splitting file paths. This caused inferRigFromCwd to always fail
since SplitList returns the whole path as one element, making the fallback
logic never trigger.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:42:03 -08:00
Steve Yegge
eb0ac8e384 feat(mq): implement gt mq submit command
Adds the merge queue submit command for workers to submit completed
work to the merge queue. The command creates a merge-request bead
that the Engineer will process.

Features:
- Auto-detects branch, issue, worker, and rig from current context
- Parses polecat/<worker>/<issue> branch naming convention
- Supports explicit --branch, --issue, --epic, --priority flags
- Inherits priority from source issue by default
- Creates merge-request bead with structured MR fields

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:33:42 -08:00
Steve Yegge
6b7ed2de83 Merge polecat/Valkyrie: keepalive signal from gt commands
Adds keepalive.Touch() to signal agent activity during commands.
Also ignores state.json in .gitignore.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:28:34 -08:00
Steve Yegge
93b57b9acb chore: ignore state.json in .gitignore
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:25:44 -08:00
Steve Yegge
62bd8739d6 feat: keepalive signal from gt commands
Every gt command now touches .gastown/keepalive.json with the last
command and timestamp. This enables smarter daemon backoff:
- Fresh (< 2 min): agent is working, skip heartbeat
- Stale (2-5 min): might be thinking, gentle poke
- Very stale (> 5 min): likely idle, safe to interrupt

Uses PersistentPreRun hook to capture all commands including subcommands.

Closes gt-bfd

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:24:51 -08:00
Steve Yegge
e831b2cb1f Merge polecat/Razor: tmux notifications and merge execution
Adds:
- gt mail send now triggers tmux notification for recipients
- Merge execution with config and retry logic

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:24:27 -08:00
Steve Yegge
7fc16ef752 Merge polecat/Keeper: mail message types and threading support
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:23:50 -08:00
Steve Yegge
784c0582b5 Merge polecat/Ace: mq list + mq reject commands
Combined with Dag's mq retry from previous merge.
Full MQ CLI now includes: list, retry, reject subcommands.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:23:26 -08:00
Steve Yegge
5da8497a7e Merge polecat/Dag: mq retry + fetch/conflict check 2025-12-18 20:19:03 -08:00
Steve Yegge
884045f031 beads: sync closed issues from workers 2025-12-18 20:18:46 -08:00
Steve Yegge
999abe672c feat: add FetchBranch and CheckConflicts for merge queue
Add git helper functions for merge request conflict checking:
- FetchBranch(remote, branch): fetch a specific branch from remote
- CheckConflicts(source, target): test merge to detect conflicts
- Returns list of conflicting files without modifying working directory
- runMergeCheck helper to capture stdout (where CONFLICT appears)

Tests cover clean merges, conflicting merges, and working dir cleanup.

Closes gt-3x1.2

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:17:42 -08:00
Steve Yegge
f032dd8c19 feat(refinery): implement merge execution with config and retry logic
Implements gt-3x1.3: Merge execution (merge, test, push)

Changes:
- Add MergeConfig struct with run_tests, test_command, delete_merged_branches,
  push_retry_count, and push_retry_delay_ms configuration options
- Add DefaultMergeConfig() with sensible defaults (tests enabled, go test ./...,
  branch cleanup, 3 retries with 1s base delay)
- Update ProcessMR to use MergeConfig for all settings
- Add pushWithRetry() with exponential backoff for transient failures
- Add gitOutput() helper to get command stdout (for merge commit SHA)
- Return merge commit SHA in MergeResult on success
- Conditional branch deletion based on config.DeleteMergedBranches

Configuration (in .gastown/config.json):
{
  "merge_queue": {
    "run_tests": true,
    "test_command": "go test ./...",
    "delete_merged_branches": true,
    "push_retry_count": 3,
    "push_retry_delay_ms": 1000
  }
}

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:17:35 -08:00
Steve Yegge
14abb8dfae Pivot molecules from YAML schema to Beads-native prose
- Closed gt-4nn.1 (YAML schema): molecules should be Beads issues
- Updated gt-4nn epic: type=molecule, prose-based step definitions
- Updated subtasks for transaction-based instantiation

AI agents parse prose natively - no rigid schemas needed.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:16:34 -08:00
Steve Yegge
dea935f647 feat: implement gt mq list command for merge queue display
- Add gt mq list <rig> command with table output
- Support --ready flag to show only unblocked MRs
- Support --status, --worker, --epic filtering
- Support --json output format
- Parse MR fields from beads issues for display
- Show blocking info for blocked MRs

Closes gt-svi.2

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:16:10 -08:00
Steve Yegge
96902092fd feat(mail): add message types and threading support
- Add MessageType enum (task, scavenge, notification, reply)
- Expand Priority from 2 to 4 levels (low, normal, high, urgent)
- Add ThreadID and ReplyTo fields to Message struct
- Add --type and --reply-to flags to 'gt mail send'
- Add 'gt mail thread <id>' command to view conversation threads
- Update inbox/read display to show type and threading info
- Auto-generate thread IDs for new messages
- Reply messages inherit thread from original

Closes: gt-hgk

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:14:13 -08:00
Steve Yegge
7c2780fcd1 feat: implement Engineer main loop for merge queue processing
Adds the Engineer component that polls for ready merge-requests and
processes them according to the merge queue design.

Features:
- Main loop that queries `bd ready` for merge-request type issues
- Configurable poll_interval and max_concurrent from rig config.json
- Graceful shutdown via context cancellation or Stop() method
- Claims MRs via `bd update --status=in_progress` before processing
- Handles success/failure with appropriate status updates

Configuration (in rig config.json merge_queue section):
- poll_interval: duration string (default "30s")
- max_concurrent: number (default 1)
- enabled, target_branch, run_tests, test_command, etc.

Also adds ReadyWithType() to beads package for type-filtered queries.

Note: ProcessMR() and handleFailure() are placeholders - full
implementation in gt-3x1.2 and gt-3x1.4.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:14:10 -08:00
Steve Yegge
81c5f6afd5 feat: implement gt mq retry command for failed merge requests
Add 'gt mq retry <rig> <mr-id>' command to retry failed MRs:
- Added GetMR() and Retry() methods to refinery.Manager
- Added RegisterMR() for persistent MR tracking
- Added PendingMRs field to Refinery state
- Created new mq.go command file with retry subcommand
- Support --now flag for immediate processing
- Added comprehensive tests for retry functionality

Closes gt-svi.4

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:11:09 -08:00
Steve Yegge
3acb0e9c12 feat: implement gt mq reject command for manual MR rejection
- Add gt mq command group with reject subcommand
- Add FindMR method to locate MRs by ID or branch
- Add RejectMR method to reject MRs with reason
- Add notifyWorkerRejected for optional mail notification
- Add tests for rejection state transitions

Closes gt-svi.5

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:10:40 -08:00
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
ae0c532723 feat: implement gt mq status command for detailed MR view
Adds the 'gt mq status <id>' command for displaying detailed merge request
information. Features:

- Shows all MR fields (branch, target, source_issue, worker, rig)
- Displays current status with timestamps and relative time
- Shows dependencies (what it's waiting on) with status icons
- Shows blockers (what's waiting on it)
- Supports JSON output with --json flag

This is part of the merge queue CLI commands (gt-svi).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:05:06 -08:00
Steve Yegge
400ff55419 fix: use bd mail instead of bd message
The bd CLI renamed 'message' subcommand to 'mail'. Updated gt mail
to call the correct bd subcommand, and fixed body to use -m flag
instead of positional argument.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 19:42:55 -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