feat(formula): Update mol-polecat-work for ephemeral polecat model (gt-si8rq.4)

- Change polecat contract from wait-for-termination to ephemeral
- Rename close-issue → prepare-for-review (Refinery closes after merge)
- Rename signal-complete → submit-and-exit (polecat recyclable after gt done)
- Bump formula version to 4

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
rictus
2026-01-02 12:09:58 -08:00
committed by Steve Yegge
parent b81c4760fe
commit e2b872af11

View File

@@ -1,22 +1,23 @@
description = """ description = """
Full polecat work lifecycle from assignment through merge-ready handoff. Full polecat work lifecycle from assignment through MR submission.
This molecule guides a polecat through a complete work assignment. Each step This molecule guides a polecat through a complete work assignment. Each step
has clear entry/exit criteria and specific commands to run. A polecat can has clear entry/exit criteria and specific commands to run. A polecat can
crash after any step and resume from the last completed step. crash after any step and resume from the last completed step.
## Polecat Contract ## Polecat Contract (Ephemeral Model)
You are an autonomous worker. You: You are an ephemeral worker. You:
1. Receive work via your hook (pinned molecule + issue) 1. Receive work via your hook (pinned molecule + issue)
2. Execute the work following this formula 2. Execute the work following this formula
3. Signal completion to Witness (who verifies and merges) 3. Submit to merge queue via `gt done`
4. Wait for Witness to terminate your session 4. Become recyclable - Refinery handles the rest
**You do NOT:** **You do NOT:**
- Push directly to main (Refinery merges) - Push directly to main (Refinery merges)
- Kill your own session (Witness does cleanup) - Close your own issue (Refinery closes after merge)
- Skip verification steps (quality gates exist for a reason) - Wait for merge (you're done at MR submission)
- Handle rebase conflicts (Refinery dispatches fresh polecats for that)
## Variables ## Variables
@@ -33,7 +34,7 @@ You are an autonomous worker. You:
| Context filling | Use gt handoff to cycle to fresh session | | Context filling | Use gt handoff to cycle to fresh session |
| Unsure what to do | Mail Witness, don't guess |""" | Unsure what to do | Mail Witness, don't guess |"""
formula = "mol-polecat-work" formula = "mol-polecat-work"
version = 3 version = 4
[[steps]] [[steps]]
id = "load-context" id = "load-context"
@@ -374,21 +375,24 @@ git diff origin/main...HEAD # Your changes (expected)
**Exit criteria:** Branch pushed, workspace clean, no cruft.""" **Exit criteria:** Branch pushed, workspace clean, no cruft."""
[[steps]] [[steps]]
id = "close-issue" id = "prepare-for-review"
title = "Close the assigned issue" title = "Prepare work for review"
needs = ["cleanup-workspace"] needs = ["cleanup-workspace"]
description = """ description = """
Mark the issue as complete in beads. Verify work is complete and ready for merge queue.
**1. Close with a summary:** **Note:** Do NOT close the issue. The Refinery will close it after successful merge.
```bash This enables conflict-resolution retries without reopening closed issues.
bd close {{issue}} --reason "Implemented: <brief summary of what was done>"
```
**2. Verify closure:** **1. Verify the issue shows your work:**
```bash ```bash
bd show {{issue}} bd show {{issue}}
# Status should show 'closed' # Status should still be 'in_progress' (you're working on it)
```
**2. Add completion notes:**
```bash
bd update {{issue}} --notes "Implemented: <brief summary of what was done>"
``` ```
**3. Sync beads:** **3. Sync beads:**
@@ -396,44 +400,55 @@ bd show {{issue}}
bd sync bd sync
``` ```
**Exit criteria:** Issue closed in beads, synced to remote.""" **Exit criteria:** Issue updated with completion notes, beads synced."""
[[steps]] [[steps]]
id = "signal-complete" id = "submit-and-exit"
title = "Signal completion to Witness" title = "Submit to merge queue and exit"
needs = ["close-issue"] needs = ["prepare-for-review"]
description = """ description = """
Notify Witness you're done and wait for termination. Submit your work to the merge queue. You become recyclable after this.
**1. Update your agent state:** **Ephemeral Polecat Model:**
Once you submit, you're done. The Refinery will:
1. Process your merge request
2. Handle rebasing (mechanical rebases done automatically)
3. Close your issue after successful merge
4. Create conflict-resolution tasks if needed (fresh polecat handles those)
**1. Submit with gt done:**
```bash ```bash
# Your agent bead should reflect completion gt done
gt mol done # Or equivalent command
``` ```
**2. Send POLECAT_DONE mail:** This single command:
```bash - Creates an MR bead in the merge queue
gt mail send <rig>/witness -s "POLECAT_DONE $(hostname)" -m "Exit: MERGED - Notifies the Witness (POLECAT_DONE)
Issue: {{issue}} - Updates your agent state to 'done'
Branch: $(git branch --show-current) - Reports cleanup status (ZFC compliance)
Commits: $(git log --oneline origin/main..HEAD | wc -l | tr -d ' ')
Work complete. Ready for merge queue." **2. Verify submission:**
You should see output like:
```
✓ Work submitted to merge queue
MR ID: gt-xxxxx
Source: polecat/<name>
Target: main
Issue: {{issue}}
``` ```
**3. WAIT FOR WITNESS:** **3. You're recyclable:**
Do NOT exit or kill your session. The Witness will: Your work is in the queue. The Witness knows you're done.
1. Verify your git state is clean Your sandbox can be cleaned up - all work is pushed to origin.
2. Send MERGE_READY to Refinery
3. Wait for MERGED confirmation
4. Kill your session
You may see a ~30-60 second delay while this happens. If you have context remaining, you may:
If you don't get killed within 5 minutes, mail Witness again. - Pick up new work from `bd ready`
- Or use `gt handoff` to cycle to a fresh session
**CRITICAL:** Do not exit yourself. Do not run `exit`. Just wait. If the Refinery needs conflict resolution, it will dispatch a fresh polecat.
You do NOT need to wait around.
**Exit criteria:** Witness terminates your session (you won't reach this).""" **Exit criteria:** MR submitted, Witness notified, polecat recyclable."""
[vars] [vars]
[vars.issue] [vars.issue]