Commit Graph

405 Commits

Author SHA1 Message Date
Steve Yegge
17eeaebfc7 bd sync: 2025-12-21 13:52:58 2025-12-21 13:52:58 -08:00
Steve Yegge
854c37cddb bd sync: 2025-12-21 13:39:42 2025-12-21 13:39:42 -08:00
Steve Yegge
19d522bbb8 bd sync: 2025-12-21 12:18:36 2025-12-21 12:18:44 -08:00
Steve Yegge
308a7bc190 gt-975: Molecule execution support for polecats and crew
Added molecule workflow integration to Gas Town:

1. spawn.go: MoleculeContext in work assignment mail
   - Shows step N/M and molecule ID in subject
   - Includes molecule workflow instructions
   - Guides polecat through DAG execution

2. prime.go: outputMoleculeContext()
   - Detects if in-progress issue is a molecule step
   - Shows molecule progress and next steps
   - Displays molecule work loop instructions

3. molecule.go: 'gt molecule progress' command
   - Shows execution progress for molecule root
   - Displays done/in-progress/ready/blocked steps
   - Progress bar and completion percentage
   - JSON output for Witness automation

This enables polecats to work through molecule DAGs:
- Receive molecule-aware work assignments
- See context in gt prime output
- Follow DAG with 'bd ready --parent <root>'
- Witness can monitor with 'gt molecule progress'

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 12:03:21 -08:00
Steve Yegge
beb4efc4f9 bd sync: 2025-12-21 12:03:05 2025-12-21 12:03:05 -08:00
Steve Yegge
24123ad678 bd sync: 2025-12-21 12:00:18 2025-12-21 12:00:18 -08:00
Steve Yegge
ac6c99efb5 docs: remove obsolete bd ready/list from worker instructions
- Update Finding Work section with mail cwd clarification
- Replace bd ready/list with molecule-based work assignment
- Workers now receive work from overseer, not by polling bd

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 11:54:06 -08:00
Steve Yegge
12a8b7e2b3 feat(crew): auto-prime when exec'ing Claude in-session
When running `gt crew at <name>` from inside the target session, we exec
Claude directly. Previously this meant we couldn't send `gt prime` afterward.

Now we pass "gt prime" as the initial prompt argument to the Claude CLI,
so Claude loads context immediately upon startup.

Closes gt-qivm

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 11:51:58 -08:00
Steve Yegge
3c5622fda0 bd sync: 2025-12-21 11:51:11 2025-12-21 11:51:11 -08:00
Steve Yegge
a9830ba626 bd sync: 2025-12-21 11:44:40 2025-12-21 11:46:58 -08:00
Steve Yegge
a2f3c783e1 bd sync: 2025-12-21 11:43:24 2025-12-21 11:46:58 -08:00
Steve Yegge
d7e48a5057 bd sync: 2025-12-21 11:28:28 2025-12-21 11:46:58 -08:00
Steve Yegge
ff654eee59 feat(mq): auto-cleanup polecats after MR submission
When `gt mq submit` is run from a polecat work branch (polecat/<worker>/<issue>),
it now automatically triggers polecat shutdown after submitting the MR. The
polecat sends a lifecycle request to its Witness and waits for termination.

This eliminates the need for polecats to manually run `gt handoff --shutdown`
after completing work - they can just run `gt mq submit` and the cleanup
happens automatically.

Added `--no-cleanup` flag to disable auto-cleanup when needed (e.g., for
submitting multiple MRs or continuing work).

Closes gt-tca

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 11:44:35 -08:00
Steve Yegge
d5f4188ed6 feat: add --mail flag to gt rig reset to clear stale messages
Closes gt-48bs: gt rig reset now clears stale mail messages.
- Non-pinned messages are closed with reason 'Cleared during reset'
- Pinned messages have their content cleared but remain open
- Works with both --mail flag and default reset (all state)
2025-12-21 11:28:22 -08:00
Steve Yegge
a80ae0a212 bd sync: 2025-12-21 11:21:31 2025-12-21 11:21:31 -08:00
Steve Yegge
07a40771da feat: add gt orphans command to find lost polecat work
Implements gt-b2hj: Uses git fsck --unreachable to find orphaned commits
that were never merged to main.

