Skip to content

refactor(index): one index session for index/watch/serve/brain/MCP setup - #576

Merged
ajianaz merged 1 commit into
developfrom
refactor/index-session
Oct 7, 2026
Merged

ajianaz merged 1 commit into
developfrom
refactor/index-session

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

What

Adds index::session (IndexSession, ConfigSource, configure) as the single owner of config -> embedding backend -> vector store -> skip patterns -> project root (via IndexBridge) -> incremental index -> stats. index, index --watch, watch, serve, brain and the MCP brain tool all go through it.

Why

Closes #567

How

  • prepare_index_config removed; commands/watch.rs and the brain arm no longer re-inline the steps.
  • serve now takes the global --config (it used to pass None).
  • MCP brain search now resolves the embedding backend. It uses ConfigSource::ProjectOnly (project .cora.yaml only, no env/global/API keys, per security(config): don't send API key to base_url from project .cora.yaml #563). resolve_backend only consumes the local brain.embedding string, so this does not widen the trust surface.
  • Review-time index scanners use index_skip_patterns(config) = ignore.files + index_skip_files, the same set as indexing.
  • cora index arm is thin dispatch to commands/index_cmd.rs.
  • index --watch now delegates to the watch implementation (500ms debounce instead of a fixed 2s poll; watch's message wording). Flags unchanged. --rebuild now also refreshes the session's project id.
  • Removed now-unused IndexBridge::current_root.

Testing

  • cargo test --features tree-sitter passes
  • cargo fmt --all -- --check passes
  • cargo clippy --all-targets --features tree-sitter -- -D warnings passes
  • cargo build --release not run (disk)
  • New tests in index/session.rs: merged skip patterns, backend resolution (project-only path used by MCP), explicit --config honored, incremental stats, rebuild/prune, scanners and indexing sharing one skip source.

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: ajianaz <ajianaz@users.noreply.github.com>
@ajianaz
ajianaz merged commit 3da0b40 into develop Oct 7, 2026
14 checks passed
ajianaz added a commit that referenced this pull request Oct 8, 2026
)

Covers security hardening (#563, #572, #573), fixes (#553, #561, #562,
#564, #565, #574-#576), and the ignore-pattern semantic changes from
#577 that can alter which files existing configs exclude.

Signed-off-by: ajianaz <ajianaz@users.noreply.github.com>
Co-authored-by: ajianaz <ajianaz@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(index): one index-session module for index/watch/serve/brain/MCP setup

1 participant