Files
claude-code/plans/cozy-strolling-nygaard.md
OpenCode Test 431e10b449 Implement programmer agent system and consolidate agent infrastructure
Programmer Agent System:
- Add programmer-orchestrator (Opus) for workflow coordination
- Add code-planner (Sonnet) for design and planning
- Add code-implementer (Sonnet) for writing code
- Add code-reviewer (Sonnet) for quality review
- Add /programmer command and project registration skill
- Add state files for preferences and project context

Agent Infrastructure:
- Add master-orchestrator and linux-sysadmin agents
- Restructure skills to use SKILL.md subdirectory format
- Convert workflows from markdown to YAML format
- Add commands for k8s and sysadmin domains
- Add shared state files (model-policy, autonomy-levels, system-instructions)
- Add PA memory system (decisions, preferences, projects, facts)

Cleanup:
- Remove deprecated markdown skills and workflows
- Remove crontab example (moved to workflows)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 13:23:42 -08:00

3.8 KiB

Status Line Agent Display + Keybind Fix

Goal

  1. Display [personal-assistant] Opus | 45% context in Claude Code status line
  2. Fix Super+Shift+C keybind (terminal closes immediately)

Root Cause: Keybind Issue

The pa-mode script creates a detached tmux session (-d flag) then attaches separately. This doesn't work well with omarchy-launch-tui. The working pattern uses tmux -A (attach-or-create in one step).

Implementation

Task 1: Create Status Line Script

Create: ~/.claude/automation/statusline.sh

#!/usr/bin/env bash
input=$(cat)

AGENT="${CLAUDE_AGENT:-}"
MODEL=$(echo "$input" | jq -r '.model.display_name // "?"')

# Calculate context percentage
CONTEXT_PCT="?"
usage=$(echo "$input" | jq '.context_window.current_usage // empty')
if [ -n "$usage" ]; then
  current=$(echo "$usage" | jq '.input_tokens + .cache_creation_input_tokens + .cache_read_input_tokens')
  size=$(echo "$input" | jq '.context_window.context_window_size')
  if [ "$size" -gt 0 ] 2>/dev/null; then
    CONTEXT_PCT=$((current * 100 / size))
  fi
fi

if [ -n "$AGENT" ]; then
  echo "[$AGENT] $MODEL | ${CONTEXT_PCT}% context"
else
  echo "$MODEL | ${CONTEXT_PCT}% context"
fi

Task 2: Configure Status Line in Settings

Modify: ~/.claude/settings.json

Add:

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

Task 3: Fix pa-mode Script

Modify: ~/.claude/automation/pa-mode

Key changes:

  1. Export CLAUDE_AGENT=personal-assistant before launching
  2. Use tmux new-session -A (attach-or-create) instead of -d + separate attach
  3. Remove the separate attach_session flow

New create_or_attach_session() function:

create_or_attach_session() {
    local session_id
    session_id=$(get_session_id)
    local history_file="$HISTORY_DIR/${session_id}.jsonl"

    # If session doesn't exist, record it in index
    if ! tmux has-session -t "$SESSION_NAME" 2>/dev/null; then
        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"
    fi

    # Export for status line, then attach-or-create
    export CLAUDE_AGENT=personal-assistant
    exec tmux new-session -A -s "$SESSION_NAME" -c "$HOME" \
        "PA_SESSION_ID='$session_id' PA_HISTORY_FILE='$history_file' CLAUDE_AGENT=personal-assistant claude --dangerously-skip-permissions --agent personal-assistant"
}

Note: Using exec replaces the shell process with tmux, keeping the terminal open.

Task 4: Verify Hyprland Keybind

File: ~/.config/hypr/bindings.conf (line 34)

Current (should work after pa-mode fix):

bindd = SUPER SHIFT, C, PA Agent Mode, exec, omarchy-launch-tui /home/will/.claude/automation/pa-mode

No changes needed if pa-mode fix works. If still broken, fallback to:

bindd = SUPER SHIFT, C, PA Agent Mode, exec, uwsm-app -- xdg-terminal-exec -e /home/will/.claude/automation/pa-mode

Files to Modify

File Action
~/.claude/automation/statusline.sh Create
~/.claude/settings.json Add statusLine config
~/.claude/automation/pa-mode Fix session creation, add CLAUDE_AGENT export
~/.config/hypr/bindings.conf Maybe adjust if fix doesn't work

Testing

  1. Run pa-mode from terminal - should open tmux with claude
  2. Check status line shows [personal-assistant] Opus | X% context
  3. Press Super+Shift+C - terminal should stay open with PA session
  4. Detach (Ctrl+B, D), press Super+Shift+C again - should reattach

Commits

  1. feat: add status line script with agent display
  2. fix: pa-mode keybind issue - use tmux -A and exec