global-memory
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@global-memory Remember to always write commit messages in English."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
global-memory — cross-client global memory for AI instruction presets
English | 简体中文
Tell an AI a reusable requirement once ("always use a formal tone in emails", "write commit messages in English"), confirm it, and it is stored for the long term. From then on, every connected AI tool (Claude Code / Claude Desktop / Codex CLI / Gemini CLI) recalls it automatically by scope — and a trust curve decides whether to ask you again before applying it.
Unlike "fact memory" products such as OpenMemory, this stores behavioral constraints you place on the AI. The core promise is control: nothing is saved without your confirmation, presets can be confirmed before they apply, every action leaves a visible trace, and everything can be uninstalled in one command. The full design is in DESIGN.md (Chinese).
What it is: an MCP server (stdio) + a management CLI + a local web admin
Runtime: Node ESM, no build step; all dependencies are pinned inside the project directory (
./pixi+node_modules) — nothing is installed system-wideMemory data:
~/.global-memory/memories.json(outside the repo, shared by all clients)Platform: currently verified on macOS (Apple Silicon) only —
pixi.tomltargetsosx-arm64and consent dialogs useosascript; other platforms fall back to in-conversation confirmationLanguage: CLI output, dialogs, the web admin, and the generated SKILL.md are currently in Chinese
Quick start
git clone https://github.com/chy4pro/global-memory-mcp.git
cd global-memory-mcp
./pixi install && ./pixi run setup # project-local Node + npm deps (pixi bootstraps itself into ./.pixi-home on first run)
./bin/global-memory setup --dry-run # preview which files would be written
./bin/global-memory setup # connect every detected AI tool on this machine
./bin/global-memory status # show integration statussetup only touches clients it detects, and does four things (all backed up, marked, idempotent, and reversible):
MCP registration: writes each tool's config (Claude Code
~/.claude.json, Claude Desktopclaude_desktop_config.json, Codex~/.codex/config.toml, Gemini~/.gemini/settings.json), all pointing atbin/global-memory(a self-contained launcher that uses the project-local Node). An existing same-named entry written by someone else is skipped, never overwrittenSkill links: the canonical workflow SKILL.md lives only in
~/.global-memory/skills/global-memory/; each tool's skills directory gets a symlink — edit once, every tool picks it up (falls back to a version-marked copy if symlinks fail)L1 hook (Claude Code): a SessionStart hook in
~/.claude/settings.jsondeterministically injects applicable presetsL2 standing instructions (Codex/Gemini): a marked section appended to
AGENTS.md/GEMINI.md
Original files are backed up with timestamps to ~/.global-memory/backups/ before any change. Afterwards, whenever a client launches the server it self-heals: it restores a missing canonical skill / skill link, hook, or instruction section — but never touches MCP registration.
The configs store the launcher's absolute path. If you move the repository, run
uninstalland thensetupagain.
Related MCP server: agent-magnet
How it works
Recall: at the start of a task the AI calls
recall_presets(with the project name and task type). Presets not yet due for review apply directly; due ones go through the consent broker:Local macOS session: due presets are merged into one checklist dialog (all pre-selected, at most 8 per dialog; unchecking = rejecting that preset; "hand over to chat" = handle them one by one in the conversation; after 60 s of no input each preset is resolved by its
unattended_policy). If only one preset is due, a single confirm dialog with a 45 s countdown is used insteadNon-macOS, SSH sessions, or
GLOBAL_MEMORY_CONSENT=conversation: falls back to one-by-one confirmation in the conversation; the AI reports results viarecord_usageThe outcome is announced in a one-line
user_notice(composed by the server, relayed verbatim by the model); nothing is shown when there is nothing to report
Unattended:
mode=unattended(scheduled jobs, etc.) never shows dialogs and resolves byunattended_policy—apply/skip/by_trust(apply ifharmlessor trust ≥ L2, otherwise skip);always_askpresets are never auto-applied. Unattended decisions go into a pending re-confirmation backlogRisk tiers: each preset has a
risktier —harmless(preferences with no bad outcome, e.g. language/format: confirmed once when saved, never prompts again) /normal(default, follows the trust curve) /sensitive(destructive operations, security, credentials: never batched, always a single dedicated confirmation). The AI proposes the tier at save time and you approve it together with the saveTrust curve: a fixed, explainable ladder — L0 asks every time → L1 review after 1 auto-apply → L2 after 3 → L3 after 7 days → L4 after 30 days → L5 after 90 days (cap). An explicit confirmation moves up one level; a rejection or override halves the level; silence is not consent — unattended applications never advance the curve.
confirm_policycan pin a preset toalways_ask/always_autoSaving: the AI spots a durable requirement → proposes a scope (global / project / task type + free-form category) → you confirm → it is stored (on the dialog channel the server shows its own confirmation dialog as a guarantee; rejection or timeout means it is not saved). Duplicates are detected automatically, and existing presets in the same scope are returned so the AI can check for contradictions
Correction: when you override an applied preset on the spot, the AI must point it out and diagnose with one question — one-off exception / scope too broad / outdated / badly worded — and handle each case accordingly
Management: say "show / tidy up my memories" to the AI — browse, search, edit, disable, delete, and deep consolidation (semantic de-duplication / disabling stale presets / clustering presets into a dedicated skill)
SessionStart injection (Claude Code): the hook runs
global-memory recall-context, uses the current directory name as the project name, and lists applicable presets plus the pending re-confirmation count — informational only, no dialogs, no usage counting
MCP tools
Tool | Purpose |
| Recall and resolve applicable presets (applied / skipped / pending_confirmation / backlog / suggestions) |
| Report confirmation results gathered in conversation (confirmed / rejected / overridden) |
| Save a durable requirement the user has confirmed |
| Browse, edit, delete |
| Statistics and health checks |
| Deep consolidation: produce proposals → apply atomically after user approval |
Configuration (environment variables)
Variable | Effect |
|
|
| Max presets per checklist dialog (default 8 — an attention budget) |
| Disable self-healing on server start |
| Data directory (default |
| Pin the AI provider: |
| Output directory for |
| Fake HOME from which all client paths are derived (for tests) |
Memory migration and built-in AI features
The tool can call the AI CLIs already installed on your machine (claude / codex / gemini — auto-detected, falls back to the next on failure, no API key needed):
./bin/global-memory extract-raw [--clean] # collect memories from every local AI tool → raw-memories/ (with provenance)
./bin/global-memory distill # have an AI distill raw memories into presets, then review repeatedly until clean
./bin/global-memory web [port] # web admin, default http://127.0.0.1:7777extract-raw details:
Memory sources: Claude Code user-level
CLAUDE.mdand per-projectmemory/, CodexAGENTS.md, GeminiGEMINI.md(this tool's own marked sections stripped), and this tool's existing preset storeFull transcripts are copied verbatim (no provenance header, so the formats stay valid; they are not fed into distill or search): Claude Code session jsonl, Codex
sessions/rollouts +history.jsonl, Geminitmp/<project>/chats/session-*+logs.jsonCodex / Gemini sources are allow-listed, so credential files such as
auth.jsonandoauth_creds.jsonare not copied; however~/.hermesand~/.openclaw/memory(if present) are collected as whole directories — every md/txt/json file under 1 MB — without credential filteringClaude Desktop chats live in the cloud; there is no local plaintext to extract
⚠️
raw-memories/is a plaintext copy of your local AI memories and full conversation transcripts. It is excluded in.gitignore— never commit or share it.
Presets produced by distill always start at L0 trust — you are still asked the first time each one is used; AI consolidation never bypasses consent.
Web admin (zero-dependency node:http, listens on 127.0.0.1 only): statistics and health checks, search/filter, enable/disable/delete, risk-tier tags, plus AI management — give an instruction in natural language ("merge and tighten the communication presets"); the AI only produces proposals, and nothing runs until you approve them one by one or all at once. The Raw memories section at the bottom browses every extract-raw file read-only (grouped by source), with instant plain-text search (line excerpts + highlighting, no AI) and AI semantic search (relevant files + reasons; hallucinated paths are filtered out).
⚠️ The web admin has no login and no Origin/CSRF checks: while it is running, a malicious web page open in your browser could in theory send modifying requests to
127.0.0.1:7777. Stop it with Ctrl+C when you are done.
Command line
Install & maintain
global-memory setup [--dry-run] connect local AI tools
global-memory status show per-tool integration status
global-memory uninstall [--dry-run] [--purge] revert all writes (--purge also deletes memory data)
Manage the store (day to day, just tell the AI "manage memories")
global-memory list [--all] list presets (--all includes disabled/archived)
global-memory show <id> full JSON of one preset
global-memory enable|disable <id> enable / disable
global-memory rm <id> delete
global-memory stats | export | path stats & health / export whole store as JSON / storage path
Migration & AI consolidation
global-memory extract-raw [--clean] | distill | web [port]
Internal
global-memory start the MCP server (stdio)
global-memory recall-context called by the Claude Code SessionStart hookpixi tasks work too: ./pixi run serve, ./pixi run cli <subcommand>.
Client support
Client | MCP | Local skill | Recall guarantee |
Claude Code (CLI / Desktop Code / IDE) | ✓ | ✓ symlink | SessionStart hook (deterministic) |
Codex CLI | ✓ | ✓ symlink |
|
Gemini CLI | ✓ | ✓ symlink |
|
Claude Desktop (Chat mode) | ✓ | ✗ (platform limitation) | MCP server instructions as fallback |
Data & privacy
All personal data lives outside the repo (except raw-memories/, which is git-ignored):
Location | Contents |
| The preset store (JSON + file lock + atomic writes) |
| Canonical SKILL.md |
| Timestamped backups taken by setup / uninstall before editing configs |
Each client's config | MCP registration, skill symlink, hook, marked sections in |
|
|
Uninstall: ./bin/global-memory uninstall (removes only content marked as written by this tool; data is kept); --purge also deletes ~/.global-memory.
Development & testing
./pixi run test # 45 tests: trust / store / consent / setup (fake HOME) / ai-pipeline (stub) / server (real stdio end-to-end) / web APIAll tests use temporary directories (GLOBAL_MEMORY_DIR / GLOBAL_MEMORY_HOME / GLOBAL_MEMORY_RAW_DIR), and dialogs and AI calls are stubbed, so your real environment is never touched.
Design document (Chinese): DESIGN.md
Source map
File | Responsibility |
Entry point; no args = start the MCP server, subcommands = install / manage / migrate / web | |
MCP server + the 9 tool definitions; triggers self-heal on start | |
Storage: JSON + file lock + v1→v2 migration + scope matching + health heuristics + atomic consolidation | |
Trust curve: ladder scheduling, confirm-to-promote / reject-to-halve, unattended resolution, system suggestions | |
Consent broker: osascript single/checklist dialogs / conversation fallback / direct resolution | |
| |
Client adapter matrix (detection / config / skills / hook paths) | |
setup / status / uninstall / self-heal; backup-and-merge, no clobbering, idempotent | |
Canonical SKILL.md content (four-duty skeleton + red lines) + version marker | |
Enumerates local memory sources and extracts them into | |
AI provider layer: detect/invoke local claude/codex/gemini CLIs, fallback, JSON parsing | |
Consolidation engine: raw → AI distillation into the store → iterative review | |
Zero-dependency web admin ( | |
Self-contained launcher: runs the CLI with the project-local pixi Node | |
Unit tests + fake-HOME install flow + AI pipeline stubs + real stdio end-to-end + web API |
Roadmap (Phase 2+, not implemented yet)
npm release (configs switch to npx -y) | Linux/Windows dialogs | MCP sampling enhancements | guided graduation of presets into skills | BYOK scheduled consolidation | cloud sync / team sharing. See DESIGN.md §12.
License
Available Tools
9 toolsapply_consolidation落地整理提案A
原子地执行用户已确认的整理操作清单。仅限用户主导的管理场景。op: update(带 fields)/ delete / disable / archive(可带 note 注明去向)/ create(带 fields)。Atomically apply user-approved consolidation operations.
Inputs: operations (required).
delete_memory删除记忆A
永久删除一条预设。必须先向用户复述内容并获明确确认;临时不用应改为 status=disabled。Permanently delete (confirm with user first; prefer disabling).
Inputs: id (required).
list_memories查看/搜索记忆B
列出或搜索已保存的预设。所有过滤条件可选。List/search saved presets.
Inputs: query, status, project, category, +1 more.
memory_overview记忆库总览A
统计 + 体检指标(疑似重复/陈旧候选/毕业候选簇/待补确认/上次整理时间)。用户说"看看我的记忆"时先调这个。Overview with health checks.
Inputs: no named parameters.
recall_presets召回适用预设A
开始任务时调用,召回适用于当前上下文的预设并完成确认(服务器可能向用户弹系统确认框,等待返回即可)。返回终态:applied=已应用(照单执行)、skipped=不要应用、pending_confirmation=请在对话中逐条向用户确认(结果用 record_usage 回报)、backlog=待补确认(方便时向用户提及)、suggestions=单条转达的系统建议。返回的 user_notice 必须原样转述给用户。Recall and resolve applicable presets; relay user_notice verbatim.
Inputs: mode, project, task_type.
record_usage回报确认结果A
回报对话中完成的预设确认结果(pending_confirmation 的逐条答复、backlog 补确认、纠正流程的推翻)。confirmed=用户确认沿用;rejected=用户拒绝;overridden=应用后被用户当场推翻。Report per-preset consent outcomes resolved in conversation.
Inputs: outcomes (required).
save_requirement保存用户要求为预设A
把用户确认过的可复用要求保存为预设。调用前必须已向用户展示提炼表述+建议分类并获明确同意(弹框通道下服务器会再次弹框担保,超时不保存)。单次指令不入库。返回 potential_conflicts=同作用域/分类的既有预设——检查语义矛盾,矛盾则提议更新旧预设而非新增。user_notice 原样转述。Save a user-confirmed durable requirement.
Inputs: content (required), risk, project, category, +3 more.
start_consolidation开始记忆整理A
仅在用户主动要求整理记忆时调用。返回全库与体检指标。你的任务:产出整理提案清单(合并语义重复、解决矛盾、提炼表述、陈旧停用、聚类毕业成 skill),以清单呈现、由用户驱动决定,再用 apply_consolidation 落地。Start a user-initiated consolidation pass.
Inputs: no named parameters.
update_memory修改记忆A
修改预设:内容、作用域、分类、策略、启用/停用/归档。需用户已确认该修改。未传字段不变;project/task_type/category 传 "" 清除。内容实质改写会重置信任(新表述=未验证的新承诺)。user_notice 原样转述。Update a preset (user-approved).
Inputs: id (required), risk, status, content, +5 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Most tools have clearly distinct roles: recall/record_usage, list/overview, and start_consolidation/apply_consolidation are well separated. The only potential confusion is between update_memory and apply_consolidation (both can modify presets) and between delete_memory and apply_consolidation's delete, but the usage context (direct user action vs. consolidation workflow) disambiguates them.
Eight of nine tools follow a consistent verb_noun pattern (record_usage, list_memories, update_memory, start_consolidation, apply_consolidation, recall_presets, save_requirement, delete_memory). memory_overview breaks the pattern by being noun_noun, but it is still readable and clearly the odd one out.
Nine tools is a well-scoped size for a memory/preset management server. Each tool covers a distinct operation or workflow stage—CRUD, recall, usage reporting, and consolidation—without redundancy or bloat.
The tool surface covers the full lifecycle: save_requirement creates presets, list_memories/memory_overview/recall_presets read them, update_memory plus apply_consolidation handle updates/disable/archive, and delete_memory covers deletion. The two-phase consolidation workflow and record_usage for outcome tracking round out the domain with no obvious gaps.
Maintenance
Related MCP Connectors
Shared memory for AI tools: save once, recall word for word from Claude, ChatGPT, Codex or Gemini.
Persistent memory for Claude Code and Cursor. Stop re-explaining your project every session.
Gives your AI assistant persistent memory and intelligence about your work patterns.
A profile you control: gives your AI your role, projects and preferences, across ChatGPT and Claude.
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to maintain persistent conversations and context between sessions through automated saving and global installation across projects. Provides zero-configuration memory persistence with automatic conversation history preservation.-
- AlicenseNot gradedqualityBmaintenanceSelf-learning memory for AI tools. Remembers user preferences and context across Claude, Cursor, and Codex with multi-parameter forgetting and cross-tool identity.15MIT
- AlicenseNot gradedqualityAmaintenanceGives Claude Code persistent cross-session memory with semantic search over saved facts, decisions, and journals, alongside automatic detection and classification of user corrections as trackable behavioral patterns. It also extracts behavioral signals from sessions and evolves self-authored frameworks over time, so the assistant develops judgment that carries forward between conversations — all local, with no cloud or API key required.6 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables Claude Code, Cursor, and Codex sessions to persist decisions, rules, bugs, to-dos, and failed approaches in a repository file and automatically recall relevant saved context in later sessions. It also checks planned commands or edits against those saved rules before they run.169 npmMIT