diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 51a8be3..6a179fb 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -8,7 +8,7 @@ "name": "ix-memory", "source": "./", "description": "Ix Memory integration — cognitive skills, agentic workflows, and auto-ingestion hooks for graph-aware engineering", - "version": "3.1.0" + "version": "3.1.1" } ] } diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 7c41802..0f257f5 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "ix-memory", - "version": "3.1.0", + "version": "3.1.1", "description": "Ix Memory integration — transforms Claude into a graph-reasoning agent with cognitive skills for understanding, investigation, impact analysis, planning, debugging, architecture auditing, and deep documentation synthesis.", "author": { "name": "Ix Memory" diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2873136 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,15 @@ +# Changelog + +## 3.1.1 + +Hardening for the auto-ingestion hooks so background graph refresh is safe to run frequently. + +- **Post-edit hook (`ix-ingest.sh`) no longer retries `ix map` itself.** The `ix` CLI now owns retry/backoff and a per-run wall-clock deadline and is single-flight per workspace, so a shell-level retry only amplified load against a slow backend. +- **Both refresh hooks (`ix-map.sh`, `ix-ingest.sh`) mark their map as automatic (`IX_AUTO_MAP=1`).** The CLI skips an automatic map when the active backend is remote, so background refresh stays a local convenience and remote ingestion is left to deliberate, manual `ix map`. Set `IX_AUTO_MAP_CLOUD=1` to opt back in to remote auto-refresh. + +Pairs with the `ix` CLI single-flight + deadline support (Ix #290). + +## 3.1.0 + +- Adopt `ix --format llm` across skills and agents. +- Add an `mkdir`-lock fallback to the Stop-time full-map hook so concurrent runs don't stack on systems without `flock`. diff --git a/hooks/ix-ingest.sh b/hooks/ix-ingest.sh index 5e8459c..398e4df 100755 --- a/hooks/ix-ingest.sh +++ b/hooks/ix-ingest.sh @@ -20,24 +20,30 @@ source "${_HOOK_DIR}/lib/index.sh" ix_health_check IX_HOOK_NAME="ix-ingest" +# Mark this map as automatic (background refresh). The CLI skips an automatic +# map when the active backend is remote (see ix-map.sh for the rationale). +export IX_AUTO_MAP=1 + IX_INGEST_INJECT="${IX_INGEST_INJECT:-off}" ix_log "ENTRY file=$FILE_PATH inject=$IX_INGEST_INJECT" -# ── Map file (retry once on failure) ───────────────────────────────────────── +# ── Map file (single attempt) ──────────────────────────────────────────────── +# No shell-level retry. The ix CLI owns retry/backoff and a hard wall-clock +# deadline, and is single-flight per workspace (a concurrent map coalesces and +# exits 0). A shell retry here only amplified load against an unhealthy backend: +# a burst of edits could stack many immediate re-attempts. One attempt is +# enough — if it misses, the next edit or the Stop-hook full map (ix-map.sh) +# refreshes anything left stale. ix_log "RUN ix map $FILE_PATH" _map_err=$(mktemp) ix_log_command ix map "$FILE_PATH" ix map "$FILE_PATH" >/dev/null 2>"$_map_err" || { - ix_log "RETRY ix map failed once, retrying" - ix_log_command ix map "$FILE_PATH" - ix map "$FILE_PATH" >/dev/null 2>"$_map_err" || { - _exit=$? - ix_capture_async "ix" "ix-map" "ix map failed" "$_exit" \ - "ix map $(basename "$FILE_PATH")" "$(head -3 "$_map_err")" - ix_log "FAILED ix map after retry exit=$_exit" - rm -f "$_map_err" - exit 0 - } + _exit=$? + ix_capture_async "ix" "ix-map" "ix map failed" "$_exit" \ + "ix map $(basename "$FILE_PATH")" "$(head -3 "$_map_err")" + ix_log "FAILED ix map exit=$_exit" + rm -f "$_map_err" + exit 0 } rm -f "$_map_err" ix_log "DONE mapped $FILE_PATH" diff --git a/hooks/ix-map.sh b/hooks/ix-map.sh index 4fabade..db8aacf 100755 --- a/hooks/ix-map.sh +++ b/hooks/ix-map.sh @@ -17,6 +17,12 @@ source "${_HOOK_DIR}/lib/index.sh" 2>/dev/null || true ix_health_check IX_HOOK_NAME="ix-map" +# Mark this map as automatic (background refresh). The CLI skips an automatic +# map when the active backend is remote — a shared remote graph should be fed +# deliberately, not on every change from every client. Manual `ix map` is +# unaffected. Users who want remote auto-refresh set IX_AUTO_MAP_CLOUD=1. +export IX_AUTO_MAP=1 + # ── Debounce — skip if a map ran recently ──────────────────────────────────── IX_MAP_DEBOUNCE_SECONDS="${IX_MAP_DEBOUNCE_SECONDS:-300}" IX_MAP_DEBOUNCE_FILE="${TMPDIR:-/tmp}/ix-map-last"