Commit Graph

1579 Commits

Author SHA1 Message Date
Steve Yegge
cb9c6385d0 bd sync: 2025-12-28 16:00:47 2025-12-28 16:16:24 -08:00
Steve Yegge
975626c11b Add session name helper functions (gt-atqr8)
Create helper functions in internal/session/names.go for consistent
session name construction across Gas Town agents:
- MayorSessionName()
- DeaconSessionName()
- WitnessSessionName(rig)
- RefinerySessionName(rig)
- CrewSessionName(rig, name)
- PolecatSessionName(rig, name)

Includes comprehensive unit tests in names_test.go.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 16:14:26 -08:00
Steve Yegge
40977b1ccc feat: Unify C-b n/p cycling across session types
The previous implementation set separate bindings for crew vs town
sessions, but tmux key bindings are global. This meant whichever
session type was started last would overwrite the other's bindings.

New approach:
- Add unified `gt cycle next/prev` command that auto-detects session type
- Town sessions (gt-mayor, gt-deacon) cycle within town group
- Crew sessions (gt-*-crew-*) cycle within their rig's crew
- Other sessions (polecats, witness, refinery) do nothing on cycle

The old SetCrewCycleBindings and SetTownCycleBindings are now aliases
for the unified SetCycleBindings function.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 16:07:58 -08:00
Steve Yegge
faee888a9f Add town session cycling for mayor/deacon (C-b n/p)
- Create gt town next/prev commands for cycling between town-level sessions
- Add SetTownCycleBindings() to tmux package
- Wire up bindings when starting mayor and deacon sessions

Now mayor and deacon have the same C-b n/p cycling behavior as crew workers.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 16:00:41 -08:00
Steve Yegge
213b3bab20 feat: Add atomic write pattern for state files (gt-wled7)
Prevents data loss from concurrent/interrupted state file writes by using
atomic write pattern (write to .tmp, then rename).

Changes:
- Add internal/util package with AtomicWriteJSON/AtomicWriteFile helpers
- Update witness/manager.go saveState to use atomic writes
- Update refinery/manager.go saveState to use atomic writes
- Update crew/manager.go saveState to use atomic writes
- Update daemon/types.go SaveState to use atomic writes
- Update polecat/namepool.go Save to use atomic writes
- Add comprehensive tests for atomic write utilities

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 15:57:53 -08:00
Steve Yegge
36dbea9618 bd sync: 2025-12-28 15:51:37 2025-12-28 15:51:37 -08:00
Steve Yegge
31a392eec2 bd sync: 2025-12-28 15:43:30 2025-12-28 15:43:30 -08:00
Steve Yegge
02d7b4ee0e test: Add polecat identity regression tests (gt-si6am, gt-y41ep)
Adds tests to prevent regression of polecat identity bugs:

1. TestInstallCLAUDETemplate: Verifies template is loaded from
   mayor/rig/templates/ (not rig root) with correct variable substitution.

2. TestInstallCLAUDETemplateNotAtRigRoot: Verifies templates at the
   old buggy location (rig root) are NOT used.

3. TestPolecatCommandFormat: Documents and verifies that polecat sessions
   export GT_ROLE=polecat, GT_RIG, GT_POLECAT, BD_ACTOR inline before
   starting Claude (because tmux SetEnvironment only affects new panes).

These tests ensure polecats correctly identify as polecats, not mayor.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-28 15:40:01 -08:00
Steve Yegge
b5a3fe3e15 fix: Polecat identity detection - template path and env export (gt-si6am, gt-y41ep, gt-9ar8x)
Two bugs caused polecats to think they were mayor:

1. Template lookup path (gt-si6am):
   - Was looking at rig.Path/templates/ which doesn't exist
   - Now correctly looks at mayor/rig/templates/
   - Polecats get the polecat CLAUDE.md instead of inheriting mayor's

2. Env var export (gt-y41ep):
   - tmux SetEnvironment only affects new panes, not current shell
   - Now exports GT_ROLE, GT_RIG, GT_POLECAT, BD_ACTOR inline before Claude
   - Matches how crew sessions work

