@mindfoldhq/trellis 0.5.1 → 0.5.3
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.
- package/dist/migrations/manifests/0.5.2.json +9 -0
- package/dist/migrations/manifests/0.5.3.json +9 -0
- package/dist/templates/claude/agents/trellis-check.md +7 -0
- package/dist/templates/claude/agents/trellis-implement.md +7 -0
- package/dist/templates/codebuddy/agents/trellis-check.md +7 -0
- package/dist/templates/codebuddy/agents/trellis-implement.md +7 -0
- package/dist/templates/codex/hooks/session-start.py +6 -3
- package/dist/templates/copilot/hooks/session-start.py +6 -3
- package/dist/templates/cursor/agents/trellis-check.md +7 -0
- package/dist/templates/cursor/agents/trellis-implement.md +7 -0
- package/dist/templates/droid/droids/trellis-check.md +7 -0
- package/dist/templates/droid/droids/trellis-implement.md +7 -0
- package/dist/templates/kiro/agents/trellis-check.json +1 -1
- package/dist/templates/kiro/agents/trellis-implement.json +1 -1
- package/dist/templates/opencode/agents/trellis-check.md +4 -15
- package/dist/templates/opencode/agents/trellis-implement.md +4 -18
- package/dist/templates/shared-hooks/inject-subagent-context.py +6 -3
- package/dist/templates/shared-hooks/session-start.py +6 -3
- package/dist/templates/trellis/scripts/task.py +25 -6
- package/dist/templates/trellis/workflow.md +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.5.2",
|
|
3
|
+
"description": "Hotfix Python <=3.11 SyntaxError in SessionStart hook (f-string backslash).",
|
|
4
|
+
"breaking": false,
|
|
5
|
+
"recommendMigrate": false,
|
|
6
|
+
"changelog": "**Bug Fixes:**\n- fix(hooks): SessionStart hook crashes at parse time on Python <=3.11. The Windows path normalizer added in 0.5.0-rc.6 used `f\"{drive}:\\\\{rest.replace('/', '\\\\')}\"`; PEP 498 forbids backslashes inside f-string expression parts, so Python <=3.11 raises `SyntaxError: f-string expression part cannot include a backslash` and the hook exits with code 1 before doing anything. PEP 701 in Python 3.12 lifted the restriction, hiding the bug from 3.12+ users. Codex CLI 0.128 + Trellis 0.5.0 reproduced it in the field. Fixed by lifting the `.replace(...)` out of each f-string expression into a local variable. 9 occurrences across `codex/hooks/session-start.py`, `copilot/hooks/session-start.py`, and `shared-hooks/session-start.py` (Claude Code / Cursor / Gemini CLI / Qoder / CodeBuddy / Factory Droid / Kiro).",
|
|
7
|
+
"migrations": [],
|
|
8
|
+
"notes": "Hotfix on top of 0.5.1. Run `trellis update` (no `--migrate` needed). Affects every Python <=3.11 user on a hook-capable platform; Python 3.12+ users were unaffected."
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.5.3",
|
|
3
|
+
"description": "Hotfix: fallback for class-1 sub-agent context injection + non-blocking task.py start.",
|
|
4
|
+
"breaking": false,
|
|
5
|
+
"recommendMigrate": false,
|
|
6
|
+
"changelog": "**Bug Fixes:**\n- fix(hooks): class-1 platforms (claude / cursor / opencode / kiro / codebuddy / droid) inject sub-agent context (prd.md + implement.jsonl / check.jsonl) via PreToolUse hook. The hook silent-skips on Windows at v2.1.119 (upstream `anthropics/claude-code#53254`); the existing sub-agent definition files trusted the hook to always fire and had no fallback. Added marker-based dual-channel context loading: `inject-subagent-context.py` prepends a `<!-- trellis-hook-injected -->` sentinel to the build_implement_prompt / build_check_prompt / build_finish_prompt outputs (only emitted on the success path). Each class-1 trellis-implement / trellis-check definition now opens with a `Trellis Context Loading Protocol` section that branches on the marker: present → hook injected, proceed; absent → read `Active task` line from dispatch prompt + Read prd.md + the relevant jsonl yourself. workflow.md dispatch protocol scope changed from class-2-only to all platforms (except trellis-research).\n- fix(task): `task.py start` previously hard-failed with `return 1` when no `TRELLIS_CONTEXT_ID` was injected, blocking the AI from continuing. Replaced with a yellow-tagged degraded-mode warning, still flips `task.json.status: planning → in_progress`, returns 0. Happy path (`resolve_context_key()` truthy) is byte-identical. Affects every Windows + Claude Code user where the SessionStart hook can't reach the spawned shell.\n\nClass-2 platforms (codex / copilot / gemini / qoder) untouched — they already use `buildPullBasedPrelude`. trellis-research intentionally not marker'd — research is decoupled from task.",
|
|
7
|
+
"migrations": [],
|
|
8
|
+
"notes": "Hotfix on top of 0.5.2. Run `trellis update` (no `--migrate` needed). Affects every class-1 platform user whose SessionStart / PreToolUse hook injection ever fails (Windows + Claude Code, --continue / resume paths, fork distributions, hooks disabled)."
|
|
9
|
+
}
|
|
@@ -8,6 +8,13 @@ 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
|
+
## Trellis Context Loading Protocol
|
|
12
|
+
|
|
13
|
+
Look for the `<!-- trellis-hook-injected -->` marker in your input above.
|
|
14
|
+
|
|
15
|
+
- **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the check work directly.
|
|
16
|
+
- **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.
|
|
17
|
+
|
|
11
18
|
## Context
|
|
12
19
|
|
|
13
20
|
Before checking, read:
|
|
@@ -8,6 +8,13 @@ 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
|
+
## Trellis Context Loading Protocol
|
|
12
|
+
|
|
13
|
+
Look for the `<!-- trellis-hook-injected -->` marker in your input above.
|
|
14
|
+
|
|
15
|
+
- **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the implementation work directly.
|
|
16
|
+
- **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.
|
|
17
|
+
|
|
11
18
|
## Context
|
|
12
19
|
|
|
13
20
|
Before implementing, read:
|
|
@@ -8,6 +8,13 @@ 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
|
+
## Trellis Context Loading Protocol
|
|
12
|
+
|
|
13
|
+
Look for the `<!-- trellis-hook-injected -->` marker in your input above.
|
|
14
|
+
|
|
15
|
+
- **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the check work directly.
|
|
16
|
+
- **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.
|
|
17
|
+
|
|
11
18
|
## Context
|
|
12
19
|
|
|
13
20
|
Before checking, read:
|
|
@@ -8,6 +8,13 @@ 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
|
+
## Trellis Context Loading Protocol
|
|
12
|
+
|
|
13
|
+
Look for the `<!-- trellis-hook-injected -->` marker in your input above.
|
|
14
|
+
|
|
15
|
+
- **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the implementation work directly.
|
|
16
|
+
- **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.
|
|
17
|
+
|
|
11
18
|
## Context
|
|
12
19
|
|
|
13
20
|
Before implementing, read:
|
|
@@ -47,19 +47,22 @@ def _normalize_windows_shell_path(path_str: str) -> str:
|
|
|
47
47
|
m = re.match(r"^/([A-Za-z])/(.*)", p)
|
|
48
48
|
if m:
|
|
49
49
|
drive, rest = m.group(1).upper(), m.group(2)
|
|
50
|
-
|
|
50
|
+
rest = rest.replace('/', '\\')
|
|
51
|
+
return f"{drive}:\\{rest}"
|
|
51
52
|
|
|
52
53
|
# Cygwin style: /cygdrive/c/Users/...
|
|
53
54
|
m = re.match(r"^/cygdrive/([A-Za-z])/(.*)", p)
|
|
54
55
|
if m:
|
|
55
56
|
drive, rest = m.group(1).upper(), m.group(2)
|
|
56
|
-
|
|
57
|
+
rest = rest.replace('/', '\\')
|
|
58
|
+
return f"{drive}:\\{rest}"
|
|
57
59
|
|
|
58
60
|
# WSL mounted drive (sometimes leaked into env): /mnt/c/Users/...
|
|
59
61
|
m = re.match(r"^/mnt/([A-Za-z])/(.*)", p)
|
|
60
62
|
if m:
|
|
61
63
|
drive, rest = m.group(1).upper(), m.group(2)
|
|
62
|
-
|
|
64
|
+
rest = rest.replace('/', '\\')
|
|
65
|
+
return f"{drive}:\\{rest}"
|
|
63
66
|
|
|
64
67
|
return path_str
|
|
65
68
|
|
|
@@ -50,19 +50,22 @@ def _normalize_windows_shell_path(path_str: str) -> str:
|
|
|
50
50
|
m = re.match(r"^/([A-Za-z])/(.*)", p)
|
|
51
51
|
if m:
|
|
52
52
|
drive, rest = m.group(1).upper(), m.group(2)
|
|
53
|
-
|
|
53
|
+
rest = rest.replace('/', '\\')
|
|
54
|
+
return f"{drive}:\\{rest}"
|
|
54
55
|
|
|
55
56
|
# Cygwin style: /cygdrive/c/Users/...
|
|
56
57
|
m = re.match(r"^/cygdrive/([A-Za-z])/(.*)", p)
|
|
57
58
|
if m:
|
|
58
59
|
drive, rest = m.group(1).upper(), m.group(2)
|
|
59
|
-
|
|
60
|
+
rest = rest.replace('/', '\\')
|
|
61
|
+
return f"{drive}:\\{rest}"
|
|
60
62
|
|
|
61
63
|
# WSL mounted drive (sometimes leaked into env): /mnt/c/Users/...
|
|
62
64
|
m = re.match(r"^/mnt/([A-Za-z])/(.*)", p)
|
|
63
65
|
if m:
|
|
64
66
|
drive, rest = m.group(1).upper(), m.group(2)
|
|
65
|
-
|
|
67
|
+
rest = rest.replace('/', '\\')
|
|
68
|
+
return f"{drive}:\\{rest}"
|
|
66
69
|
|
|
67
70
|
return path_str
|
|
68
71
|
|
|
@@ -7,6 +7,13 @@ 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
|
+
## Trellis Context Loading Protocol
|
|
11
|
+
|
|
12
|
+
Look for the `<!-- trellis-hook-injected -->` marker in your input above.
|
|
13
|
+
|
|
14
|
+
- **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the check work directly.
|
|
15
|
+
- **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.
|
|
16
|
+
|
|
10
17
|
## Context
|
|
11
18
|
|
|
12
19
|
Before checking, read:
|
|
@@ -7,6 +7,13 @@ 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
|
+
## Trellis Context Loading Protocol
|
|
11
|
+
|
|
12
|
+
Look for the `<!-- trellis-hook-injected -->` marker in your input above.
|
|
13
|
+
|
|
14
|
+
- **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the implementation work directly.
|
|
15
|
+
- **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.
|
|
16
|
+
|
|
10
17
|
## Context
|
|
11
18
|
|
|
12
19
|
Before implementing, read:
|
|
@@ -8,6 +8,13 @@ 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
|
+
## Trellis Context Loading Protocol
|
|
12
|
+
|
|
13
|
+
Look for the `<!-- trellis-hook-injected -->` marker in your input above.
|
|
14
|
+
|
|
15
|
+
- **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the check work directly.
|
|
16
|
+
- **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.
|
|
17
|
+
|
|
11
18
|
## Context
|
|
12
19
|
|
|
13
20
|
Before checking, read:
|
|
@@ -8,6 +8,13 @@ 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
|
+
## Trellis Context Loading Protocol
|
|
12
|
+
|
|
13
|
+
Look for the `<!-- trellis-hook-injected -->` marker in your input above.
|
|
14
|
+
|
|
15
|
+
- **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the implementation work directly.
|
|
16
|
+
- **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.
|
|
17
|
+
|
|
11
18
|
## Context
|
|
12
19
|
|
|
13
20
|
Before implementing, read:
|
|
@@ -1,7 +1,7 @@
|
|
|
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## 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```",
|
|
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
5
|
"tools": ["read", "write", "shell", "glob", "grep"],
|
|
6
6
|
"hooks": [
|
|
7
7
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
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## 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",
|
|
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
5
|
"tools": ["read", "write", "shell", "glob", "grep"],
|
|
6
6
|
"hooks": [
|
|
7
7
|
{
|
|
@@ -15,23 +15,12 @@ permission:
|
|
|
15
15
|
|
|
16
16
|
You are the Check Agent in the Trellis workflow.
|
|
17
17
|
|
|
18
|
-
## Context
|
|
18
|
+
## Trellis Context Loading Protocol
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Look for the `<!-- trellis-hook-injected -->` marker in your input above.
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
1. Run `python3 ./.trellis/scripts/task.py current --source` → get active task directory and source (e.g., `Current task: .trellis/tasks/xxx`)
|
|
25
|
-
2. Read `{task_dir}/check.jsonl`
|
|
26
|
-
3. For each entry in JSONL:
|
|
27
|
-
- If `path` is a file → Read it
|
|
28
|
-
- If `path` is a directory → Read all `.md` files in it
|
|
29
|
-
4. Read `{task_dir}/prd.md` for requirements understanding
|
|
30
|
-
5. Read `.opencode/commands/trellis/finish-work.md` for checklist
|
|
31
|
-
|
|
32
|
-
Then proceed with the workflow below using the loaded context.
|
|
33
|
-
|
|
34
|
-
---
|
|
22
|
+
- **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the check work directly.
|
|
23
|
+
- **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>` (or run `python3 ./.trellis/scripts/task.py current --source` as a fallback), then Read `<task-path>/prd.md` and the spec files listed in `<task-path>/check.jsonl` yourself before doing the work.
|
|
35
24
|
|
|
36
25
|
## Context
|
|
37
26
|
|
|
@@ -15,26 +15,12 @@ permission:
|
|
|
15
15
|
|
|
16
16
|
You are the Implement Agent in the Trellis workflow.
|
|
17
17
|
|
|
18
|
-
## Context
|
|
18
|
+
## Trellis Context Loading Protocol
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Look for the `<!-- trellis-hook-injected -->` marker in your input above.
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
1. Run `python3 ./.trellis/scripts/task.py current --source` → get active task directory and source (e.g., `Current task: .trellis/tasks/xxx`)
|
|
25
|
-
2. Read `{task_dir}/implement.jsonl`
|
|
26
|
-
3. For each entry in JSONL (JSON object per line):
|
|
27
|
-
- Skip rows without a `"file"` field (e.g. `{"_example": "..."}` seed rows)
|
|
28
|
-
- If `file` points at a file → Read it
|
|
29
|
-
- If `file` ends with `/` (directory) → Read all `.md` files in it
|
|
30
|
-
4. Read `{task_dir}/prd.md` for requirements
|
|
31
|
-
5. Read `{task_dir}/info.md` for technical design (if exists)
|
|
32
|
-
|
|
33
|
-
**If `implement.jsonl` has no curated entries (only a seed row, or the file is missing)**: read `prd.md` to understand the task domain, then decide which specs apply based on `.trellis/spec/` layout. You can list available specs with `python3 ./.trellis/scripts/get_context.py --mode packages`. Do not block on the missing jsonl — proceed with prd-only context plus your own spec judgment.
|
|
34
|
-
|
|
35
|
-
Then proceed with the workflow below using the loaded context.
|
|
36
|
-
|
|
37
|
-
---
|
|
22
|
+
- **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the implementation work directly.
|
|
23
|
+
- **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>` (or run `python3 ./.trellis/scripts/task.py current --source` as a fallback), 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.
|
|
38
24
|
|
|
39
25
|
## Context
|
|
40
26
|
|
|
@@ -329,7 +329,8 @@ def get_finish_context(repo_root: str, task_dir: str) -> str:
|
|
|
329
329
|
|
|
330
330
|
def build_implement_prompt(original_prompt: str, context: str) -> str:
|
|
331
331
|
"""Build complete prompt for Implement"""
|
|
332
|
-
return f"""
|
|
332
|
+
return f"""<!-- trellis-hook-injected -->
|
|
333
|
+
# Implement Agent Task
|
|
333
334
|
|
|
334
335
|
You are the Implement Agent in the Multi-Agent Pipeline.
|
|
335
336
|
|
|
@@ -363,7 +364,8 @@ All the information you need has been prepared for you:
|
|
|
363
364
|
|
|
364
365
|
def build_check_prompt(original_prompt: str, context: str) -> str:
|
|
365
366
|
"""Build complete prompt for Check"""
|
|
366
|
-
return f"""
|
|
367
|
+
return f"""<!-- trellis-hook-injected -->
|
|
368
|
+
# Check Agent Task
|
|
367
369
|
|
|
368
370
|
You are the Check Agent in the Multi-Agent Pipeline (code and cross-layer checker).
|
|
369
371
|
|
|
@@ -397,7 +399,8 @@ All check specs and dev specs you need:
|
|
|
397
399
|
|
|
398
400
|
def build_finish_prompt(original_prompt: str, context: str) -> str:
|
|
399
401
|
"""Build complete prompt for Finish (final check before PR)"""
|
|
400
|
-
return f"""
|
|
402
|
+
return f"""<!-- trellis-hook-injected -->
|
|
403
|
+
# Finish Agent Task
|
|
401
404
|
|
|
402
405
|
You are performing the final check before creating a PR.
|
|
403
406
|
|
|
@@ -47,19 +47,22 @@ def _normalize_windows_shell_path(path_str: str) -> str:
|
|
|
47
47
|
m = re.match(r"^/([A-Za-z])/(.*)", p)
|
|
48
48
|
if m:
|
|
49
49
|
drive, rest = m.group(1).upper(), m.group(2)
|
|
50
|
-
|
|
50
|
+
rest = rest.replace('/', '\\')
|
|
51
|
+
return f"{drive}:\\{rest}"
|
|
51
52
|
|
|
52
53
|
# Cygwin style: /cygdrive/c/Users/...
|
|
53
54
|
m = re.match(r"^/cygdrive/([A-Za-z])/(.*)", p)
|
|
54
55
|
if m:
|
|
55
56
|
drive, rest = m.group(1).upper(), m.group(2)
|
|
56
|
-
|
|
57
|
+
rest = rest.replace('/', '\\')
|
|
58
|
+
return f"{drive}:\\{rest}"
|
|
57
59
|
|
|
58
60
|
# WSL mounted drive (sometimes leaked into env): /mnt/c/Users/...
|
|
59
61
|
m = re.match(r"^/mnt/([A-Za-z])/(.*)", p)
|
|
60
62
|
if m:
|
|
61
63
|
drive, rest = m.group(1).upper(), m.group(2)
|
|
62
|
-
|
|
64
|
+
rest = rest.replace('/', '\\')
|
|
65
|
+
return f"{drive}:\\{rest}"
|
|
63
66
|
|
|
64
67
|
return path_str
|
|
65
68
|
|
|
@@ -90,20 +90,39 @@ def cmd_start(args: argparse.Namespace) -> int:
|
|
|
90
90
|
except ValueError:
|
|
91
91
|
task_dir = str(full_path)
|
|
92
92
|
|
|
93
|
+
task_json_path = full_path / FILE_TASK_JSON
|
|
94
|
+
|
|
93
95
|
if not resolve_context_key():
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
# Degraded mode: no session identity available.
|
|
97
|
+
# Hook didn't inject TRELLIS_CONTEXT_ID (common on Windows + Claude Code,
|
|
98
|
+
# --continue resume path, fork distribution, hooks disabled, etc.). Skip
|
|
99
|
+
# per-session pointer write; AI continues based on conversation context.
|
|
100
|
+
print(colored(
|
|
101
|
+
"ℹ Session identity not available; active-task pointer not persisted "
|
|
102
|
+
"this session (degraded mode). AI continues based on conversation context.",
|
|
103
|
+
Colors.YELLOW,
|
|
104
|
+
))
|
|
105
|
+
print(colored(
|
|
96
106
|
"Hint: run inside an AI IDE/session that exposes session identity, "
|
|
97
|
-
"or set TRELLIS_CONTEXT_ID before running task.py start."
|
|
98
|
-
|
|
99
|
-
|
|
107
|
+
"or set TRELLIS_CONTEXT_ID before running task.py start.",
|
|
108
|
+
Colors.YELLOW,
|
|
109
|
+
))
|
|
110
|
+
|
|
111
|
+
# Still flip task.json status: planning → in_progress so downstream phases proceed.
|
|
112
|
+
if task_json_path.is_file():
|
|
113
|
+
data = read_json(task_json_path)
|
|
114
|
+
if data and data.get("status") == "planning":
|
|
115
|
+
data["status"] = "in_progress"
|
|
116
|
+
if write_json(task_json_path, data):
|
|
117
|
+
print(colored("✓ Status: planning → in_progress (degraded)", Colors.GREEN))
|
|
118
|
+
run_task_hooks("after_start", task_json_path, repo_root)
|
|
119
|
+
return 0
|
|
100
120
|
|
|
101
121
|
active = set_active_task(task_dir, repo_root)
|
|
102
122
|
if active:
|
|
103
123
|
print(colored(f"✓ Current task set to: {task_dir}", Colors.GREEN))
|
|
104
124
|
print(f"Source: {active.source}")
|
|
105
125
|
|
|
106
|
-
task_json_path = full_path / FILE_TASK_JSON
|
|
107
126
|
if task_json_path.is_file():
|
|
108
127
|
data = read_json(task_json_path)
|
|
109
128
|
if data and data.get("status") == "planning":
|
|
@@ -186,7 +186,7 @@ Research output **must** land in `{task_dir}/research/*.md`, written by `trellis
|
|
|
186
186
|
[workflow-state:in_progress]
|
|
187
187
|
**Flow**: trellis-implement → trellis-check → trellis-update-spec → commit (Phase 3.4) → `/trellis:finish-work`.
|
|
188
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/`).
|
|
189
|
-
**Sub-agent dispatch protocol (
|
|
189
|
+
**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
190
|
**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
191
|
[/workflow-state:in_progress]
|
|
192
192
|
|
package/package.json
CHANGED