@pennixrv/trellis 0.7.0-beta.5 → 0.7.0-beta.50

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 (219) hide show
  1. package/dist/cli/index.d.ts.map +1 -1
  2. package/dist/cli/index.js +47 -3
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/commands/backup.d.ts +25 -0
  5. package/dist/commands/backup.d.ts.map +1 -0
  6. package/dist/commands/backup.js +152 -0
  7. package/dist/commands/backup.js.map +1 -0
  8. package/dist/commands/channel/adapters/claude.d.ts.map +1 -1
  9. package/dist/commands/channel/adapters/claude.js +2 -0
  10. package/dist/commands/channel/adapters/claude.js.map +1 -1
  11. package/dist/commands/channel/adapters/codex.d.ts +5 -1
  12. package/dist/commands/channel/adapters/codex.d.ts.map +1 -1
  13. package/dist/commands/channel/adapters/codex.js +19 -9
  14. package/dist/commands/channel/adapters/codex.js.map +1 -1
  15. package/dist/commands/channel/adapters/index.d.ts +3 -0
  16. package/dist/commands/channel/adapters/index.d.ts.map +1 -1
  17. package/dist/commands/channel/adapters/index.js +3 -3
  18. package/dist/commands/channel/adapters/index.js.map +1 -1
  19. package/dist/commands/channel/adapters/types.d.ts +2 -0
  20. package/dist/commands/channel/adapters/types.d.ts.map +1 -1
  21. package/dist/commands/channel/guard.d.ts.map +1 -1
  22. package/dist/commands/channel/guard.js +38 -29
  23. package/dist/commands/channel/guard.js.map +1 -1
  24. package/dist/commands/channel/index.d.ts.map +1 -1
  25. package/dist/commands/channel/index.js +52 -16
  26. package/dist/commands/channel/index.js.map +1 -1
  27. package/dist/commands/channel/kill.d.ts.map +1 -1
  28. package/dist/commands/channel/kill.js +37 -15
  29. package/dist/commands/channel/kill.js.map +1 -1
  30. package/dist/commands/channel/messages.d.ts.map +1 -1
  31. package/dist/commands/channel/messages.js +3 -2
  32. package/dist/commands/channel/messages.js.map +1 -1
  33. package/dist/commands/channel/process-identity.d.ts +3 -0
  34. package/dist/commands/channel/process-identity.d.ts.map +1 -0
  35. package/dist/commands/channel/process-identity.js +24 -0
  36. package/dist/commands/channel/process-identity.js.map +1 -0
  37. package/dist/commands/channel/profiles.d.ts +26 -0
  38. package/dist/commands/channel/profiles.d.ts.map +1 -0
  39. package/dist/commands/channel/profiles.js +186 -0
  40. package/dist/commands/channel/profiles.js.map +1 -0
  41. package/dist/commands/channel/rm.d.ts +0 -1
  42. package/dist/commands/channel/rm.d.ts.map +1 -1
  43. package/dist/commands/channel/rm.js +203 -96
  44. package/dist/commands/channel/rm.js.map +1 -1
  45. package/dist/commands/channel/spawn.d.ts +3 -0
  46. package/dist/commands/channel/spawn.d.ts.map +1 -1
  47. package/dist/commands/channel/spawn.js +43 -15
  48. package/dist/commands/channel/spawn.js.map +1 -1
  49. package/dist/commands/channel/supervisor/idle.d.ts +2 -0
  50. package/dist/commands/channel/supervisor/idle.d.ts.map +1 -1
  51. package/dist/commands/channel/supervisor/idle.js +15 -7
  52. package/dist/commands/channel/supervisor/idle.js.map +1 -1
  53. package/dist/commands/channel/supervisor/inbox.d.ts.map +1 -1
  54. package/dist/commands/channel/supervisor/inbox.js +48 -33
  55. package/dist/commands/channel/supervisor/inbox.js.map +1 -1
  56. package/dist/commands/channel/supervisor/stdout.d.ts.map +1 -1
  57. package/dist/commands/channel/supervisor/stdout.js +6 -3
  58. package/dist/commands/channel/supervisor/stdout.js.map +1 -1
  59. package/dist/commands/channel/supervisor/warning.d.ts.map +1 -1
  60. package/dist/commands/channel/supervisor/warning.js +2 -3
  61. package/dist/commands/channel/supervisor/warning.js.map +1 -1
  62. package/dist/commands/channel/supervisor.d.ts +12 -0
  63. package/dist/commands/channel/supervisor.d.ts.map +1 -1
  64. package/dist/commands/channel/supervisor.js +88 -16
  65. package/dist/commands/channel/supervisor.js.map +1 -1
  66. package/dist/commands/channel/wait.d.ts +3 -1
  67. package/dist/commands/channel/wait.d.ts.map +1 -1
  68. package/dist/commands/channel/wait.js +59 -14
  69. package/dist/commands/channel/wait.js.map +1 -1
  70. package/dist/commands/init.d.ts.map +1 -1
  71. package/dist/commands/init.js +23 -10
  72. package/dist/commands/init.js.map +1 -1
  73. package/dist/commands/update.d.ts.map +1 -1
  74. package/dist/commands/update.js +446 -333
  75. package/dist/commands/update.js.map +1 -1
  76. package/dist/commands/workflow.d.ts +1 -0
  77. package/dist/commands/workflow.d.ts.map +1 -1
  78. package/dist/commands/workflow.js +56 -1
  79. package/dist/commands/workflow.js.map +1 -1
  80. package/dist/configurators/codex.d.ts +6 -0
  81. package/dist/configurators/codex.d.ts.map +1 -1
  82. package/dist/configurators/codex.js +93 -0
  83. package/dist/configurators/codex.js.map +1 -1
  84. package/dist/configurators/shared.js +2 -2
  85. package/dist/configurators/shared.js.map +1 -1
  86. package/dist/constants/paths.d.ts +2 -0
  87. package/dist/constants/paths.d.ts.map +1 -1
  88. package/dist/constants/paths.js +2 -0
  89. package/dist/constants/paths.js.map +1 -1
  90. package/dist/migrations/manifests/0.7.0-beta.10.json +9 -0
  91. package/dist/migrations/manifests/0.7.0-beta.11.json +9 -0
  92. package/dist/migrations/manifests/0.7.0-beta.12.json +9 -0
  93. package/dist/migrations/manifests/0.7.0-beta.13.json +9 -0
  94. package/dist/migrations/manifests/0.7.0-beta.14.json +9 -0
  95. package/dist/migrations/manifests/0.7.0-beta.15.json +9 -0
  96. package/dist/migrations/manifests/0.7.0-beta.16.json +9 -0
  97. package/dist/migrations/manifests/0.7.0-beta.17.json +9 -0
  98. package/dist/migrations/manifests/0.7.0-beta.18.json +9 -0
  99. package/dist/migrations/manifests/0.7.0-beta.19.json +9 -0
  100. package/dist/migrations/manifests/0.7.0-beta.20.json +9 -0
  101. package/dist/migrations/manifests/0.7.0-beta.21.json +17 -0
  102. package/dist/migrations/manifests/0.7.0-beta.22.json +9 -0
  103. package/dist/migrations/manifests/0.7.0-beta.23.json +9 -0
  104. package/dist/migrations/manifests/0.7.0-beta.24.json +9 -0
  105. package/dist/migrations/manifests/0.7.0-beta.25.json +9 -0
  106. package/dist/migrations/manifests/0.7.0-beta.26.json +9 -0
  107. package/dist/migrations/manifests/0.7.0-beta.27.json +9 -0
  108. package/dist/migrations/manifests/0.7.0-beta.28.json +9 -0
  109. package/dist/migrations/manifests/0.7.0-beta.29.json +9 -0
  110. package/dist/migrations/manifests/0.7.0-beta.30.json +9 -0
  111. package/dist/migrations/manifests/0.7.0-beta.31.json +9 -0
  112. package/dist/migrations/manifests/0.7.0-beta.32.json +9 -0
  113. package/dist/migrations/manifests/0.7.0-beta.33.json +9 -0
  114. package/dist/migrations/manifests/0.7.0-beta.34.json +9 -0
  115. package/dist/migrations/manifests/0.7.0-beta.35.json +9 -0
  116. package/dist/migrations/manifests/0.7.0-beta.36.json +9 -0
  117. package/dist/migrations/manifests/0.7.0-beta.37.json +9 -0
  118. package/dist/migrations/manifests/0.7.0-beta.38.json +9 -0
  119. package/dist/migrations/manifests/0.7.0-beta.39.json +9 -0
  120. package/dist/migrations/manifests/0.7.0-beta.40.json +9 -0
  121. package/dist/migrations/manifests/0.7.0-beta.41.json +9 -0
  122. package/dist/migrations/manifests/0.7.0-beta.42.json +9 -0
  123. package/dist/migrations/manifests/0.7.0-beta.43.json +9 -0
  124. package/dist/migrations/manifests/0.7.0-beta.44.json +9 -0
  125. package/dist/migrations/manifests/0.7.0-beta.45.json +9 -0
  126. package/dist/migrations/manifests/0.7.0-beta.46.json +9 -0
  127. package/dist/migrations/manifests/0.7.0-beta.47.json +9 -0
  128. package/dist/migrations/manifests/0.7.0-beta.48.json +9 -0
  129. package/dist/migrations/manifests/0.7.0-beta.49.json +13 -0
  130. package/dist/migrations/manifests/0.7.0-beta.50.json +12 -0
  131. package/dist/migrations/manifests/0.7.0-beta.6.json +9 -0
  132. package/dist/migrations/manifests/0.7.0-beta.7.json +9 -0
  133. package/dist/migrations/manifests/0.7.0-beta.8.json +9 -0
  134. package/dist/migrations/manifests/0.7.0-beta.9.json +9 -0
  135. package/dist/templates/codex/hooks/session-start.py +21 -17
  136. package/dist/templates/common/bundled-skills/trellis-channel/SKILL.md +3 -1
  137. package/dist/templates/common/bundled-skills/trellis-channel/references/command-reference.md +24 -16
  138. package/dist/templates/common/bundled-skills/trellis-channel/references/forum.md +4 -12
  139. package/dist/templates/common/bundled-skills/trellis-channel/references/multi-target-dispatch.md +139 -0
  140. package/dist/templates/common/bundled-skills/trellis-channel/references/progress-debugging.md +9 -5
  141. package/dist/templates/common/bundled-skills/trellis-channel/references/subnode-work.md +84 -14
  142. package/dist/templates/common/bundled-skills/trellis-channel/references/workers.md +9 -11
  143. package/dist/templates/common/bundled-skills/trellis-channel/references/workflows.md +25 -14
  144. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-skills-or-commands.md +13 -11
  145. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-task-lifecycle.md +7 -2
  146. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +6 -1
  147. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workflow.md +6 -4
  148. package/dist/templates/common/bundled-skills/trellis-session-insight/SKILL.md +42 -3
  149. package/dist/templates/common/bundled-skills/trellis-session-insight/references/cli-quick-reference.md +1 -1
  150. package/dist/templates/common/bundled-skills/trellis-session-insight/references/triggering-patterns.md +10 -2
  151. package/dist/templates/common/commands/continue.md +36 -8
  152. package/dist/templates/common/commands/finish-work.md +17 -2
  153. package/dist/templates/common/commands/start.md +8 -1
  154. package/dist/templates/common/skills/brainstorm.md +49 -22
  155. package/dist/templates/common/skills/break-loop.md +6 -10
  156. package/dist/templates/common/skills/check.md +34 -5
  157. package/dist/templates/copilot/hooks/session-start.py +19 -15
  158. package/dist/templates/copilot/prompts/brainstorm.prompt.md +27 -21
  159. package/dist/templates/markdown/spec/backend/database-guidelines.md.txt +22 -22
  160. package/dist/templates/markdown/spec/backend/directory-structure.md.txt +20 -20
  161. package/dist/templates/markdown/spec/backend/error-handling.md.txt +22 -22
  162. package/dist/templates/markdown/spec/backend/index.md.txt +19 -19
  163. package/dist/templates/markdown/spec/backend/logging-guidelines.md.txt +22 -22
  164. package/dist/templates/markdown/spec/backend/quality-guidelines.md.txt +22 -22
  165. package/dist/templates/markdown/spec/frontend/component-guidelines.md.txt +25 -25
  166. package/dist/templates/markdown/spec/frontend/directory-structure.md.txt +20 -20
  167. package/dist/templates/markdown/spec/frontend/hook-guidelines.md.txt +22 -22
  168. package/dist/templates/markdown/spec/frontend/index.md.txt +20 -20
  169. package/dist/templates/markdown/spec/frontend/quality-guidelines.md.txt +22 -22
  170. package/dist/templates/markdown/spec/frontend/state-management.md.txt +22 -22
  171. package/dist/templates/markdown/spec/frontend/type-safety.md.txt +22 -22
  172. package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +80 -85
  173. package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +164 -209
  174. package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +161 -185
  175. package/dist/templates/markdown/spec/guides/index.md.txt +51 -51
  176. package/dist/templates/markdown/workspace-index.md +44 -44
  177. package/dist/templates/opencode/lib/session-utils.js +2 -2
  178. package/dist/templates/shared-hooks/inject-shell-session-context.py +3 -6
  179. package/dist/templates/shared-hooks/inject-workflow-state.py +3 -2
  180. package/dist/templates/shared-hooks/session-start.py +23 -18
  181. package/dist/templates/trellis/agents/subnode-profiles.json +13 -0
  182. package/dist/templates/trellis/agents/subnode.md +11 -5
  183. package/dist/templates/trellis/config.yaml +2 -0
  184. package/dist/templates/trellis/index.d.ts +2 -1
  185. package/dist/templates/trellis/index.d.ts.map +1 -1
  186. package/dist/templates/trellis/index.js +4 -2
  187. package/dist/templates/trellis/index.js.map +1 -1
  188. package/dist/templates/trellis/scripts/add_session.py +35 -32
  189. package/dist/templates/trellis/scripts/common/active_task.py +8 -8
  190. package/dist/templates/trellis/scripts/common/developer.py +18 -18
  191. package/dist/templates/trellis/scripts/common/ownership_record.py +13 -8
  192. package/dist/templates/trellis/scripts/common/safe_commit.py +38 -9
  193. package/dist/templates/trellis/scripts/common/task_planning.py +137 -0
  194. package/dist/templates/trellis/scripts/common/task_store.py +46 -14
  195. package/dist/templates/trellis/scripts/common/workflow_phase.py +4 -3
  196. package/dist/templates/trellis/scripts/subnode_artifact.py +470 -21
  197. package/dist/templates/trellis/scripts/task.py +175 -2
  198. package/dist/templates/trellis/workflow.md +407 -388
  199. package/dist/utils/managed-paths.d.ts +2 -0
  200. package/dist/utils/managed-paths.d.ts.map +1 -1
  201. package/dist/utils/managed-paths.js +24 -2
  202. package/dist/utils/managed-paths.js.map +1 -1
  203. package/dist/utils/template-fetcher.d.ts +1 -0
  204. package/dist/utils/template-fetcher.d.ts.map +1 -1
  205. package/dist/utils/template-fetcher.js +2 -1
  206. package/dist/utils/template-fetcher.js.map +1 -1
  207. package/dist/utils/uninstall-scrubbers.d.ts.map +1 -1
  208. package/dist/utils/uninstall-scrubbers.js +5 -0
  209. package/dist/utils/uninstall-scrubbers.js.map +1 -1
  210. package/dist/utils/workflow-provenance.d.ts +24 -0
  211. package/dist/utils/workflow-provenance.d.ts.map +1 -0
  212. package/dist/utils/workflow-provenance.js +71 -0
  213. package/dist/utils/workflow-provenance.js.map +1 -0
  214. package/dist/utils/workflow-resolver.d.ts +9 -2
  215. package/dist/utils/workflow-resolver.d.ts.map +1 -1
  216. package/dist/utils/workflow-resolver.js +33 -7
  217. package/dist/utils/workflow-resolver.js.map +1 -1
  218. package/package.json +2 -2
  219. package/dist/templates/trellis/agents/subnode.env +0 -4
