Roles
A user is a person (see users & accounts); a role is the permission set the user holds. The chain is three links: a channel identity resolves to a user, and the user’s role partitions their session, memory root, notes, workspace, grants, toolset, mode ceiling, budget, audit rows and command surface. The terminal, web panel, CLI and local API act as the operator (user operator, role admin).
Roles shipped after v0.13.0 (ADR-0002) with identities bound directly to roles; the team edition (v0.14.0, ADR-0004) puts the user between them and moves the partition key to the person. The behavior contract is
docs/contract/rbac.md.
Defining roles
Section titled “Defining roles”[tools]disable = ["tool:bash"] # profile-wide engine baseline; the admin's toolset too
[[role]]name = "member" # [a-z0-9-]{1,32}; unique; "admin" is reservedmode = "readonly" # the role's default AND its ceilingallow = ["read", "grep"] # per-turn toolset allowlist (or `disable`; never both)budget_daily_usd = 2.0 # unset: the profile's [budgets] applycommands = ["status", "help", "history", "memory"]# escalate = ["bash"] # tools that are always the admin's call (D9)# workspace = "~/projects/shared" # default <data>/users/<name>/workspace
[[role.grants.path]] # role sessions see ONLY these grantsdir = "/srv/reports"access = "allow"Validation happens at load and every violation is a hard config error: allow and disable are mutually exclusive; a workspace may not nest with the profile workspace, ka agent’s own tree (users/ included) or another role’s workspace; install, full and advisory are admin-only and refused on a role. disable and escalate entries use the engine’s spec grammar (exact hand names and mcp:<server>[:<tool>]), validated before any worker spawns.
Binding identities and users
Section titled “Binding identities and users”ka-agent user invite --role member --group dev # the account (see users)ka-agent identity link telegram 12345 --role member # default: adminka-agent identity role telegram 12345 ops # reassign (audited)ka-agent identity list # shows user + role columnsidentity link --role writes the identity’s role column and the binding to the user that role maps to (creating it on a fresh install). Once an identity is bound to a user, the user’s role is what the runtime enforces. A role that is not defined in the active profile’s config fails the command while naming the config file; an identity whose role is later removed fails closed (read-only, engine-muted), never escalated to admin. Identity changes are audited (identity.role, identity.link).
What a user’s role partitions
Section titled “What a user’s role partitions”| Surface | Admin | A non-admin user |
|---|---|---|
| Session | the profile’s session | their own session row; sessions run in parallel, one live engine each |
| Memory | <data>/memory |
<data>/users/<u>/memory |
| Notes | <data>/notes |
<data>/users/<u>/notes |
| Workspace | the config’s workspace | the role’s workspace, else <data>/users/<u>/workspace |
| Grants | [grants] |
only the role’s [[role.grants.path]] list |
| Toolset | [tools] disable |
the role’s allow or disable on top of the baseline |
| Mode | the profile’s mode |
the role’s mode (ceiling and default) |
| Budget | [budgets] |
the user’s quota, else budget_daily_usd, else the profile caps |
| Models | the catalog | the union of their groups’ models_allow |
| Knowledge | every KB | KBs their groups can read (see knowledge) |
| Commands | all | the role’s list plus the help/status floor; model follows the group allowlist |
| Approvals | decides shared, over-quota and escalate |
decides their own in-scope asks (see below) |
| Audit | username = operator |
the acting username and role on every row |
| Cron | role admin |
the creator’s user; the toolset is re-clamped at every fire. Inbound triggers follow the same rule, and a demoted user’s trigger narrows at the next fire |
Enforcement
Section titled “Enforcement”Two layers bind the toolset: disable specs are subtracted from the engine at worker spawn (fail-closed inside the engine), and a per-turn allowlist filters tool specs and rejects calls at admit. Mode is a ceiling: a looser /mode clamps to it and the worker re-asserts the ceiling after a strand replay. The __guard hook write-protects every other user’s root, every role root and the profile tree, and a user’s reads of the operator’s memory, notes, strands or store are refused. /history search, the notes tools and memory candidates resolve the acting user, so one user never sees another’s turns or proposals, and @turn:/@session: resolution honors the same rule: another user’s ids render the same not found marker as a missing one. A scout child stays inside its parent’s partition with the role allowlist intersected with a fixed read-only set, and its own asks are denied fail-closed. Durable allow-rules answer only their own subject’s non-escalated self-scope asks, within the creation mode and looser, so a rule can never lift a member above their ceiling.
A cron scheduled by a user fires as that user, and its tools may only narrow; /cron list, /reminders and /cron rm are scoped to the caller’s user. Messages never steer into or submit over another user’s live turn: each user has their own session and queue, and a busy pool queues a new user’s message for a slot instead of blocking on someone else’s turn (see sessions).
Approval routing (D9)
Section titled “Approval routing (D9)”An intent raised in a user’s turn is self-scope when the affected path is inside the role’s grants, the projected cost fits the user’s remaining daily quota, and the tool does not match the role’s escalate list. Self-scope asks surface as cards on the user’s own surfaces (their chat, their Slack or Discord DM, the panel) and their /y / /n settle them. Everything else (shared resources such as KB writes and agent edits, over-quota actions, escalate hits) goes to the admin queue with the escalation reason on the card; a foreign decision is refused and audited.
Every approved intent re-resolves the actor at execute time: a user disabled since, a role removed or a grant withdrawn means deny, an admin notice, and an approval.stale audit row, so the external write never happens. See approvals.
Delivery
Section titled “Delivery”Turn-scoped events carry their source: Telegram keeps one chat per linked sender (telegram:<uid>), Matrix one room per sender, Slack and Discord map DMs to the person. Escalations (admin approval cards, memory proposals, skill proposals, reminders) go to the admin’s chat or room; self-scope cards go to the asking user’s own surface, so a member never sees another member’s asks.
Web accounts
Section titled “Web accounts”There is no per-role browser pairing any more: ka-agent pair web and the panel’s /pair form are gone. ka-agent user invite prints a one-time code; the recipient signs in at /invite (sets their password) or /login, and the cookie reaches their own chat, history and uploads only. Every admin page answers 403 this web session is chat-only for them, and the SSE stream is filtered to envelopes stamped with their own web:<username> source. See users & accounts.
What users do not get
Section titled “What users do not get”- Their own provider keys, bot token or model catalog (one key set, one bot token per channel; the org pays, quotas slice it).
- Approval authority over shared resources, or the config/keys/persona commands;
modelis theirs only as far as their groups allow. - OS-level isolation from each other: every user runs as the same UID. Partitions are filesystem plus
__guardplus per-user engine HOME. The bubblewrap-per-engine profile exists behindruntime.sandbox_enginebut ships disabled: the ADR-0003 spike measured 2.7x startup and +12% memory per engine, past its cost gate. RBAC bounds subjects of the assistant, not hostile tenants; two hostile principals still want two instances.