
Palace
io.github.AncientiCe由 GitHub 帳號 AncientiCe 發布v0.19.1更新於 Nov 3, 2026
面向編碼代理的本機優先記憶——MCP server,單一 SQLite 檔案,本機嵌入
AI 翻譯由 AI 模型根據下方的原文描述翻譯,可能有誤。
原文描述
Local-first memory for coding agents — MCP server, single SQLite file, local embeddings
概覽
Palace 的本機 MCP 服務;無需登入;STDIO。
暫無 AI 概覽:以下資訊來自註冊中心條目和服務本身。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Palace,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
[CI status] [Latest release] [License: MIT] [Platforms: Linux, macOS, Windows] [Rust 1.82+] [Listed in the MCP registry] [Listed on mcpservers.org] [Works with Claude Code, Codex, Cursor, Gemini CLI, VS Code, OpenCode, Cline, Zed, Goose, Windsurf and Claude Desktop]
Local-first memory for coding agents.
Your agent remembers decisions, fixes, commands, and preferences between sessions.
One binary, one SQLite file, no API keys, no cloud.
Quick start · Install · How it works · Clients · CLI · MCP tools · FAQ
Palace gives Claude Code, Codex, Cursor, Gemini CLI, VS Code, OpenCode, Cline, Zed, Goose, Windsurf, 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.
🧭 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.
📦 Install
Pick one. Each method installs the palace binary. Run palace install
afterwards to connect your agents.
macOS / Linux
Windows (PowerShell)
The scripts download the matching GitHub Release binary, verify its SHA-256 checksum, and install it. To upgrade later, run the same command again.
Homebrew (macOS Apple Silicon / Linux)
To upgrade, refresh the tap first. Without brew update, Homebrew can keep
reporting the old version as already installed:
When a release changes the memory protocol rule (the CHANGELOG says so), run
palace install again afterwards so your agents get the new rule text.
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
The embedding model (~23 MB) downloads from Hugging Face the first time you
mine or search, then stays cached in ~/.cache/huggingface.
⚡ Quick start
Restart 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:
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.
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
Figure 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.
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.
migrate 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, rerank_score, intent) and the neighbouring chunks from
the same source file.
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.
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
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, 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.
Rule files are written as a managed block. Your existing content is kept.
With --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, and <project>/.cursor/rules/palace.mdc.
Cursor, VS Code and OpenCode also get a project MCP config
(.cursor/mcp.json, .vscode/mcp.json, opencode.json).
Manual MCP config
Any MCP client can run Palace as a stdio server with palace mcp.
JSON clients (Claude Code, Cursor, Claude Desktop):
Codex (~/.codex/config.toml):
Claude Code CLI:
MCP prompts
Claude Desktop cannot run hooks, so the server offers two prompts in its prompt picker:
Profiles
A profile changes the agent rule, the protocol text, and which rooms
palace init looks for:
The 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.
🧰 CLI reference
Run palace <command> --help for every flag.
Setup
Adding memory
Finding memory
Maintenance
Servers
Mining a project
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.
--limit runs can be resumed: the next run continues from where the last
one stopped.
Measuring value with palace gain
Usage metadata stays in your local palace.db. Set PALACE_GAIN_DISABLED=1
to turn recording off.
🧩 MCP tools
All 50 tools
Status and health
Wings and taxonomy
Search
Drawers
Knowledge graph
Graph and tunnels
Diaries and sessions
Internal
🔧 Configuration
Settings load in this order: environment variables, then
~/.palace/config.json, then defaults.
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:
📊 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?
The 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 partly tuned, on purpose. The ranker's coding-agent boosts include a handful of phrases taken from the eval's own questions (such as "explain themselves", "proof priority" and "release theme"), so the tuned scores here and in the bake-off below are higher than general ranking alone would give. We keep them until general improvements reach the same numbers, then remove them. Measured on the same code with those phrases removed:
The phrases have no effect outside this eval: real-palace probes and every per-session LongMemEval ranking are identical with and without them.
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.
Hybrid recall, 400 drawers sampled from a 10,800-drawer palace, Windows,
16 threads. 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 longer drawers (the synthetic speed corpus) q8 indexes about
1.7x faster than fp32. 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 about level. 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.
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.
Method and per-type results
- 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. - Hardware: Windows, 16 threads.
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. - 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
❓ FAQ
Do I have to tell my agent to use it?
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.
How is this different from CLAUDE.md or AGENTS.md?
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.
Does it send my data anywhere?
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.
Will it slow my agent down?
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.
What happens when a memory goes out of date?
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.
Can my whole team share one memory?
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.
Is it only for code?
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). Add it as a git dependency:
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
Tests use in-memory SQLite, and only tests that need the embedding model load it. See CONTRIBUTING.md, SECURITY.md, and CHANGELOG.md.
🚚 Migrating from older versions
From mempalace (0.1.x)
Version 0.2.0 renamed the project from mempalace to palace. The 0.2.x line
kept the old names working with warnings. They were removed in 0.3.0.
To upgrade from 0.1.x, either install a 0.2.x release first and run
palace install, which migrates configs and moves ~/.mempalace to
~/.palace, or rename by hand: ~/.mempalace → ~/.palace,
mempalace.yaml → palace.yaml, MEMPALACE_* → PALACE_*, and the
mempalace_* MCP tools → palace_*. Hooks that ran mempalace mcp or
python -m mempalace.mcp_server should now run palace mcp.
From the Python version
The Rust version replaces ChromaDB plus SQLite with a single palace.db.
ChromaDB data cannot be converted, so re-ingest:
identity.txt, people_map.json, and known_names.json in ~/.palace/ are
still compatible and are read automatically.
📜 License
來源:README.md,提交 22e922b
工具
0版本歷史
11- v0.19.1最新Nov 3, 2026
- v0.19.0Oct 29, 2026
- v0.18.1Oct 26, 2026
- v0.18.0Oct 24, 2026
- v0.17.1Oct 20, 2026
- v0.17.0Oct 15, 2026
- v0.16.1Oct 15, 2026
- v0.16.0Oct 12, 2026
- v0.15.0Sep 27, 2026
- v0.14.2Sep 23, 2026
- v0.14.1Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分