Cogitator Rites of the Omnissiah

auditedFree

Adeptus Mechanicus status line for the faithful tech-priest. Your context window is the machine spirit's soul: as it fills the Warp bleeds in and heresy rises, green to red, until you purge with /compact. Model becomes your rank, cost the Tithe, effort your sacred rites.

by fishmug202 installswarhammer-40kadeptus-mechanicusthemedcontextreactive
Claude Code
>
++ MACHINE SPIRIT PLACID ++· Archmagos Opus
WARP 18%·TITHE $0.08· Omnissiah's Favour 86%
? for shortcuts⏵⏵ accept edits on
Security auditby claude-opus-4-8

A themed Adeptus Mechanicus statusline that reads Claude Code session JSON from stdin, parses fields via jq (model name, context usage percentage, cost, lines added/removed, effort level, thinking flag, rate limits), reads the current git branch, and prints two decorated, color-coded, width-aware display lines. It performs simple arithmetic with awk for a 'favour' percentage. No network access, no file writes, no reading of home/sensitive paths beyond the git repo it's run in.

subprocessesenv-vars

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

The script — read it before you run it

#!/usr/bin/env bash
# ++ Cogitator Rites of the Omnissiah ++
# An Adeptus Mechanicus status line for Claude Code.
# Your context window is the machine spirit's soul; as it fills the Warp
# bleeds in and heresy rises. Purge with /compact to sanctify the cogitator.
#
# Reads Claude Code session JSON on stdin, prints two sanctified lines.
# Requires: jq. Degrades gracefully when fields are null/absent.

input=$(cat)

# --- Extract session data (all with fallbacks) ------------------------------
j() { printf '%s' "$input" | jq -r "$1" 2>/dev/null; }

MODEL=$(j '.model.display_name // "Cogitator"')
PCT=$(j '.context_window.used_percentage // 0' | cut -d. -f1)
[ -z "$PCT" ] && PCT=0
COST=$(j '.cost.total_cost_usd // 0')
ADDED=$(j '.cost.total_lines_added // 0')
REMOVED=$(j '.cost.total_lines_removed // 0')
EFFORT=$(j '.effort.level // empty')
THINKING=$(j '.thinking.enabled // false')
FIVEH=$(j '.rate_limits.five_hour.used_percentage // empty')

# --- Colours ----------------------------------------------------------------
RESET='\033[0m'; BOLD='\033[1m'; DIM='\033[2m'
GREEN='\033[38;5;35m'; YELLOW='\033[38;5;220m'
ORANGE='\033[38;5;208m'; RED='\033[38;5;196m'
BRASS='\033[38;5;179m'; STEEL='\033[38;5;109m'; VIOLET='\033[38;5;141m'

# --- Machine-spirit state driven by context usage ---------------------------
if   [ "$PCT" -ge 90 ]; then STATE="++ HERESY! THE WARP DEVOURS THE COGITATOR - PURGE (/compact) ++"; SC="$BOLD$RED"; GLYPH='☠'
elif [ "$PCT" -ge 70 ]; then STATE="++ WARP INTRUSION DETECTED ++"; SC="$ORANGE"; GLYPH='⚠'
elif [ "$PCT" -ge 50 ]; then STATE="++ THE COGITATOR LABOURS ++"; SC="$YELLOW"; GLYPH='⚙'
else                          STATE="++ MACHINE SPIRIT PLACID ++"; SC="$GREEN"; GLYPH='⚙'
fi

# --- Rank from model --------------------------------------------------------
case "$MODEL" in
  *Opus*)   RANK="Archmagos $MODEL" ;;
  *Sonnet*) RANK="Tech-Priest $MODEL" ;;
  *Haiku*)  RANK="Servitor $MODEL" ;;
  *Fable*)  RANK="Lexmechanic $MODEL" ;;
  *)        RANK="Adept $MODEL" ;;
esac

