Skip to content

Add index-time path exclusion via config and --exclude - #94

Merged
nicosuave merged 1 commit into
mainfrom
feat/index-time-exclusion
Aug 18, 2026
Merged

Add index-time path exclusion via config and --exclude#94
nicosuave merged 1 commit into
mainfrom
feat/index-time-exclusion

Conversation

@nicosuave

Copy link
Copy Markdown
Owner

Closes #93.

Problem

memex indexes each supported tool's session store wholesale. When a transcript tree mixes work with different confidentiality obligations (client, employer, personal projects as sibling directories under ~/.claude/projects), indexing is all-or-nothing: whole-source toggles exclude entire tools, and --source takes a single path. Since the Tantivy schema stores text/tool_input/tool_output, and memex transfer/share can move indexed content off-machine, the current answer is to decline the whole tool.

Change

An index-time exclusion list, applied during source discovery so matched transcripts never enter the index:

exclude_paths = ["~/.claude/projects/*-client-*", "~/work/**"]

plus a repeatable --exclude GLOB flag on memex index for one-off runs (merged on top of config patterns).

  • Matching is done with globset (literal_separator(false) so * crosses path separators, and ** works as expected). A leading ~/ is expanded to the home directory.
  • Applied at discovery — before metadata access — for every source: Claude, Codex (rollouts + history), OpenCode, Cursor, Pi, OMP, OpenClaw, Copilot. Not at query time, so stored-text and transfer/share reachability is unchanged for excluded content.
  • Adding a pattern after content was already indexed removes those records from the index and analytics store on the next run, and prunes them from ingest state — no --reindex required.
  • The background index service command builder forwards --exclude; auto-index paths (search, TUI, machine RPC) honor config exclusions.
  • is_excluded also matches symlink-resolved canonical paths, so patterns work with either spelling where temp/home dirs are symlinked (e.g. macOS /var/private/var).

Verification

  • cargo fmt --check and cargo clippy -- -D warnings pass.
  • New tests: discovery filtering + purge of previously indexed excluded transcripts, ** separator behavior, invalid-pattern rejection, ~ expansion, empty-pattern no-op, and service command forwarding.
  • Full cargo test --lib: 356 passed, 2 failures that reproduce identically on clean main (sources::hermes::wal_dependency_preserves_invalid_utf8_path_bytes_and_invalidates_on_change fails in isolation; analytics::repository_grouping_uses_git_common_dir_project is order-dependent and passes alone). Neither touches this change.

Transcripts matched by `exclude_paths` in ~/.memex/config.toml (or
repeatable `--exclude GLOB` on `memex index`) are now skipped during
source discovery, so their content never enters the Tantivy index,
the analytics store, or the vector store. This keeps the indexed
corpus aligned with the trust boundary when one tool's session tree
mixes projects with different confidentiality obligations.

- New `exclude_paths` config key with `~/` expansion, and a
  repeatable `--exclude` CLI flag for one-off runs (both merged).
- Exclusions apply at discovery for every source (Claude, Codex,
  OpenCode, Cursor, Pi, OMP, OpenClaw, Copilot), before metadata
  access, not at query time.
- Records previously indexed from now-excluded paths are deleted
  from the index and analytics store on the next run, and pruned
  from ingest state, so adding a pattern does not require --reindex.
- Glob matching uses globset with literal_separator(false), and
  also matches symlink-resolved canonical paths so patterns work
  with either spelling on systems where temp/home dirs are symlinked.
- The background index service command builder forwards --exclude.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@nicosuave
nicosuave merged commit 5f951d0 into main Aug 18, 2026
4 checks passed
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.

Index-time exclusion for paths or projects

1 participant