(args: z.infer<typeof RecallArgs>, ctx: ToolContext)
| 71 | argsSchema = RecallArgs; |
| 72 | |
| 73 | async execute(args: z.infer<typeof RecallArgs>, ctx: ToolContext): Promise<ToolResult> { |
| 74 | const cwd = ctx.cwd ?? process.cwd(); |
| 75 | const limit = args.limit ?? 20; |
| 76 | const scope = args.scope ?? 'all'; |
| 77 | const q = args.query?.trim(); |
| 78 | const store = getSessionStore(); |
| 79 | const get = (s: 'user' | 'project') => q ? store.searchFacts(q, s, cwd, limit) : store.getFactsByScope(s, cwd, limit); |
| 80 | const sections: string[] = []; |
| 81 | if (scope === 'all' || scope === 'user') { |
| 82 | const u = get('user'); |
| 83 | if (u.length) sections.push(`User memory (all projects) — ${u.length}:\n${u.map(f => ' - ' + f).join('\n')}`); |
| 84 | } |
| 85 | if (scope === 'all' || scope === 'project') { |
| 86 | const p = get('project'); |
| 87 | if (p.length) sections.push(`Project memory (${cwd}) — ${p.length}:\n${p.map(f => ' - ' + f).join('\n')}`); |
| 88 | } |
| 89 | if (sections.length === 0) { |
| 90 | return { content: q ? `No facts matching "${q}"${scope === 'all' ? '' : ` in ${scope}`}.` : `No ${scope === 'all' ? '' : scope + ' '}facts stored yet.` }; |
| 91 | } |
| 92 | return { content: (q ? `🔎 Search "${q}":\n\n` : '') + sections.join('\n\n') }; |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | const ForgetArgs = z.object({ |
nothing calls this directly
no test coverage detected