@blxzer/cursor-trellis 0.3.5 → 0.3.6

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 (130) hide show
  1. package/CHANGELOG.md +46 -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/configurators/workflow.d.ts.map +1 -1
  18. package/dist/configurators/workflow.js +13 -1
  19. package/dist/configurators/workflow.js.map +1 -1
  20. package/dist/goal/action-packet.d.ts +89 -0
  21. package/dist/goal/action-packet.d.ts.map +1 -0
  22. package/dist/goal/action-packet.js +113 -0
  23. package/dist/goal/action-packet.js.map +1 -0
  24. package/dist/goal/audit.d.ts +14 -0
  25. package/dist/goal/audit.d.ts.map +1 -0
  26. package/dist/goal/audit.js +12 -0
  27. package/dist/goal/audit.js.map +1 -0
  28. package/dist/goal/constants.d.ts +26 -0
  29. package/dist/goal/constants.d.ts.map +1 -0
  30. package/dist/goal/constants.js +24 -0
  31. package/dist/goal/constants.js.map +1 -0
  32. package/dist/goal/paths.d.ts +8 -0
  33. package/dist/goal/paths.d.ts.map +1 -0
  34. package/dist/goal/paths.js +36 -0
  35. package/dist/goal/paths.js.map +1 -0
  36. package/dist/goal/preflight.d.ts +21 -0
  37. package/dist/goal/preflight.d.ts.map +1 -0
  38. package/dist/goal/preflight.js +97 -0
  39. package/dist/goal/preflight.js.map +1 -0
  40. package/dist/goal/review-seam.d.ts +44 -0
  41. package/dist/goal/review-seam.d.ts.map +1 -0
  42. package/dist/goal/review-seam.js +153 -0
  43. package/dist/goal/review-seam.js.map +1 -0
  44. package/dist/goal/reviewer-rules.d.ts +13 -0
  45. package/dist/goal/reviewer-rules.d.ts.map +1 -0
  46. package/dist/goal/reviewer-rules.js +153 -0
  47. package/dist/goal/reviewer-rules.js.map +1 -0
  48. package/dist/goal/reviewer.d.ts +9 -0
  49. package/dist/goal/reviewer.d.ts.map +1 -0
  50. package/dist/goal/reviewer.js +54 -0
  51. package/dist/goal/reviewer.js.map +1 -0
  52. package/dist/goal/runtime.d.ts +32 -0
  53. package/dist/goal/runtime.d.ts.map +1 -0
  54. package/dist/goal/runtime.js +242 -0
  55. package/dist/goal/runtime.js.map +1 -0
  56. package/dist/goal/sdk-client.d.ts +10 -0
  57. package/dist/goal/sdk-client.d.ts.map +1 -0
  58. package/dist/goal/sdk-client.js +34 -0
  59. package/dist/goal/sdk-client.js.map +1 -0
  60. package/dist/goal/state.d.ts +40 -0
  61. package/dist/goal/state.d.ts.map +1 -0
  62. package/dist/goal/state.js +37 -0
  63. package/dist/goal/state.js.map +1 -0
  64. package/dist/goal/task-triggers.d.ts +15 -0
  65. package/dist/goal/task-triggers.d.ts.map +1 -0
  66. package/dist/goal/task-triggers.js +23 -0
  67. package/dist/goal/task-triggers.js.map +1 -0
  68. package/dist/goal/walls.d.ts +12 -0
  69. package/dist/goal/walls.d.ts.map +1 -0
  70. package/dist/goal/walls.js +65 -0
  71. package/dist/goal/walls.js.map +1 -0
  72. package/dist/goal/worker-prompt.d.ts +13 -0
  73. package/dist/goal/worker-prompt.d.ts.map +1 -0
  74. package/dist/goal/worker-prompt.js +41 -0
  75. package/dist/goal/worker-prompt.js.map +1 -0
  76. package/dist/goal/worker.d.ts +42 -0
  77. package/dist/goal/worker.d.ts.map +1 -0
  78. package/dist/goal/worker.js +180 -0
  79. package/dist/goal/worker.js.map +1 -0
  80. package/dist/migrations/manifests/0.3.5.json +9 -0
  81. package/dist/migrations/manifests/0.3.6.json +9 -0
  82. package/dist/templates/common/commands/continue.md +15 -3
  83. package/dist/templates/common/skills/check.md +7 -4
  84. package/dist/templates/cursor/agents/cstl-check.md +1 -0
  85. package/dist/templates/cursor/fixtures/expected-rules.d.ts.map +1 -1
  86. package/dist/templates/cursor/fixtures/expected-rules.js +6 -1
  87. package/dist/templates/cursor/fixtures/expected-rules.js.map +1 -1
  88. package/dist/templates/cursor/rules/cstl-cursor-modes.mdc +32 -0
  89. package/dist/templates/cursor/rules/cstl-triage.mdc +2 -4
  90. package/dist/templates/cursor/rules/retrieval-routing.mdc +26 -7
  91. package/dist/templates/markdown/index.d.ts +3 -0
  92. package/dist/templates/markdown/index.d.ts.map +1 -1
  93. package/dist/templates/markdown/index.js +3 -0
  94. package/dist/templates/markdown/index.js.map +1 -1
  95. package/dist/templates/markdown/spec/guides/cursor-context-injection-guide.md.txt +38 -21
  96. package/dist/templates/markdown/spec/guides/cursor-native-modes-guide.md.txt +125 -0
  97. package/dist/templates/markdown/spec/guides/index.md.txt +107 -104
  98. package/dist/templates/markdown/spec/guides/injection-budget-guide.md.txt +111 -0
  99. package/dist/templates/markdown/spec/guides/retrieval-daily-guide.md.txt +24 -6
  100. package/dist/templates/markdown/spec/guides/verification-strength-guide.md.txt +184 -0
  101. package/dist/templates/shared-hooks/session-start.py +10 -0
  102. package/dist/templates/trellis/config.yaml +18 -0
  103. package/dist/templates/trellis/index.d.ts +5 -0
  104. package/dist/templates/trellis/index.d.ts.map +1 -1
  105. package/dist/templates/trellis/index.js +14 -0
  106. package/dist/templates/trellis/index.js.map +1 -1
  107. package/dist/templates/trellis/scripts/common/artifact_locale.py +278 -0
  108. package/dist/templates/trellis/scripts/common/codebase_retrieval_router.py +37 -2
  109. package/dist/templates/trellis/scripts/common/config.py +39 -0
  110. package/dist/templates/trellis/scripts/common/injection_budget.py +317 -0
  111. package/dist/templates/trellis/scripts/common/parent_orchestration.py +161 -5
  112. package/dist/templates/trellis/scripts/common/retrieval_agent_instructions.py +9 -3
  113. package/dist/templates/trellis/scripts/common/session_context.py +32 -4
  114. package/dist/templates/trellis/scripts/common/session_memory.py +26 -0
  115. package/dist/templates/trellis/scripts/common/subagent_dispatch.py +74 -9
  116. package/dist/templates/trellis/scripts/common/task_context.py +18 -0
  117. package/dist/templates/trellis/scripts/common/task_dashboard.py +16 -1
  118. package/dist/templates/trellis/scripts/common/task_map.py +40 -8
  119. package/dist/templates/trellis/scripts/common/task_store.py +144 -39
  120. package/dist/templates/trellis/scripts/common/test_observable_defaults.py +135 -0
  121. package/dist/templates/trellis/scripts/cursor_retrieval_probe_prompt.md +14 -12
  122. package/dist/templates/trellis/scripts/generate_dispatch_prompt.py +182 -0
  123. package/dist/templates/trellis/scripts/injection_budget_probe.py +69 -0
  124. package/dist/templates/trellis/scripts/retrieval_probe_matrix_template.json +3 -3
  125. package/dist/templates/trellis/scripts/spec_health_outcomes.py +160 -0
  126. package/dist/templates/trellis/scripts/task.py +19 -0
  127. package/dist/templates/trellis/tasks/locale/en/default-prd.md +19 -0
  128. package/dist/templates/trellis/tasks/locale/zh/default-prd.md +19 -0
  129. package/dist/templates/trellis/workflow.md +23 -3
  130. 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,7 @@ 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;
33
36
  //# 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,gCAA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F,eAAO,MAAM,gCAAgC,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"}
@@ -55,4 +55,7 @@ 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");
58
61
  //# 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,EAA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CAA+C,CAChD,CAAC;AACF,MAAM,CAAC,MAAM,iCAAiC,GAAW,iBAAiB,CACxE,2CAA2C,CAC5C,CAAC;AACF,MAAM,CAAC,MAAM,8BAA8B,GAAW,iBAAiB,CACrE,uCAAuC,CACxC,CAAC;AACF,MAAM,CAAC,MAAM,wCAAwC,GACnD,iBAAiB,CAAC,mDAAmD,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,mCAAmC,GAAW,iBAAiB,CAC1E,8CAA8C,CAC/C,CAAC;AACF,MAAM,CAAC,MAAM,sCAAsC,GAAW,iBAAiB,CAC7E,gDAAgD,CACjD,CAAC;AACF,MAAM,CAAC,MAAM,iCAAiC,GAAW,iBAAiB,CACxE,2CAA2C,CAC5C,CAAC"}
@@ -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`