> ## 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.

# Context

> Commands that control what gets injected into an agent turn: domains and their triggers, rules, standards, star commands, and previewing any of it on demand before you send a prompt.

These are the controls for what your agents are told and when. A domain decides *when* something is relevant, a rule is *what* gets said, a standard is a protocol that fires when you edit a matching file, and a star command is a switch you type straight into the chat. `base context` shows you the result of all of it without sending a prompt.

The split worth holding on to: `domains.toml` holds triggers only, and the rule text lives in the graph. That is why `base domain` and `base rule` are two commands rather than one.

<Warning>
  `base domain remove` and `base rule remove` take things away, and neither has a preview or a confirmation flag. `base commands remove` edits `commands.toml` in place. Everything else on this page is safe to run at any time.
</Warning>

## Domains

A domain is a named bundle of triggers. When your prompt or the file you are editing matches one, everything attached to that domain becomes eligible to be injected.

Read `base domain list` and `base domain get` as merged across both tiers. The write commands are not merged, and that catches people out, so see the tier note at the end of this section.

### base domain list

Show every configured domain, from the global tier and this workspace together.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base domain list
```

### base domain get

Show one domain's full configuration: its triggers, its mode, and what is attached.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base domain get basemode
```

The name is case-insensitive. Use this to confirm a trigger landed where you expected it.

### base domain create

Create a new domain, optionally with its first trigger.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base domain create --name basemode
base domain create --name basemode --keyword "portal"
base domain create --name basemode --path "apps/portal"
```

| Flag                  | What it does                                   |
| --------------------- | ---------------------------------------------- |
| `--name <NAME>`       | The domain name. Required.                     |
| `--keyword <KEYWORD>` | A prompt keyword that makes this domain match. |
| `--path <PATH>`       | A file path that makes this domain match.      |

### base domain add-trigger

Add a keyword or a path trigger to a domain that already exists.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base domain add-trigger --domain basemode --keyword "portal"
base domain add-trigger --domain basemode --path "apps/portal"
```

| Flag                  | What it does                    |
| --------------------- | ------------------------------- |
| `--domain <DOMAIN>`   | The domain to add to. Required. |
| `--keyword <KEYWORD>` | The prompt keyword to add.      |
| `--path <PATH>`       | The file path to add.           |

Matching is plain substring and path matching. Nothing here is fuzzy or semantic, so a trigger either appears in the text or it does not.

### base domain remove-trigger

Take a keyword or path trigger back off a domain.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base domain remove-trigger --domain basemode --keyword "portal"
base domain remove-trigger --domain basemode --path "apps/portal"
```

| Flag                  | What it does                         |
| --------------------- | ------------------------------------ |
| `--domain <DOMAIN>`   | The domain to remove from. Required. |
| `--keyword <KEYWORD>` | The prompt keyword to remove.        |
| `--path <PATH>`       | The file path to remove.             |

### base domain remove

**Destructive.** Remove a domain entirely, which stops its triggers from ever matching again.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base domain remove basemode
```

The name is case-insensitive. This is a triggers-level delete: rules you added to that domain still exist in the graph, they simply have nothing left to fire them. If you want a domain quiet but recoverable, remove its triggers instead of removing the domain.

### base domain sync

Read `domains.toml` into the graph, so that domains and their rules exist as entities you can query.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base domain sync
```

| Flag            | What it does                                                             |
| --------------- | ------------------------------------------------------------------------ |
| `--carl <CARL>` | Path to a `carl.json` file, for a one-time migration of older decisions. |

<Warning>
  **The domain write commands do not all use the same tier.** `create`, `remove-trigger` and `remove` only ever touch the global `~/.base-gbl/domains.toml`. `add-trigger` writes the workspace file instead. So a domain you create and then add a trigger to ends up split across two files, and a trigger you added in a workspace cannot be removed from the command line. `list` and `get` read both tiers merged, which is why the domain still looks correct while this is happening.

  Established from source at `4866996`, the commit the shipped 0.13.2 binary was built from: `add_trigger` resolves the workspace base directory, while `create_domain`, `remove_trigger` and `remove_domain` all take the current directory as an unused argument and go straight to the global file. Until this changes, edit the workspace `.base/domains.toml` by hand when you need to take a workspace trigger off.
</Warning>

## Rules

A rule is a line of text attached to a domain. When the domain matches, the rule is injected.

`base rule` is the only command that carries a `-g` / `--global` flag, and it goes **before** the verb: `base rule -g list --domain basemode`. Putting it after the verb is invalid.

### base rule add

Attach a rule to a domain, optionally with the reason behind it.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base rule add --domain basemode --text "Never push to main; main is the live deploy"
base rule add --domain basemode --text "Never push to main" --rationale "main is the live deploy"
base rule -g add --domain basemode --text "Never push to main"
```

