]> git.ekhem.eu.org Git - guix.git/commitdiff
[ai] Add status-line hook showing worktree session in prompt.
authorJakub Czajka <jakub@ekhem.eu.org>
Mon, 6 Jul 2026 08:37:59 +0000 (10:37 +0200)
committerJakub Czajka <jakub@ekhem.eu.org>
Tue, 7 Jul 2026 21:36:27 +0000 (23:36 +0200)
Displays the current worktree session ID or branch name in the
Claude Code status line, making it visible at a glance whether
the session is running in an isolated worktree or on main.

.claude/hooks/status-line [new file with mode: 0755]
.claude/settings.json

diff --git a/.claude/hooks/status-line b/.claude/hooks/status-line
new file mode 100755 (executable)
index 0000000..3475173
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Copyright (c) 2026 Jakub Czajka <jakub@ekhem.eu.org>
+# License: GPL-3.0 or later.
+#
+# status-line - Display current session/worktree in the Claude Code prompt.
+
+if echo "$PWD" | grep -q '/worktrees/'; then
+    echo "🌿 $CLAUDE_CODE_SESSION_ID"
+else
+    branch=$(git -C "$PWD" branch --show-current 2>/dev/null)
+    [ -n "$branch" ] && echo "🌿 $branch"
+fi
index dc5acb1ff9c86b521be6a6b5e30a23cfbeaa4048..2c30fb5718c8dc291cacdd5b1b210dad7d384548 100644 (file)
@@ -3,6 +3,10 @@
     "GUIX_BIN": "/run/current-system/profile/bin",
     "PROFILE": "nonfree"
   },
+  "statusLine": {
+    "type": "command",
+    "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/status-line"
+  },
   "hooks": {
     "PreToolUse": [
       {