Memini

io.github.lumayapartners由 GitHub 账号 lumayapartners 发布v0.4.0更新于 Oct 24, 2026

Local-first project memory and mistake-prevention guardrails for AI coding agents.

已验证STDIO仅桌面知识与记忆开发者工具

概览

AI 生成的概览

Memini 是一个本地优先的项目记忆与防护栏服务器,记录失败尝试、脆弱文件和决策,让 AI 编程助手在重蹈覆辙前收到警告。

可以做什么
以分类记忆记录项目经验:失败尝试、脆弱文件、决策、架构、部署、客户偏好和会话总结,并关联来源文件与 git 状态。召回项目上下文并执行编辑前检查,让助手在改动文件前看到已记录的风险。会话开始时注入按严重程度排序的记忆摘要,会话结束时提示助手记录可长期保留的经验。搜索、列出、查看、归档和批准记忆,并统计哪些防护栏真正触发过。标记所引用文件已变更的过期记忆,并提示重复、矛盾或长期未触发的防护栏供人工复核。
适用场景
当 AI 编程助手在同一仓库反复做出相同的错误改动,而你希望这些经验被强制执行而非依赖助手自觉时,值得安装。适合希望拥有可评审、存放于仓库内的脆弱文件与部署规则记忆的团队。
运行要求
通过 npx 作为本地 stdio 进程运行(需要 Node.js)。初始化会在仓库中创建 .memini 目录,内含本地 SQLite 索引和 markdown 视图,并可选安装 git 与编辑器钩子。未声明任何账号、API 密钥或环境变量。
安装前请注意
钩子会拦截编辑工具,对 block 级别的文件可拒绝编辑,直到人工归档该记忆;git 预提交防护栏失败时放行,且可用 --no-verify 绕过。助手只能在项目范围内提议记忆,更大范围的规则需人工验证后才生效。密钥在存储前会自动脱敏,但记忆正文会写入仓库并可能被提交。目前为早期 v0.1 版本。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Memini,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

memini

[npm version] [CI] [memini MCP server]

Never the same mistake twice. Mistake-prevention guardrails and persistent project memory for AI coding agents.

AI coding agents are stateless: every session starts with amnesia. The agent that broke your build editing vercel.json on Monday will happily try the exact same edit on Thursday. memini gives each repo a persistent memory of failed attempts, fragile files, decisions, and deployment rules — and force-feeds the relevant warning to the agent at the moment it's about to repeat history.

Not a notebook the agent may choose to read. A guardrail it can't skip.

[memini demo — an agent is stopped before repeating a recorded deploy mistake]

How it works

  1. Memories live in your repo — a .memini/ folder with a local SQLite index and human-readable, PR-reviewable markdown views. Local-first: nothing leaves your machine.
  2. Hooks enforce guardrails — when the agent tries to edit a file with recorded risks, the edit is intercepted before it happens and the recorded lesson is injected:

    [WARNING] Editing vercel.json broke the build (recorded 2026-07-03) — Tried changing buildCommand; deploy failed. Actual fix: move checkout server-side and set VITE_STRIPE_USE_SERVER=true.

    • warn severity: the agent is warned once per session, then may proceed.
    • block severity: the edit is always denied until a human archives the memory.
  3. Session start injects a digest of the most important memories (severity-first, token-budgeted).
  4. MCP tools let the agent record what it learns: remember_failed_attempt, remember_fragile_file, remember_decision, end_session_summary, plus recall_project_context and check_before_editing.
  5. Git-aware staleness — memories hash the files they reference; pm stale flags memories whose evidence has changed, and stale memories stop firing guardrails until re-verified.

Quickstart (90 seconds)

bash
cd your-reponpx -y memini init       # creates .memini/ + installs Claude Code hooks
# record your first guardrailnpx -y memini remember failed_attempt \  "Editing vercel.json broke the build" \  -b "Tried changing buildCommand; deploy failed. Fix: move checkout server-side." \  --file vercel.json --severity warn

That's it. Next time any Claude Code session in this repo tries to edit vercel.json, it gets the warning first.

Cursor, Windsurf, and other MCP clients:

bash
claude mcp add memini -- npx -y memini mcp   # Claude Code MCPnpx -y memini install-mcp --write cursor     # Cursor: MCP + rule + enforced preToolUse hooknpx -y memini install-copilot                # GitHub Copilot: enforced preToolUse hook (.github/hooks)npx -y memini install-mcp                    # print generic MCP config

