Commit Graph

1508 Commits

Author SHA1 Message Date
Steve Yegge
b6f1e32dfd bd sync: beads state update (gt-5eegv) 2025-12-28 02:07:33 -08:00
Steve Yegge
31b663cec2 deacon patrol: 21 cycles complete 2025-12-28 02:07:33 -08:00
Steve Yegge
b27372b6f8 bd sync: 2025-12-28 01:56:58 2025-12-28 02:07:33 -08:00
Steve Yegge
2d6b93f26b fix: Remove PID/tmux state inference (gt-psuw7)
ZFC compliance: daemon becomes pure transport layer, trusting agent beads.

Changes:
- refinery Status(): Simply returns loaded state, no PID/tmux reconciliation
- witness Status(): Simply returns loaded state, no PID inference
- daemon ensureDeaconRunning(): Trusts agent bead state, no tmux fallback
- daemon pokeDeacon(): Trusts agent bead state, no HasSession check

Removed:
- 78 lines of state inference code (PID checks, tmux session parsing)
- "Reconciliation" logic that overwrote agent-reported state

Note: Timeout fallback for dead agents is gt-2hzl4 (separate issue).

Reference: ~/gt/docs/zfc-violations-audit.md

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 01:56:42 -08:00
Steve Yegge
597c6b8071 Add timeout fallback for dead agents (gt-2hzl4)
- Add checkStaleAgents() to detect agents reporting "running" but not updating
- Add markAgentDead() to update agent bead state to "dead"
- Integrate stale agent check into heartbeat cycle
- DeadAgentTimeout set to 15 minutes

This is a safety mechanism for agents that crash without updating their state.
The daemon now marks them as dead so they can be restarted.

Also fixes duplicate AgentFields declaration - now uses beads.go version with
ParseAgentFieldsFromDescription alias in fields.go.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 01:55:52 -08:00
Steve Yegge
a1715fa91f refactor: Move agent field parsing to shared beads package
- Add AgentFields and ParseAgentFieldsFromDescription to internal/beads/fields.go
- Update daemon/lifecycle.go to use shared parsing
- Update cmd/molecule_status.go to use shared parsing
- Remove duplicate parsing code and unused isAgentRunningByBead function

This consolidates agent bead field parsing in one place, following the pattern
established for AttachmentFields and MRFields.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 01:43:43 -08:00
Steve Yegge
4f5b7bf519 bd sync: 2025-12-28 01:37:49 2025-12-28 01:43:43 -08:00
Steve Yegge
d5ecaccc96 bd sync: 2025-12-28 01:37:41 2025-12-28 01:43:43 -08:00
Steve Yegge
b4765c0c69 feat: Add polecat agent bead lifecycle (gt-rxa7v)
Create ephemeral agent beads for ZFC-compliant polecat state tracking.

- Add AgentFields struct and helpers to beads package
  - CreateAgentBead: Creates agent bead with role_type/rig/agent_state
  - UpdateAgentState: Updates agent_state and hook_bead fields
  - DeleteAgentBead: Hard-deletes ephemeral agent bead
  - GetAgentBead: Retrieves and parses agent bead

- Integrate lifecycle in polecat manager:
  - Add(): Creates gt-polecat-<rig>-<name> bead with state=spawning
  - Recreate(): Deletes old bead, creates fresh with state=spawning
  - RemoveWithOptions(): Deletes agent bead on nuke

This enables Witness to read polecat state from beads instead of
tmux scraping. State updates (spawning→working→done) are done by
polecats via bd agent state (separate beads CLI enhancement).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 01:37:22 -08:00
Steve Yegge
d150f339d2 bd sync: 2025-12-28 01:37:11 2025-12-28 01:37:11 -08:00
Steve Yegge
9c47f99767 Daemon reads agent bead state (gt-39ttg)
- Add getAgentBeadState() and getAgentBeadInfo() to read agent state from beads
- Add identityToAgentBeadID() to map daemon identities to agent bead IDs
- Update ensureDeaconRunning() to check agent bead state first (ZFC compliant)
- Add agent bead state logging in executeLifecycleAction()

This is the first step toward ZFC-compliant state detection. Dependent tasks:
- gt-psuw7: Remove PID/tmux state inference
- gt-2hzl4: Add timeout fallback for dead agents

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 01:35:29 -08:00
Steve Yegge
dce8d8bfae refactor: Split beads.go into focused files
- beads.go (512 lines): Core types and bd CLI wrapper operations
- fields.go (327 lines): AttachmentFields and MRFields parsing/formatting
- handoff.go (218 lines): Handoff bead ops, ClearMail, molecule attach/detach
- audit.go (98 lines): Detach audit logging

No functional changes - just reorganization for maintainability.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 01:29:35 -08:00
Steve Yegge
a827b56260 Refinery patrol: Add banners and wisp-based execution (gt-qz2l)
- Add step banners with emojis for each patrol step
- Add startup banner for Refinery initialization
- Add patrol summary banner at end of cycle
- Document wisp-based execution pattern (spawn/squash)
- Add Propulsion Principle for startup protocol
- Update refinery.md.tmpl template
- Update prompts/roles/refinery.md
- Update gastown refinery CLAUDE.md

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 01:22:33 -08:00
Steve Yegge
e3b9abb79b Update gt mol status to use hook slot from agent beads (gt-lisj6)
This change migrates gt mol status from querying by pinned status + assignee
to reading the hook_bead field from agent beads.

Changes:
- Add AgentBeadFields struct to parse agent bead description fields
- Add buildAgentBeadID function to convert identity to agent bead ID
- Update runMoleculeStatus to:
  1. First try to find the agent bead by ID
  2. Read hook_bead from agent bead description
  3. If hook_bead is set, fetch and display that bead
  4. Fall back to legacy pinned-query approach if no agent bead or hook

The implementation is backwards compatible - agents without agent beads
(like polecats before gt-rxa7v is completed) still work via the fallback.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 01:12:21 -08:00
Steve Yegge
a8ca0b1013 docs: Add warning about using gt nudge instead of tmux send-keys
Raw tmux send-keys doesn't work correctly with Claude's input handling.
gt nudge uses literal mode + debounce + separate Enter for reliable delivery.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 00:59:31 -08:00
Steve Yegge
9d09a1f540 fix: Make sling target path parsing more forgiving (gt-e0u3r)
Now accepts:
- gastown/nux (polecat shorthand)
- gastown/Nux (case-insensitive)
- gastown/polecats/nux (explicit path)
- gastown/crew/max (unchanged)
- gastown/witness (unchanged)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 00:54:27 -08:00
Steve Yegge
52b0d27d3e bd sync: 2025-12-28 00:46:52 2025-12-28 00:46:52 -08:00
Steve Yegge
a0ddbe22b0 docs: add mail protocol reference (gt-k294l)
Document inter-agent mail types:
- POLECAT_DONE, MERGE_READY, MERGED
- WITNESS_PING, HELP, HANDOFF

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 00:17:25 -08:00
Steve Yegge
4f95e33fe1 bd sync: agent beads created 2025-12-28 00:12:13 -08:00
Steve Yegge
a8145010d6 bd sync: 2025-12-28 00:08:31 2025-12-28 00:08:31 -08:00
Steve Yegge
19042c09b2 bd sync: 2025-12-28 00:03:29 2025-12-28 00:03:29 -08:00
Steve Yegge
2d05da9dcc bd sync: 2025-12-27 23:38:14 2025-12-27 23:38:14 -08:00
Steve Yegge
9c3f89a392 bd sync: 2025-12-27 22:17:30 2025-12-27 22:17:30 -08:00
Steve Yegge
eb73ed51ae bd sync: 2025-12-27 22:13:56 2025-12-27 22:13:56 -08:00
Steve Yegge
393d2fd689 bd sync: 2025-12-27 21:34:40 2025-12-27 21:34:48 -08:00
Steve Yegge
7cba83cac5 bd sync: 2025-12-27 20:09:39 2025-12-27 21:34:48 -08:00
Steve Yegge
879018f35d fix: gt commands follow .beads/redirect for shared beads (gt-ln5af)
Added ResolveBeadsDir() helper that follows .beads/redirect files,
enabling crew workers and polecats to properly access shared beads.

Updated callers:
- mailbox.go: NewMailboxFromAddress follows redirect
- catalog.go: LoadCatalog follows redirect at all levels
- doctor checks: beads_check, patrol_check, wisp_check follow redirect

Also added comprehensive tests for the redirect resolution logic.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 21:34:22 -08:00
Steve Yegge
f443cd6637 feat: Add routes-config check to gt doctor (gt-p3yhp)
Adds a new fixable doctor check that verifies beads routing configuration:
- Checks if routes.jsonl exists
- Verifies all rigs have routing entries (by path, not just prefix)
- Validates that routes point to valid locations with .beads directories
- Can auto-fix by adding missing routes with --fix

The check is smart about prefix mismatches: if a rig already has a route
by path (e.g., gastown/mayor/rig), it won't report it as missing even if
the prefix in rigs.json differs from what's in routes.jsonl.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 20:09:27 -08:00
Steve Yegge
e71e8676ae bd sync: 2025-12-27 20:02:37 2025-12-27 20:02:37 -08:00
Steve Yegge
45854106c2 bd sync: 2025-12-27 19:27:37 2025-12-27 19:27:37 -08:00
Steve Yegge
6b4c0e3a08 bd sync: 2025-12-27 19:19:15 2025-12-27 19:19:15 -08:00
Steve Yegge
8e337dad6a bd sync: 2025-12-27 19:13:31 2025-12-27 19:13:31 -08:00
Steve Yegge
6a053a767e Add CLI audit issues (gt-et72q, gt-tzogh, gt-361qj) 2025-12-27 18:21:03 -08:00
Steve Yegge
d4c076451c Fix gt mol status: cross-rig scanning for town-level roles (gt-4ol8f)
When mayor/deacon checks their hook from ~/gt, gt mol status now scans all
registered rigs for pinned beads. This ensures the propulsion principle works
regardless of which directory the agent starts in.

