Commit Graph

2987 Commits

Author SHA1 Message Date
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
372d4d4828 Merge polecat/Warboy: gt crew restart command (gt-1fl) 2025-12-19 12:43:03 -08:00
Steve Yegge
7112c42ee9 docs: document GGT harness separation from PGT (gt-dq3)
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>
2025-12-19 12:08:33 -08:00
Steve Yegge
5b88000fd3 Merge polecat/Feral: harness documentation (gt-l1o) 2025-12-19 12:07:26 -08:00
Steve Yegge
7c723f251c docs(harness): document harness concept comprehensively
Add docs/harness.md covering:
- What a harness (installation directory) is
- Directory structure with mayor/ config files
- Town-level vs rig-level mayor presence
- Beads architecture and resolution via BEADS_DIR
- Relationship between harness and rigs
- Example configurations and setup workflow

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:07:19 -08:00
Steve Yegge
db975b675c Merge polecat/Praetorian: tmux notification banner (gt-vnp9) 2025-12-19 12:07:18 -08:00
Steve Yegge
8b659de6c8 Merge polecat/Immortan: polecat add existing branch fix (gt-bmjw) 2025-12-19 12:07:16 -08:00
Steve Yegge
c8d27f2f3e feat(crew): add restart command to kill and restart session fresh
Add `gt crew restart <name>` command that kills the tmux session and
starts fresh with Claude. Unlike `refresh`, this does not send handoff
mail - it is a clean slate restart. Useful when a crew member gets
confused or needs context cleared.

Alias: gt crew rs

Resolves: gt-1fl

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:07:00 -08:00
Steve Yegge
83ba553dda Merge polecat/Bullet: mq integration land (gt-h5n.5) 2025-12-19 12:06:32 -08:00
Steve Yegge
e9f9f5940c Merge polecat/Cutter: built-in molecules (gt-4nn.4) 2025-12-19 12:06:29 -08:00
Steve Yegge
1aa42eeeb3 Merge polecat/Gyro: spawn paste debounce fix (gt-eqys) 2025-12-19 12:06:27 -08:00
Steve Yegge
1e6a363757 docs: add harness design documentation (gt-cr9)
Create comprehensive harness documentation covering:
- What a harness is (installation directory vs town concept)
- Harness structure and creation with gt install
- Beads redirect patterns for complex setups
- Multi-system sharing (PGT/GGT coexistence)
- Configuration files (town.json, rigs.json, state.json)
- Harness templates for organizations
- Migration between harnesses

Update architecture.md to:
- Rename "Town" section to "Harness (Town)" with clearer explanation
- Add cross-references to new harness.md
- Update directory structure section with "Harness Level" heading
- Expand CLI commands section with more gt install options

Update install.go help text to reference harness.md.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:02:04 -08:00
Steve Yegge
0cbb93484d feat(beads): add built-in molecules for standard workflows
Add three built-in molecule definitions that are automatically seeded
during `gt install`:

- engineer-in-box: Full workflow from design to merge (5 steps)
- quick-fix: Fast path for small changes (3 steps)
- research: Investigation workflow (2 steps)

These molecules provide reusable workflow templates that polecats can
instantiate to execute multi-step procedures with proper dependency
tracking between steps.

Closes gt-4nn.4

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:02:04 -08:00
Steve Yegge
7de003a18b feat(mq): implement integration land command (gt-h5n.5)
Add 'gt mq integration land <epic>' command that:
- Verifies all MRs targeting integration/<epic> are merged
- Verifies integration branch exists
- Merges integration/<epic> to main (--no-ff)
- Runs tests on main (if configured)
- Pushes to origin
- Deletes integration branch (local and remote)
- Updates epic status to closed

Options:
- --force: land even if some MRs still open
- --skip-tests: skip test run
- --dry-run: preview only

Also adds:
- MergeNoFF() and DeleteRemoteBranch() to git package
- WorkDir() accessor for git.Git
- Unit tests for mq helper functions

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:01:42 -08:00
Steve Yegge
0ea6d9d9cb docs: add Gas Town harness configuration guide (gt-l1o)
Document what a harness is (private repo containing GT installation),
why you would want one (work on public projects privately), and how to
configure beads redirects for multi-rig workflows.

Closes: gt-346, gt-5qc, gt-l1o

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:01:23 -08:00
Steve Yegge
1fed8e2eaa fix(spawn): increase paste debounce to prevent Enter racing paste
The spawn context inject was sending Enter too quickly after pasting
large messages. Claude needs time to process the paste before Enter
is sent (Claude shows "Pasted text #1 +N lines" message).

Increased debounce timing:
- Base delay: 100ms → 200ms
- Per-KB scaling: 50ms → 100ms
- Max cap: 500ms → 1500ms

For a typical 4KB spawn context, this gives 600ms (vs 300ms before).

Fixes: gt-eqys

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:01:23 -08:00
Steve Yegge
4c064aff5d feat(molecule): add molecule CLI commands and spawn integration
Add `gt molecule` subcommands for managing workflow templates:
- list: Show all molecules (type=molecule issues)
- show: Display molecule with parsed step structure
- parse: Validate molecule and show parsed details
- instantiate: Create child beads from molecule template
- instances: Show all instantiations of a molecule

