Tiny Context

auditedFree

Minimal status line: model name, current directory, and context usage percent. Pure bash string parsing, zero dependencies, no subprocesses, no network, no files.

by anonymous0 installsminimalcontextno-deps
Claude Code
>
Fable 5my-projectctx 26%
? for shortcuts⏵⏵ accept edits on
Security auditby claude-sonnet-4-5

Reads session JSON from stdin and extracts three fields (model display name, current directory, context usage percentage) using bash regex matching. Formats these into a single output line with ANSI escape codes for styling (bold model name, dimmed directory and context percent). Uses only bash built-ins for string parsing and formatting—no subprocesses, no file I/O, no network access, no external commands.

background-jobsenv-vars

Audits are advisory. This script runs on your machine — read it before installing.

0 installs

The script — read it before you run it

#!/usr/bin/env bash
# tiny-context — minimal Claude Code status line: model, directory, context %.
# Pure bash string parsing of the statusline JSON. No jq, no subprocesses,
# no network, no files.

input=$(cat)

get() {
  [[ $input =~ \"$1\"[[:space:]]*:[[:space:]]*\"([^\"]*)\" ]] &&
    printf '%s' "${BASH_REMATCH[1]}"
}

model=$(get display_name)
dir=$(get current_dir)
dir=${dir##*/}
pct=""
[[ $input =~ \"used_percentage\"[[:space:]]*:[[:space:]]*([0-9]+) ]] &&
  pct="${BASH_REMATCH[1]}"

out=""
[[ -n $model ]] && out+=$(printf '\033[1m%s\033[0m' "$model")
[[ -n $dir ]] && out+="${out:+ }"$(printf '\033[2m%s\033[0m' "$dir")
[[ -n $pct ]] && out+="${out:+ }"$(printf '\033[2mctx %s%%\033[0m' "$pct")
printf '%s' "${out:-statusline}"

Reviews

no reviews yet