SourceBrain
A versioned knowledge base for your codebase. Capture lessons learned, document system rules, and export context bundles that any developer or AI model can use, without reading every file every time.
What is SourceBrain?
SourceBrain lets you build a structured, versioned collection of knowledge about your codebase. Each piece of knowledge lives at a path like auth/jwt or api/rate-limiting. Paths form a tree that you can browse in the CLI or web UI, and every time you update a lesson a new version is saved, so you can see how your understanding evolved over time.
SourceBrain is designed to feed that knowledge to AI agents. Run sourcebrain context "authentication" to get a clean markdown document of every relevant lesson to paste into a prompt, or connect the built-in MCP server so tools like Claude Desktop and Cursor can search, read, and even write lessons on their own. See the AI Integration guide.
Two modes
π Local mode
Works like git. Run sourcebrain init in any project directory to create a .sourcebrain/ folder with a local SQLite database. No login, no server, works offline. Add the folder to .gitignore: it is a database, not diffable text, and lessons are versioned inside SourceBrain itself.
βοΈ Cloud mode
Sign up, create a workspace, and every lesson you add is stored on the server. Invite teammates to the same workspace. Use the web UI to browse and edit. Use push and pull to sync with a local copy.
sourcebrain init for local work, then sourcebrain login + sourcebrain push to share it with your team.What to read next
Quickstart
Be up and running in 5 minutes, in either mode.
Key Concepts
Workspaces, lessons, paths, versions, sync, and plans.
CLI Reference
Every command, flag, and example.
AI Integration
Context export, the MCP server, the HTTP API, and AI lesson drafts.
Recipes
Practical things to do with an agent: import your memory files, install the hooks, work the session loop.
VS Code Extension
See lessons inline in your editor; add and draft them from a selection.
Web UI Guide
How to use the browser interface.