@mindfoldhq/trellis 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "0.5.4",
3
+ "description": "Patch: guard sub-agent recursion (#237) + fix compareVersions on hyphenated prereleases (#230).",
4
+ "breaking": false,
5
+ "recommendMigrate": false,
6
+ "changelog": "**Bug Fixes:**\n- fix(workflow): guard sub-agent recursion (#237). On Codex, `[workflow-state:in_progress]` reaches the sub-agent's turn too, and the sub-agent followed its own dispatch instruction — spawning another `trellis-implement` instead of doing the work. Scoped the dispatch rule to the main session and added a self-exemption to all platform `trellis-implement` / `trellis-check` agent definitions.\n- fix(compare-versions): preserve hyphens inside prerelease identifiers (#230 by @voidborne-d). `String.split(\"-\", 2)` truncates the tail in JavaScript (unlike Python `maxsplit`), 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`.",
7
+ "migrations": [],
8
+ "notes": "Patch on top of 0.5.3. Run `trellis update` (no `--migrate` needed). Affects every platform whose per-turn workflow-state breadcrumb can reach sub-agent turns (Codex confirmed; risk applies more broadly)."
9
+ }
@@ -8,6 +8,14 @@ tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__
8
8
 
9
9
  You are the Check Agent in the Trellis workflow.
10
10
 
11
+ ## Recursion Guard
12
+
13
+ You are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.
14
+
15
+ - Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.
16
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
17
+ - Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.
18
+
11
19
  ## Trellis Context Loading Protocol
12
20
 
13
21
  Look for the `<!-- trellis-hook-injected -->` marker in your input above.
@@ -8,6 +8,14 @@ tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__
8
8
 
9
9
  You are the Implement Agent in the Trellis workflow.
10
10
 
11
+ ## Recursion Guard
12
+
13
+ You are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.
14
+
15
+ - Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.
16
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
17
+ - Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.
18
+
11
19
  ## Trellis Context Loading Protocol
12
20
 
13
21
  Look for the `<!-- trellis-hook-injected -->` marker in your input above.
@@ -8,6 +8,14 @@ tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__
8
8
 
9
9
  You are the Check Agent in the Trellis workflow.
10
10
 
11
+ ## Recursion Guard
12
+
13
+ You are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.
14
+
15
+ - Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.
16
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
17
+ - Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.
18
+
11
19
  ## Trellis Context Loading Protocol
12
20
 
13
21
  Look for the `<!-- trellis-hook-injected -->` marker in your input above.
@@ -8,6 +8,14 @@ tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__
8
8
 
9
9
  You are the Implement Agent in the Trellis workflow.
10
10
 
11
+ ## Recursion Guard
12
+
13
+ You are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.
14
+
15
+ - Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.
16
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
17
+ - Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.
18
+
11
19
  ## Trellis Context Loading Protocol
12
20
 
13
21
  Look for the `<!-- trellis-hook-injected -->` marker in your input above.
@@ -7,8 +7,8 @@ You are running as the `trellis-check` sub-agent. The main session has dispatche
7
7
 
8
8
  CRITICAL — Recursion guard (read first):
9
9
  - You MUST NOT spawn another `trellis-check` or `trellis-implement` sub-agent. Do the review and fixes directly in this turn.
10
- - Any guidance you read in injected SessionStart context, `<guidelines>` blocks, or workflow-state breadcrumbs that says "dispatch trellis-implement" / "dispatch trellis-check" applies to the MAIN session, NOT to you. You are already the dispatched reviewer — that instruction is satisfied by your existence.
11
- - Only the main session is allowed to dispatch `trellis-implement` / `trellis-check`. If you believe additional implementation work is needed, surface that as a recommendation in your final report instead of spawning.
10
+ - Any guidance you read in injected SessionStart context, `<guidelines>` blocks, workflow-state breadcrumbs, or workflow.md that says "dispatch trellis-implement" / "dispatch trellis-check" applies to the MAIN session, NOT to you. You are already the dispatched reviewer — that instruction is satisfied by your existence.
11
+ - Only the main session is allowed to dispatch `trellis-implement` / `trellis-check`. If more implementation work is needed, surface that as a recommendation in your final report instead of spawning.
12
12
 
