Open source & local-first

Self-hosted second brain: memory server, AI search or a vault people and AI both write

By Baalda Team · · 7 min read

Short answer

A self-hosted second brain is a notes or memory system running on hardware you control. There are three kinds: an MCP memory server the AI writes to, an AI search app that reads your documents, and a notes app with its own sync server. Choose by who writes: the AI, you, or both, as a team needs.

A self-hosted second brain is a notes or memory system that runs on hardware you control, so what you capture, and what your AI learns about your work, never sits on a vendor's server. There are three kinds sold under the name, and the way to choose is to ask who writes into it: only the AI, only you, or both.

Search for the phrase and the results mix very different things. Some are MCP memory servers that let Claude or ChatGPT remember facts between chats. Some are AI search apps that read your documents and answer questions about them. Some are note apps with a sync server you run yourself. All three are self-hosted. They are not interchangeable, and the difference shows up the moment a second person, or a second assistant, needs the same knowledge. Baalda, an open source (Apache-2.0) notes app, is one answer for teams: plain markdown files on each person's disk, a server you run with one command, and an MCP endpoint on that same server so people and assistants write into the same notes. It is part of the answer below, and so are the cases where something else is the better pick.

What are the three kinds of self-hosted second brain?

They split on who does the writing, and that decides what you can do with the result later.

KindExampleWho writesWhere it livesWhat you get back
AI memory serverMCP Knowledge Graph Memory ServerThe assistantOne JSONL fileFacts the assistant chose to keep
AI search over your documentsKhojYou, elsewhereYour existing files, indexedAnswers in a chat window
Notes app with a sync serverTrilium NotesYouThe app's own storeNotes you organised yourself
Shared vault over MCPBaaldaYou, your team and your assistantsMarkdown files plus your serverNotes anyone, human or AI, can read and edit

AI memory servers. The reference Knowledge Graph Memory Server from the Model Context Protocol project describes itself as "a basic implementation of persistent memory using a local knowledge graph". As of 30 November 2026, its README says it stores entities, relations and observations in a JSONL file, set with MEMORY_FILE_PATH, and exposes tools such as create_entities, add_observations and search_nodes. It is small, it is yours, and it is written by the model. You can open the file, but it was never meant to be read like notes.

AI search over your documents. Khoj's README calls it "open-source, self-hostable. Always." It reads PDFs, Markdown, Notion, Word documents and org-mode files, and lets you chat with local or online models about them. Its licence is AGPL-3.0. It answers questions about what you already wrote. Its README does not describe it writing back into your notes, so the writing still happens somewhere else.

Notes apps with a sync server. Trilium Notes describes itself as a note taking application "with focus on building large personal knowledge bases", with a self-hosted sync server and a web interface served from it. Also AGPL-3.0. Here the person writes and organises everything, and AI is not part of the core product.

Each of these is a good tool for one writer. The question is what happens when there are two.

Why does it matter who writes into it?

Because a second brain is only useful if what goes in can be trusted when it comes out, and trust depends on who put it there and whether you can check it.

A memory server written by an assistant holds what the model decided was worth keeping, in the model's wording. When it is wrong, fixing it means another tool call or editing a JSONL line by hand. A search app holds nothing of its own: it is only as good as the files it indexes, and it cannot fix them. A notes app written by hand is trustworthy and slow, and an assistant cannot add to it without a plugin or a script.

What most people actually want from a self-hosted second brain is the combination: notes a person can read and correct, which an assistant can also search, read and add to, all on a machine they control. That means the store has to be readable by humans and writable by AI at the same time, without one overwriting the other.

How does a self-hosted Baalda server work?

Baalda keeps the store as files and puts the server beside them, not in front of them.

The notes are markdown on disk. A vault is a folder. Each note is a .md file on each member's computer, and the desktop app (macOS, Windows, Linux) edits those files directly. Baalda's docs are explicit that everything except your files is rebuildable: the local search index, the edit history and the server's copy can all be deleted and derived again from the markdown.

The server is one service plus Postgres. The deploy guide offers a one-click Railway template, a Docker Compose bundle, Coolify, or plain Docker. The Compose route is three lines:

bash
cd deploy/compose
cp .env.example .env    # POSTGRES_PASSWORD, JWT_SECRET, BETTER_AUTH_URL
docker compose up -d

Only three variables are required: DATABASE_URL, JWT_SECRET and BETTER_AUTH_URL. A self-hosted server has no paid tier and no vault or member limits, as long as BAALDA_DEPLOYMENT=self-hosted is set. Left at its cloud default, the server caps each vault at 20,000 notes even with billing off. The Compose and Coolify bundles set it for you.

The assistant connects to the same server. The MCP endpoint is your server's address plus /api/mcp. A person creates a token in Vault Settings, MCP, and connects a client with it, as the MCP setup guide shows for Claude Code:

bash
claude mcp add --transport http context https://notes.example.com/api/mcp \
  --header "Authorization: Bearer mcp_…"

That token is scoped to one person in one vault. The assistant gets tools such as search_notes, read_note, create_note and append_note, and it can reach exactly what that person can. A folder the person cannot see does not appear in its listings or search results and cannot be read, written or renamed.

Edits merge instead of colliding. Every change, typed or written by an assistant, becomes an operation on the same CRDT document (Yjs). If two people type in one note, or an assistant appends to a meeting note while someone is still editing it, both changes land. If the note is open, you watch the assistant's text appear as it writes.

What does a self-hosted second brain look like for a team?

The solo version of the question is about privacy. The team version adds three more: whose notes are whose, what the assistants can reach, and what happens when the server goes away.

A layout that works for a team of five to fifty on a Baalda server:

text
Team Vault/
├── Inbox/            # anyone captures here, people and assistants
├── Projects/         # one folder per active project
├── Decisions/        # short notes: what, why, who, when
├── People-private/   # No access for everyone except its owner
└── Archive/

The private folder is the part a JSONL memory file cannot give you. Permissions are set per folder and per note, so a person's assistant, using that person's token, cannot read People-private/ either. An assistant that summarises a meeting into Inbox/ writes a note the whole team can open, correct and link, rather than a fact hidden inside one person's chat history.

The last question, what happens if the server disappears, has a short answer. Every member still has the markdown files on their own disk. The server's copy can be rebuilt from them. Nothing about the knowledge depends on keeping one database alive.

If you also want the model on your hardware, so that no note leaves the building even when an assistant reads it, connect a local model over the same endpoint. The local LLM second brain guide covers Ollama and LM Studio, and LibreChat over MCP covers a self-hosted chat app on top.

Where does Baalda not help?

It is the wrong pick more often than a vendor page admits:

  • You want memory, not notes. If all you want is for Claude to remember your preferences between chats, the reference memory server is a few lines of config and needs no app.
  • You want to ask questions of documents you never edit. A folder of PDFs and contracts is a document chat problem. Khoj is built for that.
  • You want answers built in. Baalda ships no model and no chat box. Your team brings its own assistant, connected over MCP. Search over MCP matches words more than meaning, which the self-hosted knowledge base post explains in detail.
  • You need phone or browser access. Baalda is a desktop app. Trilium serves a web and mobile interface from its own server.
  • You do not want to run a server at all. Then do not. Baalda works fully offline on one machine with no account, and the managed service handles sync if a team wants it without operating anything.
  • You will not maintain it. A self-hosted server does not update itself. The deploy guide says to update the server before the desktop app, and with plain Docker you run migrations yourself before every upgrade.

Where it fits is a team that wants its second brain on its own infrastructure, written by the people doing the work and by their assistants together, as files that would outlive the server if it ever went away.

FAQ

Frequently asked questions

What is the best self-hosted second brain?

It depends on who writes into it. For an assistant that remembers facts between chats, an MCP memory server. For questions over documents you already have, Khoj. For notes you organise by hand, Trilium. For a team where people and assistants edit the same notes on your own server, Baalda.

Can I self-host a second brain that AI can write to?

Yes. A self-hosted Baalda server exposes an MCP endpoint at your own address plus /api/mcp. Each person creates a token, and their assistant can search, read, create and append to notes with exactly that person's permissions. Its edits merge with people's typing instead of overwriting it.

What do I need to run a self-hosted Baalda server?

One Node service and Postgres. The deploy guide offers a one-click Railway template, a Docker Compose bundle, Coolify or plain Docker, with three required variables: DATABASE_URL, JWT_SECRET and BETTER_AUTH_URL. With BAALDA_DEPLOYMENT set to self-hosted there are no vault or member limits.

What happens to my notes if the self-hosted server goes down?

Nothing is lost. Every member keeps the notes as markdown files on their own disk, and the app keeps working offline. Baalda's docs say the server's copy can be deleted and derived again from those files, so the knowledge never depends on one database surviving.

Start your team’s brain

Free and open source. No account needed.