# Roles and Tool Permissions for AI Agents Configure roles to select system prompts, model settings, and tool grants for an AI agent, and to check effective tool permissions. This guide is for users creating local roles or inspecting the effective permissions of a tap agent. ## How Roles Work Every session runs with a role. The role determines: - **System prompt** — instructions for the AI - **MCP server access** — which tool servers are available - **Tool permissions** — which specific tools can be used - **Model profile** — optional `[roles.model]` overrides inherited from `[model]` > **Role vs. tap agent.** A **role** is a plain `[[roles]]` entry in your config, addressed by its name (e.g. > `helper`). A **tap agent** is a ready-made manifest published in a tap (a registry of agents), addressed by its name > (e.g. `developer`). A name with no matching role in your config is resolved through the registry, > fetching the manifest and merging it on top of your config. A role in your config with the same name as a tap agent takes priority over the tap agent. A tap agent tag is `` (the base agent of a namespace, such as `developer`) or `:` (a variant from a private tap, such as `acme:reviewer`; a specialty is a skill, see [Skill or Variant](../integration/04-tap-system.md#skill-or-variant)). See [Tap System](../integration/04-tap-system.md) for > details. ## Shipped Config Roles vs. Tap Agents It helps to know what actually exists out of the box. The default config ships three plain roles, and the default tap (`muvon/tap`, which resolves to the GitHub repo `github.com/muvon/octomind-tap`) provides tap agents addressed by name: | Kind | Identifier | What it is | |------|------------|------------| | Config role | `task_refiner` | Query refinement with no explicit server references | | Config role | `task_researcher` | Research helper explicitly granting `view` when `filesystem` resolves | | Config role | `reduce` | Summarization/reduction with no explicit server references | | Tap agent | `assistant` | The config `default`; prompt and tools come from its resolved manifest | | Tap agent | `developer` | Example development agent; prompt and tools come from its resolved manifest | ```bash octomind run # The config default, the tap agent assistant octomind run developer # Tap agent developer octomind run task_refiner # Plain config role ``` Tap agents are not wildcard selectors: pass an exact agent name. After startup, inspect the tools actually exposed: ```text /role /mcp list ``` ## Defining Custom Roles Add this complete role entry in `roles.toml` alongside the generated `config.toml`. Use `[[roles]]` with a `name`, not a table named after the role. Choose a unique plain name; see [Role Priority](#role-priority) for collisions. ```toml [[roles]] name = "helper" system = """ You are helpful and knowledgeable assistant. Working directory: {{CWD}} """ welcome = "Hello! Working in {{CWD}} (Role: {{ROLE}})" [roles.mcp] server_refs = ["core"] allowed_tools = ["core:recall"] ``` ```bash octomind config --validate octomind run helper ``` ### Role Fields `name`, `system`, and `welcome` define the role. `[roles.model]` is optional; every field inside it inherits from `[model]` when omitted. | Field | Type | Required | Description | |-------|------|----------|-------------| | `name` | string | yes | Role identifier | | `system` | string | yes | System prompt (supports [template variables](../reference/04-environment-variables.md#template-variables)) | | `welcome` | string | yes | Welcome message on session start | | `model` | table | no | Partial model profile; omitted fields inherit from `[model]` | | `mcp` | table | no | If present, include both `server_refs` and `allowed_tools`; if absent, both start empty | `[roles.model]` accepts every field from the main `[model]` table. **Model resolution priority.** When more than one source sets a model, the effective model is chosen in this order (highest first): ```text runtime override > role model profile > tap name mapping > [model] ``` A role's `[roles.model]` may override any subset of the complete profile. Missing fields inherit through the chain; omitting the block uses the inherited profile unchanged. For the full model-selection story see [Providers](04-providers.md). For multi-step execution outside a session, see [Workflows](09-workflows.md). ## Tool Permissions ### Server References `server_refs` lists explicit server grants. For example, replace the `helper` role's MCP table with: ```toml [roles.mcp] server_refs = ["core"] allowed_tools = ["core:recall"] ``` Empty `server_refs` removes explicit grants, but exact-match `auto_bind` servers still join the role. Interactive CLI sessions also receive `schedule` and `monitor` from `orchestration`, even when the role has no server references. That interactive addition does not itself grant `tap`. A `server_refs` entry that names a server not present in the global registry is **silently dropped** (it only produces a debug log: `referenced by role but not found in global registry`). See the note on `filesystem` below. ### Allowed Tools `allowed_tools` controls tools within explicitly referenced servers. This alternative table uses only servers declared in the default template: ```toml [roles.mcp] server_refs = ["core", "orchestration", "runtime"] allowed_tools = [ "core:*", # recall, when attention or governance is enabled "orchestration:*", # tap, schedule, monitor "runtime:mcp", # only mcp from runtime (schedule belongs to orchestration) ] ``` See [Configuration](03-configuration.md#mcp-servers) for the four builtin servers and their tool groups. `filesystem` is not declared in the default server registry. Supply it through your external MCP configuration or a tap capability before using the examples below. Tool names belong to that external server's schema; inspect them before choosing a filter: ```text /mcp list /mcp full ``` **Pattern syntax:** - `"server:*"` — all tools from a server - `"server:prefix_*"` — prefix match within a server (e.g. `filesystem:sh*` matches `shell`) - `"server:tool_name"` — one specific tool - `"tool_name"` (no colon) — backward-compat form: matches that tool name across **all** referenced servers - Empty array `[]` — no role-level filter; each registered server's `tools` filter still applies A nonempty role allowlist with no matching pattern drops an explicitly referenced server. A role filter replaces that server's `tools` filter, so `server:*` exposes all its tools even if the registry entry had a narrower filter. ### Effective Permissions There is no global allowlist fallback during role merging. When you include `[roles.mcp]`, specify both fields: ```toml [roles.mcp] server_refs = [] allowed_tools = [] ``` Tool grants are not an OS sandbox. Interactive `monitor` can execute commands; runtime tools and automatic capability activation can add tools. Project executables under `.agents/tools/` are also added independently of role allowlists when the session has MCP servers. Inspect `/mcp list` after activation or role changes. To disable automatic capability activation, edit this root key before all table headers: ```toml auto_capabilities = false ``` This does not remove interactive session tools or project-local tools. See [MCP Tools](07-mcp-tools.md) for the runtime tool surface. ## Auto-Bind Servers MCP servers can auto-attach to specific roles. For example, save this as `mcp-core.toml` in the config directory to replace the existing `core` server definition and bind it to the exact agent name: ```toml [[mcp.servers]] name = "core" type = "builtin" timeout_seconds = 30 tools = [] auto_bind = ["developer"] ``` `auto_bind` matches the role name by **exact** string. The bound server is automatically added to the role's `server_refs` even if not explicitly listed. There is a second, easy-to-miss half: - For newly added server references, if the role uses a **restricted** `allowed_tools` (a non-empty list), auto-bind also appends `":*"` to `allowed_tools`, keeping downstream consumers consistent with the added server. - If `allowed_tools` is **empty** (unrestricted), no patch is needed — everything from the bound server is already allowed. If an explicit reference was excluded by its role filter, auto-bind can add that server back. The server's own `tools` filter still applies to the auto-bound definition. Inspect the result: ```bash octomind run developer ``` ```text /mcp list ``` ## Example Roles Add these entries to `roles.toml`. They assume you have registered a `filesystem` server exposing `view` and `text_edit`; use the [external server setup](03-configuration.md#mcp-servers) with that server name and your installed executable. They demonstrate server grants, not a complete sandbox. ### Full Developer Access ```toml [[roles]] name = "developer" system = """ You are an expert software developer. Working directory: {{CWD}} Git status: {{GIT_STATUS}} """ welcome = "Developer role ready in {{CWD}}" [roles.mcp] server_refs = ["core", "orchestration", "runtime", "filesystem"] allowed_tools = ["core:*", "orchestration:*", "runtime:*", "filesystem:*"] ``` ### Analyst with a View Grant ```toml [[roles]] name = "analyst" system = "You analyze code and provide insights. Do not modify files." welcome = "Analyst role ready." [roles.mcp] server_refs = ["filesystem"] allowed_tools = ["filesystem:view"] ``` ### Documentation Writer ```toml [[roles]] name = "docs" system = "You write clear documentation." welcome = "Docs role ready." [roles.model] name = "openai:gpt-5.6-luna" [roles.mcp] server_refs = ["filesystem"] allowed_tools = ["filesystem:view", "filesystem:text_edit"] ``` ## Use Custom Roles After adding the examples and configuring the filesystem server, start each by its local name: ```bash octomind run developer octomind run analyst octomind run docs ``` The `docs` example requires an OpenAI credential. There is no plain `developer` role in the shipped config; the example above creates it, and a local role wins over a tap agent of the same name. Without that role, `octomind run developer` starts the tap agent `developer`. ### Switching Roles Mid-Session These bare names refer explicitly to local `[[roles]]` entries from the examples above: ```text /role /role analyst ``` A successful `/role` switch rebuilds the system prompt, reinitializes MCP, applies the new role's resolved model profile, and saves the role to the session. It leaves the global config unchanged. The profile application can replace an earlier `/model` or `/effort` choice; reapply those commands after switching if needed. ### Role Priority Two distinct cases — don't conflate them: 1. **Manifest vs. config name collision.** When a tap manifest contains a `[[roles]]` entry whose `name` duplicates a role already defined in your base config, the **base (config) role wins** and the manifest's same-named role is skipped (manifest merge dedups by name, base-wins). 2. **A local role with the same name as a tap agent takes priority.** `octomind run developer` then starts your local `developer` role, not the tap agent. Use a name that no tap agent has when you want both. > **Unknown plain role names are rejected.** User-supplied bare names are validated before session setup or `/role` > switching, unless the name is a tap agent such as `developer` (a local role > with the same name wins). A tag with `:` that no tap has fails with an error that lists the variants its namespace has, or says that no installed tap has it. Spell local role names exactly. ## Troubleshooting **Why is a tool missing?** Check that its server is registered, referenced or auto-bound, and matched by the allowlist. Then inspect connection status and schemas: ```text /mcp health /mcp full ``` **Why are tools present with empty `server_refs`?** Check auto-bind, the interactive `schedule`/`monitor` addition, automatic capabilities, and project-local tools. Empty explicit grants do not describe the entire runtime. **Why does a role edit remove old settings?** Multi-file config merging keeps the last whole same-named role entry. Repeat its required fields; tap merging instead preserves base entries. Validate after editing: ```bash octomind config --validate ``` ## See also - [Configuration](03-configuration.md) - [AI Providers](04-providers.md) - [Sessions](05-sessions.md) - [MCP Tools](07-mcp-tools.md) - [Tap System](../integration/04-tap-system.md)