Files
claude-foundations/memory/script-statusline.md
Paul O'Reilly e7c8214499 Add statusline scripts, context-load improvements, and prior distill updates
- Add statusline.sh and set-topic.sh for per-session status line topics
- Update context-load with improved directory walking and output format
- Update CLAUDE.md with status line docs and early-call safety note
- Update MEMORY.md and README.md with new script/skill entries
- Add memory files: script-statusline, skill-decompose, skill-orchestrate, gotchas-gitea
- Add networking.md best practice (nftables, systemd sockets, Docker forwarding, TLS)
- Update best practices from prior distill: documentation, kubernetes, scripting,
  secrets-management, skills-development
- Prune reflected session logs, add new session logs
- Update reflection state

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 11:11:40 +13:00

2.1 KiB

Status Line Scripts

Overview

Two scripts that power a persistent status bar at the bottom of Claude Code, showing the current session topic, model name, and context window usage.

Files

  • scripts/statusline.sh — Status line renderer. Receives session JSON on stdin from Claude Code, outputs formatted text. Also writes the session ID to /tmp/claude-session-id-<cwd-hash> so Claude can discover it.
  • scripts/set-topic.sh — Helper to write the topic file for a session. Usage: set-topic.sh <cwd> "topic text".
  • ~/.claude/status/ — Symlinks back to the canonical scripts. Claude Code's settings.json points here.
  • ~/.claude/status/<session-id>/claude-topic.txt — Per-session topic files, written by set-topic.sh.

Setup

The statusLine config in ~/.claude/settings.json:

{
  "statusLine": {
    "type": "command",
    "command": "~/.claude/status/statusline.sh"
  }
}

Symlinks in ~/.claude/status/:

  • statusline.sh~/dev/claude/projects/claude-foundations/scripts/statusline.sh
  • set-topic.sh~/dev/claude/projects/claude-foundations/scripts/set-topic.sh

How It Works

  1. Claude Code runs statusline.sh after each assistant message (debounced 300ms)
  2. The script receives session JSON on stdin with session_id, model, context_window, cwd, etc.
  3. It writes the session ID to /tmp/claude-session-id-<md5 of cwd> so Claude can discover its own session
  4. It reads the topic from ~/.claude/status/<session-id>/claude-topic.txt if it exists
  5. Outputs: [Model Name] topic text | N% context (or without topic if not set)

Early Topic Setting

If set-topic.sh is called before the status line has run (e.g., on the first message), the topic is written to a pending file (/tmp/claude-pending-topic-<hash>). On its next run, statusline.sh picks up the pending file and moves it into the correct session topic location. No error is raised — the topic just appears on the next response.

Dependencies

  • jq — for parsing the session JSON
  • md5sum — for hashing the cwd to a predictable filename