Problem. 'Which project am I in?' is answered differently by different callers. main.rs repeats the resolve-root → open DB → ensure_project sequence in ~9 arms (700, 851, 924, 1005, 1054, 1113, 1163, 1224, 1630) using resolve_project_root; engine/review.rs (177-190, 242, 297, 784, 927) and engine/index_scanner.rs (118/212/295/482) use raw current_dir(); mcp/tools.rs:440, serve, watch, routes, query and engine/db_writer.rs each have their own open path with different PRAGMAs (6 vs 2). From a subdirectory the review-time scanners can resolve a different/empty project_id than the one indexed; #565 (per-project file keying) made this load-bearing, and project_root_mismatch_hint is a band-aid. IndexBridge is only used by the resolver, so it does not pass the deletion test.
Direction. One module owns resolve root + open DB + project id (tolerant for review, strict for CLI) and the PRAGMAs. All entry points go through it.
Benefit. Locality for the root-resolution bug class; ~10 main.rs arms shrink; scanners (unused-imports, dead-code) become testable against an in-memory index without touching $HOME. Unblocks the other candidates.
From the 2026-10 architecture review (deepening candidates, develop @ 147dd75).
Problem. 'Which project am I in?' is answered differently by different callers.
main.rsrepeats the resolve-root → open DB →ensure_projectsequence in ~9 arms (700, 851, 924, 1005, 1054, 1113, 1163, 1224, 1630) usingresolve_project_root;engine/review.rs(177-190, 242, 297, 784, 927) andengine/index_scanner.rs(118/212/295/482) use rawcurrent_dir();mcp/tools.rs:440,serve,watch,routes,queryandengine/db_writer.rseach have their own open path with different PRAGMAs (6 vs 2). From a subdirectory the review-time scanners can resolve a different/empty project_id than the one indexed; #565 (per-project file keying) made this load-bearing, andproject_root_mismatch_hintis a band-aid.IndexBridgeis only used by the resolver, so it does not pass the deletion test.Direction. One module owns resolve root + open DB + project id (tolerant for review, strict for CLI) and the PRAGMAs. All entry points go through it.
Benefit. Locality for the root-resolution bug class; ~10 main.rs arms shrink; scanners (unused-imports, dead-code) become testable against an in-memory index without touching $HOME. Unblocks the other candidates.
From the 2026-10 architecture review (deepening candidates, develop @ 147dd75).