fix: sync .cursor observe.sh and fix suggest-compact.sh session tracking

- Sync .cursor/observe.sh with corrected main version (use stdin pipe
  instead of broken heredoc json.loads pattern)
- Fix suggest-compact.sh to use CLAUDE_SESSION_ID instead of $$ which
  gives a new PID per invocation, preventing counter from incrementing
This commit is contained in:
Affaan Mustafa
2026-02-12 13:33:52 -08:00
parent b57eef4f71
commit e1a0700067
2 changed files with 29 additions and 24 deletions

View File

@@ -28,7 +28,9 @@
# - Plan has been finalized
# Track tool call count (increment in a temp file)
COUNTER_FILE="/tmp/claude-tool-count-$$"
# Use CLAUDE_SESSION_ID for session-specific counter (not $$ which changes per invocation)
SESSION_ID="${CLAUDE_SESSION_ID:-${PPID:-default}}"
COUNTER_FILE="/tmp/claude-tool-count-${SESSION_ID}"
THRESHOLD=${COMPACT_THRESHOLD:-50}
# Initialize or increment counter