$ show jarrodwatts/claude-hud
Claude HUD is a real-time statusline plugin for Claude Code, the AI coding assistant. It runs as a subprocess and renders a multi-line or compact HUD below the input field, displaying context usage, rate limits, active tools, running agents, todo progress, git/jj status, memory usage, and cost tracking. The system reads session data from stdin (JSON payload) and optionally parses the Claude Code transcript JSONL file for detailed tool/agent activity. It is highly configurable with ~60+ options for layout, colors, visibility, and i18n (English, Simplified/Traditional Chinese). The architecture is modular: a CLI orchestrator (src/index.ts) loads config, runs git/jj/memory/extra-cmd in parallel, then renders via a pure render layer. It uses no external npm dependencies, relying on Node.js built-ins and child processes. The codebase demonstrates strong engineering practices: extensive test coverage (unit, integration, golden snapshot tests), dependency injection for testability, atomic file writes for persistent state, and thorough sanitization of untrusted inputs to prevent terminal injection. It is actively maintained with frequent releases and CI/CD pipelines.
The LLM identified 4 files worth highlighting for reuse:
Strips ANSI escape sequences, OSC sequences, control characters, and bidirectional text from untrusted strings to prevent terminal injection. Reusable in any CLI tool that renders user-provided or model-provided text.
Provides terminal width detection (COLUMNS env var, capped at 1000), CJK-aware character width calculation, and text wrapping that preserves ANSI hyperlinks. Reusable for any terminal UI that needs to handle mixed-width characters.
A type-safe configuration system with default schema, key-specific validation rules, nested merging, and safe file reading (size limits, symlink rejection). Could be extracted as a generic config loader for CLI tools.
Manages a daily/weekly cost ledger with atomic file writes, injectable dependencies for testing, and strict validation/recovery from corrupt files. Pattern for any CLI that needs to persist rolling counters.