Commit 037b769
fix(ingest): self-healing graph memo + commit-triggered re-analyze
Make codebase-graph freshness trustable instead of periodic-and-stale.
1. Self-heal the cached graph_path memo. find_cached_graph returns a
memoised path only when the graph still exists on disk (non-empty
dir/file), preferring the most-recent such memo; otherwise None so the
caller re-analyses. Previously it returned the first tag match
unconditionally, so a memo outliving its deleted graph made
ingest_codebase silently project an empty graph. One fix heals all
three consumers (ensure_graph, pipeline_impact_bump, SessionStart bg
worker). Dijkstra audit: the pointer is not the thing.
2. Make a commit the freshness signal. New PostToolUse hook
post_commit_reindex spawns the detached background re-analyze worker
(ingest_codebase_background --reindex) when a git commit touches
indexable source. Closes the gap the 24h SessionStart TTL leaves open
within a working session. Gated on changed source, detached (never
blocks the commit), 120s coalesce cooldown (also serialises writes to
the same graph dir).
Two-speed model: facts fresh per commit, consolidation/clustering on the
existing TTL cycles (perception continuous, consolidation in sleep).
Honest scope: the upstream analyzer (ai-automatised-pipeline
index_codebase, src/indexer/mod.rs) re-parses the whole tree -- it has NO
per-file incremental skip. "Incremental" here means trigger-only-on-change,
not reparse-only-the-changed-file. Full re-parse is seconds for
harness-sized repos and runs detached. Extension gate sourced from AP
src/parser/mod.rs Language::from_extension plus the .js light-link pass.
Tests: self-heal memo (existence + recency + dead-path skip), handler-level
re-analyze on dead memo, hook gating (non-commit/failed/docs-only/cooldown/
spawn), --reindex flag threading.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent e2e774b commit 037b769
8 files changed
Lines changed: 713 additions & 24 deletions
File tree
- .claude-plugin
- mcp_server
- handlers
- hooks
- tests_py
- handlers
- hooks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
41 | 77 | | |
42 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
43 | 109 | | |
44 | 110 | | |
45 | 111 | | |
46 | 112 | | |
47 | 113 | | |
48 | 114 | | |
| 115 | + | |
| 116 | + | |
49 | 117 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
60 | 132 | | |
61 | 133 | | |
62 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
6 | 10 | | |
7 | 11 | | |
8 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
9 | 18 | | |
10 | 19 | | |
11 | 20 | | |
| |||
34 | 43 | | |
35 | 44 | | |
36 | 45 | | |
| 46 | + | |
37 | 47 | | |
38 | 48 | | |
39 | 49 | | |
| |||
43 | 53 | | |
44 | 54 | | |
45 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
46 | 59 | | |
47 | 60 | | |
48 | | - | |
49 | | - | |
| 61 | + | |
50 | 62 | | |
51 | 63 | | |
52 | 64 | | |
| |||
60 | 72 | | |
61 | 73 | | |
62 | 74 | | |
63 | | - | |
| 75 | + | |
| 76 | + | |
64 | 77 | | |
65 | 78 | | |
66 | 79 | | |
| |||
0 commit comments