Summary
Add a memory_save tool that allows the LLM to persist important information to Ghost's memory system. Follows the same tool.Tool interface pattern as search.go.
Details
New files:
internal/tool/memory_save.go
internal/tool/memory_save_test.go
Type:
type MemorySave struct {
Store *memory.Store
}
Tool definition:
- Name:
memory_save
- Description:
"save important information to persistent memory for future reference"
- Parameters:
content (string, required): the information to save
target (string, optional): "daily" (default) or "long_term"
Execute:
- Parse args JSON (same pattern as
search.go)
- Route to
Store.SaveToDaily() or Store.SaveToLongTerm() based on target
- Return confirmation:
"Saved to daily log (2026-02-07.md)" or "Saved to long-term memory (MEMORY.md)"
Errors:
ErrMemorySaveArgs — failed to parse arguments
ErrMemorySaveFail — save operation failed
ErrInvalidTarget — target not "daily" or "long_term"
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_savetool that allows the LLM to persist important information to Ghost's memory system. Follows the sametool.Toolinterface pattern assearch.go.Details
New files:
internal/tool/memory_save.gointernal/tool/memory_save_test.goType:
Tool definition:
memory_save"save important information to persistent memory for future reference"content(string, required): the information to savetarget(string, optional):"daily"(default) or"long_term"Execute:
search.go)Store.SaveToDaily()orStore.SaveToLongTerm()based on target"Saved to daily log (2026-02-07.md)"or"Saved to long-term memory (MEMORY.md)"Errors:
ErrMemorySaveArgs— failed to parse argumentsErrMemorySaveFail— save operation failedErrInvalidTarget— target not "daily" or "long_term"Testing:
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())