Access the underlying IKnowledgeGraph implementation.
Useful for advanced queries (traversal, semantic search, neighbourhood lookups) that are not exposed on the facade directly.
Static createCreate a new Memory instance and wire together all subsystems.
Initialization sequence:
config with defaults (store='sqlite', path=tmpdir, graph=true,
selfImprove=true, decay=true).SqliteBrain.open(config.path).SqliteKnowledgeGraph(brain).SqliteMemoryGraph(brain) and call .initialize().LoaderRegistry() (pre-registers all built-in loaders).FolderScanner(registry).ChunkingEngine().selfImprove: create RetrievalFeedbackSignal(brain) and
ConsolidationLoop(brain, memoryGraph).Optional config: MemoryConfigOptional configuration; see MemoryConfig.
A fully initialised Memory instance.
Store a new memory trace.
Creates a trace in the memory_traces table with a unique ID, content
hash for deduplication, and optional type/scope/tags metadata. If the
memory graph is available the trace is also added as a graph node.
The text content to remember.
Optional options: RememberOptionsOptional metadata (type, scope, tags, importance, etc.).
The created MemoryTrace-like object.
Search for memory traces matching a natural-language query.
Uses FTS5 full-text search with the Porter tokenizer. Results are ranked
by strength * abs(fts_rank) and filtered by optional type/scope/strength
criteria.
Natural-language search query.
Optional options: RecallOptionsOptional filters (limit, type, scope, minStrength).
Ranked array of ScoredTrace results.
Ingest documents from a file, directory, or URL.
Workflow:
document_chunks, create a memory trace.documents table.File path, directory path, or URL.
Optional options: IngestOptionsOptional ingestion settings (recursive, include/exclude globs).
Summary of the ingestion run.
Add or update an entity in the knowledge graph.
Delegates to SqliteKnowledgeGraph.upsertEntity(). Accepts a partial
entity; id, createdAt, and updatedAt are auto-generated when omitted.
Partial entity descriptor.
The complete, persisted entity.
Add or update a relation (edge) in the knowledge graph.
Delegates to SqliteKnowledgeGraph.upsertRelation(). Accepts a partial
relation; id and createdAt are auto-generated when omitted.
Partial relation descriptor.
The complete, persisted relation.
Run one consolidation cycle (prune, merge, strengthen, derive, compact, re-index).
Optional options: { Optional topic filter (reserved for future use).
Optional topic?: stringStatistics from the consolidation run.
When selfImprove was set to false in the config.
Record retrieval feedback for a memory trace.
The feedback is persisted asynchronously. This method returns a Promise that resolves once the feedback has been written.
The ID of the trace being evaluated.
Whether the trace was 'used' or 'ignored' by the LLM.
Optional query: stringOptional retrieval context, typically the original user query.
Detect and persist used/ignored feedback for a batch of injected traces based on the assistant's final response text.
This is the high-level bridge used by long-term-memory integrations that already know which traces were injected into the prompt.
Optional query: stringExport the memory store to a file or directory.
Format is detected from options.format or the file extension:
.json -> JSON.sqlite / .db -> SQLite file copyoptions.format)Path to write the export to.
Optional options: ExportOptionsOptional format and content controls.
Import memory data from a file or directory.
Format is detected from options.format, the file extension, or by
inspecting the content.
Path to the import source (file or directory).
Optional options: ImportOptionsOptional format hint and dedup settings.
Summary of the import operation.
Import memory data from a string without filesystem access.
Supports JSON and CSV formats. Useful in browser environments or when the data is already in memory.
The raw string content to import.
The format of the content: 'json' or 'csv'.
Optional options: Pick<ImportOptions, "dedup">Optional deduplication controls.
Summary of the import operation.
Export the full brain state as a JSON string without filesystem access.
Useful in browser environments or when the data needs to be sent over a network connection.
Optional options: ExportOptionsOptional export configuration (embeddings, conversations).
Pretty-printed JSON string of the full brain payload.
Create runtime ITool instances backed by this memory facade's SQLite brain.
This is the supported bridge from the standalone memory engine into
AgentOS tool registration. The returned tools share this Memory
instance's underlying SQLite database and consolidation loop.
Typical usage:
for (const tool of memory.createTools()) {
await agentos.getToolOrchestrator().registerTool(tool);
}
When self-improvement is disabled, memory_reflect is omitted because
there is no backing ConsolidationLoop instance.
Optional options: { Optional includeReturn a health snapshot of the memory store.
Queries aggregate statistics from all tables and returns a MemoryHealth report.
Unified public API for the AgentOS memory system.
One
Memoryinstance manages the full lifecycle of an agent's memories: storing, retrieving, ingesting documents, building a knowledge graph, self-improving through consolidation, and importing/exporting data.Quick start