Spawn-primitive reference¶
/cheese-factory spawns sub-agents via the host harness's fan-out primitive. The orchestrator is harness-agnostic โ any primitive that satisfies all five invariants below is acceptable. This file collects host-by-host invocation examples plus the five invariants.
The five invariants¶
A spawn primitive is acceptable iff it satisfies all five:
- Fresh context per spawn. The sub-agent boots with no memory of prior phases. The orchestrator's chain-of-thought, prior tool outputs, and conversation history are all dropped at spawn boundary.
- Full-peer inheritance. Same model as the parent, full tool access, full skill access, full MCP access. No diminutive workers (haiku, scoped read-only types).
- No chain-forward. The sub-agent runs only its phase and returns. The no-chain-forward directive must be passed in the prompt โ the host primitive does not enforce it.
- Returns control. The orchestrator regains control after each spawn so it can read the handoff slug. Fire-and-forget primitives do not satisfy this invariant.
- Writes handoff slug. Each spawn writes its result to
.cheese/<phase>/<slug>.mdper the schema. The orchestrator decides chain progression from the slug, never from stdout.
If the host harness exposes no fan-out primitive at all, /cheese-factory is the wrong skill โ recommend /ultracook for the same review semantics in the parent's own context.
Anthropic Claude Code โ Agent() / /batch¶
/batch dispatches multiple Agent() calls in a single message โ that's the fan-out primitive /cheese-factory uses for Phase 2.
Agent(
subagent_type: "general-purpose", # never specialised
# model: omit โ inherits parent's model. Do not pass haiku/sonnet here.
prompt: "Run /<phase> <slug> --auto for THIS PHASE ONLY. Write
.cheese/<phase>/<slug>.md with the handoff schema and stop.
Do not chain forward to the next phase even though your
auto-mode contract documents that. The /cheese-factory orchestrator
is driving the chain."
)
Rules:
- Do not downgrade the model. Omit the
modelparameter so the sub-agent inherits. - Do not narrow
subagent_type. Usegeneral-purpose(or the harness equivalent that grants full tool access). Do not passExplore,lsp-probe, or any other read-only / scoped worker type. - Do not restrict tools or MCP access. Each phase needs Bash, Edit, Write, Read, the
cheez-*skills, and any MCP servers the parent has. - Do pass the slug. The phase skill resolves its own paths from the slug.
The contract is "inheritance, not diminution" โ most sub-agent patterns in this ecosystem (Explore, lsp-probe, whey-drainer, ricotta-reducer) are deliberately scoped down for cheap focused queries. /cheese-factory does the opposite: it spawns workers that are full peers of the parent.
GitHub Copilot CLI โ fleets¶
Copilot CLI fleets dispatch multiple agents from a single CLI invocation. Each agent boots in its own conversation context, satisfying invariant 1.
copilot fleet \
--agents 5 \
--prompt-file .cheese/cheese-factory/<slug>/curd-prompts.txt \
--return-on-completion
Rules:
- Each prompt in the prompt file must include the no-chain-forward directive.
--return-on-completionis mandatory; without it, control does not return to the orchestrator (invariant 4 fails).- Fleet agents inherit the same model and tool scope as the parent session, satisfying invariant 2.
- Each agent must write the handoff slug to
.cheese/cheese-factory/<slug>/curds/<id>.mdper the per-curd prompt template.
OpenAI Codex โ subagents¶
Codex subagents are spawned via the codex subagent command or the subagent tool.
codex subagent \
--type general-purpose \
--prompt-file .cheese/cheese-factory/<slug>/curd-<id>.txt \
--inherit-tools \
--wait
Rules:
--type general-purpose(or equivalent) โ never pass a scoped worker type.--inherit-toolsโ full-peer inheritance per invariant 2.--waitโ synchronous return so the orchestrator can read the handoff slug.- The prompt file must include the no-chain-forward directive.
Other / future harnesses¶
Any primitive that satisfies the five invariants is acceptable. When evaluating a new harness:
- Boot a sub-agent and verify it has no memory of prior phases (invariant 1). A simple check: ask the sub-agent to name the prior phase. If it can, the primitive is not fresh-context.
- Confirm the sub-agent has the same tool / MCP access as the parent (invariant 2).
- Confirm the prompt-level no-chain directive is honoured (invariant 3).
- Confirm control returns synchronously (invariant 4).
- Confirm the sub-agent can write files inside
.cheese/(invariant 5).
If any invariant fails, document the limitation in the host capabilities section of the manifest and route to /ultracook (sequential, same context) instead.