Witness sends HEALTH_OK mail to mayor on every deacon ping

## Problem

When Deacon sends HEALTH_CHECK nudges to Witnesses, the Witness Claude sessions
respond by sending 'HEALTH_OK' mail to mayor/. This floods the mayor inbox with
routine health check responses.

## Current behavior

```
Deacon: gt nudge gastown/witness 'HEALTH_CHECK from deacon'
Witness: gt mail send mayor/ -s 'HEALTH_OK witness' -m 'OK'
```

This happens every patrol cycle (~30s), flooding mayor inbox.

## Expected behavior

Witnesses should NOT send mail responses to routine health checks. Options:
1. Just acknowledge the nudge (no mail)
2. Respond to deacon, not mayor
3. Update agent bead last_activity timestamp (no mail needed)

## Root cause

Witness Claude sessions are interpreting the HEALTH_CHECK nudge as requiring
a mail response. This is not in the mol-witness-patrol.formula.toml - it's
emergent behavior from the Claude agent.

## Fix options

1. Update witness priming/formula to explicitly say 'do not mail on HEALTH_CHECK'
2. Change deacon to not send HEALTH_CHECK nudges (use different mechanism)
3. Add mail filtering so HEALTH_OK goes to /dev/null for mayor


Digest: mol-deacon-patrol

Patrol 6: Routine, all healthy


Digest: mol-deacon-patrol

Patrol 60: All healthy, 20 cycles complete, handing off


Digest: mol-deacon-patrol

Patrol cycle 2: all healthy, no events


📋 Work Assignment: Polecats must not create GitHub PRs

Issue: gt-44wh
Title: Polecats must not create GitHub PRs
Priority: P1
Type: bug

Description:
Polecats should never use 'gh pr create' or create GitHub pull requests.

## Correct Workflow
1. Polecat works on polecat/<name> branch
2. Commits and pushes to origin
3. Creates beads MR issue (type: merge-request)
4. Refinery processes the MR and merges to main

## Wrong Workflow
- Using gh pr create
- Creating GitHub pull requests directly

## Why
- Refinery is our merge queue processor
- GitHub PRs bypass our workflow
- Beads MRs are the coordination mechanism

## Workflow
1. Run `gt prime` to load polecat context
2. Run `bd sync --from-main` to get fresh beads
3. Work on your task, commit changes regularly
4. Run `bd close <issue-id>` when done
5. Run `bd sync` to push beads changes
6. Push code: `git push origin HEAD`
7. Run `gt done` to signal completion

## Handoff Protocol
Before signaling done, ensure:
- Git status is clean (no uncommitted changes)
- Issue is closed with `bd close`
- Beads are synced with `bd sync`
- Code is pushed to origin

The `gt done` command verifies these and signals the Witness.


Digest: mol-deacon-patrol

Patrol C54: all healthy


Digest: mol-deacon-patrol

Patrol 59: All healthy


Digest: mol-deacon-patrol

Patrol 15: all healthy


Digest: mol-deacon-patrol

Patrol 3: all healthy, inbox empty, no orphans


Digest: mol-deacon-patrol

Patrol #20: All clear - handoff threshold reached


SPAWN: nux starting on gt-uym5

Polecat spawn notification.

Polecat: nux
Issue: gt-uym5
Session: gt-gastown-nux
Spawned by: mayor/

Please monitor this polecat's startup. When Claude is ready (you can see the prompt
in the tmux session), send a nudge to start working:

    tmux send-keys -t gt-gastown-nux "Check your inbox with 'gt mail inbox' and begin working." Enter

The polecat has a work assignment in its inbox.


SPAWN: dementus starting on gt-rana.3

Polecat spawn notification.

Polecat: dementus
Issue: gt-rana.3
Session: gt-gastown-dementus
Spawned by: mayor/

Please monitor this polecat's startup. When Claude is ready (you can see the prompt
in the tmux session), send a nudge to start working:

    tmux send-keys -t gt-gastown-dementus "Check your inbox with 'gt mail inbox' and begin working." Enter

The polecat has a work assignment in its inbox.


Install Go Binary

Single step to rebuild and install the gt binary after code changes.

## Step: install
Build and install the gt binary locally.

Run from the rig directory:
```
go build -o gt ./cmd/gt
go install ./cmd/gt
```

Verify the installed binary is updated:
```
which gt
gt --version  # if version command exists
```


Digest: mol-deacon-patrol

Patrol 3: all systems nominal


mayor Handoff


MR Ready: Pinner (bd-phtv)

Pinner completed. Fixed pin bug. Branch: polecat/Pinner ready for merge. THIS IS THE LAST ONE - all 13 polecats complete!


Digest: mol-deacon-patrol

Patrol 77: All healthy. No incidents.


POLECAT_DONE dementus

Exit: COMPLETED
Issue: bd-au0.9
MR: mr-1766562610-734130af
Branch: polecat/dementus


📋 Work Assignment: test hook pin fix

Issue: bd-ifuw
Title: test hook pin fix
Priority: P2
Type: task

## Workflow
1. Run `gt prime` to load polecat context
2. Work on your task, commit changes regularly
3. Run `bd close <issue-id>` when done
4. Run `bd sync` to push beads changes
5. Push code: `git push origin HEAD`
6. Run `gt done` to signal completion

## Handoff Protocol
Before signaling done, ensure:
- Git status is clean (no uncommitted changes)
- Issue is closed with `bd close`
- Beads are synced with `bd sync`
- Code is pushed to origin

The `gt done` command verifies these and signals the Witness.


Digest: mol-deacon-patrol

Patrol 20: Quiet, all agents healthy


Digest: mol-deacon-patrol

Patrol 11: All healthy


URGENT: Crew workers not receiving Gas Town context

Crew workers wake up not knowing about gt prime, GUPP, or Gas Town.

Root cause:
- beads/CLAUDE.md is project documentation, not Gas Town worker context
- Claude Code reads this static file BEFORE SessionStart hook runs
- If hook fails or output not captured, crew only sees beads project docs
- No mention of gt, hooks, GUPP, propulsion principle anywhere

Symptoms:
- Crew says 'I'm not familiar with gt prime'
- GUPP is dead - crew waits for confirmation instead of executing
- Workers give wikipedia-style summaries instead of working

Immediate fix:
- Add Gas Town bootstrap section at top of beads/CLAUDE.md
- Must include: check gt hook, run gt prime for context, GUPP principle

Root fix (Phase 1 of hq-nm10s):
- Make gt prime more robust
- Ensure hook output is captured reliably
- Dynamic priming replaces static files


Digest: mol-deacon-patrol

Patrol 6: Routine


Digest: mol-deacon-patrol

Patrol cycle 1: no callbacks, no polecats, all agents healthy, cleaned 2 abandoned beads


Digest: mol-deacon-patrol

Patrol cycle 14: quiet


Digest: mol-deacon-patrol

C73: Healthy. 3 convoys open, all witnesses/refineries running.


Digest: mol-deacon-patrol

Patrol cycle: ran gt doctor --fix, created 11 missing agent beads, clone divergence for gus noted


Digest: mol-deacon-patrol

Patrol 11: all healthy


Digest: mol-deacon-patrol

Patrol 3: All healthy, 3 convoys active


📋 Work Assignment: Draft mol-ready-work protomolecule definition

Issue: gt-tnca.1
Title: Draft mol-ready-work protomolecule definition
Priority: P2
Type: task

Description:
Draft the actual protomolecule definition in markdown format.

## Molecule Structure

```markdown
## Molecule: ready-work
Autonomous backlog processing patrol for crew workers.

Phase: vapor (wisp) - ephemeral patrol cycles
Squash: after each work item or context threshold

## Step: orient
Load context and check for interrupts:
- Read mail for overseer instructions
- Check for predecessor handoff
- Load current context state

## Step: scan-backlogs
Survey all backlogs in priority order:
1. gh pr list --state open
2. gh issue list --state open --label untriaged (or no label)
3. bd ready
4. gh issue list --state open --label triaged

Capture counts and candidates.

Needs: orient

## Step: select-work
Apply ROI heuristic to select best work item:
- Estimate size (tokens needed)
- Check remaining context capacity
- Weight by impact (priority, type)
- Select highest ROI achievable item
- If empty: exit patrol

Needs: scan-backlogs

## Step: execute-work
Work the selected item:
- For PRs: review, request changes, or merge
- For untriaged: triage and label
- For beads: implement and close
- For triaged GH: implement fix

Commit, push, close/update as appropriate.

Needs: select-work

## Step: check-context
Assess context state:
- Estimate remaining capacity
- If < 20%: goto handoff
- If ok: loop to scan-backlogs

Needs: execute-work

## Step: handoff
Prepare for session transition:
- Summarize work completed this cycle
- Note any in-progress items
- Send handoff mail to self
- Squash wisp to digest
- Exit for fresh session

Needs: check-context
```

## Variables

- `backlog_priority`: Override backlog scan order
- `context_threshold`: Percentage at which to handoff (default: 20)
- `max_items`: Maximum items to process per session

## Notes

- This is a vapor-phase molecule (wisp)
- Each work item should squash to a digest
- The patrol itself squashes at handoff

## Workflow
1. Run `gt prime` to load polecat context
2. Work on your task, commit changes regularly
3. Run `bd close <issue-id>` when done
4. Run `bd sync` to push beads changes
5. Push code: `git push origin HEAD`
6. Run `gt done` to signal completion

## Handoff Protocol
Before signaling done, ensure:
- Git status is clean (no uncommitted changes)
- Issue is closed with `bd close`
- Beads are synced with `bd sync`
- Code is pushed to origin

The `gt done` command verifies these and signals the Witness.


Digest: mol-deacon-patrol

Patrol cycle 3: all clear


Digest: mol-deacon-patrol

Patrol complete: 0 callbacks, agents healthy, cleaned 1 stale lock


Digest: mol-deacon-patrol

Patrol 9: Routine


Digest: mol-deacon-patrol

Patrol 13: All healthy


Digest: mol-deacon-patrol

Patrol cycle 20: Nominal - preparing handoff


Digest: mol-deacon-patrol

Patrol #16: routine


Digest: mol-deacon-patrol

Patrol 11: Healthy


Digest: mol-deacon-patrol

Patrol 9: routine


Digest: mol-deacon-patrol

Patrol 14: healthy


Digest: mol-deacon-patrol

Patrol 3: Clean


Digest: mol-deacon-patrol

Patrol 4: 5 polecats working. All healthy.


Digest: mol-deacon-patrol

Patrol 2: all agents healthy, no messages, no incidents


Digest: mol-deacon-patrol

Patrol cycle 20: all clear, handoff threshold


Epic: Async Gates for Agent Coordination

## Summary

Agents need an async primitive for waiting on external events (CI completion,
API responses, human approval). Currently they either poll wastefully or can't
resume after handoff.

## Design: Deacon-Managed Gates

### Core Concepts

**Gate** = wisp issue that blocks until external condition is met
- Type: `gate`
- Phase: wisp (never synced, ephemeral)
- Assignee: `deacon/` (Deacon monitors it)
- Fields: `await_type`, `await_id`, `timeout`, `waiters[]`

**Await Types:**
- `gh:run:<id>` - GitHub Actions run completion
- `gh:pr:<id>` - PR merged/closed
- `timer:<duration>` - Simple delay (e.g., "5m", "1h")
- `human:<prompt>` - Human approval required
- `mail:<pattern>` - Wait for mail matching pattern

### Workflow

```
Agent                              Deacon
  |                                   |
  |-- bd gate create                  |
  |     --await gh:run:123            |
  |     --timeout 30m                 |
  |     --notify beads/dave     ----->| (registers gate)
  |                                   |
  |-- handoff & exit                  |
  :                                   |
  :                                   |-- patrol: check gates
  :                                   |-- gh run 123: in_progress
  :                                   |-- gh run 123: in_progress
  :                                   |-- gh run 123: completed
  :                                   |
  |<-- mail: "Gate cleared" ----------|
  |                                   |-- bd gate close <id>
  |-- (new session resumes)           |
```

### Timeout & Escalation

1. Gate created with timeout (e.g., 30m)
2. Deacon tracks elapsed time
3. If timeout reached:
   - Deacon notifies waiters: "Gate timed out"
   - Waiter can: retry, escalate to human, or fail gracefully
4. Witness sees stuck worker, nudges them
5. Worker escalates to human if needed

### Multiple Waiters

Gates support multiple waiters via `waiters[]` array:
```bash
bd gate create --await gh:run:123 --notify agent1 --notify agent2
```

All waiters get notified when gate clears.

### Commands

```bash
# Create gate (returns gate ID)
bd gate create --await <type>:<id> --timeout <duration> --notify <addr>

# Check gate status
bd gate show <id>

# List open gates
bd gate list

# Close gate (usually done by Deacon)
bd gate close <id> --reason "completed"

# Add waiter to existing gate
bd gate wait <id> --notify <addr>
```

### Implementation in Deacon Patrol