Combined effect (gt-9ar8x): Polecats now correctly identify as polecats
and work from their own directory instead of mayor/rig.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-28 15:34:35 -08:00
Steve Yegge
e54d0eec0a bd sync: 2025-12-28 15:33:00 2025-12-28 15:33:00 -08:00
Steve Yegge
2ad828f503 bd sync: 2025-12-28 15:32:52 2025-12-28 15:32:52 -08:00
Steve Yegge
85bf95a221 bd sync: 2025-12-28 15:32:31 2025-12-28 15:32:31 -08:00
Steve Yegge
4a321b9690 bd sync: 2025-12-28 15:31:31 2025-12-28 15:32:04 -08:00
Steve Yegge
e8d4fcda0b Fix MessagingConfig code review issues (gt-mrqiz, gt-ngoe6, gt-akc4m)
- Add Type field for schema consistency (gt-mrqiz)
- Fix error message inconsistency: all validation errors now wrap sentinel (gt-ngoe6)
- Add missing tests: wrong type, future version, malformed JSON (gt-akc4m)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 15:31:25 -08:00
Steve Yegge
3e863c1431 feat: Add gt polecat nuke command for full cleanup (gt-z99nh)
Implements the nuclear cleanup option for post-merge polecat removal:
- Kills Claude session (force mode)
- Deletes git worktree (bypassing all safety checks)
- Deletes polecat branch
- Closes agent bead

Supports --all for bulk nuke and --dry-run for preview.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:23:26 -08:00
Steve Yegge
bed0dacf1f feat: Add gt polecat recycle command (gt-j9ddg)
Implements session-preserving polecat recycle:
- Kills Claude session (tmux kill-session)
- Preserves sandbox (worktree and branch intact)
- Updates agent bead state to 'stopped'
- Leaves polecat ready for respawn on next molecule step

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:15:24 -08:00
Steve Yegge
73e829724f bd sync: 2025-12-28 14:07:42 2025-12-28 14:07:51 -08:00
Steve Yegge
6fb4851301 Add messaging config types and load/save functions (gt-i6jvc)
Add MessagingConfig with:
- Lists: static mailing lists with fan-out delivery
- Queues: shared work queues with claiming
- Announces: bulletin boards for broadcast messages

Includes:
- types.go: MessagingConfig, QueueConfig, AnnounceConfig types
- loader.go: Load/Save/Validate functions, MessagingConfigPath helper
- loader_test.go: Round-trip and validation tests

Created ~/gt/config/messaging.json with example configuration.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:07:30 -08:00
Steve Yegge
176ad3ae69 fix: Polecat template - directory discipline and commit before done (gt-hj0ei, gt-ibuga)
Fixed two integration test bugs:

gt-hj0ei: Polecat wrote files outside worktree
- Added CRITICAL directory discipline section at top
- Emphasizes staying in polecats/<name>/ directory

gt-ibuga: Polecat didnt commit before gt done
- Replaced vague completion protocol with explicit checklist
- Uses gt done command instead of manual mail
2025-12-28 14:00:31 -08:00
Steve Yegge
975de79fb4 docs: Add witness CLAUDE.md template with MERGE_READY step (gt-bo8mo)
Created witness-CLAUDE.md template that emphasizes the critical
MERGE_READY step in the pre-kill verification checklist.

The witness must send MERGE_READY to refinery BEFORE killing a polecat
session, so the refinery knows which branch to merge.

