# pi

> For the complete documentation index, see [llms.txt](https://docs-stg.ringleader.dev/llms.txt).


> Set pi's default model, declare your own model providers and MCP servers, and install pi extension packages on every workstation.


Install pi with the [`pi` devtool](https://docs-stg.ringleader.dev/reference/tools/devtools/pi/) and it runs
with its own defaults. Add this toolconfig to choose its default model, to install pi
packages (extensions, skills and prompts), or to declare model providers and MCP servers of
your own:

```yaml
toolconfigs:
  - name: pi
    config:
      settings:
        defaultProvider: anthropic
        defaultModel: claude-sonnet-4-5
      packages:
        - npm:pi-example-extension@1.2.3
```

Each part goes to its own place on the workstation:

- `settings` is merged into `~/.pi/agent/settings.json`.
- `models` is merged into `~/.pi/agent/models.json`.
- `mcpServers` is merged into `~/.pi/agent/mcp.json`.
- `packages` are installed with pi's own `pi install` command, as the login user.

The three files are owned by the login user and readable by nobody else. The rest of this
page covers [settings](#settings), [packages](#packages), [model providers](#model-providers),
[MCP servers](#mcp-servers), your organization's
[policy](#models-and-your-organizations-policy), and [the field list](#config-fields).

## Settings

pi writes to `settings.json` itself, when you pick a model with `/model` or install a
package, so Ringleader does not replace the whole file. It works one top-level key at a
time:

- A key you declare is written on every configuration pass.
- A key you never declared is left alone.
- A key you stop declaring is removed on the next pass.

Remove the toolconfig and Ringleader removes the keys it wrote. The file itself stays. Key
names and values are pi's, and any string may carry a `${secret:NAME}` reference.

Two keys are refused under `settings` when you apply:

- `packages`, because that list belongs to [`config.packages`](#packages). The list in
  `settings.json` also holds the packages you installed by hand, and Ringleader never
  rewrites it.
- A non-empty `enabledModels`, because its patterns can choose a provider and a model that
  your organization's policy cannot check. Use `defaultProvider` and `defaultModel` instead.

Ringleader writes only pi's default directory, `~/.pi/agent`. It does not follow the
`PI_CODING_AGENT_DIR` variable.

## Packages

`packages` lists pi packages to install. An entry is a source string, or an object that adds
pi's filters:

```yaml
packages:
  - npm:pi-example-extension@1.2.3
  - git:github.com/acme/pi-skills@v2
  - source: https://github.com/acme/pi-prompts
    prompts: ["review-*"]
    skills: ["!experimental-*"]
```

A source takes one of these forms:

| Form | Example |
|------|---------|
| An npm package, with an optional version | `npm:pkg`, `npm:@scope/pkg@1.2.3` |
| A git repository, with an optional tag or commit after `@` | `git:github.com/owner/repo@v1`, `git:git@github.com:owner/repo` |
| A repository over HTTPS | `https://github.com/owner/repo` |

Applying the config refuses a source outside these forms, and the message describes the
forms. A few cases worth knowing:

- A local path, such as `~/ext` or `./ext`, is refused. A folder on one workstation is not
  something a config can carry to another.
- A repository must be exactly `owner/repo` on a host whose name has a dot. A port, a
  trailing slash or a deeper path such as a GitLab subgroup is refused. The only user name
  accepted is `git@` in the `git:git@host:owner/repo` form.
- Two entries for the same package are refused, even with different versions or spellings,
  because pi keeps one entry per package.
- A config may declare at most 64 packages.

**Pin a version.** A pi package runs code every time pi starts. An unpinned source installs
whatever is newest on the first pass and then stays there until you change the entry.

### Package installation and removal

Ringleader runs `pi install` for each declared source when the list changes, and records
which packages that install added. It removes only packages it recorded:

- Take a source out of the list and Ringleader runs `pi remove` for it on the next pass.
- A package you installed by hand is never removed, even if you later declare it and then
  take it out again.
- A package you removed or replaced by hand is no longer Ringleader's, so it is not removed
  again.

Filters (`extensions`, `skills`, `prompts`) are written only on a package Ringleader
installed. A package you installed by hand keeps its own filters.

The step runs over the network and can take up to 15 minutes. A failed install holds the
workstation at `Configured: False` until a later pass installs it.

## Model providers

`models` is merged into `~/.pi/agent/models.json`. Declare providers under
`models.providers`, each an object in pi's own provider format:

```yaml
toolconfigs:
  - name: pi
    config:
      models:
        providers:
          acme-gateway:
            baseUrl: https://llm.acme.example/v1
            api: openai-completions
            apiKey: $ACME_LLM_KEY
            models:
              - id: acme-large
```

Providers are merged by name:

- A provider you declare replaces one of the same name already in the file, including one
  you added by hand. From then on it is Ringleader's, so taking it out of the config
  removes it.
- A provider you never declared is left alone.

An [LLM gateway Integration](https://docs-stg.ringleader.dev/workstations/coding-agents/llm-gateways/#the-pi-and-opencode-providers)
that reaches the workstation adds a provider for its gateway the same way. A provider you
declare here wins over an Integration's provider of the same name.

A top-level key under `models` that starts with `providers.` is refused. Write
`{providers: {<name>: {...}}}` instead.

## MCP servers

`mcpServers` is merged into `~/.pi/agent/mcp.json`. pi reads that file from version 0.99.0.
Declare `version` on the [`pi` devtool](https://docs-stg.ringleader.dev/reference/tools/devtools/pi/) no older
than that, or leave it out, because the release Ringleader selects by default is newer.
Declare each server by name, as an object in pi's own format. An HTTP server takes `url` and
optional `headers`:

```yaml
toolconfigs:
  - name: pi
    config:
      mcpServers:
        linear:
          url: https://mcp.linear.app/mcp
          headers:
            Authorization: ${secret:linear-token}
```

A server name holds only letters, digits, `_` and `-`. Two names that differ only by `-` and
`_`, such as `my-server` and `my_server`, are refused, because pi reads them as one name.

Servers are merged by name, as providers are:

- A server you declare replaces one of the same name that you wrote into the file by hand.
  From then on it is Ringleader's, so taking it out of the config removes it.
- Settings pi keeps for a server, such as `enabled`, stay as pi wrote them.
- A server you never declared is left alone.
- Removing a server removes its whole entry, including what pi stored for it.

A `${secret:NAME}` value is written exactly as the Secret holds it, so pi does not run it as a
command or read it as a variable. A server an
[MCP servers for coding agents](https://docs-stg.ringleader.dev/workstations/coding-agents/mcp-servers/) registers
lands in the same file. A server you declare here wins over an Integration's server of the
same name.

## Models and your organization's policy

Your organization's policy ([Policy and OrgPolicy](https://docs-stg.ringleader.dev/reference/resources/policy/)) can limit which LLM
providers and models a workstation names. When it does, applying the config checks:

- `settings.defaultProvider` against the provider rules.
- `settings.defaultModel` against the model rules.
- Each provider name under `models.providers` against the provider rules, and the `id` of
  each of its `models` against the model rules.

A value outside the policy is refused when you apply, and the message names the field.

## `config` fields

| Field | Type | Description |
|-------|------|-------------|
| `settings` | `object` | pi settings, merged key by key into `~/.pi/agent/settings.json`. `packages` and a non-empty `enabledModels` are refused. |
| `models` | `object` | Merged into `~/.pi/agent/models.json`. Providers go under `models.providers`, each an object. |
| `mcpServers` | `object` | Merged into `~/.pi/agent/mcp.json`. Each key is a server name of letters, digits, `_` and `-`, and each value an object. |
| `packages` | `list` | Up to 64 package sources. Each entry is a source string or an object with `source` and optional `extensions`, `skills` and `prompts` lists. |

A filter list holds at most 64 entries of at most 256 printable ASCII characters each, and
may not contain `$`.

## Notes

- Ringleader creates no `pi` toolconfig for you, except to carry an Integration's LLM
  provider or MCP server.
- pi is not in the set of tools Ringleader pre-trusts folders for, because pi has no folder
  trust prompt.

