agent_cleanup:flame_chase
Keep a long relay's workspace tidy. flame_chase, with a cleaner that steps in every few turns between the two chasers: it keeps the work, deletes what strayed, writes down what is next, and the repository's history becomes one commit of what survived. The same cleaner behind one agent is agent_cleanup:ralph_loop.
In hmz, open /flow → Flowverses → official and install agent_cleanup, which brings agent_cleanup:ralph_loop with it. Or run the release without installing anything:
hmz exec -f 'git+https://github.com/humanfia/agent-cleanup-flow@v0.1.1#agent_cleanup:flame_chase' …- repository
- humanfia/agent-cleanup-flow
- release
- v0.1.1 · commit
dc83fcd - earlier
- v0.1.0
- licence
- Apache-2.0
Read from humanfia/flowverse when this site was built.
❯ $agent_cleanup:flame_chase make every test in tests/ passhmz exec -f agent_cleanup:flame_chase \
-a first_chaser=claude/claude-opus-5:high -a second_chaser=codex/gpt-5.6-sol:high \
-a cleaner=claude/claude-opus-5:high \
-p work_paths=src -p budget.duration=12h,budget.cost=100 "$(cat TASK.md)"The whole run, at rest. Step through it with the buttons, or drag the bar.
The chasers alternate straight across the cleaning, so after three turns the second chaser opens the next stretch. An empty or failed turn is taken again by the same chaser.
The run, turn by turn
- first_chaser — turn 1; a session opened for this turn; hands second_chaser in the tree: the tree
- second_chaser — turn 2; a session opened for this turn; hands first_chaser in the tree: the tree
- first_chaser — turn 3; a session opened for this turn; hands cleaner in the tree: three turns of work
- cleaner — distills the tree; a session opened for this turn; hands the epoch in the tree: the distilled tree
- the epoch — checks, one commit; no turn of a model; hands second_chaser in the tree: work_paths and NEXT.md
- second_chaser — turn 4; a session opened for this turn; hands first_chaser in the tree: the tree
- first_chaser — turn 5; a session opened for this turn
Then round again: the seats keep alternating across epochs.
It ends when the budget runs out, or 3 turns in a row come to nothing.
Each cleaning rewrites your git history
Every cleaning replaces the repository's history with a single commit, epoch N: distilled tree. The history it replaces is archived outside the repository, never deleted; the flow's README says how to read it back. Run this on a clone you are willing to have rewritten.
When to use it
On a relay long enough that the tree fills up with scratch files, dead ends and notes nobody reads again. Each chaser's fresh session then starts from a tree that holds only the work under work_paths and a short NEXT.md saying what to do next.
The chasers alternate straight across a cleaning: after an odd number of turns, the other chaser opens the next stretch. Unlike plain flame_chase, a turn that comes to nothing is taken again by the same chaser rather than passed to the other.
Roles and params
| Role | What it is | How it is filled | |
|---|---|---|---|
first_chaser · second_chaser | agent, required | -a first_chaser=…,second_chaser=… | The coding turns, alternating, each in a fresh session. |
cleaner | agent, required | -a cleaner=… | One cleaning at a time, in a fresh session that it keeps through its repairs. |
human | you | filled by humanize; no -a | Asked only whether to start on a very large workspace. |
workspace | environment, local | the directory you start in; no -e | The repository every turn works in and every cleaning distills. Its git history is rewritten each epoch. |
Each agent role takes one -a role=CLI[@PROVIDER]/MODEL[:EFFORT]; several roles may share one -a, comma-separated. There is no -e to give: workspace is a local environment, the directory you start the run in, and an -e naming it is refused. See Command-line specs.
Every role must be a backend the flow can speak to mid-turn, because a turn that runs too long is told to wrap up: claude, codex, kimi or pi. Any other is refused before the first turn.
work_paths is required, and the other params and their defaults are those of agent_cleanup:ralph_loop: cleanup_turns (3), next_lines, comment_lines, repairs, check_command, the three turn timeouts, max_tracked_file_mb and confirm_large_workspace_copies.
What ends it
- The budget. A cleaning it interrupts puts the tree back first.
- Three turns in a row that come to nothing. A turn that answered nothing, or whose backend failed, is taken again by the same chaser; the third in a row stops the run.
Picking it up
--resume carries on the turn count, and so whose turn is next, and the cleanings done so far, so the next cleaning comes when it would have. See Picking a run up.
See also
- flame_chase: the relay, without the cleaning
- agent_cleanup:ralph_loop: the same cleaning, behind one agent
- Talking to a running turn: what telling a turn to wrap up is