The scan uses routes.jsonl to find all rig beads directories.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 17:53:38 -08:00
Steve Yegge
2788996e74 Revert "Fix gt sling/hook: use Town beads for town-level roles (gt-4ol8f)"
This reverts commit ed9816015d.
2025-12-27 17:51:52 -08:00
Steve Yegge
ed9816015d Fix gt sling/hook: use Town beads for town-level roles (gt-4ol8f)
When slinging or hooking work to mayor/deacon, the pin now lands in Town
beads (~/.beads/) instead of rig beads. This ensures gt mol status finds
the pinned work when run from ~/gt.

The issue was that town-level roles operate from the town root, so their
hooks should be discoverable from there.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 17:46:43 -08:00
Steve Yegge
711515506c Fix witness template: use two-step pattern for wisp creation (gt-et72q)
The template incorrectly used --assignee flag on bd mol wisp which doesn't
exist. Changed to two-step pattern matching deacon template.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 17:34:24 -08:00
Steve Yegge
4730ac508f polecat: fresh unique branches per run, add gc command (gt-ake0m)
Changed polecat branch model to use unique timestamped branches
(polecat/<name>-<timestamp>) instead of reusing persistent branches.
This prevents JSONL drift issues where stale polecat branches don't
have recently created beads.

Changes:
- Add(): create unique branch, simplified (no reuse logic)
- Recreate(): create fresh branch, old ones left for GC
- loadFromBeads(): read actual branch from git worktree
- CleanupStaleBranches(): remove orphaned polecat branches
- ListBranches(pattern): new git helper for branch enumeration
- gt polecat gc: new command to clean up stale branches

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 17:19:02 -08:00
Steve Yegge
3aa0ba6e6b bd sync: 2025-12-27 17:12:47 2025-12-27 17:12:47 -08:00
Steve Yegge
921e57309b fix: gt crew next returns success for non-crew sessions (gt-1s89v)
When run in a non-crew session (Mayor, Witness, Refinery, Deacon),
gt crew next/prev now returns success (exit 0) instead of an error.

These sessions don't have cycle groups, so pressing C-b n should
simply do nothing rather than fail with an error message.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 16:48:26 -08:00
Steve Yegge
4934131272 bd sync: 2025-12-27 16:48:16 2025-12-27 16:48:16 -08:00
Steve Yegge
be8b98c9eb refactor: remove unused Beads.Pin/Unpin methods (bd-x0zl)
These methods called `bd pin` and `bd unpin` which have been removed.
Neither method was ever called - gt uses `bd update --status=pinned` instead.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 16:02:23 -08:00
Steve Yegge
3ae39f2eb0 Fix CLI mismatches from bd-2fs7 (wisp->ephemeral) (gt-pu1t5)
bd-2fs7 moved wisp/pour under bd mol, but gastown was not updated.
This caused handoff failures - gt mail send errored with 'unknown flag: --wisp'.

Changes:
- router.go: --wisp -> --ephemeral for bd create
- patrol_helpers.go: bd wisp create -> bd mol wisp create
- wisp_check.go: bd wisp gc -> bd mol wisp gc

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 15:01:02 -08:00
Steve Yegge
bebb7b0f61 bd sync 2025-12-27 14:50:35 -08:00
Steve Yegge
67e1b1b06e Add gt crew restart --all for batch crew restarts
- Add --all flag to restart all running crew sessions
- Add --dry-run flag to preview without restarting
- Add --rig filter to target specific rig
- Extract restartCrewSession helper for reuse

🤝 Filed gt-1kljv for adding tests

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 14:50:35 -08:00
Steve Yegge
95d45b3665 bd sync: 2025-12-27 14:47:27 2025-12-27 14:50:35 -08:00
Steve Yegge
dccb698d37 bd sync: 2025-12-27 14:35:47 2025-12-27 14:50:35 -08:00
Steve Yegge
7f77491080 docs: Clarify gt mol vs bd mol command distinction
Update reference.md to explain the separation:
- bd mol: beads data operations (list, show, pour, wisp, bond)
- gt mol: agent operations (status, current, attach, burn, squash)

Key clarification: gt mol burn/squash operate on current agent's
attached molecule (auto-detected), while bd mol burn/squash take
explicit molecule IDs.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 14:47:21 -08:00
Steve Yegge
888bc3ea74 refactor: Remove duplicate mol commands from gt (gt-w91xz)
Remove beads data operations from gt mol, delegating to bd:
- catalog → bd formula list
- list → bd mol list
- show → bd mol show
- parse → bd mol show
- instantiate → bd mol pour
- instances → bd queries
- bond → bd mol bond

Keep agent-specific operations:
- status, current, progress (agent context queries)
- attach, detach, attachment, attach-from-mail (hook management)
- step (agent step operations)
- burn, squash (agent-aware lifecycle)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 14:36:12 -08:00
Steve Yegge
ce3ae5b18e fix: Don't persist namepool theme in state file
Theme is configuration (from settings/config.json), not runtime state.
Loading theme from state file was causing rig config to be ignored,
which is why the beads rig kept using mad-max names instead of minerals.
2025-12-27 14:19:14 -08:00