New:Socket for Asana Is Now Available.Learn more
Get Started

ai-statusline

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ai-statusline

Customizable status line for AI coding assistants - real-time model, tokens, cost, git status display

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
3
-40%
Maintainers
1
Weekly downloads
 
Created
Source

ai-statusline

A high-performance, customizable status line for Claude Code CLI.

Built in Rust. Zero runtime dependencies. Sub-millisecond rendering.

[Opus] ▓▓▓▓░░░░░░ 42% | $0.08 | 5m 23s
📁 my-project | 🌿 main +3 ~2 | +156 -23 | v2.1.31

✨ Features:

  • 🎨 Interactive TUI configurator — Visual configuration with live preview
  • 26 customizable widgets — Model, tokens, cost, git status, and more
  • 🎭 11 built-in themes — Dracula, Nord, Tokyo Night, Catppuccin, and more
  • 🚀 Sub-millisecond rendering — Zero lag, always fresh
  • 🔧 Zero dependencies — Single 1MB binary, no Node.js required

Why ai-statusline?

ai-statuslineccstatusline
LanguageRust (compiled binary)TypeScript (bunx/npx)
Render time<1ms~200ms (npx overhead)
Binary size1.0 MBN/A (requires Node.js)
Runtime depsNoneNode.js or Bun
Data sourceNative JSON API (stdin)Transcript file parsing
AccuracyAlways correct (official API)Breaks across models/versions
Memory1.2 MB~50 MB (Node.js runtime)
Widgets26~15
Config formatTOML (with comments)JSON

Quick Start

Install

# npm (downloads platform binary automatically)
npm install -g ai-statusline

# Or direct binary
curl -fsSL https://raw.githubusercontent.com/mstuart/ai-statusline/main/scripts/install.sh | sh

# Or build from source
cargo install --path .

Configure Claude Code

Add to ~/.claude/settings.json:

{
  "statusLine": {
    "type": "command",
    "command": "ai-statusline"
  }
}

Restart Claude Code. Done.

Configure Your Status Line

🎨 Interactive TUI (Recommended for Beginners)

The easiest way to customize your status line:

ai-statusline config

The TUI configurator lets you:

  • Add/remove widgets — Choose from 26 available widgets with live preview
  • Reorder widgets — Use j/k to move widgets up/down
  • Switch themes — Browse and preview 11 built-in themes instantly
  • Configure powerline — Toggle powerline mode, change separators, enable auto-align
  • Manage layouts — Add/remove status lines, adjust flex modes
  • Save instantlyCtrl-S to save, changes apply immediately to Claude Code

⚡ Quick Presets

Apply pre-built layouts instantly:

ai-statusline preset full       # Two-line layout with everything
ai-statusline preset minimal    # Just model + context %
ai-statusline preset powerline  # Full layout with powerline arrows
ai-statusline preset compact    # Single line, compact values

Widgets

26 built-in widgets, all reading from Claude Code's native JSON API:

Core Metrics

WidgetTypeDescription
ModelmodelCurrent model name (Opus, Sonnet, etc.)
Context %context-percentageContext window usage with optional progress bar
Context Lengthcontext-lengthAbsolute token count (e.g., "42K")
Tokens Intokens-inputInput tokens from current usage
Tokens Outtokens-outputOutput tokens
Tokens Cachedtokens-cachedCache creation + read tokens
Tokens Totaltokens-totalAll tokens combined
Session Costsession-costRunning cost in USD with optional burn rate
Session Durationsession-durationElapsed time with optional API ratio
Block Timerblock-timer5-hour usage block tracker with progress bar

Git Integration

WidgetTypeDescription
Branchgit-branchCurrent branch (with detached HEAD support)
Statusgit-statusStaged/modified/untracked file counts
Worktreegit-worktreeActive worktree name (hidden when not in worktree)

Workspace

WidgetTypeDescription
CWDcwdCurrent directory (basename, full, fish-style)
Lines Changedlines-changedLines added/removed this session
VersionversionClaude Code version
Session IDsession-idTruncated session identifier

Advanced

WidgetTypeDescription
Vim Modevim-modeNORMAL/INSERT (hidden when vim mode off)
Agent Nameagent-nameActive agent (hidden when not using --agent)
Output Styleoutput-styleCurrent output style (hidden when "default")
Exceeds 200Kexceeds-tokensWarning when tokens exceed 200K threshold
API Durationapi-durationRatio of API wait time to total time
Custom Commandcustom-commandRun any shell command, display output
Custom Textcustom-textStatic text with emoji support
SeparatorseparatorVisual divider between widgets
Flex Separatorflex-separatorFlexible spacer that pushes widgets apart
Terminal Widthterminal-widthCurrent terminal width in columns

