Repository navigation
Proposal: auto-downgrade or default-off callgraph_store for non-git/large dirs to avoid GB-scale callgraph indexing and high I/O #268
Description
Description
Summary
callgraph_store (callgraph persistence) defaults to true in 0.52.2, and unlike search_index/semantic_search it has no automatic downgrade for $HOME / non-git large directories. This still triggers a full cold-build on <home-dir> or <large non-git directory>, producing GB-scale disk usage and sustained high I/O. We propose either extending callgraph_store with a symmetric downgrade, or changing its default to false while allowing per-project opt-in.
This issue is filed as a feature proposal; the rationale: from the available docs and source we cannot determine whether callgraph_store defaulting on (and lacking downgrade for non-git/home roots) is an omission, so we do not presume it a defect—only a behavior-change suggestion, easier for maintainers to triage.
Environment
@cortexkit/aft-opencode0.52.2(aftbinaryv0.52.2)Linux (VM), editor runs a persistentopencode serve- Config
~/.config/cortexkit/aft.jsoncis empty by default (search_index: false, semantic_search: false);callgraph_storestays at defaulttrue
Symptoms
After a <long-running editor host> launched a persistent serve with <home-dir> (or <large non-git directory>) as project_root, the following was observed:
- Disk filled by the
callgraphstore (measured up toGB-scale, single project key) - Sustained high I/O (measured up to tens-of-thousands of IOPS, block device util 60%+, single core CPU pegged), machine temperature rose significantly
/aft-statusshowssearch_index/semantic_searchalready auto-disabled due todegraded_reasons: ["home_root"], butcallgraph_storestill enabled
Clearing the index cache under ~/.local/share/cortexkit/aft brought it back down, but as long as project_root remains <home-dir>/<large non-git directory> with callgraph_store:true, a restart reproduces the cold-build.
Root Cause
search_index/semantic_searchdefaultfalseand have ahome_rootauto-fuse (handle_configuresetsdegraded), so already mitigated.callgraph_storedefaultstrue(aft.schema.json: default true), with no equivalenthome_root/non-gitfuse; for non-git roots it is onlyconfigure warm deferred(deferred, not disabled), eventually stillbounded cold_build.- Users can hardly perceive that
callgraph_storeis the only heavy index enabled by default. - When a serve starts with
<home-dir>(or any non-git directory) asproject_root, AFT takes that directory as the whole callgraph build scope; the non-git root lacks.gitignoreconstraints (inferred: withoutgit_common_dir,bounded cold_buildenumerates files fromproject_root), and observations shownode_modules/.cacheetc. get included — i.e. home/non-project directories being treated as index roots and fully indexed is the direct trigger of the runaway growth.
Reproduction
- Empty config (don't set
callgraph_store), startopencode servewith<home-dir>or any non-git directory containing lots ofnode_modules/.cacheasproject_root. - Trigger one
aftcall (e.g.read), watchaftlogcallgraph store ... cold_buildand/aft-status. du -sh ~/.local/share/cortexkit/aftkeeps growing to GB-scale.
Impact
- On by default, violating the principle of least surprise; small projects unaffected, but large directories / mis-started cwd directly saturate disk and I/O.
- The real cost of turning
callgraph_storeoff is only:aft_callgraphunavailable,aft_zoom({callgraph:true})no annotations,aft_inspect'sdead_codereportscallgraph_unavailable;cycles/unused_exports/duplicates/todos,ast_grep_search/replace,LSP goto/references,outline/zoomare all unaffected — so the benefit/cost of enabling by default is not worth it.
Suggestions
The following two approaches both achieve "off by default, opt-in on demand"; please pick one:
Option A (symmetric downgrade, zero breaking): Extend the home_root fuse that callgraph_store already shares with search_index/semantic_search. We suggest adding in handle_configure a new heuristic: when project_root is a non-git root and file scale is large (specific threshold, or heuristic hit like node_modules/.cache, to be decided by implementation), automatically set callgraph_store: disabled and record degraded_reasons. This downgrade may still be explicitly overridden per project:
// <project>/.cortexkit/aft.jsonc
{ "callgraph_store": true }or finer-grained index.roots: [{ "path": "<project>", "indexes": ["callgraph"] }] to enable on demand.
Option B (change default, breaking): Change the global default of callgraph_store from true to false, guiding per-project opt-in:
// <project>/.cortexkit/aft.jsonc
{ "callgraph_store": true }also achieves "off by default, opt-in on demand"; the cost is that after upgrade all projects lose callgraph by default and must enable per project, but it buys complete mitigation for mis-start scenarios.
Both approaches preserve the fine-grained control of callgraph_chunk_size / index.roots.
Use case
No response
Activity
aft-alfonso commentedon Aug 27, 2026
Verified at source and accepted in two halves:
Home roots — you found a real asymmetry.
handle_configurefusessearch_indexandsemantic_searchon a home root (degraded_reasons: ["home_root"]) butcallgraph_storehas no fuse arm — home-root warming is only deferred, so a persistent serve rooted at$HOMEeventually cold-builds the store anyway. The symmetric fuse is being implemented now:callgraph_storeforce-disables on home roots with the same disclosure, scheduling gated at the chokepoint so no cold build is ever admitted, and callgraph-dependent surfaces (inspect dead-code, navigation) degrade through the existingcallgraph_store: falsepaths with an honest disabled status instead of a retry loop.Non-git / large directories — staying buildable by design. v0.52.2 shipped bounded resumable callgraph builds (streaming enumeration, ~tens-of-MB working set instead of the earlier GB-scale/OOM behavior) plus a crash breaker that suspends repeatedly-failing builds, precisely so non-git directories can be indexed safely — supporting document-directory use cases beyond code. So the default stays
truethere, withcallgraph_store: falseavailable per-project for opt-out. If you're seeing GB-scale stores on a non-home non-git root on 0.52.2+, that would be its own bug — a fresh report with the store path and size would be very welcome.The home fuse rides the next patch release.
aft-alfonso commentedon Aug 27, 2026
The home-root fuse is on main and CI-verified — rides the next patch release:
callgraph_storenow auto-disables on home roots exactly likesearch_indexandsemantic_search, with the samedegraded_reasons: ["home_root"]disclosure and a log line naming the remedy (open a project subdirectory).Thanks for the precise report — the asymmetry was real and your root-cause section was accurate down to the config lines.
aft-alfonso commentedon Aug 27, 2026
Released in v0.53.0 —
callgraph_storenow auto-disables on home-directory roots exactly like the search and semantic indexes (one symmetric fuse), so opening $HOME in an editor no longer triggers GB-scale callgraph builds. Callgraph-dependent surfaces report a terminal disabled state for the root instead of retrying.