```go
func (d *Deacon) checkGates(ctx context.Context) {
    gates, _ := d.store.ListOpenGates(ctx)

    for _, gate := range gates {
        // Check timeout
        if time.Since(gate.CreatedAt) > gate.Timeout {
            d.notifyWaiters(gate, "timeout")
            d.closeGate(gate, "timed out")
            continue
        }

        // Check condition
        if d.checkCondition(gate.AwaitType, gate.AwaitID) {
            d.notifyWaiters(gate, "cleared")
            d.closeGate(gate, "condition met")
        }
    }
}
```

## Children (suggested breakdown)

1. Add `gate` issue type to beads
2. Add gate fields: await_type, await_id, timeout, waiters
3. Implement `bd gate create/show/list/close/wait` commands
4. Add gate checking to Deacon patrol loop
5. Implement await type handlers (gh:run, gh:pr, timer, human, mail)
6. Add gate timeout tracking and notification
7. Integration test: agent waits for CI via gate

## Open Questions

- Should gates live in wisp storage or main storage with wisp flag?
- Do we need a gate catalog (like molecule catalog)?
- Should `waits-for` dep type work with gates?


Digest: mol-deacon-patrol

Patrol 6: town idle, all healthy


SPAWN: furiosa starting on gt-4ev4

Polecat spawn notification.

Polecat: furiosa
Issue: gt-4ev4
Session: gt-gastown-furiosa
Spawned by: mayor/

Please monitor this polecat's startup. When Claude is ready (you can see the prompt
in the tmux session), send a nudge to start working:

    tmux send-keys -t gt-gastown-furiosa "Check your inbox with 'gt mail inbox' and begin working." Enter

The polecat has a work assignment in its inbox.


Digest: mol-deacon-patrol

Patrol 8: healthy


Digest: mol-deacon-patrol

Patrol 1: inbox empty, no polecats to nudge, no gates, all agents healthy, clone divergence (zoey/jack) noted for review


Digest: mol-deacon-patrol

Patrol 4: Routine


Digest: mol-deacon-patrol

Patrol 14: All healthy


Digest: mol-deacon-patrol

Patrol cycle 1: cleaned 1 orphan (gt-boot), all 3 rig witnesses/refineries healthy


Test mail routing

Testing fix for mail visibility


📋 Work Assignment: Implement conditional bond type for mol bond

Issue: bd-kzda
Title: Implement conditional bond type for mol bond
Priority: P3
Type: feature

Description:
The mol bond command accepts 'conditional' as a bond type but doesn't implement any conditional-specific behavior. It currently behaves identically to 'parallel'.

**Expected behavior:**
Conditional bonds should mean 'B runs only if A fails' per the help text (mol.go:318).

**Implementation needed:**
- Add failure-condition dependency handling
- Possibly new dependency type or status-based blocking
- Update bondProtoProto, bondProtoMol, bondMolMol to handle conditional

**Alternative:**
Remove 'conditional' from valid bond types until implemented.

This is new functionality, not a regression.

## Workflow
1. Run `gt prime` to load polecat context
2. Work on your task, commit changes regularly
3. Run `bd close <issue-id>` when done
4. Run `bd sync` to push beads changes
5. Push code: `git push origin HEAD`
6. Run `gt done` to signal completion

## Handoff Protocol
Before signaling done, ensure:
- Git status is clean (no uncommitted changes)
- Issue is closed with `bd close`
- Beads are synced with `bd sync`
- Code is pushed to origin

The `gt done` command verifies these and signals the Witness.


📋 Work Assignment: Improve test coverage for internal/rpc (47.5% → 60%)

Issue: bd-m8ro
Title: Improve test coverage for internal/rpc (47.5% → 60%)
Priority: P2
Type: task

Description:
The RPC package has only 47.5% test coverage. RPC is the communication layer for daemon operations.

Current coverage: 47.5%
Target coverage: 60%

## Workflow
1. Run `gt prime` to load polecat context
2. Work on your task, commit changes regularly
3. Run `bd close <issue-id>` when done
4. Run `bd sync` to push beads changes
5. Run `gt done` to signal completion (branch stays local)

## Handoff Protocol
Before signaling done, ensure:
- Git status is clean (no uncommitted changes)
- Issue is closed with `bd close`
- Beads are synced with `bd sync`

The `gt done` command verifies these and signals the Witness.


Digest: mol-deacon-patrol

Patrol complete: All agents healthy, no callbacks, 16 polecats active, Witness/Refinery running


Digest: mol-deacon-patrol

Patrol 19: routine, all healthy


Digest: mol-deacon-patrol

Patrol complete: 1 handoff processed, all agents healthy (3 rigs), refinery has 21 pending items total


Digest: mol-deacon-patrol

Patrol 100: All healthy, handoff at 20 cycles


🤝 HANDOFF: Side quests ready

Session: Fixed bd mail refs, built bd with mol, gt-b2hj done. Phase 0 done, Phase 1 waiting. Quick: gt-48bs, gt-qivm. Medium: gt-tca, gt-pc5d. Bigger: gt-975, gt-fjvo. Run bd ready.


Digest: mol-deacon-patrol

Patrol 25: routine, all healthy


Research

Investigation workflow.

## Step: investigate
Explore the question. Search code, read docs,
understand context. Take notes.

## Step: document
Write up findings. Include:
- What you learned
- Recommendations
- Open questions
Needs: investigate


Digest: mol-deacon-patrol

Patrol 83: Routine, all healthy


Digest: mol-deacon-patrol

Patrol 6: all healthy


Replace WaitForClaudeReady with gt peek for steady-state agent observation

## Problem

WaitForClaudeReady uses regex to detect Claude's prompt ("> "), which is a ZFC violation - an AI system using pattern matching to detect AI readiness.

## Current State

```go
// Polls looking for "> " at start of line
func WaitForClaudeReady(session string, timeout time.Duration) error {
    for _, line := range lines {
        if strings.HasPrefix(trimmed, "> ") || trimmed == ">" {
            return nil
        }
    }
}
```

Used by:
- Daemon bootstrap (getting Deacon online)
- `gt deacon trigger-pending` (triggering polecats)
- Other agent startup paths

## Architectural Fix

### Bootstrap (ZFC violation acceptable)
During cold town startup, no AI is available. Using regex to get the Deacon online is acceptable - it's the bootstrap exception.

### Steady State (proper ZFC)
Once any agent is running, AI should observe AI:
- **Deacon starting polecats** → Deacon uses `gt peek` to observe them
- **Deacon restarting** → Mayor watches via `gt peek`
- **Mayor restarting** → Deacon watches via `gt peek`

### Implementation

1. Keep `WaitForClaudeReady` for daemon bootstrap only
2. Add `WaitForClaudeReadyAI(session)` that uses `gt peek`
3. Update `gt deacon trigger-pending` to use AI observation
4. Document the bootstrap vs steady-state distinction

## gt peek Integration

`gt peek` should answer: "Is this Claude session ready for input?"
- Can detect ready state
- Can detect error states (crashed, permission denied)
- Robust to prompt format changes


🤝 HANDOFF: Code review mol spawn --attach and mol distill

## Session Summary

Implemented bd-obep: spawn-time bonding with --attach flag.

**Changes in commit 16518223:**
- Added --attach (repeatable) and --attach-type flags to bd mol spawn
- Fixed pre-existing bug in bondProtoMol and bondMolMol that tried to add
  duplicate dependencies (UNIQUE constraint violation)
- Sequential bonds now use blocks type, parallel/conditional use parent-child

## Code Review Requested

Review the following in cmd/bd/mol.go:

### 1. spawn --attach implementation (lines ~254-400)
- Attachment validation and loading
- Variable collection from all attached protos
- Dry-run output for attachments
- Bonding loop after spawning primary molecule

### 2. bondProtoMol fix (lines ~868-898)
- Changed from adding both parent-child + blocks to single dependency
- Sequential uses blocks, parallel/conditional uses parent-child

### 3. bondMolMol fix (lines ~917-934)
- Same pattern as bondProtoMol

### 4. mol distill command (lines ~972+)
- Implemented in previous session (bd-iq19)
- Extracts proto from existing epic
- Supports --var for value→placeholder replacement
- Supports --as for custom proto title

## Review Focus Areas
- Error handling completeness
- Edge cases (empty attachments, missing variables, non-proto attachments)
- Code duplication that could be extracted
- Documentation/comment quality
- Any missing test coverage


POLECAT_STARTED hotel

Issue: bd-yck
Session: gt-beads-hotel


Digest: mol-deacon-patrol

Patrol 17: Routine.


POLECAT_DONE nux

Exit: COMPLETED
Issue: gt-h6eq.1
MR: gt-05cx
Branch: polecat/nux


Digest: mol-deacon-patrol

## Molecule Execution Summary

**Molecule**: mol-deacon-patrol
**Steps**: 9

**Completed**: 9/9

---

### Steps

1. **[closed]** Burn and respawn or loop
   Burn and let daemon respawn, or exit if context high.

Decision point at end of patrol cycle:

If context is LOW:
- Sleep briefly (avoid tight loop)
- Return to inbox-check step

If context is HIGH:
-...

2. **[closed]** Find abandoned work
   Find abandoned work.

Scan for orphaned state:
- Issues marked in_progress with no active polecat
- Polecats that stopped responding mid-work
- Merge queue entries with no polecat owner
- Wisp session...

3. **[closed]** Handle callbacks from agents
   Handle callbacks from agents.

Check the Mayor's inbox for messages from:
- Witnesses reporting polecat status
- Refineries reporting merge results
- Polecats requesting help or escalation
- External ...

4. **[closed]** Execute registered plugins
   Execute registered plugins.

Scan ~/gt/plugins/ for plugin directories. Each plugin has a plugin.md with YAML frontmatter defining its gate (when to run) and instructions (what to do).

See docs/deaco...

5. **[closed]** Check own context limit
   Check own context limit.

The Deacon runs in a Claude session with finite context. Check if approaching the limit:

```bash
gt context --usage
```

If context is high (>80%), prepare for handoff:
- Su...

6. **[closed]** Nudge newly spawned polecats
   Nudge newly spawned polecats that are ready for input.

When polecats are spawned, their Claude session takes 10-20 seconds to initialize. The spawn command returns immediately without waiting. This s...

7. **[closed]** Check Witness and Refinery health
   Check Witness and Refinery health for each rig.

**ZFC Principle**: You (Claude) make the judgment call about what is "stuck" or "unresponsive" - there are no hardcoded thresholds in Go. Read the sign...

8. **[closed]** Clean dead sessions
   Clean dead sessions and orphaned state.

Run `gt doctor -v` to check for issues, then `gt doctor --fix` to clean up.

**⚠ CRITICAL: The Deacon NEVER kills crew workers or polecats!**

The orphan-...

9. **[closed]** Evaluate pending async gates
   Evaluate pending async gates.

Gates are async coordination primitives that block until conditions are met.
The Deacon is responsible for monitoring gates and closing them when ready.

**Timer gates**...


Digest: mol-deacon-patrol

Patrol cycle 201: Mayor restarted (was stalled with 14 unread msgs), closed Formula Molecules convoy (7/7 complete), all agents healthy


Digest: mol-deacon-patrol

Patrol 7: All agents healthy. No incidents.


Digest: mol-deacon-patrol

Patrol 17: Quiet. All healthy.


Digest: mol-deacon-patrol

Patrol cycle 17: All healthy


Chemistry UX: New Beads Commands Needed

## Summary

Overseer and I designed the molecular chemistry UX for Gas Town. Need your help implementing the Beads side.

## New Commands Needed

1. **bd pour <proto>** - Instantiate proto as mol (liquid/persistent)
   - Alias for: bd mol spawn <proto> --pour
   - Creates in permanent .beads/

2. **bd wisp <proto>** - Instantiate proto as wisp (vapor/ephemeral)
   - Alias for: bd mol spawn <proto> (wisp is now default)
   - Creates in .beads-wisp/

3. **bd pin <mol-id> [--for agent]** - Attach mol to agent hook
   - Sets pinned: true and assignee on head bead

4. **bd hook [--agent name]** - Inspect what is on agent hook

## Flag Changes

- Rename --persistent to --pour in bd mol spawn
- Add --pour flag to bd mol bond (force liquid when spawning)

## Digest ID Reservation

When wisp is created, reserve its ID in permanent beads (placeholder).
On squash, replace placeholder with digest. Cross-phase refs stay valid.

## Full Spec

See: gastown/mayor/rig/docs/chemistry-design-changes.md

## Priority

P0 for Christmas launch - gt-3x0z.9 is blocked on this.

## Note

The installed bd v0.33.2 seems outdated - doesnt have --wisp flag that code shows. May need rebuild.


Digest: mol-deacon-patrol

Patrol cycle 7: all clear


DOC: Add gt nudge guidance to mayor template

dispatched_by: mayor

## Problem

Mayor template discourages nudging (line 180: 'NOT your job') but provides no guidance for when Mayor DOES need to kick a stuck refinery/witness.

I (Mayor) reached for `tmux send-keys` which always fails.

## Missing from mayor.md.tmpl

1. **Key Commands → Coordination section**:
```
### Coordination
- `gt nudge <target> "message"` - Send message to agent session
  **ALWAYS use gt nudge, NEVER tmux send-keys** (drops Enter key)
```

2. **Clarify line 180**: Change from 'nudging workers is not your job' to:
```
**NOT your job**: Per-worker cleanup, session killing, routine nudging (Witness handles that)
**Exception**: If refinery/witness is stuck, use `gt nudge refinery "Process MQ"`
```

## Also missing from

- `~/gt/CLAUDE.md` - No nudge guidance at all
- System prompt - No warning about tmux send-keys

## Evidence

The docs exist in reference.md:315-317 and witness.md.tmpl:302 but not in mayor context.


Digest: mol-deacon-patrol

Patrol cycle 7: EXTRAORDINARY - Mayor was stopped, restarted successfully. 3 witnesses healthy. gastown refinery queue stale (14 pending).


Digest: mol-deacon-patrol

Patrol cycle 1: All healthy - gastown (witness/refinery running, 15 MQ), beads (witness/refinery running), wyvern (witness running, refinery stopped/empty). No callbacks, no convoys, no orphans.


POLECAT_STARTED beads/Syncer

Issue: bd-io8c
Session: gt-beads-Syncer


📋 Work Assignment: Work on gt-8tmz.36: Validate expanded step IDs are unique...

Issue: bd-c4wq
Title: Work on gt-8tmz.36: Validate expanded step IDs are unique...
Priority: P2
Type: task

Description:
Work on gt-8tmz.36: Validate expanded step IDs are unique. In internal/formula/, add validation during cooking that checks for duplicate step IDs after expansion. When done: 1) bd close gt-8tmz.36, 2) bd sync, 3) git push, 4) gt mq submit

## Workflow
1. Run `gt prime` to load polecat context
2. Work on your task, commit changes regularly
3. Run `bd close <issue-id>` when done
4. Run `bd sync` to push beads changes
5. Run `gt done` to signal completion (branch stays local)

## Handoff Protocol
Before signaling done, ensure:
- Git status is clean (no uncommitted changes)
- Issue is closed with `bd close`
- Beads are synced with `bd sync`

The `gt done` command verifies these and signals the Witness.


Digest: mol-deacon-patrol

Patrol 20: All healthy, handoff threshold reached


Digest: mol-deacon-patrol

Patrol 20: thorough check complete, all healthy


Digest: mol-deacon-patrol

Patrol cycle 15: quiet


Digest: mol-deacon-patrol

Patrol 1: All healthy, no callbacks, no orphans


Digest: mol-deacon-patrol

Patrol cycle 16: all clear


Digest: mol-deacon-patrol

Patrol 19: Routine.


Digest: mol-deacon-patrol

Patrol 30: healthy


Digest: mol-deacon-patrol

Patrol 3: routine


Digest: mol-deacon-patrol

Patrol #11: 3 polecats active. All healthy.


Digest: mol-deacon-patrol

Patrol 6: healthy


Digest: mol-deacon-patrol

Patrol 10: All healthy, no inbox


Digest: mol-deacon-patrol

Patrol 1: inbox clear, no gates, all agents healthy


Digest: mol-deacon-patrol

Patrol 20: All healthy. Handoff threshold reached.


POLECAT_STARTED beads/nux

Issue: bd-dtl8
Session: gt-beads-nux


📋 Work Assignment: Phase 2.2: gt prime shows ephemeral molecule context

Issue: gt-3x0z.5
Title: Phase 2.2: gt prime shows ephemeral molecule context
Priority: P1
Type: task

Description:
Update gt prime to detect and display ephemeral molecule state.

## Detection

1. Check for active ephemeral molecule assigned to current identity
2. Parse molecule progress (current step, total steps)
3. Show in prime output

## Output

```
🔧 Polecat furiosa, checking in.

📦 Molecule: mol-polecat-work (eph-abc123)
   Step 3/8: do-work
   Source: gt-rixa
   Started: 10 minutes ago

Run 'bd mol status' for full molecule state.
```

## Workflow
1. Run `gt prime` to load polecat context
2. Run `bd sync --from-main` to get fresh beads
3. Work on your task, commit changes regularly
4. Run `bd close <issue-id>` when done
5. Run `bd sync` to push beads changes
6. Push code: `git push origin HEAD`
7. Run `gt done` to signal completion

## Handoff Protocol
Before signaling done, ensure:
- Git status is clean (no uncommitted changes)
- Issue is closed with `bd close`
- Beads are synced with `bd sync`
- Code is pushed to origin

The `gt done` command verifies these and signals the Witness.


Digest: mol-deacon-patrol

Patrol 5: quiet


🤝 HANDOFF: Molecular Chemistry Cleanup filed

## This Session

1. Completed gt-lz13: Updated 4 role templates with bd mol current / bd close --continue
2. Reviewed patrol templates (Deacon, Witness, Refinery) - found major issues
3. Created gt-ingm: Molecular Chemistry Cleanup epic with full inventory

## Key Findings

The OLD model (molecules defined in Go code as structs) conflicts with the CORRECT model:
- Formula (YAML) → cook → Proto (template beads) → pour/wisp → Mol/Wisp

