@blxzer/cursor-trellis 0.3.5 → 0.4.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.
Files changed (156) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +13 -0
  3. package/dist/cli/index.d.ts.map +1 -1
  4. package/dist/cli/index.js +3 -0
  5. package/dist/cli/index.js.map +1 -1
  6. package/dist/commands/goal/index.d.ts +3 -0
  7. package/dist/commands/goal/index.d.ts.map +1 -0
  8. package/dist/commands/goal/index.js +159 -0
  9. package/dist/commands/goal/index.js.map +1 -0
  10. package/dist/commands/goal/review.d.ts +6 -0
  11. package/dist/commands/goal/review.d.ts.map +1 -0
  12. package/dist/commands/goal/review.js +28 -0
  13. package/dist/commands/goal/review.js.map +1 -0
  14. package/dist/commands/sdk/run.d.ts.map +1 -1
  15. package/dist/commands/sdk/run.js +2 -27
  16. package/dist/commands/sdk/run.js.map +1 -1
  17. package/dist/commands/update.d.ts.map +1 -1
  18. package/dist/commands/update.js +5 -1
  19. package/dist/commands/update.js.map +1 -1
  20. package/dist/configurators/workflow.d.ts.map +1 -1
  21. package/dist/configurators/workflow.js +51 -2
  22. package/dist/configurators/workflow.js.map +1 -1
  23. package/dist/constants/paths.d.ts +4 -0
  24. package/dist/constants/paths.d.ts.map +1 -1
  25. package/dist/constants/paths.js +4 -0
  26. package/dist/constants/paths.js.map +1 -1
  27. package/dist/goal/action-packet.d.ts +89 -0
  28. package/dist/goal/action-packet.d.ts.map +1 -0
  29. package/dist/goal/action-packet.js +113 -0
  30. package/dist/goal/action-packet.js.map +1 -0
  31. package/dist/goal/audit.d.ts +14 -0
  32. package/dist/goal/audit.d.ts.map +1 -0
  33. package/dist/goal/audit.js +12 -0
  34. package/dist/goal/audit.js.map +1 -0
  35. package/dist/goal/constants.d.ts +26 -0
  36. package/dist/goal/constants.d.ts.map +1 -0
  37. package/dist/goal/constants.js +24 -0
  38. package/dist/goal/constants.js.map +1 -0
  39. package/dist/goal/paths.d.ts +8 -0
  40. package/dist/goal/paths.d.ts.map +1 -0
  41. package/dist/goal/paths.js +36 -0
  42. package/dist/goal/paths.js.map +1 -0
  43. package/dist/goal/preflight.d.ts +21 -0
  44. package/dist/goal/preflight.d.ts.map +1 -0
  45. package/dist/goal/preflight.js +97 -0
  46. package/dist/goal/preflight.js.map +1 -0
  47. package/dist/goal/review-seam.d.ts +44 -0
  48. package/dist/goal/review-seam.d.ts.map +1 -0
  49. package/dist/goal/review-seam.js +153 -0
  50. package/dist/goal/review-seam.js.map +1 -0
  51. package/dist/goal/reviewer-rules.d.ts +13 -0
  52. package/dist/goal/reviewer-rules.d.ts.map +1 -0
  53. package/dist/goal/reviewer-rules.js +153 -0
  54. package/dist/goal/reviewer-rules.js.map +1 -0
  55. package/dist/goal/reviewer.d.ts +9 -0
  56. package/dist/goal/reviewer.d.ts.map +1 -0
  57. package/dist/goal/reviewer.js +54 -0
  58. package/dist/goal/reviewer.js.map +1 -0
  59. package/dist/goal/runtime.d.ts +32 -0
  60. package/dist/goal/runtime.d.ts.map +1 -0
  61. package/dist/goal/runtime.js +242 -0
  62. package/dist/goal/runtime.js.map +1 -0
  63. package/dist/goal/sdk-client.d.ts +10 -0
  64. package/dist/goal/sdk-client.d.ts.map +1 -0
  65. package/dist/goal/sdk-client.js +34 -0
  66. package/dist/goal/sdk-client.js.map +1 -0
  67. package/dist/goal/state.d.ts +40 -0
  68. package/dist/goal/state.d.ts.map +1 -0
  69. package/dist/goal/state.js +37 -0
  70. package/dist/goal/state.js.map +1 -0
  71. package/dist/goal/task-triggers.d.ts +15 -0
  72. package/dist/goal/task-triggers.d.ts.map +1 -0
  73. package/dist/goal/task-triggers.js +23 -0
  74. package/dist/goal/task-triggers.js.map +1 -0
  75. package/dist/goal/walls.d.ts +12 -0
  76. package/dist/goal/walls.d.ts.map +1 -0
  77. package/dist/goal/walls.js +65 -0
  78. package/dist/goal/walls.js.map +1 -0
  79. package/dist/goal/worker-prompt.d.ts +13 -0
  80. package/dist/goal/worker-prompt.d.ts.map +1 -0
  81. package/dist/goal/worker-prompt.js +41 -0
  82. package/dist/goal/worker-prompt.js.map +1 -0
  83. package/dist/goal/worker.d.ts +42 -0
  84. package/dist/goal/worker.d.ts.map +1 -0
  85. package/dist/goal/worker.js +180 -0
  86. package/dist/goal/worker.js.map +1 -0
  87. package/dist/migrations/manifests/0.3.5.json +9 -0
  88. package/dist/migrations/manifests/0.3.6.json +9 -0
  89. package/dist/migrations/manifests/0.4.0.json +9 -0
  90. package/dist/templates/common/commands/continue.md +15 -3
  91. package/dist/templates/common/skills/check.md +7 -4
  92. package/dist/templates/cursor/agents/cstl-check.md +1 -0
  93. package/dist/templates/cursor/fixtures/expected-rules.d.ts.map +1 -1
  94. package/dist/templates/cursor/fixtures/expected-rules.js +6 -1
  95. package/dist/templates/cursor/fixtures/expected-rules.js.map +1 -1
  96. package/dist/templates/cursor/rules/cstl-cursor-modes.mdc +32 -0
  97. package/dist/templates/cursor/rules/cstl-triage.mdc +2 -4
  98. package/dist/templates/cursor/rules/retrieval-routing.mdc +26 -7
  99. package/dist/templates/markdown/index.d.ts +9 -0
  100. package/dist/templates/markdown/index.d.ts.map +1 -1
  101. package/dist/templates/markdown/index.js +9 -0
  102. package/dist/templates/markdown/index.js.map +1 -1
  103. package/dist/templates/markdown/spec/guides/artifact-locale-guide.md.txt +93 -0
  104. package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +7 -7
  105. package/dist/templates/markdown/spec/guides/cursor-context-injection-guide.md.txt +38 -21
  106. package/dist/templates/markdown/spec/guides/cursor-native-modes-guide.md.txt +125 -0
  107. package/dist/templates/markdown/spec/guides/cursor-subagent-policy.md.txt +10 -8
  108. package/dist/templates/markdown/spec/guides/debug-loop-guide.md.txt +227 -0
  109. package/dist/templates/markdown/spec/guides/goal-release-regression-runbook.md.txt +132 -0
  110. package/dist/templates/markdown/spec/guides/index.md.txt +144 -104
  111. package/dist/templates/markdown/spec/guides/injection-budget-guide.md.txt +111 -0
  112. package/dist/templates/markdown/spec/guides/prototype-guide.md.txt +139 -0
  113. package/dist/templates/markdown/spec/guides/retrieval-daily-guide.md.txt +28 -6
  114. package/dist/templates/markdown/spec/guides/test-discipline-guide.md.txt +138 -0
  115. package/dist/templates/markdown/spec/guides/verification-strength-guide.md.txt +185 -0
  116. package/dist/templates/shared-hooks/session-start.py +10 -0
  117. package/dist/templates/trellis/config.yaml +18 -0
  118. package/dist/templates/trellis/index.d.ts +17 -0
  119. package/dist/templates/trellis/index.d.ts.map +1 -1
  120. package/dist/templates/trellis/index.js +40 -0
  121. package/dist/templates/trellis/index.js.map +1 -1
  122. package/dist/templates/trellis/pool/README.md +103 -0
  123. package/dist/templates/trellis/pool/items/.gitkeep +0 -0
  124. package/dist/templates/trellis/pool/plan.md +26 -0
  125. package/dist/templates/trellis/scripts/common/artifact_locale.py +278 -0
  126. package/dist/templates/trellis/scripts/common/codebase_retrieval_router.py +37 -2
  127. package/dist/templates/trellis/scripts/common/config.py +39 -0
  128. package/dist/templates/trellis/scripts/common/injection_budget.py +317 -0
  129. package/dist/templates/trellis/scripts/common/parent_orchestration.py +161 -5
  130. package/dist/templates/trellis/scripts/common/pool_store.py +702 -0
  131. package/dist/templates/trellis/scripts/common/retrieval_agent_instructions.py +9 -3
  132. package/dist/templates/trellis/scripts/common/session_context.py +32 -4
  133. package/dist/templates/trellis/scripts/common/session_memory.py +26 -0
  134. package/dist/templates/trellis/scripts/common/subagent_dispatch.py +74 -9
  135. package/dist/templates/trellis/scripts/common/task_context.py +18 -0
  136. package/dist/templates/trellis/scripts/common/task_dashboard.py +24 -1
  137. package/dist/templates/trellis/scripts/common/task_dependencies.py +673 -0
  138. package/dist/templates/trellis/scripts/common/task_gates.py +58 -5
  139. package/dist/templates/trellis/scripts/common/task_map.py +40 -8
  140. package/dist/templates/trellis/scripts/common/task_store.py +400 -39
  141. package/dist/templates/trellis/scripts/common/test_depends_mode_block.py +489 -0
  142. package/dist/templates/trellis/scripts/common/test_observable_defaults.py +135 -0
  143. package/dist/templates/trellis/scripts/common/test_pool_store.py +428 -0
  144. package/dist/templates/trellis/scripts/common/test_task_dependencies.py +345 -0
  145. package/dist/templates/trellis/scripts/cursor_retrieval_probe_prompt.md +14 -12
  146. package/dist/templates/trellis/scripts/generate_dispatch_prompt.py +182 -0
  147. package/dist/templates/trellis/scripts/injection_budget_probe.py +69 -0
  148. package/dist/templates/trellis/scripts/pool.py +192 -0
  149. package/dist/templates/trellis/scripts/retrieval_probe_matrix_template.json +3 -3
  150. package/dist/templates/trellis/scripts/spec_health_outcomes.py +160 -0
  151. package/dist/templates/trellis/scripts/task.py +85 -1
  152. package/dist/templates/trellis/scripts/verify_evidence_probe.py +138 -0
  153. package/dist/templates/trellis/tasks/locale/en/default-prd.md +19 -0
  154. package/dist/templates/trellis/tasks/locale/zh/default-prd.md +19 -0
  155. package/dist/templates/trellis/workflow.md +55 -5
  156. package/package.json +2 -2
