Repository navigation
feat(team): standing agent teams with an office view - #23654
Closed
farzanshibu wants to merge 21 commits into
Closed
farzanshibu wants to merge 21 commits into
farzanshibu wants to merge 21 commits into
Conversation
Adds standing teams: a named group of role agents (manager plus members) bound to one repository, living in a single long-running orchestration Run so their mail, tasks and decision gates share one history. - Storage: schema v43 adds teams, members, hire proposals, board, inbox, automations and per-member spend tables. - Runtime: queue dispatcher sends each member its next message only when its agent is idle; paused teams/members refuse new worker starts; spend caps and tool-loop breakers pause and interrupt a member and notify the manager; mission scheduler, closing-time wind-down, and a loopback-only webhook trigger (per-team token, constant-time compare). - CLI: `orca team ...` (create/show/member/hire/mission/task/memory/ note/triggers/closing-time), advertised as orchestration.team.v1. - UI: Team page in the sidebar with an office floor, task board, inbox, memory graph, automations and capability editor. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The floor drew each seated sprite on top of its desk and name, left the break stations misaligned, and showed a blank floor with no status. - Sprites sit behind their desk (desk drawn over the legs) at 1.5x. - Each desk shows the member's name plus a status line (Working · tool, Needs you, On a break, Paused, Offline). - Open desks are drawn as dashed placeholders with an add-member hint. - Break stations share one baseline with labels above, and idle members get distinct spots so they never cover a label or each other. - Floor height grows with desk rows instead of clipping them. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Replaces the pixel-art office with a top-down apartment plan built from Orca's own primitives: kitchen, entry, living room, desks by the window, a whiteboard wall and bedrooms. Walls are the plan's grid gaps; rooms paint board or tile floors from existing tokens. Each member is an original cartoon character with a stable look. It sits in its desk chair while working or waiting (with a question badge when it needs you), wanders between the couch, kitchen, stools, whiteboard and door while idle, and rests in a bedroom while offline or paused. Desk cards keep the live screen (tool, ticket), agent icon and state dot. Characters are placed from measured anchors in the plan, so the layout stays responsive; walking honours prefers-reduced-motion. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Replace the apartment floor plan with a top-down pixel office drawn in one SVG: the lead's glass office, a meeting table, desk rows with monitors and chairs, and a break room. Monitors show each member's state (code while working, "?" when it needs you, screensaver on a break); working members sit at their desks, idle ones wander the break room, offline ones leave their desk empty. A roster strip below lists every member with portrait, status, role and current task. Geometry comes from a pure layout model instead of measuring DOM anchors, so characters can no longer drift off their rooms, and the floor re-flows to 2-4 desk columns (break room below on narrow screens). Art colors are mixed from existing tokens in both themes. The page header also gets top padding so the title is not clipped. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Bring the team branch up to date with main (78 commits). The one conflict was send-group.ts: main now precomputes agent statuses because getAgentStatusForHandle is async; the branch's team roster lookup stays beside it. Team code is ported to the async status API (queue dispatcher, closing time, snapshot and member projections) and passes the input kind main now requires for every terminal write. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rktree The manager was taught `worker-start --task --terminal <handle>`, which always failed in a git repo: each member lives in its own team-<slug> worktree, and worker-start defaults to the coordinator's. `orca team task assign --team --task <ref> --member <slug>` (and the `teamTaskAssign` RPC) records who works a task and starts it in that member's own terminal and worktree, as the manager's dispatch. It reuses worker-start through `startWorkerForRun`, the half of `workerStart` after caller and Run checks, so there is one dispatch path. When the task or member cannot start yet it returns why (deps, member busy, paused, not running, unverifiable, manager not running) instead of failing. A failed task restarts as a retry of its last Dispatch. - Schema v44: task kind (task | goal) and assignee on team_task_refs, the queue's source, a team-wide parallel limit, and the team_activity table the feed will use. - Members always launch as terminal agents. agent.launch may open a structured session, which has no pane for dispatches, the queue, or the manager's Run binding to reach. - The snapshot gains each member's current task and each task's kind and assignee. - Task refs resolve for a task filed since the board was last read. - The manager brief and coordinator-loop guide teach `team task assign`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The team page could only show mail, read newest-first every 3 seconds,
and matched it to members by their current handle. Queue deliveries,
direct sends, dispatches, and hires were not visible at all, so nothing
could show who is doing what in order.
`team_activity` now records it all under one sequence, and
`orchestration.teamActivity {team, afterSequence?, limit}` (and
`orca team activity [--after] [--follow]`) pages through it by cursor.
- Triggers record mail, task, dispatch, member, hire, and queue changes,
so no writer can be missed. Members are resolved when the row is
written (handle, pane leaf, `run:` to the manager, `dispatch:` to its
assignee), because handles change on every restart.
- Only a database that has a team carries the triggers, and `migrate`
drops them first: they name columns on the core tables, and a
team-less database must never be blocked by them on a rebuild.
- The read side merges a group send's per-recipient rows into one event,
adds the task ref and goal, names a goal's events as goal events, and
tells a reader whose cursor predates pruning to restart.
- Direct sends and assignments record who made them; the operator's
answer is attributed to the operator, not the Run mailbox.
- Task refs are numbered when the task is filed, not when the board is
next read.
- Queue items carry their source; the feed is pruned hourly to 30 days
and 20k rows per team.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…at every dispatch door Review of the task-assignment change found five gaps. - `teamTaskAssign` saved the assignee and only then ran the checks that refuse the manager, a goal, or a task already running or finished, so a refused call left the wrong assignee on the task. The checks now run first, in `assertTeamTaskAssignable`, shared with dispatch. - Only the team path refused goals. Admission now refuses them too, and it runs once in `startWorkerForRun` (covering remote starts, which skipped it) and in manual `dispatch`, so no door routes around a team. - The original failure had no real test. `worker-start --terminal` on a terminal in another worktree is now covered end to end: refused without `--worktree`, started with it. - `team_members.current_dispatch_id` was never written and nothing read it; v44 drops it. A member's current task is its active Dispatch. - The assign result is a shared type with an `assigned` field, so the UI and CLI build against one shape. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`orchestration.team.fanout.v1` was defined but never added to the list a host reports, so a client checking for it would always see an old host and fall back to the mail-only log, even against a host that serves `teamTaskAssign` and `teamActivity`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Three gaps in the team activity feed. - A group send is stored as one row per recipient and merged on read. The merge keyed on thread, sender, and subject alone, so two alike replies to the same member collapsed into one event, and a send cut by the page limit came back as two. A merge now needs a different recipient and the same body, and a full page reads on to the end of its last group send. - Decision gates never reached the feed. Opening one writes no mail, so nothing showed a question being raised or answered. `gate_opened` and `gate_resolved` are recorded by trigger; the operator's own resolve is attributed to the operator rather than the Run's manager. - A cursor past the host's newest row (another host, or a recreated database) returned nothing and no reset, so a reader sat empty until the sequence caught up. It now restarts like a pruned cursor. The roster triggers move to their own file to keep both under the line limit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…it waits on The loops that type into team members could stall or misfire. - The queue dispatcher marked a member as "sent to" and cleared the mark only when it saw the agent working. A turn shorter than its 3 s poll left the mark set forever and the member's queue never moved again. A shared turn ledger now holds one claim per idle edge and drops it on a working edge, a failed send, or after 30 s. The work scheduler will claim through the same ledger, in the order closing, queue, assignment. - The dispatcher polled a pane-title status that many agents never set to idle. It now reads the runtime's merged status and treats "cannot tell" as not idle. It wakes on the hook store's status changes, with a 5 s backstop. - Closing Time counted a member whose terminal could not be found as stopped, and waited forever on a paused member. An unverifiable member now blocks completion, a paused one is stopped once idle, the wrap-up note goes to the front of the queue, and the snapshot's `closing.waiting_on` names each member still waited on and why. - The tool-loop breaker finds a member by pane through the index rather than scanning every team. - `startTeamBackgroundLoops` returns a disposer, called on quit, that stops every loop and timer and closes the webhook server. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Team page polled every 3 s and trusted whatever came back last. - A slow response could overwrite a newer one, and switching teams showed the old team's floor under the new name. Each request now carries a generation and only the newest is applied; the snapshot is cleared on a team switch. - Every error vanished on the next poll. A failed refresh is now a quiet "Reconnecting…" line that leaves the floor as it was and marks nobody offline; a failed action stays until dismissed. - Buttons stayed live while their request was in flight. Actions are tracked by key and each surface disables its own controls. - A member whose terminal could not be found was drawn as out of office. It now stays seated with "No recent update": losing contact is not evidence that the agent stopped. - The Inbox count, the floor's "needs you" marker and the summary line each counted differently. One attention list (questions, gates, hires, permission prompts) drives all three. - Raw enum values such as pause reasons were shown as-is. They go through one label module, with a readable fallback for a value a newer host adds. - Task ownership uses the assignee, falling back to the dispatch handle. - The selected tab is remembered while the app runs. - The snapshot types gain the fields the host already sends and, as optional fields, those the goal and closing work add. - Stale runtime-catalog strings that overrode the code are gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The office floor had one set of `--tof-*` colours for both themes, so the dark theme showed a light-theme room, and a paint was any string. - `--office-*` environment tokens (floor, walls, glass, wood, carpet, paper, cardboard and the small prop hues) are defined in both `:root` and `.dark`, and every room and furniture `--tof-*` resolves through them. Skin, hair and shirt colours stay the same in both themes: they are how a member is recognised. - `OFFICE_PAINTS` gives a `Paint` union and the pixel primitive takes `c: Paint`, so a misspelt colour is a type error. - A CSS test checks every office token exists in both themes and that the floor colours go through them. - Crisp pixel edges come from CSS `shape-rendering` rather than a per-element attribute. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…le routes The floor was one room laid out afresh on every resize: desks reshuffled when the window changed width, and characters wandered through walls. - A plan with named rooms, walls, doors and anchors in three widths (narrow, medium, wide), with hysteresis so a resize near a boundary does not flap. Back wall: the manager's glass office, a conference room, a kitchen. Middle: reception, bullpen pods, an annex. Bottom: the warehouse and loading dock. Pod slots are reserved, so adding members only grows the floor downward. - Seats are stable and grouped into pods by role; adding or removing a member moves nobody else. A vacant desk opens the hire dialog with that pod's role filled in. - A walk graph through doors and aisles gives a deterministic route between any two anchors that never crosses a wall. - Names, badges and the reception sign (the team name) are an HTML layer over the art, so text stays at least 11px at any floor scale. - Each desk is a button under its character, with a hover card in place of the SVG tooltip. - The decorative roaming is gone; everyone present sits at their desk. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two page-level features, committed together because they share the page shell, the runtime client, the label module and the strings. Activity feed - The page read the team's mail every 3 s, newest first, and matched it to members by their current handle. It now follows the host's ordered activity feed by cursor: one request in flight at a time, 1 s while the floor is visible, slower on other tabs and when the window is hidden, backing off on errors. A host without the feed falls back to the mail log. - One list shows it everywhere: beside the floor (a right column on a wide page, a collapsible panel otherwise), and in place of the Inbox "Between agents" column, the Orchestrator routing log and the member room's mail list. Rows show time, who to whom, the kind, the subject and an expandable body; a kind this build does not know still renders. - Events that change the floor refresh the snapshot shortly after. Clicking a row marks the people involved for the floor to highlight. Goal composer - The header's primary action is New goal; Import template and New team move to an overflow menu. With no manager it offers Add a manager, since nobody could plan the goal. - The dialog submits on Cmd/Ctrl+Enter, disables at once, keeps errors inline, and says up front when the manager cannot be asked (paused, stopped, or a host that lacks goals). - The Tasks tab groups tasks under their goal with progress, a review state, and Close or Cancel. "Ask manager to write it up" is gone: that is what a goal does. A task can be assigned from its card and shows whether it started or what it is waiting on. - Done cards never aged off the board: the completed time is ISO, and the parser expected SQLite's format. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The floor plan's rooms were plain rectangles around the old desks. - Each room is drawn as itself: the manager's glass office, a conference room with a whiteboard large enough for a goal and its tasks, a kitchen, reception with the team-name sign and a note tray, and a warehouse with racks, a loading dock and a marked staging area. - Bullpen pods are two rows of desks facing each other across a shared block. The row facing away shows its screens; the row facing the viewer shows faces over monitor backs, with the screen state as light over the monitor's top edge. - The plan's desk geometry follows the pods: each desk records which way it faces, its surface, and where its nameplate goes; lanes run above, between and below pod rows. Routes still never cross a wall and every anchor is still reachable. - The plan gains the fixtures later work fills: a staging area for boxes, a note tray at reception, and paper spots on each desk. - Dark-theme paper and screens read from tokens rather than staying light. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A team could be handed tasks one at a time, and nothing started a task when it became ready or noticed when the work was finished. - A goal is a task of kind `goal`. `team goal create` files it and queues a planning prompt to the manager: the roster and each member's load, whether members have their own git worktrees or share a folder (split by path, no merge), and how to file tasks under the goal with `team task add --goal --assignee --deps`. - A work scheduler starts each ready, assigned task on its member. It wakes on agent status changes and every 3 s over one indexed query. One active dispatch per member, an optional team-wide limit, and different members start together. `team task assign` goes through the same path, so the limit and the one-prompt-per-idle-turn rule each have a single enforcer; the dispatch authority enforces the per-member limit too. - A failed start is retried after 1 minute, then 5; after three failures the task is escalated to the manager. A member whose terminal cannot be found waits and is never counted as a failure. - When every task of a goal is done the manager gets one review nudge and the feed records `goal_review`; adding or reopening a task resets it. `team goal close` completes the goal, or cancels it and its unstarted tasks. - The snapshot gains `goals[]` with progress, each member's `waiting_reason`, the asker of a question, the member and task of a gate, and the activity sequence. - Schema v45 adds the retry bookkeeping to `team_task_refs`. - `team update --max-parallel` sets the team-wide limit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…prove to be Standing members could not reliably talk to one another, and anything that was not a recognised member was treated as the human operator. - `@member:<slug>` and `@role:<slug>` address the sender's team — the live roster plus the manager — whether or not the sender holds a dispatch. The manager is reached at the Run mailbox, a busy member at its dispatch, an idle member at its own handle; `@role:manager` names the manager. A stopped member yields a warning, not an error. - Mail between members is filed under the team's Run, so it reaches the activity feed and the team log instead of an unbound bucket. - An idle member is told it has mail through its queue, since nothing else would make it look. - A member is no longer locked out of its mailbox after one failed dispatch. A non-member with a failed dispatch is still fenced. - When a member restarts, its unread direct mail follows it to the new terminal handle. - A member-to-member thread that passes six changes of speaker is held and escalated to the manager once, rather than ping-ponging. - Caller authority no longer fails open: no pane evidence is the operator; evidence that does not verify, or a verified pane that is not a member (including a member's own sub-worker), is an `agent` with no team authority. A same-user process with its environment stripped still reads as the operator; that gap is documented where the decision is made. - The member brief explains addressing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd what waits on you The floor drew rooms and people but nothing about the work itself. - Whiteboard: the open goal's title, done over total, and its tasks by ref, unfinished ones first. Lines are budgeted by the board's measured height, so a small floor shows fewer lines and "+N more" rather than clipping. With no goal it says "Give the manager a goal". - Desks: a ticket chip with the task ref for each member working one. - Warehouse: a box in the staging area for each finished task of an open goal, up to twelve, then a count. - Reception: a note pile on the tray and an "N waiting on you" button that opens the Inbox. The count is the same attention list the Inbox uses, so the two cannot disagree. Each is a pure projection of the snapshot with its own tests; the floor component mounts them in the following commit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Everyone sat still; mail showed as a ten-second envelope driven by a two-second re-render. - Activity events become floor beats, in sequence order, 400 ms apart, timed from when the client received them. Host timestamps never schedule anything, and history from the first load is never replayed. - A new goal: a note lands at reception and the manager fetches it. - Two or more dispatches together: one kickoff meeting, the manager at the whiteboard and the assignees at the table, then back to desks. A single dispatch: an idle assignee collects its ticket. - Handoffs and finished work are walked over with a folder. A sender who is working stays put and an envelope flies desk to desk instead, tinted by message type. A working recipient gets a badge and is not pulled away. - Questions, gates and hires for the human appear as notes at reception; group messages gather people in the conference room; a finished task is carried to the dock as a box; an idle member drifts to the kitchen. - Walks follow the plan's routes with one Web Animations call each, so they never cross a wall and can be sought to any point in time. - Each character queues at most three jobs; more collapse into "+N". After the window has been hidden for five seconds everyone snaps to where they belong. - A working member shows what it is doing (tool and target) from the agent status the app already receives. - Reduced motion keeps badges, notes and boxes and drops all walking, gathering and flying envelopes. - People named by a clicked feed row pulse on the floor. - A manual clock and event injector exist for a rendered probe; they are inert unless installed and absent from packaged builds. The floor component now mounts this and the content from the previous commit, and no longer re-renders every two seconds. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reply helper took a parameter typed as broad `object`, which the anti-slop audit rejects, so `pnpm lint` stopped there. It now takes the two shapes it actually sends: an error, or the trigger's result. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Orca can already run several agents on a task and coordinate them. This PR adds teams: a standing group of named agents with roles (a manager plus members such as "frontend" or "reviewer") attached to one repository. You hand the team work, watch it on an "office" page, and step in when an agent asks a question or needs approval.
What Changed
Before: orchestration Runs are one-off. There is no lasting group of agents, no per-agent spend limits, and no single place to see what a group of agents is doing.
After:
orca team …CLI:Mechanism:
--interruptis the explicit override.127.0.0.1. It needs a per-team bearer token, compared in constant time, and runs only while some team has a token set and triggers enabled.orchestration.team.v1, so clients can feature-detect it.Why
Most of this reuses orchestration rather than building a parallel system. Runs, mailbox, dispatch, gates and usage attribution already exist; a team is a durable layer over one Run plus membership, policy and presentation. That keeps one message/task store for the CLI, the sidebar and mobile, instead of a second agent-coordination model to keep in sync.
Linked Issue
Fixes #
Visual Proof
TODO: attach screenshots/video of the Team page (office floor, board, inbox).
Testing
pnpm tcpasses.Vitest passes: 995 tests across orchestration, team runtime, team RPC methods and team UI (new tests for the team store, breakers, work admission, queue dispatcher, spend monitor, triggers, memory, member workspace, office layout and board projection).
The changed-code quality gate passes.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Written with Claude Code (Claude Opus 5.5).
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
orchestration.team.v1hide the feature.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with Claude Code