Features:
- Filters to commits only (not blobs/trees)
- Date filtering (--days=N, default 7)
- Excludes stash commits (WIP on, index on, etc.)
- Excludes routine bd sync commits
- Shows recovery hints (cherry-pick, show, branch)
2025-12-21 11:11:03 -08:00
Steve Yegge
d9d4431377 bd sync: 2025-12-21 11:07:45 2025-12-21 11:07:45 -08:00
Steve Yegge
facef385f7 feat(mail): add gt mail archive command (alias for delete) 2025-12-21 10:44:54 -08:00
Steve Yegge
5ee9bb13c8 fix: replace stale 'bd mail' references with 'gt mail'
- docs/architecture.md: update mail routing explanation
- internal/witness/manager.go: fix actual bd mail calls to gt mail
- internal/cmd/mail.go: remove stale compatibility note
- internal/daemon/lifecycle.go: update comment
2025-12-21 10:44:20 -08:00
Steve Yegge
f3afa149a5 fix: notification banner should say 'gt mail' not 'bd mail' 2025-12-21 10:41:27 -08:00
Steve Yegge
7ff7cbc426 bd sync: 2025-12-21 10:33:17 2025-12-21 10:41:27 -08:00
Steve Yegge
3b32aa3da0 fix(shutdown): fully cleanup polecats on shutdown
gt shutdown now performs full polecat cleanup after killing sessions:
- Removes worktrees
- Deletes polecat branches from mayor's clone
- Protects polecats with uncommitted work (refuses to clean)

Added --nuclear flag to force cleanup even with uncommitted work.

Closes gt-u1k

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 10:33:11 -08:00
Steve Yegge
ae6f4c8185 fix(spawn): resolve variable shadowing and branch deletion edge case
- Move router and polecatAddress definitions before if block to avoid
  shadowing (defining same vars inside and after the block)
- Handle branch deletion failure in Recreate() by checking if branch
  still exists and using WorktreeAddExisting like Add() does

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 10:29:32 -08:00
Steve Yegge
e07eb96144 feat(cli): add --version flag to gt
Models often guess --version exists. Cobra provides both --version and -v
when Version is set on the root command.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 10:18:37 -08:00
Steve Yegge
4e7a329ad8 bd sync: 2025-12-21 10:16:05 2025-12-21 10:16:05 -08:00
Steve Yegge
805c306e13 bd sync: 2025-12-21 10:15 2025-12-21 10:14:13 -08:00
Steve Yegge
cb8645e1cc bd sync: 2025-12-21 10:11:08 2025-12-21 10:11:08 -08:00
Steve Yegge
82d718ee34 feat(spawn): always create fresh polecat worktrees
Fixes gt-9nf: gt spawn should create fresh polecat worktree, never reuse

Changes:
- Add Recreate() method to polecat manager that removes and recreates worktrees
- Modify spawn.go to always recreate existing polecats with fresh worktrees
- Preserves safety checks: blocks if polecat is working or has uncommitted work
- Use --force to bypass uncommitted work checks

This ensures polecats always start with the latest code from the base branch,
avoiding stale code, stale beads, and git history pollution.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 10:10:27 -08:00
Steve Yegge
9a631b9195 fix(mail): normalize crew/polecats paths in addressToIdentity
Strip crew/ and polecats/ from addresses before identity conversion.
This ensures beads/crew/dave and beads/dave both resolve to beads-dave,
fixing the inbox mismatch bug (hq-0ol).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 10:06:13 -08:00
Steve Yegge
199da5aa9b fix(handoff): write crew state.json to correct location
The daemon verifies requesting_cycle=true in state.json before
executing lifecycle actions. For crew workers, the state file
must be at <townRoot>/<rig>/crew/<name>/state.json.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 01:24:56 -08:00
Steve Yegge
dbecfe1d38 feat(handoff): route crew lifecycle requests to deacon
Crew workers now use deacon for lifecycle management instead of
requiring manual session termination. When a crew worker runs
'gt handoff', it sends a lifecycle request to the deacon which
handles session kill/restart like it does for Mayor and Witness.

Changes:
- Route crew manager to deacon/ instead of "human"
- Add getCrewIdentity() to extract <rig>-crew-<name> from session
- Include full crew identity in LIFECYCLE subject for daemon parsing
- Remove special case that skipped lifecycle flow for crew

Also fixes pre-existing test failures in daemon/lifecycle_test.go
where BeadsMessage field names were out of sync with the struct.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 01:17:32 -08:00
Steve Yegge
bdbba025f5 fix(daemon): clear requesting_cycle after successful restart
Bug: When daemon cycled a session, it verified requesting_cycle=true
but never cleared the flag after restart. This caused infinite
cycle loops on each heartbeat.

