The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
fix(observer): clean up prompt_file early and fix test for analysis_relpath
Lidang-Jiang7a4cb8c57030
diff --git a/skills/continuous-learning-v2/agents/observer-loop.sh b/skills/continuous-learning-v2/agents/observer-loop.shindex 5df241408..e2cad9af1 100755--- a/skills/continuous-learning-v2/agents/observer-loop.sh+++ b/skills/continuous-learning-v2/agents/observer-loop.sh@@ -134,6 +134,9 @@ PROMPT--allowedTools "Read,Write" \-p "$(cat "$prompt_file")" >> "$LOG_FILE" 2>&1 &claude_pid=$!+ # prompt_file content was already expanded by the shell; remove early to avoid+ # leaving stale temp files during the (potentially long) analysis window.+ rm -f "$prompt_file"(sleep "$timeout_seconds"@@ -147,7 +150,7 @@ PROMPTwait "$claude_pid"exit_code=$?kill "$watchdog_pid" 2>/dev/null || true- rm -f "$prompt_file" "$analysis_file"+ rm -f "$analysis_file"if [ "$exit_code" -ne 0 ]; thenecho "[$(date)] Claude analysis failed (exit $exit_code)" >> "$LOG_FILE"diff --git a/tests/hooks/observer-memory.test.js b/tests/hooks/observer-memory.test.jsindex 47ffe61d9..8f91df404 100644--- a/tests/hooks/observer-memory.test.js+++ b/tests/hooks/observer-memory.test.js@@ -175,7 +175,7 @@ test('prompt references analysis_file not full OBSERVATIONS_FILE', () => {assert.ok(heredocStart > 0, 'Should find prompt heredoc start');assert.ok(heredocEnd > heredocStart, 'Should find prompt heredoc end');const promptSection = content.substring(heredocStart, heredocEnd);- assert.ok(promptSection.includes('${analysis_file}'), 'Prompt should point Claude at the sampled analysis file, not the full observations file');+ assert.ok(promptSection.includes('${analysis_relpath}'), 'Prompt should point Claude at the sampled analysis file (via relative path), not the full observations file');});// ──────────────────────────────────────────────────────