Skip to main content

Parallel Work Tracks — Grok Build + 0xRay User Asides

Audience: End users wearing the 0xRay suit in Grok Build (Cursor) who want to run main-thread work and a side quest in parallel — without stepping on each other's files or spawn rules.

Prerequisite: npm install 0xray + npx 0xray grok install. User asides ship in 0xRay 4.0.0.

Three names, three jobs

Do not confuse these:

NameYou declare it?What it controls
Grok git worktreeYes (or the agent does)Where on disk — isolated directory + branch
User aside (0xRay)YesWhich plan + spawn rules — parallel todo track
AsideContext (0xRay)No — internalMCP observation subcontext — implementation detail

For a real parallel feature (e.g. suit-nft), use user aside + worktree together. See User Asides for MCP fields.


The problem you are solving​

You are in one Grok session on the main thread (suit tuning, Repertoire, confer, etc.). You also want a side quest — a separate feature branch with its own phased plan and subagent spawns — without:

  • edits landing in the wrong directory,
  • spawn gate still routing to main-plan todos,
  • or losing track of which branch is which.

Three layers address different parts of that problem. They stack; none replaces the others.


Architecture — three layers​

flowchart TB
subgraph grok["Grok Build (lead agent)"]
LEAD["Lead thread — main cwd"]
end

subgraph xray_orchestration["0xRay — orchestration layer"]
MAIN_PLAN["lead-dev-plan.json<br/>main todos a.*"]
ASIDE_PLAN["asides/suit-nft.json<br/>aside todos suit-nft.a.*"]
ACTIVE["_active.json<br/>spawn router"]
GATE["PreToolUse spawn gate"]
BOOT["session-boot.json<br/>hints on SessionStart"]
end

subgraph git_isolation["Git / Grok — filesystem layer"]
MAIN_WT["Main working tree<br/>/your/repo"]
SIDE_WT["Git worktree<br/>../suit-nft-worktree"]
end

LEAD --> MAIN_PLAN
LEAD --> ASIDE_PLAN
ASIDE_PLAN --> ACTIVE
ACTIVE --> GATE
ACTIVE --> BOOT
LEAD -->|"spawn_subagent isolation:worktree"| SIDE_WT
LEAD -->|"Task cwd hint"| SIDE_WT
GATE -->|"planTodoId suit-nft.a.1.1"| ASIDE_PLAN
GATE -->|"planTodoId a.1.1"| MAIN_PLAN
SIDE_WT -.->|"branch feat/aside-suit-nft"| ASIDE_PLAN
MAIN_WT --> MAIN_PLAN

Comparison table​

