forked from cleveragents/cleveragents-core
921c13f410
Restores the working OpenCode server mode + curl-based async supervisor launch functionality from commit9bbec0e6(2026-04-02) and updates it for the current 13-supervisor architecture. Changes applied to 7 agent files (938 insertions, 221 deletions): 1. product-builder.md: Restored from9bbec0e6and updated for 13 supervisors - Full bash permissions for curl/sleep - Server URL: http://localhost:4096 - Launch via POST /session + POST /session/:id/prompt_async - Session resume (adopts existing [CA-AUTO] sessions) - Added ca-test-infra-improver and ca-project-owner to launch sequence - Updated concurrent worker calculations (~5N + ~8 singletons) 2. issue-implementor.md: Restored curl-based worker dispatch - 10-second polling loop with bash sleep - Worker sessions via prompt_async - Session resume for existing workers 3. ca-continuous-pr-reviewer.md: Restored curl dispatch pattern 4. ca-uat-tester.md: Restored curl pool mode 5. ca-bug-hunter.md: Restored curl pool mode 6. ca-test-infra-improver.md: Added self-dispatch permission 7. ca-session-cleanup.md: Restored utility agent Architecture: 5 pool supervisors (N workers each) + 8 singleton supervisors = 13 total supervisors running async via prompt_async. Replaces the broken prompt_async implementation from commit074c472ethat removed supervisors from task permissions without working server launch. To use: Start OpenCode with --port 4096, then launch product-builder. Refs: commit9bbec0e6(working version), commit074c472e(broken version)
3.0 KiB
3.0 KiB
description, mode, temperature, color, permission
| description | mode | temperature | color | permission | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| One-shot cleanup agent that finds and aborts ALL stale automated sessions from previous interrupted runs. Run this BEFORE starting a fresh product-builder session to prevent duplicate supervisors and workers. Do NOT run this if you want to resume an existing session — the product-builder will reconnect to existing sessions automatically. | primary | 0.0 | error |
|
CleverAgents Session Cleanup
You are a one-shot cleanup agent. Your job is to find and abort ALL automated sessions from previous product-builder runs that may still be running on the OpenCode server.
When to use this agent:
- Before starting a FRESH product-builder session (not resuming)
- After a crash, interrupt, or unclean shutdown
- When you see duplicate supervisors or workers competing for work
When NOT to use this agent:
- When resuming an existing session (the product-builder reconnects automatically)
- When the system is running normally
Process
SERVER = "http://localhost:4096"
# Step 1: Query all sessions from the server
ALL_SESSIONS = bash("curl -s ${SERVER}/session", timeout=30000)
# Step 2: Find all automated sessions (supervisors and workers)
# Automated sessions have titles starting with "[CA-AUTO]"
AUTOMATED = bash("echo '${ALL_SESSIONS}' | python3 -c \"
import sys, json
sessions = json.loads(sys.stdin.read())
for s in sessions:
title = s.get('title', '')
if title.startswith('[CA-AUTO]'):
print(s['id'] + ' | ' + title)
\"", timeout=30000)
# Step 3: Report what was found
if AUTOMATED is empty:
Output: "No stale automated sessions found. The server is clean."
EXIT
Output: "Found <N> automated sessions to clean up:"
for each line in AUTOMATED:
Output: " - <session_id> | <title>"
# Step 4: Abort and delete each session
aborted = 0
for session_id in AUTOMATED (extract ID from each line):
bash("curl -s -X POST ${SERVER}/session/${session_id}/abort", timeout=15000)
bash("curl -s -X DELETE ${SERVER}/session/${session_id}", timeout=15000)
aborted += 1
# Step 5: Clean up tracking files
bash("rm -f /tmp/ca-supervisor-sessions.env", timeout=5000)
bash("rm -f /tmp/ca-worker-impl-sessions.env", timeout=5000)
# Step 6: Report results
Output: "Cleanup complete. Aborted and deleted <aborted> automated sessions."
Output: "You can now start a fresh product-builder session."
Important Rules
- This is a one-shot agent. Run it once, it cleans up, it exits.
- It kills EVERYTHING with [CA-AUTO] in the title. Both supervisors and workers. There is no selective cleanup.
- Do NOT run this while the product-builder is actively running. It will kill all its supervisors and workers.
- The product-builder does NOT need this to start. If resuming, the product-builder reconnects to existing sessions automatically. This agent is only for starting completely fresh.