Summary
Add a memory_search tool that allows the LLM to search Ghost's persistent memory using hybrid retrieval. Follows the same tool.Tool interface pattern as search.go.
Details
New files:
internal/tool/memory_search.go
internal/tool/memory_search_test.go
Type:
type MemorySearch struct {
Store *memory.Store
}
Tool definition:
- Name:
memory_search
- Description:
"search your persistent memory for relevant information from past conversations and saved knowledge"
- Parameters:
query (string, required): the search query
max_results (integer, optional): maximum results to return (default 5)
Execute:
- Parse args JSON (same pattern as
search.go)
- Call
Store.Search(ctx, query, maxResults)
- Format results:
Memory Result 1: [source: daily/2026-02-07.md]
<chunk content>
Memory Result 2: [source: MEMORY.md]
<chunk content>
Errors:
ErrMemorySearchArgs — failed to parse arguments
ErrMemorySearchFail — search operation failed
Testing:
- Table-driven tests following
search_test.go pattern
- Use real
memory.Store with temp dir and mock EmbedFunc
Note: This tool is not registered in the registry yet — that happens in the integration issue.
Dependencies
Acceptance Criteria
Summary
Add a
memory_searchtool that allows the LLM to search Ghost's persistent memory using hybrid retrieval. Follows the sametool.Toolinterface pattern assearch.go.Details
New files:
internal/tool/memory_search.gointernal/tool/memory_search_test.goType:
Tool definition:
memory_search"search your persistent memory for relevant information from past conversations and saved knowledge"query(string, required): the search querymax_results(integer, optional): maximum results to return (default 5)Execute:
search.go)Store.Search(ctx, query, maxResults)Errors:
ErrMemorySearchArgs— failed to parse argumentsErrMemorySearchFail— search operation failedTesting:
search_test.gopatternmemory.Storewith temp dir and mockEmbedFuncNote: This tool is not registered in the registry yet — that happens in the integration issue.
Dependencies
Acceptance Criteria
tool.Toolinterface (Definition()+Execute())