Skip to main content
Glama

codex-hud

中文文档

Zero-credential live terminal HUD and native MCP Statusline Provider for OpenAI Codex CLI (codex-cli >= 0.171.0, plus zero-experimental companion surfaces for every version).

codex-hud preview

Why codex-hud

Built-in Codex [tui] status_line wraps cleanly, but omits 5h/7d reset countdowns, quota pace forecasts, prompt-cache hit rate and anomaly detection, last-turn TTFT, visible-text decode speed (tok/s), active tools/skills/MCP/subagents, and working-tree Git dirty counts.

codex-hud fills those gaps with one pure SnapshotViewModel driving 5 parity surfaces — with zero binary patching, zero PTY wrapping, zero credential contact, zero network calls, and zero external runtime dependencies:

  1. Native MCP Statusline Provider (S1): Lightweight stdio MCP server (codex-hud-mcp, <200ms cold boot, <20ms in-memory resources/read, immune to Codex #62629 timeout cancellation). Baseline 0.171–0.172 uses row/text/link; v2 col/badge primitives unlock automatically at cli_version >= 0.174.0.

  2. External ANSI Bar (S2): codex-hud bar for any shell prompt or status strip.

  3. tmux Status Bar (S3): codex-hud tmux with # -> ## format-injection escaping.

  4. Watch Dashboard & Interactive Popup Inspector (S4): codex-hud watch and codex-hud -p for full untruncated Activity Snapshot inspection.

  5. OSC 8 Markdown Activity Snapshot (S5): codex-hud snapshot --markdown --write writing 0o600 snapshots in Hud Home only when the wall-clock-free contentDigest changes.

  • Native mode: Takes over the Codex TUI footer with complete presets (full, compact, agents, minimal, zen).

  • Companion mode: Defaults to the supplement preset (showing only metrics absent from the built-in Codex footer: 5h/7d countdown + pace, Cache% / TTFT / tok/s, Git dirty counts, active Tools / Skills / MCPs / Subagents, and badges). Because Codex permits one active status_line_provider, yetone/magpie users can either switch to codex-hud in /statusline or keep magpie in the TUI footer while running codex-hud watch / tmux / -p side by side with zero conflict.

Related MCP server: Gauge

Quick Start

Requires Node.js ^22.20.0 || >=24.0.0.

Option A: Official Codex Plugin (Native Statusline, Zero-Build)

codex plugin marketplace add ifelseboyxx/codex-hud --ref plugin-dist
codex plugin add codex-hud@codex-hud

Then inside Codex CLI (>= 0.171.0):

  1. Run /experimental and enable Custom status line.

  2. Run /statusline -> Choose a status line provider -> Codex HUD.

Option B: Standalone CLI & MCP Registration (npm)

npm i -g codex-hud

# Register native MCP Statusline Provider via official Codex CLI (zero manual TOML edits)
codex mcp add codex-hud -- codex-hud-mcp
# Or run: codex-hud setup --register

Option C: Zero-Experimental Companion Mode (All Codex Versions)

codex-hud watch                  # Live split-pane companion dashboard
codex-hud tmux                   # tmux status-right string (defaults to supplement preset)
codex-hud bar --preset full      # One-shot ANSI status bar
codex-hud -p                     # Interactive popup inspector
codex-hud snapshot --keybindings # Print tmux / Zellij / terminal keybinding snippets

Optional Async Lifecycle Hooks (Instant ! Approval & Sub-5ms Tool Updates)

codex-hud wire      # Strictly appends async:true hooks to ~/.codex/hooks.json (preserves existing trust indices)
codex-hud unwire    # Removes strictly codex-hud-owned entries; preserves all foreign hooks

After running codex-hud wire, open /hooks in Codex CLI to review and approve the newly appended hooks. codex-hud never uses --dangerously-bypass-hook-trust.

Presets

Preset

Default Use

Included Lines

Highlight

full

Native MCP / wide pane

identity, usage, activity, tools, skills, mcps, agents

Complete telemetry and activity rows

compact

Medium pane

identity, usage, activity

Dense 3-row summary

agents

Multi-agent workflows

identity, usage, agents, tools, mcps

Subagents and tool calls first

minimal

Small terminal

identity, usage

Model, badges, context, quota

zen

Distraction-free

usage

Context and quota only

supplement

External companion default

identity (git/perf/badges), usage (quota), activity, tools, skills, mcps, agents

Only metrics absent from built-in Codex footer

Metric Fidelity & Honest Degradation

Metric

Primary Source

Fidelity

Degradation Policy

5h / 7d Quota & Reset Countdown

MCP StatuslineState / Rollout token_count (limit_id="codex")

Exact

Cross-session fallback marked stale before turn 1; auto-hidden on API-key plans without windows

Quota Pace Forecast

Pure domain window-relative model

Exact

Suppressed during early settling window; shows ~XX% or ~0% <eta>

Context Budget & Compaction

MCP StatuslineState / Rollout token_usage_record + token_count

Exact

Suppresses post-compacted input_tokens = 0 sentinel frame to prevent 0% flicker

Categorical Context Breakdown

Not exposed locally by Codex CLI

Unavailable

Honestly omitted rather than fabricated

Prompt Cache% & Cache Anomaly

Rollout single-request usage (MCP cumulative fallback only)

Exact

Flags >25pp drop on consecutive >=10k-token same-model turns within 5m; ignores compaction and cumulative fallback

Last-Turn TTFT

Rollout task_complete.time_to_first_token_ms

Exact (last turn)

Measures to first non-reasoning output token; live mid-turn streaming TTFT is omitted

Decode Speed (tok/s)

Rollout item_completed(AgentMessage)

Approx (visible text)

Guarded by dur_ms >= 200 && tokens >= 16 against buffered flush spikes

Tools / MCPs / Skills / Subagents

Rollout streaming events + optional async Hooks

Exact (explicit $skill) / Approx (implicit SKILL.md read)

Never treats thread_spawn_edges.status = 'open' alone as running

Session Cost / Credits

MCP StatuslineState.thread.usage.cost only

Exact (host-reported)

No built-in pricing table; supports offline USD/CNY display via usdToCnyRate

! Approval Badge

Optional PermissionRequest Hook

Hooks-Only

Cleared on PostToolUse, Stop, Interrupt, and SessionEnd

Security Guarantees

See SECURITY.md for the full threat model. Every release is verified by 14 machine-enforced gates in pnpm verify:

  • Zero credentials & zero network: AST-enforced ban on network modules, fetch, WebSocket, keychain commands, auth.json, config.toml, shell_snapshots, and app-server/ipc sockets across all src/.

  • Zero-write Codex Home hot path: All owned config, caches, locks, and snapshots live in private 0o700/0o600 Hud Home ($XDG_CONFIG_HOME/codex-hud & $XDG_CACHE_HOME/codex-hud; AppData on Windows). Optional state_<N>.sqlite fallback (<= 32 MiB) runs strictly through isolated /tmp 0o700 copies supporting both WAL and DELETE -journal modes.

  • Privacy projection: Raw prompts, tool_input, tool_response, file diffs, and assistant text are dropped at parse boundaries before caching or rendering.

CLI Reference

codex-hud mcp-statusline      # Run native stdio MCP statusline provider
codex-hud watch [options]     # Live companion inspector dashboard
codex-hud bar [options]       # Single ANSI status bar frame
codex-hud tmux [options]      # tmux-escaped status line (# -> ##)
codex-hud snapshot [options]  # Full snapshot, --sessions, --markdown --write, --keybindings, or -p popup
codex-hud preview [options]   # Offline deterministic previews (--preset, --all, --surface)
codex-hud configure [options] # --show, --preset, --set key=value, --reset, --fields, -i interactive TUI
codex-hud setup [options]     # Official `codex mcp add/remove/list` registration helper & plugin guide
codex-hud wire / unwire       # Append or remove optional async passive hooks (--status)
codex-hud doctor [--json]     # Isolated read-only environment, host contract, and permission check
codex-hud clean [--all]       # Clean expired or all owned cache files inside Hud Home

Development

pnpm install --frozen-lockfile
pnpm verify

See docs/architecture.md, docs/host-contracts.md, CODING_STANDARDS.md, and CONTRIBUTING.md.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      A visual surface for terminal Claude Code that provides a persistent dashboard the agent curates itself, per-session telemetry with cost, and a menu bar glyph for status.
      -
    • A
      license
      A
      quality
      B
      maintenance
      Enables local monitoring of Codex token usage, prompt-cache reuse and estimated credits by reading existing session logs and exposing an embedded dashboard plus tools for whole-chat, latest-call and latest-prompt readings and call history. All collection and refresh stay local on-device, requiring no model calls, API key or hosted backend.
      5
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      An Antigravity MCP App plugin that surfaces real-time context window occupancy, remaining tokens, prompt cache hit rate, output speed, rolling 5-hour/7-day quota usage, and a 28-day activity heatmap by read-only parsing of local transcript logs. It presents these metrics in a theme-aware sidebar dashboard without patching or injecting into the host client.
      MIT