@mindfoldhq/trellis 0.6.0-beta.8 → 0.6.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/README.md +49 -49
  2. package/dist/cli/index.d.ts +1 -1
  3. package/dist/cli/index.d.ts.map +1 -1
  4. package/dist/cli/index.js +59 -2
  5. package/dist/cli/index.js.map +1 -1
  6. package/dist/commands/channel/adapters/claude.d.ts +29 -0
  7. package/dist/commands/channel/adapters/claude.d.ts.map +1 -0
  8. package/dist/commands/channel/adapters/claude.js +203 -0
  9. package/dist/commands/channel/adapters/claude.js.map +1 -0
  10. package/dist/commands/channel/adapters/codex.d.ts +85 -0
  11. package/dist/commands/channel/adapters/codex.d.ts.map +1 -0
  12. package/dist/commands/channel/adapters/codex.js +505 -0
  13. package/dist/commands/channel/adapters/codex.js.map +1 -0
  14. package/dist/commands/channel/adapters/index.d.ts +84 -0
  15. package/dist/commands/channel/adapters/index.d.ts.map +1 -0
  16. package/dist/commands/channel/adapters/index.js +115 -0
  17. package/dist/commands/channel/adapters/index.js.map +1 -0
  18. package/dist/commands/channel/adapters/types.d.ts +33 -0
  19. package/dist/commands/channel/adapters/types.d.ts.map +1 -0
  20. package/dist/commands/channel/adapters/types.js +2 -0
  21. package/dist/commands/channel/adapters/types.js.map +1 -0
  22. package/dist/commands/channel/agent-loader.d.ts +32 -0
  23. package/dist/commands/channel/agent-loader.d.ts.map +1 -0
  24. package/dist/commands/channel/agent-loader.js +154 -0
  25. package/dist/commands/channel/agent-loader.js.map +1 -0
  26. package/dist/commands/channel/context-loader.d.ts +26 -0
  27. package/dist/commands/channel/context-loader.d.ts.map +1 -0
  28. package/dist/commands/channel/context-loader.js +290 -0
  29. package/dist/commands/channel/context-loader.js.map +1 -0
  30. package/dist/commands/channel/context.d.ts +16 -0
  31. package/dist/commands/channel/context.d.ts.map +1 -0
  32. package/dist/commands/channel/context.js +83 -0
  33. package/dist/commands/channel/context.js.map +1 -0
  34. package/dist/commands/channel/create.d.ts +27 -0
  35. package/dist/commands/channel/create.d.ts.map +1 -0
  36. package/dist/commands/channel/create.js +39 -0
  37. package/dist/commands/channel/create.js.map +1 -0
  38. package/dist/commands/channel/dev-parse-trace.d.ts +14 -0
  39. package/dist/commands/channel/dev-parse-trace.d.ts.map +1 -0
  40. package/dist/commands/channel/dev-parse-trace.js +70 -0
  41. package/dist/commands/channel/dev-parse-trace.js.map +1 -0
  42. package/dist/commands/channel/guard.d.ts +150 -0
  43. package/dist/commands/channel/guard.d.ts.map +1 -0
  44. package/dist/commands/channel/guard.js +474 -0
  45. package/dist/commands/channel/guard.js.map +1 -0
  46. package/dist/commands/channel/index.d.ts +3 -0
  47. package/dist/commands/channel/index.d.ts.map +1 -0
  48. package/dist/commands/channel/index.js +531 -0
  49. package/dist/commands/channel/index.js.map +1 -0
  50. package/dist/commands/channel/interrupt.d.ts +10 -0
  51. package/dist/commands/channel/interrupt.d.ts.map +1 -0
  52. package/dist/commands/channel/interrupt.js +22 -0
  53. package/dist/commands/channel/interrupt.js.map +1 -0
  54. package/dist/commands/channel/kill.d.ts +7 -0
  55. package/dist/commands/channel/kill.d.ts.map +1 -0
  56. package/dist/commands/channel/kill.js +121 -0
  57. package/dist/commands/channel/kill.js.map +1 -0
  58. package/dist/commands/channel/list.d.ts +17 -0
  59. package/dist/commands/channel/list.d.ts.map +1 -0
  60. package/dist/commands/channel/list.js +233 -0
  61. package/dist/commands/channel/list.js.map +1 -0
  62. package/dist/commands/channel/messages.d.ts +15 -0
  63. package/dist/commands/channel/messages.d.ts.map +1 -0
  64. package/dist/commands/channel/messages.js +245 -0
  65. package/dist/commands/channel/messages.js.map +1 -0
  66. package/dist/commands/channel/rm.d.ts +27 -0
  67. package/dist/commands/channel/rm.d.ts.map +1 -0
  68. package/dist/commands/channel/rm.js +216 -0
  69. package/dist/commands/channel/rm.js.map +1 -0
  70. package/dist/commands/channel/run.d.ts +30 -0
  71. package/dist/commands/channel/run.d.ts.map +1 -0
  72. package/dist/commands/channel/run.js +130 -0
  73. package/dist/commands/channel/run.js.map +1 -0
  74. package/dist/commands/channel/send.d.ts +11 -0
  75. package/dist/commands/channel/send.d.ts.map +1 -0
  76. package/dist/commands/channel/send.js +24 -0
  77. package/dist/commands/channel/send.js.map +1 -0
  78. package/dist/commands/channel/spawn.d.ts +40 -0
  79. package/dist/commands/channel/spawn.d.ts.map +1 -0
  80. package/dist/commands/channel/spawn.js +244 -0
  81. package/dist/commands/channel/spawn.js.map +1 -0
  82. package/dist/commands/channel/store/events.d.ts +39 -0
  83. package/dist/commands/channel/store/events.d.ts.map +1 -0
  84. package/dist/commands/channel/store/events.js +87 -0
  85. package/dist/commands/channel/store/events.js.map +1 -0
  86. package/dist/commands/channel/store/filter.d.ts +3 -0
  87. package/dist/commands/channel/store/filter.d.ts.map +1 -0
  88. package/dist/commands/channel/store/filter.js +2 -0
  89. package/dist/commands/channel/store/filter.js.map +1 -0
  90. package/dist/commands/channel/store/lock.d.ts +23 -0
  91. package/dist/commands/channel/store/lock.d.ts.map +1 -0
  92. package/dist/commands/channel/store/lock.js +99 -0
  93. package/dist/commands/channel/store/lock.js.map +1 -0
  94. package/dist/commands/channel/store/paths.d.ts +63 -0
  95. package/dist/commands/channel/store/paths.d.ts.map +1 -0
  96. package/dist/commands/channel/store/paths.js +246 -0
  97. package/dist/commands/channel/store/paths.js.map +1 -0
  98. package/dist/commands/channel/store/schema.d.ts +27 -0
  99. package/dist/commands/channel/store/schema.d.ts.map +1 -0
  100. package/dist/commands/channel/store/schema.js +34 -0
  101. package/dist/commands/channel/store/schema.js.map +1 -0
  102. package/dist/commands/channel/store/thread-state.d.ts +5 -0
  103. package/dist/commands/channel/store/thread-state.d.ts.map +1 -0
  104. package/dist/commands/channel/store/thread-state.js +16 -0
  105. package/dist/commands/channel/store/thread-state.js.map +1 -0
  106. package/dist/commands/channel/store/watch.d.ts +19 -0
  107. package/dist/commands/channel/store/watch.d.ts.map +1 -0
  108. package/dist/commands/channel/store/watch.js +146 -0
  109. package/dist/commands/channel/store/watch.js.map +1 -0
  110. package/dist/commands/channel/supervisor/idle.d.ts +46 -0
  111. package/dist/commands/channel/supervisor/idle.d.ts.map +1 -0
  112. package/dist/commands/channel/supervisor/idle.js +72 -0
  113. package/dist/commands/channel/supervisor/idle.js.map +1 -0
  114. package/dist/commands/channel/supervisor/inbox.d.ts +30 -0
  115. package/dist/commands/channel/supervisor/inbox.d.ts.map +1 -0
  116. package/dist/commands/channel/supervisor/inbox.js +160 -0
  117. package/dist/commands/channel/supervisor/inbox.js.map +1 -0
  118. package/dist/commands/channel/supervisor/shutdown.d.ts +68 -0
  119. package/dist/commands/channel/supervisor/shutdown.d.ts.map +1 -0
  120. package/dist/commands/channel/supervisor/shutdown.js +146 -0
  121. package/dist/commands/channel/supervisor/shutdown.js.map +1 -0
  122. package/dist/commands/channel/supervisor/stdout.d.ts +51 -0
  123. package/dist/commands/channel/supervisor/stdout.d.ts.map +1 -0
  124. package/dist/commands/channel/supervisor/stdout.js +121 -0
  125. package/dist/commands/channel/supervisor/stdout.js.map +1 -0
  126. package/dist/commands/channel/supervisor/turns.d.ts +31 -0
  127. package/dist/commands/channel/supervisor/turns.d.ts.map +1 -0
  128. package/dist/commands/channel/supervisor/turns.js +45 -0
  129. package/dist/commands/channel/supervisor/turns.js.map +1 -0
  130. package/dist/commands/channel/supervisor/warning.d.ts +48 -0
  131. package/dist/commands/channel/supervisor/warning.d.ts.map +1 -0
  132. package/dist/commands/channel/supervisor/warning.js +77 -0
  133. package/dist/commands/channel/supervisor/warning.js.map +1 -0
  134. package/dist/commands/channel/supervisor.d.ts +59 -0
  135. package/dist/commands/channel/supervisor.d.ts.map +1 -0
  136. package/dist/commands/channel/supervisor.js +344 -0
  137. package/dist/commands/channel/supervisor.js.map +1 -0
  138. package/dist/commands/channel/text-body.d.ts +13 -0
  139. package/dist/commands/channel/text-body.d.ts.map +1 -0
  140. package/dist/commands/channel/text-body.js +47 -0
  141. package/dist/commands/channel/text-body.js.map +1 -0
  142. package/dist/commands/channel/threads.d.ts +39 -0
  143. package/dist/commands/channel/threads.d.ts.map +1 -0
  144. package/dist/commands/channel/threads.js +106 -0
  145. package/dist/commands/channel/threads.js.map +1 -0
  146. package/dist/commands/channel/title.d.ts +12 -0
  147. package/dist/commands/channel/title.d.ts.map +1 -0
  148. package/dist/commands/channel/title.js +24 -0
  149. package/dist/commands/channel/title.js.map +1 -0
  150. package/dist/commands/channel/wait.d.ts +17 -0
  151. package/dist/commands/channel/wait.d.ts.map +1 -0
  152. package/dist/commands/channel/wait.js +75 -0
  153. package/dist/commands/channel/wait.js.map +1 -0
  154. package/dist/commands/init.d.ts +3 -0
  155. package/dist/commands/init.d.ts.map +1 -1
  156. package/dist/commands/init.js +162 -43
  157. package/dist/commands/init.js.map +1 -1
  158. package/dist/commands/mem.d.ts +13 -217
  159. package/dist/commands/mem.d.ts.map +1 -1
  160. package/dist/commands/mem.js +142 -1587
  161. package/dist/commands/mem.js.map +1 -1
  162. package/dist/commands/uninstall.d.ts.map +1 -1
  163. package/dist/commands/uninstall.js +28 -2
  164. package/dist/commands/uninstall.js.map +1 -1
  165. package/dist/commands/update.d.ts.map +1 -1
  166. package/dist/commands/update.js +104 -7
  167. package/dist/commands/update.js.map +1 -1
  168. package/dist/commands/upgrade.d.ts +28 -0
  169. package/dist/commands/upgrade.d.ts.map +1 -0
  170. package/dist/commands/upgrade.js +84 -0
  171. package/dist/commands/upgrade.js.map +1 -0
  172. package/dist/commands/workflow.d.ts +35 -0
  173. package/dist/commands/workflow.d.ts.map +1 -0
  174. package/dist/commands/workflow.js +232 -0
  175. package/dist/commands/workflow.js.map +1 -0
  176. package/dist/configurators/claude.d.ts.map +1 -1
  177. package/dist/configurators/claude.js +1 -0
  178. package/dist/configurators/claude.js.map +1 -1
  179. package/dist/configurators/index.d.ts.map +1 -1
  180. package/dist/configurators/index.js +5 -0
  181. package/dist/configurators/index.js.map +1 -1
  182. package/dist/configurators/reasonix.d.ts +23 -0
  183. package/dist/configurators/reasonix.d.ts.map +1 -0
  184. package/dist/configurators/reasonix.js +60 -0
  185. package/dist/configurators/reasonix.js.map +1 -0
  186. package/dist/configurators/shared.d.ts.map +1 -1
  187. package/dist/configurators/shared.js +8 -0
  188. package/dist/configurators/shared.js.map +1 -1
  189. package/dist/configurators/workflow.d.ts +8 -0
  190. package/dist/configurators/workflow.d.ts.map +1 -1
  191. package/dist/configurators/workflow.js +14 -3
  192. package/dist/configurators/workflow.js.map +1 -1
  193. package/dist/constants/paths.d.ts +4 -0
  194. package/dist/constants/paths.d.ts.map +1 -1
  195. package/dist/constants/paths.js +4 -0
  196. package/dist/constants/paths.js.map +1 -1
  197. package/dist/migrations/manifests/0.5.13.json +9 -0
  198. package/dist/migrations/manifests/0.5.14.json +9 -0
  199. package/dist/migrations/manifests/0.5.15.json +9 -0
  200. package/dist/migrations/manifests/0.5.16.json +9 -0
  201. package/dist/migrations/manifests/0.5.17.json +9 -0
  202. package/dist/migrations/manifests/0.5.18.json +9 -0
  203. package/dist/migrations/manifests/0.5.19.json +9 -0
  204. package/dist/migrations/manifests/0.6.0-beta.10.json +9 -0
  205. package/dist/migrations/manifests/0.6.0-beta.11.json +9 -0
  206. package/dist/migrations/manifests/0.6.0-beta.12.json +9 -0
  207. package/dist/migrations/manifests/0.6.0-beta.13.json +9 -0
  208. package/dist/migrations/manifests/0.6.0-beta.14.json +9 -0
  209. package/dist/migrations/manifests/0.6.0-beta.15.json +9 -0
  210. package/dist/migrations/manifests/0.6.0-beta.16.json +9 -0
  211. package/dist/migrations/manifests/0.6.0-beta.17.json +9 -0
  212. package/dist/migrations/manifests/0.6.0-beta.18.json +16 -0
  213. package/dist/migrations/manifests/0.6.0-beta.19.json +9 -0
  214. package/dist/migrations/manifests/0.6.0-beta.20.json +9 -0
  215. package/dist/migrations/manifests/0.6.0-beta.21.json +9 -0
  216. package/dist/migrations/manifests/0.6.0-beta.22.json +9 -0
  217. package/dist/migrations/manifests/0.6.0-beta.23.json +88 -0
  218. package/dist/migrations/manifests/0.6.0-beta.9.json +9 -0
  219. package/dist/migrations/manifests/0.6.0-rc.0.json +9 -0
  220. package/dist/templates/claude/agents/trellis-check.md +12 -6
  221. package/dist/templates/claude/agents/trellis-implement.md +1 -1
  222. package/dist/templates/claude/agents/trellis-research.md +1 -1
  223. package/dist/templates/claude/settings.json +4 -4
  224. package/dist/templates/codebuddy/agents/trellis-check.md +12 -6
  225. package/dist/templates/codebuddy/agents/trellis-implement.md +1 -1
  226. package/dist/templates/codebuddy/agents/trellis-research.md +1 -1
  227. package/dist/templates/codebuddy/settings.json +4 -4
  228. package/dist/templates/codex/agents/trellis-check.toml +0 -25
  229. package/dist/templates/codex/agents/trellis-implement.toml +0 -25
  230. package/dist/templates/codex/config.toml +9 -16
  231. package/dist/templates/codex/hooks/session-start.py +22 -0
  232. package/dist/templates/codex/hooks.json +2 -2
  233. package/dist/templates/codex/skills/brainstorm/SKILL.md +69 -519
  234. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +27 -0
  235. package/dist/templates/common/bundled-skills/trellis-session-insight/SKILL.md +81 -0
  236. package/dist/templates/common/bundled-skills/trellis-session-insight/references/cli-quick-reference.md +66 -0
  237. package/dist/templates/common/bundled-skills/trellis-session-insight/references/triggering-patterns.md +93 -0
  238. package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/SKILL.md +41 -0
  239. package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/mcp-setup.md +90 -0
  240. package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/repository-analysis.md +59 -0
  241. package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/spec-task-planning.md +61 -0
  242. package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/spec-writing.md +70 -0
  243. package/dist/templates/common/skills/brainstorm.md +68 -518
  244. package/dist/templates/copilot/hooks/session-start.py +36 -11
  245. package/dist/templates/copilot/hooks.json +2 -2
  246. package/dist/templates/copilot/prompts/brainstorm.prompt.md +69 -519
  247. package/dist/templates/cursor/agents/trellis-check.md +12 -6
  248. package/dist/templates/cursor/agents/trellis-implement.md +1 -1
  249. package/dist/templates/cursor/agents/trellis-research.md +1 -1
  250. package/dist/templates/cursor/hooks.json +1 -7
  251. package/dist/templates/droid/droids/trellis-check.md +12 -6
  252. package/dist/templates/droid/droids/trellis-implement.md +1 -1
  253. package/dist/templates/droid/droids/trellis-research.md +1 -1
  254. package/dist/templates/droid/settings.json +4 -4
  255. package/dist/templates/gemini/agents/trellis-check.md +11 -5
  256. package/dist/templates/gemini/settings.json +2 -2
  257. package/dist/templates/kiro/agents/trellis-check.json +1 -1
  258. package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +127 -9
  259. package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +171 -6
  260. package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +48 -4
  261. package/dist/templates/markdown/spec/guides/index.md.txt +18 -0
  262. package/dist/templates/opencode/agents/trellis-check.md +11 -5
  263. package/dist/templates/opencode/lib/trellis-context.js +73 -11
  264. package/dist/templates/opencode/plugins/inject-subagent-context.js +112 -26
  265. package/dist/templates/opencode/plugins/inject-workflow-state.js +8 -1
  266. package/dist/templates/opencode/plugins/session-start.js +9 -1
  267. package/dist/templates/pi/agents/trellis-check.md +5 -4
  268. package/dist/templates/pi/agents/trellis-implement.md +5 -4
  269. package/dist/templates/pi/extensions/trellis/index.ts.txt +1339 -913
  270. package/dist/templates/pi/settings.json +0 -9
  271. package/dist/templates/qoder/agents/trellis-check.md +12 -6
  272. package/dist/templates/qoder/agents/trellis-implement.md +1 -1
  273. package/dist/templates/qoder/agents/trellis-research.md +1 -1
  274. package/dist/templates/qoder/settings.json +4 -4
  275. package/dist/templates/reasonix/agents/trellis-check.md +36 -0
  276. package/dist/templates/reasonix/agents/trellis-implement.md +41 -0
  277. package/dist/templates/reasonix/index.d.ts +13 -0
  278. package/dist/templates/reasonix/index.d.ts.map +1 -0
  279. package/dist/templates/reasonix/index.js +16 -0
  280. package/dist/templates/reasonix/index.js.map +1 -0
  281. package/dist/templates/shared-hooks/index.d.ts.map +1 -1
  282. package/dist/templates/shared-hooks/index.js +0 -1
  283. package/dist/templates/shared-hooks/index.js.map +1 -1
  284. package/dist/templates/shared-hooks/inject-workflow-state.py +22 -0
  285. package/dist/templates/shared-hooks/session-start.py +25 -8
  286. package/dist/templates/trellis/agents/check.md +70 -0
  287. package/dist/templates/trellis/agents/implement.md +71 -0
  288. package/dist/templates/trellis/config.yaml +20 -0
  289. package/dist/templates/trellis/index.d.ts +13 -0
  290. package/dist/templates/trellis/index.d.ts.map +1 -1
  291. package/dist/templates/trellis/index.js +22 -0
  292. package/dist/templates/trellis/index.js.map +1 -1
  293. package/dist/templates/trellis/scripts/common/safe_commit.py +49 -19
  294. package/dist/templates/trellis/scripts/common/session_context.py +215 -138
  295. package/dist/templates/trellis/scripts/common/task_store.py +94 -16
  296. package/dist/templates/trellis/workflow.md +21 -0
  297. package/dist/types/ai-tools.d.ts +4 -4
  298. package/dist/types/ai-tools.d.ts.map +1 -1
  299. package/dist/types/ai-tools.js +16 -0
  300. package/dist/types/ai-tools.js.map +1 -1
  301. package/dist/utils/agent-refs.d.ts +31 -0
  302. package/dist/utils/agent-refs.d.ts.map +1 -0
  303. package/dist/utils/agent-refs.js +63 -0
  304. package/dist/utils/agent-refs.js.map +1 -0
  305. package/dist/utils/cwd-guard.d.ts +38 -0
  306. package/dist/utils/cwd-guard.d.ts.map +1 -0
  307. package/dist/utils/cwd-guard.js +62 -0
  308. package/dist/utils/cwd-guard.js.map +1 -0
  309. package/dist/utils/file-writer.d.ts +13 -0
  310. package/dist/utils/file-writer.d.ts.map +1 -1
  311. package/dist/utils/file-writer.js +59 -1
  312. package/dist/utils/file-writer.js.map +1 -1
  313. package/dist/utils/manifest-prune.d.ts +61 -0
  314. package/dist/utils/manifest-prune.d.ts.map +1 -0
  315. package/dist/utils/manifest-prune.js +136 -0
  316. package/dist/utils/manifest-prune.js.map +1 -0
  317. package/dist/utils/registry-config.d.ts +7 -0
  318. package/dist/utils/registry-config.d.ts.map +1 -0
  319. package/dist/utils/registry-config.js +171 -0
  320. package/dist/utils/registry-config.js.map +1 -0
  321. package/dist/utils/task-json.d.ts +9 -42
  322. package/dist/utils/task-json.d.ts.map +1 -1
  323. package/dist/utils/task-json.js +8 -45
  324. package/dist/utils/task-json.js.map +1 -1
  325. package/dist/utils/template-fetcher.d.ts +11 -0
  326. package/dist/utils/template-fetcher.d.ts.map +1 -1
  327. package/dist/utils/template-fetcher.js +51 -2
  328. package/dist/utils/template-fetcher.js.map +1 -1
  329. package/dist/utils/template-hash.d.ts +32 -6
  330. package/dist/utils/template-hash.d.ts.map +1 -1
  331. package/dist/utils/template-hash.js +53 -31
  332. package/dist/utils/template-hash.js.map +1 -1
  333. package/dist/utils/workflow-resolver.d.ts +86 -0
  334. package/dist/utils/workflow-resolver.d.ts.map +1 -0
  335. package/dist/utils/workflow-resolver.js +265 -0
  336. package/dist/utils/workflow-resolver.js.map +1 -0
  337. package/package.json +9 -8
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: trellis-session-insight
3
+ description: "Reach into past AI conversation history through the `trellis mem` CLI. Use whenever the user asks 'how did we solve X last time', 'have we discussed this before', 'what was the decision on X', 'remind me what we did in this task', '上次怎么解的', '之前讨论过吗', '想起一段对话', or when starting a brainstorm that overlaps prior work, debugging a familiar bug, continuing a task across sessions, or doing a finish-work review. Returns raw past dialogue; decide for the moment whether to update spec, append to task notes, quote inline in the answer, or just internalize."
4
+ ---
5
+
6
+ # Trellis Session Insight
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**.
9
+
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
+
12
+ ## What `trellis mem` is
13
+
14
+ A local CLI that indexes the user's past Claude Code and Codex conversation logs (the JSONL files each platform stores under `~/.claude/projects/` and `~/.codex/sessions/`) and lets you list, search, slice by Trellis task boundaries, and dump cleaned dialogue from them. OpenCode logs are not yet indexable (provider adapter pending) — when an OpenCode session is the obvious target, surface that limitation rather than guessing.
15
+
16
+ Nothing in `mem` is uploaded. All reads are local.
17
+
18
+ ## When to reach for it
19
+
20
+ The bar is "would a senior teammate ask 'didn't we already talk about this?'" — those are the moments. Some concrete patterns:
21
+
22
+ - **Brainstorm rerun risk.** Starting a new task that touches an area the user has been in before, and you want to check whether a decision was already made — before re-asking the user.
23
+ - **Familiar-bug debugging.** The current bug pattern feels like one the user reported / fixed before. Pulling the relevant past session can save a full debugging loop.
24
+ - **Cross-session continuation.** The user resumes work after a gap and says "where were we" / "继续上次的" without being specific.
25
+ - **Decision retrieval.** The user references "the decision we made about X" but the decision lives in an old brainstorm, not in any `prd.md` / `spec/`.
26
+ - **Finish-work retrospective.** When the user explicitly asks for a wrap-up of what was decided / what hurt / what surprised them in this task — not as a forced step on every finish-work.
27
+ - **Pattern-spotting across past work.** The user asks "do I keep making the same mistake on X" / "我每次都踩这个坑吗" — search across sessions answers that.
28
+
29
+ If none of these apply, don't call `mem`. It is a tool, not a ceremony.
30
+
31
+ ## When NOT to reach for it
32
+
33
+ - The relevant context is already in the current turn, `prd.md`, `design.md`, recent `git log`, or the open files. `mem` is for stuff that has fallen out of immediate reach.
34
+ - The user is asking about a fact in the code, not a fact from a past conversation. `git log -p` / `grep` / reading the file directly is faster and more authoritative.
35
+ - You are in a sub-agent (`trellis-implement` / `trellis-check`) whose dispatch prompt already includes the curated `implement.jsonl` / `check.jsonl` context. Adding `mem` on top usually just clutters.
36
+ - The user has explicitly said "don't dig through history, just answer what I asked".
37
+
38
+ ## What to do with what `mem` returns
39
+
40
+ Treat the output as **raw material**, not a deliverable. Once you have it, decide based on the live conversation:
41
+
42
+ - **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.
44
+ - **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
+ - **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
+ - **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
+
48
+ 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
+
50
+ ## How to call it
51
+
52
+ Full CLI reference is in `references/cli-quick-reference.md`. The 80% case is one of:
53
+
54
+ ```bash
55
+ # Find sessions whose contents mention a keyword (project-scope is default;
56
+ # add --global to search every project on this machine).
57
+ trellis mem search "<keyword>"
58
+
59
+ # Dump dialogue from one session, optionally filtered by phase or keyword.
60
+ trellis mem extract <session-id> --phase brainstorm
61
+ trellis mem extract <session-id> --grep "<keyword>"
62
+
63
+ # Drill into a session: top-N hit turns + surrounding context.
64
+ trellis mem context <session-id> --turns 3 --around 2
65
+
66
+ # When you do not know the session id yet, start with list + filter.
67
+ trellis mem list --task <task-dir>
68
+ trellis mem projects # → list active project cwds, then narrow
69
+ ```
70
+
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`.
72
+
73
+ ## Triggering patterns
74
+
75
+ `references/triggering-patterns.md` lists more verbatim user phrasings (English + Chinese) that should make you think "reach for `mem`" — keep that handy when training instinct.
76
+
77
+ ## Out of scope
78
+
79
+ - `mem` does not edit code or update files. Any write-back is your decision in the moment.
80
+ - `mem` is read-only on the platform JSONL stores. It does not push or sync to remote.
81
+ - This skill does not replace `trellis-update-spec` (which is the right tool for promoting a finding into project-wide guidance) or the platform-native task / spec workflow.
@@ -0,0 +1,66 @@
1
+ # `trellis mem` CLI Reference
2
+
3
+ Full flag reference for the five subcommands. Pin this as the authoritative source — `trellis mem help` prints the same content at runtime, so anything here that drifts is a bug.
4
+
5
+ ## Subcommands
6
+
7
+ | Command | Purpose |
8
+ |---|---|
9
+ | `list` | List sessions. Default subcommand when none is given. |
10
+ | `search <keyword>` | Find sessions whose contents match a keyword. |
11
+ | `context <session-id>` | Drill into one session: top-N hit turns + surrounding context. Pair with `--grep` for keyword anchoring. |
12
+ | `extract <session-id>` | Dump cleaned dialogue. Combine with `--phase` / `--grep` to slice. |
13
+ | `projects` | List active project `cwd` values with session counts. Use this to discover which `--cwd` to pass to other subcommands. |
14
+
15
+ ## Flags (apply where meaningful)
16
+
17
+ | Flag | Subcommands | Meaning |
18
+ |---|---|---|
19
+ | `--platform claude\|codex\|opencode\|all` | all | Default `all`. OpenCode adapter is currently a stub on `0.6.0-beta.*` — see "Caveats" below. |
20
+ | `--since YYYY-MM-DD` | list / search | Inclusive lower date bound. |
21
+ | `--until YYYY-MM-DD` | list / search | Inclusive upper date bound. |
22
+ | `--global` | list / search | Include sessions from every project on this machine. Default is the current project `cwd`. |
23
+ | `--cwd <path>` | list / search | Force a specific project cwd instead of inferring from where you are. |
24
+ | `--limit N` | list / search | Cap output rows. Default `50`. |
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` = `[task.py start, task.py finish)` window. Default `all`. |
27
+ | `--turns N` | context | Number of hit turns to return. Default `3`. |
28
+ | `--around N` | context | Surrounding turns to include per hit. Default `1`. |
29
+ | `--max-chars N` | context | Total character budget. Default `6000` (~1500 tokens). |
30
+ | `--include-children` | search / context | Merge OpenCode sub-agent sessions into their parent session. |
31
+ | `--json` | all | Emit machine-parseable JSON instead of human-readable output. |
32
+ | `--task <task-dir>` | list | Narrow to sessions whose context-key resolved to a given task directory (uses `.trellis/.runtime/sessions/*.json`). |
33
+
34
+ ## Common one-liners
35
+
36
+ ```bash
37
+ # What past sessions discussed "deadlock" anywhere on this machine?
38
+ trellis mem search "deadlock" --global --limit 20
39
+
40
+ # Inside a specific session, surface the top 5 turns that mention "lock contention"
41
+ # plus 2 turns of surrounding context.
42
+ trellis mem context 5842592d --grep "lock contention" --turns 5 --around 2
43
+
44
+ # Recover the brainstorm window for a session — useful when continuing a task
45
+ # the user started a week ago.
46
+ trellis mem extract 5842592d --phase brainstorm
47
+
48
+ # List every project this machine has Trellis sessions for, with counts.
49
+ trellis mem projects
50
+ ```
51
+
52
+ ## Output shapes
53
+
54
+ - **Default human output** (no `--json`): wrapped to a terminal, with session ids highlighted and turn markers visible. Suitable to read inline but messy to paste into a markdown file.
55
+ - **`--json`**: stable schema, safe to parse and process. When piping `mem` output into a follow-up step (e.g. summarizing for a Lessons section), prefer `--json`.
56
+
57
+ ## Caveats
58
+
59
+ - **OpenCode adapter is a stub on `0.6.0-beta.*`.** When `--platform` resolves to OpenCode (or `all` and OpenCode would be included), `mem` prints a one-line "reader unavailable" notice and continues with the other platforms. Don't promise OpenCode coverage in your reply until the adapter ships.
60
+ - **`--phase` slicing depends on `task.py create` / `task.py start` invocations appearing in the recorded bash calls of the session.** Sessions where the user ran `task.py` from a different terminal — outside the recorded AI loop — will not have phase boundaries. `--phase all` is the safe fallback.
61
+ - **`mem` indexes platform JSONL files directly.** If the user has cleared their Claude / Codex session storage, `mem` cannot recover what is no longer on disk.
62
+ - **`mem` is read-only.** No remote sync, no edits to platform JSONL. Any write you do based on `mem` findings is your own follow-up call into the editing tools available to you.
63
+
64
+ ## When you need more than this reference
65
+
66
+ Run `trellis mem help` in the user's shell. The runtime help is authoritative and will be ahead of this reference during fast-moving beta releases.
@@ -0,0 +1,93 @@
1
+ # Triggering Patterns
2
+
3
+ Verbatim user phrasings that should make an AI reach for `trellis mem`. Calibrate instinct against these — if a user message hits one of these patterns and you do not reach for `mem`, you probably missed an obvious recall.
4
+
5
+ Patterns are grouped by the *intent* behind the phrasing, not the surface words. The same intent shows up in different languages and registers.
6
+
7
+ ## Past-solution recall
8
+
9
+ The user is asking "how did we (or I) solve this before". Past dialogue holds the answer; the codebase shows the result but not the reasoning.
10
+
11
+ - "How did we solve this last time?"
12
+ - "What did we end up doing about X?"
13
+ - "We dealt with this once already, didn't we?"
14
+ - "上次怎么解的?"
15
+ - "之前是怎么搞定 X 的?"
16
+ - "我记得以前修过类似的"
17
+
18
+ Reach: `trellis mem search "<symptom keyword>" --global --limit 10`, then `context` into the hit that looks closest.
19
+
20
+ ## Decision retrieval
21
+
22
+ The user is referencing a decision that lives in old dialogue, not in any committed file. Look in brainstorm windows.
23
+
24
+ - "What was the decision on X?"
25
+ - "Did we decide to use Postgres or SQLite?"
26
+ - "The rationale for choosing X over Y was…?"
27
+ - "我们当时为啥选了 X 而不是 Y?"
28
+ - "关于 X 我们之前是怎么定的?"
29
+ - "之前讨论过 X 的方案吗?"
30
+
31
+ Reach: `trellis mem search "<decision keyword>"` to find the session, then `extract <id> --phase brainstorm` to recover the discussion.
32
+
33
+ ## Cross-session continuation
34
+
35
+ The user resumed work after a gap and the context is implicit.
36
+
37
+ - "Where were we?"
38
+ - "Continue from last time."
39
+ - "Pick up where we left off."
40
+ - "继续上次的"
41
+ - "我们上次做到哪了"
42
+ - "接着昨天那个任务"
43
+
44
+ Reach: `trellis mem list --task <current-task-dir>` to find the most recent sessions tied to the active task, then `extract` the last one.
45
+
46
+ ## Familiar-bug debugging
47
+
48
+ The current bug feels like one already seen. Past sessions probably hold the resolution path.
49
+
50
+ - "I feel like I've hit this before."
51
+ - "Doesn't this look like that bug from last month?"
52
+ - "Same kind of timeout I had in X."
53
+ - "这个错好像之前见过"
54
+ - "这个 bug 是不是上次那个?"
55
+ - "怎么又是这个 error?"
56
+
57
+ Reach: `trellis mem search "<error message fragment>" --global`. Anchor on a short, distinctive token from the actual error string.
58
+
59
+ ## Self-pattern spotting
60
+
61
+ The user is asking whether they keep repeating the same kind of mistake or decision.
62
+
63
+ - "Do I always make this mistake?"
64
+ - "How often have I run into X?"
65
+ - "Is this a recurring thing for me?"
66
+ - "我每次都踩这个坑吗?"
67
+ - "我老犯这个错?"
68
+ - "这类问题之前出现过几次?"
69
+
70
+ Reach: `trellis mem search "<topic>" --global --limit 50` and scan the dates / projects in the listing. Optionally `extract` two or three for comparison.
71
+
72
+ ## Finish-work retrospective (on demand)
73
+
74
+ The user explicitly wants to look back at this task — not as a forced step, only when they ask.
75
+
76
+ - "Summarize what we did in this task."
77
+ - "What were the key decisions / surprises?"
78
+ - "Write up the lessons from this round."
79
+ - "总结一下这次的经验"
80
+ - "记一下这次踩的坑"
81
+ - "复盘下这个任务"
82
+
83
+ Reach: identify the current task's session id (from `.trellis/.runtime/sessions/*.json` or `mem list --task <task-dir>`), then `extract <id> --phase brainstorm` and `--phase implement`. Present a summary — surface concrete file:line citations where possible. Whether to also write the summary somewhere (PRD, spec, notes file) is the user's call; offer, don't auto-write.
84
+
85
+ ## Anti-patterns: do NOT reach for `mem` here
86
+
87
+ - "What does this function do?" → read the file.
88
+ - "Why is this test failing?" → read the test output and the file.
89
+ - "What's the right pattern for X in our codebase?" → grep / read spec files.
90
+ - "What's the latest npm version of Y?" → call `npm view`.
91
+ - "Fix this bug." → debug. Reach for `mem` only if you suspect prior context exists; otherwise it is noise.
92
+
93
+ The bar stays: would a senior teammate ask "didn't we already talk about this?" before answering? If yes, reach for `mem`. If no, don't.
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: trellis-spec-bootstrap
3
+ description: "Bootstrap project-specific Trellis coding specs with a platform-neutral single-agent workflow. Use when creating or refreshing .trellis/spec guidelines, analyzing a codebase with GitNexus, ABCoder, or source inspection, decomposing package/layer spec work, and writing real codebase-backed spec docs without placeholder text."
4
+ ---
5
+
6
+ # Trellis Spec Bootstrap
7
+
8
+ Use this skill to create or refresh `.trellis/spec/` guidelines from the real codebase. One capable agent owns the full loop: analyze the repository, choose the spec boundaries, write the docs, and verify the result. The workflow does not depend on a specific host, CLI, or agent brand.
9
+
10
+ ## Workflow
11
+
12
+ 1. Confirm Trellis is initialized and inspect the current `.trellis/spec/` tree.
13
+ 2. Analyze the repository architecture with the best available tools: GitNexus, ABCoder, language tooling, and direct source reads.
14
+ 3. Decompose the spec work by package and layer only when that reflects the actual codebase.
15
+ 4. Fill or reshape the spec files with concrete patterns, file paths, examples, and anti-patterns from the project.
16
+ 5. Verify that the final specs are internally consistent and contain no template placeholders.
17
+
18
+ ## Reference Routing
19
+
20
+ | Need | Read |
21
+ |------|------|
22
+ | Repository architecture analysis | [references/repository-analysis.md](references/repository-analysis.md) |
23
+ | Spec work decomposition and task planning | [references/spec-task-planning.md](references/spec-task-planning.md) |
24
+ | Writing high-signal Trellis spec files | [references/spec-writing.md](references/spec-writing.md) |
25
+ | GitNexus and ABCoder MCP setup | [references/mcp-setup.md](references/mcp-setup.md) |
26
+
27
+ ## Operating Rules
28
+
29
+ - Treat templates as starting points, not contracts. Delete, rename, split, or add spec files when the repository calls for it.
30
+ - Prefer source-backed rules over generic advice. Every important recommendation should point at a real file or repeated local pattern.
31
+ - Keep execution single-owner by default. Optional helper agents are an implementation detail, not a requirement or user-visible dependency.
32
+ - Do not write platform-specific instructions unless the target project already standardizes on that platform.
33
+ - Do not leave placeholder text, empty headings, or copied boilerplate in `.trellis/spec/`.
34
+
35
+ ## Done Criteria
36
+
37
+ - `.trellis/spec/` describes the project as it exists now.
38
+ - Each relevant package or layer has practical coding guidance with real examples.
39
+ - Non-applicable template sections are removed.
40
+ - `index.md` files match the final spec file set.
41
+ - Any required setup or analysis assumptions are documented in the relevant spec or task notes.
@@ -0,0 +1,90 @@
1
+ # MCP Setup
2
+
3
+ GitNexus and ABCoder are recommended when bootstrapping Trellis specs because they expose architecture and AST context to the agent. They are tool choices, not platform requirements. Configure them through whatever MCP mechanism your agent host provides.
4
+
5
+ ## GitNexus
6
+
7
+ GitNexus builds a code knowledge graph from the repository. Use it for module boundaries, execution flows, dependency relationships, blast radius, and graph queries.
8
+
9
+ ### Install and Index
10
+
11
+ ```bash
12
+ # Run from the repository root.
13
+ npx gitnexus analyze
14
+
15
+ # Check index status.
16
+ npx gitnexus status
17
+
18
+ # Re-index after code changes when the analysis is stale.
19
+ npx gitnexus analyze
20
+ ```
21
+
22
+ The index is written to `.gitnexus/`. Keep embeddings only if the project already uses them; otherwise a normal index is enough for spec bootstrapping.
23
+
24
+ ### MCP Server Command
25
+
26
+ Use this server command in the host's MCP configuration:
27
+
28
+ ```bash
29
+ npx -y gitnexus mcp
30
+ ```
31
+
32
+ ### Useful Tools
33
+
34
+ | Tool | Purpose |
35
+ |------|---------|
36
+ | `gitnexus_query` | Find execution flows and functional areas by concept |
37
+ | `gitnexus_context` | Inspect callers, callees, references, and process participation for a symbol |
38
+ | `gitnexus_impact` | Understand blast radius before changing a symbol |
39
+ | `gitnexus_detect_changes` | Check changed symbols and affected flows before finishing |
40
+ | `gitnexus_cypher` | Run direct graph queries |
41
+ | `gitnexus_list_repos` | List indexed repositories |
42
+
43
+ ## ABCoder
44
+
45
+ ABCoder parses code into UniAST and gives precise package, file, and node-level structure. Use it for signatures, type shapes, implementations, dependencies, and reverse references.
46
+
47
+ ### Install
48
+
49
+ ```bash
50
+ go install github.com/cloudwego/abcoder@latest
51
+ abcoder --help
52
+ ```
53
+
54
+ ### Parse Repositories
55
+
56
+ ```bash
57
+ abcoder parse /absolute/path/to/package \
58
+ --lang typescript \
59
+ --name package-name \
60
+ --output ~/abcoder-asts
61
+ ```
62
+
63
+ For monorepos, parse each package with a stable `--name` so task notes can reference the same repository names.
64
+
65
+ ### MCP Server Command
66
+
67
+ Use this server command in the host's MCP configuration:
68
+
69
+ ```bash
70
+ abcoder mcp ~/abcoder-asts
71
+ ```
72
+
73
+ ### Useful Tools
74
+
75
+ | Tool | Layer | Purpose |
76
+ |------|-------|---------|
77
+ | `list_repos` | 1 | List parsed repositories |
78
+ | `get_repo_structure` | 2 | Inspect packages and files |
79
+ | `get_package_structure` | 3 | Inspect nodes within a package |
80
+ | `get_file_structure` | 3 | Inspect functions, classes, types, and signatures in a file |
81
+ | `get_ast_node` | 4 | Retrieve code, dependencies, references, and implementations |
82
+
83
+ ## Verification
84
+
85
+ After configuration, verify from the agent host that both MCP servers are visible. Then run one simple query against each server before starting the spec writing pass.
86
+
87
+ ```bash
88
+ ls .gitnexus/meta.json
89
+ ls ~/abcoder-asts/*.json
90
+ ```
@@ -0,0 +1,59 @@
1
+ # Repository Analysis
2
+
3
+ The goal is to discover the project's real architecture before writing rules. Do not start from generic spec templates and fill blanks. Start from the code, then let the spec structure follow.
4
+
5
+ ## Analysis Order
6
+
7
+ 1. Read the existing `.trellis/spec/` tree and note which files are templates, outdated, or already project-specific.
8
+ 2. Inspect package manifests, build scripts, workspace config, and top-level documentation to identify packages and runtime layers.
9
+ 3. Use GitNexus for execution flows, module clusters, dependency hubs, and impact-sensitive areas.
10
+ 4. Use ABCoder or language-native tooling for exact signatures, types, class boundaries, and implementation examples.
11
+ 5. Read representative source and test files directly before turning any finding into a spec rule.
12
+
13
+ ## What To Capture
14
+
15
+ | Area | Questions |
16
+ |------|-----------|
17
+ | Package boundaries | What does each package own? What imports cross boundaries? |
18
+ | Runtime layers | Which code is CLI, backend, frontend, worker, shared library, test-only, or tooling? |
19
+ | Core abstractions | Which types, services, stores, commands, routes, or adapters define the system shape? |
20
+ | Data flow | Where does user input enter, how is it validated, and where does state persist? |
21
+ | Error handling | How are failures represented, logged, surfaced, and tested? |
22
+ | Configuration | Where do defaults, environment config, generated files, and templates live? |
23
+ | Tests | Which test styles are trusted examples for new work? |
24
+
25
+ ## GitNexus Usage
26
+
27
+ Start broad, then inspect specific symbols:
28
+
29
+ ```text
30
+ gitnexus_query({query: "CLI command execution flow"})
31
+ gitnexus_query({query: "template generation and migration"})
32
+ gitnexus_context({name: "SymbolName"})
33
+ gitnexus_cypher({query: "MATCH (n)-[r]->(m) RETURN n.name, type(r), m.name LIMIT 30"})
34
+ ```
35
+
36
+ Use GitNexus results to find important files and flows. Do not quote graph output as the final authority until you have checked the relevant source files.
37
+
38
+ ## ABCoder Usage
39
+
40
+ Use ABCoder when the spec needs exact code shapes:
41
+
42
+ ```text
43
+ list_repos()
44
+ get_repo_structure({repo_name: "package-name"})
45
+ get_file_structure({repo_name: "package-name", file_path: "src/example.ts"})
46
+ get_ast_node({repo_name: "package-name", node_ids: [{mod_path: "...", pkg_path: "...", name: "SymbolName"}]})
47
+ ```
48
+
49
+ ABCoder is most valuable for documenting constructor patterns, function signatures, type contracts, and reference chains.
50
+
51
+ ## Analysis Notes
52
+
53
+ Keep short notes while analyzing. The notes should include:
54
+
55
+ - Package or layer name.
56
+ - Files that define the local pattern.
57
+ - Rules the spec should teach.
58
+ - Anti-patterns found in old code, comments, tests, or migration paths.
59
+ - Spec files that should be created, deleted, renamed, or merged.
@@ -0,0 +1,61 @@
1
+ # Spec Task Planning
2
+
3
+ Use a single agent as the default execution model. The agent may create Trellis tasks for traceability, but the skill should not require a specific platform, CLI, or parallel worker model.
4
+
5
+ ## Decomposition
6
+
7
+ Create spec work units around real ownership boundaries:
8
+
9
+ - One package when a package has its own conventions.
10
+ - One layer when the same package has distinct frontend, backend, CLI, worker, or shared-library rules.
11
+ - One cross-cutting guide when a pattern spans packages and is not owned by one layer.
12
+
13
+ Avoid artificial decomposition. A small library usually needs one focused spec pass, not several tasks.
14
+
15
+ ## Task Shape
16
+
17
+ When a Trellis task is useful, write a concise PRD with these sections:
18
+
19
+ ```markdown
20
+ # Fill <package-or-layer> Trellis Specs
21
+
22
+ ## Goal
23
+ Write project-specific `.trellis/spec/` guidance for <scope>.
24
+
25
+ ## Scope
26
+ - Spec directory:
27
+ - Source directories to inspect:
28
+ - Tests to inspect:
29
+ - Out of scope:
30
+
31
+ ## Architecture Context
32
+ Summarize the concrete findings from repository analysis.
33
+
34
+ ## Files To Create Or Update
35
+ - `.trellis/spec/.../index.md`
36
+ - `.trellis/spec/.../<topic>.md`
37
+
38
+ ## Rules
39
+ - Adapt the spec file set to the real codebase.
40
+ - Use real source examples with file paths.
41
+ - Remove template-only sections that do not apply.
42
+ - Do not modify product source code unless the task explicitly asks for it.
43
+
44
+ ## Acceptance Criteria
45
+ - [ ] Specs contain concrete examples and anti-patterns from the repository.
46
+ - [ ] No placeholder text remains.
47
+ - [ ] Index files match the final spec files.
48
+ - [ ] Claims are backed by source files, tests, or project docs.
49
+ ```
50
+
51
+ ## Optional Helper Agents
52
+
53
+ If the host supports subagents, helpers can inspect independent packages or run verification. They are optional. The main agent still owns integration and final quality.
54
+
55
+ Helper tasks must have clear ownership:
56
+
57
+ - Read-only research tasks may inspect any source needed for the assigned scope.
58
+ - Write tasks should own disjoint spec directories.
59
+ - Verification tasks should check placeholder removal, broken links, and consistency.
60
+
61
+ Do not encode helper-agent names, vendor-specific commands, or platform-specific routing in the skill. Put only the required work and acceptance criteria in the task.
@@ -0,0 +1,70 @@
1
+ # Spec Writing
2
+
3
+ Trellis specs are coding guidance for future agents. They should explain how to work in this repository, not how a generic project might be organized.
4
+
5
+ ## Write From Evidence
6
+
7
+ Each important rule should be backed by one of these:
8
+
9
+ - A source file that demonstrates the preferred pattern.
10
+ - A test file that shows expected behavior.
11
+ - A project document that defines the convention.
12
+ - A repeated pattern across multiple files.
13
+
14
+ Use short snippets only when they make the rule clearer. Prefer linking to the file path and naming the symbol or behavior.
15
+
16
+ ## File Structure
17
+
18
+ Keep the spec tree aligned with the project:
19
+
20
+ - Keep `index.md` as the navigation file for the spec directory.
21
+ - Split topics when developers would look for them independently.
22
+ - Merge topics when separate files would repeat the same rule.
23
+ - Delete template files that do not apply.
24
+ - Add new files for important local patterns the template missed.
25
+
26
+ ## Content Standards
27
+
28
+ Good spec sections include:
29
+
30
+ - When the rule applies.
31
+ - The local pattern to follow.
32
+ - The source or test files that prove the pattern.
33
+ - Common mistakes or anti-patterns.
34
+ - Verification commands or checks when they are specific and reliable.
35
+
36
+ Avoid:
37
+
38
+ - Placeholder prose.
39
+ - Generic framework advice.
40
+ - Tool instructions that only work in one agent host.
41
+ - Long copied code blocks.
42
+ - Rules based on a single accidental implementation detail.
43
+
44
+ ## Example Shape
45
+
46
+ ```markdown
47
+ ## Command Handlers
48
+
49
+ Command handlers should keep argument parsing, validation, and side effects separate. The local pattern is:
50
+
51
+ - Parse CLI flags at the command boundary.
52
+ - Convert raw inputs into typed task options before invoking core logic.
53
+ - Keep filesystem writes in the command or service layer, not in template helpers.
54
+
55
+ Reference files:
56
+ - `packages/cli/src/commands/example.ts`
57
+ - `packages/cli/test/commands/example.test.ts`
58
+
59
+ Avoid passing raw `process.argv` or unvalidated config objects into shared helpers.
60
+ ```
61
+
62
+ ## Final Pass
63
+
64
+ Before finishing:
65
+
66
+ ```bash
67
+ grep -R "To be filled\\|TODO: fill\\|placeholder" .trellis/spec
68
+ ```
69
+
70
+ Also check links, index files, and whether any spec still describes a template rather than this repository.