MCPcopy
hub / github.com/codeaashu/claude-code / logContainsQuery

Function logContainsQuery

src/utils/agenticSessionSearch.ts:113–140  ·  view source on GitHub ↗

* Checks if a log contains the query term in any searchable field.

(log: LogOption, queryLower: string)

Source from the content-addressed store, hash-verified

111 * Checks if a log contains the query term in any searchable field.
112 */
113function logContainsQuery(log: LogOption, queryLower: string): boolean {
114 // Check title
115 const title = getLogDisplayTitle(log).toLowerCase()
116 if (title.includes(queryLower)) return true
117
118 // Check custom title
119 if (log.customTitle?.toLowerCase().includes(queryLower)) return true
120
121 // Check tag
122 if (log.tag?.toLowerCase().includes(queryLower)) return true
123
124 // Check branch
125 if (log.gitBranch?.toLowerCase().includes(queryLower)) return true
126
127 // Check summary
128 if (log.summary?.toLowerCase().includes(queryLower)) return true
129
130 // Check first prompt
131 if (log.firstPrompt?.toLowerCase().includes(queryLower)) return true
132
133 // Check transcript (more expensive, do last)
134 if (log.messages && log.messages.length > 0) {
135 const transcript = extractTranscript(log.messages).toLowerCase()
136 if (transcript.includes(queryLower)) return true
137 }
138
139 return false
140}
141
142/**
143 * Performs an agentic search using Claude to find relevant sessions

Callers 1

agenticSessionSearchFunction · 0.85

Calls 2

getLogDisplayTitleFunction · 0.85
extractTranscriptFunction · 0.85

Tested by

no test coverage detected