Commit Graph

383 Commits

Author SHA1 Message Date
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
Steve Yegge
205871ca7e bd sync: 2025-12-20 22:01:24 2025-12-20 22:01:24 -08:00
Steve Yegge
7e16ac4800 fix: recover orphaned mail migration to bd v0.32.0
The merge at 96c773f lost changes from 5791752 (beads-sync branch).
Re-implementing:
- router.go: Use bd create --type=message with labels
- mailbox.go: Use bd list/show/close instead of bd mail commands
- types.go: Add Pinned field to Message struct

Original work was in commits 5791752 and 4c060f4 on beads-sync.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 22:01:16 -08:00
Steve Yegge
844a1c590f bd sync: 2025-12-20 21:48:06 2025-12-20 21:48:06 -08:00
Steve Yegge
1cc20efc40 refactor: replace clone beads with redirects to canonical
All clones (crew, refinery) now use redirect files pointing to the
canonical beads database at mayor/rig/.beads instead of maintaining
their own copies.

Benefits:
- Single source of truth for all rig issues
- No git sync needed between clones
- Instant visibility of changes across all agents
- Eliminates JSONL merge conflicts

Structure:
  clone/.beads/redirect -> ../../mayor/rig/.beads

Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 21:25:47 -08:00
Steve Yegge
96c773f570 Merge beads-sync branch
Sync beads changes and code updates.

Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 21:23:39 -08:00
Steve Yegge
9beda96257 chore: ignore .beads/redirect (local clone config) 2025-12-20 21:18:56 -08:00
Steve Yegge
273faa5808 chore: add redirect to .beads/.gitignore 2025-12-20 21:18:14 -08:00
Steve Yegge
3b7c8c62c3 chore: customize CLAUDE.md for joe crew member 2025-12-20 21:17:38 -08:00
Steve Yegge
72e3b5e5f2 docs: document mail routing and shared beads for polecats
Add documentation for two key features:

1. Mail Routing (internal/mail/router.go):
   - Routes messages to correct beads database by recipient
   - Town-level (mayor/, deacon/) -> ~/gt/.beads
   - Rig-level (rig/polecat) -> ~/gt/rig/.beads
   - Uses BEADS_DIR env var for all bd commands

2. Shared Beads for Polecats:
   - Polecats use redirect files instead of own beads DBs
   - .beads/redirect contains relative path to shared beads
   - Eliminates git sync overhead between polecat worktrees
   - setupSharedBeads() creates redirect on polecat spawn

Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 21:15:35 -08:00
Steve Yegge
b9f93fc806 feat: implement rig/town-level mail routing and shared beads for polecats 2025-12-20 21:04:23 -08:00
Steve Yegge
fc1f50502f feat(polecat): Add shared beads redirect for polecats (gt-cxtu)
When creating a polecat worktree, create a .beads/redirect file pointing
to the rig-level shared beads database. This eliminates git sync overhead
between polecats - they all connect to the same daemon and database.

Architecture:
  gastown/
    .beads/              <- Shared database (created if missing)
    polecats/
      nux/
        .beads/
          redirect       <- Contains "../../.beads"

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 20:54:37 -08:00
Steve Yegge
8fab4d3790 chore: VC pattern analysis + Deacon simplification
- Add gt-zhpa epic: VC Pattern Integration (6 child tasks)
  Extracted validated ideas from ~/src/vc that map to Gas Town primitives

- Close gt-5af: Deacon epic as over-engineered
  Problem solved by hooks + gt prime

- Create lightweight successors:
  - gt-htto: Heartbeat convention
  - gt-bnch: Human escalation

- Disable beads MCP plugin for Gas Town
  CLI works; MCP adds complexity without value

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 20:41:33 -08:00
Steve Yegge
e5c88ae9d4 feat(lifecycle): immediate daemon notification via SIGUSR1
- daemon.go: Add SIGUSR1 handler to process lifecycle requests immediately
- handoff.go: Signal daemon after sending lifecycle mail to deacon/
- mail.go: Show message IDs in hook output for direct reading

Previously, gt handoff would wait up to 5 min for daemon heartbeat poll.
Now lifecycle requests are processed within milliseconds.

Closes gt-zut3

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 20:28:36 -08:00
Steve Yegge
57917521e6 fix: migrate gt mail to use bd v0.32.0 issue commands
bd v0.32.0 removed mail commands. Updated gt mail to use:
- bd list --type message (inbox)
- bd show (read)
- bd close (delete/ack)
- bd create --type message (send)

Sender/thread/reply-to now stored in labels and extracted on read.
Added --pinned flag (blocked by bd pin bug gt-zr0a).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 20:11:09 -08:00
Steve Yegge
bc4cec1494 docs(crew): Work off main, no feature branches
Crew workers are trusted maintainers who push directly to main:
- Own their clones (no isolation needed)
- Fast work cycles (10-15 min) make branch overhead wasteful
- Branches go stale with context cycling
- Polecats use branches/MRs; crew does not need review

Also updated two-level beads docs (removed stale rig-level references).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 18:35:02 -08:00
Steve Yegge
5f206348a5 fix: Use correct beads paths for molecule and statusline
- molecule.go: Use findLocalBeadsDir() for project-level beads
- statusline.go: Use findMailWorkDir() for mail count (town beads)

Part of two-level beads architecture cleanup.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 18:30:45 -08:00
Steve Yegge
c16324b713 fix(mail): Use town beads for all mail (two-level architecture)
Replace complex address-based routing with simple town root lookup.
All mail goes to ~/gt/.beads/ (town beads), eliminating the broken
rig-level routing.

Two-level model:
- Town beads (~/gt/.beads/): ALL mail and coordination
- Clone beads (<rig>/crew/*/.beads/): Project issues only

Fixes: gt-4qey

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 18:28:14 -08:00
Steve Yegge
b3ef048c28 feat(mail): sort pinned messages first in inbox (gt-ngu1)
Add Pinned field to Message and BeadsMessage types, and implement
sorting in listBeads() to show pinned messages first, then by
priority, then by date.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 18:02:53 -08:00
Steve Yegge
f6ff533891 feat(mail): Sort pinned messages first in inbox (gt-ngu1)
Add Pinned field to BeadsMessage and sort pinned messages before
unpinned ones in listBeads(). Within each group, sort by newest first.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 17:53:52 -08:00
Steve Yegge
4c060f4aaa refactor(mail): Remove bd mail dependency, use bd create/list/show (gt-9xg)
Replace `bd mail send/inbox/read/ack` commands with `bd create/list/show/close`.
This separates the orchestration layer (gt) from the data plane (beads).

Changes:
- router.go: Use `bd create --type=message` instead of `bd mail send`
- mailbox.go: Use `bd list --type=message` and `bd show` for inbox/read
- types.go: Parse metadata from labels (from:, thread:, reply-to:)
- mail.go: Fix findBeadsWorkDir to prefer rig-level beads, fix crew address format

Messages are now stored as beads issues with type=message. Metadata (sender,
thread, reply-to) is stored in labels for retrieval.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 17:52:15 -08:00
Steve Yegge
a9d204aa22 feat(daemon): add lifecycle support for refinery and crew
- Add refinery and crew patterns to identityToSession()
- Add refinery and crew handling to restartSession() with pre-sync
- Add refinery and crew to identityToStateFile()
- Fix gt refinery start to send gt prime after Claude starts
- New syncWorkspace() helper for agents with persistent clones
2025-12-20 17:42:21 -08:00
Steve Yegge
d242239aa1 bd sync: add gt-976 crew lifecycle + gt-977 work request to max 2025-12-20 17:20:02 -08:00