Repository navigation
feat(workforce, core, engine): every worker on one shared copy of its flow (FIX-1788 P4) - #2866
Conversation
…resource tools reach (FIX-1788 P4 S8) A flow's optional resourceVisibility rule narrows every model-facing listing and lookup in core: the resource tools, search, the discover door's resource source, path and uri resolution. A hidden resource answers exactly as an unregistered one; a read-only one is read and not written. With no rule nothing changes. Generic: the rule names no worker (FIX-1788 D7, the epic's seventh Layer 1 mechanism). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
…donly value (FIX-1788 P4 S11, BR-18b) A key-derived child that already exists with another value of a readonly session-state field than the dispatch names is refused key-occupied, naming the field, instead of running as the stored value. Covers the visibility rule end to end on the real engine too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
…oster and pins removed (FIX-1788 P4 S7 S8 S10 S11 S14) hireWorkforce(installation) registers one copy of each worker flow and the roster flow, and mints nothing per worker. agent on an installation loads its turn's worker in request.onStarted, keeps each worker's skills drawer apart, narrows each turn's model to the worker's document grants through the installation's resourceVisibility, refuses a turn whose input names a worker, and signs mailbox posts as the turn's worker. The mailbox wake keys each member's conversation by worker and the task lookup births each task's session naming its worker, for standard workers. workerFlow(...) builds a flow kept in its own file on its installation. Removed: the seat-hire capability and blocks, registerHiredSeat, the boot reload and repair, the hired-roster collections, seat addresses and listedSeatRows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
…ions name their worker (FIX-1788 P4 S12 S15) Roster reads the signed-in person's roster through createWorkforceClient (useWorkforce) beside the standard workers. A seat's conversation is the person's newest session on its flow naming the worker, opened naming it before the first line. The DevTeam Lab, its fixtures and tests run one copy per worker flow, with hire and fire as the chief of staff's tools over the person's roster. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
…P4 S15) The specialists are standard workers on one registered agent copy; the roster panel talks to workers through sessions that name them. The hire-plane admin flow and its reload report are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
…ane goals retired (FIX-1788 P4 S15, VG, V7) goals/workers-as-resources/keeps-each-users-workers-their-own is the issue's goal, with its org-scoped-workers and no-create-check controls. The grants goal grades what each worker's model reaches on one copy, with a no-visibility-rule control. Goals that asserted a copy per worker move to the installation or are retired in goals/README.md, each naming the rule that replaced it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
…isibility (FIX-1788 P4 S16) Hiring and forking replaces the runtime-hire page; Workers on disk gains Talking to a worker and the shared-copy flow contract; every example builds an installation. Resources gains resourceVisibility. The workforce, shift-manager and cli READMEs follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
…FIX-1788 P4) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 2d9a6974-fbc3-4c9b-82be-9ed8a449ce96) |
…cked composer
The composer is blocked from the first render ("Reading the conversation first…"), so findByTestId could return before the failed read re-rendered it. Ported from 1665993 on fix/FIX-1791-coordinator-flow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
…E2E on the worker model (FIX-1788 P4) Every worker runs on the one agent copy, so a run's flowId is agent for all of them; the working row now names the worker the wake ran, read off its key. The rail and talk specs move to the worker model: the rail opens the agent kind into its one copy, a conversation starts from the roster panel's Talk, and which worker a conversation belongs to is read by the session's workerId. The rail's per-seat leaf detail is gone from the app, so its layout check goes with it; the VG check reads the roster panel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
Plainer intros, refusal shapes on Hiring and forking, an approval step that is optional where it is, no undefined owner pins, a React example without await in render, what fork copies, what a worker with no resources: reaches on a shared copy, and the glossary's workforce rows. The memory wording waits on the product owner's call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
…working memory per worker (FIX-1788 P4) The product owner's call on BR-23: on the shared agent copy, long-term memory (episodic, semantic, digest) is kept per person and shared by that person's workers, never across people; skills are kept per worker and working memory per conversation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 322790fe-8a33-4b9d-bc79-d8c51746379b) |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 9f4fa630-de36-4265-993d-a94760f250c1) |
There was a problem hiding this comment.
Code Snob — already tight. No POC.
I read packages/core/src/types/resource-visibility.ts, packages/core/src/tools/resource-tools.ts, packages/engine/src/context/dispatch-run.ts, packages/workforce/src/workers/register.ts, worker-flow.ts, installation.ts, verified-worker.ts, hire.ts (mintSeats), agent-worker-flow.ts, mailbox-post-capability.ts, mailbox/wake-member-seats.ts, worker-lookup.ts, packages/shift-manager/src/lib/workforce.ts, conversation.ts, surfaces/Roster.tsx, and apps/kitchen-sink/workforce/hire.ts.
A rewrite would not shrink the contract. reachableEntries is already the one place the visibility rule runs; isLlmWritableNow has to look the access back up because a collection instance is not a registry entry. postToMailboxFor already shares the two mailbox capabilities, and the two exports are the two callers (a minted copy signs seatId, a shared copy signs the loaded worker). seatConfigOf falls back so a minted agent copy still reads flow.config; workerConfigOf throws so a custom flow cannot silently do that — one function would drop one of those. mintSeats stays the configuration check (same words on save, hire, and turn); hireWorkforce only adds one copy per flow plus the roster flow. The unattended-board loop is the same helper on both entry points, and the attendance tests still drive mintSeats. useWorkforce is the recorded package-boundary split. standardSeats flipping standard to reuse ownSeats is a local trick, not a smaller roster contract.
Left the recorded calls alone: per-person long-term memory, standard workers only on wakes and task lookup, createSession rather than ensureWorkerSession, and FIX-1810.
Sent by Cursor Automation: Code Snob
There was a problem hiding this comment.
Problem this PR solves
Durable hire, per-worker flow copies, and the roster/seat-hire stack made “add a worker” a registration and pinning ceremony. P4 flips that: workers are data, one registered copy per flow kind, and the engine refuses adoption when readonly session state (e.g. workerId) would disagree with an existing child session.
On balance this is a large net simplification (~23k lines removed). The remaining complexity is real but mostly localized (installation + per-turn resolve + resourceVisibility), not another distributed registry.
Did the approach go too far?
Mostly no for the product goal. Deleting roster/seat-hire and kitchen-sink workforce-admin is the right trade: fewer moving parts at boot, no owner pins, V9 registration story is clear (hireWorkforce → register kinds + roster flow).
Where complexity moved instead of vanished (worth tracking, not blocking):
-
Per-turn
mintSeatsinresolveWorker(installation.ts~303–323) — deliberate single path with hire/fork/edit (good for parity), but it keeps the heavyhire.tsmint pipeline on the hot path. The inline cost note helps; if this ever shows up in profiles, the cleaner follow-up is a config-only validator shared with hire blocks, not an ad-hoc cache without parity tests. -
Three cooperating mechanisms on one shared copy —
markVerifiedWorker/seatConfigOf, flowresourceVisibility, and minted seat resources for grants. Tests give confidence; long term, document one invariant (“model tools =granted; block code = full registry”) to keepreaches()andgrantedaligned. -
Dual
defineAgentWorkerFlowmodes (installationset vs legacy minted copy) — branches for mailbox signing,flowConfigSchema,request.onStarted, etc. Reasonable for a phased epic; treat installation-bound as the end state and plan to narrow or gate the legacy path.
Simpler approaches considered
| Alternative | Upside | Why this PR didn't need it |
|---|---|---|
Session workerId + row read without mint |
Lighter hot path | Loses “same refusal words as hire” unless checks are duplicated |
Request-scoped config instead of WeakMap |
One read path | WeakMap avoids cycles; keeps attribution off session state (BP-031) |
hireWorkforce returns Record<kind, FlowInstance> |
Clearer than mergeSeatFlows |
Docs/naming follow-up |
| Engine-owned registration | Fewer app steps | Correctly rejected; coupling guard stays clean |
| Third-party registry package | Less custom code | Nothing generic fits FSD adoption/readonly semantics |
I don't see a different top-level approach that is clearly cleaner without giving up S5/S6 or the readonly adoption guard.
Targeted simplify notes (file anchors)
register.ts:26—createCheck === installation.createCheckis fragile if session is wrapped; optional symbol/tag marker.register.ts:61—as unknown asmint; small typed helper on coreFlowType.installation.ts:320— broadtry/catcharound mint may surface programming errors as hire refusals (narrow if you've seen that in practice).resource-tools.ts:38—reachableEntriesre-scans registry per tool call; memoize per request if large document maps show up in profiles.agent-worker-flow.ts—installation === undefinedbranches are the main ongoing tax;request.onStarted→resolveTurnWorkeris the right resume-safe hook (confirm no double-mint on resume ifonStartedfires again).
Organization / docs (non-blocking)
workers/ is crisp; hire.ts still carries mint + seat vocabulary while registration lives next door. Package docs (mergeSeatFlows, inventory) still say “seat/hired roster” in places — easy to misread now that registered ids are flow kinds. Terminology sweep in a follow-up PR.
Verdict
Approve. Direction matches FIX-1788 P4; tests and goals moved with the cut. Notes above are follow-ups, not a request to re-architect before merge.
Sent by Cursor Automation: Review For Best Approach
| export function chiefOfStaffRosterTools(installation: WorkerInstallation) { | ||
| const blocks = createWorkerHireBlocks(installation); | ||
| return { | ||
| hire: sequencer({ |
There was a problem hiding this comment.
why is this a sequencer if its just one step? It can be just the step itself.
There was a problem hiding this comment.
The wrapper only renames the step and gives it a description. The step itself is Workforce's workforce-hire block, which has no description. The chief of staff's tools: line calls it hire, and the agent flow refuses a catalog entry whose key doesn't match its block's own name (assertOneNamePerCatalogEntry, because that name is what the model sees and what tools: authorizes). So hire: blocks.hire would fail at startup, and the model would also get no description. Core has no way to rename or re-describe a block, so a one-step sequencer is the only way today. setWorkstreams above, already on main, is the same wrapper for the same reason.
My recommendation: keep it in this PR, and add a small core method in a follow-up. Something like block.as({ name, description }) would return the same block under a model-facing name, and this would become hire: blocks.hire.as({ name: "hire", description: "…" }). That removes hire, fire and setWorkstreams here, plus whatever else wraps for this reason. Doing it in this PR would add public core API to an already large switch and re-run its CI, and the rest of the epic is waiting on this one.
Say the word and I'll file the follow-up, or I can fold it in here if you'd rather.
Generated by Claude Code
There was a problem hiding this comment.
Filed as follow-ups:
- FIX-1811 adds
block.as({ name, description }). - FIX-1812, blocked by FIX-1811, sweeps the codebase for one-step rename wrappers (
hireandsetWorkstreamshere) and replaces them.
Generated by Claude Code
|
FIX-1797 milestone (FIX-1805): green on FIX-1788's merge commit. Shift Manager's DevTeam install, two signed-in users (Alice, Bob), real model, goal from #2864 (
Generated by Claude Code |


The problem
Today every worker a user hires is its own registered copy of a flow, pinned to its owner. A hire or a fire reaches other processes only after a restart, and the copy-per-worker model is what FIX-1788's privacy work replaces: a worker should be data its owner holds, run by one shared copy of the flow it names. P1 and P2 built the parts beside today's model; nothing switched over yet.
What this does
This is the switch. Every worker now runs on one copy of the flow it names. A user's own workers are rows in their own data, so a hire, fork or fire is seen by every process on the next turn, and nobody else can list, open, run or create a session with them. A session names its worker once, when it is created; every turn loads that worker.
resourceVisibility) narrows each turn's model to the documents its own worker's file grants. Any other document answers exactly as one that doesn't exist, through every model-facing tool, an app's own included.agent. Each worker keeps its own skills drawer on the shared copy.forkandhirereachable throughcreateWorkforceClient. Its Roster screen lists the signed-in person's own workers.What's asked of you
This implements the approved direction (FIX-1788 D3 to D7, approved by the product owner), with one call the product owner made during review: on the shared
agentcopy, long-term memory (episodic, semantic, digest) is kept per person, shared by that person's workers and never reaching another person. Skills are kept per worker, and working memory per conversation. BR-23 is being amended to match, and per-worker long-term memory on shared flows moves to a follow-up issue, FIX-1810. Nothing else here is yours to decide.Parts worth reviewing closely
packages/core/src/tools/resource-tools.ts:reachableEntriesis the one place the rule applies. Every listing, lookup, write target and the discovery door's resource source go through it. Check nothing model-facing still enumerates the registry around it.packages/workforce/src/workers/installation.ts: the rule Workforce supplies (resourceVisibility), and the verified worker it reads. A turn that loaded no worker reaches no granted document.packages/engine/src/context/create-request-host.tsanddispatch-run.ts: the adoption refusal (BR-18b). Only fields the dispatch names are compared.packages/workforce/src/agent-worker-flow.ts: the worker is loaded inrequest.onStarted, so a resumed turn still runs as its worker; strict input refuses a turn that names one.packages/workforce/src/worker-lookup.tsandmailbox/wake-member-seats.ts: board tasks and mailbox wakes reach standard workers only. See the engineering calls.Spec · Linear FIX-1788 · epic FIX-1786 · milestone FIX-1805 (goal on #2864) · merges (last PR of the FIX-1788 stack; P1 #2850 and P2 #2856 are on main)
How to review this
Engineering calls
defineFlow({ resourceVisibility: (ctx, { name, ref }) => "visible" | "read-only" | "hidden" }), definition-only, synchronous, naming no worker (D7 left the name to P4). It composes withllmReadable/llmWritable: it only narrows. A write to a read-only collection is refused as for a path no collection matches.createSession({ state: { workerId } }), notensureWorkerSession. Its conversation rule (the newest direct session, FIX-1793 BR-14) excludes sessions a post or a run started;ensureWorkerSessionreturns the most recent match whichever started it. Same check, same refusals; the Roster lists throughcreateWorkforceClient(...).roster().useWorkforcelives in Shift Manager (src/lib/workforce.ts):reactmay not importworkforce, norworkforcereact. The public docs show theuseMemoform.agentis per person (the product owner's decision). Per-worker long-term memory on a shared copy would need the memory package to take a key per turn, a framework change outside the epic's seven, so it is out of scope here and moves to a follow-up issue, FIX-1810. BR-23 is being amended to match: per-worker skills and per-conversation memory, with long-term memory per person.isolateUserStatekeeps its per-flow meaning and doesn't separate workers on the one copy; its doc comment, the built-in page and the README say so.flowId: agent. The E2E specs moved to the worker model: the rail opensagentinto its one copy, a conversation starts from the roster panel's Talk, and which worker a conversation belongs to is read by the session'sworkerId.hireWorkforce(workers, { references }),{ documents }) now namescreateWorkerInstallation.main, then review fixes on top; intermediate commits of the first seven don't each typecheck (the workforce change breaks its consumers until their commit).{ hire, fork, edit, fire }and the roster flow (workforce-roster) comes registered fromhireWorkforce, so an app defines noroster-adminflow; React builds the client withuseMemo(no package hook); the visibility rule's real name isresourceVisibility.Everything else
Against the P4 row
agentagent-worker-flow.ts); BR-23 inagent-drawer-seeded-worker.test.tsand VGa:own-memoryresourceVisibility; Workforce supplies it from the verified worker;agent-grants-per-turn.test.ts,engine/test/resource-visibility.test.ts, V7 goalhireWorkforce(installation): one copy per flow plus the roster flow, no per-worker copy, no pin (V9:worker-registration.test.ts)session-birth.test.ts); wake keyed by worker; task lookup births the child naming its worker;writtenBy.workerIdand mailbox lines signed by the turn's worker; the inventory lists standard workers onlyroster-screen.test.tsx,workforce.test.ts); conversations keyed by flow and worker (conversation.test.tsx,chief-of-staff.test.ts)registerHiredSeat, boot reload,brokenSeats/rehire, hired-roster collections, seat addresses,listedSeatRows: removedgoals/README.md, each naming the rule that replaced itresourceVisibility), every Workforce page's examples; READMEs; changesets: core minor, engine minor, workforce minor, shift-manager minorVerification
The goal runs and checks below were re-run at
4f477d81e. The verdict-log rows in the goals were recorded at9ea11deff; no code a goal reaches has changed since apart from Shift Manager's test and kitchen-sink's working row.pnpm tsx goals/workers-as-resources/keeps-each-users-workers-their-own/run.mtsGOAL_CONTROL=org-scoped-workersb:reads-worker(Bob readsmy-desk,scribeon his roster),b:createwith it; leg a greenGOAL_CONTROL=no-create-checkb:create(Bob's create naming Alice'sscribewrote a session),b:other-flowwith it; leg a greenmainac39e7c14)mainrefusesagentas one copy for every worker ("seatId": Required)pnpm tsx goals/workforce-seats/a-seat-reaches-the-documents-its-file-names/run.mts(at9ea11deff)deskcopy, three workers with different grants, each reaching only its own; another worker's document answers as a missing one through core's tools and the app'speekGOAL_CONTROL=no-visibility-rule(at9ea11deff)the first worker's model lists the second's document: engineering.lead lists ["payroll"], with (b) to (e) redGOAL_ONLY=milestone pnpm tsx goals/workforce-privacy/two-users-share-a-project-and-nothing-else/run.mts(goal from #2864, not committed here)chief-of-staffthroughforkonworkforce-rosterand her Roster screen draws it; Bob is refused at every reach and his Roster doesn't draw it; Alice's second org sees none of itorg-scoped-workers, run by the goalmain(ea91beb49, #2864's log) failed m1: noworkforce-rosterflowpnpm typecheckpnpm --filter <pkg> testplaywright testagainst the test-mode build, no retriestalk-from-page"the routed specialist shows as working" (it read "agent is working")conversation.test.tsxwaitFor)pnpm --filter docs build🤖 Generated with Claude Code
https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
Note
High Risk
This rewires workforce identity, session birth, and per-turn resource exposure—areas that gate multi-tenant privacy and dispatch correctness—with broad API removals and doc-driven behavior changes.
Overview
Workforce moves from one registered flow copy per worker to one shared copy per worker flow, with each user's hired/forked workers stored as user-scoped roster rows (
workforce-rosteractions andcreateWorkerInstallation/hireWorkforce(installation)). Sessions name aworkerIdat creation; turns load that worker and narrow model access viaresourceVisibilityin core (hidden/read-only/visible per resource). The engine refuseskey-occupiedadoption when a key-derived child session already exists with a different readonly state value instead of reusing it.Removed the old seat-hire plane: per-seat registration pins,
reloadHiredSeats, hired-roster collections,seatAddress,createSeatHireCapability, and related inventory/runtime-hire docs. Mailbox wakes and task lookup target standard workers only; Shift Manager registers installation flows and lists the signed-in user's roster.Docs, changesets, goals/fixtures, and app wiring (kitchen-sink, DevTeam) are updated to match.
Reviewed by Cursor Bugbot for commit 4f477d8. Configure here.