Major issues:
- molecules_*.go files define molecules in Go (45KB of wrong code)
- Protos are empty (mol-witness-patrol has 0 children, mol-refinery-patrol doesn't exist)
- Role templates list steps that should come from beads

## Created Issues

- gt-ingm: Molecular Chemistry Cleanup (6 children with deps)
- bd-8y9t: Remove bd mol spawn - use pour/wisp only (for Dave)

## Next Session

Start gt-ingm.1: Create patrol formula YAML files for:
- mol-deacon-patrol.formula.yaml
- mol-witness-patrol.formula.yaml
- mol-refinery-patrol.formula.yaml

Use molecules_patrol.go as reference for step content, but output as formula YAML.


Digest: mol-deacon-patrol

Patrol 16: nominal


Digest: mol-deacon-patrol

Patrol cycle 2: All witnesses/refineries healthy, no messages, no orphans


Digest: mol-deacon-patrol

Patrol cycle 9: Routine


Digest: mol-deacon-patrol

Patrol 12: healthy


📋 Work Assignment: Audit and standardize JSON output across all commands

Issue: bd-au0.7
Title: Audit and standardize JSON output across all commands
Priority: P1
Type: task

Description:
Ensure consistent JSON format and error handling when --json flag is used.

**Scope:**
1. Verify all commands respect --json flag
2. Standardize success response format
3. Standardize error response format
4. Document JSON schemas

**Commands to audit:**
- Core CRUD: create, update, delete, show, list, search ✓
- Queries: ready, blocked, stale, count, stats, status
- Deps: dep add/remove/tree/cycles
- Labels: label commands
- Comments: comments add/list/delete
- Epics: epic status/close-eligible
- Export/import: already support --json ✓

**Testing:**
- Success cases return valid JSON
- Error cases return valid JSON (not plain text)
- Consistent field naming (snake_case vs camelCase)
- Array vs object wrapping consistency

## Workflow
1. Run `gt prime` to load polecat context
2. Work on your task, commit changes regularly
3. Run `bd close <issue-id>` when done
4. Run `bd sync` to push beads changes
5. Run `gt done` to signal completion (branch stays local)

## Handoff Protocol
Before signaling done, ensure:
- Git status is clean (no uncommitted changes)
- Issue is closed with `bd close`
- Beads are synced with `bd sync`

The `gt done` command verifies these and signals the Witness.


Digest: mol-deacon-patrol

Patrol cycle 5: No messages, 2 convoys still open, cleaned 1 orphan session, all agents healthy.


🤝 HANDOFF: gt-3x0z.9 Done, Binary Freshness Issues

## Session Summary

### Completed
- **gt-3x0z.9**: Deacon wisp-based patrol - DONE (commit ae513a5)
  - Removed checkDeaconAttachment from daemon
  - Updated deacon.md.tmpl for wisp-based patrol

- **gt-a07f**: Closed - Dave finished chemistry commands (bd pour, bd wisp, bd hook)

- **bd-d9mu**: Created cross-rig external dependency feature request in Beads

- **gt-0a90**: Created gt hook command issue

- **gt-q6lg**: Created mol-crew-session issue for crew startup/shutdown protocols

### Issues Found
1. **Mail address mismatch**: beads/dave vs beads/crew/dave
   - Fix exists (commit ebbe886) but wasn't deployed
   - Root cause: fix-gt script didn't copy to ~/go/bin/gt
   - Fixed fix-gt to: rm before cp, sign after copy

2. **gt binary freshness**: crew clones have stale binaries
   - Causes hangs, mail failures, etc.
   - gt-q6lg filed for mol-crew-session startup protocol

### Binary Sync Status
Updated: ~/go/bin/gt, ~/gt/gt, crew/joe/gt, crew/max/gt
Daemon restarted with new binary

### Remaining P1
All done! Only P2 items remain:
- gt-3x0z.10: Witness/Refinery patrol molecules
- gt-3x0z.11: Document ephemeral architecture
- gt-0a90: gt hook command
- gt-q6lg: mol-crew-session

### Start Here
```
bd show gt-3x0z.10  # Next patrol molecule
bd ready            # Find unblocked work
```


Digest: mol-deacon-patrol

Patrol 2: All agents healthy. Gastown (13 pending MQ), beads (8 pending MQ). No callbacks, no orphans.


Digest: mol-deacon-patrol

Patrol 19: Quick cycle.


Digest: mol-deacon-patrol

Patrol 15: Routine


Digest: mol-deacon-patrol

Patrol 6: All healthy.


🤝 HANDOFF: Code review wisp simplification

## Context

Completed wisp simplification integration (gt-fgms + bd-bkul).

## What Was Done

1. Pulled Dave's bd-bkul work from beads repo
2. Found bug: sync_export.go wasn't filtering wisps (autoflush.go was)
3. Fixed by adding wisp filter to sync_export.go
4. Committed and pushed: 9f8b3478

## Code Review Needed

Review these files in ~/gt/beads/crew/dave for correctness:

1. **cmd/bd/sync_export.go** - My fix (wisp filtering)
2. **cmd/bd/mol_squash.go** - Dave's changes (removed cross-store logic)
3. **cmd/bd/mol_burn.go** - Dave's changes (rewritten for main store)
4. **cmd/bd/mol_bond.go** - Dave's changes (--wisp/--pour flags)
5. **cmd/bd/autoflush.go** - Existing wisp filter (reference)

## Key Review Points

- Verify all JSONL export paths filter wisps
- Check mol squash handles wisp children correctly
- Check mol burn rejects non-wisp molecules
- Verify bond --wisp creates Wisp=true in main store
- Look for any other export paths that might leak wisps

## Test Commands

gt mail send gastown/max --wisp -s 'Test' -m 'test'
bd sync
grep wisp ~/gt/.beads/issues.jsonl  # Should find nothing with wisp:true


Digest: mol-deacon-patrol

Patrol 24: All healthy


Digest: mol-deacon-patrol

Patrol 15: All healthy.


Digest: mol-deacon-patrol

Patrol cycle 20: All healthy. 3 rigs operational. No incidents.


Digest: mol-deacon-patrol

Patrol 7: quiet


Simple kill protection: SafeToKill() check + no auto-kill

## Problem
Workers keep getting killed with uncommitted work.

## Simple Solution

### 1. SafeToKill() function
```go
func SafeToKill(worktree string) (bool, string) {
    if hasUncommittedWork(worktree) {
        return false, "uncommitted changes"
    }
    if hasUnpushedCommits(worktree) {
        return false, "unpushed commits"
    }
    return true, "clean"
}
```

### 2. Add check to gt polecat nuke
Refuse to kill if SafeToKill() returns false, unless --force flag.

### 3. Remove auto-kill from Deacon
Deacon should NEVER kill sessions. Report-only via gt doctor.

### 4. gt doctor --fix should not touch sessions
Diagnosis and reporting only. Human decides.

## Acceptance Criteria
- `gt polecat nuke` checks for dirty state before killing
- Deacon has no kill authority
- `gt doctor` never kills sessions

Already implemented in v0.2.3: polecat nuke has multi-layer safety checks, Deacon has no kill authority (dry-run only + death warrants), doctor never kills sessions


Digest: mol-deacon-patrol

Patrol 5: all clear


POLECAT_STARTED beads/rictus

Issue: bd-au0.7
Session: gt-beads-rictus


Digest: mol-deacon-patrol

Patrol 19: all nominal


📋 Work Assignment: Refinery patrol: Add banners and wisp-based execution

Issue: gt-qz2l
Title: Refinery patrol: Add banners and wisp-based execution
Priority: P1
Type: task

Description:
Bring Refinery patrol up to Deacon's level of sophistication:

## Current state
- mol-refinery-patrol exists (needs verification)
- Basic merge queue processing

## Needed
1. **Banners** - Print step banners like Deacon does:
   ```
   ═══════════════════════════════════════════════════════════════
     ⚗ QUEUE-CHECK
     Processing merge queue entries
   ═══════════════════════════════════════════════════════════════
   ```

2. **Wisp-based execution** - Spawn patrol as wisp, squash when complete
3. **Handoff bead attachment** - Refinery needs its own handoff bead with attached_molecule
4. **Loop-or-exit step** - Context-aware cycling like Deacon
5. **Patrol summary banner** at end of each cycle

## Reference
See Deacon patrol implementation in ~/gt/deacon/CLAUDE.md

## Workflow
1. Run `gt prime` to load polecat context
2. Work on your task, commit changes regularly
3. Run `bd close <issue-id>` when done
4. Run `bd sync` to push beads changes
5. Push code: `git push origin HEAD`
6. Run `gt done` to signal completion

## Handoff Protocol
Before signaling done, ensure:
- Git status is clean (no uncommitted changes)
- Issue is closed with `bd close`
- Beads are synced with `bd sync`
- Code is pushed to origin

The `gt done` command verifies these and signals the Witness.


Digest: mol-deacon-patrol

Patrol cycle 7: All quiet


Digest: mol-deacon-patrol

Patrol cycle 6: All agents healthy


Digest: mol-deacon-patrol

Patrol cycle 12: All healthy


Digest: mol-deacon-patrol

Patrol #22: beads/crew/emma active (1h+). All healthy.


Digest: mol-deacon-patrol

Patrol 18: all clear


Digest: mol-deacon-patrol

Patrol 16: All healthy.


Digest: mol-deacon-patrol

Patrol 64: All healthy, 3 convoys, no incidents.


📋 Work Assignment: Update templates with molecule navigation workflow

Issue: gt-lz13
Title: Update templates with molecule navigation workflow
Priority: P1
Type: task

Description:
Update all agent templates to use new molecule navigation commands.

## Commands to integrate
- bd mol current: orientation after startup/handoff (bd-sal9)
- bd close --continue: seamless step transitions (bd-ieyy)

## Templates to update

### prompts/roles/polecat.md
- Add bd mol current to 'Finding Your Work' section
- Replace manual 3-command dance with bd close --continue
- Update 'Working Through Steps' section

### prompts/roles/crew.md
- Add molecule navigation to workflow section
- Show bd mol current for session startup

### prompts/roles/refinery.md
- Update patrol step transitions to use --continue

### prompts/roles/witness.md
- Update patrol step transitions to use --continue

### prompts/roles/deacon.md
- Update patrol step transitions to use --continue

## Key message
The Propulsion Principle: close a step, immediately get handed the next.
No friction, no forgetting, no 3-command dance.

## Blocked by (Beads features)
- bd-sal9: bd mol current
- bd-ieyy: bd close --continue

## Workflow
1. Run `gt prime` to load polecat context
2. Work on your task, commit changes regularly
3. Run `bd close <issue-id>` when done
4. Run `bd sync` to push beads changes
5. Push code: `git push origin HEAD`
6. Run `gt done` to signal completion

## Handoff Protocol
Before signaling done, ensure:
- Git status is clean (no uncommitted changes)
- Issue is closed with `bd close`
- Beads are synced with `bd sync`
- Code is pushed to origin

The `gt done` command verifies these and signals the Witness.


Digest: mol-deacon-patrol

P16: clear


Digest: mol-deacon-patrol

Patrol cycle 6: All healthy.


Digest: mol-deacon-patrol

Patrol 13: Clean


Digest: mol-deacon-patrol

Patrol cycle 8 complete: all clear.


Deacon Patrol

Mayor's daemon patrol loop.

The Deacon is the Mayor's background process that runs continuously,
handling callbacks, monitoring rig health, and performing cleanup.
Each patrol cycle runs these steps in sequence, then loops or exits.

## Step: inbox-check
Handle callbacks from agents.

Check the Mayor's inbox for messages from:
- Witnesses reporting polecat status
- Refineries reporting merge results
- Polecats requesting help or escalation
- External triggers (webhooks, timers)

Process each message:
```bash
gt mail inbox
# For each message:
gt mail read <id>
# Handle based on message type
```

Callbacks may spawn new polecats, update issue state, or trigger other actions.

## Step: health-scan
Ping Witnesses and Refineries.

For each rig, verify:
- Witness is responsive
- Refinery is processing queue
- No stalled operations

```bash
gt status --health
# Check each rig
for rig in $(gt rigs); do
    gt rig status $rig
done
```

Report any issues found. Restart unresponsive components if needed.
Needs: inbox-check

## Step: plugin-run
Execute registered plugins.

Run any plugins registered with the Deacon:
- Custom health checks
- Integration hooks (Slack, GitHub, etc.)
- Metrics collection
- External system sync

Plugins are defined in the Mayor's config and run on each patrol cycle.
Skip this step if no plugins are registered.
Needs: health-scan

## Step: orphan-check
Find abandoned work.

Scan for orphaned state:
- Issues marked in_progress with no active polecat
- Polecats that stopped responding mid-work
- Merge queue entries with no polecat owner
- Wisp sessions that outlived their spawner

```bash
bd list --status=in_progress
gt polecats --all --orphan
```

For each orphan:
- Check if polecat session still exists
- If not, mark issue for reassignment or retry
- File incident beads if data loss occurred
Needs: health-scan

## Step: session-gc
Clean dead sessions.

Garbage collect terminated sessions:
- Remove stale polecat directories
- Clean up wisp session artifacts
- Prune old logs and temp files
- Archive completed molecule state

```bash
gt gc --sessions
gt gc --wisps --age=1h
```

Preserve audit trail. Only clean sessions confirmed dead.
Needs: orphan-check

## Step: context-check
Check own context limit.

The Deacon runs in a Claude session with finite context.
Check if approaching the limit:

```bash
gt context --usage
```

If context is high (>80%), prepare for handoff:
- Summarize current state
- Note any pending work
- Write handoff to molecule state

This enables the Deacon to burn and respawn cleanly.
Needs: session-gc

## Step: loop-or-exit
Burn and let daemon respawn, or exit if context high.

Decision point at end of patrol cycle:

If context is LOW:
- Sleep briefly (avoid tight loop)
- Return to inbox-check step

If context is HIGH:
- Write state to persistent storage
- Exit cleanly
- Let the daemon orchestrator respawn a fresh Deacon

The daemon ensures Deacon is always running:
```bash
# Daemon respawns on exit
gt daemon status
```

This enables infinite patrol duration via context-aware respawning.
Needs: context-check


📋 Work Assignment: Add date and priority filters to bd search

Issue: bd-au0.5
Title: Add date and priority filters to bd search
Priority: P1
Type: task

Description:
Add date and priority filters to bd search for parity with bd list.

## Current State
bd search supports: --status, --type, --assignee, --label, --limit
bd list supports: all of the above PLUS date ranges and priority filters

## Filters to Add

### Priority Filters
```bash
bd search "query" --priority 1           # Exact priority
bd search "query" --priority-min 0       # P0 and above (higher priority)
bd search "query" --priority-max 2       # P2 and below (lower priority)
```

### Date Filters
```bash
bd search "query" --created-after 2025-01-01
bd search "query" --created-before 2025-12-31
bd search "query" --updated-after 2025-01-01
bd search "query" --closed-after 2025-01-01
```

### Content Filters
```bash
bd search "query" --desc-contains "bug"
bd search "query" --notes-contains "todo"
bd search "query" --empty-description    # Issues with no description
bd search "query" --no-assignee          # Unassigned issues
bd search "query" --no-labels            # Issues without labels
```

## Files to Modify

### 1. cmd/bd/search.go
Add flag definitions in init():
```go
searchCmd.Flags().IntP("priority", "p", -1, "Filter by exact priority (0-4)")
searchCmd.Flags().Int("priority-min", -1, "Filter by minimum priority")
searchCmd.Flags().Int("priority-max", -1, "Filter by maximum priority")
searchCmd.Flags().String("created-after", "", "Filter by creation date (YYYY-MM-DD)")
searchCmd.Flags().String("created-before", "", "Filter by creation date")
searchCmd.Flags().String("updated-after", "", "Filter by update date")
searchCmd.Flags().String("updated-before", "", "Filter by update date")
searchCmd.Flags().String("closed-after", "", "Filter by close date")
searchCmd.Flags().String("closed-before", "", "Filter by close date")
searchCmd.Flags().String("desc-contains", "", "Filter by description content")
searchCmd.Flags().String("notes-contains", "", "Filter by notes content")
searchCmd.Flags().Bool("empty-description", false, "Filter issues with empty description")
searchCmd.Flags().Bool("no-assignee", false, "Filter unassigned issues")
searchCmd.Flags().Bool("no-labels", false, "Filter issues without labels")
```

### 2. internal/rpc/protocol.go
Update SearchArgs struct:
```go
type SearchArgs struct {
    Query             string
    Filter            types.IssueFilter
    // Already has most fields via IssueFilter
}
```

Note: types.IssueFilter already has these fields - just need to wire them up!

### 3. cmd/bd/search.go Run function
Parse flags and populate filter:
```go
if priority, _ := cmd.Flags().GetInt("priority"); priority >= 0 {
    filter.Priority = &priority
}
if createdAfter, _ := cmd.Flags().GetString("created-after"); createdAfter != "" {
    t, err := time.Parse("2006-01-02", createdAfter)
    if err != nil {
        FatalError("invalid date format for --created-after: %v", err)
    }
    filter.CreatedAfter = &t
}
// ... similar for other flags
```

## Implementation Steps

1. **Check types.IssueFilter** - verify all needed fields exist
2. **Add flags to search.go** init()
3. **Parse flags** in Run function
4. **Pass to SearchIssues** via filter
5. **Test all combinations**

## Testing
```bash
# Create test issues
bd create "Test P1" -p 1
bd create "Test P2" -p 2 --description "Has description"

# Test filters
bd search "" --priority 1
bd search "" --priority-min 0 --priority-max 1
bd search "" --empty-description
bd search "" --desc-contains "description"
```

## Success Criteria
- All filters work in both direct and daemon mode
- Date parsing handles YYYY-MM-DD format
- --json output includes filtered results
- Help text documents all new flags

## Workflow
1. Run `gt prime` to load polecat context
2. Work on your task, commit changes regularly
3. Run `bd close <issue-id>` when done
4. Run `bd sync` to push beads changes
5. Push code: `git push origin HEAD`
6. Run `gt done` to signal completion

## Handoff Protocol
Before signaling done, ensure:
- Git status is clean (no uncommitted changes)
- Issue is closed with `bd close`
- Beads are synced with `bd sync`
- Code is pushed to origin

The `gt done` command verifies these and signals the Witness.


Digest: mol-deacon-patrol

Patrol cycle 1: All healthy. 3 rigs running. No callbacks, no convoys completed, no orphans.


📋 Work Assignment: test pin fix 2

Issue: gt-0yn0
Title: test pin fix 2
Priority: P2
Type: task

## Workflow
1. Run `gt prime` to load polecat context
2. Work on your task, commit changes regularly
3. Run `bd close <issue-id>` when done
4. Run `bd sync` to push beads changes
5. Push code: `git push origin HEAD`
6. Run `gt done` to signal completion

## Handoff Protocol
Before signaling done, ensure:
- Git status is clean (no uncommitted changes)
- Issue is closed with `bd close`
- Beads are synced with `bd sync`
- Code is pushed to origin

The `gt done` command verifies these and signals the Witness.


Digest: mol-deacon-patrol

Patrol cycle 18: All healthy.


Digest: mol-deacon-patrol

Patrol cycle 10: Nominal


Digest: mol-deacon-patrol

Patrol 19: All healthy.


Digest: mol-deacon-patrol

Patrol cycle 18: all healthy


SPAWN: nux starting on gt-rana.2

Polecat spawn notification.

Polecat: nux
Issue: gt-rana.2
Session: gt-gastown-nux
Spawned by: mayor/

Please monitor this polecat's startup. When Claude is ready (you can see the prompt
in the tmux session), send a nudge to start working:

    tmux send-keys -t gt-gastown-nux "Check your inbox with 'gt mail inbox' and begin working." Enter

The polecat has a work assignment in its inbox.


Digest: mol-deacon-patrol

Patrol 20: routine, handoff threshold reached


Digest: mol-deacon-patrol

Patrol 11: Routine.


Digest: mol-deacon-patrol

Patrol 1: All agents healthy, no callbacks, no orphans, no pending spawns


Digest: mol-deacon-patrol

Patrol cycle 16: gastown/crew/joe started


Digest: mol-deacon-patrol

Patrol 13 complete: all healthy


Digest: mol-deacon-patrol

Patrol 47: All healthy


Digest: mol-deacon-patrol

Patrol 10: routine, no incidents


🤝 HANDOFF: Molecule lifecycle research complete, beads filed

## Session Summary

Deep research session on molecule/wisp lifecycle and "closing out" semantics.

### Key Discoveries Documented

1. **Molecules ARE epics** - The "template" label is the only structural difference for protos.
   Molecules add lifecycle semantics (pour/squash/burn/bond), not structure.

2. **Staleness redefined** - Not time-based. Stale = orphaned (no owner) + blocking other work
   (graph pressure). Created a 2x2 matrix: orphaned × blocking dimensions.

3. **Parallelism is default** - No deps = parallel. Sequential is opt-in via `depends_on`.
   No need for "parallel" labels on parent epics.

4. **progress.Completed/Total** - Computed on-demand from subgraph traversal, not stored fields.

### Beads Filed

