@blxzer/cursor-trellis 0.2.8 → 0.3.0
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/CHANGELOG.md +89 -0
- package/README.md +37 -12
- package/README.zh-CN.md +41 -16
- package/bin/{trellis.js → cstl.js} +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +30 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/capability-smoke.d.ts +24 -0
- package/dist/commands/capability-smoke.d.ts.map +1 -0
- package/dist/commands/capability-smoke.js +83 -0
- package/dist/commands/capability-smoke.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +94 -34
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/uninstall.d.ts +1 -1
- package/dist/commands/uninstall.js +2 -2
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.d.ts +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +79 -34
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/upgrade.js +2 -2
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/configurators/cursor.d.ts +2 -2
- package/dist/configurators/cursor.js +4 -4
- package/dist/configurators/cursor.js.map +1 -1
- package/dist/configurators/index.js +3 -3
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/shared.d.ts +10 -10
- package/dist/configurators/shared.d.ts.map +1 -1
- package/dist/configurators/shared.js +26 -26
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/workflow.d.ts +2 -2
- package/dist/migrations/manifests/0.2.10.json +374 -0
- package/dist/migrations/manifests/0.2.9.json +9 -0
- package/dist/migrations/manifests/0.3.0.json +89 -0
- package/dist/templates/common/bundled-skills/{trellis-cursor2plus-setup → cstl-cursor2plus-setup}/SKILL.md +5 -4
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/SKILL.md +75 -75
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/customize-local/add-project-local-conventions.md +8 -8
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/customize-local/change-agents.md +6 -6
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/customize-local/change-context-loading.md +7 -7
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/customize-local/change-skills-or-commands.md +1 -1
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/customize-local/change-spec-structure.md +2 -2
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/customize-local/change-task-lifecycle.md +31 -31
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/customize-local/change-workflow.md +12 -12
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/customize-local/overview.md +55 -55
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/local-architecture/context-injection.md +13 -13
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/local-architecture/generated-files.md +83 -83
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/local-architecture/overview.md +2 -2
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/local-architecture/spec-system.md +1 -1
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/local-architecture/task-system.md +22 -22
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/local-architecture/workflow.md +5 -5
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/local-architecture/workspace-memory.md +3 -3
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/platform-files/agents.md +11 -11
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/platform-files/hooks-and-settings.md +1 -1
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/platform-files/overview.md +4 -4
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/platform-files/platform-map.md +5 -5
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/platform-files/skills-and-commands.md +15 -15
- package/dist/templates/common/bundled-skills/{trellis-micro-grill → cstl-micro-grill}/SKILL.md +62 -47
- package/dist/templates/common/bundled-skills/{trellis-skill-creator → cstl-skill-creator}/SKILL.md +44 -44
- package/dist/templates/common/bundled-skills/{trellis-skill-creator → cstl-skill-creator}/references/authoring-rules.md +97 -97
- package/dist/templates/common/bundled-skills/{trellis-skill-creator/references/trellis-skill-locations.md → cstl-skill-creator/references/cstl-skill-locations.md} +52 -52
- package/dist/templates/common/bundled-skills/{trellis-skill-creator → cstl-skill-creator}/references/review-checklist.md +47 -47
- package/dist/templates/common/bundled-skills/{trellis-spec-bootstrap → cstl-spec-bootstrap}/SKILL.md +1 -1
- package/dist/templates/common/bundled-skills/smart-search-cli/SKILL.md +7 -8
- package/dist/templates/common/bundled-skills/smart-search-cli/references/cli-contract.md +46 -46
- package/dist/templates/common/commands/continue.md +20 -20
- package/dist/templates/common/commands/start.md +11 -11
- package/dist/templates/common/index.d.ts +1 -1
- package/dist/templates/common/index.d.ts.map +1 -1
- package/dist/templates/common/skills/brainstorm.md +188 -164
- package/dist/templates/common/skills/check.md +1 -1
- package/dist/templates/cursor/agents/{trellis-check.md → cstl-check.md} +8 -8
- package/dist/templates/cursor/agents/{trellis-implement.md → cstl-implement.md} +8 -8
- package/dist/templates/cursor/agents/{trellis-research.md → cstl-research.md} +2 -2
- package/dist/templates/cursor/commands/cursor2plus-setup.md +5 -5
- package/dist/templates/cursor/fixtures/expected-rules.d.ts +1 -1
- package/dist/templates/cursor/fixtures/expected-rules.d.ts.map +1 -1
- package/dist/templates/cursor/fixtures/expected-rules.js +2 -2
- package/dist/templates/cursor/fixtures/expected-rules.js.map +1 -1
- package/dist/templates/cursor/rules/{trellis-subagent-dispatch.mdc → cstl-subagent-dispatch.mdc} +2 -2
- package/dist/templates/cursor/rules/{trellis-triage.mdc → cstl-triage.mdc} +1 -1
- package/dist/templates/markdown/agents.md +4 -4
- package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +634 -634
- package/dist/templates/markdown/spec/guides/cursor-context-injection-guide.md.txt +4 -4
- package/dist/templates/markdown/spec/guides/cursor-semantic-compliance.md.txt +6 -0
- package/dist/templates/markdown/spec/guides/cursor-subagent-policy.md.txt +393 -391
- package/dist/templates/markdown/spec/guides/durable-learning-decision-guide.md.txt +6 -6
- package/dist/templates/markdown/spec/guides/execution-strategy.md.txt +2 -2
- package/dist/templates/markdown/spec/guides/index.md.txt +3 -2
- package/dist/templates/markdown/spec/guides/retrieval-daily-guide.md.txt +12 -0
- package/dist/templates/shared-hooks/index.d.ts +1 -1
- package/dist/templates/shared-hooks/index.js +1 -1
- package/dist/templates/shared-hooks/inject-subagent-context.py +3 -3
- package/dist/templates/shared-hooks/inject-workflow-state.py +27 -27
- package/dist/templates/shared-hooks/research-end-retrieval-pack.py +1 -1
- package/dist/templates/shared-hooks/session-start.py +3 -3
- package/dist/templates/trellis/config/execution-strategy-rules.json +1 -1
- package/dist/templates/trellis/config.yaml +4 -4
- package/dist/templates/trellis/local/README.md +12 -10
- package/dist/templates/trellis/local/patch_wpelc8.py +3 -3
- package/dist/templates/trellis/local/subagent-models.json.example +1 -1
- package/dist/templates/trellis/local/trellis-task-models.json.example +3 -3
- package/dist/templates/trellis/local/trellis-task-models.json5.example +5 -5
- package/dist/templates/trellis/local/trellis_task_models_config.py +6 -6
- package/dist/templates/trellis/scripts/common/cli_adapter.py +3 -3
- package/dist/templates/trellis/scripts/common/execution_strategy.py +1 -1
- package/dist/templates/trellis/scripts/common/parent_orchestration.py +702 -702
- package/dist/templates/trellis/scripts/common/session_context.py +1159 -1159
- package/dist/templates/trellis/scripts/common/smart_search_evidence.py +33 -1
- package/dist/templates/trellis/scripts/common/subagent_dispatch.py +5 -5
- package/dist/templates/trellis/scripts/common/task_gates.py +2056 -2034
- package/dist/templates/trellis/scripts/common/task_store.py +1594 -1594
- package/dist/templates/trellis/workflow.md +805 -805
- package/dist/types/ai-tools.d.ts +1 -1
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +1 -1
- package/dist/types/ai-tools.js.map +1 -1
- package/dist/utils/project-capabilities.d.ts +14 -3
- package/dist/utils/project-capabilities.d.ts.map +1 -1
- package/dist/utils/project-capabilities.js +122 -12
- package/dist/utils/project-capabilities.js.map +1 -1
- package/dist/utils/readiness.d.ts +10 -0
- package/dist/utils/readiness.d.ts.map +1 -1
- package/dist/utils/readiness.js +6 -3
- package/dist/utils/readiness.js.map +1 -1
- package/package.json +4 -5
- /package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/customize-local/change-hooks.md +0 -0
- /package/dist/templates/common/bundled-skills/{trellis-spec-bootstrap → cstl-spec-bootstrap}/references/mcp-setup.md +0 -0
- /package/dist/templates/common/bundled-skills/{trellis-spec-bootstrap → cstl-spec-bootstrap}/references/repository-analysis.md +0 -0
- /package/dist/templates/common/bundled-skills/{trellis-spec-bootstrap → cstl-spec-bootstrap}/references/spec-task-planning.md +0 -0
- /package/dist/templates/common/bundled-skills/{trellis-spec-bootstrap → cstl-spec-bootstrap}/references/spec-writing.md +0 -0
|
@@ -1,391 +1,393 @@
|
|
|
1
|
-
# Cursor subagent dispatch policy
|
|
2
|
-
|
|
3
|
-
> **Purpose:** Cursor-first guidance for when to spawn Trellis custom agents, which mode to use, and how model choice stays on the Cursor side.
|
|
4
|
-
|
|
5
|
-
**Abstract policy:** `model_policy: cursor-configured` — Trellis workflow, agents, skills, and hooks **must not** hardcode vendor model IDs in **committed** defaults (`gpt-*`, `claude-*`, etc.).
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Quick reference: which entry point am I using?
|
|
10
|
-
|
|
11
|
-
The same `
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
How did I reach
|
|
15
|
-
│
|
|
16
|
-
├─ Opened a Cursor chat and @mentioned or /slash-invoked it
|
|
17
|
-
│ → Agent session. Top-bar model decides. Cursor Settings for
|
|
18
|
-
│ largely ineffective under BYOK. Do NOT expect json5 + Method 2.5 here.
|
|
19
|
-
│
|
|
20
|
-
├─ Main session dispatched Task(subagent_type=
|
|
21
|
-
│ → Task dispatch. ONLY path where BYOK json5 + Method 2.5 applies.
|
|
22
|
-
│ Context: CLI Layer 2 pre-embed (primary on Cursor); hook is best-effort
|
|
23
|
-
│ (<!--
|
|
24
|
-
│
|
|
25
|
-
└─ Used the
|
|
26
|
-
→ Skill form. Main-session model. Only
|
|
27
|
-
Agent + Skill forms; research/implement are NOT skills.
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
If unsure: Task dispatch is the path Trellis workflow routes through; Agent session and Skill are manual/edge entry points.
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## Scene matrix
|
|
35
|
-
|
|
36
|
-
| Scene | Mechanism | Mode | Output / notes |
|
|
37
|
-
| --------------------------------------------------- | -------------------------------------------------------------- | ----------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
38
|
-
| Code, history, or external research | `
|
|
39
|
-
| Implementation (after `start-execution --approved`) | `
|
|
40
|
-
| Post-implementation verification | `
|
|
41
|
-
| Parent/Child child worker | `generate-child-prompt --mode subagent` | **Parent Task** `
|
|
42
|
-
| Architecture / deep review | `
|
|
43
|
-
| PRD Grill (planning) | `
|
|
44
|
-
| Small unclear ask (no task) | `
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## Model dispatch strategy (BYOK-aware)
|
|
49
|
-
|
|
50
|
-
> **Model routing details:** See Method 2.5 / 2.6 below and Cursor++ provider settings (`~/.ccursor/providers.json`).
|
|
51
|
-
|
|
52
|
-
### Environment detection
|
|
53
|
-
|
|
54
|
-
| Environment | Custom Task subagent model control | Explore subagent model control |
|
|
55
|
-
| --------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------- |
|
|
56
|
-
| **Native Cursor API** | Frontmatter `model:` works (server-side routing) | Native model picker |
|
|
57
|
-
| **Cursor++ BYOK** | ❌ Frontmatter / Cursor Settings per-agent: not wired for `
|
|
58
|
-
|
|
59
|
-
Under Cursor++ BYOK, **committed** agent frontmatter `model:` and **Cursor Settings** UI for `
|
|
60
|
-
|
|
61
|
-
### Dispatch strategy matrix
|
|
62
|
-
|
|
63
|
-
| Subagent type | Independent model? (BYOK) | Method | Fallback |
|
|
64
|
-
| ----------------------------------- | ------------------------------------ | ----------------------------------------------------------------------- | -------------------- |
|
|
65
|
-
| **Explore** (built-in) | ✅ Yes | Cursor++ panel (built-in override row) | Inherit parent model |
|
|
66
|
-
| **
|
|
67
|
-
| **
|
|
68
|
-
| **
|
|
69
|
-
| **generalPurpose** / **shell** / **best-of-n-runner** | ✅ Yes if map includes keys | **Method 2.5 / 2.6** JSON map | Inherit parent model |
|
|
70
|
-
|
|
71
|
-
### When to ask (and when not)
|
|
72
|
-
|
|
73
|
-
**Ask** when a subagent dispatch is imminent AND the dispatch method depends on user choice.
|
|
74
|
-
|
|
75
|
-
**Do not ask** for: planning-only turns, PRD Grill / micro-grill, inline edits in the main session,
|
|
76
|
-
|
|
77
|
-
Task mode (Lite / Full / Parent) does **not** by itself trigger the question — only **impending subagent dispatch** does.
|
|
78
|
-
|
|
79
|
-
### Method 1: Inherit (default, zero-friction)
|
|
80
|
-
|
|
81
|
-
- Custom Task subagents inherit the parent session model.
|
|
82
|
-
- No model question asked. No frontmatter edit.
|
|
83
|
-
- **Use when:** The parent model is appropriate for the subagent's work, or the user has said "用当前模型派发" / "inherit" / "跟上次一样" in this turn.
|
|
84
|
-
|
|
85
|
-
### Method 2: Explore subagent with custom model (read-only research)
|
|
86
|
-
|
|
87
|
-
When research is purely **codebase exploration** (no external web search, no file writing outside exploration scope), dispatch an **Explore subagent** instead of
|
|
88
|
-
|
|
89
|
-
**Constraints:**
|
|
90
|
-
|
|
91
|
-
- Explore subagent is **read-only** — it cannot Write or Edit files.
|
|
92
|
-
- Cannot persist to {TASK}/research/\*.md directly — must return findings in chat, then main session persists.
|
|
93
|
-
- Cannot use smart-search-cli or external tools — limited to Glob, Grep, Read, and terminal.
|
|
94
|
-
|
|
95
|
-
**Use when:** Pure codebase search/understanding tasks where a different model adds value. Main session receives findings and writes the research files.
|
|
96
|
-
|
|
97
|
-
### Method 2.5: Cursor++ BYOK proxy map (publishable bundle)
|
|
98
|
-
|
|
99
|
-
**What it is:** A reversible patch to Cursor++ `extension.js` resolver `WPeLc8` that maps `subagentType` → BYOK catalog **slug** (`model-xxxxx`), evaluated **before** the inherit-parent branch. Verified 2026-06-18 (Cursor++ v0.0.11).
|
|
100
|
-
|
|
101
|
-
**Trellis ships (every `
|
|
102
|
-
|
|
103
|
-
**Operator workflow (Cursor++ BYOK only):**
|
|
104
|
-
|
|
105
|
-
1. Fill **`~/.ccursor/trellis-task-models.json`** (user-wide) with `subagent_type` → slug from **`~/.ccursor/providers.json`** `id` fields.
|
|
106
|
-
2. Optionally override per repo: **`.trellis/local/subagent-models.json`** (project wins on same key).
|
|
107
|
-
3. If paths are not auto-detected: copy `config.local.json.example` → `config.local.json`, or run `python patch_wpelc8.py --bootstrap`, or set `TRELLIS_CCURSOR_HOME` / `TRELLIS_CURSOR2PLUS_EXTENSION`.
|
|
108
|
-
4. From `.trellis/local/cursor2plus/`: `python patch_wpelc8.py --print-map` → `python patch_wpelc8.py` → **Developer: Reload Window**.
|
|
109
|
-
5. **Verify:** `taskToolCall dispatching` → `resolvedModelId` matches slug.
|
|
110
|
-
|
|
111
|
-
**Revert:** `python patch_wpelc8.py --revert`; Reload Window. Re-run patch after Cursor / Cursor++ upgrades.
|
|
112
|
-
|
|
113
|
-
**Cursor++ sidebar / Cursor Settings:** Do **not** wire `
|
|
114
|
-
|
|
115
|
-
### Method 2.6: Temporary Task types (advanced, BYOK)
|
|
116
|
-
|
|
117
|
-
For rare per-dispatch models on the Task channel without changing global slots:
|
|
118
|
-
|
|
119
|
-
1. Add `.cursor/agents/
|
|
120
|
-
2. Add `"
|
|
121
|
-
3. Re-run `patch_wpelc8.py`; dispatch `Task(subagent_type=
|
|
122
|
-
4. Remove agent file and JSON key when done.
|
|
123
|
-
|
|
124
|
-
Parent/Child **default** does not use 2.6 — it uses `
|
|
125
|
-
|
|
126
|
-
### Method 3: Manual dispatch (different model for Task subagent)
|
|
127
|
-
|
|
128
|
-
When a custom Task subagent (`
|
|
129
|
-
|
|
130
|
-
1. **Main session prepares the dispatch prompt** — full text with:
|
|
131
|
-
- First line: Selected task: <path> (e.g. .trellis/tasks/06-17-my-task)
|
|
132
|
-
- Task context from inject-subagent-context.py content (PRD, design, implement docs)
|
|
133
|
-
- Agent role instructions (from the corresponding .cursor/agents/
|
|
134
|
-
- Specific work assignment
|
|
135
|
-
2. **Main session presents the prompt** to the user in a clearly marked block:
|
|
136
|
-
`── Manual Dispatch Prompt ──
|
|
137
|
-
Target model: <recommended model>
|
|
138
|
-
Agent role:
|
|
139
|
-
── Prompt Start ──
|
|
140
|
-
<full prompt text>
|
|
141
|
-
── Prompt End ──`
|
|
142
|
-
3. **User actions:**
|
|
143
|
-
a. Open a new Cursor chat tab
|
|
144
|
-
b. Select the desired model in the model picker
|
|
145
|
-
c. Paste the prompt and send
|
|
146
|
-
d. Wait for completion
|
|
147
|
-
e. Copy relevant results back to the main session
|
|
148
|
-
|
|
149
|
-
4. **Main session** receives results from user and integrates them (persists research, reviews implementation, etc.)
|
|
150
|
-
|
|
151
|
-
**Use when:** The subagent work benefits significantly from a different model's strengths, and the manual overhead is justified.
|
|
152
|
-
|
|
153
|
-
### Method 4: Ephemeral model overlay (native API only)
|
|
154
|
-
|
|
155
|
-
Under **native Cursor API** (non-BYOK), frontmatter model: on agent files works for model routing. The original ephemeral overlay mechanism applies:
|
|
156
|
-
|
|
157
|
-
1. Before dispatch: edit .cursor/agents/
|
|
158
|
-
2. Dispatch the subagent.
|
|
159
|
-
3. After dispatch: restore frontmatter — remove model: line.
|
|
160
|
-
|
|
161
|
-
**Under BYOK: this method does NOT work.** Do not attempt ephemeral overlay in BYOK environments.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
├─
|
|
170
|
-
|
|
171
|
-
├─
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
- **
|
|
191
|
-
- **
|
|
192
|
-
-
|
|
193
|
-
- **Do not**
|
|
194
|
-
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
- **
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
|
218
|
-
|
|
|
219
|
-
| **You (operator)** |
|
|
220
|
-
| **
|
|
221
|
-
| **
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
|
239
|
-
|
|
|
240
|
-
|
|
|
241
|
-
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
- Parent
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
model:
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
|
288
|
-
|
|
|
289
|
-
| `
|
|
290
|
-
| `
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
-
|
|
307
|
-
|
|
308
|
-
- Do not
|
|
309
|
-
- Do not
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
|
338
|
-
|
|
|
339
|
-
| `.cursor/
|
|
340
|
-
|
|
|
341
|
-
|
|
342
|
-
**
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
-
|
|
349
|
-
-
|
|
350
|
-
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
- Cursor++
|
|
357
|
-
-
|
|
358
|
-
-
|
|
359
|
-
- Cursor
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
-
|
|
364
|
-
|
|
365
|
-
- Do not
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
"setup-worktree
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
-
|
|
388
|
-
- `.trellis
|
|
389
|
-
-
|
|
390
|
-
-
|
|
391
|
-
-
|
|
1
|
+
# Cursor subagent dispatch policy
|
|
2
|
+
|
|
3
|
+
> **Purpose:** Cursor-first guidance for when to spawn Trellis custom agents, which mode to use, and how model choice stays on the Cursor side.
|
|
4
|
+
|
|
5
|
+
**Abstract policy:** `model_policy: cursor-configured` — Trellis workflow, agents, skills, and hooks **must not** hardcode vendor model IDs in **committed** defaults (`gpt-*`, `claude-*`, etc.).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Quick reference: which entry point am I using?
|
|
10
|
+
|
|
11
|
+
The same `cstl-*` name can be reached via three entry points with **different model routing**. Identify yours before touching model config:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
How did I reach cstl-research / cstl-implement / cstl-check?
|
|
15
|
+
│
|
|
16
|
+
├─ Opened a Cursor chat and @mentioned or /slash-invoked it
|
|
17
|
+
│ → Agent session. Top-bar model decides. Cursor Settings for cstl-* are
|
|
18
|
+
│ largely ineffective under BYOK. Do NOT expect json5 + Method 2.5 here.
|
|
19
|
+
│
|
|
20
|
+
├─ Main session dispatched Task(subagent_type=cstl-*)
|
|
21
|
+
│ → Task dispatch. ONLY path where BYOK json5 + Method 2.5 applies.
|
|
22
|
+
│ Context: CLI Layer 2 pre-embed (primary on Cursor); hook is best-effort
|
|
23
|
+
│ (<!-- cstl-hook-injected --> marker; skips if already present).
|
|
24
|
+
│
|
|
25
|
+
└─ Used the cstl-check SKILL in main session (no subagent spawn)
|
|
26
|
+
→ Skill form. Main-session model. Only cstl-check has both
|
|
27
|
+
Agent + Skill forms; research/implement are NOT skills.
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If unsure: Task dispatch is the path Trellis workflow routes through; Agent session and Skill are manual/edge entry points.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Scene matrix
|
|
35
|
+
|
|
36
|
+
| Scene | Mechanism | Mode | Output / notes |
|
|
37
|
+
| --------------------------------------------------- | -------------------------------------------------------------- | ----------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
38
|
+
| Code, history, or external research | `cstl-research` | Cursor **Agent** (writable) | `{TASK}/research/*.md`; smart-search-cli first, Cursor web fallback per skill |
|
|
39
|
+
| Implementation (after `start-execution --approved`) | `cstl-implement` | Agent | Code edits; no `git commit` in subagent; **CLI Layer 2** dispatch prompt on Cursor |
|
|
40
|
+
| Post-implementation verification | `cstl-check` | Agent | Fixes + `verify.md` / gate hints; **CLI Layer 2** on Cursor; main session records gates |
|
|
41
|
+
| Parent/Child child worker | `generate-child-prompt --mode subagent` | **Parent Task** `cstl-implement` (default) | Child delivers `verify.md` + `handoff.md`; rare per-child model → **new writable Agent** session when user names that child |
|
|
42
|
+
| Architecture / deep review | `cstl-check` or documented inline deep review | Agent or main session | Model via dispatch strategy (Methods 1–2.5, 3–4 below) |
|
|
43
|
+
| PRD Grill (planning) | `cstl-micro-grill` contract **inside** `cstl-brainstorm` | **Not** a subagent | Single-question business follow-ups only |
|
|
44
|
+
| Small unclear ask (no task) | `cstl-micro-grill` skill | Main session | No task artifacts by default |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Model dispatch strategy (BYOK-aware)
|
|
49
|
+
|
|
50
|
+
> **Model routing details:** See Method 2.5 / 2.6 below and Cursor++ provider settings (`~/.ccursor/providers.json`).
|
|
51
|
+
|
|
52
|
+
### Environment detection
|
|
53
|
+
|
|
54
|
+
| Environment | Custom Task subagent model control | Explore subagent model control |
|
|
55
|
+
| --------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------- |
|
|
56
|
+
| **Native Cursor API** | Frontmatter `model:` works (server-side routing) | Native model picker |
|
|
57
|
+
| **Cursor++ BYOK** | ❌ Frontmatter / Cursor Settings per-agent: not wired for `cstl-*`; **✅ Method 2.5** if applied | ✅ Independent model via Cursor++ panel (v0.0.11+) |
|
|
58
|
+
|
|
59
|
+
Under Cursor++ BYOK, **committed** agent frontmatter `model:` and **Cursor Settings** UI for `cstl-research` / `cstl-implement` / `cstl-check` do **not** populate `subagentModelOverrides` for those types (verified). Without **Method 2.5**, custom Task subagents **inherit** the parent session BYOK model.
|
|
60
|
+
|
|
61
|
+
### Dispatch strategy matrix
|
|
62
|
+
|
|
63
|
+
| Subagent type | Independent model? (BYOK) | Method | Fallback |
|
|
64
|
+
| ----------------------------------- | ------------------------------------ | ----------------------------------------------------------------------- | -------------------- |
|
|
65
|
+
| **Explore** (built-in) | ✅ Yes | Cursor++ panel (built-in override row) | Inherit parent model |
|
|
66
|
+
| **cstl-research** (custom Task) | ✅ Yes if **Method 2.5** map applied | **Method 2.5** (machine-local); else Method 1 or **Method 3** (manual) | Inherit parent model |
|
|
67
|
+
| **cstl-implement** (custom Task) | ✅ Yes if **Method 2.5** map applied | **Method 2.5**; else Method 1 or **Method 3** | Inherit parent model |
|
|
68
|
+
| **cstl-check** (custom Task) | ✅ Yes if **Method 2.5** map applied | **Method 2.5**; else Method 1 or **Method 3** | Inherit parent model |
|
|
69
|
+
| **generalPurpose** / **shell** / **best-of-n-runner** | ✅ Yes if map includes keys | **Method 2.5 / 2.6** JSON map | Inherit parent model |
|
|
70
|
+
|
|
71
|
+
### When to ask (and when not)
|
|
72
|
+
|
|
73
|
+
**Ask** when a subagent dispatch is imminent AND the dispatch method depends on user choice.
|
|
74
|
+
|
|
75
|
+
**Do not ask** for: planning-only turns, PRD Grill / micro-grill, inline edits in the main session, cstl-check **skill** without spawning the check agent, or any turn where no Trellis subagent will run this round.
|
|
76
|
+
|
|
77
|
+
Task mode (Lite / Full / Parent) does **not** by itself trigger the question — only **impending subagent dispatch** does.
|
|
78
|
+
|
|
79
|
+
### Method 1: Inherit (default, zero-friction)
|
|
80
|
+
|
|
81
|
+
- Custom Task subagents inherit the parent session model.
|
|
82
|
+
- No model question asked. No frontmatter edit.
|
|
83
|
+
- **Use when:** The parent model is appropriate for the subagent's work, or the user has said "用当前模型派发" / "inherit" / "跟上次一样" in this turn.
|
|
84
|
+
|
|
85
|
+
### Method 2: Explore subagent with custom model (read-only research)
|
|
86
|
+
|
|
87
|
+
When research is purely **codebase exploration** (no external web search, no file writing outside exploration scope), dispatch an **Explore subagent** instead of cstl-research. The Explore type gets independent model selection via the Cursor++ panel.
|
|
88
|
+
|
|
89
|
+
**Constraints:**
|
|
90
|
+
|
|
91
|
+
- Explore subagent is **read-only** — it cannot Write or Edit files.
|
|
92
|
+
- Cannot persist to {TASK}/research/\*.md directly — must return findings in chat, then main session persists.
|
|
93
|
+
- Cannot use smart-search-cli or external tools — limited to Glob, Grep, Read, and terminal.
|
|
94
|
+
|
|
95
|
+
**Use when:** Pure codebase search/understanding tasks where a different model adds value. Main session receives findings and writes the research files.
|
|
96
|
+
|
|
97
|
+
### Method 2.5: Cursor++ BYOK proxy map (publishable bundle)
|
|
98
|
+
|
|
99
|
+
**What it is:** A reversible patch to Cursor++ `extension.js` resolver `WPeLc8` that maps `subagentType` → BYOK catalog **slug** (`model-xxxxx`), evaluated **before** the inherit-parent branch. Verified 2026-06-18 (Cursor++ v0.0.11).
|
|
100
|
+
|
|
101
|
+
**Trellis ships (every `cstl init` / `cstl update`, strategy C):** `.trellis/local/cursor2plus/` — `patch_wpelc8.py`, `README.md`, `config.local.json.example`. Native Cursor API users can ignore this directory.
|
|
102
|
+
|
|
103
|
+
**Operator workflow (Cursor++ BYOK only):**
|
|
104
|
+
|
|
105
|
+
1. Fill **`~/.ccursor/trellis-task-models.json`** (user-wide) with `subagent_type` → slug from **`~/.ccursor/providers.json`** `id` fields.
|
|
106
|
+
2. Optionally override per repo: **`.trellis/local/subagent-models.json`** (project wins on same key).
|
|
107
|
+
3. If paths are not auto-detected: copy `config.local.json.example` → `config.local.json`, or run `python patch_wpelc8.py --bootstrap`, or set `TRELLIS_CCURSOR_HOME` / `TRELLIS_CURSOR2PLUS_EXTENSION`.
|
|
108
|
+
4. From `.trellis/local/cursor2plus/`: `python patch_wpelc8.py --print-map` → `python patch_wpelc8.py` → **Developer: Reload Window**.
|
|
109
|
+
5. **Verify:** `taskToolCall dispatching` → `resolvedModelId` matches slug.
|
|
110
|
+
|
|
111
|
+
**Revert:** `python patch_wpelc8.py --revert`; Reload Window. Re-run patch after Cursor / Cursor++ upgrades.
|
|
112
|
+
|
|
113
|
+
**Cursor++ sidebar / Cursor Settings:** Do **not** wire `cstl-*` BYOK routing; use JSON + patch.
|
|
114
|
+
|
|
115
|
+
### Method 2.6: Temporary Task types (advanced, BYOK)
|
|
116
|
+
|
|
117
|
+
For rare per-dispatch models on the Task channel without changing global slots:
|
|
118
|
+
|
|
119
|
+
1. Add `.cursor/agents/cstl-worker-<id>.md` (role prompt only; no committed `model:`).
|
|
120
|
+
2. Add `"cstl-worker-<id>": "model-xxxxx"` to **project** `.trellis/local/subagent-models.json`.
|
|
121
|
+
3. Re-run `patch_wpelc8.py`; dispatch `Task(subagent_type=cstl-worker-<id>)`.
|
|
122
|
+
4. Remove agent file and JSON key when done.
|
|
123
|
+
|
|
124
|
+
Parent/Child **default** does not use 2.6 — it uses `cstl-implement` from the user map. Per-child manual model → **new writable Agent** session (user-named exception).
|
|
125
|
+
|
|
126
|
+
### Method 3: Manual dispatch (different model for Task subagent)
|
|
127
|
+
|
|
128
|
+
When a custom Task subagent (`cstl-research`, `cstl-implement`, `cstl-check`) needs a **different model** than the parent under BYOK **and Method 2.5 is not available**:
|
|
129
|
+
|
|
130
|
+
1. **Main session prepares the dispatch prompt** — full text with:
|
|
131
|
+
- First line: Selected task: <path> (e.g. .trellis/tasks/06-17-my-task)
|
|
132
|
+
- Task context from inject-subagent-context.py content (PRD, design, implement docs)
|
|
133
|
+
- Agent role instructions (from the corresponding .cursor/agents/cstl-<role>.md)
|
|
134
|
+
- Specific work assignment
|
|
135
|
+
2. **Main session presents the prompt** to the user in a clearly marked block:
|
|
136
|
+
`── Manual Dispatch Prompt ──
|
|
137
|
+
Target model: <recommended model>
|
|
138
|
+
Agent role: cstl-<role>
|
|
139
|
+
── Prompt Start ──
|
|
140
|
+
<full prompt text>
|
|
141
|
+
── Prompt End ──`
|
|
142
|
+
3. **User actions:**
|
|
143
|
+
a. Open a new Cursor chat tab
|
|
144
|
+
b. Select the desired model in the model picker
|
|
145
|
+
c. Paste the prompt and send
|
|
146
|
+
d. Wait for completion
|
|
147
|
+
e. Copy relevant results back to the main session
|
|
148
|
+
|
|
149
|
+
4. **Main session** receives results from user and integrates them (persists research, reviews implementation, etc.)
|
|
150
|
+
|
|
151
|
+
**Use when:** The subagent work benefits significantly from a different model's strengths, and the manual overhead is justified.
|
|
152
|
+
|
|
153
|
+
### Method 4: Ephemeral model overlay (native API only)
|
|
154
|
+
|
|
155
|
+
Under **native Cursor API** (non-BYOK), frontmatter model: on agent files works for model routing. The original ephemeral overlay mechanism applies:
|
|
156
|
+
|
|
157
|
+
1. Before dispatch: edit .cursor/agents/cstl-<role>.md frontmatter — add model: <id>.
|
|
158
|
+
2. Dispatch the subagent.
|
|
159
|
+
3. After dispatch: restore frontmatter — remove model: line.
|
|
160
|
+
|
|
161
|
+
**Under BYOK: this method does NOT work.** Do not attempt ephemeral overlay in BYOK environments.
|
|
162
|
+
|
|
163
|
+
**Live evidence (Native, 2026-07-02):** Main session with parent **Auto** + ephemeral `model: composer-2.5-fast` on `cstl-research.md` → `Task(cstl-research)` self-reported **`composer-2.5-fast`**. Task: `07-02-child-oc06-t-a3-live` / `research/native-t-a3-live-retest.md`. Evidence level: **verified** (Native main session).
|
|
164
|
+
|
|
165
|
+
### Decision flow
|
|
166
|
+
|
|
167
|
+
```text
|
|
168
|
+
Subagent dispatch needed
|
|
169
|
+
├─ Cursor++ BYOK + cstl-* needs fixed per-role models?
|
|
170
|
+
│ └─ Method 2.5 applied on this machine? → dispatch Task normally (map handles routing)
|
|
171
|
+
├─ Parent model appropriate for cstl-*? → Method 1 (inherit)
|
|
172
|
+
├─ Read-only codebase exploration only? → Method 2 (Explore + Cursor++ panel)
|
|
173
|
+
├─ Native Cursor API (non-BYOK)? → Method 4 (ephemeral frontmatter overlay)
|
|
174
|
+
└─ BYOK, no Method 2.5, different model required? → Method 3 (manual dispatch)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Main-session contract
|
|
178
|
+
|
|
179
|
+
When a dispatch is imminent:
|
|
180
|
+
|
|
181
|
+
1. Assess which method applies based on the decision flow.
|
|
182
|
+
2. If **Method 2.5** is active on this machine: dispatch `cstl-research` / `cstl-implement` / `cstl-check` via Task tool as usual — **do not** ask model each time; **do not** edit agent frontmatter.
|
|
183
|
+
3. If Method 1 (inherit): dispatch directly, no model question.
|
|
184
|
+
4. If Method 2 (Explore): set Explore model in Cursor++ panel if needed, dispatch `explore`.
|
|
185
|
+
5. If Method 3 (manual): prepare the full dispatch prompt, present to user.
|
|
186
|
+
6. If Method 4 (overlay, native API): ask model preference, apply overlay, dispatch, restore.
|
|
187
|
+
|
|
188
|
+
### Rules
|
|
189
|
+
|
|
190
|
+
- **Never** commit long-lived model: in shared Trellis templates or team repo defaults.
|
|
191
|
+
- **Never** inject model IDs via hooks (inject-subagent-context.py stays task-only).
|
|
192
|
+
- **Do not** attempt ephemeral model overlay under BYOK — it silently fails for routing (Method 4).
|
|
193
|
+
- **Do not** rely on Cursor Settings per `cstl-*` agent for BYOK routing — use Method 2.5 map or Method 3.
|
|
194
|
+
- Method 2.5 map lives **outside** committed Trellis templates (machine-local); never commit patched `extension.js` into the Trellis repo.
|
|
195
|
+
- **Do not** assume Explore subagent can replace cstl-research for all scenarios — it is read-only and cannot persist files.
|
|
196
|
+
- Workflow and skills **must not** hardcode vendor model IDs.
|
|
197
|
+
|
|
198
|
+
### Child worker
|
|
199
|
+
|
|
200
|
+
- **Default (BYOK + map):** Parent session dispatches **Task** `cstl-implement` with prompt from `generate-child-prompt --mode subagent`; model from user/project JSON map.
|
|
201
|
+
- **Exception:** User or `child-prompts.md` names a child for **separate writable Agent** → new chat, manual model, paste prompt (Method 3).
|
|
202
|
+
- **Native API:** ephemeral overlay on `cstl-implement` (Method 4) still valid.
|
|
203
|
+
|
|
204
|
+
### Technical note
|
|
205
|
+
|
|
206
|
+
Client layer still only builds override rows for built-in types such as `explore`. Cursor Settings entries for custom agent **names** do not reach the BYOK proxy override list for `cstl-*`. **Method 2.5** patches Cursor++ `WPeLc8` so `taskToolCall` sets `resolvedModelId` from a local `subagentType → slug` table before inherit-parent. **Method 3** bypasses Task routing (user picks model in a new chat).
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
## Trellis workflow: using per-agent models (BYOK + Method 2.5)
|
|
212
|
+
|
|
213
|
+
Operational contract between the Trellis task ladder and Cursor++ BYOK.
|
|
214
|
+
|
|
215
|
+
### Roles and who picks the model
|
|
216
|
+
|
|
217
|
+
| Layer | Picks model for… | Mechanism |
|
|
218
|
+
| ----- | ---------------- | --------- |
|
|
219
|
+
| **You (operator)** | Main orchestration chat | Cursor model picker (parent BYOK route) |
|
|
220
|
+
| **You (operator)** | `cstl-research` / `cstl-implement` / `cstl-check` (+ optional built-in Task types) | **Method 2.5 / 2.6** JSON maps + `.trellis/local/cursor2plus/patch_wpelc8.py` — **not** repo agent files |
|
|
221
|
+
| **You (operator)** | `explore` | Cursor++ panel |
|
|
222
|
+
| **Main Agent session** | When to spawn which agent | `workflow.md`, skills, scene matrix |
|
|
223
|
+
| **Hooks** | Never | `inject-subagent-context.py` — task context only |
|
|
224
|
+
|
|
225
|
+
### Normal Full / Lite task flow
|
|
226
|
+
|
|
227
|
+
1. **Select task** — `task.py select`; dispatch prompts include `Selected task: .trellis/tasks/<id>` when hooks need it.
|
|
228
|
+
2. **Main session model** — your choice for planning and orchestration.
|
|
229
|
+
3. **Research** — Task `subagent_type=cstl-research` → mapped research slug (Method 2.5).
|
|
230
|
+
4. **Implement** — after `start-execution --approved`, Task `cstl-implement` → mapped implement slug.
|
|
231
|
+
5. **Check** — Task `cstl-check` → mapped check slug.
|
|
232
|
+
6. **Gates / finish** — main session `record-gate`, `cstl-finish-work`.
|
|
233
|
+
|
|
234
|
+
No model field in dispatch prompt under Method 2.5. Task `model: fast` does **not** override custom types under BYOK.
|
|
235
|
+
|
|
236
|
+
### When to use which method
|
|
237
|
+
|
|
238
|
+
| Setup | Research | Implement | Check |
|
|
239
|
+
| ----- | -------- | --------- | ----- |
|
|
240
|
+
| Method 2.5 configured | `cstl-research` Task | `cstl-implement` Task | `cstl-check` Task |
|
|
241
|
+
| No map; one parent model | Task (inherit) | Task (inherit) | Task (inherit) |
|
|
242
|
+
| No map; different models | Method 3 | Method 3 | Method 3 |
|
|
243
|
+
| Repo read-only only | Method 2 Explore | — | — |
|
|
244
|
+
|
|
245
|
+
### Parent/Child
|
|
246
|
+
|
|
247
|
+
- **Default:** Parent dispatches **Task** `cstl-implement` (BYOK map applies to `subagentType`).
|
|
248
|
+
- **Rare per-child model:** new writable Agent session when user names that child — not a separate Trellis subagent type by default.
|
|
249
|
+
- Parent retains `review-child` / `integrate-child`; serial integration and worktree rules unchanged.
|
|
250
|
+
|
|
251
|
+
### Maintainer checklist (BYOK)
|
|
252
|
+
|
|
253
|
+
1. Resolve slugs in `~/.ccursor/providers.json` (or path in `config.local.json`).
|
|
254
|
+
2. Edit user and/or project JSON maps; include `generalPurpose`, `shell`, `best-of-n-runner` if you use those Task types.
|
|
255
|
+
3. Run `patch_wpelc8.py` from `.trellis/local/cursor2plus/` → Reload Window.
|
|
256
|
+
4. Re-apply after Cursor / Cursor++ upgrades.
|
|
257
|
+
|
|
258
|
+
### What stays in the Trellis repo
|
|
259
|
+
|
|
260
|
+
- `.cursor/agents/cstl-*.md` — no committed `model:`; link to this policy.
|
|
261
|
+
- Skills/workflow — **which** agent to spawn, not BYOK slugs.
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Model and reuse (baseline)
|
|
266
|
+
|
|
267
|
+
- **Baseline:** `.cursor/agents/cstl-*.md` in repo have **no** `model:` → **inherit** parent Agent session model when no overlay is applied.
|
|
268
|
+
- **`preToolUse` (Task/Subagent):** injects task context only (`inject-subagent-context.py`). Never inject model IDs.
|
|
269
|
+
|
|
270
|
+
Optional team paste (comments only — not Cursor product settings):
|
|
271
|
+
|
|
272
|
+
```yaml
|
|
273
|
+
model_policy: cursor-configured
|
|
274
|
+
dispatch_model: inherit_or_method25_or_manual
|
|
275
|
+
child_worker:
|
|
276
|
+
mode: separate_writable_agent_session
|
|
277
|
+
explore_subagent:
|
|
278
|
+
model: independent # Cursor++ panel
|
|
279
|
+
trellis_task_subagents:
|
|
280
|
+
model: method_2_5_proxy_map # machine-local; not in git
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Hooks (Cursor)
|
|
286
|
+
|
|
287
|
+
| Event | Role |
|
|
288
|
+
| -------------------------- | ----------------------------------------------------------------------- |
|
|
289
|
+
| `sessionStart` | Task dashboard, phase index, next-action |
|
|
290
|
+
| `preToolUse` Task/Subagent | PRD/jsonl + `<!-- cstl-hook-injected -->` |
|
|
291
|
+
| `beforeShellExecution` | Short-lived ticket for `task.py select` / `selected` / `exit` in shells |
|
|
292
|
+
| `stop` | Optional `retrieval-pack-latest.json` when task has `research/` |
|
|
293
|
+
|
|
294
|
+
**Per-turn workflow-state on Cursor:** deferred — use `sessionStart` + `/cstl-continue` / `get_context.py --mode phase` instead of a per-turn hook injection (the relevant Cursor channel has a confirmed `additional_context` bug, see `cursor-context-injection-guide.md`).
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Parent/Child alignment
|
|
299
|
+
|
|
300
|
+
- `generate-child-prompt --mode subagent` → Parent **Task** `cstl-implement` by default; inline mode is the portable default when dispatching without spawning a subagent.
|
|
301
|
+
- Child workers call `task.py set-child-state <parent> <child> <open|working|blocked|review> --evidence <ref>` — **no** session identity required for this command.
|
|
302
|
+
- Integration states (`accepted`, `integrating`, `integrated`, …) are **Parent-only** via `integrate-child` / `review-child`.
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## Anti-patterns
|
|
307
|
+
|
|
308
|
+
- Do not use generic `generalPurpose` / default agents for Trellis research, implement, or check.
|
|
309
|
+
- Do not spawn `cstl-implement` from inside `cstl-implement` (recursion guard in agent defs).
|
|
310
|
+
- Do not spawn a subagent for PRD Grill — use brainstorm Phase B + micro-grill contract.
|
|
311
|
+
- Do not leave `model:` on agent files after dispatch (always restore).
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## Maintainer: subagent missing task context (Cursor)
|
|
316
|
+
|
|
317
|
+
If a dispatched subagent cannot answer from `prd.md` / jsonl (empty or generic replies):
|
|
318
|
+
|
|
319
|
+
1. Confirm the main session used **CLI Layer 2** before `Task(...)` (workflow Phase 2.1 / 2.2).
|
|
320
|
+
2. **Manual fallback (Method 3):** run `python ./.trellis/scripts/task.py generate-dispatch-prompt <task-dir> <role> [--scope "..."]`, paste stdout into `Task(subagent_type=..., prompt=...)`.
|
|
321
|
+
3. Hook-only injection is best-effort on Cursor; do not treat `preToolUse` as the sole source.
|
|
322
|
+
|
|
323
|
+
This command is **Agent-facing** — not listed in user README or slash command surface.
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Hook fallback (no selected-task pointer)
|
|
328
|
+
|
|
329
|
+
When `preToolUse` cannot resolve a selected task, the subagent should read **`Selected task:`** from the first line of its dispatch prompt, then load `implement.jsonl` / `check.jsonl`, `prd.md`, `design.md`, and `implement.md` manually. Trellis does **not** document or depend on Cursor `/multitask` for workflow orchestration.
|
|
330
|
+
|
|
331
|
+
## Cursor++ (BYOK) compatibility
|
|
332
|
+
|
|
333
|
+
[Cursor++](https://ccursor.cometix.dev) (ccursor by cometix) is a third-party Patch that intercepts Cursor API traffic via a local server (`127.0.0.1:39831`). It does **not** modify `.cursor/` files — it intercepts at the API/gRPC layer (`AgentService/RunSSE`, `AvailableModels`, etc.) and routes requests to BYOK providers.
|
|
334
|
+
|
|
335
|
+
### Confirmed compatibility (v0.0.11+, Cursor 3.7.27)
|
|
336
|
+
|
|
337
|
+
| Trellis component | Status under Cursor++ | Notes |
|
|
338
|
+
| --------------------- | --------------------- | ----------------------------------------------------------------------------------- |
|
|
339
|
+
| `.cursor/agents/` | Normal | Agent files not intercepted; `model:` frontmatter read by Cursor at spawn |
|
|
340
|
+
| `.cursor/hooks/` | Normal | Hook config loads; verify `hooksConfig` in agent logs when debugging |
|
|
341
|
+
| `.cursor/mcp.json` | Normal | MCP servers and tools load normally |
|
|
342
|
+
| SubAgent write access | **Fixed in v0.0.11** | Prior versions defaulted SubAgent to readonly; `cstl-implement` now writes files |
|
|
343
|
+
|
|
344
|
+
**Minimum version: v0.0.11.** Earlier versions break `cstl-implement` due to SubAgent readonly bug.
|
|
345
|
+
|
|
346
|
+
### Model routing under BYOK (verified 2026-06-18)
|
|
347
|
+
|
|
348
|
+
- **Explore subagent:** Independent model selection works via Cursor++ panel (v0.0.11+). Cursor++ intercepts and routes the selected BYOK model for Explore-type requests.
|
|
349
|
+
- **Custom Task subagents:** Frontmatter `model:` and Cursor Settings per-agent names are **not** applied for `cstl-*` BYOK routing. Use **Method 2.5** or **Method 3**. **Explore** uses Cursor++ panel.
|
|
350
|
+
- The `model:` ID **must match** a model configured in Cursor++ provider settings (`~/.ccursor/providers.json`). If it doesn't match, the request will fail with a provider error.
|
|
351
|
+
- Cursor++ intercepts `AvailableModels`/`GetDefaultModel` - the model picker and model list are determined by BYOK provider config, not Cursor's official model catalog.
|
|
352
|
+
- Under Cursor++, "inherit" means the parent session's BYOK-routed model, which may differ from what the Cursor UI label suggests.
|
|
353
|
+
|
|
354
|
+
### Safety boundary
|
|
355
|
+
|
|
356
|
+
- Cursor++ patches Cursor internal modules at runtime. Strongest recovery: reinstall Cursor.
|
|
357
|
+
- API keys are stored in **plaintext** in `~/.ccursor/providers.json` — restrict file permissions (`chmod 600` / Windows ACL).
|
|
358
|
+
- Cursor++ stores rules in `~/.ccursor/knowledge-base.json`, independent of `.cursor/rules/` and Trellis rules.
|
|
359
|
+
- Version updates lag behind Cursor releases — after a Cursor update, BYOK routing may break until Cursor++ catches up. Trellis hooks/agents/skills survive the window (they don't depend on API routing).
|
|
360
|
+
- Do not mix Cursor++ BYOK sessions with Cursor official sessions — they cannot be continued across each other.
|
|
361
|
+
- Cursor++ may violate Cursor ToS; use at own risk. Not recommended for enterprise/compliance environments.
|
|
362
|
+
|
|
363
|
+
### Anti-patterns for Cursor++
|
|
364
|
+
|
|
365
|
+
- Do not use Cursor++ older than v0.0.11 with Trellis (SubAgent readonly bug).
|
|
366
|
+
- Do not assume Cursor official model IDs work under BYOK — use model IDs from your provider config.
|
|
367
|
+
- Do not mix Cursor++ and Cursor official sessions for the same conversation.
|
|
368
|
+
|
|
369
|
+
## Worktree template
|
|
370
|
+
|
|
371
|
+
When Parent/Child children use `isolation: git-worktree`, configure `.cursor/worktrees.json` and `task.py prepare-child-worktree` so each child edits in an isolated Git checkout:
|
|
372
|
+
|
|
373
|
+
```json
|
|
374
|
+
{
|
|
375
|
+
"setup-worktree": ["<install-command>"],
|
|
376
|
+
"setup-worktree-unix": ["<install-command>"],
|
|
377
|
+
"setup-worktree-windows": ["<install-command>"]
|
|
378
|
+
}
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
Replace `<install-command>` with the project's dependency install command (e.g. `pnpm install --frozen-lockfile`, `npm ci`, `pip install -e .`). Platform-specific keys (`setup-worktree-unix`, `setup-worktree-windows`) are optional; `setup-worktree` is the cross-platform fallback.
|
|
382
|
+
|
|
383
|
+
For multi-package workspaces, list all install commands needed after a fresh checkout.
|
|
384
|
+
|
|
385
|
+
## References
|
|
386
|
+
|
|
387
|
+
- `.cursor/agents/cstl-research.md`, `cstl-implement.md`, `cstl-check.md`
|
|
388
|
+
- `.cursor/agents/.trellis-model-overlay.local.md` — optional overlay audit stub (native API)
|
|
389
|
+
- Reference `patch_wpelc8.py` in task `06-18-byok-manual-dispatch-automation/research/` — copy locally; not a runtime git dependency
|
|
390
|
+
- `.trellis/workflow.md` — Task Ladder + Parent orchestration
|
|
391
|
+
- [Cursor Subagents](https://cursor.com/docs/subagents) — `model: inherit | <id>`
|
|
392
|
+
- [Cursor Multitask changelog](https://cursor.com/changelog/04-24-26) — `/multitask`, Worktrees, Multi-root Workspaces
|
|
393
|
+
- `.cursor/worktrees.json` — Cursor native worktree setup configuration
|