Implements the 'gt mq integration land <epic>' command that merges an
integration branch to main.
Features:
- Verifies all MRs targeting integration branch are merged (unless --force)
- Merges with --no-ff for clear merge commit
- Runs tests before push (unless --skip-tests)
- Deletes integration branch (local and remote)
- Closes epic with merge commit info
- Rollback on test/push failure
- Dry-run mode (--dry-run)
Also adds to git package:
- MergeNoFF: merge with --no-ff flag
- DeleteRemoteBranch: delete branch on origin
- Reset: reset HEAD with optional --hard
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds the gt molecule seed subcommand that creates built-in molecule
definitions (engineer-in-box, quick-fix, research) in the beads database.
- Brings molecule.go from main (with list, show, parse, instantiate, instances)
- Adds builtin_molecules.go with 3 built-in workflow templates
- SeedBuiltinMolecules() writes directly to JSONL to bypass bd CLI type validation
- Molecules use well-known IDs (mol-engineer-in-box, mol-quick-fix, mol-research)
- Command is idempotent - skips molecules that already exist
Note: bd CLI does not yet support molecule as a valid issue type.
Filed beads-1 to add molecule type support. Until then, use bd --no-db.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Created docs/harness.md documenting the GGT harness at ~/gt/ and its
separation from the legacy PGT harness at ~/ai/. Updated architecture.md
and federation-design.md to use ~/gt/ consistently.
Key changes:
- Created harness.md with full harness structure documentation
- Added Harness section to Core Concepts in architecture.md
- Updated mermaid diagrams from ~/ai/ to ~/gt/
- Documented cleanup steps for legacy ~/ai/ artifacts
🤝 Handoff: The ~/ai/ directory has GGT leftovers that can be cleaned:
- rm -rf ~/ai/gastown/mayor/ (old GGT clone)
- rm ~/ai/.beads/redirect (old beads redirect)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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
Replace mail-based handoff system with pinned beads that persist
across sessions. This fixes the issue where handoff messages get
closed before successors can read them.
Changes:
- beads: Add StatusPinned constant and handoff functions:
- HandoffBeadTitle() for well-known naming
- FindHandoffBead() to locate role handoff bead
- GetOrCreateHandoffBead() to ensure bead exists
- UpdateHandoffContent() to set handoff message
- ClearHandoffContent() to reset after reading
- cmd/handoff: Update to use pinned beads instead of mail
- sendHandoffMail() now updates pinned bead content
- cmd/prime: Display handoff content on startup
- outputHandoffContent() reads and shows handoff bead
- cmd/rig: Add reset command with --handoff flag
- gt rig reset --handoff clears handoff content
Generated with Claude Code
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This implements the ephemeral polecat model where polecats are spawned
fresh for each task and deleted upon completion.
Key changes:
**Spawn (internal/cmd/spawn.go):**
- Always create fresh worktree from main branch
- Run bd init in new worktree to initialize beads
- Remove --create flag (now implicit)
- Replace stale polecats with fresh worktrees
**Handoff (internal/cmd/handoff.go):**
- Add rig/polecat detection from environment and tmux session
- Send shutdown requests to correct witness (rig/witness)
- Include polecat name in lifecycle request body
**Witness (internal/witness/manager.go):**
- Add mail checking in monitoring loop
- Process LIFECYCLE shutdown requests
- Implement full cleanup sequence:
- Kill tmux session
- Remove git worktree
- Delete polecat branch
**Polecat state machine (internal/polecat/types.go):**
- Primary states: working, done, stuck
- Deprecate idle/active (kept for backward compatibility)
- New polecats start in working state
- ClearIssue transitions to done (not idle)
**Polecat commands (internal/cmd/polecat.go):**
- Update list to show "Active Polecats"
- Normalize legacy states for display
- Add deprecation warnings to wake/sleep commands
Closes gt-7ik
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changes:
- Remove creation of mayor/mail/ directory with legacy JSONL inbox
- Initialize town-level beads DB (gm- prefix) via `bd init` instead of
creating a .beads/redirect placeholder file
- Update help text and next-steps output to reflect new architecture
Town beads (gm-*) store mayor mail, cross-rig coordination, and handoffs.
Rig beads remain separate with their own prefixes.
Closes: gt-jpt
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The spawn command now accepts --polecat and --rig flags as an
alternative to the positional rig/polecat argument. When using
--polecat without --rig, the rig is inferred from the current
working directory.
Examples:
gt spawn --issue gt-xyz --polecat Angharad
gt spawn --issue gt-abc --rig gastown --polecat Toast
Fixes gt-selw
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement 'gt mq integration create <epic>' command to create integration
branches for batch work on epics. The command:
1. Verifies the epic exists in beads
2. Creates branch integration/<epic-id> from origin/main
3. Pushes the branch to origin
4. Stores integration branch info in the epic's metadata
Also adds helper methods to git package:
- CreateBranchFrom: create branch from specific ref
- BranchExists: check if local branch exists
- RemoteBranchExists: check if branch exists on remote
Future MRs for the epic's children can target the integration branch
with: gt mq submit --epic <epic-id>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds two new commands to transition polecats back to idle state:
- gt polecat done (alias: finish): Transitions from working/done/stuck
states to idle, clearing the assigned issue. For normal workflow when
work is complete but session was not properly cleaned up.
- gt polecat reset: Force resets any state to idle. For recovery when
polecat is stuck in an unexpected state.
Both commands check that the session is stopped before modifying state.
Fixes gt-s3m0
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When gt rig add creates workspaces by cloning a repository, the cloned
repos CLAUDE.md would be inherited, causing crew workers to show refinery
context. Now explicitly create role-appropriate CLAUDE.md files after each
clone to ensure correct agent prompting.
Fixes gt-vdp0
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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>
When using `gt spawn rig --create` and no polecats exist (or all are
busy), the command now automatically generates a Mad Max themed polecat
name and creates it, rather than failing with "no available polecats".
This improves agent UX by making the --create flag work intuitively.
Fixes: gt-szsq
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The refinery start command was only updating state.json without
actually starting a session. Now it spawns a tmux session named
gt-{rig}-refinery that runs the refinery in foreground mode.
Also updated Stop() and Status() to properly check tmux session
state alongside the PID-based tracking for backwards compatibility.
Fixes: gt-17zr
🤝 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add MergeQueueConfig struct and RigConfig type with:
- All merge queue settings (enabled, target_branch, on_conflict, etc.)
- Default values via DefaultMergeQueueConfig()
- Validation for on_conflict strategy and poll_interval duration
- Load/Save/Validate functions following existing config patterns
- Comprehensive tests for round-trip, custom config, and validation
Implements gt-h5n.8.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
'gt session capture rig/polecat 50' now works in addition to
'gt session capture rig/polecat -n 50'. Agent UX: commands should
work the way agents guess they work.
Closes: gt-d7i
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>