Uses {{RIG}} placeholder for rig-specific deployment.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 13:59:06 -08:00
Steve Yegge
957c557d25 fix: gt done creates MR bead instead of file-based mrqueue (gt-wtfej)
Previously gt done wrote MRs to .beads/mq/*.json files, but gt mq list
queried beads for issue_type=merge-request. These were two different
storage systems, so MRs created by gt done never showed in gt mq list.

Now gt done creates a proper MR bead with:
- issue_type: merge-request
- Description containing branch, target, source_issue, rig, worker

Also updated mq_submit.go for consistency.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 13:56:23 -08:00
Steve Yegge
c107665f17 bd sync: 2025-12-28 13:00:08 2025-12-28 13:00:20 -08:00
Steve Yegge
bac6f084ff Wire polecat-CLAUDE.md template into polecat spawn (gt-34mxx)
Add installCLAUDETemplate() to Manager that:
- Reads templates/polecat-CLAUDE.md from rig root
- Substitutes {{rig}} and {{name}} with actual values
- Writes to polecats/<name>/CLAUDE.md

Called from both Add() and Recreate() after worktree creation.
Non-fatal if template is missing.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 12:59:54 -08:00
Steve Yegge
65b16117f7 bd sync: 2025-12-28 12:57:06 2025-12-28 12:57:07 -08:00
Steve Yegge
ecfd862dac Add preflight-tests step to mol-polecat-work
Checks tests on main BEFORE starting work. Scotty Principle:
- Quick fix (<15 min): Fix it, commit, continue
- Big fix: File bead, notify Witness, proceed

Closes gt-3zkjw
2025-12-28 12:49:48 -08:00
Steve Yegge
43ef530e95 bd sync: 2025-12-28 12:46:53 2025-12-28 12:46:53 -08:00
Steve Yegge
c564bfd736 Comprehensive polecat work lifecycle (mol-polecat-work v2)
Complete redesign of polecat work formula with 8 concrete steps:
1. load-context - Prime, read issue, verify can proceed
2. branch-setup - Clean feature branch, rebased on main
3. implement - Do work, commit regularly, file discovered work
4. self-review - Review diff, fix issues before testing
5. run-tests - ALL tests must pass, verify coverage
6. cleanup-workspace - No uncommitted, no stash, no cruft
7. close-issue - bd close with summary
8. signal-complete - POLECAT_DONE mail, WAIT for termination

Also updated mol-polecat-lease.formula.toml (v2):
- 5 steps: boot → working → verifying → merge_requested → done
- Aligns with witness patrol and mail protocol
- Clear verification criteria before MERGE_READY

Added templates/polecat-CLAUDE.md:
- Polecat role context for spawned workers
- Propulsion principle, key commands, completion protocol
- Clear "do NOT" section (don't exit, don't push to main)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 11:13:00 -08:00
Steve Yegge
1366a032de bd sync: 2025-12-28 11:02:50 2025-12-28 11:02:50 -08:00
Steve Yegge
12a9e7982d bd sync: 2025-12-28 10:52:57 2025-12-28 10:53:08 -08:00
Steve Yegge
977927244a bd sync: 2025-12-28 10:27:57 2025-12-28 10:53:08 -08:00
Steve Yegge
b2c3b21721 Change feed hotkey from C-b f to C-b a (activity)
C-b f conflicts with tmux built-in find-window command.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 10:31:30 -08:00
Steve Yegge
a43a5a8e4b Add tmux hotkey C-b f for feed window (gt-95j13)
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 10:27:10 -08:00
Steve Yegge
7ee51b8460 bd sync: 2025-12-28 10:24:08 2025-12-28 10:25:30 -08:00
Steve Yegge
8624ae68cb chore: Ignore .beads/redirect (location-specific file)
The redirect file points crew/polecat clones to the shared beads.
It's location-specific and regenerated by 'gt prime', so it should
not be tracked in git.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 10:25:11 -08:00
Steve Yegge
4c0ca6be4d Revert "chore: Track .beads/redirect for crew shared beads"
This reverts commit e00528e4ef.
2025-12-28 10:25:01 -08:00
Steve Yegge
e00528e4ef chore: Track .beads/redirect for crew shared beads
The redirect file points crew workers to the shared beads database
at mayor/rig/.beads. Tracking it keeps git status clean.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 10:22:55 -08:00
Steve Yegge
1877ed9e13 bd sync: 2025-12-28 10:18:51 2025-12-28 10:18:51 -08:00
Steve Yegge
5ec5616c9f bd sync: 2025-12-28 10:17:44 2025-12-28 10:17:44 -08:00
Steve Yegge
a001e78c71 bd sync: 2025-12-28 10:17:22 2025-12-28 10:17:22 -08:00
Steve Yegge
aadd58a06a bd sync: 2025-12-28 10:14:08 2025-12-28 10:14:08 -08:00
Steve Yegge
a5b8e9a6f0 bd sync: 2025-12-28 10:07:07 2025-12-28 10:07:14 -08:00
Steve Yegge
990d9820a0 feat: Create crew agent beads in doctor --fix and crew add
- doctor/agent_beads_check.go: Check and create agent beads for all crew workers
  - New listCrewWorkers() helper finds crew directories in each rig
  - Run() checks for missing crew agent beads
  - Fix() creates missing crew agent beads with proper fields

- cmd/crew_add.go: Create agent bead when adding a crew worker
  - Creates gt-crew-<rig>-<name> agent bead after workspace creation
  - Non-fatal if bead creation fails (warns but continues)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 10:07:01 -08:00
Steve Yegge
2655a85124 chore: remove issue ID references from comments
Strip (gt-xxx), (bd-xxx) suffixes from code comments. The descriptions
remain meaningful without the ephemeral issue IDs.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 10:05:16 -08:00
Steve Yegge
5838d4cd1b Witness pings Deacon for second-order monitoring (gt-5v8ls)
Added WITNESS_PING protocol for monitoring Deacon health:

Witness patrol (mol-witness-patrol):
- Added ping-deacon step after survey-workers
- Sends WITNESS_PING mail to Deacon each patrol cycle
- Checks Deacon agent bead last_activity timestamp
- Escalates to Mayor if Deacon appears unresponsive

Deacon patrol (mol-deacon-patrol):
- Added WITNESS_PING handling in inbox-check
- Added second-order monitoring section to description
- Bumped formula version to 2

This prevents the "who watches the watchers" problem - if Deacon dies,
the collective Witness fleet detects it and escalates.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 10:02:55 -08:00
Steve Yegge
60940bfd99 bd sync: 2025-12-28 09:59:49 2025-12-28 09:59:49 -08:00
Steve Yegge
012ff444db Add --window flag to gt feed for tmux integration (gt-3pm0f)
Phase 2: Adds dedicated tmux window support:
- gt feed --window creates 'feed' window in current session
- If window exists, switches to it (idempotent)
- Always uses --follow mode in window (persistent stream)
- Error handling for non-tmux environments

Users can now C-b n/p to cycle to/from the activity feed.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 09:58:51 -08:00
Steve Yegge
ae8539d7e0 Refinery processes MERGE_READY and sends MERGED (gt-7uhts)
Updated mol-refinery-patrol formula with:
- MERGE_READY handling in inbox-check (parse branch/issue/polecat)
- Mail-based queue instead of git branch scanning
- MERGED mail sent to Witness after successful merge
- Flow diagram showing Witness→Refinery→Witness mail protocol
- Bumped formula version to 2

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 09:58:51 -08:00
Steve Yegge
600c468a9b bd sync: 2025-12-28 09:57:07 2025-12-28 09:58:51 -08:00
Steve Yegge
34ccd121e8 feat: Complete agent bead lifecycle for ZFC compliance
Changes:
1. prime.go: Create agent beads on first prime for all roles including crew
2. done.go: Update agent state to done/stuck/idle when work completes
3. sling.go: Populate hook_bead when work is assigned to agents
4. mol-witness-patrol.formula.toml: Document dead and spawning states

Closes: gt-hymm0, gt-0lop3, gt-59k2x, gt-c4j4j

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 09:56:59 -08:00
Steve Yegge
76b969fb2e Witness sends MERGE_READY to refinery on polecat completion (gt-u6siy)
Updated mol-witness-patrol formula with:
- MERGE_READY mail sent after polecat verification (process-cleanups)
- MERGED mail handling in inbox-check (completes cleanup)
- Cleanup wisp state machine: pending → merge-requested → closed
- Fallback discovery in survey-workers creates cleanup if done polecat
  found without existing wisp

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 09:53:51 -08:00