Skip to main content
Glama

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_path from 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.md or notes folder

  • Absorbing 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_save for 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

TableJSON Schema
NameRequiredDescriptionDefault
scope_idNoProject scope to tag imported memories with. Defaults to "default" (cross-project). Use a specific project name to scope the import.default
source_pathYesAbsolute 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

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Thoroughly describes mutation, atomic writes, security (path traversal guards), failure modes, dedup, idempotency, and latency. No annotations provided, so full burden is carried.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with sections, lists, and examples. Slightly verbose but each part justifies its length. Not overly terse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with 2 parameters and an output schema (mentioned), description covers behavior, usage, failure modes, return format, and example. Very complete given context signals.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema covers 100% of parameters with descriptions. Description adds context on source_path formats, scope_id default, and examples, going beyond schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states bulk import from file/directory/chat export. Distinguishes from sibling memory_save for single items and notes for incremental saves.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly lists when to use (initial bootstrap, absorbing decision logs, batch captures) and when not to use (incremental saves, session log mining). Names alternatives: memory_save and background miner.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TT-Wang/memem'

If you have feedback or need assistance with the MCP directory API, please join our Discord server