Repository navigation
feat(workflow): run a step as a team role, and link every result to the harness that produced it - #1668
Conversation
A clone step can now name a team role (`role: review`). The steps that
continue that clone get the role's knowledge, and the member keeps the
channels their own roles grant. A code-review or planning step can then
run with the knowledge of a role the member does not hold, without
changing the member's selection or getting the role's hooks, MCP, env or
models.
What changed:
- parse: `role` is accepted only on a step that opens a clone that
installs a team. Anything else is `bad_role`, and so is a role
manifest/roles.yaml does not declare when the cache syncs.
`review --branch` warns that teamai before 0.29.0 drops such a workflow.
- drivers: a strict `can.role` capability. The local driver declares it.
Skill host profiles do not, so the step stays held with `role` in
`wait.held[].missing`. The lease carries `role`.
- checkout-roles.json in the data home records the role a copy runs
with. Writes take the file's lock. It is applied at every config load
as the runtime-only `stepRole`, and the save and the role refresh never
write it.
- namespaces: with `stepRole`, knowledge (skills, rules, agents, docs,
wiki, learnings) comes from that role and the member's projects.
Channels and discovery stay the member's. An undeclared role delivers
nothing instead of falling back. Member tags and skill exclusions do
not filter a role copy.
- clone install: checks that the role is declared at the pinned
revision, and refuses a role whose knowledge would land outside the
clone. It records the role, then checks that the child pull exited 0
and recorded a complete delivery with `selection.stepRole`. Any of
these failing is `role_unavailable`. The local driver checks again
before it launches. The overlay also covers delivered paths beyond the
agent paths, such as team docs, so a step's commit holds only its own
edits.
- records: the delivery selection keeps `stepRole`, and the pull fast
path compares it. The run observation takes it from the prepared
clone, not from the driver. The scorer `role` dimension uses
`stepRole ?? primaryRole`.
Testing:
- New e2e workflow-clone-role.test.ts, with the real CLI driven as an
external driver. Role knowledge comes in and the member's hooks stay.
The selection recorded is { primaryRole: frontend, stepRole: review }.
The step's commit holds only answer.js. The member's config and state
are unchanged. A Codex hook and `pull` / `pull --force` in the clone
keep the role.
- Unit tests for parse/cache validation, can.role holds, the role file
under concurrent writers, load/refresh/save, the namespace split,
containment over every launch tool and a docs dir outside the copy, a
failed child pull, a role that the pinned team revision does not
declare, a busy or unreadable role file (the clone is given up), the
results role dimension, and the review warning.
- npm run typecheck, npm run lint (including doc checks), npm run build,
and the clone and benchmark e2e files that share the clone install.
A team that wants to know whether a role's knowledge helps on its own tasks can now compare roles as benchmark arms: the same tool, model and team revision, with `role: frontend` against `role: review`. What changed: - suite: `role` joins `defaults`, arms and `matrix`, so an arm that changes only the role is a role arm and a matrix crosses roles with tools, models, teams and workflows. A role with `team: none` is refused, since there are no team assets for it to select. - start: each arm's role is checked against manifest/roles.yaml at the team revision the arm runs on, and an undeclared one refuses the run with `role_unavailable` before any trial exists. A roles.yaml that cannot be read at that revision refuses the run the same way, naming the parse error and how to fix it. - plan and bundle: the planned arm keeps its role, and the step that opens a trial's clone carries it, so the prompt, a workflow arm's steps and the check all continue the clone with that role. - record: arms keep `role`. A trial whose clone was delivered for another role is a deviation; one with no observed role is not verified. - history: `role` is a comparison dimension, and it joins the arm and team-change identities only when set, so role-less suites and their history keep the keys they had. A pair that differs in tool and role is no longer read as a tool comparison. - results table: `benchmark run` prints a Role column once an arm runs with a role, and a role-less arm in that table reads as the member's roles. - dashboard: each arm shows its role under its name, and in every bar, point and legend title. Compare offers Role, names a role-less side as the member's roles, and the task panel names what the chosen pair shares, such as its role. Testing: - Unit: a role suite compiles and is admitted with the role on each clone opener; suite parsing of role arms, a tool x role matrix and role with team none; the deviation check; history comparisons, team-change series per role, and pinned key literals of role-less arms and configurations; the Role column of the results table, and its absence when no arm has a role; a workflow arm with a role, whose plan and fix steps and check all continue the clone with that role; the rendered Benchmarks page in English and Chinese. - E2E with the built CLI: a suite of a frontend and a review arm gives each arm's clone only its role's skills and records the role each trial ran with; an arm whose role the team revision does not declare is refused with no run, and so is one whose team revision has a roles.yaml that cannot be read; the printed results table shows the Role column. The other benchmark arm, trial copy and clone role e2e files still pass. - npm run typecheck, npm run lint (including doc checks), npm run build.
…tool A prompt step that opens a worktree copy (`workspace: new`) or continues one (`workspace: continue`) can now name a team role. A planning step can then run with what spec writers know, and a review step with what reviewers know, on any tool, without changing the member's selection or handing the step the role's hooks, MCP, env or models. What changed: - parse: `role` is accepted on a prompt step with `workspace: new` or `continue`, besides a clone step. It stays `bad_role` on a step with no workspace, on a command step, and on a step continuing a clone. A step another file runs in a clone with a different role fails `role_unavailable` when it is leased. - lease: the engine offers each step's own role (`stepRoleOf`). A role step is held from a driver without `can.role`, and from one that does not ask `next --prepare`, since only teamai delivers a role into a copy. - worktree setup: before the base agent files go on, the copy's role is recorded in checkout-roles.json, or an earlier step's is cleared. The overlay covers the copy's knowledge places too, so the step's commit holds nothing the pull delivered. The pull now reports its outcome. A skipped or failed pull, or a record not delivered for the role, fails the step `role_unavailable` and puts the branch's files back. The local driver checks this again before launch. - overlay: in self mode the copy's inventory also covers the tracked .teamai/.gitignore its pull may rewrite, taken from the same path the pull writes, so no step commit carries it, with or without a role. - release: releasing or giving up a worktree place drops its role entry and its search index. A copy kept after a failed step keeps both. - recall: a role copy has its own index, built cold from the role's knowledge. Rebuilding it drops no other index. A member rebuild drops the role copies' indexes. A source update drops every other index, the shared one included. - record: for an external driver, a worktree role step's `agent.team` comes from the copy teamai prepared, never from the report. - dashboard: each pass in a run's Steps table shows its harness on one line (tool, model, effort, role), marks a step's own role apart from the member's, and shows the team revision on hover. - docs: guide examples in English and Chinese, the `can.role` row, the engine notes, and the `next --prepare` and `--json` help. How it was proven: - e2e on Claude, through the built CLI, with and without members.yaml: the copy gets rv-only, rv-docs and fe-guard, and not fe-only, fe-docs or rv-hook. A pull in the copy keeps them and `selection.stepRole`. The branch holds only the step's edit. The member's config, records, index and files are unchanged. The run records `stepRole: review`, a fingerprint, and rv-only in `used.skills`. - unit tests: a launched session holds the copy's delivery; a skipped preparation pull refuses a kept same-role copy; cold recall finds a role-only learning only in the copy; member tags do not filter a role copy's rules; a step in a self-mode copy whose committed .teamai/.gitignore is outdated commits only its own edit; Codex `team-rules` through the real config path returns the role's rules; OpenCode lists the rules instructions entry in the copy and commits none of it; the hold and conflict rules; the dashboard harness and its rendered line. - npm run typecheck, npm run lint, the related unit files (137 files, 3575 tests) and e2e files pass.
…endants A team sets a role once for a group of steps, or for a whole file, instead of on every prompt. A review can then fix, review and lint a change in one copy that runs as a reviewer. Precedence: a step's own role, else the nearest enclosing workflow step's, else defaults.role of the nearest workflow file. The step that opens a copy resolves the copy's role, and every step continuing the copy runs with it, commands included. A step that opens a copy of its own may take another. What changed: - parse: `role` is accepted on a workflow step and in `defaults`. A new whole-file check, over inline workflows and the files a step runs by name, refuses as bad_role a step that continues a copy with another role, a role or defaults.role no step in a copy takes, and a prompt role in no copy; it refuses as bad_session a session.from across roles. A prompt without a workspace may now name a role when the copy it continues is in the same file. - lease: stepRoleOf answers the role of the copy a step runs in. A step continuing a role copy without a role of its own now keeps the copy's role; before, its setup cleared the role and redelivered the member's assets. planWorkspace and sessionOf refuse the same conflicts for a workflow output pull never saw in place. - worktree setup: the copy's pull is forced. The base agent files replace what an earlier step delivered into a copy it continues, while the copy's record still holds that delivery, so the fast path left a continuing step without the team's skills, with or without a role. - review --branch warns about defaults.role too. - docs: a review-container example, the precedence table and the pull output in workflow.md (English and Chinese); the review-change example in workflow-advanced.md moves the role to the step that opens the copy. How it was proven: - e2e through the built CLI, local driver: a workflow step with role: review around a copy runs both prompts with rv-only and not fe-only, records stepRole: review on both, and a command check continuing the copy without a role finds rv-only there. - unit tests: the precedence through inline and named workflows, the conflicting role, the unused defaults.role and container role, the session.from across roles, a named file's step or defaults conflicting with the caller's copy, the same refusals at lease for a workflow output, and the review --branch warning. - npm run typecheck, npm run lint, 102 related unit files (3524 tests) and 10 e2e files (70 tests) pass.
A fan-out often needs a different reviewer per part: the UI change should
be reviewed with what the frontend role knows, the API change with what
the review role knows. A role could only be a fixed id, so every item of
a for_each step ran with the same role.
A step role may now be a template that reads only its item, such as
role: "{{ item.role }}", wherever an item is bound. Pull accepts it as a
template and leaves what it gives to the lease. When an item is leased,
its role is rendered from that item through the same precedence the
copy rules use, so each item opens its own copy, delivered and recorded
for its own role.
- A template that gives no string fails the item role_unavailable before
anything launches; an id manifest/roles.yaml does not declare fails at
copy setup, as a fixed id does.
- A step continuing an item's copy with another role fails
role_unavailable, and session.from across two resolved roles fails
bad_session, at lease.
- session: continue now compares the role the step runs with to the
stepRole the resumed pass recorded, as a loop may run an item again for
another item. A pass that recorded no role while the step has one is
refused rather than assumed to match.
- stepRoleOf answers a union (role, none, unrenderable), so the lease,
the held-step path, sessionOf and the report path each handle a
template that gives no id themselves instead of relying on
planWorkspace failing it first.
- The docs example check leases the way the local driver does, with
can.role and --prepare, so an example whose first step has a role is
checked too.
Tested: workflow-item-role unit tests (lease per item, continue and
session across resolved roles, non-string role), workflow-parse
(template accepted, bad templates refused, static checks left to the
lease), workflow-worktree-role (an external driver that prepares and
reports each item gets the role teamai delivered into its copy
recorded, not the team its report names), and a real-CLI e2e where two items run with frontend and review
in their own copies, each copy holding only its role's skill and the run
file recording each item's stepRole, and an undeclared item role fails
before its tool launches. typecheck, lint (with docs checks) and build
pass.
A workflow label did not say what it judged. Results joined it to the run file to find the tool, model and role, so a label whose run file was gone counted as "not recorded", and a role step could not be told apart from the member steps beside it on the Scorers page. What changed: - label: a workflow label records `agent`, the harness the judged work ran with. A prompt step takes its pass's observation, also when the pass recorded no model or fingerprint. A `workflow:` step takes the first observation of its prompt passes when they all recorded one and agree by value on tool, model, effort, definition and team; command passes are left out, and passes that disagree (a for_each whose items ran with different roles) give none. `agent` is not part of the label key, and the judge's prompt and evidence are unchanged. - sessions: adding the tool version and settling a session's agent keep the definition a capture recorded, and captures that differ in it give no agent. - results: a workflow label is counted under its own `agent`, and under the run's record only when it carries none. Labels of isolated runs stay out. The role dimension is the step's role when the pass had one. - dashboard: the Scorers page lists each failing label's harness on one line (tool, model, effort, step or member role, short team revision), opens its run while the run is listed, and says "Harness not recorded" when there is none. On a phone each failing label is a card. The runs view and the Scorers page share one harness model, `agentHarnessOf` in agent-observation.ts beside `RecordedAgent`, and one browser line in `agent-harness-view.ts` (renamed from `step-harness-view.ts`), so scorer results do not import from the dashboard. - docs: scorers guide (English and Chinese) shows a label record with its `agent`, the role grouping for a `role: review` step beside a member step, and what "Harness not recorded" means; the dashboard guide's grouping and failing-label lines follow. The docs check now pulls the complete workflow examples on the scorer pages too, as it does for the workflow pages; their unnamed `steps:` fragments are left out. How it was proven: - unit tests, each seen failing first: a prompt pass's label carries its observation without a model; a workflow step's label carries the first prompt pass's agent when its prompt passes agree, whatever its command pass recorded, and none when they differ in definition or step role or one recorded none; the judge's prompt and evidence name nothing of the harness; a label with `agent` keeps the key it had before (pinned literal) and reads back; a session keeps its definition through the version update and gives no agent when captures differ in it; results count a label under its own agent when its run is gone, still drop isolated runs, and group a role step under its role; the failing list carries the harness and the page renders it, links a listed run, and names a missing harness, in English and Chinese. - e2e: an external driver's reported tool, model and effort reach the label written through the built CLI (score-external-driver). - docs check: a misspelled key seeded in the new scorer-page example fails `node scripts/check-docs.mjs`. - typecheck, lint with the docs checks, and build pass.
The step-role mechanism spans config loading, pull, place setup, the local driver and results, and the guide pages only say how to write `role`. Record how it works and why, so a later change to any of those layers keeps the contract. The note leads with one review step and what its copy gets from the role versus what stays the member's, then follows a copy from setup through the delivery proof, launch, hooks and pull inside it, to release. It records which step decides a copy's role, the decisions behind the role/member split, the role file, containment, the forced setup pull, the per-copy search index and the results link to the harness, and why git hooks and git exclude need no role code.
The harness and role this branch added to results were hard to read. A run's Steps table was wider than the drawer, so a narrow screen hid each pass's status, score and outcome. Scorers switched its failing labels to cards by window width, so with the sidebar open at 768 px it cut off the harness and the run link. The step role and member role markers did not look like a pair, and the run drawer showed the team revision only on hover. Compare by Role gave the direction both ways and named neither role on the cost chart. - Run details: the Steps table moves into its own view and each cell names its column. Below 760 px of its own width, the drawer shows each pass as a card with its harness, score and outcome. - Scorers: the By Role and Failing labels tables switch to cards by the panel's own width, a container query instead of the window's. - Harness line: every part stays whole and the line wraps between parts. The text is 12 px. "step role" (accented) and "member role" (neutral) are the same kind of non-link marker. The short team revision is shown inline everywhere, and the full one stays on hover. The run link's arrow stays with the run id. - Scorers by Role: each group says whether its labels ran with the step's role, the member's or both. The results view model computes this from each label's `agent`. - Benchmarks Compare: the KPI reads from baseline to candidate, as the pair row and the per-task heading do. Compared by role, both ends of the cost arrow name their role. With one dimension to compare by, "Compare by" names it as text. The run legend puts each arm's role on its own line under its name. Tests: new view tests for the Steps cards and their container query. Role-source tests for the view model and the By Role rows. Updated harness-line and Compare tests. typecheck, lint, and the dashboard and scorers unit files pass (38 files, 653 tests). On the built CLI over a sandbox workspace, /api/scorers grouped by role answered frontend member, review step and spec step. The page served the new Steps table and container-query CSS.
…benchmark with production A lead who saw a role fail could not tell from the dashboard whether one harness caused it, which pass of a step changed model or role, or whether a role that wins a benchmark also holds up on real work. Each answer meant reading label by label, or joining two pages by hand. - Scorers: with a group selected, Failures by harness counts its failing labels by harness (tool, model, effort, role with its step or member marker, short team revision), the most first. The results view model counts every failing label of the group, not only the listed page. A harness's short revision splits the page at that team commit. - Run details: a pass whose harness differs from the previous pass of the same step names what changed, such as "model changed: claude-sonnet-5-5 -> claude-opus-5-5". The run detail computes it. - Benchmarks, Arms: an arm with a role shows the role's production pass rate from the Scorers labels of the same role, in the Scorers page's window and measurement, with n, and links to Scorers grouped by Role on that role. A role with no labels says so instead of 0%. Tests: view-model tests for the harness counts and the step changes, and rendered-page tests for the summary and its split, the change flags and the production line and its link, each seen failing first. typecheck, lint and the dashboard and scorer unit files pass (39 files, 681 tests). On the built CLI over a sandbox workspace, /api/scorers grouped by tool with claude selected counted two failing labels on two harnesses (spec step role, frontend member role), and the page served the new views.
A screenshot pass over the dashboard at 1440, 768 and 390 px found eight problems that predate the role work. Benchmark charts were drawn for the window's width at the time they rendered, not for their own box, and kept a 600 px minimum: at 768 the cost charts scrolled and hid an arm or the start of the arrow, at 1440 they scrolled by 82 px, and after a resize to a phone the Arms cost chart shrank its text to 4 to 5 px. Other views read wrong: a 0% meter was a near-invisible track in dark, a cost change the pair does not support showed as a win, and small labels broke or lied. - Benchmark charts (Tencent#3, Tencent#9): each chart is drawn as wide as its box. After every render of the Benchmarks page and on a window resize, the page measures each chart and draws it again if its width changed, so the text stays 11 to 12 px and nothing scrolls. The 600 px minimum width is gone. An SVG's text scales with its viewBox, so a container query alone could only choose between scrolling and shrinking. - Failing labels (Tencent#11): with a group selected, the heading names it, as "Failing labels · spec step". - Compare, Cost per passed trial (Tencent#13): neutral until the pass rates of the pair are separated, by the rule the difference card already uses. - Compare, Pass rate (Tencent#14): "100% -> 100%" stays on one line and shrinks with its card's own width (a container query). - Counts (Tencent#16): a count of one takes the singular noun everywhere the Benchmarks and Scorers pages join a count to a plural: "1 run" under an arm and in a team revision's title, "1 deviation", "1 trial reported it", "1 paired trial", "1 pair", "and 1 more file", "1 label" under the pass rate and on each side of a team commit, "+1 pt" and "1 hand-labelled session". Each uses the page's n===1 convention, with zh-CN labels. - Run drawer (Tencent#17): full width on a phone; the dialog's default maximum width left a 35 px strip. - Meters (Tencent#19): the track has a 1 px outline in the muted colour of each theme, so 0% reads as an empty bar, not as missing data. Tests: rendered-page tests for the chart widths before and after a resize, each singular count, the neutral cost and the heading, each seen failing first. Tencent#14, Tencent#17 and Tencent#19 are style only. typecheck, lint and the dashboard unit files pass (27 files, 517 tests). On the built CLI over a sandbox workspace in Chrome, resized without reloading: the Arms and Compare charts were drawn at 518, 486 and 340 px for 1440, 768 and 390 with no horizontal scroll and 11 to 12 px text, both cost points and the arrow's start inside the chart; the Pass rate KPI held one line at every width; the drawer was 390 px wide at 390; the heading read "Failing labels · spec step 1"; the arms read "1 run".
The label a submit writes and publishes carries `agent`, the harness the judged work ran with, but the answer to the submit left it out, so the person who submitted could not see which harness was judged. What changed: - a succeeded attempt's verdict keeps the settled label's `agent` beside its label, score and passed, as the answer reads them; it is copied from the label, not worked out again, and is optional, so attempt files written before read as they did. - the label summary of `score --lease <ref> --submit`, `score --lease`, `score --run` and their kept labels names that `agent` when the label has one. A lease submitted again answers it too. The judge still sees nothing of the harness. - docs: the scorers guide (English and Chinese) shows `agent` in the two label summaries it prints. How it was proven: - unit: the submit answer names the recorded agent, also for a second submit of the same lease; seen failing first (no `agent` in the answer). - e2e (built CLI, score-external-driver): an external driver's submit prints the label with the tool, model, effort and driver it ran with. - typecheck, lint with the docs checks, build, and the scoring, session, drain, entry and label store unit files pass.
…led step When a step in a workflow copy failed and the copy was kept, putting the branch's agent files back removed each delivered file but left its folder, so the copy held empty knowledge folders such as .claude/skills/rv-only/ that the branch never had. What changed: - after the restore, each folder the overlay recorded (_dirs.json) that the branch's saved copy does not have is removed when it is empty, deepest first, so a parent its children emptied goes too. A folder the branch has, one the step made, and one under a symlink stay. A folder that cannot be read or removed is left as it is. How it was proven: - unit (workflow-worktree-role): a role step in a new copy that makes an empty folder and fails leaves only that folder empty in the kept copy; seen failing first with rv-only and the teamai skill folders left empty. - typecheck, lint with the docs checks, and the worktree role, workspace, place, clone place, role copy places and team-without unit files pass.
The docs check pulled complete workflow examples only on the workflow and scorer guide pages, so a broken example on any other page, such as the review workflow in the workflow step roles design note or the shipped teamai-benchmark workflow on the benchmarks page, passed `npm run lint`. What changed: - every page under docs/guide (both languages) and docs/designs is checked: each yaml block parses, and each complete workflow passes pull unless the page shows its failure. A new page is covered by default. - off the workflow pages, an unnamed `steps:` fragment is left out, as it already was on the scorer pages; only the workflow and scorer pages must show a complete example. How it was proven: - a misspelled `rol:` seeded in the design note's example fails `node scripts/check-docs.mjs` with the unknown field and no runnable version; the same seed passes the check before this change. Reverted. - the newly covered pages hold three complete workflows (design note, benchmarks in English and Chinese), all valid; no example needed a fix. - typecheck and lint with the docs checks pass.
… tool its pull delivers to The containment check of a role copy covered only the step's tool, while the copy's pull delivers to every tool the member enables. A member with Claude and Hermes running a Claude step as role review got the review skills in ~/.hermes/skills, shared with every checkout and their user scope, and the copy's release left them there. In a role copy (a config with stepRole), locate now gives no knowledge place (skills, rules, blocks, agents) outside the copy's real path, for any tool, so the pull's writers and cleanups agree and leave such places alone. roleCopyRefusal still sees every place and refuses only when the step's tool would lose one. Setup also refuses with role_unavailable when the team's teamai.yaml does not load, instead of skipping the check. Proven by two tests in workflow-worktree-role.test.ts: with claude and hermes enabled and a `tool: claude, role: review` step, the member's Hermes skills are byte-identical before, during and after the step and the copy has rv-only for Claude (red: rv-only replaced fe-only in ~/.hermes/skills); and a base commit whose teamai.yaml does not parse fails the step naming teamai.yaml (red: it failed later, saying the pull did not deliver everything). Full unit suite, typecheck and lint pass.
… described describe built each step's offer without its role, while the engine's offer includes it, so describe no longer held what next holds. A workflow whose steps run as a team role was described as fit for the skill driver, which started it and then handed off mid-run at the first role step, after running the steps before it. describe now resolves the role of the copy each step runs in from its enclosing steps and defaults.role, as stepRoleOf does, and offers it as a driver that prepares the copy would ask. A step held for `role` makes the skill preflight route the run to the local driver with its own reason, ahead of the benchmark --sandbox one that `prepare` would otherwise give. Proven at the skill driver's describe call (workflow-skill-preflight.test.ts): a workflow with defaults.role and a copy opened by a workflow step is held for `role` at both steps, asks for `--driver local` with the can.role reason, and a start is refused without making a run (red: no held step, ask kind start on the skill driver). Workflow and benchmark unit files, typecheck and lint pass.
…unions and has no learnings fallback A role copy must know what its role defines, the same for every member (D2), and its learnings follow the role with no fallback (D4). Two paths broke that. A workspace with children applied the workspace's own skill exclusions on top of the union, so a role skill the workspace excluded was not delivered, nor counted among the push sources. And cold recall and contribute resolved a role copy's learnings by hand: a role the manifest does not declare gave the shared root instead of a refusal. Whether the member's personal filters apply is now one predicate, usesMemberFilters, at every site that applies tags or skill exclusions to delivery: the skill and rule resolvers, the workspace union, the delivered skill sources, and pull's handling of excluded skills. Learnings of a role copy go through withStepRoleKnowledge, the purpose map's resolver, which throws for an undeclared role or an unreadable manifest. Proven by two tests, red first: a workspace with children whose own config and one child exclude the role's skill now delivers it and lists its source (red: only a-tool), and resolveActiveLearningsNamespaces rejects an undeclared step role with the manifest's message (red: resolved to []). Pull, workspace, contribute, projects and recall unit files, typecheck and lint pass.
A copy's entry in checkout-roles.json goes when teamai releases the copy. Abandoning a place teamai did not make, such as an adopted host-made one, kept its entry for good, so a copy made later at that path loaded the old role. Every write of the file, recording or clearing a role, now keeps only the entries whose copy path still exists, under the same file lock. Writing is idempotent: an entry of a live copy is never dropped. Proven in checkout-roles.test.ts: after a copy's directory is removed, the next record drops its entry, a copy remade at that path loads no role, and a later clear leaves no entry of the copies that went (red: the remade copy loaded review). checkout-roles, worktree, clone and item role unit files, typecheck and lint pass.
… declares no role Worktree and clone setup read manifest/roles.yaml with every error turned into "no manifest", so a roles.yaml that does not parse failed the step with "it declares no role ... Add the role to manifest/roles.yaml", a fix that does not help. That breaks the contract loadRolesManifestIfPresent records: only absence relaxes, a manifest that cannot be read is a failure to report. roleDeclaration in roles.ts now answers whether the team declares a role as a tagged result: declared, undeclared with the ids, unreadable with the first line of the error, or missing. Worktree setup, clone install, benchmark arm start and the workflow cache sync use it, each mapping every variant, with a never check, to its own whole message that says what happened and what to do next (the cache defers an unreadable manifest to the lease, as before). Proven in workflow-worktree-role.test.ts: a run whose base commit holds a roles.yaml that does not parse fails the role step saying manifest/roles.yaml cannot be read, with the parse error, and to fix it (red: it said the manifest declares no role). Workflow, benchmark, roles and checkout-roles unit files, typecheck and lint pass.
A role step that names no tool had its copy checked and delivered for every tool the member enables. With Hermes enabled, which takes skills from the member's home, the step failed role_unavailable even though it launches Claude, and Hermes already gets nothing outside a role copy. The local driver now prepares a role step's place for the tool promptReport will launch there (the lease's tool, else the one launchToolFor picks), so setup's containment check and its delivery check cover that tool, as the check right before launch already did. A clone with no team selection of its own installs for that tool too. Proven in workflow-worktree-role.test.ts: with claude and hermes enabled, a role step with no tool: that launches claude, the run's default, now runs with the role, gets rv-only, and leaves the member's Hermes skills byte-identical (red: role_unavailable, hermes takes its skills from ~/.hermes/skills, outside the copy). Workflow and benchmark unit files, typecheck and lint pass.
Clone setup skipped the containment check of a role clone when its teamai.yaml was missing or did not parse, and went on to the clone's own pull, so the step failed later with whatever that pull printed, or ran if it somehow succeeded. Worktree setup already refuses in that case. installTeam now fails such a step role_unavailable before the role is recorded or the pull runs, with one message that names the team revision and says to fix teamai.yaml there or run the step on another revision. Proven in workflow-clone-place.test.ts: a role clone pinned to a team revision whose teamai.yaml does not parse is refused with that message, and the clone's pull is not reached (red: "its teamai pull --team-ref ... exited 3: the pull ran"). Clone, item and worktree role unit files, typecheck and lint pass.
…n to benchmark and back A second screenshot pass of the role pages found chart labels that collide or read as hollow text, a split that happens off screen, a revision left alone on a line, and production numbers that weigh 1/1 the same as 2/2. A lead also could not get from a role's Scorers row to the benchmark arms that ran with it, or see where a role started failing. What changed: - Arms cost chart and Compare arrow: each point name is placed beside its point, else under or over it, else on the other side, wherever no other name or point is, inside the chart. The hollow end of the arrow is named away from the shaft. Names have a solid fill with a panel-coloured halo; the hollow-circle style no longer applies to the text. - Failures by harness: selecting a revision scrolls the Before and after cards into view and focuses them. - The short team revision stays in one unbreakable span with the part before it, in the harness line and in Failures by harness. - Run steps cards label TOKENS in capitals like the other parts. - An arm named after its role shows a "role" marker once instead of repeating the role under its name; at narrow widths its pass rate and its production line start at the same edge. - In production: shows the 95% Wilson interval, the step/member/both marker from By Role, and the scorer at every width. While the interval overlaps the arm's it says "not separated" and the rate is not bold. Each Scorers group now carries that interval, from the same Wilson function the benchmark arms use, so there is one formula, on the server. - Scorers: the weekly pass rate is drawn at its box width like the benchmark charts (fitting moved to its own chart-fit view, run after every render and resize); the scorer table and the Benchmarks suites, runs and revision tables turn into cards by their panel's width. - Scorers By Role links a role to the benchmark arms that ran with it (/api/benchmarks now returns roleArms for the window); a link opens Benchmarks on that suite's Arms with the arm marked. - Scorers, group selected: "First failed at team revision X · last passed on Y", computed in the results view model, only when the group's labels, in scoring order, passed up to one point and failed from then on, on revisions none of the passing labels ran on. The Scorers page has no minimum label count to reuse, so production is weighed with the interval rule Benchmarks already uses to tell two arms apart, rather than a new threshold. How it was proven: - Page tests through the rendered HTML: label boxes stay apart and inside the chart at 330, 486 and 518 px; the hollow-end name is centred on or past its point; scroll and focus after a split; the glued revision; TOKENS; the role marker; the production line text and weight; the trend chart width; card tables; the role-to-arm links and the marked arm. Unit tests for each group's interval, for roleArms and for revisionChange (a clear turn, and four unclear cases). Each was seen failing before its change. - npm run typecheck, npm run lint, the dashboard and scorers test files (38 files, 684 tests) and npm run build pass. - A dashboard built from this change over a sandbox workspace, checked in a browser at 390, 768 and 1440 px in light and dark: no label overlap, no sideways scroll in the Scorers and Benchmarks tables at 768, week labels at 12 px at 390, the revision on the role's line, the split heading scrolled to the top and focused, and a By Role link landing on the marked arm.
…emplate
A step's `role` holds either a role id or a template of its item
(`{{ item.role }}`), and the two were told apart again wherever a role
was read: `isRoleTemplate` in parse-roles.ts (three call sites), the
`itemRoleTemplate` re-parse in `itemRoleOf`, and `roleTemplate` in
parse.ts. The role id itself was validated by `TOKEN` in parse.ts and a
restated regex in benchmark/suite.ts.
- template.ts: `StepRoleSpec` (`{ kind: 'id' } | { kind: 'item_template' }`)
and `stepRoleSpec`, which replaces `itemRoleTemplate`.
- workspace.ts: a `RoleLevel` carries the role its step names as a
`StepRoleSpec`, read once by `roleLevelOf`. A lease's levels hold the
id each template renders (`RoleLevel<RoleIdSpec>`), so `stepRoleOf`
and `copyRoleFailure` read ids by type. `itemRoleOf`, parse.ts and
parse-roles.ts switch on `kind` with a `never` default.
- roles.ts: `RoleIdSchema` and `isRoleId`, used by parse.ts (step role,
`defaults.role`), the benchmark suite and the plan (which keeps its
record-label limit on top).
`WorkflowStep.role` stays the string as written: run files pin
definitions byte for byte and the workflow cache is not rewritten while
a file's source is unchanged, so a stored shape change would break
definitions already cached or pinned.
No behaviour change: the role-related unit files (parse, workspace,
cache, item role, worktree role, clone place, describe/preflight,
benchmark suite, plan and bundle, scoring, captures) pass unchanged,
1259 tests in 22 files; typecheck and lint pass.
Why a step's copy did not get its role was mapped to text in three places: `worktreeRoleFailure` and `undeclaredRoleFailure` for a worktree, and `recordedRoleProblem`, `roleDeliveryProblem` and inline literals in installTeam and promptReport for a clone, over the same checkout-record and role-file outcomes. Some matches had no `never` check: the `busy ?:` and `skipped ?:` ternaries, `setUpWorktreeRole` ignoring an `unreadable` clear, the `releaseWorktreeRole` if-chain, and the negative `place.role !==` tests in place.ts. - role-copy.ts: `RoleNotDelivered` (worktree, clone, or no copy) with a gap union per copy, and one `roleNotDeliveredFailure` that maps every variant to a whole message, each match closed with `never`. `cloneRoleProblem` replaces `roleDeliveryProblem` and returns the failure, as `worktreeRoleProblem` does. - clone.ts and the local driver's launch check report gaps instead of composing a prefix with a reason. - `setUpWorktreeRole` and `releaseWorktreeRole` switch over the clear outcome; an unreadable checkout-roles.json still lets a role-less step run, as every teamai then loads no role for the copy. - place.ts: `isWorktreeCopy` answers which places run with their own role, with a `never` check over the place kinds. - The local driver works out a role lease's launch tool once, at staging, and launches it; other leases pick theirs in promptReport as before. No behaviour change: every message keeps its text. The role-related unit files plus the local driver's pass unchanged, 1420 tests in 23 files; typecheck and lint pass.
Some role_unavailable and bad_role messages were assembled at run time
from a prefix and a sentence fragment, so the text an operator sees
could not be found in the source:
- parse-roles.ts prefixed a conflict with `caller.says`, a recursive
"step X runs workflow W, whose " fragment, and spliced in `opened`
("with role R" / "without a role").
- workspace.ts `copyRoleFailure` spliced in the same `opened` fragment.
- overlay.ts appended `unrestoredConfig` to a role failure.
Each case is now one literal; only values (ids, labels, paths, the
reason git gave) are interpolated. `roleConflictMessage` switches over
who names the role with a `never` check. The clone and launch-check
messages became whole literals in the previous commit.
Text that changes:
- A conflict two or more workflow files down names the workflows it
runs through as one value: `step "change" runs workflow "outer" >
"look", whose step "note" ...` (was `... runs workflow "outer", whose
step "inner" runs workflow "look", whose ...`). One file down reads as
before.
- A worktree role failure whose branch agent files could not be put
back leads with that, then quotes why the role was not delivered.
New test in workflow-parse.test.ts pins the nested message; it failed
on the previous assembly. The role-related unit files pass, 1421 tests
in 23 files; typecheck and lint pass.
Whether two observations ran one harness was defined twice: `harnessParts`
in workflow/scoring.ts for the prompt passes a workflow label judged, and
`compared` in session-flow/captures.ts for the captures of a session,
each picking tool, model, effort, definition and team by hand. A third,
unrelated `harnessParts` in the dashboard's browser code rendered a
harness line, so the name meant two things.
- agent-observation.ts: `sameHarness(left, right, { comparesTeam })`,
beside `agentHarnessOf`, compares tool (version included), model,
effort, definition and team; captures leave the team out when one saw
it change, as before.
- scoring.ts `judgedAgent` and captures.ts `agentOf` call it.
- The dashboard's renderer is `harnessPartsHtml`.
No behaviour change: the role-related unit files plus session-flow
register and run-steps view pass unchanged, 1429 tests in 25 files;
typecheck and lint pass.
Names left behind as role support widened what they do: - review-branch.ts `invokeAliasFindings` also warns about `defaults.role` and step `role`: `newerWorkflowKeyFindings`. - protocol.ts `withPreparedClone` also rewrites the team of a worktree copy that runs with a role: `withPreparedCopy`, its comment saying so. - pull.ts `assignedRolePart` also compares `stepRole`, which no one assigns: `rolesDeliveredFor`. - parse-roles.ts booleans state their question: `isOwnDefaultRole`, `isOwn`, `isConsumed`; the message string beside them is `unconsumedMessage`. docs/dev/workflow-engine.md: the role bullet keeps the invariant and where each part lives, and drops per-caller detail the code holds. No behaviour change: the role-related unit files plus session-flow register and run-steps view pass unchanged, 1429 tests in 25 files; typecheck and lint pass.
… mock The recall test of a workflow copy that runs with a role replaced `detectProjectConfig` with a mock that handed recall a config holding `stepRole`. That skipped the part that decides it: a copy's install loading the role its setup recorded in checkout-roles.json. The test now makes a git checkout with a project install, adds a worktree at the path a workflow copy takes, records role `review` for it with `recordCheckoutRole`, and runs recall from each directory. Recording `frontend` instead makes the copy's recall miss the review learning, so the test fails when the copy does not load its role.
…opened Scorers' "Benchmark arms: suite · arm ↗" opened Benchmarks on the right suite with the arm marked, and Benchmarks' "Scorers ↗" opened Scorers on the right role group. But a page change renders from the top, and focus goes to the page title. So the marked arm was below the fold on a phone, and at 1440 only its top 43 px showed. The selected group sat 1245 px down, also below the fold. Each link now asks for its target to be shown once the page's data has loaded: the marked arm (`bench-marked-arm`) or the selected group (`scorer-selected-group`). The page scrolls it to the centre and focuses it without scrolling again. This is what a split asked from a failing harness already did for its Before and after cards. That case now goes through the same `revealAsked` and its one flag. A group the reader picks on the page itself does not move the page. The page tests record each scroll and focus. The new expectations failed on the previous code, which gave neither element an id and moved nothing.
…ighbours on a phone Three things a 390 px screen showed on the role views: - On the cost chart, an arm at 100% sits on the top line, in the same band as the "↖ better" note. Its name, placed beside it, crossed the note. The note now sits in the margin above the 100% line, and label placement treats it as an obstacle. No point or name can cover it. - On an arm's "In production" line, "Scorers ↗" wrapped onto a line of its own. It now wraps together with the window part before it. - "Benchmark arms:" sat 8 px from its first link, which read as a double space beside 12 px text. The row's column gap is now 4 px. New page tests cover the first two at 330, 486 and 518 px. Both failed on the previous code. The third is layout only.
… role code The step role code predates the lint rules main now enforces. This brings it in line without changing behaviour. - no-conditional-empty-object-spread: build the object, then assign each present field in the order the spread had, so key order and absent keys stay as they were. - no-runtime-typeof: parse with zod, jsonType, instanceof or isRead instead of checking typeof at run time. - no-known-value-widening: name the shape instead of annotating an anonymous one: Pick<GrantedTerms, 'role'>, a PullOutcome type for the pull out-param, and ChangeEnds for a harness change. - no-unknown-parameters: renderedKind takes a JsonValue. - no-array-filter-map: one flatMap in judgedAgent.
… a member with nothing to filter by A member with no role and no project to filter by resolves no filter: their workflow, prompt and scorer caches read every namespace on disk, and the benchmark suite cache every declared one. A copy of theirs that runs with a team role skipped that early return, so its member side started empty. The step role then replaced only knowledge, and every discovery type came out with no namespace: the copy found none of the member's namespaced workflows, prompts, scorers or benchmarks. Outside self mode the workflow cache is the data home's, shared by every checkout, so the copy's pull also dropped the member's own cached workflows until their next pull. That member's discovery in the copy is now what their own caches read: every namespace directory of workflows, prompts and scorers, and every declared benchmark namespace. Channels stay as the member gets them, the root files only, so the copy gets no hook, MCP server, env variable or model the member does not. The step role replaces knowledge as before. A member whose role is misconfigured, and who falls back to no filter, is treated the same. The copy's discovery and the member's workflow cache surviving the copy's pull failed before the change. A test reads the copy's env and MCP servers through their entry readers and compares them with the member's.
A clone installs the team at the revision it pins, and its setup already checks the role against roles.yaml there. Parse also checked the role against the roles.yaml pulled now. A role the team renamed or dropped after that revision was refused as bad_role, and the workflow never ran, though the clone it opens declares the role. That held for a role on the clone step and for one it takes from defaults.role or from the workflow step around it. A role that only pinned clones take is no longer checked against the current manifest. The pinned revision's check at setup decides, and fails the step role_unavailable when that revision does not declare the role. The setup test for that case already exists. A defaults.role or a workflow step's role that also reaches a new copy, a worktree, or a step whose copy this file cannot see is still checked now, since those run with the team pulled now. That check moves from parse to where the role checks follow each step to its copy. The cache tests for a clone step's own role and for an inherited one failed before the change. A guard test keeps the refusal for a new copy, a copy a workflow step's role reaches, and a defaults.role a clone shares with a new copy. The advanced guide says where the role is checked, in English and Chinese.
…g stage beside the harness With a DECIDED BY column, the Failing labels table needed 1170 px in a 1126 px box at 1440 and cut off the OPEN link until it was scrolled. Its SCORED column kept the 240 px minimum of every session table's first column, beside a HARNESS column that keeps a role and its revision on one line. This table's first column now takes the width of its date, as the compact tables' first column does. Checked in the dashboard at 1440: the table is 1126 px in its 1126 px box with the rule, and 1170 px without it. The 768 and 390 card layouts do not change.
The PR description documents sufficient testing, including a build and representative real-CLI verification at |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
The role delivery works as described. I built this head and main, and ran them on an isolated home with local bare team and app origins. The team had two roles, frontend (fe-only, a frontend rule, the fe-guard hook) and review (rv-only, a review rule, the rv-guard hook), and the member was [frontend]. With review (role: review, workspace: new) followed by implement (workspace: new):
- The
reviewcopy heldrv-onlyand the review rule only. Theimplementcopy heldfe-onlyand the frontend rule. - Afterwards the member checkout still had only
fe-onlyand thefe-guardhook,checkout-roles.jsonwas{}, and no worktree was left behind. - Two role steps running at once (
max_parallel: 2) each kept only their own role's knowledge. - After the driver was killed mid-step, the member checkout stayed clean, even after a member
pull. - The same held under a symlinked root, and for Codex and OpenCode copies.
score --runlabels carryagentwithstepRole: "review"on the review step only.- Main refuses a workflow that uses
rolewith "Update teamai". Main's dashboard reads this PR's labels and run files, and this PR's dashboard reads main's labels.
[P1 blocking] A role workflow that ends in a command step fails when Hermes is enabled
This is the CI review's P1, and it reproduces with the review-change example from workflow-advanced.md. With --agent claude the run succeeds. With --agent claude,hermes, change.build and change.review succeed, then:
✖ Step "change.test" failed with role_unavailable: Role review was not delivered into <home>/work/.teamai/workflow-worktrees/teamai-…-change-p1-…: hermes takes its skills from <home>/.hermes/skills, outside the copy, where every checkout would read them. Run the step on a tool that takes them inside the project, or without a role.
setUpWorktreeRole (src/workflow/place/role-copy.ts:349) falls back to project.enabledAgents when the step names no tool, and a command step never does, so Hermes's home skills place refuses it. The advice can't be followed, because a command step has no tool to change, and it contradicts the guide's own line that a home-scoped tool such as Hermes simply gets none of the role's skills. A step that launches no agent only reads the copy, so it could skip the knowledge-place refusal. Alternatively, it could check only the tools whose places are inside the copy, as the comment at role-copy.ts:348 already says.
[P1 blocking] CI is red at the head
Lint & Test (Node 22 on ubuntu-latest) fails this PR's own case at src/__tests__/workflow-worktree-role.test.ts:342 ("… names claude as its tool"). The outcome is failed where the test expects succeeded, and the log gives no failure code. Its sibling case passed in the same job, and the same setup on the built CLI here (one role: review step with tool: claude, Claude and Hermes enabled) succeeded 3 times out of 3. So it may be flaky, but it needs a green rerun or an explanation. Since then, Lint & Test on Node 20 and 24 and E2E shard 1/3 have also failed; their logs will be readable once the run finishes.
[P3 nit] A continuing step that repeats a pinned clone's role is checked against the current roles.yaml
This is the CI review's first P2, which I'd rate a nit: it needs a hand-written pinned clone, a role renamed later, and a redundant role on the continuing step. parse.ts:843-846 checks undeclaredRole for it, while copyRoleConflict (workspace.ts:906-913) accepts it.
[P3 nit] A role copy's pull can leave the member's search index stale
This is the CI review's second P2, which I'd also rate a nit. When a role copy's pull advances the shared team clone, dropIndexesAfterRebuild (search-index.ts:44-47) returns early, so the member's recall stays stale until their next pull, which session start runs anyway.
Notes
- The label
agentblock reverses the 2026-10-22 note on #1137 ("a workflow label … carries no copy of it").docs/designs/workflow-step-roles.mdrecords why, which is fine. - Not run here: clone-step roles and benchmark role arms. The new e2e files cover them in CI.
…ember enables A command step that continues a copy running with a role sets up a copy of its own, with the role and no tool. Setup then checked the knowledge places of every tool the member enables, and the delivery of the role to each. With Hermes enabled, whose skills live in the member's home, the step failed role_unavailable, though a command launches no tool to read them. A review step followed by `npm test` in the same copy could not run. Setup and its delivery check now cover the tools the step launches: a prompt step's tool, or every enabled tool when the lease names none, and none for a command. The team docs must still land inside the copy, as its pull writes them whatever the step runs. The worktree role test of a command step that continues a role copy, for a member with Claude and Hermes, failed before the change.
… at the clone's revision A step that continues a clone may name the clone's own role. Parse checked that role against the roles.yaml pulled now, and exempted only the step that opens the clone. Once the team renamed the role after the revision the clone pins, the workflow was refused as bad_role, though the clone's setup checks the role at that revision. A step's own role is now checked with defaults.role and workflow-step roles, where the role checks follow each step to its copy: against the current manifest when a copy of the team pulled now takes it, and left to the clone's setup when only a pinned clone does. A role on a step whose copy a calling workflow opens is still checked now. The cache test of a step that continues a pinned clone failed before the change. With the moved check disabled, the guard that refuses an undeclared role on a new copy goes red.
A workflow copy that runs with a role keeps its own search index. Its pull may move the team clone or the learnings checkout that every index reads, but its rebuild dropped no other index. The member's recall and other copies' kept serving what those sources held before, while a member's pull drops the other checkouts' indexes (Tencent#808). A role copy's rebuild now drops every other index, the shared one included, as a contribution does. Each rebuilds from its own roots and selection when recall next reads it. The unit test that pinned the old rule now pins this one, and failed before the change. The worktree role e2e no longer compares the member's index file, which the copy's pull now drops, but what the member's recall returns: the member's docs before and after the step, never the role's. The design note says so.
The local driver offers a step that names its tool only a tool it finds on PATH. The Hermes test names claude, so on a runner without Claude Code the step failed tool_unavailable before it reached the role copy. A fake claude on PATH stands in for the session.
…e pull The Codex session-start hook in the clone runs its pull detached, and that pull holds the sync lock until it is done. The member's pull run right after it could find the lock held, skip, and exit 1. The test now waits for the hook's detached pull first, as the other session-start tests do.
|
All three findings above are fixed in
|
The guide said a role step leaves the member's index unchanged. The copy's pull may move the team repo that index was built from, so it now drops it, and the member's next recall rebuilds it from their roles.
|
All four findings are addressed as of
|
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Both blocking findings are resolved. I reran the review-change example from workflow-advanced.md with the built CLI and --agent claude,hermes: it now exits 0 with all four steps succeeded, where 91437bb failed change.test with role_unavailable. A prompt step that names no tool still refuses a role when Hermes is enabled, as intended. The CI failure explanation matches the code: the local driver offers a named tool only when it is on PATH, and the E2E failure was the session-start hook's background pull still holding the sync lock. The pinned-clone role check and the member's recall after a role step are covered by the new tests.
Approving, provided CI is green at this head. The Windows job failed on a 15 s timeout in hooks-windows-bash.test.ts, which this PR does not touch. It passed at 91437bb, and the same timeout appeared on #1607, so it needs a rerun.
[P3 nit] A role step drops every other search index even when the team did not move
Each role copy's pull now drops the member's index and every other role copy's, whatever changed. A workflow with N role steps makes the member's next recall rebuild cold N times. With max_parallel above 1, a role step loses its index whenever another one sets up. Results stay correct; only recall speed suffers. Dropping the indexes only when the team or learnings revision changed would avoid it.
The earlier worktree-command, inline pinned-clone, and search-index scenarios are resolved. The PR description documents sufficient testing: build plus representative real-CLI verification. Older verification commits and coverage deferred to CI are not blocking. No PR code was run, built, or installed. |
|
The CI review's P1 and P2 above, and |
…ones, named workflows, members.yaml (#1672) Three role failures left over from #1668 are fixed. A `role:` clone whose first step is a command now opens, and the role is checked for the tools each step launches. A pinned clone that runs a named workflow checks the continuing step's role at the revision it pins, not at the current team. A clone whose `team.selection` names roles that `manifest/members.yaml` at its revision does not assign now fails `clone_prepare_failed` and says what to change, instead of silently installing other roles.
Summary
Every workflow step ran with the member's own roles. A review step on Alice's machine got her
frontendskills and rules, not the team'sreviewones, and a plan step could not use the skills aspecrole keeps. Results could not say which harness produced them either: a label recorded a run and a step, not the tool, model, team assets and role it judged.Now a step names a team role, and the copy it runs in gets that role's knowledge. Hooks, MCP, env and models stay the member's, so the step stays inside the member's guardrails. Every label records the harness it judged, benchmarks gain role arms, and the dashboard compares a role's benchmark with its production results.
What the step's copy holds:
reviewstep aboverv-only, notfe-onlyfe-guard, notrv-hookfe-docs, notrv-docsrolealso works on a clone step, asdefaults.role, on aworkflowstep for every step it runs, and perfor_eachitem (role: "{{ item.role }}", rendered when the step is leased).How it works: the role is part of the copy's checkout selection. Every config load in the copy applies it, so pull's existing writers, hooks and the local driver deliver the role for every tool with no per-tool adapter.
What moved:
Dashboard
Workflow Runs: each pass names the harness it ran with: tool · model · role, marked as a step role or the member's, · team revision.
Scorers: group by Role. A step role and a member role are told apart, each role links to the benchmark arms that run it, and Failing labels lists failures by harness.
Benchmarks, Arms: an arm can run as a role. Under each arm, "In production" shows that role's labels from real runs for the same scorer, with a link to them.
Benchmarks, Compare by Role: two arms that differ only in role, trial by trial.
Light theme
Tablet (768) and phone (390), dark and light
Links between pages land on what they open
review-sql · frontendarmreview→ ScorersType of Change
Test Plan
npx tsc --noEmitpassesnpm run lintpasses, including the docs checks and every workflow example in the guides and the design notenpx vitest runpasses: 687 files, 21441 tests, 24 skippedAlso:
npm run test:e2e -- workflow-clone-role workflow-worktree-role workflow-container-role workflow-item-role benchmark-team-arms score-delivered-run-1247: 6 files, 24 tests pass.gitlabandgithubproviders: left to CI. The e2e files above cover clone, worktree, container andfor_eachroles with a fake tool. A unit test (workflow-worktree-role.test.ts) covers a role copy's OpenCodeinstructions.Real-CLI verification
Built from this branch (
npm run build) and run on 2026-11-02 with Claude Code 2.1.316, macOS and Node 24.21.0: sections 1 to 3 at91437bb9, section 4 at24032ea2andefd55e00.Setup. This used a throwaway HOME.
team.gitandbilling.gitare local bare repos, reached throughinsteadOffromhttps://github.com/acme/{team,billing}.git.~/work/billingis a small Node app:src/customers.jsandsrc/invoices-query.jsbuild SQL by concatenation, andtest/holdsnode --testtests. The member ranteamai init … --role frontend. The team repo declares three roles:frontendfe-onlyrules/frontend/ui.mdfe-docsfe-guardreviewrv-onlyrules/review/review.mdrv-docsrv-hookspecsp-onlyrules/spec/spec.mdsp-docs1. A workflow whose steps run as different roles
workflows/plan-and-review.yamlis the example at the top:planasspec,implementwith the member's role,reviewasreview. Each step isworkspace: newunder a strict sandbox.The skill each step's Claude session was given, read from its session log:
Each branch holds only the step's own edit:
planhasPLAN.md,implementhassrc/customers.jsandtest/customers.test.js, andreviewhasREVIEW.md. Of the team skills, the member's checkout still has onlyfe-only, andcheckout-roles.jsonhas no entry for any copy of this run.2. Labels name the harness they judged
After the same for
review,--nextanswered{"idle":{"open":0,"leased":0}}.These counts include labels from earlier runs in the same sandbox.
3. Benchmark arms that run as a role
benchmarks/review-sql/suite.yamlsetsdefaults: { tool: claude, model: fast, role: frontend }and has two arms:frontend, andreviewwithrole: review. It has two tasks, each checked by anode --testfile.4. A command step that continues a role copy, for a member who also enables Hermes
Hermes reads skills from the member's home, so a role cannot reach it inside a copy. A command step launches no tool and needs none of them. The member enables
claudeandhermes, andworkflows/review-and-test.yamlrunslook(a prompt) and thentest(npm test) in onereviewcopy:Before (
91437bb9), the command step was refused for a tool it never launches:After (
24032ea2):The
review-changeexample fromworkflow-advanced.md, run as written with the same member atefd55e00, also succeeds:change.buildandchange.reviewwithstepRole: review, thenchange.test.Not covered by a real run: clone steps with
roleother than benchmark trials, andfor_eachroles. The e2e files above cover them.Related Issues
Related to #1137: the harness as a benchmark arm dimension.
Notes for Reviewers
Reading order, 39 commits:
9e8bd38d…81c10afcdefaults.roleandworkflowsteps,for_eachitems, labels that carry the harnessed8d8b15docs/designs/workflow-step-roles.md: the mechanism, the lifecycle and each decision5f05b556694a6c872833b63e9860a3d9729632c491437bb9dc0728bcteamai score --submitnames the harness it judgedfix(workflow)commitsb4171c45d6d41f57be58504fac999da9d2e71f2a63f06412mainenforces since #16641cbe083befd55e0052af63504f129b2dclaudeon PATH, and the session-start hook's detached pull joined before the next pull7cff613ffixes dashboard defects that are already onmainand that these screenshots showed: benchmark charts, labels and meters at tablet and phone widths. It is a separate commit, so it reads on its own.force(deliverTeamAssets), role or not. The base-config overlay takes back what an earlier step's pull delivered, while the copy's record still holds that delivery, so the fast path would deliver nothing. That is one full pull per worktree step. A role copy keeps its own search index. Its pull drops every other index, the member's included, since it can move the team clone or the learnings checkout they all read. Each rebuilds when recall next reads it.roles.yamlat the revision the clone pins, when the clone is set up, and failsrole_unavailable. That covers the clone step's own role, a step that continues the clone, and a role it takes fromdefaults.roleor aworkflowstep. A clone pinned before a role was renamed still runs. A role that reaches a step running with the team pulled now isbad_roleat sync, as before.role,defaults.role, a label'sagentand a record'sstepRole. Older teamai strips them when it reads a label or record. A team that commits a workflow withroleneeds teamai 0.29.0 on every member's machine. Earlier versions drop that workflow, andteamai review --branchwarns about it.team.selection.primaryRoleis overridden bymembers.yaml. This was reported on feat(benchmark): run benchmark suites as a default workflow #1379 and does not affectstepRole.