Skip to content

Commit c80631f

Browse files
committed
fix(observer): improve Windows compatibility for temp files and Haiku prompt
Address remaining issues from anomalyco#842 after PR anomalyco#903 moved temp files to PROJECT_DIR/.observer-tmp: Bug A (path resolution): Use relative paths (.observer-tmp/filename) in the prompt instead of absolute paths from mktemp. On Windows Git Bash/MSYS2, absolute paths use MSYS-style prefixes (/c/Users/...) that the spawned Claude subprocess may fail to resolve. Bug B (asks for permission): Add explicit IMPORTANT instruction block at the prompt start telling the Haiku agent it is in non-interactive --print mode and must use the Write tool directly without asking for confirmation. Additional improvements: - Pass prompt via -p flag instead of stdin redirect for Windows compat - Add .observer-tmp/ to .gitignore to prevent accidental commits Fixes anomalyco#842 Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: Lidang-Jiang <[email protected]>
1 parent 8b6140d commit c80631f

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ temp/
8383
*.bak
8484
*.backup
8585

86+
# Observer temp files (continuous-learning-v2)
87+
.observer-tmp/
88+
8689
# Rust build artifacts
8790
ecc2/target/
8891

‎skills/continuous-learning-v2/agents/observer-loop.sh‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,16 @@ analyze_observations() {
6262
analysis_count=$(wc -l < "$analysis_file" 2>/dev/null || echo 0)
6363
echo "[$(date)] Using last $analysis_count of $obs_count observations for analysis" >> "$LOG_FILE"
6464

65+
# Use relative path from PROJECT_DIR for cross-platform compatibility (#842).
66+
# On Windows (Git Bash/MSYS2), absolute paths from mktemp may use MSYS-style
67+
# prefixes (e.g. /c/Users/...) that the Claude subprocess cannot resolve.
68+
analysis_relpath=".observer-tmp/$(basename "$analysis_file")"
69+
6570
prompt_file="$(mktemp "${observer_tmp_dir}/ecc-observer-prompt.XXXXXX")"
6671
cat > "$prompt_file" <<PROMPT
67-
Read ${analysis_file} and identify patterns for the project ${PROJECT_NAME} (user corrections, error resolutions, repeated workflows, tool preferences).
72+
IMPORTANT: You are running in non-interactive --print mode. You MUST use the Write tool directly to create files. Do NOT ask for permission, do NOT ask for confirmation, do NOT output summaries instead of writing. Just read, analyze, and write.
73+
74+
Read ${analysis_relpath} and identify patterns for the project ${PROJECT_NAME} (user corrections, error resolutions, repeated workflows, tool preferences).
6875
If you find 3+ occurrences of the same pattern, you MUST write an instinct file directly to ${INSTINCTS_DIR}/<id>.md using the Write tool.
6976
Do NOT ask for permission to write files, do NOT describe what you would write, and do NOT stop at analysis when a qualifying pattern exists.
7077
@@ -117,10 +124,11 @@ PROMPT
117124
max_turns=10
118125
fi
119126

120-
# Prevent observe.sh from recording this automated Haiku session as observations
127+
# Prevent observe.sh from recording this automated Haiku session as observations.
128+
# Pass prompt via -p flag instead of stdin redirect for Windows compatibility (#842).
121129
ECC_SKIP_OBSERVE=1 ECC_HOOK_PROFILE=minimal claude --model haiku --max-turns "$max_turns" --print \
122130
--allowedTools "Read,Write" \
123-
< "$prompt_file" >> "$LOG_FILE" 2>&1 &
131+
-p "$(cat "$prompt_file")" >> "$LOG_FILE" 2>&1 &
124132
claude_pid=$!
125133

126134
(

0 commit comments

Comments
 (0)