Also add `--molecule` flag to `gt spawn` for molecule-based workflows.
When specified, the molecule is instantiated on the parent issue first,
then the polecat is spawned on the first ready step.

🤝 Co-authored-by: Claude <noreply@anthropic.com>
2025-12-19 12:00:30 -08:00
Steve Yegge
d371f60e03 fix(mail): use visible banner for tmux notifications
Replace tmux display-message (subtle status bar notification) with
send-keys to echo a visible banner to the terminal. This ensures
mail notifications are actually seen by agents.

Closes gt-vnp9

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:00:22 -08:00
Steve Yegge
e5ce1467e0 fix(polecat): handle existing branch gracefully in polecat add
When adding a polecat, check if the branch already exists (e.g., from a
previous polecat that was removed but whose branch wasn't cleaned up).
If so, reuse the existing branch with WorktreeAddExisting instead of
failing with 'a branch named polecat/X already exists'.

Fixes: gt-bmjw

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 11:59:30 -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
Steve Yegge
4b1be156e7 Merge polecat/Corpus: handoffs using pinned beads (gt-cu7r)
Resolved conflict in handoff.go by keeping pinned bead implementation.
2025-12-19 01:55:53 -08:00
Steve Yegge
e993ba1aca Merge polecat/Bullet: ephemeral polecat model (gt-7ik)
Resolved conflict in spawn.go by keeping --polecat flag feature.
2025-12-19 01:55:21 -08:00
Steve Yegge
f5601471a5 Merge polecat/Flamer: real beads DB for town-level (gt-jpt) 2025-12-19 01:54:42 -08:00
Steve Yegge
690e8dfd81 Merge polecat/Scabrous: polecat done/reset commands (gt-s3m0) 2025-12-19 01:54:40 -08:00
Steve Yegge
7d206c3efc Merge polecat/Immortan: spawn --polecat flag (gt-selw) 2025-12-19 01:54:33 -08:00
Steve Yegge
cbd30e76a2 Merge polecat/Buzzard: mq integration create (gt-h5n.4) 2025-12-19 01:54:30 -08:00
Steve Yegge
4edacde590 Implement handoffs using pinned beads (gt-cu7r)
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>
2025-12-19 01:51:14 -08:00
Steve Yegge
231d6e92e0 feat: implement ephemeral polecat model
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>
2025-12-19 01:48:59 -08:00
Steve Yegge
ba8abf8463 fix(install): use real beads DB instead of redirect file
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>
2025-12-19 01:47:48 -08:00
Steve Yegge
231e7a422e Add --polecat flag to gt spawn command
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>
2025-12-19 01:46:23 -08:00
Steve Yegge
50cdd638cb feat(mq): add gt mq integration create command
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>
2025-12-19 01:46:04 -08:00
Steve Yegge
aa3c1d41ef Add done/finish and reset commands for polecat state management
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>
2025-12-19 01:45:56 -08:00
Steve Yegge
007acf8f01 feat(beads): add molecule instantiation for workflow templates
Implement ParseMoleculeSteps() and InstantiateMolecule() for creating
child beads from molecule templates. Molecules are composable workflow
patterns that define steps with dependencies.

Key features:
- Parse `## Step: <ref>` sections from molecule descriptions
- Extract `Needs:` dependencies and `Tier:` hints
- Support `{{variable}}` template parameterization
- Create child issues atomically with proper parent/dependency wiring
- Validate molecules for duplicate refs, unknown deps, self-deps

Closes: gt-4nn.2

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 01:45:06 -08:00
Steve Yegge
717bc89132 Merge remote-tracking branch 'origin/polecat/Buzzard' 2025-12-19 01:30:57 -08:00
Steve Yegge
37de0c5330 Merge remote-tracking branch 'origin/polecat/Immortan' 2025-12-19 01:30:55 -08:00
Steve Yegge
b47da4baae Merge remote-tracking branch 'origin/polecat/Angharad' 2025-12-19 01:30:54 -08:00
Steve Yegge
e20778fc1e Merge remote-tracking branch 'origin/polecat/Warboy' 2025-12-19 01:30:52 -08:00
Steve Yegge
5493180920 Merge remote-tracking branch 'origin/polecat/Bullet' 2025-12-19 01:30:41 -08:00
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
82e10e4ef2 fix: create role-specific CLAUDE.md for crew/refinery/mayor on rig add
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>
2025-12-19 00:36:35 -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
1907eea102 fix(spawn): auto-add polecat when --create flag is set
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>
2025-12-19 00:29:57 -08:00
Steve Yegge
dc876d1783 fix(refinery): start command now spawns tmux session
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>
2025-12-19 00:29:50 -08:00
Steve Yegge
3f924234ad feat(config): add merge_queue section to rig config schema
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>
2025-12-19 00:29:40 -08:00
Steve Yegge
67c952290a feat(session): add positional line count to capture command
'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>
2025-12-19 00:28:21 -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