Skip to main content
Glama
jryom

agentsmd-memory

by jryom

agentsmd-memory

npm ci license

MCP server for keeping project memory in AGENTS.md. Zero dependencies.

The tools don't edit files. They resolve the nearest memory file and return instructions the agent carries out with its own Write/Edit tools, so every change — even creating the file — shows up as a reviewable git diff.

Tools

  • memory_save — record a durable fact (decision, convention, gotcha, non-obvious command).

  • memory_forget — remove a stale fact.

Related MCP server: mcp-memory-vault

Install

Published on npm as agentsmd-memory. Runs via npx — no global install needed. The config schema differs per client; expand yours below. On Windows, wrap the command as cmd /c npx -y agentsmd-memory.

Installs the MCP tools and same per-turn UserPromptSubmit nudge used by Claude Code:

codex plugin marketplace add https://github.com/jryom/agentsmd-memory.git
codex plugin add agentsmd-memory@agentsmd-memory

Restart Codex after installation. Review and enable the plugin hook with /hooks; Codex requires explicit trust for plugin hooks. Override reminder text with MEMORY_NUDGE.

Installs the MCP tools and a per-turn nudge in one step (see why the nudge helps; Claude Code delivers it via a UserPromptSubmit hook):

claude plugin marketplace add jryom/agentsmd-memory
claude plugin install agentsmd-memory@agentsmd-memory

Override the reminder text with the MEMORY_NUDGE env var. No file config needed: the tools prefer AGENTS.md and fall back to CLAUDE.md, which Claude Code auto-loads (see Config).

Tools without the nudge:

claude mcp add --transport stdio memory -- npx -y agentsmd-memory

claude_desktop_config.json or .cursor/mcp.json:

{
  "mcpServers": {
    "memory": {
      "command": "npx",
      "args": ["-y", "agentsmd-memory"]
    }
  }
}

~/.config/opencode/opencode.json. Note the differences: top-level mcp (not mcpServers), command is a single array, env goes in environment (not env).

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "memory": {
      "type": "local",
      "command": ["npx", "-y", "agentsmd-memory"],
      "enabled": true
    }
  },
  "plugin": ["agentsmd-memory"]
}

The plugin line is recommended — see per-turn reminder. It loads from npm by name, so it requires agentsmd-memory >= 1.2.0; restart opencode after editing.

.vscode/mcp.json (project) or your user mcp.json. Top-level key is servers and the type is stdio:

{
  "servers": {
    "memory": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "agentsmd-memory"]
    }
  }
}
copilot mcp add memory -- npx -y agentsmd-memory

Or edit ~/.copilot/mcp-config.json directly. Copilot CLI requires type: "local" and a tools field:

{
  "mcpServers": {
    "memory": {
      "type": "local",
      "command": "npx",
      "args": ["-y", "agentsmd-memory"],
      "tools": ["*"]
    }
  }
}

Repo → Settings → Copilot → MCP servers. Same shape as the CLI (type: "local", tools required). Any env vars must be prefixed COPILOT_MCP_.

{
  "mcpServers": {
    "memory": {
      "type": "local",
      "command": "npx",
      "args": ["-y", "agentsmd-memory"],
      "tools": ["*"]
    }
  }
}

Per-turn reminder

The tools are prompt-driven — the agent only calls them if it decides to, which rarely happens mid-task. The package ships integrations for opencode, Claude Code, and Codex that inject a short reminder every turn (opencode via the system prompt; Claude Code and Codex via a UserPromptSubmit hook), so the agent reliably reaches for memory_save/memory_forget. The opencode plugin is enabled via the "plugin": ["agentsmd-memory"] line in the config above. Override reminder text with MEMORY_NUDGE.

Config

Env

Default

Purpose

MEMORY_FILE

(unset)

Pin the target to a single file name, e.g. GEMINI.md. Bare name only. When set, disables the auto fallback below.

MEMORY_NUDGE

built-in reminder

opencode/Claude Code/Codex plugin only. Overrides the per-turn reminder text. To skip injection, don't load or enable the plugin hook.

