---
url: /build/base.md
---
# Building on another agent

A definition can build on one other Pandra agent, its base, as a Dockerfile builds on the image its `FROM` names. The agent inherits everything the base's package has, and its own tables replace, add, or leave out parts:

```sh
pandra add --base ghcr.io/acme/reviewer:1.2.0
```

```toml
# pandra.toml
name = "house-reviewer"
version = "0.1.0"
description = "Reviews pull requests by our house rules"

[base]
oci = "ghcr.io/acme/reviewer:1.2.0"
exclude-skills = ["legacy-style"]
exclude-mcp-servers = ["jira"]

[[instructions]]
path = "instructions.md"

[skills.review]
path = "skills/review"
```

Use a base to adapt an agent that someone else maintains, such as your team's reviewer with your own rules, or to let several agents in one repository share a core. A [plugin](/build/components.md#plugins), by contrast, brings only skills. A change that does not alter what the agent is, such as another model, secrets, or another MCP method, needs no project: make it in your [configuration](/configure.md).

## Adding the base

`pandra add --base` takes a reference to an agent and writes `[base]` before the other tables:

| Reference | Written as | Pinned in `pandra.lock` |
| --- | --- | --- |
| A project directory: `pandra add --base ../reviewer` | `path = "../reviewer"` | Nothing: it is part of your project and is built on every build. |
| A project in a Git repository: `pandra add --base github.com/acme/agents/reviewer@v1.2.0` | `git`, `path`, and a ref, the keys of a [Git source](/build/components.md#where-components-come-from) | The digest of its package and its commit. |
| A package in an OCI registry: `pandra add --base ghcr.io/acme/reviewer:1.2.0` | `oci = "ghcr.io/acme/reviewer:1.2.0"` | The digest of its package. |

A `path` or `git` base is built from its own lockfile, so its dependencies are the ones its author locked. `pandra lock` in your project does not update a `path` base's lockfile: after you change the base's `pandra.toml`, run `pandra lock` in the base's directory, commit that lockfile too, and run `pandra lock --check` there in CI as you do in your project. Until then, the build stops with the step to take:

```text
error: pandra.toml:6: `[base]` names the agent at /home/me/agents/reviewer, whose own lockfile /home/me/agents/reviewer/pandra.lock is out of date with the base's pandra.toml (1 difference)
  [skills.review] differs from its pandra.lock entry in `tag`: v1.1.0 in pandra.toml, v1.0.0 in pandra.lock
  To update the base's lockfile, run in /home/me/agents/reviewer:
    pandra lock
```

Pandra keeps a `git` or `oci` base in your [store](/share/pulling.md#managing-your-store), so later builds work offline. Building on it needs no approval, though `pandra agent list` shows it as not ready to run on its own until you approve it. A base can have a base of its own, up to a chain of 4 bases.

## What your definition changes

| Part | Inherited from the base | With a table in your `pandra.toml` |
| --- | --- | --- |
| Instructions | Inherited, unless `exclude-instructions = true` | Your `[[instructions]]` are appended after the base's. |
| Prompt | Inherited | Your `[prompt]` replaces it. |
| Skills | Inherited with their namespaces, except those named in `exclude-skills` | `[skills.<name>]` replaces the base's skill of that name, and `[plugins.<name>]` every skill the base has in that namespace. |
| MCP servers | Inherited, except those named in `exclude-mcp-servers` | `[mcp-servers.<name>]` replaces the base's server of that name as a whole. |
| Environment variable declarations | Inherited | `[env.<NAME>]` replaces the base's declaration of that name. |
| License and notice files | Inherited with the base's name appended, so `LICENSE` becomes `LICENSE.reviewer`; entries of `LICENSES/` keep their names | Yours keep their names. A file the base brings under a name yours use, such as `LICENSES/MIT.txt`, must be the same file, or the build fails. |
| `name`, `version`, `description`, and the other top-level keys | Not taken | The derived agent is another agent, with its own identity, approval, and configuration. |

`exclude-skills` takes a skill's name with or without its namespace (`superpowers:brainstorming`). A name in `exclude-skills` or `exclude-mcp-servers` that the base does not have is an error that lists what the base has, so you notice a part that disappeared upstream. Two skills with one name, such as an inherited skill and a skill of one of your plugins, are an error that shows the table to write, as for [plugins](/build/components.md#plugins).

## What the base brings

Your own project needs no approval, its base included, so `pandra add --base` asks nothing. It shows the parts your agent inherits, each MCP server with what it is and the command it runs or the URL it connects to, and the tools each inherited skill pre-approves. It marks with `(new)` what the previous pin did not have, and each server that changed since then what it is, the check of its registry entry, the command it runs, or the URL it connects to:

```text
Added `[base]` to pandra.toml and updated pandra.lock.
  pinned base from ghcr.io/acme/reviewer:1.2.0 (sha256:85a5f7353137)

Base ghcr.io/acme/reviewer:1.2.0
  inherited:
    instructions         followed by this project's 1 entry
    prompt
    skills               legacy-style, review, triage
    MCP servers          jira, search
    env                  GITHUB_REPOSITORY

MCP servers the base brings:
  jira (new)
    Server:   npm package @acme/jira-mcp 1.0.0
    Command:  npx
    Args:     -y @acme/jira-mcp@1.0.0
  search (new)
    Server:   remote (defined by the package)
    URL:      https://search.example.com/mcp

triage pre-approves: Read (new), Grep (new)
```

`pandra lock` prints the same block when it pins the base to other content. Your own tables and the `exclude-` keys change no pin, so run `pandra agent inspect .` to see what they replace and leave out. Its output ends with the base's block:

```text
Base ghcr.io/acme/reviewer:1.2.0 (sha256:85a5f7353137)
  inherited:
    instructions         followed by this project's 1 entry
    prompt
    skills               triage
    MCP servers          search
    env                  GITHUB_REPOSITORY
  replaced by this project:
    skill review         [skills.review] (pandra.toml:14)
  left out:
    skill legacy-style   exclude-skills (pandra.toml:8)
    MCP server jira      exclude-mcp-servers (pandra.toml:9)
```

The package that `pandra build` makes holds the base's parts as its own, so whoever approves it sees every server and pre-approved tool, whichever agent it came from.

## Upgrading and removing the base

```sh
# move to another release; keeps the exclude- keys
pandra add --base ghcr.io/acme/reviewer:1.3.0
# read the same tag or branch again
pandra lock --upgrade --base
# remove [base] and its pin; the base's files stay where they are
pandra remove --base
```

`pandra add --base` and `pandra lock --upgrade --base` print the change as a diff, then the base's block again, marking with `(new)` what the previous pin did not have and each server that changed, as [what the base brings](#what-the-base-brings) says. Moving a base pinned by `rev` to its default branch with `pandra add --base https://github.com/pandra-io/pandra/examples/hello-world` prints (output abridged):

```text
Updated `[base]`
    source  https://github.com/pandra-io/pandra/examples/hello-world
  - ref     rev 5c0d7f1fe629
  - commit  5c0d7f1fe629
  + commit  2d5c8b550d65
Updated pandra.lock
```

`pandra lock --upgrade --base` moves a branch, or a tag that its publisher moved; a reference that names a digest never moves.

## Agents that share a repository

In a repository that holds several agents, a `path` base lets them share one core, such as `base/` beside `reviewer/` and `developer/`:

```toml
# reviewer/pandra.toml
name = "reviewer"
version = "1.2.0"

[base]
path = "../base"

[[instructions]]
path = "instructions.md"
```

Whoever pulls `github.com/acme/agents/reviewer@v1.2.0` gets the base from the same commit: a project fetched from Git can use local paths anywhere inside its repository, never outside it ([sharing through Git](/share/publishing.md#sharing-through-git)).
