Commit Graph

23 Commits

Author SHA1 Message Date
Steve Yegge
f00b0254f2 feat(config): add OpenCode as built-in agent preset (#861)
Add AgentOpenCode as a first-class built-in agent preset, similar to
Claude, Gemini, Codex, Cursor, Auggie, and AMP.

OpenCode preset configuration:
- Command: "opencode"
- Args: [] (uses Env for YOLO mode, no CLI flags needed)
- Env: OPENCODE_PERMISSION='{"*":"allow"}' for auto-approve
- ProcessNames: ["opencode", "node"] (runs as Node.js)
- SupportsHooks: true (uses .opencode/plugin/gastown.js)
- NonInteractive: run subcommand with --format json

Runtime defaults for opencode provider:
- ready_delay_ms: 8000 (delay-based detection for TUI)
- process_names: [opencode, node]
- instructions_file: AGENTS.md

This allows users to simply configure:
  role_agents:
    refinery: "opencode"

Instead of manually configuring agents.json and runtime settings.

Test coverage:
- TestOpenCodeAgentPreset: comprehensive preset validation
- TestOpenCodeProviderDefaults: runtime config defaults
- TestOpenCodeRuntimeConfigFromPreset: Env copying
- TestIsKnownPreset: includes opencode
- TestGetAgentPresetByName: opencode returns preset

Templates added:
- templates/agents/opencode.json.tmpl: agent config template
- templates/agents/opencode-models.json: model delay presets

Co-authored-by: Avyukth <subhrajit.makur@hotmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 17:20:57 -08:00
mayor
5ecf8ccaf5 docs: add batch-closure heresy warning to priming
Molecules are the LEDGER, not a task checklist. Each step closure
is a timestamped CV entry. Batch-closing corrupts the timeline.

Added explicit warnings to:
- molecules.md (first best practice)
- polecat-CLAUDE.md (new 🚨 section)

The discipline: mark in_progress BEFORE starting, closed IMMEDIATELY
after completing. Never batch-close at the end.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 04:05:40 -08:00
furiosa
ae2fddf4fc fix: add Idle Polecat heresy warnings to polecat templates (gt-c7ifqm)
Add prominent warnings about the mandatory gt done requirement:
- New 'THE IDLE POLECAT HERESY' section at top of both templates
- Emphasize that sitting idle after completing work is a critical failure
- Add MANDATORY labels to completion protocol sections
- Add final reminder section before metadata block

This addresses the bug where polecats complete work but don't run gt done,
sitting idle and wasting resources instead of properly shutting down.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 15:46:57 -08:00
gastown/crew/joe
98b11eda3c docs: clarify polecat three-state model (working/stalled/zombie)
Polecats have exactly three operating conditions - there is no idle pool:
- Working: session active, doing assigned work
- Stalled: session stopped unexpectedly, never nudged back
- Zombie: gt done called but cleanup failed

Key clarifications:
- These are SESSION states; polecat identity persists across sessions
- "Stalled" and "zombie" are detected conditions, not stored states
- The status:idle label only applies to persistent agents, not polecats

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 02:20:30 -08:00
gus
8219fd5abe feat(polecat): self-cleaning model and new review formulas
Polecats now self-clean when done:
- gt done always exits session (no more --exit flag needed)
- gt done requests self-nuke (sandbox cleanup)
- No idle polecats - done means gone
- Refinery re-implements on conflict (never sends work back)

New formulas:
- mol-polecat-review-pr: review external PRs, approve/reject
- mol-polecat-code-review: review code, file beads for findings

Docs updated:
- polecat-lifecycle.md: self-cleaning model, identity vs session
- polecat-CLAUDE.md: updated contract and completion protocol
- mol-polecat-work: updated for self-cleaning

Implementation beads filed:
- gt-yrz4k: gt done always exits
- gt-fqcst: polecat self-nuke mechanism
- gt-zdmde: abstract work unit completion

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 17:11:55 -08:00
joe
bfafb9c179 docs: add explicit no-PR rule for maintainer repos
Polecats were creating GitHub PRs instead of using gt done to submit
to the Refinery. Added clear conditional language:

- If repo is steveyegge/beads or steveyegge/gastown: NEVER create PRs
- Polecats use gt done → Refinery merges
- Crew workers push directly to main
- PRs are for external contributors only

This fixes a prompting gap that led to PR #292 being created incorrectly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 22:47:39 -08:00
gastown/crew/max
ac4649ba7d docs(polecat): remove push instructions for local-only branches (gt-cqw0n)
Phase 3 of heresy correction: polecat branches stay local, Refinery
accesses them via shared .repo.git.

Changes:
- templates/polecat-CLAUDE.md: Remove push from completion checklist
- mol-polecat-work.formula.toml: Remove push step from cleanup-workspace
- polecat.md.tmpl: Update landing rule for local branches
- refinery.md.tmpl: Change origin/polecat to local branch references

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-06 13:11:54 -08:00
chumbucket
4b8b444133 docs: document polecat lifecycle (session/sandbox/slot layers)
Clarifies the three distinct lifecycle layers to prevent confusion:
- Session (Claude context): ephemeral, cycles per step
- Sandbox (worktree): persistent until nuke
- Slot (name from pool): persistent until nuke

Addresses anti-patterns like "idle polecats" and misunderstanding
what recycling means. (gt-bc6gm)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 14:27:09 -08:00
max
37ae702427 docs: Clarify formula vs molecule semantics - formulas are NOT instructions
PROBLEM: Agents were reading formula files directly and manually creating beads
for each step, rather than using the cook→pour→molecule pipeline.

FIXES:
- polecat-CLAUDE.md: Changed "following the formula" to "work through your
  pinned molecule" and added explicit anti-pattern warning
- mol-polecat-work.formula.toml: Added note that formula defines template,
  use bd ready to find step beads
- docs/molecules.md: Added "Common Mistake" section with WRONG/RIGHT examples
- mol-*.formula.toml (5 files): Changed "execute this formula" to "work
  through molecules (poured from this formula)"

The key insight: Formulas are source templates (like source code). You never
read them directly. The cook → pour pipeline creates step beads for you.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 17:26:08 -08:00
furiosa
c2dee85617 docs(polecat): Update template to use gt done --exit (gt-x4ad3)
Update polecat template to reflect the new --exit flag behavior:
- Completion checklist now uses `gt done --exit` instead of waiting
- Remove "Wait for Witness" step - polecats now self-terminate
- Update Polecat Contract to reflect new exit flow
- Remove outdated "Don't exit yourself" guidance

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 13:48:14 -08:00
mayor
c0d597f092 witness: Stop routine reports to mayor (costs tokens) 2026-01-02 13:11:46 -08:00
gastown/polecats/capable
c2d87a9063 fix(witness): Remove mail response on HEALTH_CHECK nudges (gt-xbjxp)
Witnesses were sending HEALTH_OK mail to mayor on every deacon health
check (~30s), flooding the inbox. Updated witness templates to:

- Explicitly state NOT to mail on HEALTH_CHECK nudges
- Explain that Deacon tracks health via session status
- Add gotcha note in the main template

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 18:25:22 -08:00
gastown/crew/jack
4bafbfb0f7 fix: Add health check protocol to witness template (gt-t3e07)
Witnesses should send HEALTH_OK to deacon/, not mayor/deacon.
Added explicit Health Check Protocol section to the witness template
explaining the correct address and why.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 10:54:04 -08:00
gastown/polecats/dag
58a7615801 Witness: Reduce chattiness, increase autonomy (gt-lxdn7)
Remove routine POLECAT_PROCESSED and WITNESS_REPORT/REFINERY_REPORT
mail types from Witness→Mayor communication.

Changes:
- Remove Notify Mayor step for routine polecat processing from
  witness-CLAUDE.md template
- Remove WITNESS_REPORT and REFINERY_REPORT callback types from
  callbacks.go (pattern matching, handlers, constants)
- Update callback help text to reflect new behavior

Witness now handles routine lifecycle autonomously. Only genuine
problems that require human/Mayor intervention are escalated:
- ESCALATION (problems Witness cannot resolve)
- BLOCKED (needs human decision)
- CRASH_RECOVERY (informational)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 22:16:47 -08:00
gastown/crew/max
b4a7b930e5 Update all prompts to use gt hook instead of gt mol status
- Role templates (crew, polecat, mayor, deacon, witness, refinery)
- prime.go startup protocol messages
- Documentation (propulsion, reference, molecules, wisp architecture)
- Session hints and sling prompts
- Formula template instructions
- CLAUDE.md

The hook is the user-facing concept, molecules are implementation details.
Agents should use `gt hook` to check what work is assigned to them.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 22:10:08 -08:00
gastown/polecats/slit
aed2482d88 Witness: Add recovery escalation for dormant polecats with unpushed work
- Add gt polecat check-recovery command to check cleanup_status from agent bead
- Update gt polecat nuke to block on polecats with unpushed work (use --force to override)
- Add EscalateRecoveryNeeded function for RECOVERY_NEEDED escalations
- Update Witness template with dormant polecat recovery protocol

Prevents accidental data loss when cleaning up dormant polecats that have
unpushed commits. The Witness should now use check-recovery before nuking
and escalate NEEDS_RECOVERY cases to the Mayor.

(gt-cloml)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 20:59:46 -08:00
Steve Yegge
23fca6f2eb Add Landing Rule to polecat priming: work must be on main or in MQ 2025-12-30 18:19:09 -08:00
Steve Yegge
d8be33d13e fix: Witness cleanup uses gt polecat nuke for correct repo base
The witness template previously instructed using raw git commands:
- git worktree remove polecats/<name>
- git branch -d polecat/<name>

This failed because git worktree operations must run from the repo
that created the worktree (mayor/rig or .repo.git), not the rig root.

Now uses `gt polecat nuke` which handles repo base detection via
the repoBase() function and properly cleans up worktrees.

Fixes gt-gp6i

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 00:49:51 -08:00
Steve Yegge
f0b23c50f1 polecat template: Add SINGLE-TASK FOCUS section (gt-m61ew)
Polecats were going off-task during swarms. Added explicit guidance:
- ONE job: work your pinned bead until done
- DO NOT list for common distractions (mail checking, monitoring others, etc.)
- Reminder to file discovered work as beads, not fix it

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 16:42:14 -08:00
Steve Yegge
5e19643080 Add Self-Managed Session Lifecycle to polecat template (gt-zb0io)
Template update matching polecat/ace/CLAUDE.md changes:
- Added 'Closing Steps' guidance for activity feed visibility
- Added 'When to Handoff' guidance for self-managed session cycling
- Added 'If You Forget' recovery notes
- Clarified Witness role: monitors for stuck but doesn't force recycles

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 16:16:24 -08:00
Steve Yegge
176ad3ae69 fix: Polecat template - directory discipline and commit before done (gt-hj0ei, gt-ibuga)
Fixed two integration test bugs:

gt-hj0ei: Polecat wrote files outside worktree
- Added CRITICAL directory discipline section at top
- Emphasizes staying in polecats/<name>/ directory

gt-ibuga: Polecat didnt commit before gt done
- Replaced vague completion protocol with explicit checklist
- Uses gt done command instead of manual mail
2025-12-28 14:00:31 -08:00
Steve Yegge
975de79fb4 docs: Add witness CLAUDE.md template with MERGE_READY step (gt-bo8mo)
Created witness-CLAUDE.md template that emphasizes the critical
MERGE_READY step in the pre-kill verification checklist.

The witness must send MERGE_READY to refinery BEFORE killing a polecat
session, so the refinery knows which branch to merge.

Uses {{RIG}} placeholder for rig-specific deployment.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 13:59:06 -08:00
Steve Yegge
c564bfd736 Comprehensive polecat work lifecycle (mol-polecat-work v2)
Complete redesign of polecat work formula with 8 concrete steps:
1. load-context - Prime, read issue, verify can proceed
2. branch-setup - Clean feature branch, rebased on main
3. implement - Do work, commit regularly, file discovered work
4. self-review - Review diff, fix issues before testing
5. run-tests - ALL tests must pass, verify coverage
6. cleanup-workspace - No uncommitted, no stash, no cruft
7. close-issue - bd close with summary
8. signal-complete - POLECAT_DONE mail, WAIT for termination

Also updated mol-polecat-lease.formula.toml (v2):
- 5 steps: boot → working → verifying → merge_requested → done
- Aligns with witness patrol and mail protocol
- Clear verification criteria before MERGE_READY

Added templates/polecat-CLAUDE.md:
- Polecat role context for spawned workers
- Propulsion principle, key commands, completion protocol
- Clear "do NOT" section (don't exit, don't push to main)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 11:13:00 -08:00