@@ -127,11 +127,15 @@ wait command starts, capture a barrier before that operation and pass it back:
127
127
  ```bash
128
128
  BARRIER="$(trellis channel barrier T)"
129
129
  # spawn or trigger work that may emit a terminal event
130
- trellis channel wait T --as main --from check --kind done,error \
130
+ trellis channel wait T --workers check \
131
131
  --after-seq "$BARRIER" --timeout 15m
132
132
  ```
133
133
 
134
- It wakes on:
134
+ Worker mode waits for a lifecycle transition to terminal, including
135
+ supervisor-authored killed/error events. Ordinary adapter errors and peer turn
136
+ completion remain nonterminal. Use `--workers check,check-cx --all` for a group.
137
+
138
+ The separate event-filter mode wakes on:
135
139
 
136
140
  - `message`
137
141
  - `done`
@@ -142,10 +146,10 @@ It wakes on:
142
146
  Useful filters:
143
147
 
144
148
  ```bash
145
- trellis channel wait T --as main --from check --kind done --timeout 15m
146
- trellis channel wait T --as main --from check,check-cx --kind done --all --timeout 15m
149
+ trellis channel wait T --from check --kind done --timeout 15m
150
+ trellis channel wait T --from check,check-cx --kind done --all --timeout 15m
147
151
  trellis channel wait T --as worker --kind message --timeout 1h
148
- trellis channel wait T --as main --thread release-note --action status --timeout 10m
152
+ trellis channel wait T --thread release-note --action status --timeout 10m
149
153
  ```
