| name | continuous-refactor |
| description | Continuous runner for the continuous-refactor workflow across supported agents. |
continuous-refactor
Purpose
Run the continuous-refactor workflow in continuous mode until the dispatcher
returns recommended_role: stop (only [MINOR] refactoring ideas remain).
The workflow rotates through three prompt steps in a strict cycle:
prompt.refactor_scan — identify code smells and refactoring candidates
prompt.refactor_execute — apply selected refactorings
prompt.refactor_verify — verify refactored code correctness
Cold starts are handled automatically — the infrastructure initialises the
rotation at step 1 when no prior runtime entry exists.
Agent execution protocol
Run one dispatcher step at a time:
python3 .codex/skills/vibe-loop/scripts/agentctl.py --repo-root . --format json next --workflow continuous-refactor
python3 .codex/skills/vibe-prompts/scripts/prompt_catalog.py <prompt_catalog_path> get <recommended_prompt_id>
python3 .codex/skills/vibe-loop/scripts/agentctl.py --repo-root . --format json loop-result --line "LOOP_RESULT: <json>"
The --workflow continuous-refactor flag is required — it activates the
continuous override that ignores normal plan-state routing and selects from the
refactor prompt rotation instead.
In this orchestration source repo, use tools/agentctl.py and tools/prompt_catalog.py
instead; the .codex runtime helper scripts are generated during install.
LOOP_RESULT format
After executing each prompt, emit a LOOP_RESULT JSON line with the dispatcher-required
report fields:
{
"loop": "implement",
"result": "ready_for_review",
"stage": "<current_stage>",
"checkpoint": "<current_checkpoint>",
"status": "<current_status>",
"next_role_hint": "implement|review|stop",
"workflow": "continuous-refactor",
"report": {
"acceptance_matrix": [
{
"item": "<checked behavior>",
"status": "PASS|FAIL|N/A",
"evidence": "<command or file evidence>",
"critical": true,
"confidence": 0.9,
"evidence_strength": "LOW|MEDIUM|HIGH"
}
],
"top_findings": [
{"impact": "MAJOR|MINOR", "title": "[MAJOR|MODERATE|MINOR] ...", "evidence": "...", "action": "..."}
],
"state_transition": {
"before": {"stage": "<current_stage>", "checkpoint": "<current_checkpoint>", "status": "<previous_status>"},
"after": {"stage": "<current_stage>", "checkpoint": "<current_checkpoint>", "status": "<current_status>"}
},
"loop_result": {
"loop": "implement",
"result": "ready_for_review",
"stage": "<current_stage>",
"checkpoint": "<current_checkpoint>",
"status": "<current_status>",
"next_role_hint": "implement|review|stop"
}
}
}
Use idea impact tags ([MAJOR], [MODERATE], [MINOR]) in top_findings titles.
The structured impact field follows the dispatcher impact schema; use the title tag
for the continuous-workflow major/moderate/minor idea threshold.
The workflow stops when only [MINOR] ideas remain.
Scripts (wrapper)
scripts/continuous_refactor.py
Wraps vibe-run with --workflow continuous-refactor. Useful for terminal
or headless modes:
python3 .codex/skills/continuous-refactor/scripts/continuous_refactor.py --repo-root . --show-decision
python3 .codex/skills/continuous-refactor/scripts/continuous_refactor.py --repo-root . --non-interactive --simulate-loop-result --max-loops 10 --show-decision
Notes
- Uses the same LOOP_RESULT acknowledgement flow as
vibe-run.
- The dispatcher handles cold starts (no
workflow_runtime.json entry) by
starting the rotation at step 1 — no manual initialisation is needed.
- If the dispatcher returns
requires_loop_result: true, record the pending
LOOP_RESULT before calling next again.
- Refer to
resources/refactoring-guide.md for code smell heuristics.