@@ -0,0 +1,32 @@
1
+ ---
2
+ description: "Prefer Cursor native modes — task-driven; quiet cstl spine fallback"
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Prefer Cursor native modes (P1 — orchestrate, don't replace)
7
+
8
+ cstl **prefers** Cursor native modes and maps them to Trellis Triage/phases. **Do not** replace Cursor UI or invent a parallel Plan/Ask/Debug product. Full table: `.cstl/spec/guides/cursor-native-modes-guide.md` · evidence: `{TASK}/research/modes-callability-matrix.md`.
9
+
10
+ ## Quick routing
11
+
12
+ | Situation | Prefer | Trellis anchor |
13
+ | --- | --- | --- |
14
+ | Read-only explain / lookup | **Ask** when reachable; else No Task in Agent | `[Triage: No Task]` — no durable edits |
15
+ | Scope / design before code | **Try `SwitchMode(plan)`**; if poor, write artifacts in Agent | Phase 1 → `prd.md` / `design.md` / `implement.md`; `--check` |
16
+ | Approved build / verify | **Agent**; `SwitchMode(agent)` after Plan | Phase 2–3; `execution_mode` |
17
+ | Runtime / repeat failure | **Debug** when reachable; else verify + break-loop | Evidence → `verify.md` |
18
+ | Independent Parent children (post-approval) | **Multitask** / `Task` parallel when useful | Explicit `.cstl/tasks/<dir>` per worker; Parent integrates |
19
+
20
+ ## Quiet fallback
21
+
22
+ When native cannot be task-driven well: continue on the **cstl spine** (Triage / Phase / artifacts / gates). Do **not** add user-facing “本版本不适配某 mode” copy. Do **not** center guidance on “please open the mode picker.”
23
+
24
+ ## Hard boundaries
25
+
26
+ - Plan default save = **home dir** until Save to workspace → map into task files.
27
+ - Multitask/subagents: **never** rely on `selected_task`; worktrees + Parent review.
28
+ - Agent `SwitchMode`: **`plan` / `agent` only** (Ask/Debug not in the tool enum).
29
+
30
+ ## Rollback
31
+
32
+ Delete this file + `cursor-native-modes-guide.md` (see guide Rollback).
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Trellis Request Triage — mandatory classification before any work (Cursor sessionStart additional_context is broken; this rule is the reliable injection channel)"
2
+ description: "Trellis Request Triage — mandatory classification before any work (Cursor: alwaysApply rule is the per-turn reliable channel; sessionStart is session-level only)"
3
3
  alwaysApply: true
4
4
  ---
5
5
 
@@ -33,6 +33,4 @@ If the user declines a task for a simple request, skip Trellis for this session.
33
33
 
34
34
  ## Why this rule exists
35
35
 
36
- Cursor's `sessionStart` hook has a confirmed bug (#158452): `additional_context` is never injected into the agent's system context. The Triage rules in `.cstl/workflow.md` therefore never reach you via that channel. This `.cursor/rules` file is the reliable workaround Cursor prepends rules to your context before every prompt, independent of the broken sessionStart path.
37
-
38
- Full decision-tree details, trigger-signal keywords, and the Task Ladder table: see `.cstl/workflow.md` → `### Request Triage`.
36
+ Request Triage must be visible **on every turn**, not only at session start. `.cursor/rules` with `alwaysApply: true` is the reliable per-turn channel on Cursor. `sessionStart` `additional_context` delivers session-level orientation (dashboard, workflow summary) once per session useful but insufficient for a per-turn hard gate. The full decision tree also lives in `.cstl/workflow.md` for on-demand loading via `get_context.py` / `cstl-continue`.
@@ -5,7 +5,23 @@ alwaysApply: true
5
5
 
6
6
  # Codebase retrieval routing (Cursor)
7
7
 
8
- Before answering **code-location / architecture / caller-chain / config-schema** questions in this repo, use the retrieval layer deliberately. On Cursor, **`.cursor/rules` is the reliable policy channel**; **per-query `## 代码库检索计划` blocks** are injected by the **`beforeSubmitPrompt`** hook (`.cursor/hooks/inject-retrieval-plan.py`) when the user message looks like a codebase question. Do **not** depend on `sessionStart` hook `additional_context` (#158452) or end-of-turn retrieval-pack hooks for plans.
8
+ Before answering **code-location / architecture / caller-chain / config-schema** questions in this repo, use the retrieval layer deliberately. On Cursor, **`.cursor/rules` is the reliable per-turn policy channel**; the **`beforeSubmitPrompt`** hook (`.cursor/hooks/inject-retrieval-plan.py`) runs **telemetry-only** it does **not** inject `## 代码库检索计划` blocks. Generate a plan via `route_codebase_retrieval.py --instructions` when needed, or follow the default tool order below. Do **not** depend on end-of-turn retrieval-pack hooks for plans.
9
+
10
+ ## Prefer / Adapt / Own (code intelligence)
11
+
12
+ **Three surfaces (do not conflate):** (1) **IDE Editor** — full extension LSP; (2) **Agents Window (Glass)** — staff-reported partial LSP vs Editor ([forum](https://forum.cursor.com/t/cursor-agents-window-lsp-not-working-with-typescript/156772)); (3) **Agent autonomous tools** — [official list](https://cursor.com/docs/agent/overview.md) is search/read/edit/shell/web — **no** `GO_TO_DEFINITION` / raw LSP tool. Trellis routes **Agent tool table** only. See `retrieval-daily-guide.md` § Prefer/Adapt/Own evidence (2026-08-05 smart-search + Native probe).
13
+
14
+ | Need | **Prefer** (Cursor native, Agent-reachable) | **Adapt** (route by intent / `cursorEnv`) | **Own** (codegraph / MCP) |
15
+ | --- | --- | --- | --- |
16
+ | Exact literal / path | **Grep** | — | — |
17
+ | Named-symbol definition (known identifier) | **Grep → Read** | Path hints from semantic when file unknown | codegraph when cross-package trap, overload ambiguity, or blast context needed |
18
+ | Agent-session diagnostics | **ReadLints** (when in tool table) | — | — |
19
+ | Conceptual / how does X work | **Native:** built-in `@codebase` / semantic search (index embeddings; ≠ LSP) | **BYOK:** **fast_context_search** (fast-context MCP). Plans show `cursorEnv`. | — |
20
+ | Caller chain / blast radius | Grep for imports/callbacks (gap-fill) | — | **codegraph_callers** / **codegraph_explore** |
21
+ | Cross-package trap / extension symbol | Grep scoped by package or `extensions/` | — | **codegraph_search** / **codegraph_explore** |
22
+ | Raw LSP / GO_TO_DEFINITION **as Agent tool** | **Not in Agent tool table** (official docs + Native probe 2026-08-05) | IDE Editor has LSP; Agents Window may lack parity — human UI, not Agent routing | codegraph when Grep+Read insufficient |
23
+
24
+ **Rollback:** revert this rule + `retrieval-daily-guide.md` Prefer rows to the pre-P1 codegraph-first definition wording; keep codegraph MCP enabled.
9
25
 
10
26
  ## When a retrieval plan block is present
11
27
 
@@ -13,7 +29,7 @@ If the user message or Trellis context contains a block starting with `## 代码
13
29
 
14
30
  1. Execute steps **in order** before stating file paths or behavior claims.
15
31
  2. Treat each step as mandatory tooling (not suggestions).
16
- 3. Finish with **Read** verification on cited sources (definition jumps use **codegraph_node**, not LSP).
32
+ 3. Finish with **Read** verification on cited sources (definition jumps: **Grep → Read** first; **codegraph** when the plan lists structural/trap routes or Grep is ambiguous).
17
33
 
18
34
  Generate a fresh plan when needed:
19
35
 
@@ -32,12 +48,13 @@ python ./.cstl/scripts/route_codebase_retrieval.py "<question>" --json
32
48
  | Need | Tool (Cursor) |
33
49
  | --- | --- |
34
50
  | Exact string / path | **Grep** (Instant Grep) |
35
- | Who calls / blast radius | **codegraph_callers** → Grep for imports/callbacks |
51
+ | Named-symbol definition | **Grep** → **Read** (Prefer native); **codegraph_explore** / **codegraph_search** when trap, overload, or blast context needed |
52
+ | IDE diagnostics | **ReadLints** on touched or cited files |
53
+ | Who calls / blast radius | **codegraph_callers** / **codegraph_explore** → Grep for imports/callbacks |
36
54
  | Same name across packages (trap) | **codegraph_search** / **codegraph_explore** → Grep |
37
55
  | Extension symbols | **codegraph_search** under `extensions/` |
38
56
  | Conceptual / how does X work | **Native:** built-in `@codebase` / semantic search. **BYOK:** **fast_context_search** (fast-context MCP). Plans show `cursorEnv`. |
39
57
  | Policy / architecture / boundaries / storage rules | **Grep** on `AGENTS.md`, `**/AGENTS.md`, `.cstl/spec/**`, `README.md` (router `policy-docs-rg`) before implementation modules |
40
- | Definition jump | **codegraph_node** / **codegraph_search**, then **Read** (Agent does not expose GO_TO_DEFINITION / LSP) |
41
58
  | Wide cross-cutting explore | **Native:** DEEP_SEARCH or Explore subagent. **BYOK:** **Task explore** subagent, then Grep/codegraph/Read |
42
59
 
43
60
  ## Semantic on Cursor (`platform-semantic`)
@@ -50,10 +67,12 @@ python ./.cstl/scripts/route_codebase_retrieval.py "<question>" --json
50
67
 
51
68
  When the plan block includes **结果层排序**, apply it **after** collecting path candidates and **before** stating Top-1 / Top-5: caller concrete sites over assembly files; trap demotion; env scripts/e2e/bench over generic `src/auth`/`paths`. Offline reorder: `rank_retrieval_candidates.py`.
52
69
 
53
- ## codegraph-only value
70
+ ## codegraph-only value (Own layer)
71
+
72
+ Use codegraph for **call chains**, **cross-package trap disambiguation**, **extension symbol resolution**, **impact/blast radius**, and **definition/reference when native Grep+Read is ambiguous** — not for pure literal search (Grep), simple single-package definition jump (Grep+Read), BYOK concept Primary (use fast-context), Agent diagnostics (ReadLints), or **replacing IDE Editor LSP** (human surface).
54
73
 
55
- Use codegraph for **call chains**, **cross-package trap disambiguation**, **extension symbol resolution**, **impact**, and **definition/reference** (replaces unavailable Agent LSP) not for pure literal search (Grep) or BYOK concept Primary (use fast-context).
74
+ **Re-probe gate:** Before elevating raw LSP to Prefer, verify Agent tool table + `retrieval-daily-guide.md` evidence notes; if external docs add LSP tools but Native probe fails, **keep fallback** and document the gap.
56
75
 
57
76
  ## External facts
58
77
 
59
- Web/current events: **smart-search** first per `.cstl/spec/guides/retrieval-daily-guide.md` (see **External-knowledge gate** for search-or-not).
78
+ Web/current events: **smart-search** first per `.cstl/spec/guides/retrieval-daily-guide.md` (see **External-knowledge gate** for search-or-not).
@@ -30,4 +30,13 @@ export declare const guidesCursorSemanticComplianceContent: string;
30
30
  export declare const guidesCursorSubagentPolicyContent: string;
31
31
  export declare const guidesExecutionStrategyContent: string;
32
32
  export declare const guidesCursorContextInjectionGuideContent: string;
33
+ export declare const guidesCursorNativeModesGuideContent: string;
34
+ export declare const guidesVerificationStrengthGuideContent: string;
35
+ export declare const guidesInjectionBudgetGuideContent: string;
36
+ export declare const guidesArtifactLocaleGuideContent: string;
37
+ export declare const guidesDebugLoopGuideContent: string;
38
+ export declare const guidesGoalReleaseRegressionRunbookContent: string;
39
+ export declare const guidesPrototypeGuideContent: string;
40
+ export declare const guidesTestDisciplineGuideContent: string;
41
+ export declare const guidesCrossPlatformThinkingGuideContent: string;
33
42
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/markdown/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAqBH,eAAO,MAAM,eAAe,EAAE,MAAuC,CAAC;AAGtE,eAAO,MAAM,qBAAqB,EAAE,MACK,CAAC;AAG1C,eAAO,MAAM,yBAAyB,QAAwB,CAAC;AAG/D,eAAO,MAAM,wBAAwB,EAAE,MACH,CAAC;AAQrC,eAAO,MAAM,mBAAmB,EAAE,MAEjC,CAAC;AACF,eAAO,MAAM,gCAAgC,EAAE,MAE9C,CAAC;AACF,eAAO,MAAM,gCAAgC,EAAE,MAE9C,CAAC;AACF,eAAO,MAAM,+BAA+B,EAAE,MAE7C,CAAC;AACF,eAAO,MAAM,+BAA+B,EAAE,MAE7C,CAAC;AACF,eAAO,MAAM,2BAA2B,EAAE,MAEzC,CAAC;AAGF,eAAO,MAAM,oBAAoB,EAAE,MAElC,CAAC;AACF,eAAO,MAAM,iCAAiC,EAAE,MAE/C,CAAC;AACF,eAAO,MAAM,yBAAyB,EAAE,MAEvC,CAAC;AACF,eAAO,MAAM,6BAA6B,EAAE,MAE3C,CAAC;AACF,eAAO,MAAM,kCAAkC,EAAE,MAEhD,CAAC;AACF,eAAO,MAAM,gCAAgC,EAAE,MAE9C,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AAgC,EAAE,MAE9C,CAAC;AACF,eAAO,MAAM,8BAA8B,EAAE,MAE5C,CAAC;AAGF,eAAO,MAAM,kBAAkB,EAAE,MAEhC,CAAC;AACF,eAAO,MAAM,oCAAoC,EAAE,MAElD,CAAC;AACF,eAAO,MAAM,mCAAmC,EAAE,MAEjD,CAAC;AACF,eAAO,MAAM,yCAAyC,EAAE,MACiB,CAAC;AAC1E,eAAO,MAAM,gCAAgC,EAAE,MAE9C,CAAC;AACF,eAAO,MAAM,qCAAqC,EAAE,MAEnD,CAAC;AACF,eAAO,MAAM,iCAAiC,EAAE,MAE/C,CAAC;AACF,eAAO,MAAM,8BAA8B,EAAE,MAE5C,CAAC;AACF,eAAO,MAAM,wCAAwC,EAAE,MACiB,CAAC;AACzE,eAAO,MAAM,mCAAmC,EAAE,MAEjD,CAAC;AACF,eAAO,MAAM,sCAAsC,EAAE,MAEpD,CAAC;AACF,eAAO,MAAM,iCAAiC,EAAE,MAE/C,CAAC;AACF,eAAO,MAAM,gCAAgC,EAAE,MAE9C,CAAC;AACF,eAAO,MAAM,2BAA2B,EAAE,MAEzC,CAAC;AACF,eAAO,MAAM,yCAAyC,EAAE,MACiB,CAAC;AAC1E,eAAO,MAAM,2BAA2B,EAAE,MAEzC,CAAC;AACF,eAAO,MAAM,gCAAgC,EAAE,MAE9C,CAAC;AACF,eAAO,MAAM,uCAAuC,EAAE,MACiB,CAAC"}
@@ -55,4 +55,13 @@ export const guidesCursorSemanticComplianceContent = readLocalTemplate("spec/gui
55
55
  export const guidesCursorSubagentPolicyContent = readLocalTemplate("spec/guides/cursor-subagent-policy.md.txt");
56
56
  export const guidesExecutionStrategyContent = readLocalTemplate("spec/guides/execution-strategy.md.txt");
57
57
  export const guidesCursorContextInjectionGuideContent = readLocalTemplate("spec/guides/cursor-context-injection-guide.md.txt");
58
+ export const guidesCursorNativeModesGuideContent = readLocalTemplate("spec/guides/cursor-native-modes-guide.md.txt");
59
+ export const guidesVerificationStrengthGuideContent = readLocalTemplate("spec/guides/verification-strength-guide.md.txt");
60
+ export const guidesInjectionBudgetGuideContent = readLocalTemplate("spec/guides/injection-budget-guide.md.txt");
61
+ export const guidesArtifactLocaleGuideContent = readLocalTemplate("spec/guides/artifact-locale-guide.md.txt");
62
+ export const guidesDebugLoopGuideContent = readLocalTemplate("spec/guides/debug-loop-guide.md.txt");
63
+ export const guidesGoalReleaseRegressionRunbookContent = readLocalTemplate("spec/guides/goal-release-regression-runbook.md.txt");
64
+ export const guidesPrototypeGuideContent = readLocalTemplate("spec/guides/prototype-guide.md.txt");
65
+ export const guidesTestDisciplineGuideContent = readLocalTemplate("spec/guides/test-discipline-guide.md.txt");
66
+ export const guidesCrossPlatformThinkingGuideContent = readLocalTemplate("spec/guides/cross-platform-thinking-guide.md.txt");
58
67
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/markdown/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC;;GAEG;AACH,SAAS,iBAAiB,CAAC,QAAgB;IACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC3C,OAAO,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAED,gFAAgF;AAChF,8BAA8B;AAC9B,gFAAgF;AAEhF,MAAM,CAAC,MAAM,eAAe,GAAW,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAEtE,oDAAoD;AACpD,MAAM,CA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C,CACtC,CAAC;AACF,MAAM,CAAC,MAAM,yCAAyC,GACpD,iBAAiB,CAAC,oDAAoD,CAAC,CAAC;AAC1E,MAAM,CAAC,MAAM,2BAA2B,GAAW,iBAAiB,CAClE,oCAAoC,CACrC,CAAC;AACF,MAAM,CAAC,MAAM,gCAAgC,GAAW,iBAAiB,CACvE,0CAA0C,CAC3C,CAAC;AACF,MAAM,CAAC,MAAM,uCAAuC,GAClD,iBAAiB,CAAC,kDAAkD,CAAC,CAAC"}
@@ -0,0 +1,93 @@
1
+ # Human-Reviewed Artifact Locale Guide
2
+
3
+ > **Purpose:** Let PRD / DESIGN / IMPLEMENT / VERIFY / HANDOFF follow the user's language (Chinese or English) without turning Trellis into a full i18n product.
4
+
5
+ ---
6
+
7
+ ## 1. Non-goals
8
+
9
+ | In scope | Out of scope |
10
+ | --- | --- |
11
+ | Workspace / task `artifact_locale` | Full CLI `--help` / stderr i18n |
12
+ | `task.py create` PRD seed language | Auto-translating archived tasks |
13
+ | Session / planning hints for artifact language | Bilingual mirrors of `workflow.md` or `.cursor/rules` |
14
+ | `prd.md` / `design.md` / `implement.md` / `verify.md` / `handoff.md` | `task.json` field names or gate enums |
15
+
16
+ **Rollback:** `python ./.cstl/scripts/task.py artifact-locale set zh` or remove `artifact_locale` from `.cstl/config.yaml`. For a single task, delete `task.json` → `meta.artifact_locale`.
17
+
18
+ ---
19
+
20
+ ## 2. Configuration
21
+
22
+ ### Workspace default (`.cstl/config.yaml`)
23
+
24
+ ```yaml
25
+ # Human-reviewed artifact locale (zh | en)
26
+ artifact_locale: zh
27
+ ```
28
+
29
+ Default when unset: **`zh`** (matches current dogfood and User Rules for Simplified Chinese replies).
30
+
31
+ ### CLI
32
+
33
+ ```powershell
34
+ # Resolved locale (workspace default)
35
+ python ./.cstl/scripts/task.py artifact-locale get
36
+
37
+ # Resolved locale for one task (includes task override)
38
+ python ./.cstl/scripts/task.py artifact-locale get --task .cstl/tasks/<dir>
39
+
40
+ # Workspace default
41
+ python ./.cstl/scripts/task.py artifact-locale set en
42
+ python ./.cstl/scripts/task.py artifact-locale set zh
43
+
44
+ # Per-task override
45
+ python ./.cstl/scripts/task.py artifact-locale set zh --task .cstl/tasks/<dir>
46
+ ```
47
+
48
+ Invalid values print a warning and fall back to the next layer (`task` → `workspace` → `zh`).
49
+
50
+ ---
51
+
52
+ ## 3. What respects locale
53
+
54
+ | Artifact | Mechanism |
55
+ | --- | --- |
56
+ | `prd.md` on `task.py create` | Locale template under `.cstl/tasks/locale/{zh,en}/default-prd.md` |
57
+ | `design.md` / `implement.md` | Agent planning (session context + `cstl-brainstorm`) |
58
+ | `verify.md` / `handoff.md` | Agent execution / finish (same session hint) |
59
+ | Optional `tasks/templates/*` copies | Agent follows guide; English paths stay canonical |
60
+
61
+ **Does not change:** existing files in a task directory, CLI diagnostics, hooks, or machine gate names.
62
+
63
+ ---
64
+
65
+ ## 4. Dogfood checklist
66
+
67
+ 1. `artifact-locale set en` → `task.py create "Locale EN" --slug locale-dogfood-en` → `prd.md` uses `## Goal`, `## Requirements`.
68
+ 2. `artifact-locale set zh` → `task.py create "Locale ZH" --slug locale-dogfood-zh` → `prd.md` uses `## 目标`, `## 需求`.
69
+ 3. With workspace `en`, `artifact-locale set zh --task <dir>` → next create for that task only uses Chinese if `meta.artifact_locale` was set before create (override applies to resolved locale for that task).
70
+
71
+ ---
72
+
73
+ ## 5. Orthogonal `locale` settings
74
+
75
+ | Setting | Purpose |
76
+ | --- | --- |
77
+ | **`artifact_locale`** (this guide) | Human-reviewed task artifacts |
78
+ | Retrieval / semantic `locale` | Code search ranking and plan language |
79
+ | smart-search `locale-scope` | External research evidence language |
80
+
81
+ Do not merge these keys; they solve different problems.
82
+
83
+ ---
84
+
85
+ ## 6. Rollback
86
+
87
+ 1. `artifact-locale set zh` (workspace).
88
+ 2. Remove `meta.artifact_locale` from any task that should follow workspace only.
89
+ 3. Revert code/templates if needed — default `zh` keeps dogfood behavior without config.
90
+
91
+ ---
92
+
93
+ **Core principle:** Product language follows the user for artifacts they review; infrastructure stays English unless explicitly scoped.
@@ -40,7 +40,7 @@ print("Run: script.py <args>")
40
40
 
41
41
  # GOOD - Platform-aware wording
42
42
  print("Usage: python on Windows, python3 elsewhere")
43
- print("Run: {{PYTHON_CMD}} ./.cstl/scripts/task.py <args>")
43
+ print("Run: {{PYTHON_CMD}} ./.trellis/scripts/task.py <args>")
44
44
  ```
45
45
 
46
46
  **Rule 2**: When generating config files at init time, use placeholder + platform detection:
@@ -281,7 +281,7 @@ make the intended decision. Otherwise a transient sandbox/network failure hides
281
281
  the hint for the rest of the session.
282
282
 
283
283
  **Rule 2**: If a local command can provide the needed value, try it with a short
284
- timeout and captured output. For example, `cstl --version` already runs the
284
+ timeout and captured output. For example, `trellis --version` already runs the
285
285
  CLI's version comparison logic and can support an actionable update prompt
286
286
  without duplicating npm registry parsing.
287
287
 
@@ -356,7 +356,7 @@ When making platform-related changes, check **all these locations**:
356
356
 
357
357
  ### Code Locations
358
358
  - [ ] `src/templates/` - Template files for new projects
359
- - [ ] `.cstl/scripts/` - Project's own scripts (if self-hosting)
359
+ - [ ] `.trellis/scripts/` - Project's own scripts (if self-hosting)
360
360
  - [ ] `dist/` - Built output (rebuild after changes)
361
361
 
362
362
  ### Search Pattern
@@ -530,7 +530,7 @@ subprocess.run(["./script.py"]) # FileNotFoundError
530
530
 
531
531
  ```
532
532
  src/templates/script.py ← Updated
533
- .cstl/scripts/script.py ← Forgot to sync!
533
+ .trellis/scripts/script.py ← Forgot to sync!
534
534
  ```
535
535
 
536
536
  ### 4. "Python 3 is always python3"
@@ -606,8 +606,8 @@ included with Trellis, verify the whole distribution path:
606
606
  - [ ] `pnpm build` copies the asset into `dist/templates/**`.
607
607
  - [ ] `npm pack --dry-run --json` includes the expected `dist/**` path.
608
608
  - [ ] The built binary installs the asset in a fresh temp repository.
609
- - [ ] `.cstl/.template-hashes.json` tracks the generated asset path.
610
- - [ ] `cstl update --dry-run` reports `Already up to date!` in that temp
609
+ - [ ] `.trellis/.template-hashes.json` tracks the generated asset path.
610
+ - [ ] `trellis update --dry-run` reports `Already up to date!` in that temp
611
611
  repository.
612
612
 
613
613
  **Why this matters**: docs/changelog text can move independently from the code
@@ -628,7 +628,7 @@ git -C "$tmpdir" init -q
628
628
  cd "$tmpdir"
629
629
  node /path/to/Trellis/packages/cli/bin/trellis.js init -u smoke --yes --cursor
630
630
  test -f .cursor/skills/<skill>/SKILL.md
631
- grep -q '<skill>' .cstl/.template-hashes.json
631
+ grep -q '<skill>' .trellis/.template-hashes.json
632
632
  node /path/to/Trellis/packages/cli/bin/trellis.js update --dry-run
633
633
  )
634
634
  ```
@@ -4,29 +4,29 @@
4
4
 
5
5
  ---
6
6
 
7
- ## The channel matrix (verified 2026-06-19)
7
+ ## The channel matrix (verified 2026-08-05, Cursor Native 3.8.x)
8
8
 
9
- Cursor has **four** channels that can put text in front of the model. They are **not** equally reliable:
9
+ Cursor has **several** channels that can put text in front of the model. They are **not** equally reliable:
10
10
 
11
11
  | Channel | How it loads | Reliable on Cursor? | Trellis content here |
12
12
  |---|---|---|---|
13
- | `.cursor/rules/*.mdc` (`alwaysApply: true`) | Prepended before **every** prompt, independent path | ✅ **Yes** | `cstl-triage.mdc` (Request Triage hard gate) |
14
- | `beforeSubmitPrompt` hook `additional_context` | Per user message; router emits `## 代码库检索计划` | ⚠️ **Verify on your Cursor build** (docs list field; forum reports vary) | `inject-retrieval-plan.py` + `retrieval-routing.mdc` enforcement |
15
- | `AGENTS.md` (repo root + nested) | Read automatically, treated as an always-on rule | ✅ **Yes** | smart-search-first rule, command surface, remote policy (the `<!-- TRELLIS:START -->` block) |
16
- | `sessionStart` hook → `additional_context` | Hook fires, JSON parsed... **but content never reaches the model's system context** | ❌ **No (confirmed bug)** | workflow.md Phase Index + Task Dashboard + first-reply notice |
13
+ | `.cursor/rules/*.mdc` (`alwaysApply: true`) | Prepended before **every** prompt, independent path | ✅ **Yes** | `cstl-triage.mdc` (Request Triage hard gate), `retrieval-routing.mdc`, `cstl-cursor-modes.mdc` (Prefer native modes) |
14
+ | `AGENTS.md` (repo root + nested) | Read automatically, treated as an always-on rule | **Yes** | smart-search-first rule, command surface (the `<!-- CSTL:START -->` block) |
15
+ | `sessionStart` hook `additional_context` | Once per session; delivered via `hooks_context` | ✅ **Yes** (fixed — verified 2026-08-05; was #158452) | Task Dashboard, workflow Phase Index summary, first-reply notice |
16
+ | `beforeSubmitPrompt` hook → `additional_context` | Per user message; router would emit `## 代码库检索计划` | ❌ **No (telemetry-only since 2026-06-24)** | `inject-retrieval-plan.py` logs to `.cstl/.runtime/retrieval-plan-events.log`; **no injection** |
17
17
  | `.cstl/workflow.md` (read on demand) | Only if the agent explicitly runs `get_context.py` or reads the file | ⚠️ Depends on agent taking action | Full Request Triage section, Task Ladder, workflow-state breadcrumbs |
18
- | **`task.py generate-dispatch-prompt` → Task `prompt`** (CLI Layer 2) | Main session runs Trellis script before `Task(...)` | ✅ **Yes (primary for subagent task context on Cursor)** | Full embed: marker, `Selected task:`, prd/jsonl/spec bodies |
18
+ | **`task.py generate-dispatch-prompt` → Task `prompt`** (CLI Layer 2) | Main session runs Trellis script before `Task(...)` | ✅ **Yes (primary for subagent task context on Cursor)** | Full embed: marker, `Selected task:`, prd/jsonl/spec bodies (budgeted — see [injection-budget-guide](./injection-budget-guide.md)) |
19
19
 
20
- **Key takeaway**: anything that must reach the model **every turn without the agent choosing to load it** must live in `.cursor/rules` or `AGENTS.md`. Subagent task context on Cursor uses **CLI Layer 2** before Task dispatch; `preToolUse` hook injection is best-effort only (see forum reports + 2026-06-22 spike). Anything in `workflow.md` that depends on `sessionStart` injection is **invisible to Cursor agents** until the bug is fixed.
20
+ **Key takeaway**: anything that must reach the model **every turn** must live in `.cursor/rules` or `AGENTS.md`. `sessionStart` is reliable for **session-level** orientation (dashboard, workflow summary) but fires only once. Retrieval plans: use **Rules default tool order** or run `route_codebase_retrieval.py --instructions` on demand — do **not** rely on `beforeSubmitPrompt` injection. Subagent task context uses **CLI Layer 2** before Task dispatch.
21
21
 
22
22
  ---
23
23
 
24
- ## The sessionStart bug (why this guide exists)
24
+ ## The sessionStart bug (#158452) history and current status
25
25
 
26
- - **Bug**: Cursor forum #158452 — `sessionStart` hook `additional_context` is executed and JSON-parsed correctly, but the value is **never added to the agent's initial system context**.
27
- - **Status**: Confirmed by Cursor team (deanrie), internal bug filed, **no ETA** as of 2026-06-19.
28
- - **Scope**: Affects `sessionStart` and `postToolUse` `additional_context` on Cursor IDE. The `env` field of the same hook **does** work (separate storage path).
29
- - **Symptom**: hook runs (verifiable via side-channel log), valid JSON emitted, but the agent has zero awareness of the injected text (e.g. won't say a first-reply notice phrase).
26
+ - **Bug**: Cursor forum #158452 — `sessionStart` hook `additional_context` was executed and JSON-parsed correctly, but the value was **not added to the agent's initial system context** (through ~2026-06).
27
+ - **Status (2026-08-05)**: **Fixed** on Cursor Native 3.8.x first-reply-notice probe passes; `hooks_context` contains full SessionStart payload. Re-verify after major Cursor upgrades.
28
+ - **Historical scope**: Also affected `postToolUse` `additional_context` on some builds. The `env` field of the same hook uses a separate storage path.
29
+ - **Routing implication**: Even with sessionStart working, **per-turn hard gates** (Triage, retrieval policy) stay in `.cursor/rules` sessionStart fires only once per session.
30
30
 
31
31
  ### How to diagnose "is sessionStart injection actually reaching the model?"
32
32
 
@@ -38,23 +38,39 @@ Cursor has **four** channels that can put text in front of the model. They are *
38
38
 
39
39
  ## Trellis routing rules on Cursor
40
40
 
41
- Because of the bug, Trellis routes content by reliability on Cursor:
41
+ Trellis routes content by reliability on Cursor:
42
42
 
43
43
  | Trellis content | Where it lives | Why |
44
44
  |---|---|---|
45
- | **Request Triage hard gate** (classify every turn, emit `[Triage: <Mode>]`) | `.cursor/rules/cstl-triage.mdc` (`alwaysApply: true`) | Must be visible every turn; sessionStart path is broken |
46
- | **smart-search-first web routing** | `AGENTS.md` (TRELLIS:START block) | AGENTS.md is a reliable always-on channel |
47
- | **Command surface** (what's user-invocable vs internal skill) | `AGENTS.md` (TRELLIS:START block) | Same |
48
- | **Workflow phases, Task Ladder, workflow-state breadcrumbs** | `.cstl/workflow.md` | Loaded on demand via `get_context.py` / `cstl-start` / `cstl-continue`; NOT auto-injected on Cursor |
45
+ | **Request Triage hard gate** (classify every turn, emit `[Triage: <Mode>]`) | `.cursor/rules/cstl-triage.mdc` (`alwaysApply: true`) | Must be visible **every turn**; sessionStart is once-per-session |
46
+ | **Codebase retrieval policy** | `.cursor/rules/retrieval-routing.mdc` + `route_codebase_retrieval.py` | `beforeSubmitPrompt` injection is telemetry-only; Rules + router CLI |
47
+ | **Prefer Cursor native modes** (Plan/Ask/Debug/Agent/Multitask × Trellis) | `.cursor/rules/cstl-cursor-modes.mdc` + `cursor-native-modes-guide.md` | P1 orchestration; full table on demand in guide |
48
+ | **smart-search-first web routing** | `AGENTS.md` (CSTL block) | AGENTS.md is a reliable always-on channel |
49
+ | **Command surface** (what's user-invocable vs internal skill) | `AGENTS.md` (CSTL block) | Same |
50
+ | **Session orientation** (dashboard, workflow summary, first-reply notice) | `sessionStart` hook → `additional_context` | Reliable on Cursor 3.8.x+; session-level only |
51
+ | **Workflow phases, Task Ladder, workflow-state breadcrumbs** | `.cstl/workflow.md` + sessionStart summary | Full detail on demand via `get_context.py` / `cstl-continue` |
49
52
 
50
- **If a new "must-always-be-visible" rule is added to Trellis**: ship it as a `.cursor/rules/*.mdc` (Cursor) — do **not** rely on adding it to `workflow.md` and expecting sessionStart to deliver it.
53
+ **If a new "must-always-be-visible" rule is added to Trellis**: ship it as a `.cursor/rules/*.mdc` (Cursor) — do **not** rely on `workflow.md` or sessionStart alone for per-turn enforcement. Run `injection_budget_probe.py` after adding rules (see [injection-budget-guide](./injection-budget-guide.md)).
54
+
55
+ ---
56
+
57
+ ## Injection budget (P0)
58
+
59
+ Per-channel caps and jsonl/Layer 2 limits are defined in **[injection-budget-guide](./injection-budget-guide.md)**. Summary from channel matrix (2026-08-06):
60
+
61
+ - **Per-turn:** C01 Rules + C02 AGENTS only (not C04).
62
+ - **Session once:** C03 sessionStart dashboard/workflow.
63
+ - **Subagent:** C06 Layer 2 with role `max_chars` + jsonl entry/file/total caps.
64
+ - **Retrieval:** C16 Rules + router CLI on demand.
65
+
66
+ Probe: `python ./.cstl/scripts/injection_budget_probe.py --repo-root .`
51
67
 
52
68
  ---
53
69
 
54
70
  ## When to update this guide
55
71
 
56
- - Cursor ships a fix for forum #158452 mark the sessionStart row as "✅ Yes (fixed in version X)" and re-evaluate whether workflow.md content can move back to sessionStart-only.
57
- - A new Cursor injection channel appears (e.g. a working per-turn `beforeSubmitPrompt.additional_context`) add a row to the matrix.
72
+ - Cursor major upgradere-run sessionStart first-reply-notice probe and update the matrix date.
73
+ - `beforeSubmitPrompt.additional_context` becomes reliable on a future build re-enable injection in `inject-retrieval-plan.py` and update this guide.
58
74
  - Trellis adds a new `.cursor/rules/*.mdc` → add a row to the routing table.
59
75
 
60
76
  ---
@@ -62,6 +78,7 @@ Because of the bug, Trellis routes content by reliability on Cursor:
62
78
  ## Related
63
79
 
64
80
  - `cursor-subagent-policy.md` — Task tool scenes, model routing (this guide is about **context injection**, that one is about **subagent dispatch**).
81
+ - `cursor-native-modes-guide.md` — Prefer Plan/Ask/Debug/Agent/Multitask; pairs with `cstl-cursor-modes.mdc`.
65
82
  - `.cstl/workflow.md` → `### Request Triage` — the full Triage decision tree (the rule in `.cursor/rules/cstl-triage.mdc` is the slim always-apply version pointing here).
66
83
  - Task `06-19-cursor-rules-triage` (archive) — the investigation that produced this guide.
67
84
  - Cursor forum thread: https://forum.cursor.com/t/sessionstart-hook-additional-context-is-never-injected-into-agents-initial-system-context/158452
@@ -0,0 +1,125 @@
1
+ # Cursor native modes — Prefer & orchestrate (don't replace)
2
+
3
+ > **Purpose**: Task-drive Cursor **Plan / Ask / Debug / Agent / Multitask** into Trellis phases and artifacts. Prefer native when callable; **quietly** fall back to the cstl spine when not. Do **not** reimplement modes or publish an “unsupported mode” list.
4
+ >
5
+ > **Product anchor**: `.cstl/workspace/cursor-trellis-product-positioning.md` (P1).
6
+ >
7
+ > **Design lock**: Parent `research/task-driven-modes-design-lock-2026-08-06.md`.
8
+ >
9
+ > **Evidence**: `{TASK}/research/cursor-modes-external.md`, `{TASK}/research/modes-callability-matrix.md`.
10
+ >
11
+ > **Rollback**: [Rollback](#rollback).
12
+
13
+ ---
14
+
15
+ ## Principle
16
+
17
+ | Layer | Duty |
18
+ | --- | --- |
19
+ | **Cursor native** | Plan / Ask / Debug / Agent / Multitask — **try task-driven use first** |
20
+ | **cstl spine** | Triage / Phase / gates / artifacts / Parent integration — **quiet fallback** when native cannot be driven well |
21
+
22
+ **Prefer native. Invent less.** Failures drop to existing cstl paths with little commentary — never a user-facing “本版本不适配某 mode” section.
23
+
24
+ ---
25
+
26
+ ## Prefer / Adapt table (mode × Trellis × artifacts)
27
+
28
+ | Cursor mode | Prefer when | Task-driven Prefer | Quiet cstl fallback | Durable artifacts |
29
+ | --- | --- | --- | --- | --- |
30
+ | **Ask** | Explain / lookup; **no** durable change | Prefer Ask UI / side chat when the user is already there; Agent cannot `SwitchMode`→Ask | In-session **No Task** behavior (read-only, no `task.py create` without consent) | None |
31
+ | **Plan** | Scope / design / tradeoffs before code | **Try `SwitchMode(plan)`**; after review, `SwitchMode(agent)` or Build; **Save to workspace** → map into task files | Keep writing `prd.md` / `design.md` / `implement.md` + `cstl-brainstorm` in Agent | Phase 1 files |
32
+ | **Agent** | Approved build / verify | Default; `SwitchMode(agent)` when returning from Plan | — | Diff, `verify.md`, gates |
33
+ | **Debug** | Repro / runtime / regressions | Prefer real Cursor Debug when the user/session can reach it | Evidence → `verify.md`; `cstl-break-loop` if looped | Notes / logs in `verify.md` |
34
+ | **Multitask** | Independent Parent children post-approval | Prefer `/multitask` / Build in Parallel / Agent `Task` background workers **when useful** | Explicit `.cstl/tasks/<dir>` prompts + Parent `integrate-child` | Child `verify`/`handoff`; Parent `task-map` |
35
+
36
+ ### Phase quick map
37
+
38
+ ```
39
+ Triage (No Task / Micro-Grill) → Ask surface if present; else No Task in Agent
40
+ Phase 1 → SwitchMode(plan) when useful; else write artifacts in Agent
41
+ Phase 2–3 → Agent (+ workers when contracted)
42
+ Stuck / repeat failure → Debug when reachable; else verify.md + break-loop
43
+ Parent parallel children → Multitask / Task parallel when useful; Parent integrates
44
+ ```
45
+
46
+ ---
47
+
48
+ ## Mode-specific contracts
49
+
50
+ ### Ask ↔ No Task
51
+
52
+ - Official Ask does not edit files. Agent tools cannot switch into Ask.
53
+ - Classify **No Task** for pure Q&A; no task creation without consent.
54
+ - Side chats (3.11) complement Ask during Agent runs — still not Trellis artifacts.
55
+
56
+ ### Plan ↔ Phase 1
57
+
58
+ - Prefer **`SwitchMode(plan)`** for design-heavy Phase 1; care about switch-back quality.
59
+ - Default plan save = **home directory** — **Save to workspace**, then map to `{TASK}/prd.md`, `design.md`, `implement.md`.
60
+ - Does **not** skip `start-execution --check` / execution approval.
61
+ - If Plan switch or save flow is poor: **quietly** author the same files in Agent.
62
+
63
+ ### Debug ↔ evidence
64
+
65
+ - Prefer Cursor Debug instrumentation when reachable.
66
+ - Always land proof in **`verify.md`**. Contract change → Return-to-Planning.
67
+
68
+ ### Multitask ↔ Parent/Child
69
+
70
+ 1. Trellis remains source of truth for status, gates, integration.
71
+ 2. Prefer native parallel surfaces to support independent Children when they help isolation/throughput.
72
+ 3. Every worker prompt includes **explicit `.cstl/tasks/<dir>`** — never rely on `selected_task`.
73
+ 4. Parent alone `integrate-child`; no collision guarantee without worktrees + review.
74
+
75
+ ---
76
+
77
+ ## Callability (Agent tool table)
78
+
79
+ | Surface | Plan | Agent | Ask | Debug | Parallel Children |
80
+ | --- | --- | --- | --- | --- | --- |
81
+ | Agent `SwitchMode` | Yes → `plan` | Yes → `agent` | — | — | — |
82
+ | Agent `Task` / Multitask | — | workers | — | — | Prefer when useful |
83
+ | User / CLI modes | Plan UI / `/plan` | default | Ask UI / `/ask` | Debug UI | `/multitask`, Build in Parallel |
84
+
85
+ Details: `research/modes-callability-matrix.md`.
86
+
87
+ ---
88
+
89
+ ## What cstl must not claim
90
+
91
+ - Plans auto-save into `.cstl/tasks/`.
92
+ - Multitask inherits `selected_task` or exposes a stable programmatic mode API.
93
+ - Parallel agents cannot conflict without Trellis/worktree discipline.
94
+ - `SwitchMode` can open Ask or Debug.
95
+ - Shipping a parallel fake Plan/Ask/Debug product, or documenting gaps as “本版本不适配”.
96
+
97
+ ---
98
+
99
+ ## Dogfood / probes
100
+
101
+ | Mode | Minimum probe | Pass when |
102
+ | --- | --- | --- |
103
+ | **Plan** | Schema or live `SwitchMode(plan)` note in verify | Prefer path documented; quiet Agent fallback if unused |
104
+ | **Ask / Debug** | Callability matrix | Quiet spine behavior; no “不适配” section |
105
+ | **Multitask** | Task parallel or doc contract | Explicit child paths; Parent integrates |
106
+ | **Agent** | Session implements under contract | Artifacts on disk |
107
+
108
+ ---
109
+
110
+ ## Rollback
111
+
112
+ Docs + rules only:
113
+
114
+ 1. Delete `.cursor/rules/cstl-cursor-modes.mdc` and `.cstl/spec/guides/cursor-native-modes-guide.md`.
115
+ 2. Drop related `guides/index.md` / `workflow.md` rows, or `cstl update` from pre-P1 templates.
116
+ 3. **cursor-trellis**: revert this Child’s tip or delete mirrored template paths.
117
+
118
+ ---
119
+
120
+ ## Related
121
+
122
+ - `{TASK}/research/modes-callability-matrix.md`
123
+ - `{TASK}/research/cursor-modes-external.md`
124
+ - `.cursor/rules/cstl-cursor-modes.mdc`
125
+ - `.cstl/spec/guides/cursor-subagent-policy.md`
@@ -96,19 +96,21 @@ When research is purely **codebase exploration** (no external web search, no fil
96
96
 
97
97
  ### Method 2.5: Cursor++ BYOK proxy map (publishable bundle)
98
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).
99
+ **What it is:** A reversible patch to Cursor++ `extension.js` **subagent model resolver** that maps `subagentType` → BYOK catalog **slug** (`model-xxxxx`), evaluated **before** the inherit-parent branch. Obfuscated symbol names change per build (historical `WPeLc8`; 2026-08+ profile `ZiKp4I`). Script uses multi-profile detection.
100
100
 
101
- **Trellis ships (every `cstl init` / `cstl update`, strategy C):** `.cstl/local/cursor2plus/` — `patch_wpelc8.py`, `README.md`, `config.local.json.example`. Native Cursor API users can ignore this directory.
101
+ **Trellis ships (every `cstl init` / `cstl update`, strategy C):** `.cstl/local/cursor2plus/` — `patch_wpelc8.py`, `README.md`, **`UPGRADE-NOTE.md`** (upgrade re-apply), `config.local.json.example`. Native Cursor API users can ignore this directory.
102
102
 
103
103
  **Operator workflow (Cursor++ BYOK only):**
104
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: **`.cstl/local/subagent-models.json`** (project wins on same key).
105
+ 1. Fill **`~/.ccursor/trellis-task-models.json5`** (user-wide) with `subagent_type` → displayName/apiModel from **`~/.ccursor/providers.json`**.
106
+ 2. Optionally override per repo: **`.cstl/local/subagent-models.json5`** (project wins on same key).
107
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 `.cstl/local/cursor2plus/`: `python patch_wpelc8.py --print-map` → `python patch_wpelc8.py` → **Developer: Reload Window**.
109
- 5. **Verify:** `taskToolCall dispatching` `resolvedModelId` matches slug.
108
+ 4. From `.cstl/local/cursor2plus/`: `python patch_wpelc8.py --check-compat` → `--print-map` → `--apply --approve` → **Developer: Reload Window**.
109
+ 5. **Verify:** A≠B probe (parent model ≠ map target) or `resolvedModelId` matches slug.
110
110
 
111
- **Revert:** `python patch_wpelc8.py --revert`; Reload Window. Re-run patch after Cursor / Cursor++ upgrades.
111
+ **Revert:** `python patch_wpelc8.py --revert`; Reload Window.
112
+
113
+ **After any Cursor / Cursor++ upgrade:** assume patch is stale — follow **`.cstl/local/cursor2plus/UPGRADE-NOTE.md`** (`--check-compat`, re-apply, or add a new resolver profile if symbols moved).
112
114
 
113
115
  **Cursor++ sidebar / Cursor Settings:** Do **not** wire `cstl-*` BYOK routing; use JSON + patch.
114
116
 
@@ -203,7 +205,7 @@ When a dispatch is imminent:
203
205
 
204
206
  ### Technical note
205
207
 
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).
208
+ 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++ subagent model resolver (profile-bound; see `UPGRADE-NOTE.md`) 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
209
 
208
210
  ---
209
211