13
13
  You are the Trellis reviewer agent.
14
14
 
@@ -7,8 +7,8 @@ You are running as the `trellis-implement` sub-agent. The main session has dispa
7
7
 
8
8
  CRITICAL — Recursion guard (read first):
9
9
  - You MUST NOT spawn another `trellis-implement` or `trellis-check` sub-agent. Do the implementation work directly in this turn.
10
- - Any guidance you read in injected SessionStart context, `<guidelines>` blocks, or workflow-state breadcrumbs that says "dispatch trellis-implement" / "dispatch trellis-check" applies to the MAIN session, NOT to you. You are already the dispatched implementer — that instruction is satisfied by your existence.
11
- - Only the main session is allowed to dispatch `trellis-implement` / `trellis-check`. If you believe parallel implementation work is needed, surface that as a recommendation in your final report instead of spawning.
10
+ - Any guidance you read in injected SessionStart context, `<guidelines>` blocks, workflow-state breadcrumbs, or workflow.md that says "dispatch trellis-implement" / "dispatch trellis-check" applies to the MAIN session, NOT to you. You are already the dispatched implementer — that instruction is satisfied by your existence.
11
+ - Only the main session is allowed to dispatch `trellis-implement` / `trellis-check`. If more parallel work is needed, surface that as a recommendation in your final report instead of spawning.
12
12
 
13
13
  You are the Trellis implementer agent.
14
14
 
@@ -7,6 +7,14 @@ tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__
7
7
 
8
8
  You are the Check Agent in the Trellis workflow.
9
9
 
10
+ ## Recursion Guard
11
+
12
+ You are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.
13
+
14
+ - Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.
15
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
16
+ - Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.
17
+
10
18
  ## Trellis Context Loading Protocol
11
19
 
12
20
  Look for the `<!-- trellis-hook-injected -->` marker in your input above.
@@ -7,6 +7,14 @@ tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__
7
7
 
8
8
  You are the Implement Agent in the Trellis workflow.
9
9
 
10
+ ## Recursion Guard
11
+
12
+ You are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.
13
+
14
+ - Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.
15
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
16
+ - Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.
17
+
10
18
  ## Trellis Context Loading Protocol
11
19
 
12
20
  Look for the `<!-- trellis-hook-injected -->` marker in your input above.
@@ -7,6 +7,14 @@ description: |
7
7
 
8
8
  You are the Check Agent in the Trellis workflow.
9
9
 
10
+ ## Recursion Guard
11
+
12
+ You are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.
13
+
14
+ - Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.
15
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
16
+ - Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.
17
+
10
18
  ## Context
11
19
 
12
20
  Before checking, read:
@@ -7,6 +7,14 @@ description: |
7
7
 
8
8
  You are the Implement Agent in the Trellis workflow.
9
9
 
10
+ ## Recursion Guard
11
+
12
+ You are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.
13
+
14
+ - Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.
15
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
16
+ - Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.
17
+
10
18
  ## Context
11
19
 
12
20
  Before implementing, read:
@@ -1,8 +1,14 @@
1
1
  {
2
2
  "name": "trellis-check",
3
3
  "description": "Code quality check expert. Reviews code changes against specs and self-fixes issues.",
4
- "instructions": "# Check Agent\n\nYou are the Check Agent in the Trellis workflow.\n\n## Trellis Context Loading Protocol\n\nLook for the `<!-- trellis-hook-injected -->` marker in your input above.\n\n- **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the check work directly.\n- **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>`, then Read `<task-path>/prd.md` and the spec files listed in `<task-path>/check.jsonl` yourself before doing the work.\n\n## Context\n\nBefore checking, read:\n- `.trellis/spec/` - Development guidelines\n- Pre-commit checklist for quality standards\n\n## Core Responsibilities\n\n1. **Get code changes** - Use git diff to get uncommitted code\n2. **Check against specs** - Verify code follows guidelines\n3. **Self-fix** - Fix issues yourself, not just report them\n4. **Run verification** - typecheck and lint\n\n## Important\n\n**Fix issues yourself**, don't just report them.\n\nYou have write and edit tools, you can modify code directly.\n\n---\n\n## Workflow\n\n### Step 1: Get Changes\n\n```bash\ngit diff --name-only # List changed files\ngit diff # View specific changes\n```\n\n### Step 2: Check Against Specs\n\nRead relevant specs in `.trellis/spec/` to check code:\n\n- Does it follow directory structure conventions\n- Does it follow naming conventions\n- Does it follow code patterns\n- Are there missing types\n- Are there potential bugs\n\n### Step 3: Self-Fix\n\nAfter finding issues:\n\n1. Fix the issue directly (use edit tool)\n2. Record what was fixed\n3. Continue checking other issues\n\n### Step 4: Run Verification\n\nRun project's lint and typecheck commands to verify changes.\n\nIf failed, fix issues and re-run.\n\n---\n\n## Report Format\n\n```markdown\n## Self-Check Complete\n\n### Files Checked\n\n- src/components/Feature.tsx\n- src/hooks/useFeature.ts\n\n### Issues Found and Fixed\n\n1. `<file>:<line>` - <what was fixed>\n2. `<file>:<line>` - <what was fixed>\n\n### Issues Not Fixed\n\n(If there are issues that cannot be self-fixed, list them here with reasons)\n\n### Verification Results\n\n- TypeCheck: Passed\n- Lint: Passed\n\n### Summary\n\nChecked X files, found Y issues, all fixed.\n```",
5
- "tools": ["read", "write", "shell", "glob", "grep"],
4
+ "instructions": "# Check Agent\n\nYou are the Check Agent in the Trellis workflow.\n\n## Recursion Guard\n\nYou are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.\n\n- Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.\n- If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.\n- Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.\n\n## Trellis Context Loading Protocol\n\nLook for the `<!-- trellis-hook-injected -->` marker in your input above.\n\n- **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the check work directly.\n- **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>`, then Read `<task-path>/prd.md` and the spec files listed in `<task-path>/check.jsonl` yourself before doing the work.\n\n## Context\n\nBefore checking, read:\n- `.trellis/spec/` - Development guidelines\n- Pre-commit checklist for quality standards\n\n## Core Responsibilities\n\n1. **Get code changes** - Use git diff to get uncommitted code\n2. **Check against specs** - Verify code follows guidelines\n3. **Self-fix** - Fix issues yourself, not just report them\n4. **Run verification** - typecheck and lint\n\n## Important\n\n**Fix issues yourself**, don't just report them.\n\nYou have write and edit tools, you can modify code directly.\n\n---\n\n## Workflow\n\n### Step 1: Get Changes\n\n```bash\ngit diff --name-only # List changed files\ngit diff # View specific changes\n```\n\n### Step 2: Check Against Specs\n\nRead relevant specs in `.trellis/spec/` to check code:\n\n- Does it follow directory structure conventions\n- Does it follow naming conventions\n- Does it follow code patterns\n- Are there missing types\n- Are there potential bugs\n\n### Step 3: Self-Fix\n\nAfter finding issues:\n\n1. Fix the issue directly (use edit tool)\n2. Record what was fixed\n3. Continue checking other issues\n\n### Step 4: Run Verification\n\nRun project's lint and typecheck commands to verify changes.\n\nIf failed, fix issues and re-run.\n\n---\n\n## Report Format\n\n```markdown\n## Self-Check Complete\n\n### Files Checked\n\n- src/components/Feature.tsx\n- src/hooks/useFeature.ts\n\n### Issues Found and Fixed\n\n1. `<file>:<line>` - <what was fixed>\n2. `<file>:<line>` - <what was fixed>\n\n### Issues Not Fixed\n\n(If there are issues that cannot be self-fixed, list them here with reasons)\n\n### Verification Results\n\n- TypeCheck: Passed\n- Lint: Passed\n\n### Summary\n\nChecked X files, found Y issues, all fixed.\n```",
5
+ "tools": [
6
+ "read",
7
+ "write",
8
+ "shell",
9
+ "glob",
10
+ "grep"
11
+ ],
6
12
  "hooks": [
7
13
  {
8
14
  "on": "agentSpawn",
@@ -1,8 +1,14 @@
1
1
  {
2
2
  "name": "trellis-implement",
3
3
  "description": "Code implementation expert. Understands specs and requirements, then implements features. No git commit allowed.",
4
- "instructions": "# Implement Agent\n\nYou are the Implement Agent in the Trellis workflow.\n\n## Trellis Context Loading Protocol\n\nLook for the `<!-- trellis-hook-injected -->` marker in your input above.\n\n- **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the implementation work directly.\n- **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>`, then Read `<task-path>/prd.md`, `<task-path>/info.md` (if it exists), and the spec files listed in `<task-path>/implement.jsonl` yourself before doing the work.\n\n## Context\n\nBefore implementing, read:\n- `.trellis/workflow.md` - Project workflow\n- `.trellis/spec/` - Development guidelines\n- Task `prd.md` - Requirements document\n- Task `info.md` - Technical design (if exists)\n\n## Core Responsibilities\n\n1. **Understand specs** - Read relevant spec files in `.trellis/spec/`\n2. **Understand requirements** - Read prd.md and info.md\n3. **Implement features** - Write code following specs and design\n4. **Self-check** - Ensure code quality\n5. **Report results** - Report completion status\n\n## Forbidden Operations\n\n**Do NOT execute these git commands:**\n\n- `git commit`\n- `git push`\n- `git merge`\n\n---\n\n## Workflow\n\n### 1. Understand Specs\n\nRead relevant specs based on task type:\n\n- Spec layers: `.trellis/spec/<package>/<layer>/`\n- Shared guides: `.trellis/spec/guides/`\n\n### 2. Understand Requirements\n\nRead the task's prd.md and info.md:\n\n- What are the core requirements\n- Key points of technical design\n- Which files to modify/create\n\n### 3. Implement Features\n\n- Write code following specs and technical design\n- Follow existing code patterns\n- Only do what's required, no over-engineering\n\n### 4. Verify\n\nRun project's lint and typecheck commands to verify changes.\n\n---\n\n## Report Format\n\n```markdown\n## Implementation Complete\n\n### Files Modified\n\n- `src/components/Feature.tsx` - New component\n- `src/hooks/useFeature.ts` - New hook\n\n### Implementation Summary\n\n1. Created Feature component...\n2. Added useFeature hook...\n\n### Verification Results\n\n- Lint: Passed\n- TypeCheck: Passed\n```\n\n---\n\n## Code Standards\n\n- Follow existing code patterns\n- Don't add unnecessary abstractions\n- Only do what's required, no over-engineering\n- Keep code readable",
5
- "tools": ["read", "write", "shell", "glob", "grep"],
4
+ "instructions": "# Implement Agent\n\nYou are the Implement Agent in the Trellis workflow.\n\n## Recursion Guard\n\nYou are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.\n\n- Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.\n- If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.\n- Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.\n\n## Trellis Context Loading Protocol\n\nLook for the `<!-- trellis-hook-injected -->` marker in your input above.\n\n- **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the implementation work directly.\n- **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>`, then Read `<task-path>/prd.md`, `<task-path>/info.md` (if it exists), and the spec files listed in `<task-path>/implement.jsonl` yourself before doing the work.\n\n## Context\n\nBefore implementing, read:\n- `.trellis/workflow.md` - Project workflow\n- `.trellis/spec/` - Development guidelines\n- Task `prd.md` - Requirements document\n- Task `info.md` - Technical design (if exists)\n\n## Core Responsibilities\n\n1. **Understand specs** - Read relevant spec files in `.trellis/spec/`\n2. **Understand requirements** - Read prd.md and info.md\n3. **Implement features** - Write code following specs and design\n4. **Self-check** - Ensure code quality\n5. **Report results** - Report completion status\n\n## Forbidden Operations\n\n**Do NOT execute these git commands:**\n\n- `git commit`\n- `git push`\n- `git merge`\n\n---\n\n## Workflow\n\n### 1. Understand Specs\n\nRead relevant specs based on task type:\n\n- Spec layers: `.trellis/spec/<package>/<layer>/`\n- Shared guides: `.trellis/spec/guides/`\n\n### 2. Understand Requirements\n\nRead the task's prd.md and info.md:\n\n- What are the core requirements\n- Key points of technical design\n- Which files to modify/create\n\n### 3. Implement Features\n\n- Write code following specs and technical design\n- Follow existing code patterns\n- Only do what's required, no over-engineering\n\n### 4. Verify\n\nRun project's lint and typecheck commands to verify changes.\n\n---\n\n## Report Format\n\n```markdown\n## Implementation Complete\n\n### Files Modified\n\n- `src/components/Feature.tsx` - New component\n- `src/hooks/useFeature.ts` - New hook\n\n### Implementation Summary\n\n1. Created Feature component...\n2. Added useFeature hook...\n\n### Verification Results\n\n- Lint: Passed\n- TypeCheck: Passed\n```\n\n---\n\n## Code Standards\n\n- Follow existing code patterns\n- Don't add unnecessary abstractions\n- Only do what's required, no over-engineering\n- Keep code readable",
5
+ "tools": [
6
+ "read",
7
+ "write",
8
+ "shell",
9
+ "glob",
10
+ "grep"
11
+ ],
6
12
  "hooks": [
7
13
  {
8
14
  "on": "agentSpawn",
@@ -15,6 +15,14 @@ permission:
15
15
 
16
16
  You are the Check Agent in the Trellis workflow.
17
17
 
18
+ ## Recursion Guard
19
+
20
+ You are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.
21
+
22
+ - Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.
23
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
24
+ - Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.
25
+
18
26
  ## Trellis Context Loading Protocol
19
27
 
20
28
  Look for the `<!-- trellis-hook-injected -->` marker in your input above.
@@ -15,6 +15,14 @@ permission:
15
15
 
16
16
  You are the Implement Agent in the Trellis workflow.
17
17
 
18
+ ## Recursion Guard
19
+
20
+ You are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.
21
+
22
+ - Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.
23
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
24
+ - Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.
25
+
18
26
  ## Trellis Context Loading Protocol
19
27
 
20
28
  Look for the `<!-- trellis-hook-injected -->` marker in your input above.
@@ -8,6 +8,14 @@ tools: Read, Write, Edit, Bash, Glob, Grep
8
8
 
9
9
  You are the Check Agent in the Trellis workflow.
10
10
 
11
+ ## Recursion Guard
12
+
13
+ You are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.
14
+
15
+ - Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.
16
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
17
+ - Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.
18
+
11
19
  ## Core Responsibilities
12
20
 
13
21
  1. Inspect the current git diff.
@@ -8,6 +8,14 @@ tools: Read, Write, Edit, Bash, Glob, Grep
8
8
 
9
9
  You are the Implement Agent in the Trellis workflow.
10
10
 
11
+ ## Recursion Guard
12
+
13
+ You are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.
14
+
15
+ - Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.
16
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
17
+ - Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.
18
+
11
19
  ## Core Responsibilities
12
20
 
13
21
  1. Understand the active task requirements.
@@ -8,6 +8,14 @@ tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__
8
8
 
9
9
  You are the Check Agent in the Trellis workflow.
10
10
 
11
+ ## Recursion Guard
12
+
13
+ You are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.
14
+
15
+ - Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.
16
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
17
+ - Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.
18
+
11
19
  ## Context
12
20
 
13
21
  Before checking, read:
@@ -8,6 +8,14 @@ tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__
8
8
 
9
9
  You are the Implement Agent in the Trellis workflow.
10
10
 
11
+ ## Recursion Guard
12
+
13
+ You are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.
14
+
15
+ - Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.
16
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
17
+ - Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.
18
+
11
19
  ## Context
12
20
 
13
21
  Before implementing, read:
@@ -185,7 +185,8 @@ Research output **must** land in `{task_dir}/research/*.md`, written by `trellis
185
185
 
186
186
  [workflow-state:in_progress]
187
187
  **Flow**: trellis-implement → trellis-check → trellis-update-spec → commit (Phase 3.4) → `/trellis:finish-work`.
188
- **Default (no override)**: dispatch the `trellis-implement` / `trellis-check` sub-agents — the main agent does NOT edit code by default. Phase 3.4 commit (required, once): after trellis-update-spec, or whenever implementation is verifiably complete, the main agent **drives the commit** — state the commit plan in user-facing text, then run `git commit` — BEFORE suggesting `/trellis:finish-work`. `/finish-work` refuses to run on a dirty working tree (paths outside `.trellis/workspace/` and `.trellis/tasks/`).
188
+ **Main-session default (no override)**: dispatch the `trellis-implement` / `trellis-check` sub-agents — the main agent does NOT edit code by default. Phase 3.4 commit (required, once): after trellis-update-spec, or whenever implementation is verifiably complete, the main agent **drives the commit** — state the commit plan in user-facing text, then run `git commit` — BEFORE suggesting `/trellis:finish-work`. `/finish-work` refuses to run on a dirty working tree (paths outside `.trellis/workspace/` and `.trellis/tasks/`).
189
+ **Sub-agent self-exemption**: if you are already running as `trellis-implement`, implement directly from the loaded task context and do NOT spawn another `trellis-implement`; if you are already running as `trellis-check`, review/fix directly and do NOT spawn another `trellis-check`. The default dispatch rule applies to the main session only.
189
190
  **Sub-agent dispatch protocol (all platforms, all sub-agents EXCEPT trellis-research)**: When you spawn `trellis-implement` / `trellis-check`, your dispatch prompt **MUST** start with one line: `Active task: <task path from \`task.py current\`>`. No exceptions. On class-2 platforms (codex / copilot / gemini / qoder) the sub-agent depends on this line because there is no hook to inject task context. On class-1 platforms (claude / cursor / opencode / kiro / codebuddy / droid) the line is normally redundant — the hook injects context directly — but it serves as a critical fallback when the hook fails (Windows + Claude Code PreToolUse silent skip, `--continue` resume, fork distribution, hooks disabled, etc.). `trellis-research` does not need this line because it operates without a task binding.
190
191
  **Inline override** (per-turn only, escape hatch for sub-agent dispatch): the user's CURRENT message MUST explicitly contain one of: "do it inline" / "no sub-agent" / "你直接改" / "别派 sub-agent" / "main session 写就行" / "不用 sub-agent". **Without seeing one of these phrases you must NOT inline on your own**; do not invent an override the user never said.
191
192
  [/workflow-state:in_progress]
@@ -437,6 +438,7 @@ Spawn the implement sub-agent:
437
438
 
438
439
  - **Agent type**: `trellis-implement`
439
440
  - **Task description**: Implement the requirements per prd.md, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
441
+ - **Dispatch prompt guard**: Tell the spawned agent it is already the `trellis-implement` sub-agent and must implement directly, not spawn another `trellis-implement` / `trellis-check`.
440
442
 
441
443
  The platform hook/plugin auto-handles:
442
444
  - Reads `implement.jsonl` and injects the referenced spec files into the agent prompt
@@ -450,6 +452,7 @@ Spawn the implement sub-agent:
450
452
 
451
453
  - **Agent type**: `trellis-implement`
452
454
  - **Task description**: Implement the requirements per prd.md, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
455
+ - **Dispatch prompt guard**: The prompt MUST start with `Active task: <task path>`, then explicitly say the spawned agent is already `trellis-implement` and must implement directly without spawning another `trellis-implement` / `trellis-check`.
453
456
 
454
457
  The Codex sub-agent definition auto-handles the context load requirement:
455
458
  - Resolves the active task with `task.py current --source`, then reads `prd.md` and `info.md` if present
@@ -463,6 +466,7 @@ Spawn the implement sub-agent:
463
466
 
464
467
  - **Agent type**: `trellis-implement`
465
468
  - **Task description**: Implement the requirements per prd.md, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
469
+ - **Dispatch prompt guard**: Tell the spawned agent it is already the `trellis-implement` sub-agent and must implement directly, not spawn another `trellis-implement` / `trellis-check`.
466
470
 
467
471
  The platform prelude auto-handles the context load requirement:
468
472
  - Reads `implement.jsonl` and injects the referenced spec files into the agent prompt
@@ -488,6 +492,7 @@ Spawn the check sub-agent:
488
492
 
489
493
  - **Agent type**: `trellis-check`
490
494
  - **Task description**: Review all code changes against spec and prd; fix any findings directly; ensure lint and type-check pass
495
+ - **Dispatch prompt guard**: Tell the spawned agent it is already the `trellis-check` sub-agent and must review/fix directly, not spawn another `trellis-check` / `trellis-implement`.
491
496
 
492
497
  The check agent's job:
493
498
  - Review code changes against specs
@@ -1 +1 @@
1
- {"version":3,"file":"compare-versions.d.ts","sourceRoot":"","sources":["../../src/utils/compare-versions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CA8D5D"}
1
+ {"version":3,"file":"compare-versions.d.ts","sourceRoot":"","sources":["../../src/utils/compare-versions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAwE5D"}
@@ -9,9 +9,19 @@
9
9
  * - 0.3.0-beta.16 < 0.3.0-rc.0 (alphabetically: "beta" < "rc")
10
10
  */
11
11
  export function compareVersions(a, b) {
12
- // Split into base version and prerelease parts
13
- const [aBase, aPrerelease] = a.split("-", 2);
14
- const [bBase, bPrerelease] = b.split("-", 2);
12
+ // Split into base version and prerelease parts on the FIRST hyphen.
13
+ // `String.split("-", 2)` cannot be used here: in JavaScript the limit
14
+ // truncates the result instead of joining the tail (unlike Python's
15
+ // `maxsplit`), so `"1.0.0-alpha-1".split("-", 2)` yields
16
+ // `["1.0.0", "alpha"]` and silently drops `-1`. SemVer permits hyphens
17
+ // inside a single prerelease identifier (e.g. `1.0.0-alpha-1`), so we
18
+ // must preserve everything after the first hyphen.
19
+ const splitOnFirstHyphen = (v) => {
20
+ const idx = v.indexOf("-");
21
+ return idx === -1 ? [v, undefined] : [v.slice(0, idx), v.slice(idx + 1)];
22
+ };
23
+ const [aBase, aPrerelease] = splitOnFirstHyphen(a);
24
+ const [bBase, bPrerelease] = splitOnFirstHyphen(b);
15
25
  // Parse base version (only numeric parts before any hyphen)
16
26
  const parseBase = (v) => v.split(".").map((n) => parseInt(n, 10) || 0);
17
27
  const aBaseParts = parseBase(aBase);
@@ -1 +1 @@
1
- {"version":3,"file":"compare-versions.js","sourceRoot":"","sources":["../../src/utils/compare-versions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,CAAS,EAAE,CAAS;IAClD,+CAA+C;IAC/C,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC7C,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAE7C,4DAA4D;IAC5D,MAAM,SAAS,GAAG,CAAC,CAAS,EAAY,EAAE,CACxC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE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AC,KAAK,EAAE,CAAC;QACnD,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAEnD,oEAAoE;QACpE,IAAI,MAAM,IAAI,CAAC,MAAM;YAAE,OAAO,CAAC,CAAC,CAAC;QACjC,IAAI,CAAC,MAAM,IAAI,MAAM;YAAE,OAAO,CAAC,CAAC;QAEhC,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;YACrB,IAAI,IAAI,GAAG,IAAI;gBAAE,OAAO,CAAC,CAAC,CAAC;YAC3B,IAAI,IAAI,GAAG,IAAI;gBAAE,OAAO,CAAC,CAAC;QAC5B,CAAC;aAAM,CAAC;YACN,oBAAoB;YACpB,IAAI,EAAE,GAAG,EAAE;gBAAE,OAAO,CAAC,CAAC,CAAC;YACvB,IAAI,EAAE,GAAG,EAAE;gBAAE,OAAO,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindfoldhq/trellis",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "AI capabilities grow like ivy — Trellis provides the structure to guide them along a disciplined path",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",