Add mol-polecat-work built-in molecule

Defines the standard polecat work lifecycle molecule with 8 steps:
- load-context: Load context and verify assignment
- implement: Do the work, file discovered issues
- self-review: Review changes for bugs and issues
- verify-tests: Run tests, add new ones as needed
- rebase-main: Rebase against main
- submit-merge: Submit to merge queue
- update-handoff: Update handoff state
- request-shutdown: Request witness termination

This molecule enables nondeterministic idempotence for polecat work.
Crash recovery is automatic - restart reads molecule state and continues
from the last completed step.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-19 22:01:17 -08:00
parent c7e83b1619
commit 7b76ffee4c
3 changed files with 154 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ func BuiltinMolecules() []BuiltinMolecule {
ResearchMolecule(),
InstallGoBinaryMolecule(),
BootstrapGasTownMolecule(),
PolecatWorkMolecule(),
}
}
@@ -299,6 +300,97 @@ Needs: sync-beads, install-paths`,
}
}
// PolecatWorkMolecule returns the polecat-work molecule definition.
// This is the full polecat lifecycle from assignment to decommission.
// It's an operational molecule that enables crash recovery and context survival.
func PolecatWorkMolecule() BuiltinMolecule {
return BuiltinMolecule{
ID: "mol-polecat-work",
Title: "Polecat Work",
Description: `Full polecat lifecycle from assignment to decommission.
This molecule enables nondeterministic idempotence for polecat work.
A polecat that crashes after any step can restart, read its molecule state,
and continue from the last completed step. No work is lost.
## Step: load-context
Run gt prime and bd prime. Verify issue assignment.
Check inbox for any relevant messages.
Read the assigned issue and understand the requirements.
Identify any blockers or missing information.
## Step: implement
Implement the solution. Follow codebase conventions.
File discovered work as new issues with bd create.
Make regular commits with clear messages.
Keep changes focused on the assigned issue.
Needs: load-context
## Step: self-review
Review your own changes. Look for:
- Bugs and edge cases
- Style issues
- Missing error handling
- Security concerns
Fix any issues found before proceeding.
Needs: implement
## Step: verify-tests
Run existing tests. Add new tests for new functionality.
Ensure adequate coverage.
` + "```" + `bash
go test ./...
` + "```" + `
Fix any test failures before proceeding.
Needs: implement
## Step: rebase-main
Rebase against main to incorporate any changes.
Resolve conflicts if needed.
` + "```" + `bash
git fetch origin main
git rebase origin/main
` + "```" + `
If there are conflicts, resolve them carefully and
continue the rebase.
Needs: self-review, verify-tests
## Step: submit-merge
Submit to merge queue. Create PR if needed.
Verify CI passes.
` + "```" + `bash
gt done # Signal work ready for merge queue
` + "```" + `
If there are CI failures, fix them before proceeding.
Needs: rebase-main
## Step: update-handoff
Update handoff bead with final state.
File any remaining work as issues.
Document any important context for the next session
or for anyone reviewing the work.
Needs: submit-merge
## Step: request-shutdown
Send shutdown request to Witness.
Wait for termination.
The polecat is now ready to be cleaned up.
Do not exit directly - wait for Witness to kill the session.
Needs: update-handoff`,
}
}
// SeedBuiltinMolecules creates all built-in molecules in the beads database.
// It skips molecules that already exist (by title match).
// Returns the number of molecules created.