Repository navigation
Description
Summary
Four small additions to afx and porch, suggested by an adopter workspace's architect at its owner's request. Each replaces a sequence that architects there typed by hand hundreds of times in one week of shell history (16,117 commands), often with silent failures. One PR.
1. afx send: a message file, opt-in exit codes, and a safe retry
Today a held message exits 0, the same as a delivered one, so a script cannot tell them apart. A message with quotes or newlines has to survive shell quoting unless the caller knows about - (stdin).
-
--message-file <path>: the message body is read from the file. It never passes through a shell. This is distinct from--file, which appends a file to a message given on the command line; the two may be combined. The 48 KB limit applies to the result as it does today. -
--exit-code: opt in to outcome exit codes, in the manner ofgit diff --exit-code:Outcome Exit delivered, or scheduled by --delay0 failed or refused 1 held 3 Without the flag, exit codes stay exactly as they are today. Reason: agents chain
afx send … && …and read a non-zero exit as an error. A held message is persisted and will deliver; an agent that sees it "fail" will send it again, and the recipient gets it twice. Check in the source whether a send can come back delivered-but-unverified; if it can, give it its own code (4) under--exit-codeand document it. With--all, the exit is the worst outcome across recipients. -
--retry <n>: resend only when the request provably never reached Tower (connection refused, Tower not running). Never afterheld, a refusal, or a timeout on a request that was sent: the mailbox may already hold it, and a resend would duplicate it. Back off between tries and say on stderr what happened.
2. afx cleanup --keep-ignored
Cleanup removes the worktree with force, and every untracked and ignored file in it goes too: review outputs, project status folders, scratch notes. Some of that is evidence someone wants later.
- Before removing anything, copy to
~/.agent-farm/kept/<workspace-name>/<builder-id>/:- every untracked file that is not ignored;
- ignored files matching a keep list. Default:
codev/projects/**,codev/state/**,.builder-*,tmp/**,scratch/**. Configurable undercleanup.keepIgnoredin.codev/config.json.
- Never copy dependency or build output (
node_modules,dist, virtualenvs, and the like), whatever the keep list says. - Compare a checksum per file after copying.
- Refuse to overwrite: if the kept folder for that builder already exists, stop with an error naming it.
- If any copy or checksum fails, abort before removing the worktree, the branch or the registry row.
- Print the kept folder and the number of files.
3. afx spawn --max-load <n>
- Read the one-minute load average before creating anything. At or above
n, exit 75 with a message giving the load and the limit. No branch, no worktree, no registry row. --wait <seconds>with it: re-read every 15 seconds up to that long, then spawn or exit 75.- On a platform with no load average (native Windows reports zeros),
--max-loadfails loudly as unsupported. No guessing.
4. porch -C <dir>
Like git -C: run the command as if porch had been started in <dir>. It works with every subcommand and prints the directory it resolved.
Today an architect must cd into a builder worktree to run porch status, and a cd that persists in the shell later nests builders when afx spawn runs from the wrong place. -C removes the cd.
porch approve and porch skip-phase still require their explicit human-approval flag. -C grants nothing.
Notes for the builder
- Update the docs and skills that teach these commands in both trees: the
afxandporchskills,agent-farm.mdandoverview.mdunderresources/commands/, and theircodev-skeleton/twins. IfCLAUDE.mdchanges,AGENTS.mdchanges identically. - Tests: each exit code under
--exit-code, and unchanged exits without it;--retrydoes not resend afterheldor a timeout;--keep-ignoredaborts before removal on a checksum mismatch and on an existing kept folder;--max-loadcreates nothing when over;porch -Cresolves the same project as running from inside the directory. - Run targeted tests while iterating and the full suite once, for the porch check. If the one-minute load average is above 18 on this machine, wait for it to drop first.
Activity
[Air #1950] feat: afx send --message-file/--exit-code/--retry, cleanu…
[Air #1950] fix: address PR review — message-file trailing newline, k…
[Air #1950] test: pin a POSIX host for --max-load load-path tests
Merge pull request #1954 from cluesmith/builder/air-1950
Merge origin/main into builder/spir-1940
release notes: Windows preview label removed, session jobs, afx statu…
[Spec 1951][Phase: check_worktree] feat: codev check worktree