Consensus
Run one task on several coding agents at once; your tests decide, and you pick the result.
Consensus gives one task to several coding agents at once (Claude Code, Codex and Mel's own agent), each in its own copy of your project, and lets your tests decide which results count. You see where they agree, what each one changed, and the evidence behind the recommendation, and you pick the result to keep. Nothing touches your files until you do.
Why run more than one agent
One agent can be confidently wrong: it can pass its own idea of a check, skip a case, or quietly change a test until it passes. Running the same task on several agents, and running your project's own check against each result, turns "the agent says it's done" into evidence you can read:
- Your tests are the judge. A result whose check did not exit 0 is never recommended, however small or clean it looks.
- Agreement is shown, not assumed. Mel compares the passing results file by file and says where they made the same change.
- Nothing is applied for you. Each agent works on a copy. You read the diffs and choose.
Start a run
In the app: open the command palette and choose Consensus: Run This Task on Several Agents. The screen opens on the current pane's folder.
- Describe the task.
- Tick the agents to run. Only installed ones can be ticked; one that is missing says so and how to install it.
- Check the check command. Mel fills one in from your project (for example
cargo test,npm testorpytest); exit 0 is a pass. - Optionally add requirements, one per line as
name = command, each a command that exits 0 when the requirement is met. - Leave Have a different agent review each result on (the default) or turn it off.
- Press Start. Mel shows what the run may cost and waits for your OK before anything starts (see What it costs).
In the terminal:
mel consensus --agents claude,codex --check "cargo test" "fix the off-by-one in the pager"With no --agents, Mel picks two installed agents for you and says which. Before it starts, Mel prints the cost estimate and asks for y; add --yes (or -y) to skip the question. Run mel consensus --help for every option.
What happens during a run
- Each agent gets its own copy. Mel makes a git worktree for every agent from your last commit, under
~/.mel/worktrees/consensus/. Uncommitted changes are not in those copies, and the screen and the terminal both say how many of your files that leaves out. - The agents work at the same time. Each has a time limit (15 minutes by default;
--agent-minschanges it) and is stopped cleanly when it runs out or when you press Stop. - Your check runs in each copy after the agent finishes, with its own time limit (10 minutes by default;
--check-mins). - Your code is checked too. Before judging, Mel runs the same check on your commit with no change, so a test that was already failing is reported as already failing, not blamed on an agent.
Locked tests
An agent should not be able to pass by changing the test. Mel locks your existing test files (the usual test folders and files, plus the files that decide how tests run, such as conftest.py and test configuration). If an agent edits or deletes one:
- Mel puts the original back in that agent's copy before running the check, so the check runs against your test.
- The result is shown with the locked files it touched, and it is never recommended.
New test files are allowed. Use --protect PATTERN to lock more paths, such as a manifest.
The review
With the review on, each result that could be recommended is reviewed by a different agent, in a throwaway copy. A reviewer must back every objection with a command that fails when the problem is present. Mel runs that command itself and files each finding as:
| Finding | What it means |
|---|---|
| Confirmed | The command failed on the result. The result is not recommended. |
| Not reproduced | The command passed. That does not prove the reviewer wrong, so it is not called "rejected". |
| Unresolved | No usable command, or one Mel would not run (only read-only commands, your check or a plain test runner are allowed), or it timed out. |
A reviewer's words alone never move a result.
Two more options build on the results: --combine also puts the two best different results together, runs your check and requirements again on the combination, and offers it as one more result (--pick combined applies it). Mel also keeps a private record on your computer, per project, of how often each agent's result could be recommended; once every agent in the comparison has at least 5 past runs there, that record breaks a tie after requirements and open review concerns and before size, and it never moves a result that cannot be recommended.
The recommendation
Among the results that passed and changed something, Mel recommends one by what matters first:
- the fewest failed requirements;
- then the fewest open review concerns;
- then the smallest change.
Size never outranks a requirement. The results say why the recommended one was chosen, which agents made exactly the same change, and what was not checked.
Use a result
- In the app: select a result to read its diff, then press Use this result. Mel applies that diff to your working tree (not staged, not committed). It refuses, naming the files, if a file it would change has changed in your tree since the run started.
- In the terminal: add
--pick AGENT(for example--pick codex) to apply that agent's result if it passed. Mel then runs the check again in your folder and says whether it passed there. Add--keepto keep the worktrees.
The worktrees are removed when you discard the run or after a pick.
What it costs
Claude Code and Codex use your own accounts with their providers, so what they spend is billed there and Mel cannot see it. Mel's own agent spends your Mel credits: each Mel agent run, whether it is working on the task or reviewing a result, is capped at 200 credits. Before anything starts, the screen and the terminal show an estimate of the most the whole run can spend (every Mel agent run that could start, each at its cap, including more review rounds and the extra review of a result every agent agreed on) and which agents bill your own accounts, and the run waits for your OK. In the terminal, --yes skips the question; without a terminal to ask on, --yes is required.
Exit codes
mel consensus exits 0 when at least one result passed, 1 on an error, 2 for a bad command line, 3 when none passed, and 4 when you said no to the estimate (nothing was started), and 130 when stopped with Ctrl-C.