- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
- 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>
- 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>
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>
- 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>
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>
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>
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>
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>
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>
- 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>
- 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>
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>
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>
- 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>
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>
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>
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>
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>
- 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