Waking a Harness-Invoked Agent: A Blocking Receive in a Child Process and the Token Cost of Polling Instead

Authors
Vasili Gavrilov
Date
2026-07-05
PDF
iac.pdf
Deposit
doi:10.5281/zenodo.21206970 (Zenodo, all versions)
Sources, figures and data
github.com/Anode1/articles/iac
Code
github.com/Anode1/iac

Abstract

A language-model agent run by a command-line harness exists only while the harness invokes it: between turns there is no process, no socket and no event loop to deliver a message to. Coordinating several such agents on one machine is usually handed to a queue, a broker or an inter-agent protocol, which deliver to a running consumer. The missing primitive is a wakeup, and we give one: a blocking receive in a child process. The agent parks a small C program on a shared log; the program sleeps on an inotify watch, costs nothing while it waits, and exits when a message for its seat arrives, which is the one signal a harness already turns into an invocation. The alternative, the model polling the log itself, costs one activation per poll, and every activation is billed for the whole context, cached or not. We measure that on two models: billed tokens per poll equal the context at every interval, almost all of them cache reads, so an idle seat's bill is polls per hour times context, from cents to tens of dollars an hour for an empty board, while the parked child makes no model call at all. The transport under the wakeup is an append-only log in one directory, locked for writers, with a cursor per member, claims as exclusive file creation and presence as held locks, in under a thousand lines of C99 with no heap allocation. A send and the wake it causes take about two milliseconds whatever the log's size, since a reader starts from its own cursor. A pilot put three agent seats on one such log to repair a SWE-bench Verified issue; the official harness scored the joint patch resolved, and the whole exchange is one readable file.