Questions
Why can't my existing agent just do this for me?
Because it would be marking its own work. Your agent wrote the code, wrote the tests, ran them and told you they pass. When you ask it whether everything is good, you get its opinion, and its opinion is nearly always yes.
RedMachine has no opinion. It breaks the line and runs the test. The test fails or it does not. Your agent tells you the tests pass. RedMachine makes the tests prove they can fail.
How do I use it to check the code does what I asked for?
RedMachine cannot read your mind, and it does not try to. What it does is make your agent show its work in a form you can check. It goes like this:
- You say what you want. "Orders over 20 kg get a 15 dollar surcharge. Express doubles the price."
- Your agent writes the code and one test for each thing you asked for, and names each test after it:
heavy_orders_get_the_surcharge,express_doubles_the_price. - RedMachine breaks the code and runs those tests. A test that does not fail when its code is broken is exposed on the spot, whatever it is called.
- The receipt names names. It lists every test that ran, and for each changed line, the tests that failed when that line was broken.
- You read the list against what you asked for. Is there a test for the surcharge? Did it go red when the surcharge line was broken? If something you asked for has no test on the list, it was not checked, and your agent cannot say it was.
You can ask your agent "did you test the surcharge?" and then ask for the receipt. redmachine verify RECEIPT --ran heavy_orders_get_the_surcharge answers yes or no from the record, not from the agent's memory.
Better still, hand the receipt and your original request to a second agent and ask it one question: does every thing I asked for have a test here that went red? A second agent judging the first one's evidence is far stronger than the first one judging itself.
What RedMachine proves is that each named test fails when its code is broken. Whether a test's name honestly describes what it checks is for you or the second agent to judge. The receipt puts the two side by side so that judgement is quick.
But my agent is very good. Would it not notice a weak test?
Sometimes. The trouble is the kind of mistake. Agents are good at writing tests that run your code and pass. The common failure is a test that would also pass if the code were wrong. Reading the test rarely shows that. Breaking the line shows it every time.
Could I not tell my agent to break each line and run the tests itself?
You could, and a careful agent can do it for a line or two. What it will not do reliably is cover every changed line, put every file back exactly, and tell you plainly when a line slipped through. RedMachine is that discipline done by a program. It does not get tired, it names every line it did not try, and it cannot be talked into saying yes.
So does RedMachine replace my agent?
No. It gives your agent a referee. RedMachine prints the lines no test checks, with the broken version each test must catch. Your agent writes those tests. You run RedMachine again until it says PASS. We give you the instruction to paste into your agent so it does all of this for you.
What do I have at the end that I did not have before?
Evidence. A receipt lists every changed line and whether a test caught it when it was broken. An agent saying "done" is a sentence in a chat. A receipt is a file you can check tomorrow.
Is there an AI inside RedMachine?
No. No model and no randomness. The same change gives the same result every time, and it runs on your machine in seconds per line without using any of your AI plan.
Does a PASS mean my code is right?
No, and we will not pretend it does. PASS means that for every changed line, a test fails when that line is broken. It does not mean the code does what you wanted. Deciding what "right" means is still for you and your agent.
Is this a new idea?
No. It is called mutation testing and it has been around for decades. It was always too slow to use every day, because it broke the whole program. RedMachine breaks only the lines you just changed, so it is fast enough to run on every piece of work your agent hands you.
What does it work with?
Rust, Python, JavaScript, TypeScript and Go are built in. Swift and Xcode projects are in preview. Other languages work with your own test command. It runs on macOS and Linux, not Windows.
Is it safe to run?
It runs your tests against code it has broken on purpose, and it puts every file back afterwards. If your code deletes files or sends anything, run it in CI or a container, because a broken line can do whatever your code can do.