| Flag                      | What it does                                                 |
| ------------------------- | ------------------------------------------------------------ |
| `--domain <DOMAIN>`       | The domain this rule belongs to. Required.                   |
| `--text <TEXT>`           | The rule itself. Required.                                   |
| `--rationale <RATIONALE>` | Why the rule exists. Injected as "rule — because rationale". |

The rationale is worth writing. A rule with a reason attached survives being questioned; a bare imperative gets argued with.

### base rule list

Show the rules attached to a domain.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base rule list --domain basemode
base rule -g list --domain basemode
```

| Flag                | What it does                  |
| ------------------- | ----------------------------- |
| `--domain <DOMAIN>` | The domain to list. Required. |

The index printed against each rule is what `base rule remove` takes, so list before you remove.

### base rule remove

**Destructive.** Remove one rule from a domain, by its index.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base rule remove --domain basemode --index 2
```

| Flag                | What it does                                                  |
| ------------------- | ------------------------------------------------------------- |
| `--domain <DOMAIN>` | The domain to remove from. Required.                          |
| `--index <INDEX>`   | Which rule, by the index shown in `base rule list`. Required. |

There is no preview and no confirmation. Indexes shift when a rule is removed, so re-run `base rule list` between removals rather than working down a list you printed earlier.

## Standards

A standard is a protocol that injects when you edit a file it matches, rather than when you type a keyword. Standards come from a `protocols.md` source and are synced into `standards.toml` plus the graph.

### base standards sync

Read the protocols source into `standards.toml` and the graph.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base standards sync
base standards sync --source docs/protocols.md
```

| Flag                | What it does                                                |
| ------------------- | ----------------------------------------------------------- |
| `--source <SOURCE>` | Use a different `protocols.md` instead of the default path. |

### base standards list

Show every standard, with how many triggers and annotations each one carries.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base standards list
```

### base standards get

Show one standard's full configuration.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base standards get midas-security
```

### base standards test

Dry-run the matcher against a file and see the scores and what would be injected. Nothing is written and nothing is sent.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base standards test src/auth.rs
base standards test src/auth.rs --content "adding a login handler"
```

| Flag                  | What it does                                                                       |
| --------------------- | ---------------------------------------------------------------------------------- |
| `--content <CONTENT>` | Extra text to include in the match, which simulates the payload of an actual edit. |

This is the command to reach for before you rely on a standard firing. It answers "would this have injected" without you having to make an edit to find out.

## Star commands

A star command is a named behaviour switch you type into the chat, like `*audit`. They live in `commands.toml`.

`base cmd` is the short alias for `base commands`.

### base commands list

Show every star command currently loaded.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base commands list
```

### base commands show

Show the full rules text behind one star command.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base commands show audit
```

The name is case-insensitive and you leave the `*` off.

### base commands add

Add a new star command. Rules are repeatable, so pass `--rule` once per line you want it to carry.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base commands add --name audit --description "Scrutinize existing work and name failure modes"
base commands add --name audit --description "Scrutinize existing work" --rule "Find problems, do not gloss" --rule "Name the failure mode"
```

| Flag                          | What it does                                 |
| ----------------------------- | -------------------------------------------- |
| `--name <NAME>`               | The command name, without the `*`. Required. |
| `--description <DESCRIPTION>` | What the command is for. Required.           |
| `--rule <RULE>`               | A rule the command carries. Repeatable.      |

### base commands remove

**Destructive.** Remove a star command from `commands.toml`.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base commands remove audit
```

Case-insensitive on the name, and no preview.

### base commands import

Add star commands from another `commands.toml` file, such as a pack someone shared with you.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base commands import ~/Downloads/operator-modes.toml
```

The import is append-only. Names already present are skipped rather than overwritten, and nothing before the appended block is altered, so importing the same pack twice is safe.

## base context

Preview what a piece of text would pull, using the same matching that runs during an agent turn. Nothing is sent and nothing is written.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
base context "working on the portal signup flow"
base context --list
```

| Flag     | What it does                                                    |
| -------- | --------------------------------------------------------------- |
| `--list` | Show every configured trigger instead of matching against text. |

This is the fastest answer to "why did nothing arrive". Paste the prompt you actually sent, and either a domain matches or it does not.
