Quickstart

Get up and running with SourceBrain in under 5 minutes. Choose the mode that fits you.

Install the CLI

Download the latest sourcebrain binary for your platform from the releases page, then add it to your PATH.

Verify the install:

sourcebrain --help

Local mode: no account needed

Local mode stores everything in a .sourcebrain/ folder inside your project, exactly like a .git/ directory. No signup required.

  1. 1

    Initialize a knowledge base

    Run this inside any project directory:

    cd my-project
    sourcebrain init

    This creates .sourcebrain/sourcebrain.db, a local SQLite database that holds all your lessons.

    In an interactive terminal, init then offers a quick guided setup: it can add .sourcebrain/ to your .gitignore and, for Pro users, start an AI codebase scan. Press Enter to accept, or run sourcebrain init --no-guided to skip it.

  2. 2

    Add your first lesson

    Lessons are identified by a path. Paths can be anything; treat them like file paths in a tree:

    sourcebrain add auth/jwt

    Your default editor opens. Write your lesson in Markdown, save, and close. Add a version note with -m:

    sourcebrain add auth/jwt -m "initial write-up"

    Or skip the editor by passing content directly:

    sourcebrain add auth/jwt -c "JWTs expire after 30 days. Secret is in env SOURCEBRAIN_JWT_SECRET."
  3. 3

    View a lesson

    sourcebrain show auth/jwt
  4. 4

    Browse all lessons

    sourcebrain ls
  5. 5

    Export context for an AI prompt

    Search across all lessons and bundle the results into a markdown document:

    sourcebrain context "authentication"
    sourcebrain context "database migrations"

    Paste the output directly into your AI chat to give it instant codebase context.

💡
Add .sourcebrain/ to .gitignore (guided setup offers this). It is a SQLite database, so git cannot diff or merge it. Your lessons are already versioned inside SourceBrain (sourcebrain log); to share them, sync a cloud workspace with push and pull.

Cloud mode: team collaboration

Cloud mode stores lessons on a shared server. Multiple people can work in the same workspace. The web UI lets you browse and edit from any browser.

  1. 1

    Create an account

    Sign up via the CLI:

    sourcebrain signup

    Or visit the web app and click Start for free.

  2. 2

    Create a workspace

    A workspace is your shared knowledge base:

    sourcebrain workspace create my-team

    Then select it as active:

    sourcebrain workspace use my-team
  3. 3

    Add lessons: same commands as local mode

    sourcebrain add auth/jwt -m "JWT auth overview"
    sourcebrain add db/migrations -m "how we handle schema changes"

    Because you're logged in and have selected a workspace, all lessons go to the cloud automatically.

  4. 4

    Invite your team

    sourcebrain members invite teammate@example.com

    Or invite from the web UI via the Workspaces page.

  5. 5

    Open the web UI

    Visit the app in your browser, log in, and you'll see the workspace tree with all lessons. Click any lesson to read it. Click Edit to update it with the split-pane Markdown editor.


Combining local and cloud

You can have a local knowledge base and a cloud workspace at the same time. Use push to upload local lessons to the cloud, and pull to bring cloud changes down.

# Upload everything local → cloud
sourcebrain push

# Bring cloud changes → local
sourcebrain pull

If the same lesson was changed in both places you'll see a side-by-side diff and be prompted to keep local, accept cloud, edit manually, or skip.

ℹ️
Auto-detection: if you run a command inside a directory that has .sourcebrain/, SourceBrain uses local mode. Otherwise it uses the cloud workspace you selected with sourcebrain workspace use.
SourceBrain Docs · SourceBrain