150
154
 
151
155
  Exit codes: `0` matched, `124` timeout, `1`/`2` errors. On `wait --all`
@@ -10,6 +10,13 @@ lifecycle, and the final result. A subnode owns one evidence report and its own
10
10
  append-only worklog. This is a behavioral contract; do not add `--sandbox` or
11
11
  claim that path restrictions enforce it.
12
12
 
13
+ Keep credentials out of briefs, reports, worklogs and Channel messages. The artifact
14
+ validator rejects known private-key/token, Bearer and explicit credential-assignment
15
+ syntax; it does not recognize arbitrary secret values. Channel protocol messages keep
16
+ their original bytes for delivery in private local storage. Operator message views,
17
+ error/progress persistence and logs redact known credential syntax or omit raw worker
18
+ content; this is not general-purpose secret detection or private-path anonymization.
19
+
13
20
  ## Artifact Setup
14
21
 
15
22
  Before spawning, the coordinator must use an active task (`planning` or
@@ -20,7 +27,26 @@ dependencies, stop conditions, deadline, and `channel_ref`. Set `retry_of`
20
27
  only for an explicit manual retry and `counter_of` only for intentional
21
28
  counterwork. A retry names an existing, different subnode in the same task and
22
29
  `work_id`; counterwork may be initialized independently. The helper supplies
23
- the immutable task identity and report path.
30
+ the immutable task identity and report path. New units also require `unit_plan`:
31
+
32
+ ```json
33
+ {
34
+ "unit_plan": {
35
+ "plan_ref": ".trellis/tasks/09-07-example/design.md#evidence-units",
36
+ "sizing_rationale": "One bounded dependency inspection with a separately reviewable result."
37
+ }
38
+ }
39
+ ```
40
+
41
+ The reference must identify an existing regular Markdown document inside this
42
+ task. For multiple scope items, add `grouping_rationale` explaining why every
43
+ item is quick/simple, obviously related, and uses shared context while retaining
44
+ separate conclusions. Record the actual scope mapping and evidence in the task
45
+ plan before initializing briefs; owner domains and slot counts do not determine
46
+ unit counts. Complex or lengthy points need separate units or further splitting.
47
+ The helper checks structure, not the truth of the sizing judgment. Historical
48
+ brief/report readers remain compatible; new init and queue admission require
49
+ the unit plan.
24
50
 
25
51
  ```bash
26
52
  TASK=.trellis/tasks/09-07-example
@@ -50,12 +76,15 @@ and its status; the Codex supervisor projects that reply into the durable
50
76
  Channel message and `done` events. The durable JSON file carries the
51
77
  reviewable result.
52
78
 
53
- The subnode copies identity, scope, and lens from `brief.json`. The minimal
79
+ The subnode copies identity, scope, and lens from `brief.json`. Schema version 2
80
+ requires one `scope_assessment` entry for every brief scope item, structured
81
+ findings with evidence references, and typed uncertainties or corrections when
82
+ present. Schema version 1 is retired and the validator rejects it. The minimal
54
83
  complete report is:
55
84
 
56
85
  ```json
57
86
  {
58
- "schema_version": 1,
87
+ "schema_version": 2,
59
88
  "task_id": "task-id-from-brief",
60
89
  "work_id": "work-id-from-brief",
61
90
  "subnode_id": "subnode-id-from-brief",
@@ -63,6 +92,14 @@ complete report is:
63
92
  "status": "complete",
64
93
  "scope": ["exact scope copied from brief"],
65
94
  "lens": "exact lens copied from brief",
95
+ "scope_assessment": [
96
+ {
97
+ "scope": "exact scope item from brief",
98
+ "status": "covered",
99
+ "conclusion": "What this scope establishes.",
100
+ "evidence_ids": ["stable-evidence-id"]
101
+ }
102
+ ],
66
103
  "evidence": [
67
104
  {
68
105
  "id": "stable-evidence-id",
@@ -70,37 +107,60 @@ complete report is:
70
107
  "summary": "What this independently reviewable evidence establishes."
71
108
  }
72
109
  ],
73
- "findings": ["Bounded conclusion."],
110
+ "findings": [
111
+ {
112
+ "id": "finding-id",
113
+ "conclusion": "Bounded conclusion.",
114
+ "evidence_ids": ["stable-evidence-id"]
115
+ }
116
+ ],
74
117
  "uncertainties": [],
75
118
  "corrections": []
76
119
  }
77
120
  ```
78
121
 
122
+ Append a checkpoint marker to `worklog.md` when a material unit is complete or
123
+ blocked. It is a bounded recovery projection, not coordinator acceptance:
124
+
125
+ ```text
126
+ <!-- trellis-checkpoint: {"id":"checkpoint-1","covered_scope":["exact scope item"],"evidence_ids":["stable-evidence-id"],"conclusion_or_blocker":"Current conclusion or blocker.","unknowns":[],"safe_resume_point":"Next safe action."} -->
127
+ ```
128
+
129
+ The validator returns `review_concern` for missing or incomplete checkpoint
130
+ coverage and for inconclusive scope assessments so the coordinator can inspect
131
+ them. Identity, schema, path, and malformed-structure failures remain hard
132
+ errors. A concern is never automatic acceptance or rejection.
133
+
79
134
  For `blocked`, `incomplete`, or `error`, include the same base fields plus a
80
135
  `completed_scope` list (empty when no assigned scope started) and a non-empty
81
136
  `blocker` string. Never use
82
137
  `accepted`, `rejected`, or `deferred` as a report status.
83
138
 
139
+ ## Dispatch Approval
140
+
141
+ A request for research authorizes main-session evidence work; it does not by itself approve a subnode dispatch plan that has not yet been presented. Before any subnode `spawn` or `send`, persist and present the frozen plan in the active task. It must identify the research question, exact evidence-unit-to-scope mapping and grouping rationale, each brief's evidence range/sources, stop condition and report destination, concurrency/slot strategy, initial fill and FIFO refill/acceptance rules, and material dependencies. Record the user's explicit approval in that artifact. Approval is limited to the listed evidence work and grants no implementation authority. A material change to units, scope, method, owner, risk, or acceptance requires a newly frozen plan and approval before further affected dispatch. The main session may continue its own evidence work while awaiting dispatch approval.
142
+
84
143
  ## Dispatch And Wait
85
144
 
86
- Inspect the installed role first, then capture a durable event barrier before
87
- the worker can emit a terminal event. The CLI waits once and replays matching
88
- events committed after that barrier:
145
+ After the frozen plan is approved, inspect the installed role first, then capture a durable event barrier before
146
+ the worker can emit a terminal event. The CLI waits once for a worker lifecycle
147
+ transition after that barrier, including supervisor-authored terminal events:
89
148
 
90
149
  ```bash
91
- trellis channel create subnode-example --by main --cwd "$PWD"
150
+ trellis channel create subnode-example
92
151
  BARRIER="$(trellis channel barrier subnode-example)"
93
- trellis channel spawn subnode-example --agent subnode --provider codex \
94
- --as "$SUBNODE_ID" --cwd "$PWD"
152
+ trellis channel spawn subnode-example --agent subnode --as "$SUBNODE_ID"
95
153
 
96
154
  printf '%s\n' "Read $TASK/subnodes/$WORK_ID/$SUBNODE_ID/brief.json and perform only that bounded work." \
97
- | trellis channel send subnode-example --as main --to "$SUBNODE_ID" \
155
+ | trellis channel send subnode-example --to "$SUBNODE_ID" \
98
156
  --stdin --delivery-mode requireRunningWorker
99
157
 
100
- trellis channel wait subnode-example --as main --from "$SUBNODE_ID" \
101
- --kind done,error,killed --after-seq "$BARRIER" --timeout 30m
158
+ trellis channel wait subnode-example --workers "$SUBNODE_ID" \
159
+ --after-seq "$BARRIER" --timeout 30m
102
160
  ```
103
161
 
162
+ When selecting a configured model profile, use `--profile <id>` in place of `--agent subnode`; it implies the subnode role and reads its Codex provider from role frontmatter. Keep the unique worker `--as` for dispatch identity. Omit author `--as` on `send` and `wait` to use `TRELLIS_CHANNEL_AS` or `main`.
163
+
104
164
  `channel.subnode` in `.trellis/config.yaml` supplies the role defaults for
105
165
  `max_live_workers` (generated default `8`), `idle_timeout`, `timeout`, and
106
166
  `warn_before`. Change that section before a dispatch group when its resource
@@ -108,8 +168,18 @@ or lifetime needs differ; pass the corresponding `spawn` flag only for a
108
168
  one-off override. The generic `channel.worker_guard` remains the fallback for
109
169
  ordinary workers and for a subnode key omitted from the project config.
110
170
 
171
+ For rolling FIFO dispatch, follow `references/multi-target-dispatch.md`: initially
172
+ fill available native capacity, wait for the first terminal worker, review and
173
+ accept it, then refill while other workers continue. Do not use `--all` as an
174
+ ordinary refill prerequisite. Use `--workers a,b --all` only when the intent
175
+ requires draining all already dispatched workers, with the barrier captured
176
+ before dispatch.
177
+ Worker mode emits one terminal worker projection per satisfied target. Ordinary
178
+ adapter errors and peer turn completion do not end the wait. `--from` remains
179
+ an exact event-author filter; it is not a worker lifecycle selector.
180
+
111
181
  Where the host exposes a live wait continuation, capture the same barrier,
112
- establish one event waiter before triggering the worker, and continue that same
182
+ establish one worker waiter before triggering the worker, and continue that same
113
183
  waiter until terminal state. Until it resolves, times out, or errors, the next
114
184
  host operation is only that continuation: do not create another waiter or run
115
185
  shell/CLI diagnostics, including `channel messages`, worker inspection, or
@@ -44,9 +44,9 @@ relative sibling file automatically for the provider child. Use this for
44
44
  stable role settings so every spawn of that role gets the same environment.
45
45
  The file contains plain `KEY=VALUE` lines only; it is not shell code and does
46
46
  not perform expansion or interpolation. Do not put credentials in a bundled
47
- role file. The bundled `subnode` role uses this mechanism to disable
48
- OpenViking's automatic recall, capture, and fixed background injection in the
49
- evidence worker process.
47
+ role file. The coordinator may pass explicitly reviewed, task-minimal context
48
+ to the child. Parent settings are merged with role settings, then runtime
49
+ settings; later values take precedence.
50
50
 
51
51
  The success event `spawned` records `pid`, `provider`, `agent`, the injected
52
52
  `files`, and the resolved `manifests` so later spectators can audit context.
@@ -58,8 +58,7 @@ match `[A-Za-z0-9._-]+`. The default Trellis install ships three cards:
58
58
 
59
59
  - `.trellis/agents/check.md` — code-quality reviewer.
60
60
  - `.trellis/agents/implement.md` — coding worker for implementation runs.
61
- - `.trellis/agents/subnode.md` — bounded independent-evidence worker; its
62
- `subnode.env` sibling is loaded automatically.
61
+ - `.trellis/agents/subnode.md` — bounded independent-evidence worker.
63
62
 
64
63
  ```yaml
65
64
  ---
@@ -107,8 +106,7 @@ trellis channel spawn cr-example --agent check --provider codex --as check-cx \
107
106
  --file "$TASK/prd.md" \
108
107
  --file "$TASK/design.md" \
109
108
  --file "$TASK/implement.md" \
110
- --jsonl "$TASK/check.jsonl" \
111
- --cwd "$PWD" --timeout 30m
109
+ --jsonl "$TASK/check.jsonl" --timeout 30m
112
110
  ```
113
111
 
114
112
  The `spawned` event records both the literal `files` array and any `manifests`
@@ -129,7 +127,7 @@ channel:
129
127
  trellis channel spawn cr-feature --agent check --as check-claude
130
128
  trellis channel spawn cr-feature --agent check --provider codex --as check-cx
131
129
 
132
- trellis channel wait cr-feature --as main \
130
+ trellis channel wait cr-feature \
133
131
  --from check-claude,check-cx --kind done --all --timeout 15m
134
132
  ```
135
133
 
@@ -152,7 +150,7 @@ echo "Stop refactoring the parser — switch to fixing the failing test in src/f
152
150
 
153
151
  Flags:
154
152
 
155
- - `--as <agent>` **(required)** — caller identity.
153
+ - `--as <agent>` — caller identity; defaults to `TRELLIS_CHANNEL_AS` or `main`.
156
154
  - `--to <agent>` **(required)** — target worker.
157
155
  - `--scope <project|global>` — channel scope.
158
156
  - `--stdin` / `--text-file <path>` / `[text]` — replacement instruction body.
@@ -256,13 +254,13 @@ running peer.
256
254
  Inbox-relevant subcommands:
257
255
 
258
256
  - `send <channel> [text]` — append a `message` event.
259
- - `--as <agent>` **(required)** — author.
257
+ - `--as <agent>` — author; defaults to `TRELLIS_CHANNEL_AS` or `main`.
260
258
  - `--to <agents>` — CSV; one → string, many → array; broadcast if omitted.
261
259
  - `--stdin` / `--text-file <path>` / `[text]` — body source.
262
260
  - `--delivery-mode <appendOnly|requireKnownWorker|requireRunningWorker>`.
263
261
  - `interrupt <channel> [text]` — soft-interrupt redirect (see above).
264
262
  - `wait <channel>` — block until matching events arrive.
265
- - `--as <agent>` **(required)** — `self` for filter context.
263
+ - `--as <agent>` — filter identity; defaults to `TRELLIS_CHANNEL_AS` or `main`.
266
264
  - `--from <agents>` — CSV authors.
267
265
  - `--kind <kind[,kind...]>` — CSV (OR semantics); supports `interrupt`,
268
266
  `done`, `progress`, etc.
@@ -3,13 +3,20 @@
3
3
  Use these patterns by intent. Prefer durable channels for multi-round work and
4
4
  `channel run` for one-shot questions.
5
5
 
6
+ The selected project workflow owns the dispatch and evidence contract. Under
7
+ `codex-subnode-channel`, the main session implements/checks inline and explicitly
8
+ approved independent evidence uses the subnode brief/report/acceptance path in
9
+ `subnode-work.md`. The generic agent examples below do not override that path.
10
+ Codex Channel workers disable their own native multi-agent features to prevent
11
+ recursion; main-session inline mode does not disable explicit Channel evidence.
12
+
6
13
  ## Pattern A: Multi-round Brainstorm
7
14
 
8
15
  Use when the user says "和 codex/claude 讨论一下", "brainstorm", or "拉一个 agent
9
16
  进来一起看".
10
17
 
11
18
  ```bash
12
- trellis channel create brainstorm-storage-layer --by main \
19
+ trellis channel create brainstorm-storage-layer \
13
20
  --task .trellis/tasks/05-XX-storage-adapter
14
21
  BARRIER="$(trellis channel barrier brainstorm-storage-layer)"
15
22
 
@@ -20,10 +27,10 @@ trellis channel spawn brainstorm-storage-layer \
20
27
  --as cx-arch --timeout 30m
21
28
 
22
29
  trellis channel send brainstorm-storage-layer \
23
- --as main --to cx-arch --text-file /tmp/brainstorm-r1.md
30
+ --to cx-arch --text-file /tmp/brainstorm-r1.md
24
31
 
25
32
  trellis channel wait brainstorm-storage-layer \
26
- --as main --kind done --from cx-arch --after-seq "$BARRIER" --timeout 10m
33
+ --kind done --from cx-arch --after-seq "$BARRIER" --timeout 10m
27
34
  ```
28
35
 
29
36
  Do not stop after one answer. Read the answer, identify vague areas, send a
@@ -49,11 +56,14 @@ needed.
49
56
 
50
57
  ## Pattern B: Implement / Check Agent
51
58
 
52
- Use when the user asks to dispatch implementation or review work.
59
+ Use only when the selected workflow permits Channel implement/check dispatch
60
+ and the task authorizes it, such as a Channel-driven workflow. Under
61
+ `codex-subnode-channel`, use an approved independent-evidence subnode instead;
62
+ ordinary implementation/checking stays in the main session.
53
63
 
54
64
  ```bash
55
65
  TASK=.trellis/tasks/05-12-foo
56
- trellis channel create cr-foo --task "$TASK" --by main
66
+ trellis channel create cr-foo --task "$TASK"
57
67
  BARRIER="$(trellis channel barrier cr-foo)"
58
68
 
59
69
  trellis channel spawn cr-foo \
@@ -61,11 +71,10 @@ trellis channel spawn cr-foo \
61
71
  --jsonl "$TASK/check.jsonl" \
62
72
  --file "$TASK/prd.md" \
63
73
  --file "$TASK/design.md" \
64
- --file "$TASK/implement.md" \
65
- --cwd "$PWD" --timeout 15m
74
+ --file "$TASK/implement.md" --timeout 15m
66
75
 
67
- trellis channel send cr-foo --as main --to check --text-file /tmp/cr-brief.md
68
- trellis channel wait cr-foo --as main --kind done --from check --after-seq "$BARRIER" --timeout 15m
76
+ trellis channel send cr-foo --to check --text-file /tmp/cr-brief.md
77
+ trellis channel wait cr-foo --kind done --from check --after-seq "$BARRIER" --timeout 15m
69
78
  trellis channel messages cr-foo --kind message --from check --tag final_answer
70
79
  ```
71
80
 
@@ -75,10 +84,12 @@ already run.
75
84
 
76
85
  ## Pattern C: Parallel Reviewers
77
86
 
78
- Use one channel and distinct worker names.
87
+ Use one channel and distinct worker names only under the same permitted
88
+ dispatch contract as Pattern B. These generic check workers are not the default
89
+ review path for `codex-subnode-channel`.
79
90
 
80
91
  ```bash
81
- trellis channel create cr-feature --by main --ephemeral
92
+ trellis channel create cr-feature --ephemeral
82
93
  BARRIER="$(trellis channel barrier cr-feature)"
83
94
 
84
95
  trellis channel spawn cr-feature --agent check \
@@ -89,9 +100,9 @@ trellis channel spawn cr-feature --agent check --provider codex --as check-cx \
89
100
  --jsonl "$TASK/check.jsonl" --file "$TASK/prd.md" --file "$TASK/design.md" \
90
101
  --timeout 15m
91
102
 
92
- trellis channel send cr-feature --as main --to check --text-file /tmp/cr-brief.md
93
- trellis channel send cr-feature --as main --to check-cx --text-file /tmp/cr-brief.md
94
- trellis channel wait cr-feature --as main --kind done --from check,check-cx --all --after-seq "$BARRIER" --timeout 15m
103
+ trellis channel send cr-feature --to check --text-file /tmp/cr-brief.md
104
+ trellis channel send cr-feature --to check-cx --text-file /tmp/cr-brief.md
105
+ trellis channel wait cr-feature --kind done --from check,check-cx --all --after-seq "$BARRIER" --timeout 15m
95
106
  ```
96
107
 
97
108
  `--all` means every listed worker must emit a matching event.
@@ -4,10 +4,11 @@ When the user wants to change AI entry points, auto-trigger rules, or explicit c
4
4
 
5
5
  Before editing, classify the skill you are about to touch:
6
6
 
7
- - **Bundled upstream skill** — `trellis-meta`, `trellis-spec-bootstrap`, `trellis-session-insight`, `trellis-channel`. Source of truth lives in the Trellis CLI repo under `packages/cli/src/templates/common/bundled-skills/<name>/`; auto-dispatched to every platform's skill root by `getBundledSkillTemplates()` on `trellis init` / `trellis update`. Local edits here are tracked by `.trellis/.template-hashes.json` and will be flagged on the next update.
8
- - **Project-local skill** — anything else under `.{platform}/skills/`. Owned by the user; not refreshed by `trellis update`.
7
+ - **Bundled multi-file skill** — `trellis-meta`, `trellis-spec-bootstrap`, `trellis-session-insight`, `trellis-channel`, `trellis-research-record`. Source lives under `packages/cli/src/templates/common/bundled-skills/<name>/`; `getBundledSkillTemplates()` distributes it to each platform skill root on init/update.
8
+ - **Other Trellis-managed entry** — single-file skills such as `trellis-check` and `trellis-before-dev`, command-backed skills such as `trellis-finish-work`, and platform-specific entries. Their sources live under `common/skills/`, `common/commands/` or the relevant platform template directory. Configurators generate them and update tracks their template hashes too.
9
+ - **Project-local entry** — content created by the project outside the managed template set, owned by the user and not refreshed by `trellis update`. Its directory or absence from a short bundled-name list does not establish ownership.
9
10
 
10
- The remainder of this file uses "skill" for the local file; the override and conflict rules differ between the two cases.
11
+ The remainder uses "skill" for the local file. Confirm its actual source and generated-file ownership before choosing the edit path.
11
12
 
12
13
  ## Read These Files First
13
14
 
@@ -15,7 +16,7 @@ The remainder of this file uses "skill" for the local file; the override and con
15
16
  2. Target platform skill/command/prompt/workflow directory
16
17
  3. Related agent or hook files
17
18
  4. Whether project rules already exist in `.trellis/spec/`
18
- 5. `.trellis/.template-hashes.json` — confirms whether the skill you are about to edit is upstream-owned (entry present) or project-local (entry absent)
19
+ 5. `.trellis/.template-hashes.json` and the relevant template/configurator — a hash entry confirms management; a missing entry alone does not prove project ownership.
19
20
 
20
21
  ## Which Entry Type To Choose
21
22
 
@@ -25,7 +26,7 @@ The remainder of this file uses "skill" for the local file; the override and con
25
26
  | User wants to trigger manually with a command | Add or modify a command/prompt/workflow. |
26
27
  | Team project conventions | Prefer `.trellis/spec/` or a project-local skill — never a bundled skill directory. |
27
28
  | Tweak a bundled skill (`trellis-meta` et al.) for the user's own project | Create a project-local sibling skill (different name) that overrides intent, or edit `.trellis/spec/`. Edits inside the bundled skill directory survive only until the next `trellis update` and will need a "keep" choice each time. |
28
- | Contribute the change back upstream | Edit `packages/cli/src/templates/common/bundled-skills/<name>/` in the Trellis CLI repo, not the deployed copy. |
29
+ | Contribute the change back upstream | Edit its actual bundled, common skill/command or platform template source in the Trellis CLI repo, not the deployed copy. |
29
30
  | Change Trellis flow semantics | Synchronize `.trellis/workflow.md`. |
30
31
 
31
32
  ## Modify A Skill
@@ -50,12 +51,12 @@ Do not write vague descriptions such as "helpful project skill"; they can trigge
50
51
 
51
52
  ### Bundled vs. Project-Local
52
53
 
53
- The same directory shape is used by two very different ownership models:
54
+ The same directory shape can contain different ownership models:
54
55
 
55
- | Aspect | Bundled (`trellis-meta`, `trellis-spec-bootstrap`, `trellis-session-insight`, `trellis-channel`) | Project-local |
56
+ | Aspect | Trellis-managed entry | Project-local |
56
57
  | --- | --- | --- |
57
- | Source of truth | `packages/cli/src/templates/common/bundled-skills/<name>/` in Trellis CLI repo | Inside the user project itself |
58
- | Dispatch | Auto-dispatched to every platform skill root by `getBundledSkillTemplates()` (`packages/cli/src/templates/common/index.ts`) on `trellis init` / `trellis update` | Created by the user (or another skill) and never moved |
58
+ | Source of truth | Actual bundled, common skill/command or platform template in the Trellis CLI repo | Inside the user project itself |
59
+ | Generation | Bundled files use `getBundledSkillTemplates()`; other entries use the platform configurator on init/update | Created by the user (or another skill) |
59
60
  | Hash tracking | Every file recorded in `.trellis/.template-hashes.json`; conflict prompt on update | Not tracked |
60
61
  | Editing locally | Allowed but will be marked "modified by user" on next update | Free editing |
61
62
  | The right way to customize | Add a *new* project-local skill with a *different* name that supplements (or supersedes) the bundled one | Edit the file directly |
@@ -92,7 +93,7 @@ If a command only repeats workflow rules, prefer making it reference/read `.trel
92
93
  | ZCode | `.zcode/skills/`, `.zcode/commands/` |
93
94
  | Kilo / Antigravity / Devin | workflows + skills |
94
95
 
95
- Every directory above is a deploy target for the four bundled skills. Each platform receives a full copy on `trellis init` and refresh on `trellis update`; nothing has to be wired by hand.
96
+ The bundled multi-file skills are distributed to each supported platform skill root on init/update; other managed entries follow that platform's configurator. Read the actual template set rather than inferring it from a fixed count.
96
97
 
97
98
  ## Add A Project-Local Skill
98
99
 
@@ -111,8 +112,9 @@ Pick a name that does **not** collide with the bundled set:
111
112
  - `trellis-spec-bootstrap`
112
113
  - `trellis-session-insight`
113
114
  - `trellis-channel`
115
+ - `trellis-research-record`
114
116
 
115
- A reused name causes `getBundledSkillTemplates()` to overwrite the project-local copy on the next update. A common convention is to prefix the project name: `acme-trellis-deploy`, `acme-trellis-onboarding`.
117
+ Also avoid names of generated single-file or platform entries. A collision becomes managed template content or an update conflict; it is not a durable override. A common convention is to prefix the project name: `acme-trellis-deploy`, `acme-trellis-onboarding`.
116
118
 
117
119
  ## Notes
118
120
 
@@ -10,6 +10,7 @@ Task lifecycle includes creation, start, context configuration, finish, archive,
10
10
  4. `.trellis/scripts/common/task_store.py`
11
11
  5. `.trellis/scripts/common/task_utils.py`
12
12
  6. The current task's `.trellis/tasks/<task>/task.json`
13
+ 7. `.trellis/scripts/common/task_planning.py` for material revisions and start admission
13
14
 
14
15
  ## Common Needs And Edit Points
15
16
 
@@ -17,11 +18,14 @@ Task lifecycle includes creation, start, context configuration, finish, archive,
17
18
  | --- | --- |
18
19
  | Automatically sync an external system after task creation | `hooks.after_create` in `.trellis/config.yaml`. |
19
20
  | Automatically update status after task start | `hooks.after_start` in `.trellis/config.yaml`. |
21
+ | Return an in-progress task to planning | `hooks.after_replan` in `.trellis/config.yaml`. |
20
22
  | Run a script after task finish | `hooks.after_finish` in `.trellis/config.yaml`. |
21
23
  | Clean external resources after archive | `hooks.after_archive` in `.trellis/config.yaml`. |
22
24
  | Change default task fields | `.trellis/scripts/common/task_store.py`. |
23
25
  | Change task parsing/search | `.trellis/scripts/common/task_utils.py`. |
24
26
  | Change active task behavior | `.trellis/scripts/common/active_task.py`. |
27
+ | Select context without starting | Native `task.py select`; preserve phase/branch and drain live Channel work first. |
28
+ | Seal and record later approval of a material plan | Native `task.py plan seal/approve`; reserved `meta.planning`, owned by `common/task_planning.py`. |
25
29
 
26
30
  ## lifecycle hooks
27
31
 
@@ -43,7 +47,7 @@ Hook commands receive the `TASK_JSON_PATH` environment variable, pointing to the
43
47
 
44
48
  ## Change Task Fields
45
49
 
46
- If the user wants to add project-local fields, prefer putting them under `meta` in `task.json` to avoid breaking existing scripts' assumptions about standard fields.
50
+ If the user wants to add project-local fields, prefer putting them under `meta` in `task.json` to avoid breaking existing scripts' assumptions about standard fields. `meta.planning` is reserved for native seal/approve; do not prefill or overwrite it through generic metadata. Classification uses `execution_class=direct|planned` and `delivery_mode=change_bearing|analysis_only`.
47
51
 
48
52
  Example:
49
53
 
@@ -69,7 +73,8 @@ Active task is session-level state stored in `.trellis/.runtime/sessions/`. Do n
69
73
  `cmd_create` in `.trellis/scripts/common/task_store.py` calls `set_active_task` best-effort right after writing the new task directory. The behavior:
70
74
 
71
75
  - When the calling shell carries session identity (`TRELLIS_CONTEXT_ID` env var, or any platform-specific session env that `resolve_context_key` recognizes — see `active_task.py:_ENV_SESSION_KEYS`), the per-session pointer at `.trellis/.runtime/sessions/<context_key>.json` is rewritten to point at the new task. The task's `status=planning` and `[workflow-state:planning]` fires on the very next `UserPromptSubmit`.
72
- - When session identity is unavailable (raw CLI invocation outside an AI session, or a platform that doesn't propagate identity to shell), the task directory is still created and `status=planning` is still written, but the active pointer is left untouched. The user can attach the task later with `task.py start <dir>` once they're back in an AI session.
76
+ - When session identity is unavailable (raw CLI invocation outside an AI session, or a platform that doesn't propagate identity to shell), the task directory is still created and `status=planning` is still written, but the active pointer is left untouched. Attach planning context later with `task.py select <dir>` once identity is available; start requires its own phase/approval gates.
77
+ - `create --no-start` deliberately preserves the prior pointer; use select to switch context after saving the checkpoint and draining already dispatched Channel work. Selecting does not change phase/branch, run after_start, or grant implementation authority.
73
78
 
74
79
  This makes `[workflow-state:planning]` the live breadcrumb during the brainstorm and JSONL curation work that follows `task.py create`. The pre-R7 behavior left the breadcrumb stuck on `no_task` until `task.py start`, so the planning block was effectively dead text.
75
80
 
@@ -43,6 +43,8 @@ The Trellis task system is stored entirely under `.trellis/tasks/` in the user p
43
43
  | `children` / `parent` | Parent/child task relationships. |
44
44
  | `commit` / `pr_url` | Commit and PR information after completion. |
45
45
  | `meta` | Extension fields. |
46
+ | `meta.execution_class` / `meta.delivery_mode` | Explicit task classification; planned/change-bearing start needs current material-plan approval. |
47
+ | `meta.planning` | Reserved native material revision, seal, and later approval; use plan seal/approve, never generic metadata. |
46
48
 
47
49
  ## Parent / Child Task Trees
48
50
 
@@ -81,7 +83,7 @@ The user sees a "current task," but Trellis stores active task state per session
81
83
  .trellis/.runtime/sessions/<context-key>.json
82
84
  ```
83
85
 
84
- `task.py start` writes the task path into the runtime session file for the current session. `task.py current --source` shows the current task and where it came from. Different AI windows can point to different tasks without overwriting each other.
86
+ `task.py select` writes only the current session's task context; status/branch and implementation authority are unchanged. `task.py start` also enters execution after its admission gates. `task.py current --source` shows the current task and where it came from. Different AI windows can point to different tasks without overwriting each other. Before switching with live Channel work, pause refills and drain already dispatched units/reservations while preserving pending work and the old phase.
85
87
 
86
88
  If the platform or shell environment has no stable session identity, `task.py start` may be unable to set the active task. The AI should read the error, inspect the platform hook/session environment, and not fall back to a shared global pointer.
87
89
 
@@ -107,6 +109,9 @@ Rules:
107
109
 
108
110
  ```bash
109
111
  python3 ./.trellis/scripts/task.py create "<title>" --description "<one-line summary>" --slug <slug>
112
+ python3 ./.trellis/scripts/task.py select <task>
113
+ python3 ./.trellis/scripts/task.py plan seal <task>
114
+ python3 ./.trellis/scripts/task.py plan approve <task> --revision <n> --basis "<actual later approval>"
110
115
  python3 ./.trellis/scripts/task.py start <task>
111
116
  python3 ./.trellis/scripts/task.py current --source
112
117
  python3 ./.trellis/scripts/task.py add-context <task> implement <file> <reason>
@@ -22,10 +22,12 @@ Each phase contains numbered steps, such as `1.3 Configure context`. These numbe
22
22
 
23
23
  ## Skill Routing
24
24
 
25
- `workflow.md` separates routing by platform capability:
25
+ Read the selected `workflow.md` and current task phase to determine routing;
26
+ platform capability alone does not select the implementation/check path:
26
27
 
27
- - Platforms with sub-agent support: dispatch `trellis-implement` by default for implementation and `trellis-check` for checking.
28
- - Platforms without sub-agent support: the main session reads skills such as `trellis-before-dev`, then executes directly.
28
+ - A workflow that selects native sub-agent dispatch uses its platform-supported `trellis-implement` / `trellis-check` path.
29
+ - An inline workflow has the main session read `trellis-before-dev`, implement and check directly. Explicit Channel independent evidence remains subject to that workflow's authorization and acceptance contract.
30
+ - A Channel-driven workflow is a separate selected variant; generic Channel examples do not override an inline workflow.
29
31
 
30
32
  When changing local AI behavior, update the routing descriptions in `workflow.md` first, then check whether the corresponding platform skill, command, or agent files need to stay in sync.
31
33
 
@@ -59,7 +61,7 @@ Common changes:
59
61
  | Add a phase | Update the Phase Index, phase body, routing, and state blocks. |
60
62
  | Change task creation policy | Update the `no_task` state block and Phase 1 description. |
61
63
  | Change the default implementation/check path | Update Phase 2 and skill routing. |
62
- | Change the wrap-up flow | Update Phase 3 and `finish-work` related descriptions. Note the current split: Phase 3.4 = AI-driven code commits (batched, user-confirmed), Phase 3.5 = `/finish-work` (archive + record session). `/finish-work` refuses to run if the working tree is dirty. |
64
+ | Change the wrap-up flow | Update Phase 3 and `finish-work` descriptions together. Follow the selected workflow's commit/push authorization; finish-work checks acceptance and classifies task-related versus unrelated dirty paths before archive and journal recording. |
63
65
  | Change platform differences | Update routing descriptions grouped by platform. |
64
66
 
65
67
  After editing, make the AI reread `.trellis/workflow.md`; do not assume the flow from the old conversation is still valid.
@@ -5,7 +5,7 @@ description: "Reach into past AI conversation history through the `trellis mem`
5
5
 
6
6
  # Trellis Session Insight
7
7
 
8
- This skill teaches an AI **how to call `trellis mem`** — the project's cross-session memory feedstock — and **when reaching for it is the right move**.
8
+ This skill teaches an AI **how to call `trellis mem`** for local conversation history and **when reaching for it is the right move**.
9
9
 
10
10
  It is intentionally a **capability skill, not a workflow**. There is no fixed output file, no required write-back step, no "always run after finish-work" rule. What to do with what `mem` returns is a judgement call made in the moment of the conversation. The skill exists so the AI knows the capability is there and can decide.
11
11
 
@@ -15,6 +15,14 @@ A local CLI that indexes the user's past Claude Code, Codex, Devin CLI, Grok, Op
15
15
 
16
16
  Nothing in `mem` is uploaded. All reads are local.
17
17
 
18
+ `mem` returns historical discussion, not a curated knowledge base or an automatic
19
+ preference/summary writer. Current source, task artifacts, `AGENTS.md`, and specs
20
+ own current facts. If the user asks for maintained knowledge or reusable notes,
21
+ use that environment's configured native knowledge tool instead. Select the
22
+ source by intent and add a targeted second lookup only for a specific evidence
23
+ gap; there is no required sequence through all sources. A knowledge tool's
24
+ absence or failure does not block Trellis tasks, local recall, or handoff.
25
+
18
26
  ## When to reach for it
19
27
 
20
28
  The bar is "would a senior teammate ask 'didn't we already talk about this?'" — those are the moments. Some concrete patterns:
@@ -40,13 +48,44 @@ If none of these apply, don't call `mem`. It is a tool, not a ceremony.
40
48
  Treat the output as **raw material**, not a deliverable. Once you have it, decide based on the live conversation:
41
49
 
42
50
  - **Quote inline in your reply** if a specific past exchange answers the user's current question — and cite the session-id / phase so the user can verify.
43
- - **Update `<task>/prd.md` or `<task>/design.md`** if `mem` surfaced a load-bearing decision that should have been written down but wasn't. Surface the proposed edit to the user first.
51
+ - **Update `<task>/prd.md` or `<task>/design.md`** if `mem` surfaced a load-bearing decision that should have been written down but wasn't. Verify against current facts and follow the active task's authorization; material changes return to its planning gate.
44
52
  - **Append to a task-local notes file** (e.g. `<task>/notes.md` or extending an existing one) if the finding belongs to the current task's record but doesn't fit the PRD.
45
53
  - **Update `.trellis/spec/`** if the finding is a project-wide convention or gotcha that would help future tasks. Run the `trellis-update-spec` skill for that — `session-insight` ends at the discovery.
46
54
  - **Just absorb it** for the next few turns and answer better, without writing anything. This is often the right move for one-off recall.
47
55
 
48
56
  Trellis does not prescribe a single destination. Forcing every recall into a fixed file makes the file grow into noise. Let the situation decide.
49
57
 
58
+ Reusable experience can be proposed for a user-maintained knowledge tool;
59
+ executable project contracts go through `trellis-update-spec`, stable methods
60
+ through the source Skill owner, and cross-project rules require an explicit
61
+ common scope. External knowledge writes or new promotions require concrete user
62
+ intent, including any minimal source-note status/version/target-link update.
63
+ Existing authorized task/spec duties do not acquire an extra confirmation gate.
64
+ Verify each target independently; do not introduce automatic synchronization.
65
+
66
+ ## Bulk history and resource boundaries
67
+
68
+ For bulk or remote history research, first define the project path, platform,
69
+ date range, question and required session types. Start with metadata and a small
70
+ sample to verify the stored structure; filter before extracting bodies. Confirm
71
+ main-session versus child-session scope from actual metadata, not file counts.
72
+
73
+ Choose the processing location and authorized destination before reading a
74
+ large corpus. Process one bounded unit at a time, retain only needed results,
75
+ and transfer only the requested material. Test the intended bulk path on small
76
+ or synthetic data and observe memory/output before scaling. On resource
77
+ pressure, stop the affected work, preserve its checkpoint and reduce the unit;
78
+ do not continue a remote scan or increase concurrency blindly.
79
+
80
+ `--limit` limits displayed rows, not scan work or a process memory budget.
81
+ Codex small-output `search`/`context` avoid accumulating all dialogue bodies,
82
+ but per-record parsing, fingerprints/index metadata and output still cost
83
+ memory. Full `extract`/phase results and the other platform adapters may retain
84
+ complete dialogue arrays. Do not promise constant memory or infer an earlier
85
+ OOM's cause from these limits alone. Preserve the source logs; raw dialogue,
86
+ credentials and runtime data do not belong in Git. Historical findings still
87
+ require current-source verification and do not authorize automatic write-back.
88
+
50
89
  ## How to call it
51
90
 
52
91
  Full CLI reference is in `references/cli-quick-reference.md`. The 80% case is one of:
@@ -68,7 +107,7 @@ trellis mem list --cwd <project-path>
68
107
  trellis mem projects # → list active project cwds, then narrow
69
108
  ```
70
109
 
71
- Phase slicing (`--phase brainstorm|implement|all`) cuts the session at `task.py create` and `task.py start` boundaries. For a finish-work review of the current task, `--phase brainstorm` recovers the planning discussion and `--phase implement` recovers the execution loop. Default is `all`.
110
+ Phase slicing (`--phase brainstorm|implement|all`) cuts the session at `task.py create`/`replan` and `task.py start` boundaries. For a finish-work review of the current task, `--phase brainstorm` recovers the planning discussion and `--phase implement` recovers the execution loop. Default is `all`.
72
111
 
73
112
  ## Triggering patterns
74
113
 
@@ -23,7 +23,7 @@ Full flag reference for the five subcommands. Pin this as the authoritative sour
23
23
  | `--cwd <path>` | list / search | Force a specific project cwd instead of inferring from where you are. |
24
24
  | `--limit N` | list / search | Cap output rows. Default `50`. |
25
25
  | `--grep KW` | extract / context | Filter turns by keyword. Multi-token AND when whitespace-separated. |
26
- | `--phase brainstorm\|implement\|all` | extract | Slice session by Trellis task boundaries. `brainstorm` = `[task.py create, task.py start)`. `implement` = turns outside brainstorm windows. Default `all`. |
26
+ | `--phase brainstorm\|implement\|all` | extract | Slice session by Trellis task boundaries. `brainstorm` = `[task.py create/replan, task.py start)`. `implement` = turns outside brainstorm windows. Default `all`. |
27
27
  | `--turns N` | context | Number of hit turns to return. Default `3`. |
28
28
  | `--around N` | context | Surrounding turns to include per hit. Default `1`. |
29
29
  | `--max-chars N` | context | Total character budget. Default `6000` (~1500 tokens). |