Skip to main content
Use parallel sessions when several agents or workstreams need the same project context without competing for one chat. The pattern has two parts:
  • Put shared instructions, briefs, and reference files in one StefanBrain Project.
  • Give every fork its own session label. StefanBrain routes that label to a dedicated chat named Developer API — <label> inside the project.
Calls that reuse a label continue the same chat. Different labels use different chats and can run concurrently.

Address every call consistently

ask_stefanbrain, asynchronous submit tools, and the job status, result, and cancel tools accept project and session arguments. Repeat the same project and session when retrying a keyed submission. Job controls do not require the submitting session. Job status, result, and cancellation use your account and the job family, so you can control your jobs from another chat or session. Idempotency keys remain chat-scoped: retry a submit with its original address to avoid starting new work. An MCP call with an unused session label creates an empty Developer API — <label> chat. Session labels must contain 1–128 characters from A–Z, a–z, 0–9, _, ., :, or -. An invalid label returns invalid_session.
A session is a tool argument; there is no session header. An MCP connection can use x-stefanbrain-project as its fallback project scope, but each fork must still pass its own session argument.

Run forks with the SDK

Use the same label for a follow-up in one fork:

Run forks with the CLI

For a project-pinned Claude Code workspace, sb init --project proj_your_project writes or merges the MCP configuration. It does not write a session header. Tell each fork to pass its label on every StefanBrain call.

Handle busy chats deliberately

When you omit chat, ask_stefanbrain reuses the session’s chat. If that chat is busy, the new ask starts independently in a fresh chat. Its result includes the new chat and a session_chat_busy note naming the original chat. The fresh chat keeps project context but has none of the original conversation history. The session label still addresses its original chat. To continue the split ask, pass the returned chat explicitly. Use separate labels for independent workstreams. An explicitly addressed busy chat steers the active turn on 2026-11-01; steered_into_run_id names that run. Its run_id reads the shared result without starting a separate billed turn. On 2026-10-20, an explicit busy chat returns a typed busy conflict. An overlapping retry with the same idempotency_key also returns that conflict while the first call holds the key. Wait, then retry identical arguments with the same key. Once available, the retry recovers the original run and chat without starting another run. Only on_busy: "reject" is supported as an explicit option. On 2026-11-01, use it to refuse an explicit busy chat instead of steering. See version-specific busy behavior.

Resolve older sessions safely

The SDK and CLI resolve a session label with one exact, case-sensitive chat-name lookup and use the oldest-created match, which is where the server routes work for that label. A label that was never used fails with chat_not_found instead of polling another chat. Pass the chat returned at submit time to skip the lookup. Next, read TypeScript SDK or CLI for the full client contract.