MCPcopy Index your code
hub / github.com/codeaashu/claude-code / isMemorySearch

Function isMemorySearch

src/utils/collapseReadSearch.ts:81–104  ·  view source on GitHub ↗

* Check if a search tool use targets memory files by examining its path, pattern, and glob.

(toolInput: unknown)

Source from the content-addressed store, hash-verified

79 * Check if a search tool use targets memory files by examining its path, pattern, and glob.
80 */
81function isMemorySearch(toolInput: unknown): boolean {
82 const input = toolInput as
83 | { path?: string; pattern?: string; glob?: string; command?: string }
84 | undefined
85 if (!input) {
86 return false
87 }
88 // Check if the search path targets a memory file or directory (Grep/Glob tools)
89 if (input.path) {
90 if (isAutoManagedMemoryFile(input.path) || isMemoryDirectory(input.path)) {
91 return true
92 }
93 }
94 // Check glob patterns that indicate memory file access
95 if (input.glob && isAutoManagedMemoryPattern(input.glob)) {
96 return true
97 }
98 // For shell commands (bash grep/rg, PowerShell Select-String, etc.),
99 // check if the command targets memory paths
100 if (input.command && isShellCommandTargetingMemory(input.command)) {
101 return true
102 }
103 return false
104}
105
106/**
107 * Check if a Write or Edit tool use targets a memory file and should be collapsed.

Callers 1

collapseReadSearchGroupsFunction · 0.85

Calls 4

isAutoManagedMemoryFileFunction · 0.85
isMemoryDirectoryFunction · 0.85

Tested by

no test coverage detected