mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-02 15:13:28 +08:00
feat: orchestration harness, selective install, observer improvements
This commit is contained in:
@@ -91,7 +91,8 @@ PROMPT
|
||||
max_turns=10
|
||||
fi
|
||||
|
||||
claude --model haiku --max-turns "$max_turns" --print < "$prompt_file" >> "$LOG_FILE" 2>&1 &
|
||||
# Prevent observe.sh from recording this automated Haiku session as observations
|
||||
ECC_SKIP_OBSERVE=1 ECC_HOOK_PROFILE=minimal claude --model haiku --max-turns "$max_turns" --print < "$prompt_file" >> "$LOG_FILE" 2>&1 &
|
||||
claude_pid=$!
|
||||
|
||||
(
|
||||
|
||||
@@ -73,6 +73,50 @@ if [ -n "$STDIN_CWD" ] && [ -d "$STDIN_CWD" ]; then
|
||||
export CLAUDE_PROJECT_DIR="$STDIN_CWD"
|
||||
fi
|
||||
|
||||
# ─────────────────────────────────────────────
|
||||
# Lightweight config and automated session guards
|
||||
# ─────────────────────────────────────────────
|
||||
|
||||
CONFIG_DIR="${HOME}/.claude/homunculus"
|
||||
|
||||
# Skip if disabled
|
||||
if [ -f "$CONFIG_DIR/disabled" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Prevent observe.sh from firing on non-human sessions to avoid:
|
||||
# - ECC observing its own Haiku observer sessions (self-loop)
|
||||
# - ECC observing other tools' automated sessions
|
||||
# - automated sessions creating project-scoped homunculus metadata
|
||||
|
||||
# Layer 1: entrypoint. Only interactive terminal sessions should continue.
|
||||
case "${CLAUDE_CODE_ENTRYPOINT:-cli}" in
|
||||
cli) ;;
|
||||
*) exit 0 ;;
|
||||
esac
|
||||
|
||||
# Layer 2: minimal hook profile suppresses non-essential hooks.
|
||||
[ "${ECC_HOOK_PROFILE:-standard}" = "minimal" ] && exit 0
|
||||
|
||||
# Layer 3: cooperative skip env var for automated sessions.
|
||||
[ "${ECC_SKIP_OBSERVE:-0}" = "1" ] && exit 0
|
||||
|
||||
# Layer 4: subagent sessions are automated by definition.
|
||||
_ECC_AGENT_ID=$(echo "$INPUT_JSON" | "$PYTHON_CMD" -c "import json,sys; print(json.load(sys.stdin).get('agent_id',''))" 2>/dev/null || true)
|
||||
[ -n "$_ECC_AGENT_ID" ] && exit 0
|
||||
|
||||
# Layer 5: known observer-session path exclusions.
|
||||
_ECC_SKIP_PATHS="${ECC_OBSERVE_SKIP_PATHS:-observer-sessions,.claude-mem}"
|
||||
if [ -n "$STDIN_CWD" ]; then
|
||||
IFS=',' read -ra _ECC_SKIP_ARRAY <<< "$_ECC_SKIP_PATHS"
|
||||
for _pattern in "${_ECC_SKIP_ARRAY[@]}"; do
|
||||
_pattern="${_pattern#"${_pattern%%[![:space:]]*}"}"
|
||||
_pattern="${_pattern%"${_pattern##*[![:space:]]}"}"
|
||||
[ -z "$_pattern" ] && continue
|
||||
case "$STDIN_CWD" in *"$_pattern"*) exit 0 ;; esac
|
||||
done
|
||||
fi
|
||||
|
||||
# ─────────────────────────────────────────────
|
||||
# Project detection
|
||||
# ─────────────────────────────────────────────
|
||||
@@ -89,15 +133,9 @@ PYTHON_CMD="${CLV2_PYTHON_CMD:-$PYTHON_CMD}"
|
||||
# Configuration
|
||||
# ─────────────────────────────────────────────
|
||||
|
||||
CONFIG_DIR="${HOME}/.claude/homunculus"
|
||||
OBSERVATIONS_FILE="${PROJECT_DIR}/observations.jsonl"
|
||||
MAX_FILE_SIZE_MB=10
|
||||
|
||||
# Skip if disabled
|
||||
if [ -f "$CONFIG_DIR/disabled" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Auto-purge observation files older than 30 days (runs once per session)
|
||||
PURGE_MARKER="${PROJECT_DIR}/.last-purge"
|
||||
if [ ! -f "$PURGE_MARKER" ] || [ "$(find "$PURGE_MARKER" -mtime +1 2>/dev/null)" ]; then
|
||||
|
||||
Reference in New Issue
Block a user