Summary
Upstream semble #243 (ca197f7) added semble clear orphans: removes cached indexes whose local source directory no longer exists. csp's clear only accepts all | index | savings.
Upstream
cli.py::_clear_orphans(cache_folder): for each */index* entry, read metadata.json, take root_path; skip unless it is a non-empty string and cache_key(root_path) equals the entry's directory name (this excludes git-URL entries, whose root_path is a temp clone dir); delete when Path(root_path) does not exist.
cache.py::cache_key(path) extracted so the CLI can verify the key.
clear all does not include orphans; orphans is its own choice.
csp status
crates/csp/src/bin/csp/main.rs::run_clear_at: choices ["all","index","savings"]. Not reflected.
IndexManifest.source_id: Option<String> (indexing/index.rs) records the normalized source, and indexing/cache.rs::resolve_cache_dir derives the key from sourceId + content + ref — so an orphan check can recompute the key from the manifest and compare it to the directory name, as upstream does.
Tasks
Refs
Summary
Upstream semble #243 (
ca197f7) addedsemble clear orphans: removes cached indexes whose local source directory no longer exists. csp'sclearonly acceptsall | index | savings.Upstream
cli.py::_clear_orphans(cache_folder): for each*/index*entry, readmetadata.json, takeroot_path; skip unless it is a non-empty string andcache_key(root_path)equals the entry's directory name (this excludes git-URL entries, whoseroot_pathis a temp clone dir); delete whenPath(root_path)does not exist.cache.py::cache_key(path)extracted so the CLI can verify the key.clear alldoes not include orphans;orphansis its own choice.csp status
crates/csp/src/bin/csp/main.rs::run_clear_at: choices["all","index","savings"]. Not reflected.IndexManifest.source_id: Option<String>(indexing/index.rs) records the normalized source, andindexing/cache.rs::resolve_cache_dirderives the key fromsourceId + content + ref— so an orphan check can recompute the key from the manifest and compare it to the directory name, as upstream does.Tasks
orphanstoclearchoices +CLEAR_CHOICEShelp text.clear_orphan_indexes(loc)inindexing/cache.rs: iterate<home>/index/*/manifest.json, skip git sources / key mismatches / unparsable manifests, remove entries whosesource_idpath no longer exists; keep the existing "only under the real index root" safety check.csp clearsection.Refs
ca197f7)949559b..6bbbd32, 2026-09-03