Configuration

TUI Configurator

Launch the interactive TUI to configure your status line visually:

ai-statusline config

Navigation:

  • Tab / Shift-Tab — Switch between tabs (Widgets, Theme, Powerline, Layout, Preview)
  • / — Navigate items
  • / — Switch between status lines (in Widgets tab)
  • Enter / Space — Select/toggle options
  • a — Add widget
  • d / Delete — Remove widget
  • j / k — Move widget down/up
  • Ctrl-S — Save configuration
  • q — Quit

Tabs:

  • Widgets — Add, remove, and reorder widgets on each status line
  • Theme — Browse and select from 11 built-in color themes
  • Powerline — Toggle powerline mode, cycle separators, enable auto-align
  • Layout — Add/remove status lines, change flex mode
  • Preview — Live preview of your current configuration

Manual Configuration

Config lives at ~/.config/ai-statusline/config.toml. Generate a default:

ai-statusline init

Or edit the TOML file directly for advanced customization.

Example config

theme = "dracula"
default_separator = " | "
default_padding = " "
flex_mode = "full-minus-40"
compact_threshold = 60
global_bold = false
inherit_separator_colors = false

# First status line
[[lines]]
type = "model"
color = "cyan"
raw_value = true

[[lines]]
type = "context-percentage"
metadata = { bar = "true" }

[[lines]]
type = "session-cost"
color = "yellow"
raw_value = true

[[lines]]
type = "session-duration"
raw_value = true

# Second status line (start a new line group)
[[lines]]
type = "cwd"
metadata = { fish_style = "true" }

[[lines]]
type = "git-branch"
color = "magenta"

[[lines]]
type = "git-status"

[powerline]
enabled = false
separator = "\uE0B0"
auto_align = false

Widget options

Every widget supports:

OptionTypeDescription
typestringWidget type (see table above)
colorstringForeground color (named, hex, or 256-color index)
background_colorstringBackground color
boldboolBold text
raw_valueboolCompact mode without labels
paddingstringOverride default padding
merge_nextboolMerge with next widget (no separator)
metadatatableWidget-specific options

Widget-specific metadata

WidgetKeyValuesDescription
context-percentagebar"true"Show progress bar
context-percentageinverse"true"Show remaining instead of used
session-costburn_rate"true"Show hourly burn rate
session-durationapi_ratio"true"Show API time percentage
block-timerbar"true"Show progress bar
block-timerbar_width"16"Progress bar width
cwdfull"true"Show full path
cwdfish_style"true"Fish-style abbreviation
cwdsegments"3"Show last N segments
custom-commandcommandshell cmdCommand to execute
custom-texttextany stringStatic text to display
separatorcharany charSeparator character
flex-separatorcharany charFill character (default: space)

Themes

11 built-in themes optimized for popular terminal color schemes:

ai-statusline theme list    # List all themes
ai-statusline theme set nord  # Switch theme

Available: default, solarized, nord, dracula, gruvbox, monokai, light, high-contrast, one-dark, tokyo-night, catppuccin

Color Support

ai-statusline auto-detects terminal color capabilities:

  • Truecolor (24-bit): detected via COLORTERM=truecolor
  • 256-color: detected via TERM=*256color*
  • 16-color: fallback for basic terminals
  • No color: respects NO_COLOR environment variable

Override with --color-level:

ai-statusline --color-level truecolor
ai-statusline --color-level none

CLI Commands

ai-statusline              # Render status line (reads JSON from stdin)
ai-statusline init         # Generate default config file
ai-statusline doctor       # Check environment compatibility
ai-statusline theme list   # List available themes
ai-statusline theme set <name>  # Switch theme
ai-statusline preset <name>     # Apply a preset layout
ai-statusline config            # Interactive TUI configurator
ai-statusline dump-schema       # Print expected JSON input schema
ai-statusline --version         # Show version

Performance

Benchmarked on Apple M1:

MetricValue
Render time<1ms
Binary size1.0 MB
Memory usage1.2 MB
Startup time<1ms

Claude Code debounces status line updates at 300ms. ai-statusline completes in <1ms, ensuring the status line is always fresh and never causes UI lag.

How It Works

Claude Code pipes JSON session data to your status line script via stdin. ai-statusline reads this JSON, applies your configuration, and prints formatted ANSI text to stdout. No transcript parsing, no file watching, no external dependencies.

Claude Code → JSON stdin → ai-statusline → ANSI stdout → Terminal

Building from Source

git clone https://github.com/mstuart/ai-statusline
cd ai-statusline
cargo build --release
# Binary at ./target/release/ai-statusline

License

MIT

Keywords

ai-coding

FAQs

Package last updated on 16 Feb 2026

Related posts