- **bd-ujz5**: Explore wiki-style documentation (P3)
- **bd-ul59**: Update molecular chemistry docs with discoveries (P2)
- **bd-anv2**: Implement `bd mol stale` command (P2)
- **bd-6a5z**: Add stale mol check to bd doctor (P3, blocked by bd-anv2)
- **bd-o34a**: Design auto-squash behavior for wisps (P4, backlog)

### Docs Created

- `~/gt/docs/agent-feature-requests.md` - Claude Code feature requests (PostMolComplete hook)

### Decisions Made

- No timestamp tracking needed (compute completion on-demand)
- Staleness detection belongs in patrol molecules, not platform hooks
- Auto-squash is a Gas Town policy decision, not Beads primitive
- `gt handoff` should NOT block on stale mols - patrols handle cleanup

### Ready Work

Run `bd ready` - the chemistry docs update (bd-ul59) is probably the highest value next step.


🤝 HANDOFF: Code review gt-9nf fresh polecat work

## Code Review Request: gt-9nf Fresh Polecat Worktrees

Review the implementation of fresh polecat worktrees in gt spawn.

### Files Changed

1. **internal/polecat/manager.go** - Added `Recreate()` method (~60 lines)
   - Removes old worktree and branch
   - Creates fresh worktree from HEAD
   - Sets up shared beads via redirect

2. **internal/cmd/spawn.go** - Modified spawn logic (~70 lines changed)
   - Checks if polecat exists
   - If exists: safety checks then recreate
   - If not exists: create new (unchanged)

### Review Checklist

- [ ] Error handling in Recreate() - are all failure modes covered?
- [ ] Force flag behavior - does --force bypass the right checks?
- [ ] Branch deletion - is force delete safe? Could lose unpushed work?
- [ ] Worktree cleanup - does WorktreeRemove handle edge cases?
- [ ] Shared beads setup - is redirect file created correctly?
- [ ] Variable shadowing in spawn.go (polecatAddress, router defined twice)

### Test Scenarios

1. Spawn to new polecat name (should create)
2. Spawn to existing idle polecat (should recreate)
3. Spawn to polecat with uncommitted work (should error)
4. Spawn to polecat with uncommitted work + --force (should warn and proceed)
5. Spawn to working polecat (should error, cannot interrupt)

### Context

Commit: 82d718e feat(spawn): always create fresh polecat worktrees
Closed: gt-9nf, gt-tmm, gt-x7c


Digest: mol-deacon-patrol

Patrol #17: All healthy.


Digest: mol-deacon-patrol

Patrol 8: routine, all healthy


SPAWN: rictus starting on gt-3x0z.6

Polecat spawn notification.

Polecat: rictus
Issue: gt-3x0z.6
Session: gt-gastown-rictus
Spawned by: gastown/crew/max

Please monitor this polecat's startup. When Claude is ready (you can see the prompt
in the tmux session), send a nudge to start working:

    tmux send-keys -t gt-gastown-rictus "Check your inbox with 'gt mail inbox' and begin working." Enter

The polecat has a work assignment in its inbox.


Digest: mol-deacon-patrol

Patrol 15: routine, all healthy


Digest: mol-deacon-patrol

Patrol 2: All agents healthy, no incidents.


POLECAT_DONE Errata

Exit: COMPLETED
Issue: bd-qioh
MR: bd-kptp
Branch: polecat/Errata


Digest: mol-deacon-patrol

Patrol cycle 11: all quiet


Digest: mol-deacon-patrol

Patrol 12: All healthy.


Digest: mol-deacon-patrol

Patrol 6: Routine


Digest: mol-deacon-patrol

Patrol C36: All healthy


Test bd archive

Testing bd mail archive


Digest: mol-deacon-patrol

Cycle 21: No callbacks, no convoys, no gates, all agents healthy (gastown 15q, beads 8q, wyvern stopped/0q), cleaned orphan session gt-boot, no orphans, no plugins


Digest: mol-deacon-patrol

Patrol 84: All healthy. 12 polecats working. 3 convoys open. No incidents.


Digest: mol-deacon-patrol

Patrol 16: routine, all healthy


Digest: mol-deacon-patrol

Patrol 17: routine, all healthy


Digest: mol-deacon-patrol

Patrol 5: healthy


Digest: mol-deacon-patrol

Patrol cycle 3: all healthy, no callbacks, no orphans


Digest: mol-deacon-patrol

Patrol cycle 17: all healthy, fixed 1 orphan


Digest: mol-deacon-patrol

Patrol 39: All healthy


🤝 HANDOFF: Critical Review - Mail Routing & Shared Beads

## Critical Infrastructure Review Needed

The mail routing and shared beads implementation is complete but needs thorough validation before launch. This is the orchestration layer - errors here break everything.

## What Was Implemented

### 1. Mail Routing (internal/mail/router.go, mailbox.go)
- Router resolves correct beads DB based on recipient address
- Town-level (mayor/, deacon/) -> ~/gt/.beads
- Rig-level (rig/polecat) -> ~/gt/<rig>/.beads
- Sets BEADS_DIR env var for all bd commands

### 2. Shared Beads for Polecats (internal/polecat/manager.go)
- setupSharedBeads() creates .beads/redirect after worktree creation
- Redirect contains '../../.beads' pointing to rig's shared DB
- Eliminates JSONL merge conflicts between polecat clones

## Review Tasks

### Architecture Docs Overhaul
- [ ] Update docs/architecture.md with two-level beads model
- [ ] Document mail routing flow (sender -> router -> correct beads)
- [ ] Document shared beads redirect mechanism
- [ ] Update CLAUDE.md files for mayor, crew, polecats with accurate info

### Code Review
- [ ] Review router.go: detectTownRoot(), resolveBeadsDir(), isTownLevelAddress()
- [ ] Review mailbox.go: BEADS_DIR usage in all bd command calls
- [ ] Review manager.go: setupSharedBeads() error handling
- [ ] Check edge cases: What if rig .beads doesn't exist? What if redirect is invalid?

### Testing
- [ ] Test: Mayor sends to polecat (should use rig beads)
- [ ] Test: Polecat sends to mayor (should use town beads)
- [ ] Test: Polecat sends to sibling polecat (should use rig beads)
- [ ] Test: Spawn new polecat, verify redirect created
- [ ] Test: bd commands from polecat use shared rig database
- [ ] Test: Multiple polecats can read/write same issues without conflicts

### Edge Cases to Verify
- What happens if town root detection fails?
- What happens if rig beads dir doesn't exist when sending?
- What happens if redirect file is malformed?
- Do crew workers (real .beads, not redirects) still work?

## Files Changed
- gastown/crew/max/internal/mail/router.go
- gastown/crew/max/internal/mail/mailbox.go
- gastown/crew/max/internal/polecat/manager.go
(synced to polecats/nux, polecats/furiosa)

## Key Commit
gastown main: b9f93fc 'feat: implement rig/town-level mail routing and shared beads for polecats'

-- Mayor

Review complete. Found critical branch divergence - feature/rename-harness-to-hq has bd v0.32.0 migration but origin/main has multi-level routing. These need to be merged before testing. Created handoff with details and recommended action. See hq-xxx for follow-up.


Digest: mol-deacon-patrol

Patrol 14: Routine


Digest: mol-deacon-patrol

Patrol cycle 20: All healthy.


Digest: mol-deacon-patrol

Patrol 17


Digest: mol-deacon-patrol

Patrol cycle 18: clean


Digest: mol-deacon-patrol

Patrol 3: Quiet cycle.


Digest: mol-deacon-patrol

Patrol cycle 3: cleaned 1 orphan session, all agents healthy


Digest: mol-deacon-patrol

Patrol cycle 1: All healthy, no incidents


Digest: mol-deacon-patrol

Patrol cycle 18: all clear


Digest: mol-deacon-patrol

Patrol 38: All healthy


Digest: mol-deacon-patrol

Patrol cycle 31: Routine


Convoy System: Cross-Rig Work Orders

## Overview

Convoys are cross-rig work orders that track multiple issues to completion. Unlike epics
(hierarchical decomposition), convoys GROUP work for tracking purposes.

This epic lives in town beads (organization chain) and TRACKS implementation in project chains.

## Key Concepts

- **Convoy**: Cross-rig work order (hq- prefix, type=convoy)
- **War Rig**: Per-rig execution unit (discovered, not tracked)
- **Tracks**: New relation type - convoy tracks issues without blocking them
- **Town Feed**: Aggregated activity from all rigs for cross-rig visibility

## Chain Hierarchy

This epic demonstrates the two-level beads architecture:
- **Organization chain** (hq-*): This coordination epic
- **Project chains**: Implementation tasks below

## Implementation Tasks (Project Chains)

**Beads project chain (bd-*):**
- bd-3roq: Add 'tracks' relation type [P1]
- bd-hj0s: Add 'convoy' issue type with reactive completion [P1]
- bd-dx6e: bd activity --town aggregated feed [P2]

**Gastown project chain (gt-*):**
- gt-frvun: gt convoy create/status/list commands [P2]
- gt-sifj5: gt feed --follow town-level stream [P2]
- gt-wthcc: Deacon convoy patrol steps [P2]
- gt-3eqof: Overseer inbox for strategic notifications [P3]

## Dependency Chain

```
bd-3roq (tracks) ─────────────────────────────────────┐
    │                                                 │
    ▼                                                 │
bd-hj0s (convoy type) ──────────────────┬─────────────┤
                                        │             │
bd-dx6e (bd activity --town)            │             │
    │                                   │             │
    ▼                                   │             │
gt-sifj5 (gt feed)                      │             │
    │                                   │             │
    ▼                                   ▼             ▼
gt-wthcc (Deacon patrol) ◄──────────────┴─────────────┘
    │
    ▼
gt-3eqof (Overseer inbox)
```

## Design Decisions

- Convoys live in town-level beads (hq- prefix)
- Implementation lives in project chains (bd-*, gt-*)
- War Rigs are discovered at display time, not explicitly tracked
- wontfix counts toward completion
- Optional molecule orchestration via --molecule flag

## Reference

- docs/patrol-system-design.md#convoys-and-war-rigs
- docs/PRIMING.md (Chain Hierarchy section)

All 6 implementation tasks completed (tracks relation, convoy type, gt convoy commands, town feed, deacon patrol steps, overseer inbox)


Add 'tracks' relation type to beads

Add a new relation type 'tracks' for convoy → issue relationships. Unlike 'depends_on', tracks is non-blocking. Convoy tracks issues without creating a dependency.

Refiling in correct project chains (bd-* for beads schema, gt-* for gastown CLI)


Add 'convoy' issue type with reactive completion

Add convoy as a new issue type. Convoys auto-close when all tracked issues close (including wontfix). This requires watching for tracked issue closures and triggering convoy completion.


gt convoy create/status/list commands

CLI for convoy management:
- gt convoy create <name> <issues...> [--molecule <mol>] [--notify <addr>]
- gt convoy status [id]
- gt convoy list


Town feed: bd activity --town / gt feed --follow

Aggregated activity feed from all rigs. Uses routes.jsonl to discover rigs. Essential for cross-rig convoy tracking and dependency resolution.


Deacon convoy patrol steps

New Deacon patrol steps:
1. check-convoy-completion - watch for tracked issue closures
2. resolve-external-deps - propagate cross-rig closures
3. fire-notifications - notify overseer on convoy complete


Overseer inbox for strategic notifications

New address overseer/ for strategic notifications:
- Convoy completions
- Cross-rig dep resolutions
- Escalations
- Daily digests


🤝 HANDOFF: Testing handoff command

Just shipped /handoff command globally. User is about to test it on this session. Party mode activated.


🤝 HANDOFF: External deps work complete, ready for next task

## Session Summary

Completed external deps cluster:
- bd-vks2: bd dep tree now shows external deps as synthetic leaf nodes
- bd-mv6h: Added test coverage for external dep edge cases
- bd-d9mu: Closed as superseded (all child work done)

All changes committed and pushed to main (ad02b803).

## Ready Work

Run 'bd ready' - 8 issues available including:
- bd-h0we: Review SQLite indexes and scaling bottlenecks (P2)
- bd-4opy: Refactor long SQLite test files (P2)
- bd-bqcc: Consolidate maintenance commands into bd doctor --fix (P2)
- bd-kzda: Implement conditional bond type for mol bond (P3)
- bd-xsl9: Remove legacy autoflush code paths (P3)

## Notes

- Pre-existing test failure: TestDatabaseReinitialization/database_removal_scenario
  (was failing before my changes, unrelated to external deps work)
- HOP docs read at session start - good strategic context loaded

## Git State

Clean working tree, up to date with origin/main.


Digest: mol-deacon-patrol

Patrol 10: Town quiet, halfway point


Digest: mol-deacon-patrol

## Molecule Execution Summary

**Molecule**: mol-deacon-patrol
**Steps**: 9

**Completed**: 9/9

---

### Steps

1. **[closed]** Check Witness and Refinery health
   Check Witness and Refinery health for each rig.

**ZFC Principle**: You (Claude) make the judgment call about what is "stuck" or "unresponsive" - there are no hardcoded thresholds in Go. Read the sign...

2. **[closed]** Nudge newly spawned polecats
   Nudge newly spawned polecats that are ready for input.

When polecats are spawned, their Claude session takes 10-20 seconds to initialize. The spawn command returns immediately without waiting. This s...

3. **[closed]** Execute registered plugins
   Execute registered plugins.

Scan ~/gt/plugins/ for plugin directories. Each plugin has a plugin.md with YAML frontmatter defining its gate (when to run) and instructions (what to do).

See docs/deaco...

4. **[closed]** Clean dead sessions
   Clean dead sessions and orphaned state.

Run `gt doctor -v` to check for issues, then `gt doctor --fix` to clean up.

**⚠ CRITICAL: The Deacon NEVER kills crew workers or polecats!**

The orphan-...

5. **[closed]** Handle callbacks from agents
   Handle callbacks from agents.

Check the Mayor's inbox for messages from:
- Witnesses reporting polecat status
- Refineries reporting merge results
- Polecats requesting help or escalation
- External ...

6. **[closed]** Find abandoned work
   Find abandoned work.

Scan for orphaned state:
- Issues marked in_progress with no active polecat
- Polecats that stopped responding mid-work
- Merge queue entries with no polecat owner
- Wisp session...

7. **[closed]** Check own context limit
   Check own context limit.

The Deacon runs in a Claude session with finite context. Check if approaching the limit:

```bash
gt context --usage
```

If context is high (>80%), prepare for handoff:
- Su...

8. **[closed]** Evaluate pending async gates
   Evaluate pending async gates.

Gates are async coordination primitives that block until conditions are met.
The Deacon is responsible for monitoring gates and closing them when ready.

**Timer gates**...

9. **[closed]** Burn and respawn or loop
   Burn and let daemon respawn, or exit if context high.

Decision point at end of patrol cycle:

If context is LOW:
- Sleep briefly (avoid tight loop)
- Return to inbox-check step

If context is HIGH:
-...


Digest: mol-deacon-patrol

Patrol 15: quick check


Digest: mol-deacon-patrol

Patrol 19: Routine


Digest: mol-deacon-patrol

Patrol cycle 7: Routine, gastown+wyvern refineries started


Digest: mol-deacon-patrol

Patrol complete: completed prior to handoff


Digest: mol-deacon-patrol

Patrol cycle 1: All agents healthy, no callbacks, no orphans


Digest: mol-deacon-patrol

Patrol cycle 5: all 3 witnesses healthy, refineries stable (gastown 14, beads 8, wyvern 0)


Digest: mol-deacon-patrol

Cycle 20: All healthy, preparing handoff


Digest: mol-deacon-patrol

Patrol 112: All healthy.


Digest: mol-deacon-patrol

Patrol 5: Nudged warboy to handoff (7% context)


Digest: mol-deacon-patrol

Patrol 15: All clear


Digest: mol-deacon-patrol

Patrol 17: all healthy


Digest: mol-deacon-patrol

Patrol #24


Digest: mol-deacon-patrol

Patrol 7 complete: all healthy


Digest: mol-deacon-patrol

Patrol 5: Stable


Digest: mol-deacon-patrol

Patrol 8: Routine, all healthy


Digest: mol-deacon-patrol

Patrol 4: No callbacks, all healthy


Digest: mol-deacon-patrol

Patrol 1: closed 2 convoys (bd-uuo9, bd-p7i2), cleaned 2 stale locks, all agents healthy


Digest: mol-deacon-patrol

Patrol 8: routine, no incidents


Digest: mol-deacon-patrol

Patrol 40: Final cycle - all agents healthy, 3 convoys active


Digest: mol-deacon-patrol

Patrol #1: Inbox empty, all agents healthy (3 witnesses, 2 refineries, mayor), no orphans, no pending spawns, no gates


🤝 HANDOFF: Continue refactoring large files

## Current State
Completed refactoring crew.go (1184 lines → 8 focused modules). All tests pass, pushed to main.

## Next Task
Continue refactoring large files in this order:

| File | Lines |
|------|-------|
| internal/refinery/manager.go | 934 |
| internal/cmd/polecat.go | 836 |
| internal/witness/manager.go | 808 |
| internal/cmd/mail.go | 766 |

## Approach (follow the pattern from mq.go and crew.go)
1. Read the file and identify natural groupings
2. Create new files for each group (e.g., manager_queue.go, manager_merge.go)
3. Move functions to their logical homes
4. Keep main types and init in the primary file
5. Run `go build ./...` and `go test ./...` to verify
6. Commit and push to main

## Notes
- Work directly on main branch (crew worker workflow)
- Run `git pull` first to get latest
- Each file should end up under ~250 lines ideally


Digest: mol-deacon-patrol

Patrol 20: final cycle


Digest: mol-deacon-patrol

Patrol 10: Routine


Digest: mol-deacon-patrol

Patrol 16: Routine


POLECAT_STARTED rictus

Issue: gt-sd6
Session: gt-gastown-rictus


Digest: mol-deacon-patrol

Patrol 10: All systems healthy


Digest: mol-deacon-patrol

Patrol 67


Digest: mol-deacon-patrol

Patrol 3: routine, all clear


Digest: mol-deacon-patrol

Patrol cycle 19: All quiet, 3 rigs healthy


Digest: mol-deacon-patrol

Patrol cycle 21: All agents healthy, 3 convoys active (Hanoi, Boot+Polish, Messaging), nux idle 6h, no callbacks, no incidents


POLECAT_STARTED gastown/rictus


Digest: mol-deacon-patrol

Patrol 15: routine


Digest: mol-deacon-patrol

Patrol 8: all healthy


Digest: mol-deacon-patrol

Patrol 13: routine, all healthy


Deacon Patrol

Mayor's daemon patrol loop for handling callbacks, health checks, and cleanup.


Digest: mol-deacon-patrol

Patrol cycle 2: All healthy, no changes


Digest: mol-deacon-patrol

Patrol 13: quiet cycle


Digest: mol-deacon-patrol

Patrol 53: Stable


Digest: mol-deacon-patrol

Patrol 18: Routine.


Digest: mol-deacon-patrol

Patrol cycle 15: clean


Digest: mol-deacon-patrol

Patrol 30: Full health check - all agents healthy, 3 convoys active


Digest: mol-deacon-patrol

Patrol #5: All clear


Digest: mol-deacon-patrol

Patrol #9: All healthy.


Digest: mol-deacon-patrol

Patrol 52: Stable


Digest: mol-deacon-patrol

Patrol cycle 10: No messages, all agents healthy.


POLECAT_STARTED slit

Issue: gt-g2d
Session: gt-gastown-slit


Digest: mol-deacon-patrol

Patrol cycle 11: All quiet, 3 rigs healthy


🤝 HANDOFF: Code Health Review Epic (bd-tggf)

## Context
Working on Code Health Review Dec 2025: Technical Debt Cleanup epic (bd-tggf).

## Completed This Session
- **bd-4nqq**: Removed dead test code from info_test.go (2 permanently skipped tests)
- **bd-74w1**: Consolidated duplicate path-finding utilities
  - Added git.GetRepoRoot() with Windows path normalization
  - Replaced all findBeadsDir() calls with beads.FindBeadsDir()
  - Removed duplicate function definitions across 8 files

## Remaining Tasks (6)
Run `bd dep tree bd-tggf` to see current state.

Priority order suggestion:
1. **bd-9g1z** (P2) - Fix or remove TestFindJSONLPathDefault - quick win
2. **bd-dhza** (P3) - Reduce global state in main.go - medium effort
3. **bd-ork0** (P3) - Add comments to 30+ ignored errors - tedious but straightforward
4. **bd-05a8** (P2) - Split large files (doctor.go, sync.go) - significant effort
5. **bd-qioh** (P2) - Standardize error handling patterns - medium effort
6. **bd-rgyd** (P2) - Split queries.go - significant effort

## Notes
- Pre-existing flaky test: TestDatabaseReinitialization/database_removal_scenario
  (git operations failing, unrelated to our changes)
- PR #715 reviewed, requested contributor split into separate PRs
- All 38 open GitHub issues are triaged

## Commands to Resume
```bash
bd dep tree bd-tggf    # See epic status
bd show bd-9g1z        # Next suggested task
```


Digest: mol-deacon-patrol

Patrol cycle 4: routine check, all healthy


Digest: mol-deacon-patrol

Patrol 2: Routine cycle, all healthy, cleaned gt-boot orphan


Digest: mol-deacon-patrol

Patrol 10: healthy


Digest: mol-deacon-patrol

Patrol 10: All healthy.


Digest: mol-deacon-patrol

Patrol 4: town idle, all healthy


Digest: mol-deacon-patrol

Patrol 14: All healthy.


Digest: mol-deacon-patrol

Patrol 7: Quiet


Digest: mol-deacon-patrol

Patrol cycle 13: all healthy


🤝 HANDOFF: v0.34.0 release - wisp bd-25c

## Release v0.34.0 - Wisp Handoff

The release commit and tag are pushed. A wisp (bd-25c) tracks remaining steps.

### Wisp Location
```bash
bd --no-daemon --db /Users/stevey/gt/beads/mayor/rig/.beads-wisp/beads.db wisp list
```

### Completed Steps
- ✅ Kill daemons, run tests
- ✅ Update CHANGELOG.md, info.go, all version files
- ✅ Fix orphaned repo_test.go, version threshold test
- ✅ Commit release: 199def9f
- ✅ Push tag v0.34.0
- ✅ go install to ~/go/bin/bd

### Remaining Steps (in wisp)
- bd-pe3: Update Homebrew formula (run ./scripts/update-homebrew.sh 0.34.0)
- bd-eoq: Upgrade local Homebrew (brew upgrade bd)
- bd-xx8: Restart daemon (bd daemon --stop && bd daemon --start)
- bd-6wy: Upgrade beads-mcp (pip install --upgrade beads-mcp)

### When Complete
Squash the wisp to create permanent digest:
```bash
bd --no-daemon mol squash bd-25c --summary "Released v0.34.0: wisp commands, chemistry UX, cross-project deps"
```

This closes the wisp and creates a tombstone in the main .beads/ for the audit trail.


🤝 HANDOFF: Claude Settings Audit & Documentation

## Session Summary

Fixed the spawn priming race condition (gt-6957) with a comprehensive solution:

### What Was Done

1. **Created internal/claude package** with embedded settings templates:
   - settings-autonomous.json: gt prime && gt mail check --inject (SessionStart)
   - settings-interactive.json: gt prime only (SessionStart)

2. **Updated session creation** to ensure settings exist:
   - witness.go: EnsureSettingsForRole() before session
   - refinery/manager.go: EnsureSettingsForRole() before session
   - session/manager.go: EnsureSettingsForRole() for polecats

3. **Removed broken patterns**:
   - time.Sleep + SendKeys('gt prime') in witness
   - time.Sleep + NudgeSession in refinery
   - time.Sleep + Inject(issue) in polecat sessions
   - time.Sleep + NudgeSession in spawn.go

4. **Added trigger-pending-spawns to deacon patrol** (builtin molecule updated)

### Commits
- 588c0f5: Fix spawn priming race (spawn.go + builtin molecule)
- 59d6564: Add Claude settings templates for autonomous roles

### Audit Tasks for Successor

1. **Documentation audit**:
   - Does docs/architecture.md mention Claude settings?
   - Is there a best-practices doc for Gas Town setup?
   - Should we add docs/claude-configuration.md?

2. **gt doctor audit**:
   - Should gt doctor check for .claude/settings.json in worker directories?
   - Verify SessionStart hook has gt prime?
   - Check autonomous roles have mail check in SessionStart?

3. **Consistency check**:
   - Verify all polecats have updated settings (furiosa, nux, slit done)
   - Verify beads rig workers (dave, zoey) have proper settings
   - Check if any other startup code has broken timing patterns