Enforcement is a chain of gates, and memini covers several:

  • Before the edit — the edit to a guardrailed file is blocked before it happens. block → denied, warn → the user is prompted with the recorded history. Supported on:
    • Claude Code — pm init installs it
    • Cursor (1.7+) — pm install-mcp --write cursor
    • GitHub Copilot — CLI, cloud coding agent, and VS Code agent mode (preview) — pm install-copilot
  • Before the commit — every tool — a git pre-commit guardrail blocks a commit that touches a block-severity file, no matter which IDE or agent made the edit (Windsurf, Cline, a human…). Installed by pm init (or pm install-hooks --git). Fails open; overridable with git commit --no-verify.
  • Advisory — any MCP client — the check_before_editing / recall_project_context tools, plus an always-applied Cursor rule steering the agent to use them.

Keeping memory useful over time

A memory tool is only as good as what's in it, and it rots if left alone. memini keeps it healthy:

  • Auto-capture — a Claude Code session-end hook nudges the agent to record durable lessons (a fix that worked, a fragile file, a failed approach) when a session actually changed files, so you don't have to remember to pm remember. It stays silent on idle sessions.
  • Usefulness tracking — every time a guardrail actually fires, memini counts it. pm stats shows which memories are pulling their weight and which have never fired.
  • pm review — flags near-duplicates, contradictory guardrails on the same file, and dormant guardrails that have never fired long after creation. All local heuristics, no LLM — you decide what to keep, merge, or archive.
  • Git-aware staleness — memories hash the files they reference; when the code changes, the memory is flagged and stops firing until re-verified (pm stale / pm verify).

CLI

CommandWhat it does
pm initSet up .memini/, gitignore, and hooks
pm remember <type> <title> [-b body] [--file f...] [--severity warn|block]Record a memory
pm recall [query] [--file f] [--digest]Search memories / preview the agent digest
pm check <path>Guardrail check (exit 1 if risks recorded) — usable in CI
pm list / show / archive / approve <id>Manage memories
pm statsWhat your memory is doing — guardrail fires, coverage, staleness
pm reviewSurface quality issues: duplicates, contradictions, dormant guardrails
pm stale / pm verify <id>Detect and re-verify outdated memories
pm mcpRun the MCP server (stdio)
pm doctorDiagnose setup

Memory types: decision, failed_attempt, fragile_file, architecture, deployment, client_preference, session_summary.

Scopes: sharing rules across repos

Some lessons are project-specific; some apply to every repo on your machine that belongs to the same org or client. memini has three scopes:

ScopeWhere it livesUse it for
project (default)<repo>/.memini/this repo's failed fixes, fragile files, decisions
workspace.memini/ in a parent folder of your reposorg/client conventions shared by every repo under that folder
user~/.memini/personal rules that follow you everywhere
bash
cd ~/work/acme && pm init --workspace     # one-time: workspace store covering ~/work/acme/*
# from inside any repo under ~/work/acme:pm remember deployment "DB connections must use org OAuth, never PATs" \  --file "databricks.yml" --severity warn --scope workspace
pm promote <id> --workspace               # lift a project lesson that turned out to be org-wide

Every repo under the workspace folder — including ones you create later — gets those guardrails automatically. Resolution walks up the directory tree, like .gitconfig or ESLint configs. Workspace/user file guardrails match by glob (vercel.json matches any repo's vercel.json; config/**/*.yml works too), and wider-scope memories only fire when human-verified — agents can propose memories to project scope only, so a prompt-injected agent can't plant rules that spread across repos. pm doctor shows which scopes are active.

Design principles

  • Enforced, not advisory. MCP memory tools are optional for the agent; hooks are not. The guardrail path works even if the agent never thinks to check its memory.
  • Human-readable, PR-able. Every memory renders to markdown under .memini/ that your team reviews like any other change.
  • Git-linked evidence. Memories record the branch, commit, and file hashes they were born from, so claims are verifiable and staleness is detectable.
  • Local-first. SQLite + markdown in your repo. No accounts, no cloud, no telemetry. Secrets are auto-redacted from memory bodies before they're stored.
  • Cross-tool. Core is a CLI + files; Claude Code hooks and MCP are thin adapters.

Security

Local-first by design: no server, no account, no telemetry. Secrets are auto-redacted before storage, file references are contained to the repo, and injected memory text is size-capped and framed as data. See SECURITY.md for the full threat model — including the honest limitations (guardrails intercept edit tools, not arbitrary shell; warn is advisory, block is not).

Status

Early (v0.1). Team sync — shared memory across your whole team, with a review workflow — is on the roadmap. Feedback and issues welcome.

License

MIT

来源:README.md,提交 db88c1e

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.4.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分