memory_import
Bulk-import memories from files, directories, or chat exports into Cortex, with automatic security scanning and deduplication.
Instructions
Bulk-import memories from a file, directory, or chat export.
Use this to seed Cortex with existing notes, CLAUDE.md content,
documentation excerpts, or chat logs you want to make searchable.
Each imported item runs through the same security scan and deduplication
as memory_save, so clean imports even from messy sources.
Behaviour:
MUTATION. Writes one or more memory markdown files, updates FTS5 index, _index.md, and events.jsonl. Same atomic + fcntl-locked write path as
memory_save.No authentication required.
No rate limits, but latency scales with source size — importing a 100-item directory can take several seconds.
Data access scope: reads the supplied
source_pathfrom the local filesystem. Guarded against path traversal: the resolved path must be inside $HOME; anything outside is rejected. Nothing is sent over the network.Not idempotent: re-importing the same source triggers the dedup check, which rejects duplicates with a summary count.
Failure modes: invalid or non-existent source paths return a string error. Individual rejected items are counted in the summary and do not abort the whole import.
Use memory_import for:
Initial bootstrap from an existing
CLAUDE.mdor notes folderAbsorbing a team-wide decision log into a project scope
One-off batch captures from a conversation export
Do NOT use for:
Incremental per-conversation saves (use
memory_savefor single items)Mining Claude Code session logs (the background miner handles that automatically; no manual import needed)
Returns: A summary like "Imported 12 memories from 18 candidates (rejected 6 duplicates)". Errors are returned as human-readable messages.
Example: memory_import( source_path="/home/alice/notes/team-decisions.md", scope_id="my-webapp", )
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scope_id | No | Project scope to tag imported memories with. Defaults to "default" (cross-project). Use a specific project name to scope the import. | default |
| source_path | Yes | Absolute path to a file or directory containing content to import as memories. Supported formats: plain text files (.txt, .md) treated as single memories, directories recursively scanned, and structured exports (JSONL chat logs). Must be under $HOME for path-traversal safety. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |