Brainllm
概览
作者提供的说明(英文原文)
Self-hosted memory for LLMs in TriliumNext, structured by the server and editable by you.
PopNx MCP 的三大支柱
这三项永远不会合并成一个分数:意见、测量和人气是不同的东西。
- 用户评价i暂无评价评价功能将在后续阶段与账户功能一起开放
- 我们的基础检查i1 项中通过 1 项依据公开信息检查;尚未扫描代码
- 使用情况i起步阶段↓ 961/周 · ★ –
它能帮你做什么
我们还没有为它写通俗的介绍。下面是我们从注册中心读取到的事实。
- 连接方式: 在你的电脑上运行
- 传输方式: stdio
- 分类: 搜索与 AI 记忆
- 你需要填写:TRILIUM_BASE_URL, TRILIUM_ETAPI_TOKEN, TRILIUM_PASSWORD, BRAINLLM_OWNER_PASSWORD, BRAINLLM_OAUTH_SECRET
安装
选择你使用的 AI 应用,然后复制设置。
安装之前
- 基础检查:1 项中通过 1 项
- 在你的电脑上运行,拥有你的用户账户的权限(文件、网络、应用)。
- 需要你自己填写:
TRILIUM_BASE_URL,TRILIUM_ETAPI_TOKEN,TRILIUM_PASSWORD,BRAINLLM_MODE,BRAINLLM_TZ,BRAINLLM_OWNER_PASSWORD,BRAINLLM_OAUTH_SECRET,BRAINLLM_PUBLIC_URL,BRAINLLM_ALLOW_UNAUTHENTICATED_HTTP,BRAINLLM_TRUST_PROXY
标为机密的值是你账户的钥匙。千万不要分享给别人,也不要粘贴到聊天里。
你需要
- npm已安装 Node.js(用于 npx 命令)
你用的是哪个应用?
在上方选择你的应用。我们会记住它,下次按钮会显示“安装到 …”。
打开 Claude Desktop → Settings → Developer → Edit Config,把下面的内容粘贴到 claude_desktop_config.json
{
"mcpServers": {
"brainllm": {
"command": "npx",
"args": [
"-y",
"brainllm"
],
"env": {
"TRILIUM_BASE_URL": "your-value",
"TRILIUM_ETAPI_TOKEN": "your-value",
"TRILIUM_PASSWORD": "your-value",
"BRAINLLM_MODE": "your-value",
"BRAINLLM_TZ": "your-value",
"BRAINLLM_OWNER_PASSWORD": "your-value",
"BRAINLLM_OAUTH_SECRET": "your-value",
"BRAINLLM_PUBLIC_URL": "your-value",
"BRAINLLM_ALLOW_UNAUTHENTICATED_HTTP": "your-value",
"BRAINLLM_TRUST_PROXY": "your-value"
}
}
}
}在终端中运行这条命令
claude mcp add brainllm --env TRILIUM_BASE_URL=your-value --env TRILIUM_ETAPI_TOKEN=your-value --env TRILIUM_PASSWORD=your-value --env BRAINLLM_MODE=your-value --env BRAINLLM_TZ=your-value --env BRAINLLM_OWNER_PASSWORD=your-value --env BRAINLLM_OAUTH_SECRET=your-value --env BRAINLLM_PUBLIC_URL=your-value --env BRAINLLM_ALLOW_UNAUTHENTICATED_HTTP=your-value --env BRAINLLM_TRUST_PROXY=your-value -- npx -y brainllm运行前请先填写空着的值。
或者自己复制设置
粘贴到项目中的 .cursor/mcp.json,或 ~/.cursor/mcp.json
{
"mcpServers": {
"brainllm": {
"command": "npx",
"args": [
"-y",
"brainllm"
],
"env": {
"TRILIUM_BASE_URL": "your-value",
"TRILIUM_ETAPI_TOKEN": "your-value",
"TRILIUM_PASSWORD": "your-value",
"BRAINLLM_MODE": "your-value",
"BRAINLLM_TZ": "your-value",
"BRAINLLM_OWNER_PASSWORD": "your-value",
"BRAINLLM_OAUTH_SECRET": "your-value",
"BRAINLLM_PUBLIC_URL": "your-value",
"BRAINLLM_ALLOW_UNAUTHENTICATED_HTTP": "your-value",
"BRAINLLM_TRUST_PROXY": "your-value"
}
}
}
}浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。
或者自己复制设置
粘贴到项目中的 .vscode/mcp.json
{
"servers": {
"brainllm": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"brainllm"
],
"env": {
"TRILIUM_BASE_URL": "your-value",
"TRILIUM_ETAPI_TOKEN": "your-value",
"TRILIUM_PASSWORD": "your-value",
"BRAINLLM_MODE": "your-value",
"BRAINLLM_TZ": "your-value",
"BRAINLLM_OWNER_PASSWORD": "your-value",
"BRAINLLM_OAUTH_SECRET": "your-value",
"BRAINLLM_PUBLIC_URL": "your-value",
"BRAINLLM_ALLOW_UNAUTHENTICATED_HTTP": "your-value",
"BRAINLLM_TRUST_PROXY": "your-value"
}
}
}
}浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。
这个服务器在你的电脑上运行,而 ChatGPT 只能连接互联网上的服务器。请选择其他应用。
你的选择通过 Cookie 保存在这台设备上,无需账户。
需要你填写的值
- Base URL of the TriliumNext instance, e.g. http://localhost:8080
- ETAPI token. Required unless TRILIUM_PASSWORD is set. Create one in Trilium under Options → ETAPI.
- Alternative to TRILIUM_ETAPI_TOKEN — BrainLLM mints a token on first start and caches it beside brainllm.json.
BRAINLLM_MODEenvcore (default) exposes the 45 brain-aware tools; full additionally exposes the 33 raw ETAPI tools.BRAINLLM_TZenvIANA timezone used to stamp dated notes, e.g. Africa/Johannesburg. Defaults to the host timezone.- Enables the OAuth 2.1 / CIMD endpoints required by claude.ai and other hosted Claude surfaces. This is the password entered on the consent screen when authorizing a client.
- Optional 32+ character deployment secret for signing OAuth tokens; rotate it to invalidate old tokens.
BRAINLLM_PUBLIC_URLenvOverride for the public origin when a proxy rewrites Host. Must exactly match the URL entered in the client.BRAINLLM_ALLOW_UNAUTHENTICATED_HTTPenvExplicit trusted-network-only escape hatch for HTTP mode. Never enable on a public interface.BRAINLLM_TRUST_PROXYenvTrust forwarded host/protocol headers for OAuth discovery only when a trusted reverse proxy sets them.
这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。
它能做什么
它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。
基础检查i
我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月9日
- ✓ 通过
作者与仓库一致
注册名称已通过 GitHub 账户 miisodev 验证,该账户拥有此仓库
- … 尚未检查
仍在维护
我们还没有从 GitHub 读取这个仓库
- … 尚未检查
有许可证
我们还没有从 GitHub 读取这个仓库
- – 不适用
端点有响应
它在你的电脑上运行,没有互联网端点
- – 不适用
使用 OAuth 登录
在你的电脑上运行,改用本地设置
- … 尚未检查
工具描述中没有隐藏指令
它在你的电脑上运行;我们只能读取互联网端点的工具列表
与“搜索与 AI 记忆”中的其他服务器比较i
- 星标数多于此分类中其他 5730 个服务器的 0%
- 发布到注册中心的时间比此分类中其他 5730 个服务器的 88% 更新
- 基础检查结果等于或优于此分类中其他 5730 个服务器的 100%
与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。
常见问题
Brainllm 安全吗?
它在 1 项适用的基础检查中通过了 1 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。
它需要哪些密钥或代码?
你需要填写:TRILIUM_BASE_URL, TRILIUM_ETAPI_TOKEN, TRILIUM_PASSWORD, BRAINLLM_OWNER_PASSWORD, BRAINLLM_OAUTH_SECRET
它在我的电脑上运行还是在云端?
它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。
它还在维护吗?
GitHub 仓库最后更新于–,最新版本(13.3.1)于5天前进入注册中心。
哪些应用可以使用它?
支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Node.js。
有什么可以替代它?
同一分类中有:Context7, Codebase Memory, Exa
替代选择
同一分类中其他作者的服务器,按星标数排序。
如何看卡片:↓ 每周下载量i★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i
Codebase Memory
Codebase knowledge graph for AI agents — 162 languages, sub-ms queries, 99% fewer tokens.
Exa
Connect AI agents to Exa for web search, content fetching, and multi-step research.
作者的 README
打开 README
按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。
BrainLLM
Give Claude a memory that survives the session.
Self-hosted memory for LLMs in TriliumNext Notes, structured by the server and editable by you, served over the Model Context Protocol.
Site · Connect to Claude · How it works · Docs · Privacy
What is BrainLLM?
LLMs forget. Every session starts from zero: who you are, what you're working on, what was decided yesterday, what went wrong last week. BrainLLM fixes that.
BrainLLM is an MCP server that gives an LLM a real, persistent memory — stored in TriliumNext Notes, a mature open-source knowledge base you self-host and own. The model opens each session by loading who you are and what's live, writes durable facts the moment they surface, wires knowledge together as a typed graph, and closes each session with a log, a diary entry, and a database backup. The next session picks up exactly where the last one ended.
It's a single Bun/TypeScript service with two dependencies (the MCP SDK and Zod), speaking to Trilium exclusively through its public ETAPI. Your memory lives in *your* Trilium instance — inspectable, editable, and portable, never locked inside a vendor's black box.
Who it's for
Anyone running an LLM as a long-running collaborator, not a one-shot Q&A tool — across coding, research, personal knowledge management, or day-to-day operational tracking — who wants that collaborator to actually remember: who you are, what's in flight, what was decided, without you re-explaining it every session. If you're comfortable self-hosting one small service and a Trilium instance, BrainLLM turns "the model forgot everything again" into a solved problem. It works with any MCP-capable client (Claude Desktop, Claude Code, or anything else speaking MCP), not just one product.
From experiment to open source
BrainLLM began in February 2026 as a personal experiment: could an LLM operate a real, self-hosted memory reliably enough to be trusted as its own memory — orienting, writing, connecting, and closing sessions without a human doing the filing? Through sustained daily, production use the answer held. The design has settled, the failure modes have been found and fixed, and the project has graduated from experiment to something efficient and stable enough to share — so it's now open source. It still runs the author's own sessions every day; what you're reading is the same code, not a demo. It also still carries the shape of one person's daily use — see Adapting to your environment for exactly what that means and what to change.
The core principle
The model supplies content. The server owns form.
Placement, naming, labels, deduplication, relation bookkeeping, lifecycle aging, archival, date stamping, HTML sanitization, backups — and structure itself — are all deterministic server policy, never delegated to the LLM. The model never chooses a parent note, never sets a label, never checks for duplicates, never stamps a date. That division is what makes the memory *reliable*: every guarantee is enforced at the tool layer, not requested via prompt.
Design highlights
- Structure is enforced, not requested — every content kind has a canonical structure, served by
template()and held on write: a new thread requires its goal, thread/diary/session entries open with an identification line (which LLM, which environment, which session type), threads carry exactly one Resolution (owned byresolve()), duplicate section headings are detected, andLast updatedstamps are server-maintained. - Domains born complete — creating a knowledge domain creates its book *and* its canonical Sources note (marker legend, stamp, grouped source list, revision table), so every claim has a sourcing home from the first write.
- A visible graph —
graph()renders the whole relation graph (or any note's neighborhood) as a Mermaid flowchart, maintained as a native Trilium note. - Byte-preserving artifacts — text is UTF-8, while binary content uses strict standard base64 in the tool contract and raw bytes on the wire; binary reads return an explicit MIME/base64 envelope instead of replacement characters.
- One-call day orientation —
day()serves the previous session, its change log and everything touched since in a single call. - Two thread shapes — a thread is a dated journal (one child per active day) or a titled collection (one maintained note per item, e.g. an ideas list), chosen once with
shape=at creation. - Timeless notes, dated records — knowledge, information and thread books hold no state or history (only a domain's *Current State* does);
maintain(deep=true)flags dated prose that creeps in. Every note except a log carries an icon, set by kind and backfilled by the sweep. - Resilient plumbing — every backend call is timeout-bounded with retry on idempotent reads; routine core writes are idempotent or duplicate-guarded, while full-mode raw overwrites remain explicit; content surgery survives the editor's own HTML rewriting; renaming a domain cascades to everything inside it; the maintenance sweep heals drift it finds.
- Multi-agent by default — all write-classified tools serialize behind a process-wide FIFO lock, so two agents (an interactive session and an automated run, say) writing through one hosted instance queue in arrival order instead of racing; reads stay fully parallel. Deletion catch-up in the daily log keeps a note deleted after its day's close from vanishing without a trace — and its window is configurable (
deletionCatchupDaysin the lifecycle policy), defaulting to Trilium's 7-day retention. - Ask in prose, split on a seam —
consistency(subject="…")finds every note asserting about a fact however it is phrased, no regex guessing;consistency(pattern, staleAfterDays=N)surfaces figures held in exactly one untouched note, the ones that rot silently because nothing disagrees with them, and skips sessions and diaries, which are history rather than claims;diff(since="today")reviews every note a session changed in one call;revise(find="Phase 2", within="tr")edits, inserts or removes a table row named by a few words inside it;read(ids=[…])batches a multi-note orientation into one round trip — each note's size up front, or a singlesection=across them; andsplit(noteId, sections=[…], into="…")is the write half of the oversized-note problem — it lifts whole sections into a new note and leaves a pointer back. Information notes can carry a#mandatemarker so a scoped session finds the one note it must obey without reading every note's prose. - A distinct connector identity — hosted instances advertise BrainLLM and their own origin, with same-origin PNG/SVG icons, explicit page favicon links and a real multi-size ICO. The canonical mark is shared across the connector, consent pages and public assets.
- Preview changes and measure coverage —
revise(noteId, edits=[…], dryRun=true)shows sequential match counts and sanitized before/after content with no revision, labels or gate writes. Revision failures stop content overwrites.consistency()reports read failures and scan coverage; case-insensitive comparisons retain spelling variants without false conflicts. Incomplete scans cannot establish absence or unanimity. - Registers close in one call —
revise(find, within="tr", mode="remove", closure={thread, body})removes a register row and records its closure in that thread's entry for the day,closure={note, table?, row?}moves a row into an explicitly selected register table; destination cells must match the table's shape. Destination-first ordering preserves recoverability, andmoves=[{find, row?}]batches closures with preflight and per-row progress, andappend={table, row}adds a row with no anchor to find;within=also accepts a row as a reader sees it ("Phase 2 | Claude | Open"), and a table row whose cells disagree with its header is flagged at write time and bymaintain(deep). - Bulk edits and lighter receipts —
revise(find, within="tr", mode="remove", all=true)removes every row an anchor sits in, in one write and previewable withdryRun=true;remember(kind="sources", revision=[{source, from}])renames a Sources key when a source moves instead of adding a second row; a dated-thread append returnspreviousRun, its author's previous block and run number;read(ids, sizes=true)plans a bulk read from sizes and section sizes alone; anddiff(since="today", summaryOnly=true)lists what changed without the lines. - Records you can prove — sessions, diary entries and dated thread entries are append-only, and now verifiably so: every
close()seals its day's records into a digest chained to the previous day's, andmaintain(deep)reports any sealed record that was rewritten afterwards. Appends stay legal; edits to history do not go unnoticed.
How it works
At bootstrap, BrainLLM builds a five-area tree in Trilium. Every note the tools create is typed, labeled, dated, and placed by server policy:
BrainLLM (#brainLlmRoot)
├── 👤 Master Biography · Goals · Preferences (the user — maintained singletons) ├── 🤖 LLM Responsibilities · Protocols · Self-correction · Diary/ (the assistant's self-model + daily diary) ├── 🗂️ Memory Sessions/ · Threads/ (daily session logs + multi-session work) ├── 📚 Knowledge Master/ · Domains/ /{ Sources, info } (learned facts beyond/contra training) └── 💡 Insights Logs/ · Graph · Claims (the brain's record of itself)
| Note class | Kinds | Behavior |
|---|---|---|
| Singletons | biography, goals, preferences, responsibilities, protocols, selfcorrection (+ each domain's Sources note) | Exactly one maintained note; edited in place; hold *current-state truth* |
| Authored records | diary, session, dated threadEntry | One per calendar day and parent; every write lands as a timestamped addendum block — chronology is the point |
| Generated logs | log | One per calendar day; regenerated in place from the change feed |
| Collections | thread, user, information, domain | Titled notes, deduplicated by normalized title within their scope |
A session follows an enforced protocol: start() orients (who you are, live threads, what changed since last time) → the model works, writing durable facts *as they surface* → session() → addendum() → maintain() → remarks() → diary() → `close
只显示了开头部分;其余内容请在仓库中阅读