The agent's shared SQLite brain database connection.
Run a full-text search against memory_traces_fts and join back to
memory_traces for metadata.
The SQL pattern:
SELECT mt.id, mt.content, mt.type, mt.scope, mt.strength, mt.tags
FROM memory_traces_fts fts
JOIN memory_traces mt ON mt.rowid = fts.rowid
WHERE fts.memory_traces_fts MATCH ?
AND mt.deleted = 0
[AND mt.type = ?] -- when type filter provided
[AND mt.scope = ?] -- when scope filter provided
ORDER BY rank -- FTS5 BM25 relevance (lower = more relevant)
LIMIT ?
Tags are stored as JSON arrays; they are parsed and returned as string[]. Malformed tag JSON returns an empty array rather than throwing.
Search input (query, optional type/scope/limit).
Tool execution context used to resolve scoped searches.
{ results } array on success, or an error result.
Readonly idGlobally unique tool identifier.
Readonly nameLLM-facing tool name.
Readonly displayHuman-readable display name.
Readonly descriptionLLM-facing description.
Readonly categoryLogical category for discovery and grouping.
Readonly hasThis tool only reads from the database — no side effects.
Readonly inputJSON schema for input validation and LLM tool-call construction.
ITool implementation that searches the agent's memory traces using FTS5.
Usage: