> ## 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.4

> 2026-05-06

Fix Trellis sub-agent recursion when a workflow-state instruction reaches a sub-agent ([`#237`](https://github.com/mindfold-ai/Trellis/issues/237)); fix `compareVersions` dropping the tail of hyphenated prereleases ([`#230`](https://github.com/mindfold-ai/Trellis/pull/230)). No new migrations.

## Bug Fixes

### Sub-agent recursion guard

`.trellis/workflow.md`'s `[workflow-state:in_progress]` block tells the main agent to dispatch `trellis-implement` / `trellis-check` sub-agents. On Codex the same block also reaches the spawned sub-agent's turn, and the sub-agent followed the rule on itself — spawning another `trellis-implement` instead of doing the work.

Two changes:

* `[workflow-state:in_progress]` scopes the dispatch rule to the main session, and adds an explicit "if you are already a `trellis-implement` / `trellis-check` sub-agent, work directly and do not spawn another one" exemption.
* Each platform's `trellis-implement` / `trellis-check` agent definition (claude / cursor / opencode / kiro / codebuddy / droid / codex / pi / gemini / qoder) carries the same exemption, so the guard holds even if the workflow-state injection is missed.

`.trellis/spec/cli/backend/workflow-state-contract.md` updated: previously claimed only the main session could see workflow-state breadcrumbs, but Codex hooks deliver them to sub-agents too.

### `compareVersions`: hyphens inside prereleases

Thanks to [@voidborne-d](https://github.com/voidborne-d) for [`#230`](https://github.com/mindfold-ai/Trellis/pull/230).

`packages/cli/src/utils/compare-versions.ts` used `a.split("-", 2)` to separate the base version from the prerelease tag. JavaScript's `split(sep, limit)` truncates the result instead of joining the tail (unlike Python's `maxsplit`):

```js theme={null}
'1.0.0-alpha-1'.split('-', 2);
// → ["1.0.0", "alpha"]   // "-1" silently dropped
```

So `compareVersions("1.0.0-alpha-1", "1.0.0-alpha-2")` returned `0` — the two versions sorted as equal. Fixed. Adds 20 test cases in `packages/cli/test/utils/compare-versions.test.ts` covering base versions, release vs prerelease, hyphenated identifiers, and version-list sorting.

## Upgrade

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