Wayari's own notes define a loop in one line:
Pick the smallest real problem. Fix it. Prove the fix. Ship it. Look at what the fixing taught you. That is the next problem.
The gate is the step that proves the fix. Every change a crew makes has to pass one before a pull request opens.
01what the gate checks
A gate runs typecheck, the build and the tests. It also runs every check the repository declares for itself.
A repository can add checks and never take one away.
The gate reads the list again from the branch it is checking. An agent that deletes a check on its branch still meets that check.
A repository with no package.json declares its checks in wayari.json. That is how a Python service or a Go module tells the gate what it already runs.
02a gate fails closed
If a check has no command to run, the gate does not pass. A missing test script gets its own verdict, cannot-check, and it fails the gate.
The other choice would tell a person asleep at 3am that their code was verified when nothing looked at it.
The hooks that report what an agent is doing work the other way round. A broken hook gets out of the way and never blocks an agent.
03red means try again, with notes
When the gate goes red, Wayari retries twice and then holds the channel for a person.
Before a retry starts, what the failing check printed goes into the builder's task file, word for word. The next shift reads the failure before it types anything.
Only the last failure goes in. The run before it is stale, and half of what it says is already fixed.
04fast enough to run every time
The 0.5.0 release took the gate from hours to minutes.
For a change to docs or skills, the gate records typecheck, the build and the tests as unchanged. The trunk's last answer stands, and every declared check still runs.
A code change runs only the test files it can reach, and the tests line says how many:
tests: 214 of 4,166 test files ran, reached from 6 changed paths
An unchanged check is never drawn as a tick. It did not run, and the pull request says so.
The whole suite still runs once on the trunk after every merge. If the trunk goes red, wayari status says so until the next green.
05two changes since 0.5.0
Two more changes have merged since, and they ship in the next release.
The first starts the checks at the same time, so a gate lasts as long as its slowest check.
A check the gate does not know runs alone, after the rest, because it might write where another check reads.
Measured once on a Mac with 10 cores, a full gate went from 248 seconds to 229. The tests are most of a gate, so the saving is small.
The second change remembers what the trunk proved. After a green trunk run, each test file is recorded with a hash of its text and of everything it imports.
A channel's gate skips a test file whose hash still matches, and says so.
Only the trunk writes that record, so a channel can never vouch for itself. A red trunk clears it.
06loops that stop
On the night of 11 September, we used Wayari to build Wayari, one pass at a time, by hand. Every pass found a defect in Wayari itself.
In one pass, wayari ship refused with "the gate did not pass" and named no check.
In another, the summary of a failed gate showed every check's box empty when only one check had failed.
None of those defects showed up from reading the code. Both were fixed in the next release.
So a hunt is now a loop that stops. wayari loop start opens one, and each pass records what it found.
Two passes in a row with nothing new end the loop. A fixed count would stop a rich hunt early and run a finished one late.
A loop never spends on its own. Arming costs money and a merge cannot be undone, so both wait for a person, however deep the loop goes.



