# Agent capability policies

## Catalog ownership and Agent references

An Agent selects scope without copying definitions. Inheritance and enforced authority: [Configurable Agents](https://fzkuji.github.io/OpenProgram/docs/reference/design/runtime/agent-configuration/agent-configuration-ui.html).

| Catalog owns | Agent stores | Agent never stores |
| --- | --- | --- |
| Programs: callable Tools, Workflows, Applications | Policy, preset reference, explicit names and denies | Python source, expanded schemas, workflow repositories |
| Skills: procedural instructions | Mode, names/categories, exclusions | A copied Skill directory or permanently injected full text |
| MCP: connections and credentials | Allowed and required service references | Credentials, authentication cookies, server implementations |

## Policy modes and migration

| Mode | Requested set | Constraint |
| --- | --- | --- |
| `inherit` | Base policy | Resolved before discovery |
| `all` | All globally available entries | Denies and enforced ceilings still apply |
| `selected` | Explicit names and category filters intersect; Programs may instead reference one preset | `allowed=[]` means empty; preset plus explicit names is invalid for Programs |
| `none` | Empty | A deferred explicit-name load cannot bypass it |

```
effective = requested ∩ global availability ∩ caller authority
            ∩ parent delegation ceiling ∩ environment restrictions − explicit denies
```

- Missing references stay stored but are not callable.
- Required MCP references must be a subset of effective services. Contradictory patterns, wildcard denies included, are rejected.
- Skill instructions cannot authorize the tools they mention.

**Skills `selected` and legacy migration**

| Input | Result |
| --- | --- |
| `allowed` omitted, categories non-empty | Category filter alone |
| Both non-empty | Intersect |
| `allowed=[]` | No entries, even with categories |
| Both absent | Selects nothing |
| Item without a category | A declared category must match; uncategorized items keep their exemption and show as uncategorized |
| Legacy automatic | `all` |
| Legacy `disabled=["*"]` | `none` |
| Legacy non-empty allowed or categories | `selected` |
| Legacy empty allowlist | `all`, only during schema migration. With active categories it is omitted, keeping the old predicate rather than an empty whitelist. Target `selected=[]` never passes through legacy empty-is-all. |

Normalize at one boundary, not separately in UI, search and executor. Target policies have an explicit mode for Skills and MCP as well as Programs.

## Discovery, invocation and change

| Moment | Behaviour |
| --- | --- |
| Save | Stores intent |
| Run | Resolves a versioned effective scope and catalog/preset references; no full schema inventory enters the first prompt |
| `tool_search` | Searches only the effective scope and returns limited matching schemas. Explicit names and nested workflow or program calls use the same policy |
| Invoke | Rechecks revocation, availability and resource permission. A globally disabled entry stops being callable at the next boundary, even in queued or pinned runs |
| MCP outage | Optional: disables that service and surfaces status. Required: blocks admission or startup. Auth errors never connect to a different account |
| Missing names | Selectors show them until explicitly removed; saving does not erase them |
| Preset update | Affects newly resolved calls; in-flight snapshots keep their selections, subject to revocation |
| Memory tools | Also narrowed by the execution memory policy; an allowlist cannot override memory off or read-only |

## Editor

- Programs, Skills and MCP are separate; each shows mode, inherited source, effective count, missing count and a catalog action.
- Catalogs are read when their section shows; the last list read (the Skills and MCP lists are the ones their own pages keep) draws at once. Categories and presets are selectors, not copies.
- MCP adds required markers and global connection links; credentials stay outside the draft.
- The list, tree and inspector belong to [the Programs selector](https://fzkuji.github.io/OpenProgram/docs/reference/design/runtime/agent-configuration/agent-tool-configuration-ui.html).

- **Acceptance**: Selected empty is empty at search and call; denied explicit names fail; a missing required service blocks before side effects; missing references survive reload; changing tabs keeps the one draft; memory-off tools cannot execute.
- **Status**: Policy primitives exist. Target canonical modes and cross-entry enforcement are pending the [implementation plan](https://fzkuji.github.io/OpenProgram/docs/reference/design/runtime/agent-configuration/agent-configuration-plan.html).
