Repository navigation
Description
Item 6 of 11 in the Personas v2: simpler specialists milestone. It ships with or before #743 (auto-approve new Crews and additions without approval).
The problem
I want agents to grab a saved persona when one fits, without me setting up every worker by hand. But once agents are picking personas, and Crews can auto-approve and add members without asking, nothing stops an agent from handing a persona more than it has itself:
- more access than the agent is running with;
- models I left unchecked on purpose.
Today, a thread agent that spawns a persona with j5_spawn_agent gets the persona's own access, whatever the caller's is. The user docs even say so: "Spawning is not limited by the spawning agent's own access" (docs/j5/user/personas.md). And personas are the one case allowed to use models outside Models for custom members.
Where this sits
This is decision 1 of the Personas v2 proposal. Bastian's comment "Make launch authority explicit and enforce it everywhere" tightened it. It also narrows one Crews v2 decision: the "personas can use their own models" exception now applies only to personas a person picked.
What we already have
j5_spawn_agent:apps/server/src/j5/a2a/SpawnAgentService.ts:367-395. A persona's runtime mode replaces the caller's. Only outside MCP agents are capped, throughassertPersonaWithinApprovedLevel(apps/server/src/j5/a2a/mcp/outsideAgent.ts:118).delegate_task:apps/server/src/j5/agents/agentDelegation.ts:63-100. A plain child is held to the eligibility list (memberModels.assertEligible). A persona child skips that check and goes toinvokeAgent(agentInvocation.ts). The docs say a persona subagent "cannot broaden the parent's permissions". Check whether that's actually enforced, and where.- Crew launches and additions:
CrewLaunchService.tsandCrewRuntimeRequestService.tsinapps/server/src/j5/a2a/. A human-approved card can setruntimeModeOverrideon the assignment ("Human-approved crew access"). - Eligibility list:
apps/server/src/j5/agents/crewMemberModels.ts(CrewMemberModels.assertEligible), configured inapps/web/src/j5/crew/CrewMemberModelsSettings.tsx, from Crews: choose which models custom members can use #744. - Assignment:
OrchestrationV2AgentPersonaAssignmentinpackages/contracts/src/j5/agentPersona.ts:89. It records the resolved route, but not who picked the persona.
Proposal
Who picked the persona sets the limits.
An agent-picked persona:
- uses only the entries in its list that are also on the eligibility list;
- can't have more access than the caller's effective sandbox, meaning the runtime mode the caller's thread actually runs with, not the access its own persona declares. A caller with no persona is compared the same way.
If no entry meets both limits, the launch fails with reasons and the caller escalates (#785).
A person-picked persona keeps today's exception: it can use its own models even if they're unchecked, and it gets its saved access. A person picked it when it came from:
- an
@personamention; - a Crew roster card the person approved, edited or not, since the card shows each member's model, reasoning, and access;
- a member the person edited.
Auto-approved rosters and Captain additions always count as agent picks.
Every persona worker records its pick source:
- a person;
- an agent;
- an "Allow this once" exception (Personas: a blocked persona escalates, and I can allow it once #785), with the constraint it waived.
One service method owns this check, and every launch path calls it:
j5_spawn_agent;delegate_task;- Crew launches and additions;
- scheduled tasks that reach any of those.
That way no path can skip it.
Acceptance criteria
- The persona assignment records its pick source: person, agent, or allow-once with the waived constraint. Old assignments without it still decode.
- An agent-picked persona skips entries that aren't on the eligibility list, and reports why for each one.
- An agent-picked persona whose access is broader than the caller's effective sandbox is refused with a reason. A caller with no persona is compared by its thread's runtime mode.
- The same persona launches when a person picks it: through an
@personamention, an approved roster card (edited or not), or an edited member. - Auto-approved rosters and Captain additions are held to the eligibility list and the access cap.
-
j5_spawn_agent,delegate_task, Crew launch, and Crew addition all refuse the same over-limit pick with the same reason. One service method owns the check. - The agent guidance and tool descriptions (
j5_spawn_agent,delegate_task,j5_propose_crew,j5_request_crew_member) encourage passingpersonawhen one fits, and explain the limits. - The Models for custom members note reads "personas you pick can run on their own models".
-
docs/j5/user/personas.mdno longer says spawning ignores the spawner's access.docs/j5/product/features/crews.mdreflects the narrowed exception. - Focused tests cover each launch path refusing an over-access agent pick, an unchecked model skipped for an agent pick but used for a person pick, and the pick source recorded on each.
Out of scope
- The "Allow this once" flow itself (Personas: a blocked persona escalates, and I can allow it once #785).
- Reviewer model preference (Personas: reviewers prefer a different model from the author #782).
Open question
How does each path know a person made the pick? An @persona mention and an approved card are clear. For delegate_task, I'd treat any call made during a turn whose user message contains the @persona:ID mention as a person's pick, and every other call as an agent's. Does that hold up, or do we need something more explicit?
Activity
feat(j5): who picked a persona sets its limits (#931)