diff --git a/skills/commander/SKILL.md b/skills/commander/SKILL.md index 4d91b89..6a797c4 100644 --- a/skills/commander/SKILL.md +++ b/skills/commander/SKILL.md @@ -57,6 +57,27 @@ undo — a file created with `mkdir`, not a flag it sets itself. reading are the ones that are hard to reconstruct: what it skipped, what it could not verify, what it left outstanding. Ask for those explicitly or you will get a summary of what went right. +# Writing the loop, if you are the one writing it + +The background-job dialog already sends the load-bearing mechanics — use the harness's own background +mechanism, keep the wait in the shell, put the test into the shell condition, and **ask first if the +condition is not completely clear** rather than arming a guess. That last one matters more than it reads: a +wrong condition fails silently, either never firing or firing constantly, and it is found out days later. +Arming late costs a minute. + +Four details the mechanics do not carry, each of which was learned by getting it wrong: + +- **`OFFICER_ROOT` is empty in the sidecar's environment.** Any path built from it resolves to `/data/...`, + so a lock file lands somewhere nothing reads and every release looks permanently undeployed. Set it + explicitly in the loop. +- **Keep stderr out of a `--output-format=stream-json` pipe.** The CLI prints warnings there — a + connectors notice, among others — and one of them landing in the stream corrupts the first `jq` parse. + Redirect it to its own reader. +- **`jq --unbuffered`**, or the job panel shows nothing for as long as the work takes and reads as hung. + A background job that produces no output is indistinguishable from a dead one. +- **The claim goes before the spawn, not inside the action.** If the action claims its own work, an action + that dies before claiming has claimed nothing and will run again. + # Things that are true and surprising - **Its cost line understates.** The recorded cost counts the commander's OWN turns — one row per `result`