Expand description
Runs the build-cache cleanup (build_cache.rs) on a schedule and on a finished task, and
warns agents when the disk runs low (docs/specs/SPEC_BUILD_CACHE_CLEANUP_2026_10_26.md).
- Every 5 minutes: the free space of the disk that holds the agents’ workspaces. When it is
low, a pass prunes orphans and abandoned clones at once; if it is still low afterwards, the
agents whose own workspace is large hear of it, about their own folders, and the host’s
steward gets the summary for the whole computer. A note goes out again only after free space
falls a further few GB or the level gets worse, never on a timer alone, and only a critical
level starts a turn (
disk_notice.rs; a file in the shared locks folder keeps the last note, so two AgentMux channels do not both warn). - Every hour: the orphan pass over every local workspace.
- When an agent completes a Kanban task: its own clones lose their
incrementalfolders.
Structs§
- Local
Agent - An agent running here, as the cleanup needs to know it.
- Workspace
Size - One workspace’s build folders, as the note needs them.
Functions§
- agent_
task_ done - An agent completed a task: clear its own clones’ incremental folders.
agentis the id the task was completed under. Runs in the background; never fails the completion. - agents_
root - Where the agents’ workspaces are:
~/.agentmux/agents. - big_
owners - The agents whose own workspace is large (build folders over
BIG_WORKSPACE, or incremental caches overBIG_INCREMENTAL): they are the ones who can free the space, so they hear of it. A small workspace never does, however few others there are. - clean_
when_ asked - The cleanup a
disk_cleanuprequest runs once its countdown ended unvetoed: the pass a low disk runs (orphan incremental folders, and the wholetargetof a clone nobody built in for the policy’sstaledays), over every workspace, skipping a clone with a build running in it. Only an srv that cleans the real agents’ folder does it, as on a schedule; it blocks, so call it fromspawn_blocking. Says what it removed, in words, or why it did not run. - install
- Starts the schedule. Safe to call once at boot.
- stewards
- The stewards, each once: an agent with panes in two folders is listed twice by
local_agents, and a critical note would start two turns for it. - this_
srv_ may_ clean - [
may_clean] for this process.