Repository navigation
Conversation
Parse workspace paths from MCP tool output and arguments so glob-based rules attach when code is inspected through an MCP server instead of the native read tool. Handles key/value fields, grep-style rows, JSON payloads, and tool arguments for any language.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
globs-based rules attach fromFileObservationrecords. Today those recordsare only produced by the native file-handling tools (
read,write,edit,apply_patch,lsp).When an agent reads or searches the workspace through an MCP server (semantic
indexer, ripgrep wrapper, language server, filesystem or memory server), the
returned paths never become observations, so matching rules never attach.
This PR adds a language-agnostic observation normalizer for MCP tool results.
Native tool behavior is unchanged.
Implementation
MCP tool detection
mcp__<server>__<tool>.<server>_<tool>naming (for example1c-index_read_method),matched by a whole segment from
read,find,search,lookup,inspect,info,get,grep,list,scan,query,glob.Path extraction
path=,file=,file_path=,filePath=,relativePath=,module_path=,filename=; quoted values, spaces, andnon-ASCII/Cyrillic paths.
- src/a.go:10,src/a.go:10:5,→ path,-> path, and bare path lists.resultsoritems.file content.
Normalization
/..git/,node_modules/, wildcard masks, and version-like tokenssuch as
1.2.3are rejected.Also in this PR
windowsHide: truewhen resolving the git branch, so thebackground service does not flash a console window on every dispatch.
\b, soCyrillic and other non-ASCII keywords match.
Compatibility
read/write/edit/apply_patch/lspobservations are untouched.parsed; no extra filesystem access.
Tests
Added coverage in
src/session/file-observation.test.tsfor TypeScript,Python, Go, Rust, Vue, and 1C paths with spaces/Cyrillic names, plus
grep-style rows, JSON payloads, argument fallback, URL/noise rejection, and
the 5-path cap.
Targeted run:
Result: 137 passed (16 file-observation, 110 index.rules, 11 git-branch).
The full suite still reports 5 pre-existing Windows-only failures in
src/config/plugin-options.test.ts,tui/data/rules.test.ts, andsrc/index.runtime.test.ts(POSIX path expectations, file permissions, and ashell side-effect marker). They are unrelated to this change.
Commits
feat(mcp): observe file paths from MCP tool results— main change.fix(windows): hide git subprocess console window— no console flashes.fix(keywords): support non-ASCII keywords— Unicode keyword matching.