Expand description
Tower: CPU and memory per task, for the read-only task manager pane (SPEC_TOWER_TASK_MANAGER_PANE_2026_10_08.md).
A task is a pane and every process it started, plus one more for
AgentMux itself. Each sample takes one process snapshot
(agentmux_procstats) and groups it:
- The pane’s tracker (
process_tracker): a Job Object or cgroup on an agent, which nothing it starts can leave; a best-effort scan on macOS. - The pane’s process tree where there is no tracker membership (a terminal on Linux or macOS): descendants of its shell.
- Sticky membership: a process seen in a task stays in it until it exits, even after it is reparented away from the tree.
- AgentMux: the backend’s own ancestry while it is AgentMux’s (launcher, window host) and everything under it no task claimed.
Sampling is driven by the pane (tower.sample): nothing runs while no
Tower is open, and two panes asking at once share a sample.
Structs§
- Block
Label - How a block is named and what kind of task it is.
- Exited 🔒
- A task’s process that has exited: what it was when last seen.
- Group 🔒
- Grouping 🔒
- Inputs
- What the sampler is told about the panes.
- Sampled 🔒
- One measurement: the process table, every process’s CPU rate, the grouping
and each task’s CPU account rate.
renderturns it into an answer. - State 🔒
- Tower
- The process-wide sampler. Its state is the previous sample (for CPU rates) and sticky membership.
Constants§
- AGENTMUX_
TASK_ ID TowerTask::idof AgentMux’s own processes.- EXITED_
LINGER 🔒 - How long a task’s exited process stays listed (dimmed, with what it used): long enough to see a build’s compilers that a 2 s sample catches once or never. SPEC_TOWER_AGENT_CENTRIC_VIEWS_2026_10_08.md §5.4.
- INTERVAL
- How often the pane asks while it is visible.
- MAX_
EXITED 🔒 - At most this many exited processes are kept, the newest: a big build runs thousands of compilers a minute.
- MAX_
TREE 🔒 - Most processes one task’s tree walk takes (a fork bomb shouldn’t stall a sample).
- REUSE_
WITHIN 🔒 - A request this soon after the last sample gets that sample: two Tower panes (or a re-render) don’t double the cost or shrink the CPU window.
- SHARED_
TOP - Rows a snapshot sent to another machine carries per list (busiest,
largest), as a remote frame does (
agentmux_remote::procs). - STALE_
AFTER 🔒 - A gap longer than this since the last sample starts the CPU rates over, so a pane that was hidden for minutes doesn’t show minutes-long averages.
Functions§
- advance 🔒
- Measure: group the table, take every process’s and task account’s rate
since the previous measurement, and remember sticky membership.
cmdlinereads a process’s command line, for labelling AgentMux’s own processes only (tower_agentmux). - block_
label - A pane’s name in Tower and on its stats badge: the agent’s name, else what
the terminal runs.
Nonefor a block that no longer exists. - group 🔒
- Group a snapshot into tasks (module doc). Pure: everything it needs is in its arguments.
- is_
agentmux_ 🔒process - keep_
top 🔒 - Keep the
topbusiest by CPU and thetoplargest by memory (their union, in their original order). - proc_id 🔒
- render 🔒
- The answer from a measurement. Pure apart from
labelsandrenderer. - renderer_
suffix 🔒 - What a renderer row adds after its type: the window or pane it serves.
- share
- Make a snapshot fit to send to a paired device: drop the tasks
hiddennames (an agent hidden from paired devices) and their processes, keep the host rows matching every word offilter, then only thetopbusiest andtoplargest of those. Totals keep counting every process. - sum_
known 🔒 - A sum of rates, or
Nonewhen none of them is known yet (a first sample), never a made-up 0. - track_
peaks_ 🔒and_ exits - Update each process’s peak memory, and note the tasks’ members that were
in the previous measurement and are gone from this one. Returns the
peaks by index and the exited processes still within
EXITED_LINGER. - tracking_
label 🔒