@ai-devkit/memory

中文文档
0.20.4发布于 2026/10/23Apache-2.0TypeScriptES Module近 30 天下载 1787

Local MCP memory for AI coding agents to reuse project decisions, conventions, and fixes across sessions

原始使用文档
文档目录8 节
  1. Features
  2. Installation
  3. Quick Start
  4. Store Knowledge
  5. Search Knowledge
  6. Optional semantic search
  7. Documentation
  8. License

@ai-devkit/memory

A local MCP-based memory service for AI coding agents. Store project decisions, coding conventions, and reusable fixes so agents can retrieve them across sessions with SQLite full-text search.

npm version License: Apache 2.0

Most users get this automatically through ai-devkit init. Install @ai-devkit/memory directly when you want to wire the MCP memory server into your own MCP client configuration.

Features

  • 🔍 Full-Text Search — FTS5 with BM25 ranking
  • 🧠 Optional Semantic Search — Local MiniLM embeddings fused with lexical ranks
  • 🏷️ Tag-Based Filtering — Organize and find knowledge by tags
  • 📁 Scoped Knowledge — Global, project, or repo-specific rules
  • 🔄 Deduplication — Prevents duplicate content automatically
  • ⚡ Fast — SQLite with WAL mode, <50ms search latency

Installation

npm install @ai-devkit/memory

Quick Start

Add to your MCP client configuration (e.g., Claude Code, Cursor):

{
  "mcpServers": {
    "memory": {
      "command": "npx",
      "args": ["@ai-devkit/memory"]
    }
  }
}

Example developer use case: after deciding that all API responses must use DTOs, store that rule once. Future agent sessions can search memory before implementing new endpoints instead of asking you to repeat the convention.

Store Knowledge

{
  "tool": "memory_storeKnowledge",
  "arguments": {
    "title": "Always use Response DTOs for API endpoints",
    "content": "When building REST APIs, always use Response DTOs instead of returning domain entities directly.",
    "tags": ["api", "backend", "dto"],
    "scope": "global"
  }
}

Search Knowledge

{
  "tool": "memory_searchKnowledge",
  "arguments": {
    "query": "building an API endpoint",
    "contextTags": ["api"],
    "limit": 5
  }
}

Semantic search is disabled by default. Enable it in the project's .ai-devkit.json:

{
  "memory": {
    "semantic": true
  }
}

The first semantic operation downloads a pinned 23 MB quantized MiniLM model to ~/.ai-devkit/models. Queries and memory content are embedded locally and are not sent to an inference service. Once cached, the model works offline. If it is unavailable, search returns lexical FTS results instead.

You can prepare and inspect the cache explicitly, then backfill existing memories:

ai-devkit memory semantic status
ai-devkit memory semantic download
ai-devkit memory reembed

Use ai-devkit memory reembed --force after troubleshooting a cache or embedding issue. Add --explain to memory search to include lexical rank, semantic rank, cosine similarity, and reciprocal-rank-fusion score.

Documentation

📖 For the full API reference, ranking details, and advanced usage, visit:

ai-devkit.com/docs

License

Apache License 2.0

版本与发布记录

@ai-devkit/memory 共发布 24 个版本,首次发布于 2026/01/22;过去 12 个月发布了 24 个版本。

版本发布日期距今
0.20.4latest2026/10/2316 天前
0.20.32026/10/081 个月前
0.20.22026/09/301 个月前
0.20.12026/09/151 个月前
0.20.02026/09/032 个月前
0.19.02026/09/022 个月前

关于 @ai-devkit/memory 的常见问题

@ai-devkit/memory 是什么?

Local MCP memory for AI coding agents to reuse project decisions, conventions, and fixes across sessions

如何安装 @ai-devkit/memory?

在项目目录运行 npm install @ai-devkit/memory,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 ai-devkit-memory,可以用 npx ai-devkit-memory 直接运行。

@ai-devkit/memory 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ai-devkit/memory 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@ai-devkit/memory 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.20.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ai-devkit/memory 可以商用吗?

@ai-devkit/memory 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@ai-devkit/memory 的下载量有多少?

根据 npm 官方下载统计,@ai-devkit/memory 在 2026/10/05 – 2026/11/03 这 30 天内被下载 1,787 次,日均约 60 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ai-devkit/memory 还在维护吗?

最新版本 0.20.4 发布于 2026/10/23(16 天前);至今共发布 24 个版本,其中过去 12 个月发布了 24 个;首次发布于 2026/01/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。