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