Four phases: idea, build, test, ship
You will learn
Why work goes through four phases in order, and why a failed test sends it back to build and never forward to ship.
Every piece of work with an agent has the same four phases. Idea: you say in one sentence what you want. Build: the agent writes one small piece. Test: you run it and a test says yes or no. Ship: you save it and put it where it is used. The phases are not a straight line. When the test says no, the work goes back to build, not forward to ship, and the loop runs again. The spec of this lesson holds two tables: where each phase goes next when the tests pass, and where it goes when they fail. The player runs its 4 tests. Change one entry of the fail table so that a failed test goes on to ship, and exactly one test goes red.
Try it
Open the widget and walk an idea to ship with one failed test on the way; count the steps. Then in the spec find the entry of the fail table that sends a failed test back to build, change it to 3 and read which test goes red.
Walk one idea through four phases. At the test phase press pass or fail: a pass ships it, a fail sends it back to build. Nothing ships past a red test.
specs/vibecoding/four_phases.t27
// SPDX-License-Identifier: Apache-2.0
; specs/vibecoding/four_phases.t27 -- vibecoding lesson: the four phases, idea, build, test, ship
; One idea: work moves through four phases in order, and a failed test sends it back to build,
; never forward to ship. A phase is a number: 0 idea, 1 build, 2 test, 3 ship. The two tables
; below say where each phase goes next, one when the tests pass and one when they fail.
; Run it in the player, then change FAIL_NEXT[2] from 1 to 3 (a failed test goes on to ship) and
; read which test goes red.
; ASCII only, English only.
; phi^2 + 1/phi^2 = 3 | TRINITY
module vibecoding_four_phases;
pub const PHASE_IDEA : u8 = 0;
pub const PHASE_BUILD : u8 = 1;
pub const PHASE_TEST : u8 = 2;
pub const PHASE_SHIP : u8 = 3;
pub const PHASE_COUNT : u8 = 4;
; Next phase, indexed by the phase you are in.
pub const PASS_NEXT : [4]u8 = [1, 2, 3, 3];
pub const FAIL_NEXT : [4]u8 = [1, 2, 1, 3];
test the_phases_run_in_order {
assert PASS_NEXT[0] == PHASE_BUILD;
assert PASS_NEXT[1] == PHASE_TEST;
assert PASS_NEXT[2] == PHASE_SHIP;
}
test a_failed_test_goes_back_to_build {
assert FAIL_NEXT[2] == PHASE_BUILD;
assert FAIL_NEXT[2] != PHASE_SHIP;
}
test shipped_stays_shipped {
assert PASS_NEXT[3] == PHASE_SHIP;
assert FAIL_NEXT[3] == PHASE_SHIP;
}
test three_steps_from_idea_to_ship {
assert PASS_NEXT[PASS_NEXT[PASS_NEXT[0]]] == PHASE_SHIP;
assert PHASE_COUNT == PHASE_SHIP + 1;
}
All lessons
Module 1 · What vibecoding is
You describe, an agent writes, you run it and check. What a program is, and five myths put to a test.
Module 2 · Your desk
An editor with an agent beside it, ten terminal commands, and reading an error message.
Module 3 · Save points with git
A commit is a save point, a branch is a safe try, and a key is a pair of which one stays private.
Module 4 · Prompting
The parts of a prompt, an example in place of an adjective, and one small step at a time.
Module 5 · The working loop
Four phases from idea to ship, the loop of ask, run, read and fix, and what to do when it is stuck.
Module 6 · A test as the judge
A test says yes or no, a planted bug shows the test works, and a diff is read before it is accepted.
Module 7 · The parts of an agent
What an agent answers with, what it can do with tools, and what it keeps between messages.
Module 8 · A first bot
A bot is a message loop, a bot comes from a spec, and a secret stays out of the repository and the prompt.
Module 9 · Your own project
A spec for your own idea, one thing measured after it runs, and an honest plan for the next month.