Grok worktreeUser asideAsideContext
GovernsFilesystem isolationPlan + spawn routingInternal MCP observations
PersistenceReal git worktree on disk.xray/state/asides/{id}.jsonIn-memory during MCP call
You sayisolation: worktree or git worktree adduserAsideId on analyze-complexity(nothing — automatic)
EnforcementGrok x.ai/git/worktree/*PreToolUse spawn gateOrchestrator lifecycle only
Creates branch/dirYes (when configured)No — metadata hints onlyNo

State on disk — three channels​

0xRay state in Grok Build flows through three channels. Do not confuse them.

ChannelWhatAlways current?
PersistenceMCP + hooks write .xray/state/*.jsonAfter intake / activate
EnforcementPreToolUse reads plan + _active.json from disk on every tool callYes — spawn gate never uses stale in-memory cache
Awarenesssession-boot.json hints on diskRefreshed each UserPromptSubmit; lead must Read the file (Grok ignores hook stdout)

Every session, Grok hooks write .xray/state/session-boot.json on SessionStart and UserPromptSubmit. That file is the suit's hint channel for the lead agent — not the enforcement SSOT.

.xray/state/
├── session-boot.json # refreshed each hook — lead_dev_mode, activeAside hints
├── lead-dev-plan.json # main thread phased plan (after analyze-complexity)
├── pending-delegations.json # in-flight spawn queue
└── asides/
├── suit-nft.json # aside definition + namespaced plan
└── _active.json # which aside receives spawns

What session-boot loads today​

FieldSourceMeaning for you
lead_dev_modefeatures.jsonSuit rules active
activeAside_active.json + aside fileSpawns route to {id}.a.* todos
asideWorktreeaside metadataHint — lead must point spawns here
asideBranchaside metadataHint — expected git branch
asideTrapSignalsaside governanceRepertoire signals to watch
asideConferRecommendedaside governanceManual confer suggested
conferPendingsynthesis stateMain-thread confer may be due

What session-boot does not summarize yet​

Boot carries hints (activeAside, asideWorktree, confer flags). It does not yet embed leadDevPlanSummary or activeAsidePlanSummary (next todo, phase progress). For full todo lists on intake, analyze-complexity and orchestrate-task already return formatted plan text in the MCP response.

On resume without MCP, the lead should Read session-boot.json plus the active plan file, or call get-orchestration-status.

Enforcement is always live

Spawn routing reads _active.json and plan files directly — not session-boot.json. Activating an aside updates routing immediately even if boot hints lag until the next user message.

Grok hook contract

Grok ignores SessionStart and UserPromptSubmit hook stdout. Hooks persist state to disk; the lead agent does not auto-receive boot JSON in context.


Correct setup checklist​

You are using Grok Build correctly when all of these are true:

  • Suit worn — features.json → multi_agent_orchestration.lead_dev_mode: true
  • Grok bridge — npx 0xray grok install (7 MCPs + PreToolUse hook)
  • Intake before spawn — analyze-complexity ran before any Task / spawn_subagent
  • State exists — .xray/state/lead-dev-plan.json (main) or asides/{id}.json (aside)
  • Parallel track — aside intake and explicit worktree/cwd on spawns (both required)
  • Resume main — orchestrate-task with clearActiveAside: true when side quest pauses

Optional but recommended for this stack:

  • Repertoire — memory_routing.enabled + Repertoire MCP for signal-aware routing

Main thread vs parallel track​

flowchart LR
subgraph main["Main thread"]
M1["analyze-complexity<br/>(no userAsideId)"]
M2["lead-dev-plan.json"]
M3["todos: a.1.1, a.2.1 …"]
M4["clearActiveAside not needed"]
end

subgraph aside["Parallel track (user aside)"]
A1["analyze-complexity<br/>userAsideId: suit-nft"]
A2["asides/suit-nft.json"]
A3["todos: suit-nft.a.1.1 …"]
A4["_active.json points here"]
end

M1 --> M2 --> M3
A1 --> A2 --> A3 --> A4

Main thread — default. One plan, global a.* todo ids, main cwd.

Parallel track — you declare an aside. Namespaced todos, spawn gate follows aside plan while active, optional worktree/branch metadata.

Only one active aside per workspace at a time. Switch tracks with clearActiveAside before activating another.


End-to-end: parallel feature (suit-nft example)​

Step 1 — Create git isolation (filesystem)​

Either you or the lead agent:

git worktree add ../suit-nft-worktree feat/aside-suit-nft

Or tell Grok to spawn with isolation: worktree (Grok manages worktrees via x.ai/git/worktree/*).

This step is Grok/git. User aside does not run git worktree add for you.

Step 2 — Intake the aside (orchestration)​

xray-orchestrator → analyze-complexity:

{
"userAsideId": "suit-nft",
"userAsideTitle": "Suit-certified NFT mint",
"worktree": "../suit-nft-worktree",
"branch": "feat/aside-suit-nft",
"sessionId": "<your-grok-session-id>",
"tasks": [
{ "description": "Groover registration proof", "type": "research" },
{ "description": "Mint flow implementation", "type": "implementation" }
]
}

This writes asides/suit-nft.json, activates _active.json, and namespaces todos as suit-nft.a.1.1, etc.

Step 3 — Spawn subagents (both layers)​

When delegating, the lead must satisfy both:

  1. Spawn gate — planTodoId: "suit-nft.a.1.1" (aside routing)
  2. Filesystem — prompt includes "Run all commands and edits in ../suit-nft-worktree" or cwd / isolation: worktree

Example Task prompt pattern:

Implement mint flow in ../suit-nft-worktree (branch feat/aside-suit-nft).
Todo: suit-nft.a.2.1. Run per-suite tests in that worktree; report paths touched.

Step 4 — Resume main thread​

xray-orchestrator → orchestrate-task:

{ "description": "resume main suit work", "clearActiveAside": true }

Spawns return to main lead-dev-plan.json todos (a.*).

Step 5 — Reactivate aside later​

{ "description": "continue suit-nft", "userAsideId": "suit-nft" }

Existing aside plan reloads; _active.json updates.


Grok-native worktrees (without user aside)​

When you only say "spin up worktrees and manage them", you get filesystem isolation only:

Grok capabilityWhat it does
spawn_subagent + isolation: worktreeChild gets isolated git worktree
spawn_subagent + cwdChild runs in specified directory
/fork --worktreeNew session fork in a worktree
grok -w / grok --worktree=featNew session starts in worktree
x.ai/git/worktree/applyMerge worktree changes back to main

Gap without user aside: PreToolUse spawn gate still follows main lead-dev-plan.json. Parallel files, main orchestration rules.

Use this for quick isolated experiments. Use user aside + worktree for governed parallel features.


User aside vs "manage worktrees" — decision tree​

Separate plan?Separate files?Use
NoNoMain thread only (lead-dev-plan.json)
NoYesGrok worktree only (isolation: worktree)
YesNoUser aside only — risky (shared cwd)
YesYesUser aside + worktree (recommended)
MistakeWhat happens
Worktree only, no aside intakeFiles isolated; spawn gate on main plan
Aside only, no cwd in spawnsGate happy; edits may hit main cwd
Confuse AsideContext with user asideInternal MCP routing, not your side quest
Multiple active asidesNot supported — one _active.json
Omit sessionId on intakeAny session may route to aside until cleared

AsideContext — ignore unless you hack orchestrator​

AsideContext is an internal bounded subcontext created during orchestrate-task, analyze-complexity, and govern-and-apply. It accumulates governance/orchestration observations and can inherit Repertoire memoryRouting.

You never declare AsideContext. It is not a user-facing parallel work track.

If docs or agents mention "aside" without "user aside", check context — they may mean AsideContext.


Natural language — what to tell your lead agent​

GoalSay this
Start parallel feature"Intake user aside suit-nft with worktree ../suit-nft-worktree on branch feat/aside-suit-nft — tasks: …"
Work the aside"Work my suit-nft aside — next todo, spawns in the worktree"
Back to main"Clear active aside and resume main plan"
Worktree only (quick)"Spawn implementer in worktree isolation for …"
Check state"Read .xray/state/session-boot.json and aside plan — what's active?"

Config reference​

features.json:

{
"multi_agent_orchestration": {
"lead_dev_mode": true,
"user_asides": {
"enabled": true
}
}
}

user_asides.enabled defaults to true when lead_dev_mode is on. Set false to disable aside intake and routing.