From c0c17850bfa626c379ed4fc3498128d2e197cc89 Mon Sep 17 00:00:00 2001 From: OpenCode Test Date: Mon, 29 Dec 2025 11:45:28 -0800 Subject: [PATCH] fix: use full path to claude for keybind compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The keybind environment doesn't have linuxbrew in PATH. Using full path /home/linuxbrew/.linuxbrew/bin/claude fixes it. - pa-launch: new simplified script for keybind use - pa-mode: updated to use full path too 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- automation/pa-launch | 36 ++++++++++++++++++++++++++++++++++++ automation/pa-mode | 11 ++++++++--- 2 files changed, 44 insertions(+), 3 deletions(-) create mode 100755 automation/pa-launch diff --git a/automation/pa-launch b/automation/pa-launch new file mode 100755 index 0000000..f11a2e2 --- /dev/null +++ b/automation/pa-launch @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# PA Agent Mode - Launch/attach to persistent PA tmux session +set -euo pipefail + +SESSION="pa" +CLAUDE="/home/linuxbrew/.linuxbrew/bin/claude" +HISTORY_DIR="$HOME/.claude/state/personal-assistant/history" +INDEX_FILE="$HISTORY_DIR/index.json" + +export CLAUDE_AGENT=personal-assistant + +get_session_id() { + date +"%Y-%m-%d_%H-%M-%S" +} + +record_session_start() { + local session_id="$1" + local tmp_file + tmp_file=$(mktemp) + jq --arg id "$session_id" --arg started "$(date -Iseconds)" \ + '.sessions += [{"id": $id, "started": $started, "ended": null, "summarized": false, "topics": []}]' \ + "$INDEX_FILE" > "$tmp_file" && mv "$tmp_file" "$INDEX_FILE" +} + +# Check if session exists +if tmux has-session -t "$SESSION" 2>/dev/null; then + tmux attach-session -t "$SESSION" +else + session_id=$(get_session_id) + record_session_start "$session_id" + + export PA_SESSION_ID="$session_id" + export PA_HISTORY_FILE="$HISTORY_DIR/${session_id}.jsonl" + + tmux new-session -s "$SESSION" "$CLAUDE" --dangerously-skip-permissions --agent personal-assistant +fi diff --git a/automation/pa-mode b/automation/pa-mode index 0fcce8c..0266e1d 100755 --- a/automation/pa-mode +++ b/automation/pa-mode @@ -3,6 +3,7 @@ set -euo pipefail SESSION_NAME="pa" +CLAUDE="/home/linuxbrew/.linuxbrew/bin/claude" HISTORY_DIR="$HOME/.claude/state/personal-assistant/history" INDEX_FILE="$HISTORY_DIR/index.json" @@ -40,11 +41,15 @@ create_or_attach_session() { record_session_start "$session_id" fi - # Export for status line, then exec tmux (replaces this shell process) - # Using -A: attach if session exists, create if not + # Export env vars for the tmux session export CLAUDE_AGENT=personal-assistant + export PA_SESSION_ID="$session_id" + export PA_HISTORY_FILE="$history_file" + + # Using -A: attach if session exists, create if not + # exec replaces this shell with tmux exec tmux new-session -A -s "$SESSION_NAME" -c "$HOME" \ - "CLAUDE_AGENT=personal-assistant PA_SESSION_ID='$session_id' PA_HISTORY_FILE='$history_file' claude --dangerously-skip-permissions --agent personal-assistant" + "$CLAUDE" --dangerously-skip-permissions --agent personal-assistant } case "${1:-}" in