Skip to content

lf top

Real-time runtime telemetry for the LenserFight environment. Renders CPU, memory, GPU, service health, local battle load, and rolling graphs inside an alt-screen terminal UI that refreshes every second.

bash
lf top                          # compact mode (default)
lf top --mode expanded          # all panels + per-core CPU + graphs
lf top monitor                  # subcommand alias for expanded mode
lf top battle                   # battle operations center
lf top graph                    # rolling 60-second sparkline graphs
lf top infra                    # infrastructure services + host info
lf top stream                   # pipe-friendly scrolling output (no alt screen)

Modes

Compact (default)

Single-screen summary: CPU bar, memory bar, GPU (when detected), service status dots, battle counts, and active alerts. Fits in ~76 columns.

Expanded (lf top --mode expanded / lf top monitor)

All compact panels plus:

  • Per-core CPU breakdown (C00–Cnn in groups)
  • Rolling 60-second CPU and memory sparkline graphs
  • Full process info (PID, heap MB, uptime)

Adapts to up to 100 columns.

Battle (lf top battle)

Operational focus for active local battles: running/draft/executed counts, resource pressure summary (CPU/MEM/VRAM inline), and Ollama + Supabase service status. Useful during local battle run sessions.

Infrastructure (lf top infra)

Service connectivity panel — Ollama, Supabase, Cloud API, Docker — with probe detail (version strings, HTTP status). Shows host metadata: hostname, OS, architecture, Node version.

Graph (lf top graph)

Full-width Unicode sparkline graphs for CPU and memory drawn over a 60-second rolling window. The longer the session, the more context is visible.

Stream (lf top stream)

Emits one timestamped line per tick to stdout without clearing the screen:

2026-05-09T14:32:01.000Z  cpu=43%  mem=38%  gpu=61%  battles=2

No alt screen, no ANSI color by default in this mode. Designed to be piped:

bash
lf top stream --interval 5000 | tee telemetry.log
lf top stream | grep "alerts="

Keyboard controls

Controls are active in all modes except stream.

KeyAction
eToggle expanded / compact
gToggle graph mode
bToggle battle mode
iToggle infra mode
rForce immediate refresh
q / Ctrl-CQuit and restore terminal

Switching modes is instantaneous — the active mode badge in the title bar confirms the current view.


Options

FlagDefaultDescription
--modecompactInitial mode: compact, expanded, battle, infrastructure, graph, stream
--interval1000Refresh interval in milliseconds. Minimum 250.

Metrics reference

MetricSourceNotes
CPU totalos.cpus() delta between ticksAverage across all cores. First tick shows 0% (no prior sample).
CPU per-coreSame deltaVisible in expanded and graph modes.
Memoryos.freemem() / os.totalmem()Resident OS memory. Does not include kernel page cache.
Load averageos.loadavg()1m / 5m / 15m. Shown as trailing three numbers next to the CPU bar.
GPU utilizationnvidia-smi (async)Probed every 5 ticks. Silently absent when nvidia-smi is unavailable.
VRAMnvidia-smiUsed / total in GB. Shown only when GPU is detected.
GPU temperaturenvidia-smiDegrees Celsius, inline with VRAM row.
OllamaGET /api/version (2s timeout)Reports server version string when up.
SupabaseGET /auth/v1/health (2s timeout)Reads supabaseUrl from project config.
Cloud APIGET /health (2s timeout)Reads cloudApiUrl from project config.
Dockerdocker version subprocess (2s timeout)Reports client version string when up.
Battlesuser runtime local-battles/*.json plus legacy project-root filesCounts by status: running (ready), draft, executed/voted.
Heapprocess.memoryUsage().heapUsedV8 heap of the lf process itself.
Uptimeprocess.uptime()Time since the lf top session started.

Service probes run every 5 ticks and GPU detection runs every 5 ticks, both non-blocking. The displayed values between probes are the cached result from the last completed check.


Alerts

The dashboard generates inline alerts when thresholds are crossed. Critical alerts show in red; warnings in yellow. Each alert includes numbered recommended actions.

ConditionLevelExample recommendation
Memory ≥ 80%WarningMonitor Ollama VRAM; consider pausing idle agents
Memory ≥ 90%CriticalReduce active battles; enable low-memory mode
CPU ≥ 90%CriticalReduce concurrent executions; switch to a lighter model
GPU VRAM ≥ 90%CriticalReduce battles; switch inference provider; pause background agents
Any service downWarningService-specific fix command (e.g. ollama serve)

Alerts are recalculated on every tick. They auto-clear as soon as conditions normalise.


Non-TTY behaviour

When stdout is not a TTY (e.g. inside a CI script or shell substitution), lf top emits a single compact JSON snapshot and exits:

bash
lf top 2>/dev/null
# {"ts":"2026-05-09T14:32:01.000Z","cpu":43,"mem":38,"gpu":null,"alerts":0}

lf top

Real-time runtime telemetry — CPU, memory, GPU, services, battles. Keys: [e]xpand [g]raph [b]attle [i]nfra [r]efresh [q]uit

lf top monitor

Expanded runtime telemetry — all panels, per-core CPUs, graphs.

FlagTypeRequiredDescription
--intervalstringnoRefresh interval in ms

lf top battle

Battle operations center — battle load, agents, resource pressure.

FlagTypeRequiredDescription
--intervalstringnoRefresh interval in ms

lf top graph

Rolling sparkline graphs for CPU and memory (60s window).

FlagTypeRequiredDescription
--intervalstringnoRefresh interval in ms

lf top infra

Infrastructure view — service connectivity, host info.

FlagTypeRequiredDescription
--intervalstringnoRefresh interval in ms

lf top stream

Scrolling telemetry stream — pipe-friendly, no alt screen.

FlagTypeRequiredDescription
--intervalstringnoRefresh interval in ms