# --- Sacred rites from effort level -----------------------------------------
case "$EFFORT" in
  low)    RITE="Rote Cant" ;;
  medium) RITE="Sacred Rite" ;;
  high)   RITE="Deep Litany" ;;
  xhigh)  RITE="Grand Invocation" ;;
  max)    RITE="Full Sacred Rites" ;;
  *)      RITE="" ;;
esac

# --- Warzone (git branch) ---------------------------------------------------
BRANCH=$(git branch --show-current 2>/dev/null)

# --- Warp corruption bar ----------------------------------------------------
WIDTH=10
FILLED=$((PCT * WIDTH / 100)); [ "$FILLED" -gt "$WIDTH" ] && FILLED=$WIDTH
EMPTY=$((WIDTH - FILLED)); [ "$EMPTY" -lt 0 ] && EMPTY=0
BAR=""
[ "$FILLED" -gt 0 ] && printf -v F "%${FILLED}s" && BAR="${F// /▓}"
[ "$EMPTY"  -gt 0 ] && printf -v E "%${EMPTY}s"  && BAR="${BAR}${E// /░}"

# --- Width-aware assembly ---------------------------------------------------
# Claude Code sets COLUMNS to the terminal width. Segments are added in
# priority order and dropped once the visible line would overflow, so the
# rites stay legible on a narrow vox-screen as well as a wide cogitator bank.
COLS=${COLUMNS:-80}
SEP="  ${DIM}·${RESET}  "; SEP_W=5

add() { # $1 visible-text  $2 coloured-text  -> appends to LINE/PLAIN if it fits
  local vis="$1" col="$2" add_w=$(( ${#1} + SEP_W ))
  [ -z "$PLAIN" ] && add_w=${#1}
  if [ $(( ${#PLAIN} + add_w )) -le "$COLS" ]; then
    [ -z "$PLAIN" ] && { LINE="$col"; PLAIN="$vis"; } \
                    || { LINE="${LINE}${SEP}${col}"; PLAIN="${PLAIN}  ·  ${vis}"; }
  fi
}

# --- Line 1: machine-spirit state, rank, warzone ----------------------------
LINE="${SC}${GLYPH} ${STATE}${RESET}"; PLAIN="${GLYPH} ${STATE}"
add "⌖ ${RANK}" "${BRASS}⌖ ${RANK}${RESET}"
[ -n "$BRANCH" ] && add "✠ warzone: ${BRANCH}" "${STEEL}✠ warzone: ${BRANCH}${RESET}"
LINE1="$LINE"

# --- Line 2: warp bar, tithe, favour, rites, changes, communion -------------
TITHE=$(printf 'TITHE $%.2f' "$COST")
LINE="${SC}WARP ${BAR} ${PCT}%${RESET}"; PLAIN="WARP ${BAR} ${PCT}%"
add "${TITHE}" "${BRASS}${TITHE}${RESET}"
if [ -n "$FIVEH" ]; then
  FAVOUR=$(awk "BEGIN{printf \"%d\", 100-$FIVEH}")
  add "⛨ Omnissiah's Favour ${FAVOUR}%" "${STEEL}⛨ Omnissiah's Favour ${FAVOUR}%${RESET}"
fi
[ -n "$RITE" ] && add "✝ ${RITE}" "${BRASS}✝ ${RITE}${RESET}"
if [ "$ADDED" != "0" ] || [ "$REMOVED" != "0" ]; then
  add "+${ADDED} sanctified -${REMOVED} purged" \
      "${GREEN}+${ADDED} sanctified${RESET} ${RED}-${REMOVED} purged${RESET}"
fi
[ "$THINKING" = "true" ] && add "⛧ communing with the Omnissiah" \
      "${VIOLET}⛧ communing with the Omnissiah${RESET}"
LINE2="$LINE"

printf '%b\n' "$LINE1"
printf '%b\n' "$LINE2"

Reviews

no reviews yet