Skip to content
maxleePublic

About

Ultra-fast 100% Pure Rust real-time statusLine HUD plugin for Google Antigravity CLI (agy)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

AGY HUD Logo

AGY HUD (agy-hud)

Ultra-fast, zero-dependency, 100% Pure Rust real-time statusline HUD for Google Antigravity CLI (agy)

CI Release Rust 2024 Unsafe Forbidden License: MIT

English · 简体中文 · Quick Install · Features · CLI & Config · Architecture · Releases


AGY HUD renders a live, theme-adaptive heads-up display directly beneath your Antigravity CLI (agy) prompt — surfacing agent state, execution mode, model & reasoning effort, TTFT-stripped token throughput (~tok/s), multi-VCS workspace status (git, jj, hg), context window pressure, prompt cache hit rate, quota pace, active tools, subagents, and task.md checklist progress in ~1–3 ms warm execution time with zero Node.js or runtime VM dependencies.

Inspired by jarrodwatts/claude-hud and purpose-engineered from the ground up in safe Rust (#![forbid(unsafe_code)]) for the Antigravity CLI plugin & statusLine ecosystem.


📸 Live Preview

Standard Multi-Row Expanded Layout (76–179 cols)

╭─ 🔧 TOOL │ [AUTO] │ [Gemini 4 Argon · med] Pro · 🚗 ~118 tok/s (64~142) │ agy-hud git:(feat/rust-hud* ↑2) │ ⏱ 12m
├─ Ctx ████▓··· 59.3% (152k/256k · ↻2) · ⚡ 75% Cache │ ~$0.38 · agents 1/2 · tasks 1 · 🛡 Sandbox ON
├─ Quota(weekly) ▓···· 16% (4d 18h)
├─ ◐ run_command: Cargo test execution · ✓ edit_file ×2: render.rs · ✓ read_file ×5: SKILL.md
├─ Skills: hud, agy-customizations │ MCP: context7
├─ ◐ CLI Docs Researcher [research · 3.1-pro] (1m 15s) │ ◷ Waiter [self · Hydrogen] (20s) │ ✓ Security Auditor [self] (1m)
╰─ ▸ Verify compile-time arch_guard boundaries (2/4 · 50%)

Ultra-Wide Single-Line Idle (>= 180 cols) & Narrow Auto-Compact (< 76 cols)

# Ultra-wide terminal (>= 180 cols, idle) — collapses cleanly into one crisp line:
✓ IDLE │ [AUTO] │ [Gemini 4 Argon · med] Pro · 🚗 ~118 tok/s (64~142) │ agy-hud git:(main) │ ⏱ 5m │ Ctx ███████····· 59.3% (152k/256k) · ⚡ 75% Cache │ Quota(weekly) ▓···· 16% (4d 18h)

# Narrow split pane (< 76 cols, high context) — progressive degradation without wrapping:
⚡ WORK │ [AUTO] │ [Argon · M] │ agy-hud git:(main*)
Ctx ███████░ 89.6% │ Quota(weekly) 92% (1h 30m)
◐ run_command: Cargo test execution

HUD Anatomy

Row / Segment What It Shows Key Config Toggle
State & Mode Live IDLE / WORK / TOOL / CONFIRM state, [PLAN] / [AUTO] / [ACCEPT] (accept-edits & auto_edit) cycle mode, [BATTLE] / [BATTLE #N] battle badge (battle.{status, focused_arm}), /plan detection, VIM badge, and optional 8-char #<id> short session ID for /resume <prefix> display.showState, display.showMode, display.showSessionId
Model, Tier & Speed Compact model name, reasoning effort (low/med/high), normalized plan tier (Pro/Ultra), and TTFT-stripped ~tok/s decode rate with speed-tier emoji (🐢/🛵/🚗/🚅/✈️/🚀/🛰️/🛸/👽, hidden in ascii mode) and session (min~max) range display.showModel, display.showPlanTier, display.showSpeed, display.glyphMode
Workspace & VCS Clickable file:// OSC 8 project path (plus optional project › subdir breadcrumb), clickable GitHub branch OSC 8 links, git (worktrees, dirty, unpushed ↑N thresholds, file stats), jj (bookmarks, @change_id, conflicts), or hg, plus zero-subprocess fast path when stdin.vcs suffices display.showProject, display.showLaunchDir, vcs.pushWarningThreshold, vcs.showFileStats
Context & Meta Turn-1 conversation DB & compaction-watermark-scaled (256k, 512k, or learned ceiling; neutral <used>/? with (>200k) cold-start hint from exceeds_200k_tokens on unconfirmed large windows) 8th-block Unicode context bar + ↻N compaction badge, prompt Cache hit %, session/subagent/daily/weekly cost ($1.38 (sub $0.42), Today / Week), inline counts (agents, tasks, +N queued, opt-in art), and Sandbox badge (🛡 Sandbox ON / amber 🛡 Sandbox ON (net) via sandbox.allow_network) display.contextScale, display.showContextBar, display.showDailyCost, display.showWeeklyCost, display.showCounts, display.showArtifacts
Quota Pace Model-routed quota buckets (5h / weekly) with exhausted 0%-remaining recovery & sentinel (<= 2000-01-01) timestamp filtering, burn-rate projection (▲ pace alert when projected > 90% / > 100% before reset), optional low-usage threshold hiding, and reset countdown (GEMINI_API_KEY API-key mode auto-skips quota probes) display.showQuota, display.quotaPace, display.quotaThreshold, quota.backgroundRefresh
Activity & Composable Rows Folded tool invocations (×N deduplication), active Skills & MCP servers (! error alerts), Subagents (◐/◷/✗/✓ with compact per-agent model badges e.g. [research · 3.1-pro] / [Hydrogen] & 60s retirement), task.md progress, and customizable row merging / right-alignment display.mergeGroups, display.rightAlign, display.showTools, display.showSubagents, display.showSubagentModel, display.showTodos
Native Terminal Title Optional < 1 ms zero-subprocess single-line terminal tab/window title via agy-hud title (● repo (branch*) · Model · 34% — Title) install --with-title / --no-title, preview --title

✨ Highlights

  • ⚡ Native ~1–3 ms Warm Execution + Incremental O(Δ) Cursor: Single LTO-optimized binary (~930 KB), zero VM startup overhead, std::thread::scope parallel probes, and an incremental transcript.jsonl byte-offset cursor (transcript-cursors/<fnv64>.json) that preserves early skills/MCP/tool counts even in multi-megabyte sessions.
  • 📐 Turn-1 DB Ceiling, Honest Cold-Start & Quota 0% Resilience: Reads the active conversation's SQLite B-tree and committed -wal pages strictly read-only in pure Rust (zero C/SQLite dependencies or -shm side effects) to resolve exact model compaction ceilings from Turn 1, renders a neutral <used>/? ratio on unconfirmed >= 900k windows instead of guessing 256k, detects implicit compactions via a dual threshold (> 5k and >= 25% prompt drop) with shadow-model & Undo/rewind immunity, and reconstructs 0%-remaining quota buckets while filtering sentinel (<= 2000-01-01) timestamps.
  • 🎯 Hybrid TTFT-Stripped ~tok/s & Quota Burn-Rate (▲): Separates thinking/prefill latency (TTFT) and tool wait time from pure streaming decode throughput, displaying a speed-tier emoji (🐢 <50, 🛵 50–99, 🚗 100–149, 🚅 150–199, ✈️ 200–249, 🚀 250–299, 🛰️ 300–399, 🛸 400–499, 👽 500+; hidden when display.glyphMode=ascii) and session (min~max) range from completed steps / native stdin rates (preserved across model switches, shown once two distinct rounded speeds exist; toggled via display.showSpeed). Meanwhile display.quotaPace projects 5h/weekly quota burn velocity (▲ amber/red warning before you hit 0%) and display.showDailyCost / showWeeklyCost tracks cross-session spend without double counting.
  • 🎨 Theme-Safe, Grapheme-Cluster-Accurate & Composable Layout: Zero hardcoded white (37m/97m) or gray (90m) foreground codes. Full Unicode extended grapheme cluster width engine (ZWJ emoji sequences, skin-tone modifiers, regional flag pairs, CJK 2-col alignment), display.mergeGroups + display.rightAlign row composition, and 3 glyph sets (unicode, nerd, ascii).
  • 🌿 Hardened git, jj & hg Support: Windows CreateProcessW PATH-hijack protection, scope-aware Git [include] filter neutralization (preserving global git-lfs while disarming untrusted repo filters, with zero-subprocess .git/HEAD fallback), clickable GitHub branch OSC 8 links, unpushed ↑N thresholds, and FNV-1a sharded mtime caches.
  • 🔄 Built-in Verified Self-Update: Non-blocking 6-hour release check surfaces a compact header badge (↑ vX.Y.Z · /hud-update, automatically falling back to /agy-hud:hud-update if unprefixed shortcuts are absent or conflicted) and upgrades the binary, plugin, and managed shortcuts in one SHA-256-verified step while preserving --stack and user config.json.
  • 🌏 Native Multilingual UI: Auto-detects system language or switch between English (en), Simplified Chinese (zh-Hans), and Japanese (ja).

📦 Installation

Requirements

  • Antigravity CLI (agy) v1.4.5+ (fully aligned with v1.5.4–v1.5.13 schemas, /title, /resume <prefix>, GEMINI_API_KEY quota suppression, and auto_edit mode)
  • Zero Rust / Node.js / npm required for the one-line installer, GitHub plugin, or prebuilt installations (rustc 1.85+ only if compiling from source)

Marketplace status: Submitted to the Antigravity Marketplace and currently under review. Once approved, you'll also be able to add AGY HUD directly from Customizations → Marketplace in Antigravity Desktop and click the "Set up the HUD status line in Antigravity CLI" starter prompt chip to activate both the status line and global /hud & /hud-update shortcuts.

Dual-Compatible Slash Commands (/hud + /agy-hud:hud)

agy-hud is engineered to work seamlessly as both a full Antigravity plugin and short, ergonomic slash commands across Antigravity CLI (agy) and Antigravity App:

  • Full Plugin Bundle: Retains the standard agy-hud v1 plugin manifest (Marketplace & agy plugin install compatible), exposing /agy-hud:hud and /agy-hud:hud-update.
  • Conflict-Safe Unprefixed Shortcuts: Whenever install.sh, agy-hud install, or agy-hud update runs, it also deploys managed standalone copies to ~/.gemini/config/skills/hud and ~/.gemini/config/skills/hud-update (tagged with .agy-hud-managed.json), enabling /hud and /hud-update everywhere in both agy CLI and Antigravity App.
  • Zero Overwrite Guarantee: Before deploying each shortcut, agy-hud inspects existing paths/symlinks and reads ~/.gemini/config/skills.json strictly read-only. If you already maintain your own custom /hud or /hud-update skill (or matching skills.json entry), agy-hud leaves it untouched without mutating skills.json and keeps using /agy-hud:hud / /agy-hud:hud-update.
  • Immediate vs. One-Time Activation:
    • One-line install.sh users get /hud and /hud-update (alongside /agy-hud:hud and /agy-hud:hud-update) immediately.
    • agy plugin install / Marketplace users run /agy-hud:hud (or click the starter prompt chip / ask in natural language) once to activate; after that, /hud and /hud-update work everywhere too.

Method 1: One-Line SHA-256 Verified Installer (Recommended — macOS & Linux)

Detects your OS/CPU (darwin-arm64, darwin-x64, linux-x64, linux-arm64), verifies the archive against SHA256SUMS, registers the agy-hud plugin (/agy-hud:hud & /agy-hud:hud-update), deploys conflict-safe managed shortcuts (/hud & /hud-update) to ~/.gemini/config/skills/, installs ~/.gemini/antigravity-cli/agy-hud/bin/agy-hud, and atomically updates settings.json:

curl -fsSL https://raw.githubusercontent.com/maxlee/agy-hud/main/install.sh | sh

Want to stack below Antigravity's built-in status bar instead of replacing it?

curl -fsSL https://raw.githubusercontent.com/maxlee/agy-hud/main/install.sh | sh -s -- --stack

Method 2: Install via agy CLI from GitHub (macOS & Linux)

Install the plugin directly from the GitHub repository (no Marketplace listing required):

agy plugin install https://github.com/maxlee/agy-hud

Then launch agy and run /agy-hud:hud (or click the "Set up the HUD status line in Antigravity CLI" starter prompt chip if installed via Antigravity Desktop, or ask in natural language) once to activate the status line in ~/.gemini/antigravity-cli/settings.json and deploy the managed /hud & /hud-update shortcuts to ~/.gemini/config/skills/ (after activation, /hud and /hud-update work in both Antigravity CLI and Antigravity App; if agy was already open, run /skills reload first).

Method 3: Prebuilt Release Archives (macOS / Linux / Windows)

Download prebuilt binaries and SHA256SUMS from GitHub Releases:

Platform Archive Rust Target Triple Notes
macOS (Apple Silicon) agy-hud-darwin-arm64.tar.gz aarch64-apple-darwin Native M1 / M2 / M3 / M4
macOS (Intel) agy-hud-darwin-x64.tar.gz x86_64-apple-darwin Native x86_64
Linux (x64) agy-hud-linux-x64.tar.gz x86_64-unknown-linux-musl Fully static musl (zero glibc issues)
Linux (ARM64) agy-hud-linux-arm64.tar.gz aarch64-unknown-linux-musl Fully static musl
Windows (x64) agy-hud-windows-x64.zip x86_64-pc-windows-msvc Native agy-hud.exe (quote-safe path handling)

After extracting the archive, run agy-hud/scripts/bin/<platform>/agy-hud install (or agy-hud\scripts\bin\windows-x64\agy-hud.exe install on Windows) to wire settings.json and deploy the managed /hud & /hud-update shortcuts globally.

Method 4: Build from Source

git clone https://github.com/maxlee/agy-hud.git
cd agy-hud
cargo build --release
agy plugin install .
./target/release/agy-hud install

🛠️ CLI & Configuration

In-Session Slash Commands (agy CLI & Antigravity App)

Command Description
/hud · /agy-hud:hud Interactively install, diagnose, preview, or customize layout, language, and badges in natural language (/hud works globally in CLI & App after agy-hud install; /agy-hud:hud is always available via the plugin)
/hud-update · /agy-hud:hud-update Check GitHub Releases and perform a SHA-256-verified binary, plugin, and managed shortcut self-upgrade in one step
/statusline · /title Built-in agy commands to toggle the bottom status bar or native terminal tab title on or off

Native CLI Subcommands

Invoke via ~/.gemini/antigravity-cli/agy-hud/bin/agy-hud (or ./scripts/agy-hud inside a checkout):

Subcommand Purpose
install [--stack] [--replace] [--with-title] [--no-title] Deploy native binary, configure statusLine (and optionally native title, preserved across upgrades) in settings.json with backups, and install conflict-safe /hud & /hud-update shortcuts
uninstall [--plugin] [--keep-config] [--reset-default] Remove statusLine and agy-hud-managed title (restoring prior third-party backups or official agy defaults), clean backups, remove managed shortcuts & HUD directory
title Native terminal window/tab title mode: reads agy JSON from stdin and prints a sanitized single plain-text line (<= 80 cols) with zero subprocesses or disk writes
doctor [--pretty] Inspect runtime, plugin enablement, unprefixed shortcut status, statusLine & title wiring, config validity, and glyph alignment
preview [--state <name>] [--last] [--set k=v] [--title] Render showcase, idle, tool_use, confirm, high-context, inline JSON, or last live snapshot (add --title for plain single-line title preview)
schema [query] Browse all validated configuration keys, types, defaults, and descriptions
set <key>=<value> ... / set --undo Atomically update ~/.gemini/antigravity-cli/agy-hud/config.json or revert the previous change
update [--check] [--force] Check for or apply the latest SHA-256-verified release from GitHub (binary, plugin, and managed shortcuts)
quota refresh Run an isolated one-shot agy -p /usage sync to reconcile local quota cache
report [--note "..."] Export a width-preserving privacy-scrubbed diagnostic JSON bundle + replayable .case regression fixture

Common Customization Recipes

# Preview all 5 responsive layout & language presets (or native terminal tab titles)
~/.gemini/antigravity-cli/agy-hud/bin/agy-hud preview --state showcase
~/.gemini/antigravity-cli/agy-hud/bin/agy-hud preview --state showcase --title

# Enable native terminal tab title alongside statusLine (`agy` `/title`)
~/.gemini/antigravity-cli/agy-hud/bin/agy-hud install --with-title

# Switch UI to Simplified Chinese and enable +/- VCS file stats
~/.gemini/antigravity-cli/agy-hud/bin/agy-hud set language=zh-Hans vcs.showFileStats=true

# Enable cross-session Today/Week cost ledger, launch-dir breadcrumb & Git push alerts
~/.gemini/antigravity-cli/agy-hud/bin/agy-hud set display.showDailyCost=true display.showWeeklyCost=true display.showLaunchDir=true vcs.pushWarningThreshold=5 vcs.pushCriticalThreshold=15

# Merge Context + Quota onto one row (with automatic narrow-terminal CJK column stacking) and right-align Quota
~/.gemini/antigravity-cli/agy-hud/bin/agy-hud set 'display.mergeGroups=[["context","quota"]]' 'display.rightAlign=["quota"]'

# Hide quota bar until 25% used (automatically surfaces earlier if burn pace `▲` is fast)
~/.gemini/antigravity-cli/agy-hud/bin/agy-hud set display.quotaThreshold=25 display.quotaPace=true

# Switch context bar denominator between DB/learned compaction ceiling (default) and raw physical model ceiling
~/.gemini/antigravity-cli/agy-hud/bin/agy-hud set display.contextScale=compaction

# Switch glyph mode: unicode (default) | nerd (Nerd Fonts) | ascii (strict 7-bit)
~/.gemini/antigravity-cli/agy-hud/bin/agy-hud set display.glyphMode=nerd

# Customize header badges (conversation title, 8-char session ID prefix, plan tier, ~tok/s speed, subagent model badges)
~/.gemini/antigravity-cli/agy-hud/bin/agy-hud set display.showTitle=true display.showSessionId=true display.showSpeed=true display.showSubagentModel=true
~/.gemini/antigravity-cli/agy-hud/bin/agy-hud set display.showProject=false vcs.enabled=true

# Show upstream `agy` `stdin.artifact_count` (`art`, or `产物` in `zh-Hans`; off by default because fresh sessions report 1)
~/.gemini/antigravity-cli/agy-hud/bin/agy-hud set display.showArtifacts=true

# Hide all inline counts (`agents`, `tasks`, `art`, and queued inputs)
~/.gemini/antigravity-cli/agy-hud/bin/agy-hud set display.showCounts=false

# Undo the most recent `set` command
~/.gemini/antigravity-cli/agy-hud/bin/agy-hud set --undo

Environment Variables

Variable Description
AGY_HUD_DISABLE=1 Suppress HUD output for the current terminal session without modifying settings.json (AGY_HUD_DISABLE=1 agy)
AGY_CLI_DIR Override Antigravity CLI config directory (default: ~/.gemini/antigravity-cli)
AGY_HUD_HOME Override HUD data & config directory (default: ~/.gemini/antigravity-cli/agy-hud)

🧹 Clean Uninstall (Zero Residue)

Uninstall at any time with a single command — removes "statusLine" and agy-hud-managed "title" from settings.json (restoring prior third-party configs from previous-statusline.json / previous-title.json or official defaults while keeping all your other settings intact), cleans tracked backups, unregisters the plugin, removes only agy-hud-managed shortcuts under ~/.gemini/config/skills/{hud,hud-update} (verified via .agy-hud-managed.json so any custom /hud skill or skills.json is never touched), and deletes ~/.gemini/antigravity-cli/agy-hud:

curl -fsSL https://raw.githubusercontent.com/maxlee/agy-hud/main/uninstall.sh | sh

Offline alternative:

~/.gemini/antigravity-cli/agy-hud/bin/agy-hud uninstall --plugin

(Append --keep-config if you want to preserve config.json for future reinstalls.)


🔒 Architecture & Security (THE LINE)

agy-hud enforces capability isolation at compile time across a two-crate Rust workspace (continuously verified by arch_guard.rs). See ARCHITECTURE.md for full details:

agy-hud/
├── crates/
│   ├── hud-core/   # Pure deterministic logic & layout crate (#![forbid(unsafe_code)], ZERO I/O)
│   └── hud-cli/    # Thin capability shell: bounded file seeks, hardened VCS probes, atomic cache I/O
├── skills/         # Antigravity slash-command skills (/hud & /agy-hud:hud, /hud-update & /agy-hud:hud-update)
├── scripts/        # POSIX platform router & SHA-256 Marketplace binary sync tooling
└── plugin.json     # Strict Antigravity v1 plugin manifest
  1. Zero-I/O Pure Core (hud-core): Depends only on serde and serde_json (11 total transitive crates) and is statically forbidden from referencing std::fs, std::process, std::net, std::env, or std::os.
  2. Command-Injection-Safe VCS Probes (hud-cli):
    • Git: Enforces -c protocol.allow=never, -c core.fsmonitor=false, --no-optional-locks, GIT_NO_LAZY_FETCH=1, and dynamically parses .git/config in memory to neutralize repo-local [filter "<name>"] clean/smudge/process drivers before invoking git.
    • Jujutsu (jj) & Mercurial (hg): Enforces --ignore-working-copy --at-operation=@ --no-pager and HGPLAIN=1 --config extensions.fsmonitor=! under a strict 1200 ms timeout.
  3. Terminal Escape Firewall (terminal_filter): Every line written to stdout is scrubbed against OSC 52 clipboard exfiltration, window title hijacking, cursor-movement CSI escapes, and Unicode Bidi Trojans (U+202A..U+202E, U+2066..U+2069), allowing only SGR styling and local file:// OSC 8 links.

🧪 Development & Verification

cargo fmt --all -- --check                             # Verify Rustfmt formatting
cargo clippy --workspace --all-targets -- -D warnings  # Enforce zero Clippy warnings
cargo test --workspace                                 # Run unit, CLI e2e, Git filter canary & arch_guard suites
cargo build --release                                  # Build stripped LTO native binary
agy plugin validate --strict .                         # Validate Antigravity plugin manifest & skills

📄 License

Distributed under the MIT License. Copyright © Max.

About

Ultra-fast 100% Pure Rust real-time statusLine HUD plugin for Google Antigravity CLI (agy)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages