0024 - Per-Organization Team Hierarchy, and Escalation Through It¶
Status¶
Accepted by the owner on 2026-10-27 (proposed 2026-10-26 in Taskbase task #1741, a follow-up
of the Paperclip research #1728: Skatzi/taskbase docs/paperclip-research.md §3.3, §4 rank 1 and
§5). The v1 implementation tasks at the end were created on acceptance.
Built 2026-10-27: v1 tasks 1–8 (#1763–#1770) are done; task 9a, the repository read scope (#1771),
is not, so repo_read is stored but not applied. The shipped behaviour is documented in
Team and
Triage up the reporting line.
This ADR amends ADR-0005 (an organization selects and constrains the shared personas), and touches ADR-0007 (review routing, deferred here) and ADR-0008 (cost shown per role and subtree; budgets stay deferred). It does not supersede any of them.
Date¶
2026-10-26
Context¶
The owner wants (task #1741):
- each organization to define its own hierarchy of agent roles, and
- that hierarchy used to make the process more automatic, so less ends up with the owner.
What exists today¶
Read on 2026-10-26 from this repository's Taskbase docs (docs/content/contribution/components/taskbase/)
and ADRs, Skatzi/skatzi-agents personas/, and the research report above.
- Personas are kinds of work, shared by every organization (ADR-0005,
amended 2026-09-26):
agent_typeskeyed by(organization_id, slug), synced fromSkatzi/skatzi-agents. Task personas today:analyst,developer,junior-developer,operator,project-manager,reviewer,senior-developer,technical-writer; session personas:assistant,attention-helper,request-builder. - The structure is prose. Who gets which work is a table in
personas/project-manager.md("Assign each implementation task to the developer persona that fits it …"). Other personas create follow-ups for "the persona that fits". - Nothing limits delegation. An agent run reaches its task's organization through run-scoped
access and may use the organization's data routes, so it may create or reassign a task for any
persona (Run-scoped access). The only
structural rules are the review-persona guard and
required_labels(operatorruns only onrole=opsrunners). - Escalation is fixed and flat. A stuck task raises a Needs attention item and a Mattermost
notice at once (Attention). Every
minute, a task assigned to an agent other than
operatorwith an open item gets one triage task foroperator(modellarge, labelrole=ops), at most 3 per task and 5 open per organization (Triage up the reporting line, #1457). The triage run may requeue and comment on that one task (#1669). Whatever it cannot fix stays with the owner. - Decisions always go to a person. A decision task is a person's task (
assignee_type1) withdecision.questionandoptions; it raisesdecision_needed(Decision tasks). - There is no owner role inside an organization. A grant on an organization gives full access to it (Authorization); global admins reach every organization. "The organization's owners" in this ADR therefore means the people holding a grant on it, notified through its Mattermost mention list.
- Review is set per project: one
review_personareviews every task of the project (ADR-0007); "reviewer persona chosen per task" is deferred there. - Usage is recorded per run and reported per persona, task, project and model, as an API-equivalent cost (ADR-0008); per-organization limits are deferred there.
- Routines (#1737, in progress) will create tasks on a schedule from a template.
How Paperclip does it (for comparison)¶
From the research report (Paperclip at commit 507dc70): every agent row has a role enum, a free
title and reports_to; delegation is creating a task for another agent; escalation is reassigning
to the manager with a comment; tasks:assign_scope limits assignment to the agent's own subtree
(server/src/lib/agent-permissions.ts); issues.request_depth counts delegation hops. The report
advises against copying named agent instances, agents hiring agents, the C-suite enum and timer
heartbeats (§3.3, §4).
Scope¶
In scope: the roster's data model and who edits it; how it relates to ADR-0005; which automations use it in v1 and which later; the guardrails. Out of scope: spend budgets (report rank 2, an ADR-0008 amendment of its own), routines themselves (#1737), an owner/member distinction inside an organization, and any code.
Options considered¶
A. Where the hierarchy lives¶
- A1 — Per-organization roster table in Taskbase that selects and constrains shared personas (chosen). One row per role an organization uses, pointing at a shared persona. The job description stays in Git; the structure (title, manager, who it may assign to, paused) is the organization's data.
- A2 — Hierarchy in the agents repository (
reportsToin persona frontmatter, as Paperclip's team packages do). Rejected: personas are shared by every organization, so one file cannot hold Skatzi's tree and miki-research's at once; it would bring back per-organization agents repositories, which ADR-0005 dropped on 2026-09-26. - A3 — Named agent instances ("Alice, tech lead") with their own model and settings. Rejected for now: it is ADR-0005's deferred instances, whose trigger ("distinct named workers within a type") has not fired, and it needs a new assignment target on tasks.
B. How a task maps to a role¶
- B1 — One role per persona per organization (chosen). The task's assignee persona is its role, so tasks, claims and usage need no new column.
- B2 — Several roles per persona, tasks assigned to a role. Allows two leads with their own
developer pools, but adds
assignee_role_idto tasks and a choice at every assignment. Deferred (see the table at the end).
C. How escalation reaches the manager¶
- C1 — Reuse the triage task, assigned to the manager role (chosen). The #1457 sweep and the #1669 guard rule already exist; the change is who the triage task is for and what happens when it ends.
- C2 — Reassign the stuck task itself to the manager, as Paperclip does. Rejected: the task loses its assignee, model and run history context, and Needs attention would have to track a task whose persona keeps changing.
- C3 — Notify the manager persona and let it poll. Rejected: agents act only through tasks (ADR-0005 principle 3); nothing should act without a task.
Decision¶
Chosen: A1 + B1 + C1. Each organization keeps a roster of roles over the shared personas. In v1 the roster limits who an agent run may assign work to, can pause a role or the whole organization, and sends work-related Needs attention items up the reporting line before they reach a person. Decision rights, review routing, a planning cascade and lead check-ups are specified below but come later, each behind a trigger.
1. The roster¶
organization_roles
id BIGSERIAL PK
organization_id → organizations.id
persona_slug TEXT, → agent_types(organization_id, slug); UNIQUE (organization_id, persona_slug)
title TEXT NOT NULL -- free text: "Tech lead", "Research lead"; no enum
reports_to → organization_roles.id NULL -- NULL = reports to the organization's people
may_assign TEXT[] NULL -- persona slugs; NULL = any (today's behaviour)
active BOOLEAN NOT NULL DEFAULT true -- false: its tasks stay queued, not claimed
repo_read TEXT NULL -- task | organization | served; NULL = the persona's default (§6)
updated_at, updated_by
organizations
agents_paused_at TIMESTAMPTZ NULL, agents_paused_by TEXT NULL -- organization-wide pause
Rules:
- Only task personas can be roles; session personas (
kind: session) cannot. - The default tree is today's behaviour, without rows. A task persona with no row behaves as a
role titled with the persona's name, reporting to the organization's people,
may_assignNULL, active. The Team tab shows these virtual roles; editing one stores its row. New personas synced from Git therefore join every organization's tree as before, and nothing changes until someone edits it. - The top of every tree is a person.
reports_toNULL means the people holding a grant on the organization. A role may only report to a role of the same organization; writes that would create a cycle, or a chain deeper than 3 roles below the people, are refused with400. - People only. Reading the roster is open to the organization (agents included, so a run can see
whom it may assign to). Creating, editing and deleting roles and the organization pause are
humansOnlyin the guard: agent runs and session turns cannot change the tree or create roles. Personas themselves still come only from reviewed pull requests toskatzi-agents. - A persona removed from Git (
agent_types.is_activefalse) keeps its row but is shown as inactive; roles reporting to it are treated as reporting to its manager (fallback, §3).
Relation to ADR-0005. The roster selects and constrains shared personas; it does not define
per-organization personas. Persona text, kind and default_model stay as ADR-0005 defines them.
The amendment to ADR-0005 is one paragraph: an organization may store structure over its personas
(title, manager, delegation list, pause), which ADR-0005's "each extension is additive" allows. Its
key principle 2 ("the brain … doesn't dispatch to specific reviewer agents") was already relaxed by
ADR-0007; this ADR relaxes it again only for which persona a triage task is for.
Examples.
| Organization | Tree |
|---|---|
| Skatzi | people → Project manager (project-manager) → Senior developer, Developer, Junior developer, Technical writer, Analyst; Operator (operator) reports to the people directly |
| miki-research | people → Research lead (project-manager, may_assign: [analyst, technical-writer]) → Analyst (analyst, may_assign: []) |
| Emmalia | people → Tech lead (senior-developer, may_assign: [developer, junior-developer]) → Developer, Junior developer |
2. Delegation rule (v1)¶
When a request authorized as an agent run (X-Taskbase-Run) creates a task with an agent
assignee, or changes a task's agent assignee (POST /api/projects/{id}/tasks, PUT /api/tasks/{id},
and the MCP tools create_task and update_task), the guard looks up the run's role — the role of
the persona the run runs as: the task's assignee, or the review or triage persona for those runs.
The assignment is allowed when the target persona is:
- in the role's
may_assign, ormay_assignis NULL; - the role's own persona (follow-ups of the same kind);
- the role's manager's persona (handing work up is escalation, never refused);
- or there is no agent assignee: a person (decision and person tasks) or unassigned.
Otherwise 403 with forbidden: <title> (<persona>) may assign tasks to <list>; leave it unassigned
or give it to <manager persona>, the same shape as #1669's triage refusal. People and a person's
confirmed session plan (ADR-0016) act as the person and are not
limited; the roster is still shown to session assistants so their drafts follow it. A paused target
role is not a refusal: the task is created and waits.
The project manager's claim gets the roster (title, persona, manager, may_assign, active) so its
routing table comes from data; the persona keeps the judgement of which role fits the work.
3. Escalation up the reporting line (v1)¶
The triage sweep (#1457) keeps its schedule, item kinds and per-organization limits. What changes is whom the triage task is for, by the item's reason:
| Class | Reasons | First goes to |
|---|---|---|
| Run health | run_failed, run_cancelled, run_lost, usage_limit_exhausted, runner_restarts_exhausted, unclaimable, review_persona |
operator, as today: these are about runners, CI and the claim guards, not the work. review_persona means the task is assigned to the review persona by mistake (guard), so "the task's role" would be the reviewer's role and its manager the wrong one to ask |
| Work | task.question, review_blocked, review_rounds_exhausted, review_out_of_date, no_pull_request, pull_request_unreviewed |
The task's role's manager role; with no manager (the default tree) operator, as today |
| People only | decision_needed, blocking_agent_work, pull_request_unlinked, incident_flapping, incident_waits_for_person, decision_unplanned, every runner.* kind, and any item whose run named a needs_person reason (below) |
The organization's people, at once, as today |
A manager triage run may, on the one task it triages (extending #1669's rule):
- requeue it, and comment on it (an answer to a question is a comment followed by a requeue);
- reassign it to a persona in the manager role's own
may_assign(§2); - split it: create tasks within its
may_assign,follow_up_ofthe triaged task; - escalate: finish without resolving the item.
Comments and requeues are signed <title> via Taskbase triage, as #1669 signs operator.
One level up. When a triage task finishes and its item is still open, Taskbase creates the next triage task for the manager's manager, with the previous triage run's summary in its description. When the next level is the people, the item stays with them. An escalation does not need a special verdict: an unresolved item moves up by itself, so a run that crashes or gives up escalates too.
Straight to a person. Some reasons only a person can act on. A run that stops for one ends its
handoff with a new key, needs_person, set to one of credentials (logins, keys, accounts),
payment (a paid plan, a licence), physical_access (hardware, a machine, a cluster console),
owner_decision (product direction, spending, external communication, access control) or
destructive (an irreversible step). Its item skips triage and goes to the people with that reason
shown. A triage run may set it too, which ends the climb at once. This needs a new handoff key in
agent-runner and the persona instructions.
Mattermost. Today the notice goes out when the item is raised. For an item routed to a manager
role, the notice is held while an agent level has it, and is sent when the item reaches the people
(top of the tree, a people-only reason, a guardrail below) or after 4 hours, whichever comes
first. Items routed to operator keep today's immediate notice, so the default tree notifies exactly
as before. The Needs attention page shows every item at once, with "with Tech lead (triage #n)" on
those an agent level holds, and a person can act on any of them at any time.
4. Guardrails (v1)¶
- Hop limit and bounce. One item gets at most 3 triage tasks, one per level of the deepest allowed chain; the per-task lifetime limit moves from 3 to 6 triage tasks. A reassignment back to a persona the task already had during the same item counts as a bounce and sends the item to the people. The existing per-organization limit of 5 open triage tasks stays.
- Fallback. A manager role that is paused, whose persona is inactive, or that no runner serving the organization (seen within 24 hours, with the persona's labels) could claim, is skipped: the triage task goes one level further up. With no level left, the item stays with the people.
- Pause. A paused role's tasks stay
queuedand are not claimed; an organization pause holds all its agent tasks. The board shows the reason ("paused by dunk at 10:12"). A run in progress is never stopped, the same rule as subscription holds (ADR-0011). A paused role is skipped for triage (above). - Audit trail. Every action is a task, a comment, a requeue or an assignment change, signed with the role's title and logged with the triage task and run id, as #1669 logs. Nothing acts without a task.
- Cost. Each management step is a run. The Team tab shows, per role and per subtree, the API-equivalent cost of the last 30 days, with triage runs as their own figure so the cost of the hierarchy is visible (ADR-0008 data, no new recording). Budgets that stop work stay deferred (research rank 2).
5. The Team tab (v1)¶
An organization tab Team shows the tree: title, persona, default model, active or paused, open
and queued tasks, and the 30-day cost per role and subtree. People with a grant on the organization
edit titles, managers, may_assign (picked from the organization's task personas, with "any" as the
default), repo_read (§6) and the pause switches; agents and session turns only read it.
6. Repository access per role (v1)¶
Added 2026-10-27 at the owner's request. Today a run reads whatever its runner's Gitea account can read: the task's repository is cloned, and the agent's Gitea token reaches every repository that account sees. Nothing decides this per kind of work. Chat sessions are separate: ADR-0023 (decision #1662, A + docs) gives a session its own project's repository plus the platform docs.
The roster records how far a role may read, as repo_read:
repo_read |
Reads | Default for |
|---|---|---|
task |
the task's repository (cloned, as today) and the platform docs | developers, technical writer, analyst, reviewer |
organization |
every repository linked to a project of the task's organization, read-only | project-manager, so it can plan across projects |
served |
every repository of every organization the runner serves, read-only | operator, which works across the platform |
Rules:
- Read only. Writing stays as today: a branch and pull request in the task's repository only.
- Wider reads go through Taskbase, with the read tools that ADR-0023 adds for sessions (list tree, read file; later search). For a run, Taskbase allows a repository when it is within the run's role scope, using its own token. That avoids per-run Gitea credentials, which Gitea 1.27 cannot scope to repositories (ADR-0023's finding).
- Organizations may narrow or widen it per role in the Team tab (people only), e.g. an
organization whose project manager should only see its own project sets
task. - The runners' own Gitea accounts are not narrowed in v1. Until they are,
repo_readis what Taskbase grants and what the personas are told to use, not a hard wall against a run using its runner's token directly. Narrowing them is deferred (below).
7. Later, with their design and triggers¶
Each of these is specified enough to be planned, but is not part of v1.
7.1 Decision rights per role (decides) — later. A role gets decides, a list from a fixed
set: technical (an approach within the documented architecture), task-split,
dependency-upgrade (only Renovate classes standard and breaking; never stateful or core),
research-scope. A decision task created by an agent run carries an area; when a role (other than
the creator's own) decides it, the decision task is assigned to that role's persona and answered by a
run, recorded with the role's title, and listed in a daily digest the people can reverse. A decision
with no area, or in any area outside the set, goes to a person. Never delegated, and never in the
set: product direction, spending and budgets, credentials and accounts, external communication,
irreversible or destructive actions, access control. Trigger: v1 escalation has run for four weeks
and decision tasks in those areas are still a large share of what the owner answers. Needs its own
ADR-0024 amendment for the decision-task schema change.
7.2 Review routing (reviewer_role) — later. A role names the role whose persona reviews its
work, instead of the project's review_persona; the project setting stays the default. Only a
persona written to review (verdict line, merge rules of ADR-0007) may be chosen. Trigger: ADR-0007's
deferred "reviewer persona chosen per task" — tasks in one project need different reviewers. Amends
ADR-0007's deferred table.
7.3 Planning cascade — later. The people give a goal to a top role; it writes epics and delegates
each to a lead, which breaks it into tasks within its may_assign. Guardrails: tasks record
origin_task_id and request_depth (0 for a person's task, the creating run's task + 1 otherwise),
recorded first for two weeks and then enforced with a depth limit and a per-run fan-out limit set
from what was recorded; a refusal is 409 and the run stops for a person. Trigger: an organization
has two or more lead roles with their own reports, so one project manager is no longer the only
planner.
7.4 Leads look after their subtree — later. With routines (#1737), a lead role gets a scheduled task to check its subtree (stale tasks, failing runs, blocked dependencies) and act within its rights or escalate. It creates tasks only, so it stays pull-based. Trigger: #1737 is built and v1 is in use.
7.5 Budgets per role and subtree — later, in an ADR-0008 amendment (research rank 2).
What is not proposed¶
- Per-organization personas or named instances (ADR-0005's deferred items; triggers unchanged).
- Agents editing the tree or creating roles.
- A fixed C-suite role enum: titles are free text.
- Agents woken on a timer without a task (conflicts with ADR-0005/0006 pull-based dispatch).
Consequences¶
Positive¶
- The routing that is prose today becomes data the API enforces; a developer run cannot hand
production work to
operatorunless the organization allows it. - Work-related items reach a manager agent first; the owner hears only about what the agents could not resolve, what needs a person by its nature, or what took over 4 hours.
- Each organization shapes its own team without its own agents repository.
- Nothing changes for an organization until it edits its tree.
Negative¶
- More runs: every escalation level is a
largetriage run. The Team tab shows that cost, but nothing caps it until budgets come. - A held notice can delay the owner by up to 4 hours on an item an agent level cannot solve.
- A strict
may_assigncan block a legitimate follow-up; the refusal names the manager, so the work goes up instead of being lost. - One role per persona means two teams in one organization cannot have separate developer pools.
- Triage gains a branch per reason class, and the guard a roster lookup on assignment.
What we deferred (and what would trigger adding it)¶
| Concept | Trigger to add |
|---|---|
| Several roles per persona, tasks assigned to a role (option B2) | An organization needs two leads, each with their own pool of the same persona |
| Decision rights (§7.1) | Four weeks of v1, and delegable decisions still a large share of the owner's answers |
| Review routing (§7.2) | Tasks in one project need different reviewer personas |
| Planning cascade with depth and fan-out limits (§7.3) | Two or more lead roles in one organization |
| Lead subtree check-ups (§7.4) | Routines (#1737) built, v1 in use |
| Budgets per role and subtree (§7.5) | Several organizations share runners and spend needs a ceiling |
| An owner or member role inside an organization | Organizations whose people should not all be able to edit the tree |
Narrow each runner's own Gitea account to its roles' repo_read (a hard wall, §6) |
Runners dedicated to one role, or a Gitea version with repository-scoped tokens |
Implementation tasks¶
The v1 tasks were created on 2026-10-27, when the owner accepted this ADR; their Taskbase numbers are in the last column. The later ones wait for their triggers. Sizes: small, medium, large.
v1
| # | Task | Repository | Size | Depends on | Taskbase |
|---|---|---|---|---|---|
| 1 | Roster data and API: organization_roles, the organization pause columns, virtual default roles, cycle and depth checks, CRUD for people, read for agents, MCP list_roles |
Skatzi/taskbase | medium | — | #1763 |
| 2 | Team tab: the tree with title, persona, model, state, tasks and 30-day cost per role and subtree; editing for people | Skatzi/taskbase | medium | 1 | #1764 |
| 3 | Pause a role or the organization: the claim skips their tasks, the board shows the reason | Skatzi/taskbase | small | 1 | #1765 |
| 4 | Enforce may_assign for agent runs on task create and reassign (403 naming the allowed personas), roster in the project manager's claim |
Skatzi/taskbase | medium | 1 | #1766 |
| 5 | Escalation routing: reason classes, manager triage tasks, one level up on an unresolved item, extended triage-run rights, hop and bounce limits, fallback, held Mattermost notice | Skatzi/taskbase | large | 1, 7 | #1767 |
| 6 | The needs_person handoff key: accept and pass it on in the finish call |
Skatzi/agent-runner | small | — | #1768 |
| 7 | Accept needs_person on finish and route those items straight to the people |
Skatzi/taskbase | small | 6 | #1769 |
| 8 | Personas: the project manager plans from the roster; manager triage instructions; needs_person in every persona's "Stopping for a person" |
Skatzi/skatzi-agents | medium | 4, 5 | #1770 |
| 9a | Repository read scope per role: repo_read on the roster and in the Team tab, persona defaults, applied by the ADR-0023 read tools for runs (repository argument checked against the run's role) |
Skatzi/taskbase | medium | 1, ADR-0023 read tools | #1771 |
| 9 | Document the shipped behaviour: Team, delegation rule, escalation, pause (Taskbase component docs here) and amend ADR-0005/0007/0008 status lines | Skatzi/platform | medium | 5 | #1772 |
Later (each after its trigger, §7)
| # | Task | Repository | Size |
|---|---|---|---|
| 10 | Decision routing by decides, with the never-delegated list and the daily digest (ADR amendment first) |
Skatzi/taskbase | large |
| 11 | Review routing by reviewer_role |
Skatzi/taskbase | medium |
| 12 | Planning cascade: record origin_task_id and request_depth, then enforce depth and fan-out |
Skatzi/taskbase | large |
| 13 | Lead subtree check-up as a routine template | Skatzi/taskbase | small |
| 14 | Budgets per role and subtree (ADR-0008 amendment) | Skatzi/platform, Skatzi/taskbase | large |
Links¶
- ADR-0005 — Taskbase Agent System (amended by this ADR)
- ADR-0007 — Agent Code Review and Merge
- ADR-0008 — Agent Usage
- ADR-0010 — Taskbase Attention and Attention
- ADR-0016 — One Agent Chat Page
- Authentication and authorization
- Taskbase tasks #1728 (research), #1741 (this ADR), #1457 (triage), #1669 (triage-run rights), #1737 (routines)
- Paperclip research report: Skatzi/taskbase
docs/paperclip-research.md