From 4dd53a0dd0c2118f32b494aec6f04a7e81a765f4 Mon Sep 17 00:00:00 2001 From: John Ogle Date: Sat, 14 Feb 2026 17:17:44 -0800 Subject: [PATCH] feat(dev): add Claude Code statusline config via activation hook --- home/roles/development/default.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/home/roles/development/default.nix b/home/roles/development/default.nix index 2656809..42d1b7d 100644 --- a/home/roles/development/default.nix +++ b/home/roles/development/default.nix @@ -110,6 +110,12 @@ let ref = "main"; }; + # Claude Code statusline: shows model, cwd, git branch, and context usage % + claudeCodeStatusLineConfig = pkgs.writeText "claude-statusline.json" (builtins.toJSON { + type = "command"; + command = ''input=$(cat); model=$(echo "$input" | jq -r '.model.display_name'); cwd=$(echo "$input" | jq -r '.workspace.current_dir'); if git -C "$cwd" rev-parse --git-dir > /dev/null 2>&1; then branch=$(git -C "$cwd" --no-optional-locks rev-parse --abbrev-ref HEAD 2>/dev/null || echo ""); if [ -n "$branch" ]; then git_info=" on $branch"; else git_info=""; fi; else git_info=""; fi; usage=$(echo "$input" | jq '.context_window.current_usage'); if [ "$usage" != "null" ]; then current=$(echo "$usage" | jq '.input_tokens + .cache_creation_input_tokens + .cache_read_input_tokens'); size=$(echo "$input" | jq '.context_window.context_window_size'); pct=$((current * 100 / size)); context_info=" | ''${pct}% context"; else context_info=""; fi; printf "%s in %s%s%s" "$model" "$cwd" "$git_info" "$context_info"''; + }); + in { options.home.roles.development = { @@ -251,6 +257,18 @@ in $DRY_RUN_CMD echo "Claude Code beads integration configured (hooks installed)" ''; + # Configure Claude Code statusline (merge into existing settings.json) + home.activation.claudeCodeStatusLine = lib.hm.dag.entryAfter ["writeBoundary" "claudeCodeBeadsSetup"] '' + SETTINGS="$HOME/.claude/settings.json" + mkdir -p "$HOME/.claude" + if [ -f "$SETTINGS" ]; then + ${pkgs.jq}/bin/jq --slurpfile sl ${claudeCodeStatusLineConfig} '.statusLine = $sl[0]' "$SETTINGS" > "''${SETTINGS}.tmp" && mv "''${SETTINGS}.tmp" "$SETTINGS" + else + ${pkgs.jq}/bin/jq -n --slurpfile sl ${claudeCodeStatusLineConfig} '{statusLine: $sl[0]}' > "$SETTINGS" + fi + $DRY_RUN_CMD echo "Claude Code statusline configured" + ''; + # Beads timer gate checker (Linux only - uses systemd) # Runs every 5 minutes to auto-resolve expired timer gates across all beads projects # This enables self-scheduling molecules (watchers, patrols, etc.)