palace
Palace is a local-first memory server for coding agents: it stores verbatim project knowledge, recalls it semantically, and tracks facts and session history across agents.
Search memory: hybrid semantic/keyword search (
palace_search), preference-specific search (palace_preference_search), and duplicate checks before filing.Store and manage memories: add, fetch, list, update, delete/prune drawers, or file key facts with
palace_remember.Track durable facts: add, query, invalidate, and timeline knowledge-graph triples, detect stale/contradictory facts, and seed adoption facts.
Organize knowledge: list/create/rename wings, list rooms, view the taxonomy, traverse the room graph, and create/follow/delete tunnels between related rooms across wings.
Mine code repositories: check project status, mine or re-sync a repo directory, with dry-run and file limits.
Use agent diaries: write, read, and search diaries (including cross-agent), and get warm-start session context from prior work.
Manage embeddings: list/status models, estimate switching cost, migrate, verify, cut over, roll back, and re-embed drawers.
Backup and housekeeping: export/import JSON snapshots and prune old drawers.
Diagnostics: check palace status, MCP/database/embedding health, run recall probes, get memory reports, and measure usage value with
palace_gain(including recording feedback or resetting usage data).Inspect internals: view the AAAK compressed-memory spec and hook settings, and acknowledge save prompts.
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., "@palace why did we choose bundled sqlite?"
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.
Palace gives Claude Code, Codex, Cursor, Gemini CLI, VS Code, OpenCode, Cline, Zed, Goose, Windsurf, Antigravity, and Claude Desktop a memory that lasts between sessions. It stores what happened verbatim, recalls it automatically when it's relevant, and cites where each answer came from.
You: why did we switch the queue to SQLite last month?
Agent: [palace_search โ wing my_api, room decisions, filed 2026-09-03]
You dropped Redis because the deploy target had no persistent volume.
The benchmark you ran is in the same drawer.Using Palace? Tell me. One line in Show and tell about which agents you use it with and what it remembers for you helps more than a star. Prefer email? Write to contact@palacememory.com.
๐งญ Why Palace
Every new agent session starts with no memory. You explain the architecture again. The agent repeats a fix you rejected last week. It greps the whole repo to rediscover a convention you settled months ago.
Palace fixes that by:
Storing text verbatim. Code, notes, and conversations are stored as written, not as an LLM summary that loses detail.
Running locally. Embeddings come from
all-MiniLM-L6-v2(or another supported model) on ONNX Runtime, on your CPU. Nothing leaves your machine unless you turn on remote mode.Recalling without being asked. Hooks inject relevant memory when a session starts, when you send a prompt, and while the agent investigates. The agent does not need to remember to search.
Citing sources. Every result carries its wing, room, source file, drawer id, and score breakdown, so you can check where an answer came from.
Shipping as one binary. No Python, no vector database, no Docker. One
palaceexecutable and onepalace.dbfile.
It also works outside software projects. The creative and personal
profiles adapt it for worldbuilding, fiction, coaching, or
household notes.
Related MCP server: Agent Memory Bridge
๐ฆ Install
Pick one. Each method installs the palace binary. Run palace install
afterwards to connect your agents.
macOS / Linux
curl -fsSL https://raw.githubusercontent.com/AncientiCe/palace-rs/main/scripts/install.sh | shWindows (PowerShell)
irm https://raw.githubusercontent.com/AncientiCe/palace-rs/main/scripts/install.ps1 | iexThe scripts download the matching GitHub Release binary, verify its SHA-256 checksum, and install it. To upgrade later, run the same command again. The Linux binary needs glibc 2.39 or newer (Ubuntu 24.04+, Debian 13+); on an older system, build from source.
Homebrew (macOS Apple Silicon / Linux)
brew tap AncientiCe/palace
brew install palaceTo upgrade, refresh the tap first. Without brew update, Homebrew can keep
reporting the old version as already installed:
brew update && brew upgrade palaceWhen a release changes the memory protocol rule (the CHANGELOG says so), run
palace install again afterwards so your agents get the new rule text.
Claude Code plugin. After installing the binary with one of the methods
above, Claude Code users can add Palace as a plugin instead of running
palace install --client claude:
/plugin marketplace add AncientiCe/palace-rs
/plugin install palace@palace-rsThe plugin brings the MCP server and the memory hooks, and calls palace from
your PATH. It can't write ~/.claude/CLAUDE.md, so run palace install too
if you want the always-on rule. While the plugin is enabled, palace install
writes only the rule and removes its own Claude Code MCP entry and hooks, so
nothing runs twice. Hooks left in settings.json by an earlier install stay
silent while the plugin is on.
MCP registry / MCPB bundle. Palace is listed in the official
MCP registry as
io.github.ancientice/palace-rs. Each release also ships a palace-<version>.mcpb
bundle (Linux x86_64, macOS arm64, Windows x86_64) for one-click install in
MCPB-aware hosts such as Claude Desktop.
From source
git clone https://github.com/AncientiCe/palace-rs && cd palace-rs
cargo build --release # binary at target/release/palacePlatform | Status |
Linux x86_64 | Supported (glibc 2.39 or newer) |
macOS Apple Silicon | Supported |
Windows x86_64 | Supported |
macOS Intel | Not supported (no ONNX Runtime build) |
The embedding model (~23 MB) downloads from Hugging Face the first time you
mine or search, then stays cached in ~/.cache/huggingface.
โก Quick start
palace install # connect every supported agent on this machine
palace doctor # check that every client is wired up
palace init ~/my-project --yes --auto-mine # detect rooms, write palace.yaml, mineRestart your agent app so it reloads its MCP config. Then try:
"What do we know about how this project handles database migrations?"
The agent should call palace_search and answer from memory, citing the
drawer it used. You can also search from the terminal:
palace search "how did we decide on the database schema"From then on, the agent writes a diary entry after substantial work and stores durable decisions as facts. Tomorrow's session, from any of your agents, picks up where today's left off.
๐ How it works
The palace
Memory is organised like a building, which keeps search focused:
Figure 1. One palace holds many wings. Rooms group drawers, and the knowledge graph and diaries sit alongside them.
Concept | What it is | Example |
Wing | A project or a topic |
|
Room | An area inside a wing |
|
Drawer | One chunk of verbatim text plus its embedding and metadata | a paragraph of |
Knowledge graph | Time-stamped facts: subject โ predicate โ object |
|
Diary | Per-agent session notes for continuity | "Fixed the flaky migration test byโฆ" |
Tunnel | A link between rooms in different wings |
|
Wings are either project wings (a folder on disk, created by palace mine)
or topic wings (no folder, such as chat history or meeting notes, created
with palace_create_wing).
Retrieval
flowchart LR
Q["๐ฌ Question<br/>from you or the agent"] --> S["Sanitize<br/>strip pasted dumps"]
S --> I["Classify intent<br/>decision ยท how_to ยท preference โฆ"]
I --> H["Hybrid search<br/>BM25 + cosine"]
H --> B["Coding boosts<br/>+ preference pass"]
B --> R{"Rerank?<br/>optional"}
R --> OUT["๐ Results<br/>scores + source + neighbours"]
DB[("palace.db<br/>local embeddings")] -.-> HFigure 2. What happens to a query. Everything runs locally on your CPU.
Search fuses BM25 keyword scoring with cosine similarity over local
embeddings. It then applies intent boosts for coding questions. Each query is
classified as preference, decision, how_to, definition, temporal, or
unknown. Preference-shaped questions ("how do I like my commits?") get a
dedicated pass against tagged preference spans. A local cross-encoder
reranker is available as an option (--rerank or PALACE_RERANK=1).
Embedding models
Palace ships with all-MiniLM-L6-v2 and can switch a palace to another
local model. Every vector is rebuilt from the stored text, so switching never
loses memory.
Model id | Model | Precision | Notes |
| all-MiniLM-L6-v2 | int8 | Default for new palaces: same recall as fp32, faster indexing, 23 MB download |
| all-MiniLM-L6-v2 | fp32 | Palaces created before 0.19 run on it (90 MB download) |
| bge-small-en-v1.5 | fp32 | Experimental, about 2x slower indexing |
| bge-small-en-v1.5 | int8 | Experimental |
| bge-base-en-v1.5 | int8 | Experimental, 768-dim |
Experimental models scored below MiniLM on the coding-agent eval and about level on probes from a real palace (see the bake-off). You can try them on your own palace: verification decides whether it switches.
palace embeddings list # models, which is active, which are downloaded
palace embeddings estimate minilm-l6-v2-q8 # time, disk and latency, measured on this machine
palace embeddings migrate minilm-l6-v2-q8 # build, verify, switch (e.g. an older fp32 palace)
palace embeddings rollback # back to the previous model, instantly
palace embeddings cleanup # drop the previous model's vectorsmigrate builds the new vectors in batches while search keeps using the
current model, so it is safe to interrupt and rerun. When the vectors are
built, it checks the new model against the current one on 200 known-item
probes taken from your palace (hybrid and vector-only recall@1/@5, plus query
latency). It switches only if recall@5 drops by at most 0.01 and p95 query
latency stays within budget. The budget is twice the current model's p95, and
at least 25 ms. Run palace embeddings cutover --force to switch anyway, or
palace embeddings cancel to keep the current model.
Setting embedding_model in config.json (or PALACE_EMBEDDING_MODEL)
picks the model for a new, empty palace. An existing palace never switches
on its own. palace status, palace_status, and palace_session_context
report the pending migration until you run migrate. Nothing migrates on
its own: you run migrate, or ask your agent to, which uses the
palace_embeddings MCP tool (it runs the same steps in the background of
the server). In remote mode the server owns the model, so these commands run on the server.
Agent-generated query dumps are cleaned up before retrieval. Results come back
with score provenance (combined, cosine, bm25, coding_boost,
preference_match, mined_discount, repeat_discount, rerank_score,
intent) and the
chunks right before and after each hit in its source file. Pass
context: false to palace_search to leave those out.
A question in plain words favours memories you or your agent filed over mined project files that share its words. A query that names code (an identifier, a path, a file name) ranks filed and mined drawers alike.
Automatic recall (hooks)
palace install registers user-level hooks, so memory works in every project
without editing per-project files:
Figure 3. Three hooks read memory into the session. The fourth makes sure the session's lessons get written back.
Hook | What it does |
Session start | Injects the memory protocol, your standing rules from |
Prompt submit | Searches Palace with your actual question and injects matching drawers before the agent answers. If a history question finds nothing, it tells the agent to run |
Post tool use | While the agent greps and reads files, recalls related memory so earlier decisions surface without a search. In Claude Code it also records the session's Palace calls. |
Stop | If the session did real work but saved nothing, asks the agent once to write a diary entry and record decisions before it finishes. In Claude Code this is judged per session, including sessions that never used Palace; other agents use a recent-activity window. |
Auto-recall is limited to the current project. Drawers from your other project wings and diaries from other projects stay out. Topic wings still appear.
All hooks fail open: if the palace is missing or empty, the agent works as normal.
The memory protocol
palace install also writes a short rule into each client's instruction file.
The rule tells the agent when to use memory:
Session start:
palace_statusโpalace_session_contextโpalace_diary_search.Before answering a question about past decisions, preferences, or history:
palace_searchandpalace_kg_query, before grep.After work:
palace_diary_write, pluspalace_kg_addfor durable facts.
Grep remains the right first tool for current symbols, exact definitions, and code that may have changed since it was mined.
The nine protocol tools are marked _meta."anthropic/alwaysLoad" = true, so
Claude Code 2.1.121 and later keeps them loaded instead of deferring them
behind tool search.
Memory layers
Layer | Name | Contents |
L0 | Identity |
|
L1 | Essential story | Top drawers by importance, grouped by room (~600โ900 tokens) |
L2 | On demand | Wing- and room-filtered retrieval |
L3 | Deep search | Full hybrid search across the palace |
palace wake-up prints L0 and L1. Agents reach L2 and L3 through MCP tools.
๐ Supported clients
palace install configures every supported client by default
(--client all). Gemini CLI, VS Code, Windsurf, Antigravity, OpenCode, Cline, Zed and
Goose are included only when their config folder exists, so Palace never sets up an agent you don't
have. Use --client <name> to configure one explicitly.
Client |
| MCP config | Rule file | Hooks |
Claude Code |
|
|
|
|
Codex |
|
|
|
|
Cursor |
|
|
|
|
Gemini CLI |
|
|
|
|
VS Code (Copilot) |
|
|
|
|
OpenCode |
|
|
|
|
Cline |
|
|
|
|
Zed |
| Zed | Zed's global | None. Zed's agent has no hooks; external agents in Zed use their own Palace setup. |
Goose |
| Goose | Goose |
|
Windsurf |
|
|
| None. Cascade hooks can't inject context. Devin Local reuses the Claude Code hooks. |
Antigravity |
|
|
| None yet. The always-on rule carries the protocol. |
Claude Desktop |
|
|
| None. Use the MCP prompts instead. |
Rule files are written as a managed block. Your existing content is kept.
palace install --client claude # one client only
palace install --scope project --path ./my-project # project-level rule files
palace install --no-rule # MCP wiring only, no rule
palace install --dry-run # preview the changes
palace uninstall # undo everythingWith --scope project, rules go to <project>/CLAUDE.md, <project>/AGENTS.md
(Codex, OpenCode, Cline, Zed and Goose), <project>/GEMINI.md, <project>/.github/copilot-instructions.md,
<project>/.windsurf/rules/palace.md, <project>/.agents/rules/palace.md
(Antigravity), and <project>/.cursor/rules/palace.mdc.
Cursor, VS Code, Antigravity and OpenCode also get a project MCP config
(.cursor/mcp.json, .vscode/mcp.json, .agents/mcp_config.json, opencode.json).
Any MCP client can run Palace as a stdio server with palace mcp.
JSON clients (Claude Code, Cursor, Claude Desktop):
{
"mcpServers": {
"palace": { "command": "palace", "args": ["mcp"] }
}
}Codex (~/.codex/config.toml):
[mcp_servers.palace]
command = "palace"
args = ["mcp"]Claude Code CLI:
claude mcp add palace -- palace mcpMCP prompts
Claude Desktop cannot run hooks, so the server offers two prompts in its prompt picker:
Prompt | What it does |
| Loads warm-start context so the agent picks up where you left off |
| Saves the session to memory so it carries over next time |
Profiles
A profile changes the agent rule, the protocol text, and which rooms
palace init looks for:
Profile | For | Typical rooms |
| Software projects | frontend, backend, testing, docs, config |
| Worldbuilding, D&D, fiction | characters, places, lore, factions, timeline |
| Coaching, caregiving, household, client notes | people, health, finances, home, schedule |
palace install --profile creativeThe profile is saved to ~/.palace/config.json. Set PALACE_PROFILE to
override it for one process.
Remote mode (shared team memory)
By default, palace mcp serves your local palace. Remote mode turns it into a
stdio-to-HTTP bridge to a shared Palace Server,
the commercial, self-hosted team edition. Client registrations do not change.
palace remote set --endpoint https://palace.yourco.com # prompts for the ps_โฆ API key
palace remote on
palace remote test # runs the MCP handshake and reports the tool count
palace remote status # mode, endpoint, masked key
palace local # back to the local palaceTry this with one teammate and one ticket. Give both agents access to the same investigation on your own infrastructure. The team trial includes 10 seats for 60 days, with no credit card: Start the team trial.
๐งฐ CLI reference
Run palace <command> --help for every flag.
Setup
Command | What it does |
| Register the MCP server, rules, and hooks with your agents |
| Remove them again |
| Check the binary, database, MCP configs, and rules |
| Seed knowledge-graph facts that make agent recall measurable |
| Open a pre-filled public GitHub discussion to share feedback ( |
| Draft a GitHub issue about the latest search over 1 s: counts, sizes and timings only ( |
Adding memory
Command | What it does |
| Detect rooms and write |
| Chunk, embed, and store project files. Re-runs only process changed files. |
| Re-mine changed files automatically as you work |
| Ingest chat exports: Claude Code and Codex JSONL, Claude.ai, ChatGPT, Slack |
| Store transcript JSONL files as one drawer per message |
| Split concatenated Claude Code transcripts into one file per session |
Finding memory
Command | What it does |
| Hybrid search ( |
| Print the L0 identity and L1 essential story |
| Drawer counts by wing and room |
| Registered wings, with kind, drawer count, and last mined time |
| Rename a wing, or merge it into an existing wing |
| Knowledge-graph facts in time order ( |
| How much your agents use Palace, and what it saves |
Maintenance
Command | What it does |
| Back up or restore drawers as JSON (embeddings are rebuilt on import) |
| Delete old drawers ( |
| Re-embed drawers that are missing vectors |
| Re-embed everything with the active model ( |
| List, estimate, migrate to, verify, cut over to, or roll back embedding models |
| Import Python MemPalace (default |
| Compress drawers to the AAAK dialect |
Servers
Command | What it does |
| Start the MCP stdio server |
| Configure and toggle remote mode |
| Hook runner called by the installed hooks |
Mining a project
flowchart LR
DIR["๐ Your repo"] --> F["Filter<br/>.gitignore + skip build dirs"]
F --> C{"Changed since<br/>last mine?"}
C -- no --> SKIP["Skip"]
C -- yes --> CH["Chunk + pick room<br/>using palace.yaml"]
CH --> E["Embed locally<br/>all-MiniLM-L6-v2"]
E --> DB[("palace.db")]Figure 4. Mining only touches files that changed, so re-running it is cheap.
palace mine respects .gitignore and skips .git, node_modules,
target, build, dist, vendor, and other build output. It reads common
text and source formats: md, txt, rs, py, js, ts, tsx, go,
java, rb, sh, sql, json, yaml, toml, html, css, csv, and
more.
palace mine ~/my-project \
--wing my_project # override the wing name
--limit 100 # process at most 100 new or changed files
--dry-run # preview without storing
--no-gitignore # ignore .gitignore rules
--include vendor,third_party # force-include these paths--limit runs can be resumed: the next run continues from where the last
one stopped.
Measuring value with palace gain
palace gain # last 30 days
palace gain --project my_project --since 7d
palace gain --history # recent tool calls
palace gain --json
palace gain --record <query_id> <drawer_id> useful # or not_useful / wrong_answerpalace gain - last 30d (my_project)
Tool calls : 412 (sessions: 27)
Hit rate : 88% (search hits 142/162)
Precision@1 : 92%
Precision@5 : 95%
Tokens saved (est) : ~78,400
Re-index skipped : 31 (duplicate drawers avoided)
KG facts recalled : 56
Diary recalls : 8
Repeat Qs avoided : 19
p95 latency : 41 ms
Prompt recall : 230 prompts (96 with past sessions or decisions, 71 code only, 63 nothing found)Prompt recall counts what the prompt hook injected, apart from MCP tool
calls. Many "code only" or "nothing found" prompts mean agents work without
the earlier sessions in front of them.
Usage metadata stays in your local palace.db. Set PALACE_GAIN_DISABLED=1
to turn recording off.
๐งฉ MCP tools
Status and health
Tool | Description |
| Palace overview: drawer and wing counts, recent sessions ( |
| Check MCP tools, database health, embeddings, and model cache |
| Run project-memory probes and report expected hits |
| Usage gains and savings. Accepts an optional |
| Readable inventory: profile, per-wing and per-room counts, recent activity |
Wings and taxonomy
Tool | Description |
| Is this project mined, registered but unmined, or unknown? |
| Mine a code repository on demand (after the user agrees) |
| Declare a topic or project wing |
| Rename a wing, or merge it into an existing wing |
| Registered wings with kind, path, last mined time, and counts |
| Rooms within a wing |
| Full wing โ room โ count tree |
Search
Tool | Description |
| Hybrid search with score provenance and source context |
| Dedicated pass for preference and convention questions |
| Check whether content already exists |
Drawers
Tool | Description |
| Store content in a wing and room |
| Store a key fact with importance 5 |
| Fetch a drawer by id |
| List drawers, with optional wing and room filters ( |
| Update content and refresh metadata |
| Remove a drawer |
| Full provenance: who stored it, when, from where, importance |
| Remove stale or low-value drawers |
| Export or import palace data |
| Re-embed drawers and refresh preference vectors |
| List models, estimate, and migrate to another embedding model when you ask |
Knowledge graph
Tool | Description |
| Query an entity's relationships |
| Add a fact (subject โ predicate โ object) |
| Mark a fact as no longer true |
| Facts in time order |
| Graph overview |
| Find stale or contradictory facts |
| Seed adoption and quality-gate facts |
Graph and tunnels
Tool | Description |
| Breadth-first walk from a room |
| Rooms that bridge two wings |
| Manage stored tunnels |
| Follow tunnels from a wing and room |
| Graph summary |
Diaries and sessions
Tool | Description |
| Write a diary entry |
| Read recent entries |
| Search diaries. |
| Warm-start context. Falls back to other agents' recent work on the project. |
| List agent diaries |
Internal
Tool | Description |
| The AAAK compressed-memory dialect spec |
| Hook settings |
| Acknowledgement used by the stop hook |
๐ง Configuration
Settings load in this order: environment variables, then
~/.palace/config.json, then defaults.
Env var | Default | Description |
|
| Data directory. The database is |
|
|
|
| off |
|
| built-in | Override the reranker model |
|
| Comma-separated languages for entity detection |
| off |
|
| off |
|
| off |
|
|
| Search time (after the model is loaded) above which a search counts as slow |
| auto | Project name used for gain attribution when a call names no |
|
| Default source for |
| off |
|
|
| How long to wait, in milliseconds, for another palace process that is writing to the database. |
|
|
|
|
| Embedding model for new palaces (see embedding models) |
| 2x current p95 | Query-latency budget for |
| all cores | ONNX threads used for embedding |
| none | Palace Server URL (host, base URL, or full |
| none | Palace Server API key ( |
config.json takes the same settings as keys: palace_path, profile,
entity_languages, topic_wings, people_map, mcp_mode,
remote_endpoint, remote_api_key, embedding_model,
embedding_latency_budget_ms. Palace writes this file with owner-only
0600 permissions.
palace.yaml (per project)
palace init creates this file. Edit it to tune how files map to rooms:
wing: my_project
rooms:
- name: backend
description: Server and API code
keywords: [api, server, routes, models]
- name: frontend
description: UI components
keywords: [ui, components, pages, views]
- name: general
description: Everything else
keywords: []๐ Benchmarks
Coding-agent memory eval
A fixture of realistic project memories (decisions, past failures, commands, conventions, preferences, current direction) with 51 questions such as:
why did we choose bundled sqlite?
how did we fix the migration test failure last time?
what clippy command should I run?
cargo test --test coding_agent_eval -- --nocaptureThe test reports recall@1 and recall@5, and fails if retrieval drops below
a fixed threshold. It answers the question that matters: can a coding agent
find the right project context when it needs it?
This eval is not tuned. The ranker used to carry a handful of phrases taken from the eval's own questions (such as "explain themselves", "proof priority" and "release theme"); they are gone, and these are the scores without them:
Mode | R@1 / R@5 |
Keyword-only (this test) | 0.804 / 0.961 |
| 0.882 / 1.000 |
| 0.882 / 1.000 |
With the phrases the eval scored 0.863 keyword-only and 0.902 with
minilm-l6-v2-q8: they bought three questions and one question of the 51,
and nothing outside this eval.
Embedding model bake-off
tests/embedding_bakeoff.rs scores every embedding model
on this eval with embedded drawers, and on 200 known-item probes from a real
palace. It also measures indexing throughput and query latency. Each probe is
an inner sentence of a drawer with about 30% of its words dropped.
PALACE_RUN_BAKEOFF=1 PALACE_BAKEOFF_DB=~/.palace/palace/palace.db \
cargo test --release --test embedding_bakeoff -- --nocaptureModel | Coding eval R@1 / R@5 | Palace probes R@1 / R@5 | Indexing | Query p95 |
| 0.882 / 1.000 | 0.890 / 0.985 | 152 drawers/s | 2.0 ms |
| 0.882 / 1.000 | 0.900 / 0.985 | 128 drawers/s | 2.4 ms |
| 0.843 / 1.000 | 0.920 / 0.985 | 59 drawers/s | 6.7 ms |
| 0.843 / 1.000 | 0.915 / 0.985 | 69 drawers/s | 5.7 ms |
| 0.843 / 1.000 | 0.915 / 0.985 | 37 drawers/s | 6.8 ms |
Hybrid recall, 400 drawers sampled from a palace of about 14,300 drawers,
Windows, 16 threads, measured 29 Nov 2026. The probes are sampled from a live
palace, so they shift a little as it grows. int8 models embed one text per call: their activation scales
cover the whole batch, so batching would make a text's vector depend on its
neighbours. On this palace's drawers q8 indexed about 1.2x faster than fp32;
on the longer drawers of the synthetic speed corpus it was about 1.7x faster
(October). BGE ranks best with a 0.5 cosine floor and an even cosine/BM25
split, which its registry entry carries. A model ships as non-experimental
only if it matches MiniLM on the coding-agent eval, so the BGE models stay
experimental for now. On real-palace probes they are slightly ahead at R@1
(3 to 6 more of the 200 probes) and index about half as fast. verify
measures the same thing on your own palace before it switches.
LongMemEval
Retrieval recall on LongMemEval s_cleaned: 470 evaluated questions, each
over a haystack of about 50 sessions and 115k tokens. The 30 abstention
questions are excluded, as is standard.
Configuration | Model | R@1 | R@5 | R@10 |
|
| 1.000 | 1.000 | 1.000 |
One drawer per session (October) |
| 0.896 | 0.981 | 0.991 |
One drawer per session (October) |
| 0.898 | 0.981 | 0.991 |
Exchange pairs, as Palace mines chats |
| 0.913 | 0.987 | 0.996 |
The exchange-pair row is how Palace actually stores conversations: each
session goes through the same normaliser and chunker as palace mine-convos
(one chunk per user turn and its reply), and a session ranks by
its best chunk. The per-session rows are the usual LongMemEval granularity,
for comparison with other systems. The exchange-pair row is from 29 Nov 2026;
R@1 was 0.915 before a November chunking fix moved one temporal question to
second place.
docs/benchmarks.md has the full results: LongMemEval
s_cleaned and m_cleaned with recall_all and evidence-turn recall,
LoCoMo, and BEAM at 100K, 500K and 1M tokens.
Granularity: as in each row. Nothing is filtered, summarised, or extracted by an LLM; user and assistant turns are stored together.
Embedder: MiniLM-L6-v2 (384-dim, ONNX, full precision or int8), 512-token cap, local.
Retrieval: Palace's normal hybrid search (BM25 fused with cosine plus the ranking boosts), top-K 10. Each question is asked on its own
question_date, and each drawer is dated by its session, so relative dates ("two weeks ago") resolve as they would in a live palace.No LLM at any stage, no GPU. Nothing was tuned on
s_cleaned: the one ranking weight chosen on LongMemEval data (how much a session's other matching chunks count) was picked on them_cleanedsplit together with probes from a real palace, then frozen before this run.Metric:
recall_any@Kat session granularity. The five drawers behind R@5 hold about 1,700 tokens between them, 1.3% of the haystack. docs/benchmarks.md also reportsrecall_all@K, where every gold session has to be in the top K.Hardware: Windows, 16 threads.
Question type | Per session, | Exchange pairs, |
knowledge-update | 0.944 / 1.000 | 0.958 / 1.000 |
multi-session | 0.909 / 0.983 | 0.909 / 0.992 |
single-session-assistant | 1.000 / 1.000 | 1.000 / 1.000 |
single-session-preference | 0.633 / 0.867 | 0.767 / 0.933 |
single-session-user | 0.922 / 1.000 | 0.984 / 1.000 |
temporal-reasoning | 0.858 / 0.976 | 0.850 / 0.976 |
The oracle split only contains the gold sessions, so it checks the pipeline
rather than measuring retrieval. Preference questions are the weakest
category, because "I preferโฆ" sentences rarely share keywords with the
question. Ranking now favours drawers from the time a question points at
("10 days ago", "last Tuesday", "in the past month"), but the three
remaining temporal misses with exchange pairs lose on topic, not on date:
the gold chunk scores below unrelated ones from the same days.
The previous release scored 0.906 / 0.985 / 0.994 with exchange pairs and
0.891 / 0.979 / 0.991 per session (q8). Date-aware ranking, weighting a
session by its other matching chunks, and no longer reading "should I" as a
convention question account for the difference.
๐ Privacy and data
Everything is local by default. One SQLite file at
~/.palace/palace/palace.db. Embeddings are computed on your CPU.Network access is limited to the one-time model download from Hugging Face, and to your own Palace Server if you turn on remote mode.
No telemetry.
palace gainstatistics are written to your local database only.Feedback is something you post, never something Palace sends. After 5 MCP sessions,
palace_session_contextincludes a link your agent may mention once, after its current task. The link opens a public GitHub discussion pre-filled with your Palace version, OS, client name, and profile. You can edit it before posting, or ignore it.palace feedbackopens the same page. Palace can't see whether you posted, so runningpalace feedback(orpalace feedback --doneonce you have) pauses the hint for 30 days. Otherwise it returns after another 5 sessions, at most once a week, and after 3 unanswered hints at most once a month. SetPALACE_FEEDBACK_DISABLED=1to never see the hint.Slow-search reports are drafts you post yourself. When a search takes over 1 second (after the model is loaded), Palace keeps that measurement locally. Once 3 searches have been slow within 7 days, and at most once a week, it suggests
palace report slow-search. That prints a draft issue with your Palace version, OS, embedding model, drawer, wing and room counts, database size and the search's timings. It never includes queries, memory text, wing or room names, or paths.--submitopens it as a pre-filled GitHub issue that you read and post. SetPALACE_SLOW_SEARCH_DISABLED=1to turn it off.Back up with
palace export, or copypalace.db.Delete a single memory with
palace_forget, or everything by removing~/.palace.
Palace stores whatever you mine. Exclude secrets with .gitignore before you
mine a repository.
๐ฉบ Troubleshooting
Problem | Fix |
The agent never calls Palace | Run |
| Open a new terminal so |
No search results | Check |
Results are out of date | Run |
Model download fails | Check that |
Searches feel slow on first run | The first call loads the ONNX model. Later calls in the same session are fast. |
Some drawers have no vectors |
|
โ FAQ
No. After palace install, hooks inject relevant memory at session start, when
you send a prompt, and while the agent reads code. The installed rule tells the
agent to search memory before answering history questions and to save what it
learned afterwards.
Those files are instructions you write and maintain by hand, and every line is loaded into every session. Palace is searchable memory that grows as you work: only the parts relevant to the current question are recalled, and the same memory is shared by Claude Code, Codex, Cursor, and Claude Desktop. Keep using instruction files for rules; use Palace for history.
No. Storage, embeddings, and search all run locally. The only network calls are the one-time model download from Hugging Face and, if you turn it on, your own Palace Server in remote mode. See Privacy and data.
Searches typically take tens of milliseconds (palace gain shows your real
p50 and p95). The first call in a session loads the embedding model. Hooks fail
open, so a missing or broken palace never blocks the agent.
Re-running palace mine updates changed files. For facts, agents call
palace_kg_invalidate and add the new fact, so the timeline keeps both.
palace_conflicts flags facts that look stale or contradictory, and
palace_forget or palace prune removes drawers you no longer want.
Different agents on one machine already share it: a Codex session can pick up
a Claude Code session's diary. For a team, remote mode
points every palace mcp at a shared, self-hosted Palace Server.
No. The creative and personal profiles tune Palace for
worldbuilding, fiction, coaching, caregiving, and household notes. Palace
reads Markdown and text files, so Claude Desktop users can install the MCPB
bundle and start without writing code.
๐ Using Palace as a library
Palace is also a Rust crate, palace-rs,
imported as palace (API docs):
[dependencies]
palace-rs = { version = "0.20", default-features = false }use palace::{db, knowledge_graph, store};
let conn = db::open_in_memory()?;
store::add_drawer(&conn, "wing_code", "backend",
"We use SQLite with WAL mode for concurrent reads.",
None, "architecture.md", 0, "example", 4.0)?;
knowledge_graph::add_triple(&conn, "Palace", "stores_data_in", "SQLite",
Some("2026-04-01"), None, 1.0, None, None)?;default-features = false leaves out the CLI dependencies. For the full
example, see examples/basic_usage.rs
(cargo run --example basic_usage). palace::palace::Palace::search_with_provenance returns
the same score details as the MCP tools.
๐งช Development
cargo fmt
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-features
cargo auditTests use in-memory SQLite, and only tests that need the embedding model load it. See CONTRIBUTING.md, SECURITY.md, and CHANGELOG.md.
๐ Coming from another memory tool
Python MemPalace imports in one command, palace migrate: drawers, diaries,
the knowledge graph and tunnels. For other tools, mine the originals. See
docs/migrating.md.
๐ License
Available Tools
50 toolspalace_add_drawerB
File verbatim content into the palace. Checks for duplicates first.
Inputs: room (required), wing (required), content (required), added_by, +1 more.
palace_check_duplicateB
Check if content already exists in the palace before filing
Inputs: content (required), threshold.
palace_conflictsA
Find knowledge-graph facts that may be stale or contradictory: groups of facts with the same subject and predicate but different objects (for example two different values for 'project uses_database'). Each conflict lists the triples with their valid_from/valid_to dates and whether each is still current. Read-only. Use it to audit the graph; resolve a real conflict with palace_kg_invalidate on the outdated fact. For one entity's facts without conflict detection use palace_kg_query.
Inputs: entity.
palace_create_tunnelA
Store an explicit link (tunnel) between a room in one wing and a room in another, so palace_follow_tunnels can jump between related areas, e.g. an API repo's 'auth' room and a frontend repo's 'login' room. Wing names are normalised to slugs. The tunnel id is derived from its endpoints and kind, so creating the same tunnel twice is a no-op that returns the same id. Use it when the user points out a relationship palace_find_tunnels cannot infer.
Inputs: room_a (required), room_b (required), wing_a (required), wing_b (required), +1 more.
palace_create_wingB
Declare a wing in the registry. Use kind='topic' for non-repo work (e.g. sales topics) so memories have a dedicated area, or kind='project' to pre-declare a repo wing.
Inputs: name (required), kind, description, project_path.
palace_delete_drawerB
Delete a drawer by ID. Irreversible.
Inputs: drawer_id (required).
palace_delete_tunnelA
Permanently delete one explicit tunnel by id. Only the link is removed; the rooms and their drawers are untouched. Returns success=false if no tunnel had that id. Get ids from palace_list_tunnels or palace_follow_tunnels. Use only when the link is wrong or the user asks.
Inputs: tunnel_id (required).
palace_diary_readA
Read an agent's most recent diary entries, newest first, with date, topic, session id, tags and text. Read-only. Use it to review what an agent did lately in order; use palace_diary_search to find entries about a subject, and palace_session_context for warm-start context at session start.
Inputs: agent_name (required), last_n.
palace_diary_searchB
Semantic search within diary entries. Set all_agents=true to recall investigations recorded by any agent (cross-agent continuity).
Inputs: query (required), agent_name (required), tag, limit, +2 more.
palace_diary_writeB
Write to your personal agent diary. Supports session metadata for warm-start context.
Inputs: entry (required), agent_name (required), tags, topic, +2 more.
palace_embeddingsA
Embedding model management. action=list shows models; status shows the active model and any migration; estimate measures cost of switching to model on this machine; migrate rebuilds every vector for model in the background while search keeps working, verifies it on this palace, and switches only if it is at least as good; verify/cutover/rollback/cleanup/cancel run single steps. Switching models is the user's choice: run estimate, migrate, cutover, rollback or cleanup only when the user asks for it, never on your own initiative.
Inputs: force, model, action, sample.
palace_explainA
Return full provenance for a drawer: who filed it, when, from which source file, and its importance.
Inputs: id (required).
palace_exportA
Export all palace drawers as a portable JSON snapshot (embeddings excluded). Use for backup or migration.
Inputs: no named parameters.
palace_find_tunnelsA
Find rooms that appear in more than one wing, i.e. shared topics that bridge projects (for example a 'testing' room in two repos). These bridges are computed from drawer placement, unlike the stored links made by palace_create_tunnel. Returns up to 50 rooms, most drawers first, with their wings, halls, drawer count and most recent date. Read-only. Use it to spot cross-project knowledge.
Inputs: wing_a, wing_b.
palace_follow_tunnelsA
List the explicit tunnels that touch one room in one wing, in either direction, so you can jump to the linked rooms elsewhere (then search or list drawers there). Read-only; returns each tunnel's id, endpoints, kind and creation time. Only stored tunnels from palace_create_tunnel are followed; for rooms related by shared wings use palace_traverse.
Inputs: room (required), wing (required).
palace_forgetB
Delete a drawer by ID. Use when a memory is outdated or incorrect.
Inputs: id (required).
palace_gainA
Report how much value Palace's MCP tools have delivered, from a local usage log: hits, estimated tokens saved, skipped duplicates, recall rate, latency, and per-project totals. Use it when the user asks whether Palace is paying off; for database or model health use palace_verify instead. Read-only by default. Three options change it: history=true returns raw recent events instead of the summary; record={...} stores feedback on one search hit (a write); reset=true permanently deletes usage events (for one project, or all projects when project is omitted), so only reset when the user asks.
Inputs: limit, reset, since, record, +2 more.
palace_get_aaak_specA
Get the AAAK dialect specification: the compressed memory format Palace uses.
Inputs: no named parameters.
palace_get_drawerA
Fetch one drawer (a stored memory chunk) by its id, with its full content, wing, room, hall, source file, importance, timestamps and metadata. Read-only; returns an error if the id does not exist. Use it to read the whole drawer behind a search hit or citation; use palace_explain for provenance only and palace_search when you do not know the id.
Inputs: drawer_id (required).
palace_get_taxonomyB
Full taxonomy: wing โ room โ drawer count
Inputs: no named parameters.
palace_graph_statsA
Return summary statistics for the room graph: total rooms, how many rooms bridge two or more wings, rooms per wing, and the top bridging rooms. Read-only, no arguments. Use it for a quick map of how projects overlap before calling palace_find_tunnels or palace_traverse; for knowledge-graph counts use palace_kg_stats.
Inputs: no named parameters.
palace_hook_settingsA
Report whether Palace's automatic client hooks are enabled: save_enabled (periodic memory saves during a session) and precompact_enabled (saving before the client compacts context). Read-only, no arguments, and both are currently always true. Use it only to check hook behaviour; hooks themselves are installed with the palace CLI, not through MCP.
Inputs: no named parameters.
palace_importA
Import drawers from a JSON snapshot produced by palace_export. Skips drawers that already exist (idempotent).
Inputs: export_json (required).
palace_kg_addB
Add a fact to the knowledge graph. Subject โ predicate โ object.
Inputs: object (required), subject (required), predicate (required), valid_from, +1 more.
palace_kg_invalidateA
Mark a knowledge-graph fact as no longer true by setting its end date. The fact is kept as history (palace_kg_timeline and as_of queries still see it), not deleted. Only a currently open fact with exactly this subject, predicate and object is changed; if none matches, nothing changes. When a fact changes, call this on the old fact first and then palace_kg_add for the new one.
Inputs: object (required), subject (required), predicate (required), ended.
palace_kg_queryA
Look up stable facts about one entity in the knowledge graph (subject โ predicate โ object triples added with palace_kg_add). Returns every matching fact with its direction, valid_from/valid_to dates, confidence, and whether it is still current. Read-only. Use it for durable facts such as 'which database does project X use'; use palace_search for free-text memories and palace_kg_timeline for a chronological history.
Inputs: entity (required), as_of, direction.
palace_kg_statsA
Return summary counts for the knowledge graph: number of entities, total triples, current versus ended facts, and the relationship types (predicates) in use. Read-only, no arguments. Use it to see whether the graph is populated or which predicates exist before calling palace_kg_query; for the drawer store use palace_status, and for the room graph use palace_graph_stats.
Inputs: no named parameters.
palace_kg_timelineA
List knowledge-graph facts in chronological order of valid_from (up to 100), including facts that have since been invalidated, so you can see how something changed over time. Read-only. Use it for 'what happened when' questions; use palace_kg_query for an entity's facts on a given date, and palace_diary_search for session history.
Inputs: entity.
palace_list_agentsA
List the agent names that have a diary in this palace (for example claude-code, codex, cursor). Read-only, no arguments. Use it to find which agent_name to pass to palace_diary_read, or to see who else has worked here before searching all diaries with palace_diary_search all_agents=true.
Inputs: no named parameters.
palace_list_drawersA
List drawers with optional wing/room filters. Pass verbose=true for hall, chunk_index, created_at, metadata and detected entities.
Inputs: room, wing, limit, verbose.
palace_list_roomsA
List rooms within a wing (or all rooms if no wing given)
Inputs: wing.
palace_list_tunnelsA
List the explicit tunnels stored with palace_create_tunnel, newest first, with their ids, both wing/room endpoints, kind and creation time. Read-only. Use it to review links or find a tunnel_id for palace_delete_tunnel; to see the tunnels at one specific room use palace_follow_tunnels.
Inputs: kind, wing.
palace_list_wingsA
List all registered wings with their kind (project/topic), description, project path, last mined time, and drawer counts.
Inputs: no named parameters.
palace_memories_filed_awayA
Signal that you have finished filing memories after a save prompt from a Palace hook. It stores nothing and always returns success=true; call it after palace_diary_write / palace_add_drawer when a hook asked you to save, so the hook knows the save step is done. No arguments, no side effects.
Inputs: no named parameters.
palace_memory_reportA
Human-readable overview of what the palace remembers: profile, total drawers, wings and rooms with counts, recent diary topics, and top remembered facts. Use this to inspect memory without a UI, ideal for non-developer users who want to see what's stored.
Inputs: wing, limit.
palace_mineA
Mine (or re-sync) a CODE REPOSITORY directory into the palace (only after the user agrees). Repos only: chats or non-repo topics have no folder to mine, so use palace_create_wing for those. Accepting this implicitly initialises palace.yaml for first-time repos and then syncs files into the project's wing: new files are added, edited files are re-mined so their drawers reflect the latest content, unchanged files are left alone, and drawers for files deleted from disk are removed. The result's summary field reports new/updated/unchanged/removed file counts.
Inputs: project_path (required), wing, limit, dry_run.
palace_preference_searchA
Search drawers tagged as preferences or conventions. Use when asking what the user prefers, their coding style, or standing rules.
Inputs: query (required), room, wing, limit.
palace_project_statusA
Check whether the current project or topic is known to the palace. Returns a state (mined / registered_not_mined / unknown) plus a recommendation. Call this when entering a workspace; if it is unmined, ask the user before calling palace_mine, and offer palace_create_wing for non-repo topics.
Inputs: project_path (required), wing.
palace_pruneA
Delete drawers filed more than N days ago. Use to keep the palace lean. Irreversible, so export first if unsure.
Inputs: older_than_days (required).
palace_recall_checkA
Test whether known memories can actually be found. For each probe it runs the same hybrid search as palace_search and checks whether a drawer whose source_file equals expected_source appears in the top limit results. Returns ok (all passed), passed/failed counts, and per-probe rank, top source and top similarity. Read-only. Use it after mining or switching embedding models to confirm recall; to simply look something up use palace_search.
Inputs: checks (required), limit.
palace_rememberA
File a key fact with high importance (5.0). Shortcut for palace_add_drawer with importance=5.
Inputs: text (required), room, wing.
palace_rename_wingA
Rename a wing, or merge it into another wing when the new name already exists (e.g. 'my-proj' into 'my_proj'). Moves every drawer, closet, tunnel and mined-file record; drawer ids stay the same. Cannot be undone. Use only when the user asks.
Inputs: to (required), from (required).
palace_searchB
Semantic search. Returns verbatim drawer content with similarity scores, plus the chunks right before and after each hit (source_context).
Inputs: query (required), room, wing, limit, +2 more.
palace_seed_adoption_factsA
Write Palace's standard setup facts into the knowledge graph: the supported clients (Cursor, Codex, Claude Code, Claude Desktop), the memory protocol steps, and the memory routing rules, linked to the given project. Safe to re-run: facts that already exist are left unchanged and outdated ones are invalidated, and the result reports inserted, unchanged and invalidated counts. Use it once when adopting Palace in a project; for your own facts use palace_kg_add.
Inputs: project.
palace_session_contextA
Get warm-start context from recent diary entries. Falls back to other agents' recent work for the project when you have none of your own.
Inputs: agent_name (required), project_path.
palace_statusB
Palace overview: total drawers, wing counts, and recent sessions. Pass verbose=true for room counts, the protocol text, and the AAAK spec.
Inputs: verbose.
palace_traverseA
Explore related topics by walking outward from a room. Two rooms are connected when they share a wing; the walk goes breadth-first up to max_hops and returns up to 50 rooms with their wings, halls, drawer count, hop distance, and the wings they connect through. If the room does not exist it returns close name suggestions. Read-only. Use it to discover related areas; to find content use palace_search, and for explicit links you created use palace_follow_tunnels.
Inputs: start_room (required), max_hops.
palace_update_drawerA
Replace a drawer's content in place, keeping its id, wing, room and source. The old text is overwritten (no history kept), and the embedding, hall, detected entities and preference data are recomputed so search reflects the new text. Returns success=false if the id does not exist. Use it to correct a memory without changing its id; to add a new memory use palace_add_drawer, and to remove one use palace_forget.
Inputs: content (required), drawer_id (required).
palace_upgrade_embeddingsA
Re-embed all drawers with the palace's active embedding model (batched). To switch models use palace_embeddings.
Inputs: refresh_preferences.
palace_verifyA
Verify Palace MCP health: visible tools, database integrity, embedding status, and model cache.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 50 tools
The set contains several near-duplicate or overlapping tools: palace_forget and palace_delete_drawer both delete by ID, palace_remember is a shortcut for palace_add_drawer, and palace_status / palace_project_status / palace_memory_report serve related overview needs. Graph, tunnel, and diary discovery tools also have subtle boundaries that require reading long descriptions to distinguish.
All tools use a consistent palace_ prefix and snake_case, with readable subnamespaces such as palace_kg_*, palace_diary_*, and palace_*_tunnel. However, many names are noun-like or action-only (palace_status, palace_gain, palace_mine, palace_prune) rather than a strict verb_noun pattern.
At 50 tools, the surface is far beyond the typical well-scoped range and includes many niche, administrative, and alias-like operations. The count creates a high discovery and selection burden for an agent, even for a broad memory-management domain.
Coverage is broad: drawers, wings, rooms, knowledge graph, tunnels, diaries, embeddings, import/export, verification, and reporting are all represented. Minor lifecycle gaps remain, such as no clear wing/room deletion or drawer-move operation, and tunnels can be created/deleted but not updated.
Maintenance
Related MCP Connectors
Long-term MCP memory for coding agents: store, search and recall memos across sessions.
Long-term memory for AI coding agents: durable project facts, recalled by every MCP client.
Shared memory for coding agents. Stop re-explaining your codebase every session.
Team memory for AI coding agents and code reviews, reviewed by humans and served over MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA local-first memory layer for coding agents to persist and retrieve project decisions, architecture context, and rules across multiple development sessions. It utilizes a three-tier memory model and hybrid retrieval to provide agents with durable, searchable context and a WebUI for human review.4MIT
- AlicenseAqualityBmaintenanceMCP-native, local-first memory for coding agents that turns real sessions into reusable decisions, gotchas, and domain knowledge.17230 PyPI7MIT
- AlicenseNot gradedqualityCmaintenancePersonal unified memory system for AI coding agents, providing persistent memory with hybrid RAG retrieval via MCP integration, allowing agents to store, search, and manage memories locally.1MIT
- AlicenseNot gradedqualityBmaintenanceProvides a persistent, local-first memory for coding agents over MCP, enabling automatic recall and recording of past work, failures, and decisions to reduce repetition and token usage.MIT