Commit Graph

1553 Commits

Author SHA1 Message Date
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
Steve Yegge
0d75fd2675 bd sync: 2025-12-28 09:20:06 2025-12-28 09:20:06 -08:00
Steve Yegge
34f5ef0e93 feat: Wire witness patrol formula to daemon cron (gt-qpoxz)
Adds witness patrol to daemon heartbeat cycle:
- ensureWitnessesRunning(): Start witness for each rig if not running
- pokeWitnesses(): Send heartbeat messages to all witnesses
- getKnownRigs(): Read rig list from mayor/rigs.json

The daemon now ensures both Deacon and Witnesses are running
and sends periodic heartbeats to trigger their patrol molecules.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 02:44:37 -08:00
Steve Yegge
634dd7761c docs: clarify RoleBead semantics in agent bead creation
Added comments explaining that RoleBead establishes a naming convention
for the canonical location of role definitions. The referenced bead may
not exist yet - this enables tooling like gt doctor to check for and
scaffold missing role beads.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 02:43:06 -08:00
Steve Yegge
2ae7bd24a3 feat: gt doctor checks agent beads exist (gt-bq4wo)
Adds agent-beads-exist check to gt doctor:
- Verifies witness/refinery beads exist for each rig
- Verifies deacon/mayor beads exist in first rig
- Supports --fix to create missing agent beads
- Skips non-gt prefixes (beads library limitation)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 02:40:00 -08:00
Steve Yegge
315206e593 bd sync: 2025-12-28 02:26:23 2025-12-28 02:26:42 -08:00
Steve Yegge
38b6878c02 feat: gt rig add creates agent beads (gt-h3hak, gt-pinkq)
Bootstrap now creates agent beads for ZFC compliance:
- Always: <prefix>-witness-<rig>, <prefix>-refinery-<rig>
- First rig only: <prefix>-deacon, <prefix>-mayor

Agent beads are created in the rig's beads database (not town beads)
because the daemon looks up beads by prefix routing.

Changes:
- internal/rig/manager.go: Added initAgentBeads() function
- internal/cmd/install.go: Added comment explaining why beads aren't
  created here (no rig exists yet at install time)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 02:26:16 -08:00
Steve Yegge
703234cf80 bd sync: 2025-12-28 02:25:50 2025-12-28 02:25:50 -08:00
Steve Yegge
5b867332c2 bd sync: 2025-12-28 02:17:54 2025-12-28 02:17:54 -08:00
Steve Yegge
60176bd9f1 feat: polecat remove accepts just name when in rig context
parseAddress now infers rig from cwd when no slash in address.
Makes 'gt polecat remove slit' work from within gastown/.
2025-12-28 02:17:09 -08:00
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