Skip to main content
Glama

memory_save

Persist decisions, conventions, and lessons to recall in future sessions. Captures rationale and context so knowledge survives across Claude Code sessions.

Instructions

Save a durable lesson, decision, or convention to persistent memory.

Use this to capture knowledge that should survive across Claude Code sessions: user preferences, architecture decisions with rationale, environment quirks, non-obvious bug fixes, or anything you'd otherwise have to re-explain in the next session.

Behaviour:

  • MUTATION. Writes a new markdown file under /obsidian-brain/cortex/memories/, appends to the FTS5 index (/.cortex/search.db), updates ~/obsidian-brain/cortex/_index.md, and writes an append-only entry to ~/.cortex/events.jsonl. Writes are atomic (tmp + fsync + os.replace) and fcntl-locked.

  • No authentication required. Local-first; no credentials.

  • No rate limits. Typical latency 50-200ms including the security scan, dedup check, and write sync.

  • Data access scope: writes stay entirely on the local filesystem. Nothing is sent over the network.

  • Not idempotent: calling twice with identical content triggers the dedup check and the second call returns a "Memory already exists" error instead of a duplicate write.

  • Failure modes: rejected inputs return a string error ("Memory already exists", "Memory rejected: "); they never raise to the caller.

Every save goes through:

  1. Prompt-injection + credential-exfil security scan (rejects matches)

  2. Fuzzy deduplication against existing memories (word+bigram+trigram overlap — rejects near-duplicates with clear reason)

  3. Automatic related-memory linking (adds related frontmatter field)

  4. Write to Obsidian markdown file + FTS5 index + _index.md

Use memory_save for:

  • "We decided to use X because Y" (decision + rationale)

  • "User prefers small focused PRs, not big bundled ones" (preference)

  • "Database connection pool must be at least 20 for prod" (invariant)

  • "bcrypt.compare is async — always await" (gotcha)

Do NOT use for:

  • "Today I worked on X" (session logs — use transcript_search to find those)

  • Trivial facts easily re-discovered from reading code

  • Speculative or unverified claims

  • Duplicates of existing memories (the dedup check will reject them anyway)

Returns: A confirmation like "Memory saved: 63d6570e... 'JWT auth uses RS256'" on success, or an error message (starting with "Memory already exists" or "Memory rejected") on failure.

Example: memory_save( content="Use RS256 (not HS256) for JWT in production. HS256 " "requires sharing the signing secret across services " "which leaked via an env var export last quarter (#1247).", title="JWT algorithm — RS256 only in prod", tags="auth,jwt,security,postmortem", scope_id="my-webapp", )

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tagsNoComma-separated tag list (e.g. "auth,jwt,security"). Tags are used for filtering in `memory_list` and contribute to recall scoring. Keep them lowercase and topical.
titleNoShort descriptive title, <120 characters. If empty, the first 60 chars of content are used. A good title is a declarative summary ("Use RS256 JWTs in prod"), not a question.
contentYesThe full memory body, written as natural-language prose. Should be atomic (one idea per save): capture ONE decision, convention, lesson, or preference with enough context to be useful in a future session. Include the rationale, not just the outcome. Max ~2000 characters recommended.
scope_idNoProject scope for the memory. "default" for cross-project global memories (user preferences, general lessons). A specific project name for project-scoped memories (e.g. "cortex-plugin", "my-webapp").default

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations provided, the description fully discloses mutation behavior, security scan, dedup process, error handling, local-only data flow, atomic writes, and typical latency. It covers all important behavioral traits an agent needs to anticipate outcomes.

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?

The description is fairly long but well-structured with sections (Behaviour, Use for, Do NOT use for, Returns, Example). Every sentence adds value, though a few details could be tighter. Front-loaded with purpose, which is good for scanning.

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?

Given the tool's complexity (4 parameters, multiple behavioral aspects, return values), the description covers everything an agent needs: input constraints, processing steps, output format, error messages, and a complete example. No gaps remain.

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 coverage is 100%, but description adds meaning beyond the schema: explains tags are used for filtering and recall scoring, suggests title format and character limits, describes content as atomic prose with rationale, and clarifies scope_id semantics. This exceeds the baseline of 3.

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?

The description begins with a clear verb+resource pair: 'Save a durable lesson, decision, or convention to persistent memory.' It distinguishes from siblings like 'transcript_search' and provides concrete examples, leaving no ambiguity about the tool's purpose.

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 (decisions, preferences, invariants, gotchas) and when NOT to use (session logs, trivial facts, speculative claims, duplicates). It also names an alternative (transcript_search) and explains what happens with duplicates, giving the agent clear selection criteria.

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