> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trytrellis.app/llms.txt
> Use this file to discover all available pages before exploring further.

# v0.5.6

> 2026-05-07

Two prompt-layer follow-ups for Codex `multi_agent_v2`. `AGENTS.md` documents the `fork_turns="none"` requirement on `spawn_agent` calls ([`#240`](https://github.com/mindfold-ai/Trellis/issues/240) follow-up) and the deterministic close-loop algorithm for handling `wait` completion notifications ([`#241`](https://github.com/mindfold-ai/Trellis/issues/241)). No new migrations.

## Bug Fixes

### `fork_turns="none"` requirement (#240 follow-up)

[v0.5.5](/changelog/v0.5.5) removed the `SessionStart` injection vector that hijacked sub-agent sessions. [Marsor707's local-verification comment on `#240`](https://github.com/mindfold-ai/Trellis/issues/240#issuecomment-4393264022) showed a second vector remained:

> Without `fork_turns="none"`, the child can see the parent's own `spawn_agent(...)` records and then apply the Trellis/AGENTS "wait for spawned subagents" rule to itself, causing a self-wait such as `wait_agent({"timeout_ms":480000})`.

Default Codex behavior is `fork_turns="all"` — the child inherits the parent transcript including prior `spawn_agent` tool calls, and re-applies the wait rule to itself. That's another path to `wait_agent` self-deadlock independent of the SessionStart bug.

`packages/cli/src/templates/markdown/agents.md` adds a `### Codex-only — \`spawn\_agent\` parameters`subsection telling the main session to always pass`fork\_turns="none"`. Prompt-layer only — Trellis doesn't intercept`spawn\_agent\`.

### Multi-subagent close-loop algorithm ([`#241`](https://github.com/mindfold-ai/Trellis/issues/241))

The existing rule in `AGENTS.md`:

> ALWAYS wait for every spawned subagent to reach a terminal status before yielding...

Was ambiguous. Reproduction from the issue: parent dispatched two `trellis-research` sub-agents; both completed and wrote `{task_dir}/research/*.md`; parent received `completed` notifications but kept calling `wait_agent` again instead of reading deliverables and closing. User-side appearance: stuck waiting.

`packages/cli/src/templates/markdown/agents.md` adds a `### Codex-only — multi-subagent close-loop` subsection with the deterministic algorithm proposed in the issue:

1. Maintain `expected_agents` set.
2. After each `wait` update: `list_agents`, verify deliverables for terminal agents, `close_agent`, remove from set.
3. Continue waiting only if `expected_agents` still has running agents.
4. Never `wait` on an agent already reported `completed`.

Both subsections are prompt-layer-only — no script, hook, or configurator behavior changed.

## Upgrade

```bash theme={null}
npm install -g @mindfoldhq/trellis@latest
trellis update
```

`AGENTS.md` gets two new subsections under `## Subagents`. Other platforms see the `Codex-only` labels and can skip those subsections.