4. **Template sync**:
   - The gastown repo's CLAUDE.md templates may reference old patterns
   - Check prompts/roles/*.md for outdated startup instructions

### Key Files
- internal/claude/settings.go - EnsureSettings function
- internal/claude/config/*.json - Embedded templates
- internal/cmd/witness.go - Updated
- internal/refinery/manager.go - Updated
- internal/session/manager.go - Updated
- internal/cmd/spawn.go - Updated earlier

### Architecture Decision
Autonomous roles (polecat, witness, refinery) need mail in SessionStart because they may be triggered externally. Interactive roles (mayor, crew) rely on UserPromptSubmit since user types first.


Digest: mol-deacon-patrol

Patrol cycle 5: all clear


Digest: mol-deacon-patrol

Patrol 22: All healthy. No incidents.


Quick Fix

Fast path for small changes.

## Step: implement
Make the fix. Keep it focused.

## Step: test
Run relevant tests. Fix any regressions.
Needs: implement

## Step: submit
Submit for merge.
Needs: test


BUG: Formula wisp create produces incomplete/broken molecule

dispatched_by: mayor

When running 'bd mol wisp create mol-deacon-patrol':
1. Only 9 of 12 steps were created
2. Dependencies referenced IDs from a previously burned wisp
3. The parent-child relationship creates circular blocking

This breaks automated patrol execution. The deacon cannot run its loop until this is fixed.

Bug no longer reproduces. Tested wisp creation twice - both created all 12 steps with correct dependencies. The issue may have been a transient state problem (cached IDs from burned wisps) that has since cleared.


Digest: mol-deacon-patrol

Patrol 20: Clean


MR Ready: gt-usy0

Merge request gt-usy0 is ready for processing.

Branch: polecat/rictus → main
Source issue: gt-3x0z.3 (gt doctor ephemeral health checks)

Please review and merge.


Digest: mol-deacon-patrol

Patrol cycle 12: all clear


Digest: mol-deacon-patrol

Patrol 108: All healthy.


Digest: mol-deacon-patrol

Patrol 7: Routine, all healthy


Digest: mol-deacon-patrol

Patrol 10: Clean


Test wisp direct

test body


📋 Work Assignment: Bug: parseLifecycleRequest always matches 'cycle' due to LIFECYCLE prefix

Issue: gt-rixa
Title: Bug: parseLifecycleRequest always matches 'cycle' due to LIFECYCLE prefix
Priority: P2
Type: bug

Description:
In lifecycle.go, parseLifecycleRequest checks strings.Contains(title, "cycle") first, but the prefix "LIFECYCLE:" contains the word "cycle". This means ALL lifecycle messages match the cycle action, making restart and shutdown unreachable. Fix: check for restart/shutdown before cycle, or use word boundaries.

## Workflow
1. Run `gt prime` to load polecat context
2. Run `bd sync --from-main` to get fresh beads
3. Work on your task, commit changes regularly
4. Run `bd close <issue-id>` when done
5. Run `bd sync` to push beads changes
6. Push code: `git push origin HEAD`
7. Run `gt done` to signal completion

## Handoff Protocol
Before signaling done, ensure:
- Git status is clean (no uncommitted changes)
- Issue is closed with `bd close`
- Beads are synced with `bd sync`
- Code is pushed to origin

The `gt done` command verifies these and signals the Witness.


Digest: mol-deacon-patrol

Patrol 6: No callbacks, all healthy


Digest: mol-deacon-patrol

Patrol C62: all healthy


Digest: mol-deacon-patrol

Patrol 17: healthy


🤝 HANDOFF: Code review needed for async gates (bd-udsi)

Time: 2025-12-23T12:08:22-08:00
Role: crew
Action: cycle

## Code Review Needed

Commit 47b86b35 adds async gates for agent coordination (bd-udsi). This is a significant feature that needs review before we consider it production-ready.

### What was implemented:
1. Gate issue type (types.TypeGate)
2. Gate-specific fields: AwaitType, AwaitID, Timeout, Waiters
3. SQLite migration 027_gate_columns
4. CLI commands: bd gate create/show/list/close/wait

### Review focus areas:
- internal/types/types.go - Gate field definitions and ComputeContentHash
- internal/storage/sqlite/migrations/027_gate_columns.go - New migration
- cmd/bd/gate.go - New CLI commands (525 lines)
- All modified storage files (queries.go, transaction.go, etc.)

### Questions to consider:
- Is the Wisp flag correct for gates? (ephemeral by default)
- Should gate commands work via daemon RPC? (currently --no-daemon required)
- Is the await spec parsing robust enough?
- Are the JSON serialization patterns correct for Duration and []string fields?

### Commands to review:
git show 47b86b35 --stat
git show 47b86b35 -- cmd/bd/gate.go

### Remaining epic tasks (in gt, not beads):
bd-is6m, bd-2l03, bd-ykqu, bd-rl5t - Deacon patrol integration


Digest: mol-deacon-patrol

Patrol 4: routine, all healthy


Digest: mol-deacon-patrol

Patrol cycle 8: all healthy


Digest: mol-deacon-patrol

Patrol 18: All healthy.


Digest: mol-deacon-patrol

Patrol 3: routine


POLECAT_DONE india

Exit: COMPLETED
Issue: bd-indn
MR: mr-1766558481-65f7b096
Branch: polecat/india


Digest: mol-deacon-patrol

Patrol #1: All agents healthy. Gastown witness/refinery pinged. 1 stale hook cleaned. 6 convoys active. No incidents.


POLECAT_STARTED gastown/slit

Issue: gt-ci84
Session: gt-gastown-slit


Digest: mol-deacon-patrol

Patrol #11: routine


Digest: mol-deacon-patrol

Patrol 3: Routine, all healthy


Digest: mol-deacon-patrol

Patrol C71: routine


Digest: mol-deacon-patrol

Patrol 3: All systems healthy


Digest: mol-deacon-patrol

Patrol cycle 4: Healthy.


Digest: mol-deacon-patrol

Patrol 12: Quiet


🤝 HANDOFF: Critical Code Review - Branch Merge Needed

## Summary

Completed critical review of mail routing and shared beads implementation per hq-7c8.

## Critical Finding: Branch Divergence

Two parallel development lines need to be merged:

**feature/rename-harness-to-hq** (current branch):
- Pinned sorting (b3ef048)
- bd v0.32.0 migration - uses bd list/create instead of bd mail (5791752)
- Lifecycle SIGUSR1 (e5c88ae)

**origin/main**:
- Multi-level mail routing - town vs rig beads (b9f93fc)
- Shared beads redirect for polecats (fc1f505)
- Still uses bd mail commands

## Key Files Reviewed

### mailbox.go
- Feature branch: Uses `bd list --type message` + BEADS_DIR env var
- Main: Uses `bd mail inbox --json` + BEADS_DIR env var
- Both approaches work; need to pick one

### router.go
- Feature branch: Simple router without town root detection
- Main: Full multi-level routing (detectTownRoot, resolveBeadsDir)
- Main's routing is more complete but uses `bd mail send`

### manager.go (shared beads)
- setupSharedBeads() at line 536 - creates .beads/redirect file
- Points polecat .beads/ to rig .beads/ via relative path
- Called during spawn (line 144), non-fatal on error
- Implementation looks correct

### types.go
- Feature branch: Has ParseLabels() method with cached values
- Main: Inlines label parsing in ToMessage()
- Feature branch approach is cleaner

## Recommended Action

1. Switch to main: `git checkout main && git pull`
2. Merge feature branch: `git merge feature/rename-harness-to-hq`
3. Resolve conflicts by keeping:
   - Main's routing code (detectTownRoot, resolveBeadsDir, multi-level routing)
   - Feature branch's bd command approach (bd list/create instead of bd mail)
   - Feature branch's ParseLabels() method
   - Both pinned sorting implementations (should be similar)
4. Update router.go to use `bd create --type message` instead of `bd mail send`
5. Test mail routing: mayor↔polecat, polecat↔polecat, crew workers

## Files to Watch
- internal/mail/mailbox.go
- internal/mail/router.go
- internal/mail/types.go
- internal/polecat/manager.go

## Context
- bd CLI v0.30.6 has both bd mail and bd list/create
- bd v0.32.0 may have changes that motivated the migration
- The routing on main is critical for multi-agent communication


Digest: mol-deacon-patrol

Patrol 28: routine, all healthy


Digest: mol-deacon-patrol

Patrol 17: Swarm active.


POLECAT_STARTED Syncer

Issue: bd-io8c
Session: gt-beads-Syncer


Digest: mol-deacon-patrol

Patrol cycle 19: all healthy


Digest: mol-deacon-patrol

Patrol 7: Routine, all healthy


Digest: mol-deacon-patrol

Cycle 5: stable


Digest: mol-deacon-patrol

Patrol 12: Town quiet


Digest: mol-deacon-patrol

## Molecule Execution Summary

**Molecule**: mol-deacon-patrol
**Steps**: 9

**Completed**: 9/9

---

### Steps

1. **[closed]** Burn and respawn or loop
   Burn and let daemon respawn, or exit if context high.

Decision point at end of patrol cycle:

If context is LOW:
- Sleep briefly (avoid tight loop)
- Return to inbox-check step

If context is HIGH:
-...

2. **[closed]** Check Witness and Refinery health
   Check Witness and Refinery health for each rig.

**ZFC Principle**: You (Claude) make the judgment call about what is "stuck" or "unresponsive" - there are no hardcoded thresholds in Go. Read the sign...

3. **[closed]** Evaluate pending async gates
   Evaluate pending async gates.

Gates are async coordination primitives that block until conditions are met.
The Deacon is responsible for monitoring gates and closing them when ready.

**Timer gates**...

4. **[closed]** Clean dead sessions
   Clean dead sessions and orphaned state.

Run `gt doctor -v` to check for issues, then `gt doctor --fix` to clean up.

**⚠ CRITICAL: The Deacon NEVER kills crew workers or polecats!**

The orphan-...

5. **[closed]** Find abandoned work
   Find abandoned work.

Scan for orphaned state:
- Issues marked in_progress with no active polecat
- Polecats that stopped responding mid-work
- Merge queue entries with no polecat owner
- Wisp session...

6. **[closed]** Nudge newly spawned polecats
   Nudge newly spawned polecats that are ready for input.

When polecats are spawned, their Claude session takes 10-20 seconds to initialize. The spawn command returns immediately without waiting. This s...

7. **[closed]** Execute registered plugins
   Execute registered plugins.

Scan ~/gt/plugins/ for plugin directories. Each plugin has a plugin.md with YAML frontmatter defining its gate (when to run) and instructions (what to do).

See docs/deaco...

8. **[closed]** Check own context limit
   Check own context limit.

The Deacon runs in a Claude session with finite context. Check if approaching the limit:

```bash
gt context --usage
```

If context is high (>80%), prepare for handoff:
- Su...

9. **[closed]** Handle callbacks from agents
   Handle callbacks from agents.

Check the Mayor's inbox for messages from:
- Witnesses reporting polecat status
- Refineries reporting merge results
- Polecats requesting help or escalation
- External ...


MR Ready: Modular (bd-u2sc.3)

Modular completed. Split cmd/bd files. Branch: polecat/Modular ready for merge.


Digest: mol-deacon-patrol

Patrol 12: all healthy


Digest: mol-deacon-patrol

Patrol 2: All healthy, no events


Digest: mol-deacon-patrol

Patrol 9: Routine, all healthy


Digest: mol-deacon-patrol

Cycle 278: All clear


Digest: mol-deacon-patrol

Patrol 20: Healthy


📋 Work Assignment: Split large cmd/bd files: doctor.go (2948 lines), sync.go (2121 lines)

Issue: bd-05a8
Title: Split large cmd/bd files: doctor.go (2948 lines), sync.go (2121 lines)
Priority: P2
Type: task

Description:
Code health review found several oversized files:

1. doctor.go - 2948 lines, 48 functions mixed together
   - Should split into doctor/checks/*.go for individual diagnostics
   - applyFixes() and previewFixes() are nearly identical

2. sync.go - 2121 lines
   - ZFC (Zero Flush Check) logic embedded inline (lines 213-247)
   - Multiple mode handlers should be extracted

3. init.go - 1732 lines
4. compact.go - 1097 lines
5. show.go - 1069 lines

Recommendation: Extract into focused sub-packages or split into logical files.

## Workflow
1. Run `gt prime` to load polecat context
2. Work on your task, commit changes regularly
3. Run `bd close <issue-id>` when done
4. Run `bd sync` to push beads changes
5. Push code: `git push origin HEAD`
6. Run `gt done` to signal completion

## Handoff Protocol
Before signaling done, ensure:
- Git status is clean (no uncommitted changes)
- Issue is closed with `bd close`
- Beads are synced with `bd sync`
- Code is pushed to origin

The `gt done` command verifies these and signals the Witness.


Digest: mol-deacon-patrol

Patrol 28: healthy


Digest: mol-deacon-patrol

Patrol cycle 13: All healthy.


Digest: mol-deacon-patrol

Patrol 19: Quiet


Digest: mol-deacon-patrol

Patrol 15: Routine, all healthy


Digest: mol-deacon-patrol

Patrol 2: All agents healthy. 2 convoys in progress. No incidents.


📋 Work Assignment: gt polecat git-state command for pre-kill verification

Issue: gt-lnji
Title: gt polecat git-state command for pre-kill verification
Priority: P1
Type: task

Description:
Add git-state subcommand to gt polecat for Witness pre-kill verification.

## Usage
```bash
gt polecat git-state <rig>/<polecat>
```

## Output
```
Git State: gastown/furiosa

  Working Tree: clean | dirty
  Uncommitted:  0 files | N files (list)
  Unpushed:     0 commits | N commits ahead
  Stashes:      0 | N stashes

  Verdict: CLEAN (safe to kill) | DIRTY (needs cleanup)
```

## JSON output (--json flag)
```json
{
  "clean": true,
  "uncommitted_files": [],
  "unpushed_commits": 0,
  "stash_count": 0
}
```

## Used by
- Witness pre-kill verification (mol-witness-patrol)
- Manual cleanup checks

## Implementation
- Check git status in polecat worktree
- Check git log origin/main..HEAD
- Check git stash list

## Workflow
1. Run `gt prime` to load polecat context
2. Work on your task, commit changes regularly
3. Run `bd close <issue-id>` when done
4. Run `bd sync` to push beads changes
5. Push code: `git push origin HEAD`
6. Run `gt done` to signal completion

## Handoff Protocol
Before signaling done, ensure:
- Git status is clean (no uncommitted changes)
- Issue is closed with `bd close`
- Beads are synced with `bd sync`
- Code is pushed to origin

The `gt done` command verifies these and signals the Witness.


Digest: mol-deacon-patrol

Patrol #18: Town idle.


Digest: mol-deacon-patrol

Patrol 1: inbox clear, all witnesses/refineries healthy, no orphans, no plugins


Digest: mol-deacon-patrol

Patrol 35: All healthy


Digest: mol-deacon-patrol

Patrol cycle 24: Routine check, all healthy.


Digest: mol-deacon-patrol

Patrol 1: inbox empty, all agents healthy, no orphans


POLECAT_STARTED slit

Issue: gt-ci84
Session: gt-gastown-slit


Digest: mol-deacon-patrol

Patrol complete: quiet cycle, all agents healthy


Digest: mol-deacon-patrol

Patrol 26: routine, all healthy


🤝 HANDOFF: gt-4u5z complete: Refinery as worktree

## Completed This Session

### gt-4u5z: Refinery as Worktree (Epic - CLOSED)
- Refinery now created as worktree of mayor clone (shares .git)
- Polecat branches stay local (never pushed to origin)
- MRs stored as wisps in .beads-wisp/mq/ (ephemeral)
- Only main pushed to origin after merge
- New mrqueue package for wisp MR storage
- Updated docs/merge-queue-design.md

### Also Done
- Cleaned up 5 orphaned polecat branches from origin (from before this fix)
- Started deacon for patrol

### Ready For
- Swarm work (deacon running, architecture clean)
- Check bd ready for next work


Digest: mol-deacon-patrol

Patrol 9: Healthy


Test popup

Testing new banner


Digest: mol-deacon-patrol

Patrol 4: healthy


Digest: mol-deacon-patrol

Patrol 90: All healthy. No incidents.


Digest: mol-deacon-patrol

Patrol 10: Final patrol this session, all healthy


Digest: mol-deacon-patrol

Patrol cycle 14: all healthy


Digest: mol-deacon-patrol

Patrol 27: All healthy


Digest: mol-deacon-patrol

Patrol cycle 6: clean


Digest: mol-deacon-patrol

Patrol #20: final before handoff


Session ended: gt-gastown-crew-george


🚧 BLOCKED: gt-lz13 - Missing beads features

Polecat scrotus reporting.

My assigned task gt-lz13 (Update templates with molecule navigation workflow)
is blocked. The required beads features don't exist:

- `bd mol current` - command not implemented
- `bd close --continue` - flag not implemented

The gt issues (gt-fly0, gt-qswb) were closed with "Moved to beads: bd-ieyy/bd-sal9"
but those beads issues don't exist in any beads database I can find.

Options:
1. Wait for beads features to be implemented
2. Assign me different work from bd ready list
3. Update templates to reference future commands (risky - agents will try to use them)

Awaiting instructions.


POLECAT_STARTED beads/delta

Issue: bd-m8ro
Session: gt-beads-delta


Digest: mol-deacon-patrol

Patrol #6: All healthy.


Test message for reset

This should be cleared


Digest: mol-deacon-patrol

Patrol 11: quiet cycle


deacon Handoff


Handle callbacks from agents.

Handle callbacks from agents.

Check the Mayor's inbox for messages from:
- Witnesses reporting polecat status
- Refineries reporting merge results
- Polecats requesting help or escalation
- External triggers (webhooks, timers)

Process each message:
```bash
gt mail inbox
# For each message:
gt mail read <id>
# Handle based on message type
```

Callbacks may spawn new polecats, update issue state, or trigger other actions.

instantiated_from: hq-70c
step: inbox-check


Ping Witnesses and Refineries.

Ping Witnesses and Refineries.

For each rig, verify:
- Witness is responsive
- Refinery is processing queue
- No stalled operations

```bash
gt status --health
# Check each rig
for rig in $(gt rigs); do
    gt rig status $rig
done
```

Report any issues found. Restart unresponsive components if needed.

instantiated_from: hq-70c
step: health-scan


Execute registered plugins.

Execute registered plugins.

Run any plugins registered with the Deacon:
- Custom health checks
- Integration hooks (Slack, GitHub, etc.)
- Metrics collection
- External system sync

Plugins are defined in the Mayor's config and run on each patrol cycle.
Skip this step if no plugins are registered.

instantiated_from: hq-70c
step: plugin-run


Find abandoned work.

Find abandoned work.

Scan for orphaned state:
- Issues marked in_progress with no active polecat
- Polecats that stopped responding mid-work
- Merge queue entries with no polecat owner
- Wisp sessions that outlived their spawner

```bash
bd list --status=in_progress
gt polecats --all --orphan
```

For each orphan:
- Check if polecat session still exists
- If not, mark issue for reassignment or retry
- File incident beads if data loss occurred

instantiated_from: hq-70c
step: orphan-check


Clean dead sessions.

Clean dead sessions.

Garbage collect terminated sessions:
- Remove stale polecat directories
- Clean up wisp session artifacts
- Prune old logs and temp files
- Archive completed molecule state

```bash
gt gc --sessions
gt gc --wisps --age=1h
```

Preserve audit trail. Only clean sessions confirmed dead.

instantiated_from: hq-70c
step: session-gc


Check own context limit.

Check own context limit.

The Deacon runs in a Claude session with finite context.
Check if approaching the limit:

```bash
gt context --usage
```

If context is high (>80%), prepare for handoff:
- Summarize current state
- Note any pending work
- Write handoff to molecule state

This enables the Deacon to burn and respawn cleanly.

instantiated_from: hq-70c
step: context-check


Burn and let daemon respawn, or exit if context high.

Decision point at end of patrol cycle:

If context is LOW:
- Sleep briefly (avoid tight loop)
- Return to inbox-check step

If context is HIGH:
- Write state to persistent storage
- Exit cleanly
- Let the daemon orchestrator respawn a fresh Deacon

The daemon ensures Deacon is always running:
```bash
# Daemon respawns on exit
gt daemon status
```

This enables infinite patrol duration via context-aware respawning.

instantiated_from: hq-70c
step: loop-or-exit


POLECAT_STARTED morsov

Issue: gt-4my
Session: gt-gastown-morsov


🤝 HANDOFF: Tmux status line icons

## What We Did

Added icons to tmux status bars for all Gas Town agents:

| Agent | Icon |
|-------|------|
| Mayor | 🎩 |
| Deacon | 🦉 |
| Witness | 👁 |
| Refinery | 🏭 |
| Crew | 👷 |
| Polecat | 😺 |

Icons now appear in TWO places:
1. **Left side**: Before the brackets, e.g. `👷 [gastown/max] crew`
2. **Right side**: In the dynamic status, e.g. `👷 | 16:30`

## What to Expect

User is restarting to test. They should see:
- Left side: `👷 [gastown/max] crew` (icon before brackets)
- Right side: `👷 | HH:MM` (icon with time)

If the time is split across lines (hour on one line, minutes on next), that's a ZWJ emoji bug - we fixed that by avoiding complex emojis.

## Related Beads

Created beads for future polecat mood system:
- gt-aqd8: Witness Patrol Molecule
- gt-u818: Witness Plugin System
- gt-kjnt: Polecat Mood Plugin (standard)
- gt-6y5b: Polecat mood command and status line display

## Files Changed

- internal/cmd/agents.go - AgentTypeIcons map
- internal/cmd/statusline.go - Right side status for all roles
- internal/tmux/tmux.go - Left side roleIcons map + SetStatusFormat


Digest: mol-deacon-patrol

Patrol complete: all healthy, no issues


POLECAT_DONE keeper

Exit: COMPLETED
Issue: gt-h6eq.6
MR: gt-iahc
Branch: polecat/keeper


Digest: mol-deacon-patrol

Patrol #15: routine


Digest: mol-deacon-patrol

Patrol cycle 16: All quiet, 3 rigs healthy


Digest: mol-deacon-patrol

Patrol 12: routine


Start work

Work on gt-qz2l: Refinery patrol banners and wisp-based execution. Read the issue with 'bd show gt-qz2l', implement the fix, test, commit, push, close the issue, then run 'gt done'.


Digest: mol-deacon-patrol

Patrol cycle 14: 17 running, all healthy


Digest: mol-deacon-patrol

Patrol cycle 16: all quiet


POLECAT_DONE Polish

Exit: COMPLETED
Issue: bd-4qfb
MR: bd-ibl9
Branch: polecat/Polish


POLECAT_STARTED tracer

Issue: gt-aobh
Session: gt-gastown-tracer


Digest: mol-deacon-patrol

Patrol cycle 2: All healthy, 3 polecats working, no issues


Digest: mol-deacon-patrol

Patrol 2: all clear


Digest: mol-deacon-patrol

Patrol cycle 20: all healthy, handing off


Digest: mol-deacon-patrol

Patrol 15: All healthy, no inbox


Test routing fix

This should land in town beads


Digest: mol-deacon-patrol

Cycle 265: All clear


Digest: mol-deacon-patrol

Patrol cycle 11: Routine


Digest: mol-deacon-patrol

Patrol cycle 19: All quiet


Digest: mol-deacon-patrol

Patrol cycle: all healthy, no issues


Digest: mol-deacon-patrol

Patrol cycle 10: All agents healthy, 1 orphan cleaned


Digest: mol-deacon-patrol

## Molecule Execution Summary

**Molecule**: mol-deacon-patrol
**Steps**: 9

**Completed**: 9/9

---

### Steps

1. **[closed]** Execute registered plugins
   Execute registered plugins.

Scan ~/gt/plugins/ for plugin directories. Each plugin has a plugin.md with YAML frontmatter defining its gate (when to run) and instructions (what to do).

See docs/deaco...

2. **[closed]** Check own context limit
   Check own context limit.

The Deacon runs in a Claude session with finite context. Check if approaching the limit:

```bash
gt context --usage
```

If context is high (>80%), prepare for handoff:
- Su...

3. **[closed]** Evaluate pending async gates
   Evaluate pending async gates.

Gates are async coordination primitives that block until conditions are met.
The Deacon is responsible for monitoring gates and closing them when ready.

**Timer gates**...

4. **[closed]** Handle callbacks from agents
   Handle callbacks from agents.

Check the Mayor's inbox for messages from:
- Witnesses reporting polecat status
- Refineries reporting merge results
- Polecats requesting help or escalation
- External ...

5. **[closed]** Burn and respawn or loop
   Burn and let daemon respawn, or exit if context high.

Decision point at end of patrol cycle:

If context is LOW:
- Sleep briefly (avoid tight loop)
- Return to inbox-check step

If context is HIGH:
-...

6. **[closed]** Nudge newly spawned polecats
   Nudge newly spawned polecats that are ready for input.

When polecats are spawned, their Claude session takes 10-20 seconds to initialize. The spawn command returns immediately without waiting. This s...

7. **[closed]** Clean dead sessions
   Clean dead sessions and orphaned state.

Run `gt doctor -v` to check for issues, then `gt doctor --fix` to clean up.

**⚠ CRITICAL: The Deacon NEVER kills crew workers or polecats!**

The orphan-...

8. **[closed]** Check Witness and Refinery health
   Check Witness and Refinery health for each rig.

**ZFC Principle**: You (Claude) make the judgment call about what is "stuck" or "unresponsive" - there are no hardcoded thresholds in Go. Read the sign...

9. **[closed]** Find abandoned work
   Find abandoned work.

Scan for orphaned state:
- Issues marked in_progress with no active polecat
- Polecats that stopped responding mid-work
- Merge queue entries with no polecat owner
- Wisp session...


Digest: mol-deacon-patrol

Cycle 6: Clean


Digest: mol-deacon-patrol

Patrol 12: routine, all healthy


Digest: mol-deacon-patrol

Patrol 4: Quiet


Digest: mol-deacon-patrol

Patrol 35: Full check - all agents healthy


Digest: mol-deacon-patrol

Patrol 177: All healthy


Digest: mol-deacon-patrol

Patrol 14: Routine


Digest: mol-deacon-patrol

Patrol 1 complete: inbox empty, all witnesses healthy (gastown/wyvern/beads), all refineries running, no orphans, no pending spawns, doctor run


Digest: mol-deacon-patrol

Patrol complete: Town idle, all agents healthy, 2 open convoys (PR #970, docs), no orphans or zombies


Digest: mol-deacon-patrol

Patrol 2: Routine - all healthy


Digest: mol-deacon-patrol

Patrol 9: 11 polecats working. Swarm ramping up.


Digest: mol-deacon-patrol

Patrol 5: All healthy.


Digest: mol-deacon-patrol

Patrol 9: Routine, all healthy


Digest: mol-deacon-patrol

Patrol cycle 3: Restarted 3 idle agents (gastown/witness, gastown/refinery, wyvern/refinery). No inbox messages, no orphans, 21 sessions healthy.


Digest: mol-deacon-patrol

Patrol 43: Stable


Digest: mol-deacon-patrol

Patrol 14: all healthy


Test CC

Testing CC to overseer

cc:overseer from:gastown/crew/joe thread:thread-6b87426cac87 was:message


Digest: mol-deacon-patrol

Patrol 6: Stable