Commit Graph

1567 Commits

Author SHA1 Message Date
Steve Yegge
fa79d06d0e Add AgentIdentity type for session name parsing (gt-ov2uv)
Create AgentIdentity type to parse and construct session names, replacing
duplicated logic in sling.go and handoff.go.

- Add internal/session/identity.go with AgentIdentity type
- ParseSessionName handles: mayor, deacon, witness, refinery, crew, polecat
- SessionName() reconstructs valid tmux session name
- Address() returns mail-style address (e.g., "gastown/crew/max")
- GTRole() returns GT_ROLE env var format
- Update sling.go:sessionToAgentID to use ParseSessionName
- Update handoff.go:sessionToGTRole to use ParseSessionName
- Add comprehensive unit tests with round-trip verification

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 16:23:15 -08:00
Steve Yegge
6a5d7cb3ec 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:12:13 -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
Steve Yegge
aab15fdf67 bd sync: 2025-12-28 09:49:17 2025-12-28 09:49:17 -08:00
Steve Yegge
f8fc01ecb5 Add gt feed command for activity streaming (gt-3pm0f)
Wraps bd activity with Gas Town integration:
- Default follow mode for streaming
- --rig flag to target specific rig beads
- Passthrough of bd activity flags (--since, --mol, --type, --limit)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 09:46:37 -08:00
Steve Yegge
db1d144fbb feat: gt status shows agent bead hook/state (gt-k5dip)
- Add HookBead and State fields to AgentRuntime struct
- discoverGlobalAgents and discoverRigAgents now look up agent beads
- Display hook_bead ID and work title in status output
- Show agent_state when not idle
- Fall back to legacy Hooks array for rig agents without agent beads

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 09:43:47 -08:00
Steve Yegge
6cfb31419e bd sync: 2025-12-28 09:43:06 2025-12-28 09:43:06 -08:00
Steve Yegge
ec0f314a2d bd sync: 2025-12-28 09:42:29 2025-12-28 09:42:53 -08:00
Steve Yegge
f3a6ef6ca5 feat: Witness reads polecat state from agent beads (gt-gizsv)
Changes:
1. Fix reportAgentState in prime.go to use beads API directly instead of
   non-existent `bd agent state` command. Agents now properly self-report
   their state to their agent beads on startup.

2. Update witness patrol survey-workers step to use agent beads:
   - List polecats via `bd list --type=agent --json`
   - Filter by role_type: polecat in description
   - Check agent_state field (running/idle/stuck/done)
   - Trust agent-reported state (ZFC principle)

No more PID/tmux inference for polecat state - agents self-report.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 09:42:07 -08:00
Steve Yegge
5b0b852eb5 bd sync: 2025-12-28 09:41:53 2025-12-28 09:41:53 -08:00
Steve Yegge
914d81151e bd sync: 2025-12-28 09:35:07 2025-12-28 09:35:17 -08:00
Steve Yegge
b9bb6577f8 bd sync: 2025-12-28 09:34:57 2025-12-28 09:35:17 -08:00
Steve Yegge
f90b7d9817 feat: Auto-create patrol hooks for witness/refinery/deacon (gt-qpoxz)
gt rig add now creates .claude/settings.json with patrol hooks for:
- witness/ directory (SessionStart, PreCompact, UserPromptSubmit hooks)
- refinery/ directory (same hooks)

gt deacon start also creates hooks if not present (idempotent).

These hooks run `gt prime && gt mail check --inject` on session start,
enabling autonomous patrol execution when daemon sends heartbeats.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 09:33:17 -08:00
Steve Yegge
ec870b92d8 bd sync: 2025-12-28 09:33:08 2025-12-28 09:33:08 -08:00
Steve Yegge
e54435bc2c bd sync: 2025-12-28 09:23:07 2025-12-28 09:23:07 -08:00