|
| 1 | +# MemPalace Cursor Plugin |
| 2 | + |
| 3 | +A Cursor IDE plugin that gives your agent a persistent memory system. Auto-registers the `mempalace-mcp` server (19 MCP tools), ships 5 slash commands, two model-invocable skills (setup/mining/search and a recall protocol), and an optional recall rule. |
| 4 | + |
| 5 | +> Hooks (auto-save + session-start memory recall) are shipped separately under `hooks/cursor/` so the plugin is safe to install in any Cursor workspace without touching the agent loop. See [Hooks](#hooks-optional) below. |
| 6 | +
|
| 7 | +## Prerequisites |
| 8 | + |
| 9 | +- Python 3.9+ |
| 10 | +- Cursor 1.7+ (plugin manifest schema requires it) |
| 11 | + |
| 12 | +## Installation |
| 13 | + |
| 14 | +### Local clone (recommended while not in the marketplace yet) |
| 15 | + |
| 16 | +Symlink (or copy) this repository into Cursor's local plugins folder: |
| 17 | + |
| 18 | +```bash |
| 19 | +ln -s /path/to/mempalace ~/.cursor/plugins/local/mempalace |
| 20 | +``` |
| 21 | + |
| 22 | +Then in Cursor: <kbd>Cmd</kbd>-<kbd>Shift</kbd>-<kbd>P</kbd> → **Developer: Reload Window**. |
| 23 | + |
| 24 | +### Marketplace |
| 25 | + |
| 26 | +Once published, install via the Cursor marketplace panel and select `mempalace`. Required-plugin distribution from a team marketplace is also supported. |
| 27 | + |
| 28 | +## Post-Install Setup |
| 29 | + |
| 30 | +After installing the plugin, run the `init` command in a Cursor chat: |
| 31 | + |
| 32 | +``` |
| 33 | +/mempalace-init |
| 34 | +``` |
| 35 | + |
| 36 | +(Or just say "use the mempalace skill" — Cursor will model-invoke the bundled skill.) |
| 37 | + |
| 38 | +This installs the `mempalace` package via `uv tool` or `pip`, initializes a palace under `~/.mempalace/`, and verifies the MCP server is reachable. |
| 39 | + |
| 40 | +## Available Slash Commands |
| 41 | + |
| 42 | +| Command | Description | |
| 43 | +|---------------------|-----------------------------------------------------------------------------------| |
| 44 | +| `/mempalace-help` | Show available tools, skills, CLI commands, hooks, and architecture | |
| 45 | +| `/mempalace-init` | Set up MemPalace — install, configure, onboard | |
| 46 | +| `/mempalace-search` | Search your memories across the palace using semantic search | |
| 47 | +| `/mempalace-mine` | Mine projects and conversations into the palace | |
| 48 | +| `/mempalace-status` | Show palace overview — wings, rooms, drawer counts | |
| 49 | + |
| 50 | +> Cursor commands are global, not plugin-namespaced — that's why each slug is prefixed with `mempalace-` rather than appearing as `/help`, `/init`, etc. This keeps them collision-free with built-in or other-plugin commands. |
| 51 | +
|
| 52 | +## Skills |
| 53 | + |
| 54 | +Two model-invocable skills ship at the plugin root under `skills/`: |
| 55 | + |
| 56 | +| Skill | What it does | |
| 57 | +|-------|--------------| |
| 58 | +| `mempalace` | Setup, mining, status, and the dynamic `mempalace instructions` CLI. | |
| 59 | +| `mempalace-recall` | Search-before-answer protocol — makes the agent read the palace before answering about past work, people, projects, or prior decisions instead of guessing. | |
| 60 | + |
| 61 | +Cursor surfaces these automatically when a request matches their description, or you can attach them explicitly. |
| 62 | + |
| 63 | +## Recall rule (optional) |
| 64 | + |
| 65 | +The plugin also ships a Cursor rule at the plugin root under `rules/mempalace-recall.mdc`: |
| 66 | + |
| 67 | +```yaml |
| 68 | +description: When the user asks about past work, prior decisions, people, ... call mempalace_search before answering ... |
| 69 | +alwaysApply: false |
| 70 | +``` |
| 71 | +
|
| 72 | +It is `alwaysApply: false` on purpose — Cursor loads it only when its matcher judges the turn recall-relevant, so it never fires on unrelated coding work and never adds MCP latency to greenfield tasks. The rule, the `mempalace-recall` skill, and the `sessionStart` hook all reference the same canonical protocol in [`integrations/shared/recall-protocol.md`](../integrations/shared/recall-protocol.md). |
| 73 | + |
| 74 | +Want recall forced into **every** conversation regardless of context? Copy the aggressive `alwaysApply: true` variant from [`examples/cursor/rules/`](../examples/cursor/rules/README.md) into `~/.cursor/rules/`. That is a deliberate, heavier opt-in, not a default. |
| 75 | + |
| 76 | +## MCP Server |
| 77 | + |
| 78 | +This plugin ships `mcp.json` at the plugin root, so Cursor auto-loads the `mempalace-mcp` server on plugin install: |
| 79 | + |
| 80 | +```json |
| 81 | +{ |
| 82 | + "mempalace": { |
| 83 | + "command": "mempalace-mcp" |
| 84 | + } |
| 85 | +} |
| 86 | +``` |
| 87 | + |
| 88 | +All 19 MemPalace MCP tools (`mempalace_search`, `mempalace_add_drawer`, `mempalace_diary_write`, `mempalace_check_duplicate`, `mempalace_diary_read`, …) become available to the agent immediately. No manual `~/.cursor/mcp.json` edit required. |
| 89 | + |
| 90 | +If the server doesn't appear, confirm `mempalace-mcp` is on the user `$PATH`: |
| 91 | + |
| 92 | +```bash |
| 93 | +command -v mempalace-mcp |
| 94 | +``` |
| 95 | + |
| 96 | +If it isn't, run `/init` (or `mempalace install` from a terminal) — `mempalace-mcp` is installed alongside the `mempalace` package. |
| 97 | + |
| 98 | +## Hooks (optional) |
| 99 | + |
| 100 | +Cursor's hooks system is configured separately from plugins (in `~/.cursor/hooks.json` or `.cursor/hooks.json`), so this plugin does **not** wire hooks itself. The MemPalace repository ships three Cursor-native hooks under [`hooks/cursor/`](../hooks/cursor/) that you install with one command. |
| 101 | + |
| 102 | +User scope — writes `~/.cursor/hooks.json`, applies to every Cursor workspace (recommended): |
| 103 | + |
| 104 | +```bash |
| 105 | +hooks/cursor/install.sh --scope user --variant full |
| 106 | +``` |
| 107 | + |
| 108 | +Project scope — writes `.cursor/hooks.json` under the current project only: |
| 109 | + |
| 110 | +```bash |
| 111 | +hooks/cursor/install.sh --scope project --variant full |
| 112 | +``` |
| 113 | + |
| 114 | +What you get: |
| 115 | + |
| 116 | +| Hook event | What it does | |
| 117 | +|----------------|-------------------------------------------------------------------------------------------------------| |
| 118 | +| `sessionStart` | Injects an `additional_context` recap of relevant memories scoped to the workspace wing | |
| 119 | +| `stop` | Counts agent turns; every N turns, emits a `followup_message` instructing a memory checkpoint | |
| 120 | +| `preCompact` | Synchronously mines the transcript before compaction, drops a marker so the next `stop` saves a diary | |
| 121 | + |
| 122 | +Full details: [`website/guide/cursor-hooks.md`](../website/guide/cursor-hooks.md) and [`hooks/cursor/README.md`](../hooks/cursor/README.md). |
| 123 | + |
| 124 | +## Uninstall |
| 125 | + |
| 126 | +Remove the local plugin symlink: |
| 127 | + |
| 128 | +```bash |
| 129 | +rm ~/.cursor/plugins/local/mempalace |
| 130 | +``` |
| 131 | + |
| 132 | +Then in Cursor: <kbd>Cmd</kbd>-<kbd>Shift</kbd>-<kbd>P</kbd> → **Developer: Reload Window**. |
| 133 | + |
| 134 | +If you also installed the hooks, remove them (leaves any unrelated hooks in `hooks.json` untouched): |
| 135 | + |
| 136 | +```bash |
| 137 | +hooks/cursor/install.sh --scope user --uninstall |
| 138 | +``` |
| 139 | + |
| 140 | +## Full Documentation |
| 141 | + |
| 142 | +See the main [README](../README.md) for complete documentation, architecture details, and advanced usage. |
0 commit comments