remember
Remember preference
Save or update a user preference (category+key upsert). Re-saving the same key increases confidence by 0.1 (cap 1.0). Returns the row id for forget().
key必填value必填category必填
io.github.worakorn-prince由 GitHub 帳號 worakorn-prince 發布v2.4.3更新於 Nov 8, 2026
Local long-term memory MCP server (SQLite) for AI coding agents — OpenCode, Claude Code, Cursor
發布方自己的服務:Memory.fit
以本機 SQLite 為後端的長期記憶伺服器,讓程式開發代理能跨工作階段記住偏好、經驗教訓與過往互動。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
參照 儲存庫 中的啟動說明。
[npm version] [npm downloads] [License: MIT] [Node] [CI] [Version Sync]
[Listed on mcpservers.org] [th-memory-mcp MCP server – quality and maintenance score on Glama] [Th Memory MCP on mcprush] [Tested by AddonAudit]
better-sqlite3 native build, import.meta.url). Node.js 20 is EOL and unsupported. CI tests the minimum patched version of each supported line (22/24/26).npm install, npm run build, npm test. No external services, accounts, or API keys — everything lives in a single local SQLite file.node:sqlite on OpenCode Desktop/Node 22.5+ and falls back to bun:sqlite on the Bun-based CLI.MEMORY_DB_PATH with setx, macOS/Linux: export in your shell profile.Security: Use a patched Node.js release — check your runtime with
npx is-my-node-vulnerable.npm auditcovers npm dependencies only, not Node.js core CVEs.
Audit: Independently smoke-tested by AddonAudit on v2.4.1 — an automated test, not a security guarantee; the one high advisory it found was fixed in 2.4.2, and fresh installs from 2.4.3 onward report 0 critical/high advisories.
Fastest path: npm run quickstart (after cloning) builds, wires opencode.json/opencode.jsonc, deploys the plugin, and sets MEMORY_DB_PATH — the steps below are the manual equivalent. npm alternative: npm install -g th-memory-mcp (or npx th-memory-mcp) and point mcp.command to th-memory-mcp instead of dist/index.js (plugin still from this repo; not on GitHub Packages anymore).
~/.config/opencode/opencode.json (replace <REPO> with the absolute clone path; ready-made block in opencode.example.json). MEMORY_DB_PATH must be the SAME file for server and plugin — a system/user-level env var covers both; environment below covers the server only. Example rules: AGENTS.memory.example.md (attachable at project level).src/plugin/learning-capture.ts → ~/.config/opencode/plugins/learning-capture/index.tsThe plugin works in both modes: OpenCode V2 calls the default export's id + setup(ctx) (domain hooks for prompt/tool/compaction/failure events), while V1 (1.18.29+) calls the same default export's server(), which returns the legacy hook object. One file, no runtime import of @opencode/plugin (types only), so it loads under both Node and Bun.
If startup reports Failed to load plugin ... Received protocol 'bun:' or the plugin is silently ignored on V2, you are on an older install layout. Re-deploy the current src/plugin/learning-capture.ts to ~/.config/opencode/plugins/learning-capture/index.ts; a legacy ~/.config/opencode/plugins/learning-capture.ts is renamed to .bak-<timestamp> by npm run quickstart (never deleted). It loads node:sqlite first and only falls back to bun:sqlite under Bun.
OpenCode loads the plugin learning-capture (dual-mode V1/V2, Node/Bun) — auto-captures prompt/tool/error into the DB, injects the profile on compaction — and the MCP server th-memory-mcp (Node stdio) exposing the 16 tools on that same SQLite DB; global rules (memory-protocol.md) teach the AI to use them.
api_key=, password:, token) filtered before storage.better-sqlite3 only (no extra native extensions).lesson records (situation → mistake → correction), not just flat facts.get_context blends FTS5 keyword search with dependency-free lexical fuzzy matching (hashed n-gram similarity, 512-dim FNV-1a) via RRF fusion, then assembles a token-budgeted context with optional memory-graph expansion.derived_from links).A standard MCP server: 16 tools anywhere MCP-over-stdio works; all harnesses share one SQLite file via MEMORY_DB_PATH. Auto-capture needs a hook runtime (built into OpenCode, bridged for Claude Code).
UserPromptSubmit/PreCompact, distill on SessionEnd. Qwen Code (QWEN_SETUP.md) — MCP fully; hooks need a small Gemini-CLI adapter. Codex (CODEX_SETUP.md) · Cursor (CURSOR_SETUP.md) — manual tools.th-memory)Usage: th-memory [--db <path>] [--json] [--plain] <command> [options] — per-command help via th-memory <command> --help. highlight/recall --highlight: matches underlined (ESC[4m) on a color TTY, else [mem]…[/mem] markers (piped, --plain, --json).
The AI accepts Thai and English interchangeably; long-term care: npm run distill summarizes stats and prunes interactions older than 30 days.
remember — save a preferenceget_recent_interactions, finds patterns, saves insights itselfmemory_statsexport_memorysearch_history · "Forget..." → forgetdata/memory.db is plain, unencrypted SQLite (WAL mode, better-sqlite3); "100% local & private" means no cloud/network exfiltration, not encrypted at rest — anyone with filesystem access can read it. For sensitive data: OS full-disk encryption (BitLocker / FileVault / LUKS) or an opt-in SQLCipher build (native rebuild + key management); no in-code encryption by default (src/db/index.ts documents this).userId / sessionId / projectId are caller-supplied with no authentication or authorization check inside the server; scope isolation (retrieval, get_context, graph, consolidate, link_memory, merge_memory) binds only to caller-sent values, so any scope is readable/writable by passing a different id. Suitable for a single-user local process; do not share one server/DB across untrusted users without an auth layer in front enforcing the correct userId (projectId / sessionId). No auth is built in by design.來源:README.md,提交 7047183
Remember preference
Save or update a user preference (category+key upsert). Re-saving the same key increases confidence by 0.1 (cap 1.0). Returns the row id for forget().
key必填value必填category必填Recall memory
Search preferences + lessons via full-text index, plus recent matching interactions. Use before starting a new task.
limittopic必填Get user profile
Get the distilled user profile: profile sections, top preferences by confidence (max 15), and the 5 most recent lessons. Optional userId/sessionId/projectId scope the auto-projected memories; without them only GLOBAL memories are included.
userIdprojectIdsessionIdSave lesson
Record a lesson learned from a correction: what situation, what mistake, what is the correct way. Call immediately after the user corrects your work.
mistake必填situation必填correction必填Search prompt history
Search past user prompts (kind='prompt') by keyword. Returns timestamped snippets truncated to 200 chars each.
limitquery必填sessionIdForget a memory entry
Delete one memory row (preference, lesson or interaction) by id and sync the search index. Pass type when you know it (ids from remember are preference ids, from save_lesson are lesson ids).
typetarget_id必填Memory statistics
Summarize memory usage: interaction counts by kind, preference/lesson totals, DB file size, oldest/newest interaction timestamps, and profile sections.
無需輸入參數。
Recent interactions
List recently captured raw interactions (newest first) as [id] ts [kind] content lines. Optionally filter by kind. Use for auditing history or before distilling memory.
kindlimitsessionIdExport memory to JSON
Export preferences, lessons, profile (and optionally raw interactions) to a JSON file under data/exports/. Only writes inside that directory. Returns the file path, size in bytes and a JSON preview.
filenameincludeInteractionsGet assembled context
Assemble relevant memories for the current task via hybrid retrieval (+ optional memory-graph expansion), with token budgeting. Use to load memory into context before a task.
limitqueryuserIdmaxTokensprojectIdsessionIdincludeGraphincludeHistoryConsolidate memories
Cluster similar memories via embedding similarity and optionally create derived/consolidated memories linked via 'derived_from'. Use during periodic consolidation.
deriveuserIdprojectIdsessionIdthresholdminClusterSizeLink two memories
Create a typed relationship between two memories in the graph (supports/contradicts/supersedes/derived_from/related_to/caused_by/depends_on).
relation必填sourceId必填targetId必填Merge memories
Merge a duplicate/near-duplicate memory into a canonical one. The source becomes superseded and provenance is recorded in metadata.merged_from.
sourceId必填targetId必填Update a memory
Update mutable fields (summary/importance/confidence/valid_from/valid_until/metadata) in place. If content changes, a superseding memory is created by default (set supersede=false to edit in place).
id必填contentsummarymetadatasupersedevalidFromconfidenceimportancevalidUntilImport memories
Import memories from a JSON array or a .json file inside data/exports/. Validates type, dedupes against existing memories, and never overwrites active memory blindly. Dry-run by default; pass apply=true to insert.
filejsonapplyuserIdtrustedExtract memories from interactions
Scan recent captured interactions for memory-intent phrases and propose memory candidates (deterministic, no LLM). Dry-run by default; pass apply=true to create them (source=captured).
kindapplylimituserIdsessionId已滿足適用檢查項的 90%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

fit.memory官方發布者
託管式 Memory.fit 伺服器,讓 AI 讀取你的訓練、睡眠、恢復與飲食資料,並寫回每週計畫、每日目標和飲食計畫。
io.ddx.pg官方發布者
pg.ddx.io: the PostgreSQL community's memory 的託管 MCP 服務,由 pg.ddx.io 發布;無需登入;Streamable HTTP;29 個工具。
gg.var官方發布者
遠端 MCP 伺服器,可依領域概念推薦並檢索韓、日、中、越、英多語言的程式識別字名稱,並提供 ERD 結構查詢。

ai.counterparts
為 Claude Code 與 Claude Desktop 提供的本地優先長期記憶:助理自行寫下關於你與專案的筆記,並在之後的對話中回想起來。

由 GitHub 帳號 pedramgholizadeh 發布
以波斯語為先的地理記憶平臺:發現地點,起草併發布僅限波斯語的記憶。AI 翻譯
# 1. Clone and buildgit clone https://github.com/worakorn-prince/th-memory-mcp.gitcd th-memory-mcp && npm install && npm run build# 2. Share one DB between the server and the pluginsetx MEMORY_DB_PATH "$PWD/data/memory.db" # Windows (PowerShell)# export MEMORY_DB_PATH="$PWD/data/memory.db" # macOS/Linux — add to your shell profile (~/.zshrc){ "instructions": ["<REPO>/AGENTS.memory.example.md"], "mcp": { "memory": { "type": "local", "command": ["node", "<REPO>/dist/index.js"], "enabled": true, "environment": { "MEMORY_DB_PATH": "<REPO>/data/memory.db" } } } }th-memory remember --category coding_pref --key package_manager --value pnpmth-memory recall pnpm --limit 5echo "I prefer pnpm for installs" | th-memory highlight -q pnpmdata/├── memory.db # SQLite (WAL mode) — main DB (+ .db-wal, .db-shm); path overridable via MEMORY_DB_PATH└── exports/ # JSON files from export_memory (writeable only in this dir)# everything in data/ is git-ignored