Commit Graph

197 Commits

Author SHA1 Message Date
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
f6d7da3284 feat(mq): add integration status command (gt-h5n.6)
Implement 'gt mq integration status <epic>' command that displays:
- Integration branch name and creation date
- Commits ahead of main
- Merged MRs (closed, targeting integration branch)
- Pending MRs (open, targeting integration branch)

Also adds git helpers for BranchCreatedDate and CommitsAhead.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:53:04 -08:00
Steve Yegge
8de4010d2c Merge polecat/Dementus: harness design documentation (gt-cr9) 2025-12-19 12:50:46 -08:00
Steve Yegge
8f0723d846 fix(docs): correct mermaid diagram to show polecats as worktrees not clones
The rig-level mermaid diagram incorrectly labeled polecats as git clone
when they are actually git worktrees from Mayor's clone. This now matches
the ASCII diagram which correctly describes them as worktrees.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:49:29 -08:00
Steve Yegge
1447632a32 Merge polecat/Crow: eliminate state.json, use beads assignee (gt-qp98) 2025-12-19 12:47:56 -08:00
Steve Yegge
403872bcca Merge polecat/Corpus: auto-target integration branch for epic children (gt-h5n.7) 2025-12-19 12:47:28 -08:00
Steve Yegge
bbff3b2144 refactor(polecat): eliminate state.json, use beads assignee for state
Replace polecat state.json with beads assignee field for state management:

- Remove state.json read/write from polecat.Manager
- Add loadFromBeads() to derive state from issue.assignee field
- Update AssignIssue() to set issue.assignee in beads
- Update ClearIssue() to clear assignee from beads
- Update SetState() to work with beads or gracefully degrade
- Add ListByAssignee and GetAssignedIssue to beads package
- Update spawn to create beads issues for free-form tasks
- Update tests for new beads-based architecture

State derivation:
- Polecat exists: worktree directory exists
- Polecat assigned: issue.assignee = 'rig/polecatName'
- Polecat working: issue.status = open/in_progress
- Polecat done: issue.status = closed or no assignee

Fixes: gt-qp98

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:47:15 -08:00
Steve Yegge
9660fd414b feat(mq): auto-target integration branch for epic children
When 'gt mq submit' is called:
1. Parse source issue from branch
2. Check if issue has a parent epic
3. Check if integration/<epic> branch exists
4. If yes: set target=integration/<epic>
5. If no: set target=main

The --epic flag still works for explicit targeting.

Closes gt-h5n.7

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:47:12 -08:00
Steve Yegge
848e2dbf90 docs: update paths from ~/ai/ to ~/gt/ (gt-dq3)
- Update mermaid diagram in architecture.md
- Add Harness section to Core Concepts
- Update federation-design.md examples
- Add PGT/GGT historical context section to 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:46:16 -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
4048cdc373 fix(lint): resolve all errcheck warnings
Fix ~50 errcheck warnings across the codebase:

- Add explicit `_ =` for intentionally ignored error returns (cleanup,
  best-effort operations, etc.)
- Use `defer func() { _ = ... }()` pattern for defer statements
- Handle tmux SetEnvironment, KillSession, SendKeysRaw returns
- Handle mail router.Send returns
- Handle os.RemoveAll, os.Rename in cleanup paths
- Handle rand.Read returns for ID generation
- Handle fmt.Fprint* returns when writing to io.Writer
- Fix for-select with single case to use for-range
- Handle cobra MarkFlagRequired returns

All tests pass. Code compiles without errors.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:44:42 -08:00
Steve Yegge
3a477f673c feat(daemon): add adaptive backoff for heartbeat pokes
Implements per-agent backoff tracking to reduce noise for busy agents:
- AgentBackoff type tracks interval, miss count, and last activity
- BackoffManager manages state across all agents
- Geometric backoff strategy (1.5x factor, 10min cap)
- Integrates with keepalive to skip pokes when agents are fresh
- Resets backoff immediately when activity detected

Closes gt-8bx

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:44:05 -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
372d4d4828 Merge polecat/Warboy: gt crew restart command (gt-1fl) 2025-12-19 12:43:03 -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