When MEMORY_FILE is unset the tools prefer AGENTS.md, then fall back to CLAUDE.md. So a Claude Code repo that only has CLAUDE.md (which Claude auto-loads; it doesn't read AGENTS.md) is found without any config, while AGENTS.md stays preferred for cross-tool sharing when present.

Notes

  • Claude Code and Codex plugin installs launch the MCP server through unpinned npx -y agentsmd-memory, intentionally following npm's latest tag. npm may download package code on startup and caches fetched packages.

  • Workspace dir is resolved from MCP roots, else a cwd arg, else process.cwd(). From there it walks up to the git root; the nearest existing file wins, and at a given level AGENTS.md beats the CLAUDE.md fallback. When nothing exists, AGENTS.md is created at the git root.

  • The tools never write files. When no memory file exists, memory_save returns instructions to create one; the agent authors it with its own Write tool, so even bootstrapping shows up as a reviewable diff.

  • Saves are prompt-driven; the agent decides when to call them. Bundled integrations nudge it every turn.

Develop

npm test
npx @modelcontextprotocol/inspector npx -y agentsmd-memory

Source: github.com/jryom/agentsmd-memory.

License

MIT

Available Tools

2 tools
memory_forgetA

Remove outdated or wrong facts from the nearest AGENTS.md. Call this PROACTIVELY the moment you notice a stored fact no longer holds — do not wait to be asked. Triggers: you read AGENTS.md and a fact contradicts what you observe in the code; a command/path/convention it describes has been renamed or removed; a decision it records was reversed; a refactor made it obsolete; or you just changed something that invalidates an existing entry. Whenever you act on a fact from memory, sanity-check it against reality first — if it's stale, forget it. Keeping stale memory is worse than none: it misleads future sessions. Describe what to remove in natural language; matching is fuzzy. Returns instructions which you then carry out with your own Read/Edit tools, leaving all other facts intact.

ParametersJSON Schema
NameRequiredDescriptionDefault
cwdNoAbsolute path of the current project directory.
descriptionYesNatural-language description of the fact(s) to remove.

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations provided, the description fully explains behavior: returns instructions for the agent to execute, uses fuzzy matching, leaves other facts intact, and warns about consequences of stale memory. No hidden side effects or contradictions.

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 moderately long but well-structured: core action first, then triggers, then behavioral context, then return value. Each sentence adds value, though some redundancy could be trimmed.

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 no output schema, the description explains the tool's return (instructions) and overall process. It covers triggers, proactive use, and warns about stale memory, making it complete for a tool with only two parameters and high schema coverage.

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 all parameters (100%), but the description adds value by clarifying that matching is fuzzy and describing the removal in natural language. The cwd parameter is already well-described in the 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?

The description clearly states the tool removes outdated or wrong facts from AGENTS.md, with a specific verb (remove) and resource (nearest AGENTS.md). It distinguishes from the sibling tool 'memory_save' by focusing on forgetting.

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 instructs proactive calling upon noticing stale facts, lists multiple triggers, and directs the agent to use its own tools for the actual removal. Provides clear when-to-use guidance without ambiguity.

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

memory_saveA

Persist a durable project fact to the nearest AGENTS.md so future sessions skip rediscovering it. Call this PROACTIVELY the moment you learn something lasting and non-inferable — do not wait to be asked. Triggers: an architecture decision or its rationale; a naming/structure convention; a build/test/deploy command that isn't obvious; a gotcha or footgun you hit; a tooling quirk (e.g. uses Fossil not git, runs behind a proxy); a 'we tried X, it failed, use Y instead' lesson. Also call it when WRAPPING UP a task that revealed any such fact: before you report completion, ask yourself 'did I learn something a future session would have to rediscover?' and if so, save it. Do NOT save: transient state (current bug, a path you're editing now), secrets/credentials, anything trivially re-derivable from the code, or facts the user explicitly said are one-off. Keep each fact one concise sentence. Returns merge instructions which you then carry out with your own Read/Edit tools. Exception: if no memory file exists yet, this creates it directly and no further action is needed.

ParametersJSON Schema
NameRequiredDescriptionDefault
cwdNoAbsolute path of the current project directory.
learningYesThe durable fact to remember, stated concisely.

TDQS

A4.6/5.0
Behavior4/5

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

With no annotations provided, the description carries full burden. It discloses that the tool returns merge instructions to be carried out with Read/Edit tools and handles the case where no memory file exists by creating it directly. However, it does not detail authentication, rate limits, or potential side effects beyond writing.

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 lengthy but well-structured with clear sections for triggers, anti-triggers, and behavioral instructions. It is front-loaded with the core purpose. While not perfectly concise, every sentence adds value and the thoroughness aids correct usage.

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 absence of annotations and output schema, the description is remarkably complete. It explains the return value and required subsequent actions, handles the exception of no existing memory file, and provides comprehensive guidance on what and when to save. The only minor ambiguity is 'nearest AGENTS.md', but overall it thoroughly equips the agent.

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%, so descriptions already cover parameters. The description adds significant meaning for 'learning' by specifying format ('one concise sentence') and giving concrete examples of what constitutes a durable fact. The 'cwd' parameter is not further elaborated, but schema explains it sufficiently.

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 explicitly states 'Persist a durable project fact to the nearest AGENTS.md' with a specific verb and resource. It clearly distinguishes from sibling tool memory_forget by focusing on saving vs. forgetting.

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?

The description provides detailed when-to-use instructions: 'Call this PROACTIVELY the moment you learn something lasting and non-inferable' and lists specific triggers and anti-triggers. It also advises calling at task wrap-up and explicitly states what not to save.

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

TDQS

A4.6/5.0
Disambiguation5/5

The two tools have clearly distinct purposes: one saves new facts, the other removes outdated ones. There is no overlap or ambiguity.

Naming Consistency5/5

Both tools follow a consistent 'memory_' prefix followed by a verb ('save', 'forget') that accurately describes their action.

Tool Count4/5

With only 2 tools, the server is minimal but well-scoped for its purpose of managing a single memory file. It could benefit from a read or update tool, but the count is not inappropriate.

Completeness3/5

The set covers the core operations of adding and removing facts, but lacks the ability to explicitly list or update facts. However, agents can use their own read tools to inspect the file, and updates can be simulated by a forget-then-save sequence.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    A
    maintenance
    MCP server providing cognitive memory tools (remember, recall, think, etc.) for AI agents, enabling forgetting, consolidation, and contradiction detection.
    172
    Apache 2.0
  • A
    license
    Not graded
    quality
    C
    maintenance
    An MCP server that gives agents persistent memory with namespaced facts, tags, full-text search, and TTL expiry, all running locally on SQLite with zero external dependencies.
    1
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    MCP server providing persistent memory for AI agents, enabling them to read, write, and query memories across sessions.
    9
    24
    MIT

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/jryom/agentsmd-memory'

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