Skip to content

Commit 8b772e5

Browse files
fix(hooks): skip auto-map on remote backend; drop ingest retry (v3.1.1) (#26)
Hardening for the auto-ingestion hooks so background graph refresh is safe to run frequently. - 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 mark their map as automatic (IX_AUTO_MAP=1). The CLI skips an automatic map when the active backend is remote, keeping background refresh a local convenience; remote ingestion stays deliberate. Opt in to remote auto-refresh with IX_AUTO_MAP_CLOUD=1. Bumps plugin + marketplace manifest to 3.1.1. Pairs with Ix #290. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 051eb59 commit 8b772e5

5 files changed

Lines changed: 40 additions & 13 deletions

File tree

.claude-plugin/marketplace.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"name": "ix-memory",
99
"source": "./",
1010
"description": "Ix Memory integration — cognitive skills, agentic workflows, and auto-ingestion hooks for graph-aware engineering",
11-
"version": "3.1.0"
11+
"version": "3.1.1"
1212
}
1313
]
1414
}

.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ix-memory",
3-
"version": "3.1.0",
3+
"version": "3.1.1",
44
"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.",
55
"author": {
66
"name": "Ix Memory"

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Changelog
2+
3+
## 3.1.1
4+
5+
Hardening for the auto-ingestion hooks so background graph refresh is safe to run frequently.
6+
7+
- **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.
8+
- **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.
9+
10+
Pairs with the `ix` CLI single-flight + deadline support (Ix #290).
11+
12+
## 3.1.0
13+
14+
- Adopt `ix --format llm` across skills and agents.
15+
- Add an `mkdir`-lock fallback to the Stop-time full-map hook so concurrent runs don't stack on systems without `flock`.

hooks/ix-ingest.sh

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,30 @@ source "${_HOOK_DIR}/lib/index.sh"
2020
ix_health_check
2121
IX_HOOK_NAME="ix-ingest"
2222

23+
# Mark this map as automatic (background refresh). The CLI skips an automatic
24+
# map when the active backend is remote (see ix-map.sh for the rationale).
25+
export IX_AUTO_MAP=1
26+
2327
IX_INGEST_INJECT="${IX_INGEST_INJECT:-off}"
2428
ix_log "ENTRY file=$FILE_PATH inject=$IX_INGEST_INJECT"
2529

26-
# ── Map file (retry once on failure) ─────────────────────────────────────────
30+
# ── Map file (single attempt) ────────────────────────────────────────────────
31+
# No shell-level retry. The ix CLI owns retry/backoff and a hard wall-clock
32+
# deadline, and is single-flight per workspace (a concurrent map coalesces and
33+
# exits 0). A shell retry here only amplified load against an unhealthy backend:
34+
# a burst of edits could stack many immediate re-attempts. One attempt is
35+
# enough — if it misses, the next edit or the Stop-hook full map (ix-map.sh)
36+
# refreshes anything left stale.
2737
ix_log "RUN ix map $FILE_PATH"
2838
_map_err=$(mktemp)
2939
ix_log_command ix map "$FILE_PATH"
3040
ix map "$FILE_PATH" >/dev/null 2>"$_map_err" || {
31-
ix_log "RETRY ix map failed once, retrying"
32-
ix_log_command ix map "$FILE_PATH"
33-
ix map "$FILE_PATH" >/dev/null 2>"$_map_err" || {
34-
_exit=$?
35-
ix_capture_async "ix" "ix-map" "ix map failed" "$_exit" \
36-
"ix map $(basename "$FILE_PATH")" "$(head -3 "$_map_err")"
37-
ix_log "FAILED ix map after retry exit=$_exit"
38-
rm -f "$_map_err"
39-
exit 0
40-
}
41+
_exit=$?
42+
ix_capture_async "ix" "ix-map" "ix map failed" "$_exit" \
43+
"ix map $(basename "$FILE_PATH")" "$(head -3 "$_map_err")"
44+
ix_log "FAILED ix map exit=$_exit"
45+
rm -f "$_map_err"
46+
exit 0
4147
}
4248
rm -f "$_map_err"
4349
ix_log "DONE mapped $FILE_PATH"

hooks/ix-map.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ source "${_HOOK_DIR}/lib/index.sh" 2>/dev/null || true
1717
ix_health_check
1818
IX_HOOK_NAME="ix-map"
1919

20+
# Mark this map as automatic (background refresh). The CLI skips an automatic
21+
# map when the active backend is remote — a shared remote graph should be fed
22+
# deliberately, not on every change from every client. Manual `ix map` is
23+
# unaffected. Users who want remote auto-refresh set IX_AUTO_MAP_CLOUD=1.
24+
export IX_AUTO_MAP=1
25+
2026
# ── Debounce — skip if a map ran recently ────────────────────────────────────
2127
IX_MAP_DEBOUNCE_SECONDS="${IX_MAP_DEBOUNCE_SECONDS:-300}"
2228
IX_MAP_DEBOUNCE_FILE="${TMPDIR:-/tmp}/ix-map-last"

0 commit comments

Comments
 (0)