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

Function collectSurfacedMemories

src/utils/attachments.ts:2251–2266  ·  view source on GitHub ↗
(messages: ReadonlyArray<Message>)

Source from the content-addressed store, hash-verified

2249 * are gone from the compacted transcript, so re-surfacing is valid again.
2250 */
2251export function collectSurfacedMemories(messages: ReadonlyArray<Message>): {
2252 paths: Set<string>
2253 totalBytes: number
2254} {
2255 const paths = new Set<string>()
2256 let totalBytes = 0
2257 for (const m of messages) {
2258 if (m.type === 'attachment' && m.attachment.type === 'relevant_memories') {
2259 for (const mem of m.attachment.memories) {
2260 paths.add(mem.path)
2261 totalBytes += mem.content.length
2262 }
2263 }
2264 }
2265 return { paths, totalBytes }
2266}
2267
2268/**
2269 * Reads a set of relevance-ranked memory files for injection as

Callers 1

Calls 1

addMethod · 0.45

Tested by

no test coverage detected