From e459d109719328063bec2a24a28fdebf77fbfec6 Mon Sep 17 00:00:00 2001 From: Jackson Miller Date: Mon, 23 Nov 2026 22:33:22 -0500 Subject: [PATCH] fix(j5): Claude opens new threads with j5_spawn_agent again J5's Peer Agent line named j5_spawn_agent only for an explicit Peer Agent or a standalone agent, so on v0.1.11 Sonnet answered "open N new threads" with delegate_task. The line now names new and other threads, rules out delegate_task and Subagents for them, keeps forks on t3_thread_transfer, and routes an @persona:ID in such a request to persona. Closes #1208 Co-Authored-By: Claude Opus 5.5 --- apps/server/src/provider/agentContextBudget.json | 4 ++-- .../provider-core/src/j5/orchestrationInstructions.test.ts | 2 +- packages/provider-core/src/j5/orchestrationInstructions.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/server/src/provider/agentContextBudget.json b/apps/server/src/provider/agentContextBudget.json index 5e3eb35c2d1b4..2bc4c66e1e258 100644 --- a/apps/server/src/provider/agentContextBudget.json +++ b/apps/server/src/provider/agentContextBudget.json @@ -1,5 +1,5 @@ { - "claudeSystemAppendBytes": 20443, - "codexAdditionalContextBytes": 21827, + "claudeSystemAppendBytes": 20621, + "codexAdditionalContextBytes": 22005, "mcpToolListJsonBytes": 100540 } diff --git a/packages/provider-core/src/j5/orchestrationInstructions.test.ts b/packages/provider-core/src/j5/orchestrationInstructions.test.ts index 66cb6427e2c16..bcd29c55bc179 100644 --- a/packages/provider-core/src/j5/orchestrationInstructions.test.ts +++ b/packages/provider-core/src/j5/orchestrationInstructions.test.ts @@ -133,7 +133,7 @@ describe("J5 orchestration instructions", () => { assert.include(J5_ORCHESTRATION_INSTRUCTIONS, "your provider's native Subagent mechanism"); assert.include( J5_ORCHESTRATION_INSTRUCTIONS, - "Use `j5_spawn_agent` when the user explicitly asks for a Peer Agent or a standalone agent they will talk to", + "Use `j5_spawn_agent` when the user asks for a new thread or another thread, a Peer Agent, or a standalone agent they will talk to", ); assert.include( J5_ORCHESTRATION_INSTRUCTIONS, diff --git a/packages/provider-core/src/j5/orchestrationInstructions.ts b/packages/provider-core/src/j5/orchestrationInstructions.ts index c3061176813bc..42a8a8e4d48c2 100644 --- a/packages/provider-core/src/j5/orchestrationInstructions.ts +++ b/packages/provider-core/src/j5/orchestrationInstructions.ts @@ -32,7 +32,7 @@ ${AGENT_INVOCATION_INSTRUCTIONS} `- Every new delegated review or re-check is a new \`delegate_task\` carrying the original brief, prior findings, responses, and unresolved objections. Track each round by its own \`taskId\`. Fix small review findings yourself; start no delegate for them. When told to proceed without a delegate, or to run fewer, \`task_cancel\` the extras. Start no replacement. - Follow a running delegate's \`next\`: its completion wakes this thread, so end your turn. Do not poll it (\`task_status\`, \`sleep\`, watchers, Monitor, ScheduleWakeup). Stop a delegate run you replace or no longer need with \`task_cancel\`, never \`t3_thread_interrupt\` on a \`childThreadId\`. - If you are a subagent or delegated child, do the work yourself. Start no subagents unless your task says to.`, - `- A Peer Agent is a full participant with its own top-level thread that the user can open and message. Use \`j5_spawn_agent\` when the user explicitly asks for a Peer Agent or a standalone agent they will talk to, or when a skill you are following names it. When nobody asked for one, it is not a way to get help with your own work: use a subagent or a Crew. Its brief states the task and whether a reply is expected; when you need a reply, include what should come back in that brief instead of sending a follow-up ask. + `- A Peer Agent is a full participant with its own top-level thread that the user can open and message. Use \`j5_spawn_agent\` when the user asks for a new thread or another thread, a Peer Agent, or a standalone agent they will talk to, or when a skill you are following names it; never \`delegate_task\` or a Subagent for those, and \`t3_thread_transfer\` only to fork this conversation. An \`@persona:ID\` in that request goes in \`persona\`. When nobody asked for one, it is not a way to get help with your own work: use a subagent or a Crew. Its brief states the task and whether a reply is expected; when you need a reply, include what should come back in that brief instead of sending a follow-up ask. - A Crew is a group of Peer Agents you command as Captain for one bounded task. Use \`j5_propose_crew\` when the work needs members who must respond to each other. Mix saved personas from \`j5_list_personas\` with custom seats: set persona for a saved persona, or omit it and provide task-specific instructions for a custom seat. Custom seats inherit your harness, model, and reasoning by default and, unless you set \`runtime_mode\`, run with full access on a roster the user approves and with your own access otherwise; you can select their harness, model, reasoning, and access with \`model_selection\` (instanceId, model, options) and \`runtime_mode\` from \`orchestrator_capabilities\`. Saved personas use their own configuration and do not accept those overrides. A persona seat marked independent_reviewer runs, when it can, on a model none of the seats or members it reviews runs on: every one that is not a reviewer by default, or the ones \`reviews\` names. A seat nobody approves (an auto-approved roster, or one added with \`j5_request_crew_member\`) gets no more access than you run with, and a persona seat there uses only its models checked in Models for custom members. The app shows the roster in your thread, with each seat's resolved provider, model, reasoning, and access, and it is approved, edited, or declined there. Approval creates the seats without starting turns: send each member its first assignment when it has work, or hand it its first playbook step. Reuse finished members for follow-up work in the same thread; a member messages you when its work is done, and the platform tells you only when a member's run fails. Grow a Crew you command with \`j5_request_crew_member\`, which adds one seat directly with the crew_instance_id and a clear reason naming the concern and needed responsibility; it needs no approval. To move a member's work to a different model, such as a reviewer whose model just wrote what it will review, request the new member with \`replaces\` set to that member's seat: the new member takes over the seat's unfinished playbook steps, and the replaced member is stopped and leaves the Crew.`, `- Crew members, their Captain, and Captains of other crews coordinate directly with \`j5_send_message\`, grouping related updates into one message rather than sending each as it happens. Members run their own review loops: a reviewer sends findings straight to the teammate who owns the work, the owner sends the fix straight back, and they repeat until no finding is unresolved. The Captain hears from a member only for a review pass that names the commit or change it reviewed, a blocker that names what is needed, a disagreement the members could not settle, or its final result or step report, and a member sends no acknowledgments or progress updates. As Captain you own the outcome: settle technical disagreements within the agreed scope yourself, and ask the user only when product intent or their judgment is needed; when you do, ask with \`j5_send_message\` to the user with \`expect_reply=true\`, not a native question tool, so the request reaches their Inbox, state the disagreement, the options as a list and your recommendation, and keep working on what does not depend on the answer. A busy receiver handles each message as its own turn after its current one ends. Do not wait for an artifact or a separate coordination approval. Return results in messages unless the user or a selected persona explicitly requires an artifact; that output requirement never blocks conversation. If a concern needs expertise missing from the roster, the member tells its Captain, and the Captain adds a seat with \`j5_request_crew_member\`; continue the already-approved work and coordination meanwhile. - Use \`j5_list_participants\` to resolve an already-addressable agent or a person. It lists the people who can write to your thread; where more than one can, it also lists everyone here, and an ask to everyone here reaches all of them and is closed by the first reply. Use \`j5_send_message\` without expect_reply for updates or results that need no response. Only for later work owed by an existing participant, use \`j5_send_message(..., expect_reply=true, intent="...")\` to open an Exchange. The reply arrives later as an incoming message; continue with other work instead of polling or holding a turn open to wait. Messages reach a supported active turn through provider steering; otherwise they queue for its next turn.