> ## Documentation Index
> Fetch the complete documentation index at: https://docs.basemode.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting started

> Install base, wire it into Claude Code, and teach it the first thing it will tell you back. By the end of this page a rule you wrote by hand arrives inside an agent turn without anyone asking for it.

That last step is the one worth getting to, so this page takes the short route to it rather than covering everything base can do. Five commands, in order, and then the loop runs on its own.

<Note>
  base works with Claude Code today. Codex and Antigravity support is on the way. Where a step below names Claude Code specifically, it is because the install target has to be concrete — everything else applies to whichever agents you run.
</Note>

## Install

base is one Rust binary. You can build it from source on any platform, or take the prebuilt archive on Windows.

<CodeGroup>
  ```bash Build from source theme={null}
  cargo build --release
  ./target/release/base install
  ```

  ```powershell Windows, prebuilt theme={null}
  # Download base-windows-x86_64.zip from the latest release,
  # unpack it, then run the installer from the unpacked folder:
  .\base.exe install
  ```

  ```powershell Windows, from source theme={null}
  powershell -ExecutionPolicy Bypass -File scripts\build-base-windows.ps1
  ```
</CodeGroup>

The Windows build script imports the MSVC developer environment and resolves LLVM and libclang, which bindgen needs for the vendored RocksDB. If you would rather not set up a toolchain, take the prebuilt archive instead.

### What `base install` does

Running the installer is the only step that touches anything outside the current directory, so it is worth knowing exactly what it changes:

* It puts the binary at `~/.local/bin/base`.
* It creates `~/.base-gbl/`, which holds your global configuration and the global tier of the graph.
* It wires base into Claude Code's hook pipeline by editing `~/.claude/settings.json`.
* It offers to install the starter star commands — `*handoff`, `*fork`, `*base` and `*end` — so there is something to type on day one.

Two flags are worth knowing about up front:

```bash theme={null}
base install --skip-hooks            # install the binary, leave settings.json alone
base install --no-starter-commands   # skip the star commands without being asked
```

Use `--starter-commands` to accept them without being asked instead.

## Set up a workspace

A workspace is any directory you want base to know about. Scaffolding one creates a `.base/` directory for its configuration and registers it globally, so base can resolve it later from anywhere on the machine.

```bash theme={null}
cd ~/my-workspace
base scaffold
```

`base scaffold` takes an optional path if you would rather not change directory first.

## Teach it one thing

Everything base knows arrives through commands like this one. Start with a rule, because a rule is the shortest path to seeing the whole loop work.

```bash theme={null}
base rule add --domain myapp --text "Migrations always run through the CLI, never raw SQL"
```

A rule belongs to a domain. A domain is a named subject with triggers attached to it — keywords and file paths that decide when its rules are relevant. Rules live in the graph; the domain's triggers live in `domains.toml`.

You can add the reasoning as well, which is worth doing when the rule would otherwise read as arbitrary:

```bash theme={null}
base rule add --domain myapp \
  --text "Migrations always run through the CLI, never raw SQL" \
  --rationale "Raw SQL skips the audit log and the staging replica never sees it"
```

Ask for it back to confirm it landed:

```bash theme={null}
base recall --keyword "migrations"
```

## Map the code

Registering a project tells base which directory it covers. Syncing the AST reads that directory with tree-sitter and records every function, class, import and call relationship.

```bash theme={null}
base project add --name "My App" --path "src"
base sync --ast --target src
```

Now questions about the code are queries rather than searches:

```bash theme={null}
base ast query --contains "auth"       # entities whose name contains "auth"
base ast query --calls "validate"      # everything that calls validate
base ast query --file "main.rs"        # what lives in this file
base ast query --imports "config.rs"   # which files import it
```

Every command has a short alias, so the same four lines are `base a q -c "auth"`, `--calls`, `-f` and `-i`. Run `base help <command>` for the rest.

## Watch it arrive on its own

The commands above are the part you drive. The part you do not drive is the reason base exists.

Open Claude Code in the workspace you just scaffolded and touch a file inside the mapped directory. The file's shape — its entities, its imports, what depends on it — arrives in the turn before the agent reads its contents. Then type a prompt that mentions migrations. The rule you wrote arrives with it, because the prompt matched the domain.

Nobody asked for either one. That loop is the product: you teach the graph once, and it speaks up on its own from then on.

To see what would arrive for a given piece of text before you send it, ask directly:

```bash theme={null}
base context "touching the billing module"
base context --list                      # every trigger currently configured
```

## If something looks wrong

```bash theme={null}
base doctor
```

`base doctor` checks graph health across both tiers and exits nonzero when it finds a problem. Add `--repair` to quarantine malformed lines and rewrite the good set, which backs up first. Add `--json` if you are reading it from a script.

## Where to go next

<CardGroup cols={2}>
  <Card title="How it works" icon="workflow" href="/how-it-works">
    The four points in an agent's turn where context gets placed, and what the graph holds.
  </Card>

  <Card title="Command reference" icon="terminal" href="/reference/commands">
    Every command, grouped by whether it is safe to run without thinking about it.
  </Card>
</CardGroup>