Also removed redundant SendKeysDelayed("gt prime") that injected
rogue text into terminal (SessionStart hook already handles priming).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 01:14:20 -08:00
Steve Yegge
c4892938d0 fix(daemon): use gt mail instead of bd mail for lifecycle requests
The handoff command sends lifecycle requests via 'gt mail send' to
town-level beads, but the daemon was reading with 'bd mail inbox'
which reads from the local beads database. This fixes the mismatch.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 00:47:05 -08:00
Steve Yegge
9c3cc0255c refactor(cmd): split crew.go into focused modules
Break down 1184-line crew.go into 8 smaller, focused files:
- crew.go: command definitions, flags, init (229 lines)
- crew_helpers.go: shared utilities (235 lines)
- crew_lifecycle.go: remove/refresh/restart (219 lines)
- crew_status.go: status command (154 lines)
- crew_at.go: session attachment (142 lines)
- crew_maintenance.go: rename/pristine (121 lines)
- crew_list.go: list command (89 lines)
- crew_add.go: add command (74 lines)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 00:46:12 -08:00
Steve Yegge
b118b5299b fix(prime): include rig name in Polecat and Crew check-ins
Format is now "<Rig> Polecat <name>, checking in." and
"<Rig> Crew <name>, checking in." to match the pattern.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 00:36:36 -08:00
Steve Yegge
842819cce6 fix(namepool): load theme from disk correctly
The Load() function wasn't reading the saved theme because the condition
p.Theme == "" was never true after NewNamePool() set it to "mad-max".
Now the loaded theme properly overrides constructor defaults.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 00:35:47 -08:00
Steve Yegge
5a75ca5944 bd sync: 2025-12-20 23:26:37 2025-12-21 00:35:33 -08:00
Steve Yegge
74e397fadb feat(prime): add check-in announcements for all agent roles
Extend the startup protocol to have all roles announce themselves:
- Mayor: "Mayor, checking in." (already present)
- Witness: "Witness, checking in."
- Polecat: "Polecat <name>, checking in."
- Refinery: "Refinery, checking in."
- Crew: "Crew <name>, checking in." (new case added)

This provides consistent startup behavior across all Gas Town agents.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 00:35:30 -08:00
Steve Yegge
4073638fa1 fix: crew workers detected as polecat in gt handoff
- Add crew session detection before polecat (gt-*-crew-* pattern)
- Crew workers exit immediately after sending handoff mail
- No waiting for manager since crew is human-managed

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 23:35:22 -08:00
Steve Yegge
80aa280e04 fix: use gt mail instead of bd mail in handoff command
bd doesn't have a mail subcommand - mail routing goes through gt.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 23:31:25 -08:00
Steve Yegge
61f94d1e04 refactor: split mq.go (1738 lines) into focused modules
- mq.go (400): commands, flags, init, shared helpers
- mq_integration.go (606): integration branch create/land/status
- mq_status.go (357): status display and formatting
- mq_submit.go (219): submit command and branch parsing
- mq_list.go (206): list command and filtering

Also adds unit tests for helper functions:
- formatStatus, getStatusIcon, formatTimeAgo
- filterMRsByTarget with edge cases
- Test utilities for mocking beads

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 23:25:16 -08:00
Steve Yegge
e787eb14c8 feat(shutdown): add confirmation prompt and preserve crew by default
- Add y/N confirmation before shutdown (skip with --yes)
- Preserve crew sessions by default (include with --all)
- Add --polecats-only for minimal shutdown
- Show what will be stopped vs preserved before confirming

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 23:10:00 -08:00
Steve Yegge
a2dc42bb4b fix(mail): route all mail to town beads
The mail router was incorrectly routing rig-level addresses
(e.g., gastown/crew/max) to {rig}/.beads instead of town beads.
This caused mail to be invisible when agents checked their inbox.

Two-level beads architecture:
- ALL mail uses town beads ({townRoot}/.beads)
- Rig-level beads are for project issues only

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 22:50:14 -08:00
Steve Yegge
07aa044e3b add: install-local.sh script for local gt installation 2025-12-20 22:40:40 -08:00
Steve Yegge
916dadc740 add Makefile with auto-signing for macOS
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 22:38:13 -08:00
Steve Yegge
2a0f1fe514 chore: prepare v0.1.0 OSS release
- Add MIT LICENSE file
- Update version to 0.1.0
- Add mol-version-bump molecule for release workflow
- Terse README for OSS release

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 22:22:56 -08:00
Steve Yegge
b70dc21826 bd sync: 2025-12-20 22:20:03 2025-12-20 22:20:53 -08:00
Steve Yegge
8efaa59446 feat: gt doctor checks for branch hygiene
Add two new doctor checks:

1. persistent-role-branches: Detects crew/*, witness/rig, refinery/rig
   directories not on main branch. Persistent roles should work directly
   on main to avoid orphaned work.

2. beads-sync-orphans: Detects code changes on beads-sync branch that
   weren't merged to main, catching cases where merges lose code changes.

Also adds ensureMainBranch() to crew attach to auto-switch persistent
roles to main at session start.

Closes gt-p9zh

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 22:19:32 -08:00
Steve Yegge
67f84339a6 Merge feature/rename-harness-to-hq: restore beads (mayor/rig is canonical)
The redirect was incorrectly added to main. mayor/rig/.beads IS the
canonical beads location - other clones redirect TO here, not FROM here.
2025-12-20 22:06:25 -08:00
Steve Yegge
ca3e83c158 bd sync: update issues.jsonl after deacon kernel epic 2025-12-20 22:04:52 -08:00