-
Notifications
You must be signed in to change notification settings - Fork 24
[Gastown] PR 12: Refinery Agent #218
Copy link
Copy link
Closed
Description
Parent: #204 | Phase 2: Multi-Agent Orchestration
Revised: The Refinery is now a Kilo CLI process inside the Town Container instead of a cloud-agent-next session. Dispatched by the Rig DO alarm when review queue entries are ready.
Goal
Automated merge review with quality gates. The Refinery is an AI agent (Kilo CLI process) that can reason about test failures and send actionable rework requests.
Flow
When a review queue entry is ready:
- Rig DO alarm fires,
processReviewQueue()detects pending entry - DO signals container:
POST /agents/startwith refinery role config - Container spawns a Kilo CLI process (the "Refinery") that:
- Gets a git worktree with the polecat's branch
- Runs quality gates (configurable:
npm test,npm run build, lint, etc.) - If passing → merge to default branch, push, update review queue entry via
gt_done - If failing → reason about failures, create
REWORK_REQUESTmail to the polecat viagt_mail_send, set entry tofailed
- Refinery process exits after the review completes
Quality Gate Configuration
Stored in rig config:
{
"refinery": {
"gates": ["npm test", "npm run build"],
"auto_merge": true,
"require_clean_merge": true
}
}Refinery System Prompt
The Refinery agent needs a system prompt that:
- Explains its role (review code, run quality gates, decide merge/rework)
- Instructs on how to interpret test failures
- Instructs on writing actionable rework requests (specific, with file/line references)
- Explains merge mechanics (git merge in the worktree, push to remote)
- Uses
gt_mail_sendto communicate rework requests to the polecat
Dependencies
- PR 1 (Rig DO — review queue)
- PR 4 (Town Container — process spawning)
- PR 5 (Rig DO Alarm —
processReviewQueue) - PR 3 (Tool Plugin —
gt_done,gt_mail_send) - PR 8 (Manual Merge Flow — review queue entries)
Acceptance Criteria
- Refinery Kilo CLI process spawned by container on DO alarm signal
- Quality gate execution (configurable commands)
- AI-powered failure analysis and actionable rework requests
- Git merge in worktree and push on success
-
REWORK_REQUESTmail with specific failure details on failure - Refinery system prompt
- Process exits cleanly after review completes
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels