Small useful tools

System Health for Codex

Give coding agents a clear view of the resources they use.

Interactive study

Explore the example
Memory %56.0Disk %31.0CPU %18.0
From the example below.

Why I’m interested

A coding agent starts builds, opens processes, and fills storage on the same computer I use. I want it to account for that cost. A CPU number needs its sample time beside it, and missing data needs an explicit state. Otherwise a tidy panel turns an old reading into a misleading picture of the machine.

Progress

The Python and TypeScript plugin includes a shared sampler, a Codex panel, process and storage views, and settings. The Rust example below shows how the panel distinguishes current, stale, and missing measurements. Its host values are synthetic.

A measurement needs an age

The same panel tells a different story when its sample is fresh, seven minutes old, or missing. Switch between those states with synthetic host data.

Choose an example

Synthetic host: Current

The CPU sample is four seconds old. Its age keeps the value tied to the time of measurement.

Memory %56.0Disk %31.0CPU %18.0
CPU state
Current
CPU sample age
4 seconds
Memory
56% of 16 GiB

Input

cpu_percent: Some(18.0)
cpu_age_seconds: Some(4)
memory_percent: 56
disk_percent: 31

Result

CPU state: Current

Synthetic host: Stale

Seven minutes passed since this CPU sample. The panel keeps the value visible and marks it stale, so its age travels with it.

Memory %56.0Disk %31.0CPU %82.0
CPU state
Stale
CPU sample age
420 seconds
Memory
56% of 16 GiB

Input

cpu_percent: Some(82.0)
cpu_age_seconds: Some(420)
memory_percent: 56
disk_percent: 31

Result

CPU state: Stale

Synthetic host: Missing

The CPU sample is missing. The panel reports that state explicitly instead of substituting a zero-percent reading.

Memory %56.0Disk %31.0CPU: unavailable
CPU state
Missing
CPU sample age
Unknown
Memory
56% of 16 GiB

Input

cpu_percent: None
cpu_age_seconds: None
memory_percent: 56
disk_percent: 31

Result

CPU state: Missing

Rust checks each synthetic value and its sample age, then classifies the measurement as current, stale, or missing.

What comes next

Connect a public metrics sample from the plugin to the same value-and-age checks.

Implementation and credits

How does a resource panel distinguish a fresh measurement from an old one?

Synthetic CPU, memory, and disk samples demonstrate the measurement states. Python and TypeScript implement the host plugin.

Switch between current, stale, and missing CPU samples and inspect the value and age together.

Rust validates sample values and ages. HTML controls select the measurement state.

A personal Codex plugin experiment.

Back to the collection