@fifine/aim-studio 0.0.1

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 (289) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +159 -0
  3. package/bin/aim.js +3 -0
  4. package/dist/cli/index.d.ts +3 -0
  5. package/dist/cli/index.d.ts.map +1 -0
  6. package/dist/cli/index.js +89 -0
  7. package/dist/cli/index.js.map +1 -0
  8. package/dist/commands/init.d.ts +13 -0
  9. package/dist/commands/init.d.ts.map +1 -0
  10. package/dist/commands/init.js +513 -0
  11. package/dist/commands/init.js.map +1 -0
  12. package/dist/commands/update.d.ts +27 -0
  13. package/dist/commands/update.d.ts.map +1 -0
  14. package/dist/commands/update.js +1275 -0
  15. package/dist/commands/update.js.map +1 -0
  16. package/dist/configurators/claude.d.ts +32 -0
  17. package/dist/configurators/claude.d.ts.map +1 -0
  18. package/dist/configurators/claude.js +98 -0
  19. package/dist/configurators/claude.js.map +1 -0
  20. package/dist/configurators/index.d.ts +51 -0
  21. package/dist/configurators/index.d.ts.map +1 -0
  22. package/dist/configurators/index.js +113 -0
  23. package/dist/configurators/index.js.map +1 -0
  24. package/dist/configurators/shared.d.ts +12 -0
  25. package/dist/configurators/shared.d.ts.map +1 -0
  26. package/dist/configurators/shared.js +21 -0
  27. package/dist/configurators/shared.js.map +1 -0
  28. package/dist/configurators/workflow.d.ts +28 -0
  29. package/dist/configurators/workflow.d.ts.map +1 -0
  30. package/dist/configurators/workflow.js +147 -0
  31. package/dist/configurators/workflow.js.map +1 -0
  32. package/dist/constants/paths.d.ts +68 -0
  33. package/dist/constants/paths.d.ts.map +1 -0
  34. package/dist/constants/paths.js +77 -0
  35. package/dist/constants/paths.js.map +1 -0
  36. package/dist/constants/version.d.ts +9 -0
  37. package/dist/constants/version.d.ts.map +1 -0
  38. package/dist/constants/version.js +15 -0
  39. package/dist/constants/version.js.map +1 -0
  40. package/dist/index.d.ts +9 -0
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +9 -0
  43. package/dist/index.js.map +1 -0
  44. package/dist/migrations/index.d.ts +54 -0
  45. package/dist/migrations/index.d.ts.map +1 -0
  46. package/dist/migrations/index.js +160 -0
  47. package/dist/migrations/index.js.map +1 -0
  48. package/dist/migrations/manifests/0.0.1.json +9 -0
  49. package/dist/migrations/manifests/0.1.9.json +30 -0
  50. package/dist/migrations/manifests/0.2.0.json +49 -0
  51. package/dist/migrations/manifests/0.2.12.json +9 -0
  52. package/dist/migrations/manifests/0.2.13.json +9 -0
  53. package/dist/migrations/manifests/0.2.14.json +175 -0
  54. package/dist/migrations/manifests/0.2.15.json +33 -0
  55. package/dist/migrations/manifests/0.3.0-beta.0.json +278 -0
  56. package/dist/migrations/manifests/0.3.0-beta.1.json +9 -0
  57. package/dist/migrations/manifests/0.3.0-beta.10.json +9 -0
  58. package/dist/migrations/manifests/0.3.0-beta.11.json +9 -0
  59. package/dist/migrations/manifests/0.3.0-beta.12.json +9 -0
  60. package/dist/migrations/manifests/0.3.0-beta.13.json +9 -0
  61. package/dist/migrations/manifests/0.3.0-beta.14.json +9 -0
  62. package/dist/migrations/manifests/0.3.0-beta.15.json +9 -0
  63. package/dist/migrations/manifests/0.3.0-beta.16.json +9 -0
  64. package/dist/migrations/manifests/0.3.0-beta.2.json +9 -0
  65. package/dist/migrations/manifests/0.3.0-beta.3.json +9 -0
  66. package/dist/migrations/manifests/0.3.0-beta.4.json +9 -0
  67. package/dist/migrations/manifests/0.3.0-beta.5.json +9 -0
  68. package/dist/migrations/manifests/0.3.0-beta.6.json +9 -0
  69. package/dist/migrations/manifests/0.3.0-beta.7.json +11 -0
  70. package/dist/migrations/manifests/0.3.0-beta.8.json +9 -0
  71. package/dist/migrations/manifests/0.3.0-beta.9.json +9 -0
  72. package/dist/migrations/manifests/0.3.0-rc.0.json +9 -0
  73. package/dist/migrations/manifests/0.3.0-rc.1.json +9 -0
  74. package/dist/migrations/manifests/0.3.0-rc.2.json +9 -0
  75. package/dist/templates/CLAUDE.md +71 -0
  76. package/dist/templates/aim/gitignore.txt +29 -0
  77. package/dist/templates/aim/index.d.ts +49 -0
  78. package/dist/templates/aim/index.d.ts.map +1 -0
  79. package/dist/templates/aim/index.js +92 -0
  80. package/dist/templates/aim/index.js.map +1 -0
  81. package/dist/templates/aim/scripts/__init__.py +5 -0
  82. package/dist/templates/aim/scripts/add_session.py +392 -0
  83. package/dist/templates/aim/scripts/common/__init__.py +80 -0
  84. package/dist/templates/aim/scripts/common/cli_adapter.py +435 -0
  85. package/dist/templates/aim/scripts/common/developer.py +190 -0
  86. package/dist/templates/aim/scripts/common/git_context.py +383 -0
  87. package/dist/templates/aim/scripts/common/paths.py +347 -0
  88. package/dist/templates/aim/scripts/common/phase.py +253 -0
  89. package/dist/templates/aim/scripts/common/registry.py +366 -0
  90. package/dist/templates/aim/scripts/common/task_queue.py +255 -0
  91. package/dist/templates/aim/scripts/common/task_utils.py +178 -0
  92. package/dist/templates/aim/scripts/common/worktree.py +219 -0
  93. package/dist/templates/aim/scripts/create_bootstrap.py +290 -0
  94. package/dist/templates/aim/scripts/get_context.py +16 -0
  95. package/dist/templates/aim/scripts/get_developer.py +26 -0
  96. package/dist/templates/aim/scripts/init_developer.py +51 -0
  97. package/dist/templates/aim/scripts/multi_agent/__init__.py +5 -0
  98. package/dist/templates/aim/scripts/multi_agent/cleanup.py +403 -0
  99. package/dist/templates/aim/scripts/multi_agent/create_pr.py +329 -0
  100. package/dist/templates/aim/scripts/multi_agent/plan.py +233 -0
  101. package/dist/templates/aim/scripts/multi_agent/start.py +461 -0
  102. package/dist/templates/aim/scripts/multi_agent/status.py +817 -0
  103. package/dist/templates/aim/scripts/task.py +1068 -0
  104. package/dist/templates/aim/scripts-shell-archive/add-session.sh +384 -0
  105. package/dist/templates/aim/scripts-shell-archive/common/developer.sh +129 -0
  106. package/dist/templates/aim/scripts-shell-archive/common/git-context.sh +263 -0
  107. package/dist/templates/aim/scripts-shell-archive/common/paths.sh +208 -0
  108. package/dist/templates/aim/scripts-shell-archive/common/phase.sh +150 -0
  109. package/dist/templates/aim/scripts-shell-archive/common/registry.sh +247 -0
  110. package/dist/templates/aim/scripts-shell-archive/common/task-queue.sh +142 -0
  111. package/dist/templates/aim/scripts-shell-archive/common/task-utils.sh +151 -0
  112. package/dist/templates/aim/scripts-shell-archive/common/worktree.sh +128 -0
  113. package/dist/templates/aim/scripts-shell-archive/create-bootstrap.sh +299 -0
  114. package/dist/templates/aim/scripts-shell-archive/get-context.sh +7 -0
  115. package/dist/templates/aim/scripts-shell-archive/get-developer.sh +15 -0
  116. package/dist/templates/aim/scripts-shell-archive/init-developer.sh +34 -0
  117. package/dist/templates/aim/scripts-shell-archive/multi-agent/cleanup.sh +396 -0
  118. package/dist/templates/aim/scripts-shell-archive/multi-agent/create-pr.sh +241 -0
  119. package/dist/templates/aim/scripts-shell-archive/multi-agent/plan.sh +207 -0
  120. package/dist/templates/aim/scripts-shell-archive/multi-agent/start.sh +317 -0
  121. package/dist/templates/aim/scripts-shell-archive/multi-agent/status.sh +828 -0
  122. package/dist/templates/aim/scripts-shell-archive/task.sh +1204 -0
  123. package/dist/templates/aim/tasks/.gitkeep +0 -0
  124. package/dist/templates/aim/workflow.md +258 -0
  125. package/dist/templates/aim/worktree.yaml +47 -0
  126. package/dist/templates/claude/agents/check.md +122 -0
  127. package/dist/templates/claude/agents/debug.md +106 -0
  128. package/dist/templates/claude/agents/dispatch.md +230 -0
  129. package/dist/templates/claude/agents/implement.md +96 -0
  130. package/dist/templates/claude/agents/plan.md +396 -0
  131. package/dist/templates/claude/agents/research.md +120 -0
  132. package/dist/templates/claude/agents/story.md +53 -0
  133. package/dist/templates/claude/commands/aim/before-backend-dev.md +13 -0
  134. package/dist/templates/claude/commands/aim/before-frontend-dev.md +13 -0
  135. package/dist/templates/claude/commands/aim/break-loop.md +153 -0
  136. package/dist/templates/claude/commands/aim/check-backend.md +13 -0
  137. package/dist/templates/claude/commands/aim/check-cross-layer.md +153 -0
  138. package/dist/templates/claude/commands/aim/check-frontend.md +13 -0
  139. package/dist/templates/claude/commands/aim/check-story.md +59 -0
  140. package/dist/templates/claude/commands/aim/create-command.md +154 -0
  141. package/dist/templates/claude/commands/aim/export.md +187 -0
  142. package/dist/templates/claude/commands/aim/finish-work.md +104 -0
  143. package/dist/templates/claude/commands/aim/integrate-skill.md +219 -0
  144. package/dist/templates/claude/commands/aim/onboard.md +358 -0
  145. package/dist/templates/claude/commands/aim/parallel.md +217 -0
  146. package/dist/templates/claude/commands/aim/portrait.md +170 -0
  147. package/dist/templates/claude/commands/aim/record-session.md +92 -0
  148. package/dist/templates/claude/commands/aim/start.md +112 -0
  149. package/dist/templates/claude/commands/aim/story.md +140 -0
  150. package/dist/templates/claude/commands/aim/update-spec.md +285 -0
  151. package/dist/templates/claude/commands/aim/visualize.md +182 -0
  152. package/dist/templates/claude/commands/trellis/before-backend-dev.md +13 -0
  153. package/dist/templates/claude/commands/trellis/before-frontend-dev.md +13 -0
  154. package/dist/templates/claude/commands/trellis/break-loop.md +125 -0
  155. package/dist/templates/claude/commands/trellis/check-backend.md +13 -0
  156. package/dist/templates/claude/commands/trellis/check-cross-layer.md +153 -0
  157. package/dist/templates/claude/commands/trellis/check-frontend.md +13 -0
  158. package/dist/templates/claude/commands/trellis/create-command.md +154 -0
  159. package/dist/templates/claude/commands/trellis/finish-work.md +129 -0
  160. package/dist/templates/claude/commands/trellis/integrate-skill.md +219 -0
  161. package/dist/templates/claude/commands/trellis/onboard.md +358 -0
  162. package/dist/templates/claude/commands/trellis/parallel.md +193 -0
  163. package/dist/templates/claude/commands/trellis/record-session.md +62 -0
  164. package/dist/templates/claude/commands/trellis/start.md +280 -0
  165. package/dist/templates/claude/commands/trellis/update-spec.md +285 -0
  166. package/dist/templates/claude/hooks/inject-subagent-context.py +772 -0
  167. package/dist/templates/claude/hooks/ralph-loop.py +388 -0
  168. package/dist/templates/claude/hooks/session-start.py +142 -0
  169. package/dist/templates/claude/index.d.ts +54 -0
  170. package/dist/templates/claude/index.d.ts.map +1 -0
  171. package/dist/templates/claude/index.js +85 -0
  172. package/dist/templates/claude/index.js.map +1 -0
  173. package/dist/templates/claude/settings.json +41 -0
  174. package/dist/templates/extract.d.ts +68 -0
  175. package/dist/templates/extract.d.ts.map +1 -0
  176. package/dist/templates/extract.js +128 -0
  177. package/dist/templates/extract.js.map +1 -0
  178. package/dist/templates/markdown/agents.md +25 -0
  179. package/dist/templates/markdown/gitignore.txt +12 -0
  180. package/dist/templates/markdown/index.d.ts +32 -0
  181. package/dist/templates/markdown/index.d.ts.map +1 -0
  182. package/dist/templates/markdown/index.js +58 -0
  183. package/dist/templates/markdown/index.js.map +1 -0
  184. package/dist/templates/markdown/spec/backend/database-guidelines.md.txt +51 -0
  185. package/dist/templates/markdown/spec/backend/directory-structure.md.txt +54 -0
  186. package/dist/templates/markdown/spec/backend/error-handling.md.txt +51 -0
  187. package/dist/templates/markdown/spec/backend/index.md +40 -0
  188. package/dist/templates/markdown/spec/backend/index.md.txt +38 -0
  189. package/dist/templates/markdown/spec/backend/logging-guidelines.md.txt +51 -0
  190. package/dist/templates/markdown/spec/backend/quality-guidelines.md.txt +51 -0
  191. package/dist/templates/markdown/spec/backend/script-conventions.md +467 -0
  192. package/dist/templates/markdown/spec/frontend/component-guidelines.md.txt +59 -0
  193. package/dist/templates/markdown/spec/frontend/directory-structure.md.txt +54 -0
  194. package/dist/templates/markdown/spec/frontend/hook-guidelines.md.txt +51 -0
  195. package/dist/templates/markdown/spec/frontend/index.md.txt +39 -0
  196. package/dist/templates/markdown/spec/frontend/quality-guidelines.md.txt +51 -0
  197. package/dist/templates/markdown/spec/frontend/state-management.md.txt +51 -0
  198. package/dist/templates/markdown/spec/frontend/type-safety.md.txt +51 -0
  199. package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md +118 -0
  200. package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +92 -0
  201. package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +94 -0
  202. package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md +394 -0
  203. package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +319 -0
  204. package/dist/templates/markdown/spec/guides/index.md.txt +89 -0
  205. package/dist/templates/markdown/spec/story/character.md.txt +95 -0
  206. package/dist/templates/markdown/spec/story/index.md.txt +31 -0
  207. package/dist/templates/markdown/spec/story/script.md.txt +313 -0
  208. package/dist/templates/markdown/spec/story/world.md.txt +92 -0
  209. package/dist/templates/markdown/workspace-index.md +123 -0
  210. package/dist/templates/markdown/worktree.yaml.txt +58 -0
  211. package/dist/templates/trellis/gitignore.txt +29 -0
  212. package/dist/templates/trellis/index.d.ts +49 -0
  213. package/dist/templates/trellis/index.d.ts.map +1 -0
  214. package/dist/templates/trellis/index.js +92 -0
  215. package/dist/templates/trellis/index.js.map +1 -0
  216. package/dist/templates/trellis/scripts/__init__.py +5 -0
  217. package/dist/templates/trellis/scripts/add_session.py +392 -0
  218. package/dist/templates/trellis/scripts/common/__init__.py +80 -0
  219. package/dist/templates/trellis/scripts/common/cli_adapter.py +435 -0
  220. package/dist/templates/trellis/scripts/common/developer.py +190 -0
  221. package/dist/templates/trellis/scripts/common/git_context.py +383 -0
  222. package/dist/templates/trellis/scripts/common/paths.py +347 -0
  223. package/dist/templates/trellis/scripts/common/phase.py +253 -0
  224. package/dist/templates/trellis/scripts/common/registry.py +366 -0
  225. package/dist/templates/trellis/scripts/common/task_queue.py +255 -0
  226. package/dist/templates/trellis/scripts/common/task_utils.py +178 -0
  227. package/dist/templates/trellis/scripts/common/worktree.py +219 -0
  228. package/dist/templates/trellis/scripts/create_bootstrap.py +290 -0
  229. package/dist/templates/trellis/scripts/get_context.py +16 -0
  230. package/dist/templates/trellis/scripts/get_developer.py +26 -0
  231. package/dist/templates/trellis/scripts/init_developer.py +51 -0
  232. package/dist/templates/trellis/scripts/multi_agent/__init__.py +5 -0
  233. package/dist/templates/trellis/scripts/multi_agent/cleanup.py +403 -0
  234. package/dist/templates/trellis/scripts/multi_agent/create_pr.py +329 -0
  235. package/dist/templates/trellis/scripts/multi_agent/plan.py +233 -0
  236. package/dist/templates/trellis/scripts/multi_agent/start.py +461 -0
  237. package/dist/templates/trellis/scripts/multi_agent/status.py +817 -0
  238. package/dist/templates/trellis/scripts/task.py +1056 -0
  239. package/dist/templates/trellis/scripts-shell-archive/add-session.sh +384 -0
  240. package/dist/templates/trellis/scripts-shell-archive/common/developer.sh +129 -0
  241. package/dist/templates/trellis/scripts-shell-archive/common/git-context.sh +263 -0
  242. package/dist/templates/trellis/scripts-shell-archive/common/paths.sh +208 -0
  243. package/dist/templates/trellis/scripts-shell-archive/common/phase.sh +150 -0
  244. package/dist/templates/trellis/scripts-shell-archive/common/registry.sh +247 -0
  245. package/dist/templates/trellis/scripts-shell-archive/common/task-queue.sh +142 -0
  246. package/dist/templates/trellis/scripts-shell-archive/common/task-utils.sh +151 -0
  247. package/dist/templates/trellis/scripts-shell-archive/common/worktree.sh +128 -0
  248. package/dist/templates/trellis/scripts-shell-archive/create-bootstrap.sh +299 -0
  249. package/dist/templates/trellis/scripts-shell-archive/get-context.sh +7 -0
  250. package/dist/templates/trellis/scripts-shell-archive/get-developer.sh +15 -0
  251. package/dist/templates/trellis/scripts-shell-archive/init-developer.sh +34 -0
  252. package/dist/templates/trellis/scripts-shell-archive/multi-agent/cleanup.sh +396 -0
  253. package/dist/templates/trellis/scripts-shell-archive/multi-agent/create-pr.sh +241 -0
  254. package/dist/templates/trellis/scripts-shell-archive/multi-agent/plan.sh +207 -0
  255. package/dist/templates/trellis/scripts-shell-archive/multi-agent/start.sh +317 -0
  256. package/dist/templates/trellis/scripts-shell-archive/multi-agent/status.sh +828 -0
  257. package/dist/templates/trellis/scripts-shell-archive/task.sh +1204 -0
  258. package/dist/templates/trellis/tasks/.gitkeep +0 -0
  259. package/dist/templates/trellis/workflow.md +416 -0
  260. package/dist/templates/trellis/worktree.yaml +47 -0
  261. package/dist/types/ai-tools.d.ts +48 -0
  262. package/dist/types/ai-tools.d.ts.map +1 -0
  263. package/dist/types/ai-tools.js +32 -0
  264. package/dist/types/ai-tools.js.map +1 -0
  265. package/dist/types/migration.d.ts +86 -0
  266. package/dist/types/migration.d.ts.map +1 -0
  267. package/dist/types/migration.js +8 -0
  268. package/dist/types/migration.js.map +1 -0
  269. package/dist/utils/compare-versions.d.ts +12 -0
  270. package/dist/utils/compare-versions.d.ts.map +1 -0
  271. package/dist/utils/compare-versions.js +76 -0
  272. package/dist/utils/compare-versions.js.map +1 -0
  273. package/dist/utils/file-writer.d.ts +23 -0
  274. package/dist/utils/file-writer.d.ts.map +1 -0
  275. package/dist/utils/file-writer.js +140 -0
  276. package/dist/utils/file-writer.js.map +1 -0
  277. package/dist/utils/project-detector.d.ts +16 -0
  278. package/dist/utils/project-detector.d.ts.map +1 -0
  279. package/dist/utils/project-detector.js +188 -0
  280. package/dist/utils/project-detector.js.map +1 -0
  281. package/dist/utils/template-fetcher.d.ts +51 -0
  282. package/dist/utils/template-fetcher.d.ts.map +1 -0
  283. package/dist/utils/template-fetcher.js +174 -0
  284. package/dist/utils/template-fetcher.js.map +1 -0
  285. package/dist/utils/template-hash.d.ts +78 -0
  286. package/dist/utils/template-hash.d.ts.map +1 -0
  287. package/dist/utils/template-hash.js +239 -0
  288. package/dist/utils/template-hash.js.map +1 -0
  289. package/package.json +87 -0
@@ -0,0 +1,280 @@
1
+ # Start Session
2
+
3
+ Initialize your AI development session and begin working on tasks.
4
+
5
+ ---
6
+
7
+ ## Operation Types
8
+
9
+ | Marker | Meaning | Executor |
10
+ |--------|---------|----------|
11
+ | `[AI]` | Bash scripts or Task calls executed by AI | You (AI) |
12
+ | `[USER]` | Slash commands executed by user | User |
13
+
14
+ ---
15
+
16
+ ## Initialization `[AI]`
17
+
18
+ ### Step 1: Understand Development Workflow
19
+
20
+ First, read the workflow guide to understand the development process:
21
+
22
+ ```bash
23
+ cat .trellis/workflow.md
24
+ ```
25
+
26
+ **Follow the instructions in workflow.md** - it contains:
27
+ - Core principles (Read Before Write, Follow Standards, etc.)
28
+ - File system structure
29
+ - Development process
30
+ - Best practices
31
+
32
+ ### Step 2: Get Current Context
33
+
34
+ ```bash
35
+ python3 ./.trellis/scripts/get_context.py
36
+ ```
37
+
38
+ This shows: developer identity, git status, current task (if any), active tasks.
39
+
40
+ ### Step 3: Read Guidelines Index
41
+
42
+ ```bash
43
+ cat .trellis/spec/frontend/index.md # Frontend guidelines
44
+ cat .trellis/spec/backend/index.md # Backend guidelines
45
+ cat .trellis/spec/guides/index.md # Thinking guides
46
+ ```
47
+
48
+ ### Step 4: Report and Ask
49
+
50
+ Report what you learned and ask: "What would you like to work on?"
51
+
52
+ ---
53
+
54
+ ## Task Classification
55
+
56
+ When user describes a task, classify it:
57
+
58
+ | Type | Criteria | Workflow |
59
+ |------|----------|----------|
60
+ | **Question** | User asks about code, architecture, or how something works | Answer directly |
61
+ | **Trivial Fix** | Typo fix, comment update, single-line change, < 5 minutes | Direct Edit |
62
+ | **Development Task** | Any code change that: modifies logic, adds features, fixes bugs, touches multiple files | **Task Workflow** |
63
+
64
+ ### Decision Rule
65
+
66
+ > **If in doubt, use Task Workflow.**
67
+ >
68
+ > Task Workflow ensures specs are injected to agents, resulting in higher quality code.
69
+ > The overhead is minimal, but the benefit is significant.
70
+
71
+ ---
72
+
73
+ ## Question / Trivial Fix
74
+
75
+ For questions or trivial fixes, work directly:
76
+
77
+ 1. Answer question or make the fix
78
+ 2. If code was changed, remind user to run `/trellis:finish-work`
79
+
80
+ ---
81
+
82
+ ## Task Workflow (Development Tasks)
83
+
84
+ **Why this workflow?**
85
+ - Research Agent analyzes what specs are needed
86
+ - Specs are configured in jsonl files
87
+ - Implement Agent receives specs via Hook injection
88
+ - Check Agent verifies against specs
89
+ - Result: Code that follows project conventions automatically
90
+
91
+ ### Step 1: Understand the Task `[AI]`
92
+
93
+ Before creating anything, understand what user wants:
94
+ - What is the goal?
95
+ - What type of development? (frontend / backend / fullstack)
96
+ - Any specific requirements or constraints?
97
+
98
+ If unclear, ask clarifying questions.
99
+
100
+ ### Step 2: Research the Codebase `[AI]`
101
+
102
+ Call Research Agent to analyze:
103
+
104
+ ```
105
+ Task(
106
+ subagent_type: "research",
107
+ prompt: "Analyze the codebase for this task:
108
+
109
+ Task: <user's task description>
110
+ Type: <frontend/backend/fullstack>
111
+
112
+ Please find:
113
+ 1. Relevant spec files in .trellis/spec/
114
+ 2. Existing code patterns to follow (find 2-3 examples)
115
+ 3. Files that will likely need modification
116
+
117
+ Output:
118
+ ## Relevant Specs
119
+ - <path>: <why it's relevant>
120
+
121
+ ## Code Patterns Found
122
+ - <pattern>: <example file path>
123
+
124
+ ## Files to Modify
125
+ - <path>: <what change>
126
+
127
+ ## Suggested Task Name
128
+ - <short-slug-name>",
129
+ model: "opus"
130
+ )
131
+ ```
132
+
133
+ ### Step 3: Create Task Directory `[AI]`
134
+
135
+ Based on research results:
136
+
137
+ ```bash
138
+ TASK_DIR=$(python3 ./.trellis/scripts/task.py create "<title from research>" --slug <suggested-slug>)
139
+ ```
140
+
141
+ ### Step 4: Configure Context `[AI]`
142
+
143
+ Initialize default context:
144
+
145
+ ```bash
146
+ python3 ./.trellis/scripts/task.py init-context "$TASK_DIR" <type>
147
+ # type: backend | frontend | fullstack
148
+ ```
149
+
150
+ Add specs found by Research Agent:
151
+
152
+ ```bash
153
+ # For each relevant spec and code pattern:
154
+ python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" implement "<path>" "<reason>"
155
+ python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" check "<path>" "<reason>"
156
+ ```
157
+
158
+ ### Step 5: Write Requirements `[AI]`
159
+
160
+ Create `prd.md` in the task directory with:
161
+
162
+ ```markdown
163
+ # <Task Title>
164
+
165
+ ## Goal
166
+ <What we're trying to achieve>
167
+
168
+ ## Requirements
169
+ - <Requirement 1>
170
+ - <Requirement 2>
171
+
172
+ ## Acceptance Criteria
173
+ - [ ] <Criterion 1>
174
+ - [ ] <Criterion 2>
175
+
176
+ ## Technical Notes
177
+ <Any technical decisions or constraints>
178
+ ```
179
+
180
+ ### Step 6: Activate Task `[AI]`
181
+
182
+ ```bash
183
+ python3 ./.trellis/scripts/task.py start "$TASK_DIR"
184
+ ```
185
+
186
+ This sets `.current-task` so hooks can inject context.
187
+
188
+ ### Step 7: Implement `[AI]`
189
+
190
+ Call Implement Agent (specs are auto-injected by hook):
191
+
192
+ ```
193
+ Task(
194
+ subagent_type: "implement",
195
+ prompt: "Implement the task described in prd.md.
196
+
197
+ Follow all specs that have been injected into your context.
198
+ Run lint and typecheck before finishing.",
199
+ model: "opus"
200
+ )
201
+ ```
202
+
203
+ ### Step 8: Check Quality `[AI]`
204
+
205
+ Call Check Agent (specs are auto-injected by hook):
206
+
207
+ ```
208
+ Task(
209
+ subagent_type: "check",
210
+ prompt: "Review all code changes against the specs.
211
+
212
+ Fix any issues you find directly.
213
+ Ensure lint and typecheck pass.",
214
+ model: "opus"
215
+ )
216
+ ```
217
+
218
+ ### Step 9: Complete `[AI]`
219
+
220
+ 1. Verify lint and typecheck pass
221
+ 2. Report what was implemented
222
+ 3. Remind user to:
223
+ - Test the changes
224
+ - Commit when ready
225
+ - Run `/trellis:record-session` to record this session
226
+
227
+ ---
228
+
229
+ ## Continuing Existing Task
230
+
231
+ If `get_context.py` shows a current task:
232
+
233
+ 1. Read the task's `prd.md` to understand the goal
234
+ 2. Check `task.json` for current status and phase
235
+ 3. Ask user: "Continue working on <task-name>?"
236
+
237
+ If yes, resume from the appropriate step (usually Step 7 or 8).
238
+
239
+ ---
240
+
241
+ ## Commands Reference
242
+
243
+ ### User Commands `[USER]`
244
+
245
+ | Command | When to Use |
246
+ |---------|-------------|
247
+ | `/trellis:start` | Begin a session (this command) |
248
+ | `/trellis:parallel` | Complex tasks needing isolated worktree |
249
+ | `/trellis:finish-work` | Before committing changes |
250
+ | `/trellis:record-session` | After completing a task |
251
+
252
+ ### AI Scripts `[AI]`
253
+
254
+ | Script | Purpose |
255
+ |--------|---------|
256
+ | `python3 ./.trellis/scripts/get_context.py` | Get session context |
257
+ | `python3 ./.trellis/scripts/task.py create` | Create task directory |
258
+ | `python3 ./.trellis/scripts/task.py init-context` | Initialize jsonl files |
259
+ | `python3 ./.trellis/scripts/task.py add-context` | Add spec to jsonl |
260
+ | `python3 ./.trellis/scripts/task.py start` | Set current task |
261
+ | `python3 ./.trellis/scripts/task.py finish` | Clear current task |
262
+ | `python3 ./.trellis/scripts/task.py archive` | Archive completed task |
263
+
264
+ ### Sub Agents `[AI]`
265
+
266
+ | Agent | Purpose | Hook Injection |
267
+ |-------|---------|----------------|
268
+ | research | Analyze codebase | No (reads directly) |
269
+ | implement | Write code | Yes (implement.jsonl) |
270
+ | check | Review & fix | Yes (check.jsonl) |
271
+ | debug | Fix specific issues | Yes (debug.jsonl) |
272
+
273
+ ---
274
+
275
+ ## Key Principle
276
+
277
+ > **Specs are injected, not remembered.**
278
+ >
279
+ > The Task Workflow ensures agents receive relevant specs automatically.
280
+ > This is more reliable than hoping the AI "remembers" conventions.
@@ -0,0 +1,285 @@
1
+ # Update Spec - Capture Knowledge into Specifications
2
+
3
+ When you learn something valuable (from debugging, implementing, or discussion), use this command to update the relevant spec documents.
4
+
5
+ **Timing**: After completing a task, fixing a bug, or discovering a new pattern
6
+
7
+ ---
8
+
9
+ ## When to Update Specs
10
+
11
+ | Trigger | Example | Target Spec |
12
+ |---------|---------|-------------|
13
+ | **Implemented a feature** | Added template download with giget | Relevant `backend/` or `frontend/` file |
14
+ | **Made a design decision** | Used type field + mapping table for extensibility | Relevant spec + "Design Decisions" section |
15
+ | **Fixed a bug** | Found a subtle issue with error handling | `backend/error-handling.md` |
16
+ | **Discovered a pattern** | Found a better way to structure code | Relevant `backend/` or `frontend/` file |
17
+ | **Hit a gotcha** | Learned that X must be done before Y | Relevant spec + "Common Mistakes" section |
18
+ | **Established a convention** | Team agreed on naming pattern | `quality-guidelines.md` |
19
+ | **New thinking trigger** | "Don't forget to check X before doing Y" | `guides/*.md` (as a checklist item, not detailed rules) |
20
+
21
+ **Key Insight**: Spec updates are NOT just for problems. Every feature implementation contains design decisions and project conventions that future AI/developers need to know.
22
+
23
+ ---
24
+
25
+ ## Spec Structure Overview
26
+
27
+ ```
28
+ .trellis/spec/
29
+ ├── backend/ # Backend coding standards
30
+ │ ├── index.md # Overview and links
31
+ │ └── *.md # Topic-specific guidelines
32
+ ├── frontend/ # Frontend coding standards
33
+ │ ├── index.md # Overview and links
34
+ │ └── *.md # Topic-specific guidelines
35
+ └── guides/ # Thinking checklists (NOT coding specs!)
36
+ ├── index.md # Guide index
37
+ └── *.md # Topic-specific guides
38
+ ```
39
+
40
+ ### CRITICAL: Spec vs Guide - Know the Difference
41
+
42
+ | Type | Location | Purpose | Content Style |
43
+ |------|----------|---------|---------------|
44
+ | **Spec** | `backend/*.md`, `frontend/*.md` | Tell AI "how to write code" | Detailed rules, code examples, forbidden patterns |
45
+ | **Guide** | `guides/*.md` | Help AI "what to think about" | Checklists, questions, pointers to specs |
46
+
47
+ **Decision Rule**: Ask yourself:
48
+
49
+ - "This is **how to write** the code" → Put in `backend/` or `frontend/`
50
+ - "This is **what to consider** before writing" → Put in `guides/`
51
+
52
+ **Example**:
53
+
54
+ | Learning | Wrong Location | Correct Location |
55
+ |----------|----------------|------------------|
56
+ | "Use `reconfigure()` not `TextIOWrapper` for Windows stdout" | ❌ `guides/cross-platform-thinking-guide.md` | ✅ `backend/script-conventions.md` |
57
+ | "Remember to check encoding when writing cross-platform code" | ❌ `backend/script-conventions.md` | ✅ `guides/cross-platform-thinking-guide.md` |
58
+
59
+ **Guides should be short checklists that point to specs**, not duplicate the detailed rules.
60
+
61
+ ---
62
+
63
+ ## Update Process
64
+
65
+ ### Step 1: Identify What You Learned
66
+
67
+ Answer these questions:
68
+
69
+ 1. **What did you learn?** (Be specific)
70
+ 2. **Why is it important?** (What problem does it prevent?)
71
+ 3. **Where does it belong?** (Which spec file?)
72
+
73
+ ### Step 2: Classify the Update Type
74
+
75
+ | Type | Description | Action |
76
+ |------|-------------|--------|
77
+ | **Design Decision** | Why we chose approach X over Y | Add to "Design Decisions" section |
78
+ | **Project Convention** | How we do X in this project | Add to relevant section with examples |
79
+ | **New Pattern** | A reusable approach discovered | Add to "Patterns" section |
80
+ | **Forbidden Pattern** | Something that causes problems | Add to "Anti-patterns" or "Don't" section |
81
+ | **Common Mistake** | Easy-to-make error | Add to "Common Mistakes" section |
82
+ | **Convention** | Agreed-upon standard | Add to relevant section |
83
+ | **Gotcha** | Non-obvious behavior | Add warning callout |
84
+
85
+ ### Step 3: Read the Target Spec
86
+
87
+ Before editing, read the current spec to:
88
+ - Understand existing structure
89
+ - Avoid duplicating content
90
+ - Find the right section for your update
91
+
92
+ ```bash
93
+ cat .trellis/spec/<category>/<file>.md
94
+ ```
95
+
96
+ ### Step 4: Make the Update
97
+
98
+ Follow these principles:
99
+
100
+ 1. **Be Specific**: Include concrete examples, not just abstract rules
101
+ 2. **Explain Why**: State the problem this prevents
102
+ 3. **Show Code**: Add code snippets for patterns
103
+ 4. **Keep it Short**: One concept per section
104
+
105
+ ### Step 5: Update the Index (if needed)
106
+
107
+ If you added a new section or the spec status changed, update the category's `index.md`.
108
+
109
+ ---
110
+
111
+ ## Update Templates
112
+
113
+ ### Adding a Design Decision
114
+
115
+ ```markdown
116
+ ### Design Decision: [Decision Name]
117
+
118
+ **Context**: What problem were we solving?
119
+
120
+ **Options Considered**:
121
+ 1. Option A - brief description
122
+ 2. Option B - brief description
123
+
124
+ **Decision**: We chose Option X because...
125
+
126
+ **Example**:
127
+ \`\`\`typescript
128
+ // How it's implemented
129
+ code example
130
+ \`\`\`
131
+
132
+ **Extensibility**: How to extend this in the future...
133
+ ```
134
+
135
+ ### Adding a Project Convention
136
+
137
+ ```markdown
138
+ ### Convention: [Convention Name]
139
+
140
+ **What**: Brief description of the convention.
141
+
142
+ **Why**: Why we do it this way in this project.
143
+
144
+ **Example**:
145
+ \`\`\`typescript
146
+ // How to follow this convention
147
+ code example
148
+ \`\`\`
149
+
150
+ **Related**: Links to related conventions or specs.
151
+ ```
152
+
153
+ ### Adding a New Pattern
154
+
155
+ ```markdown
156
+ ### Pattern Name
157
+
158
+ **Problem**: What problem does this solve?
159
+
160
+ **Solution**: Brief description of the approach.
161
+
162
+ **Example**:
163
+ \`\`\`
164
+ // Good
165
+ code example
166
+
167
+ // Bad
168
+ code example
169
+ \`\`\`
170
+
171
+ **Why**: Explanation of why this works better.
172
+ ```
173
+
174
+ ### Adding a Forbidden Pattern
175
+
176
+ ```markdown
177
+ ### Don't: Pattern Name
178
+
179
+ **Problem**:
180
+ \`\`\`
181
+ // Don't do this
182
+ bad code example
183
+ \`\`\`
184
+
185
+ **Why it's bad**: Explanation of the issue.
186
+
187
+ **Instead**:
188
+ \`\`\`
189
+ // Do this instead
190
+ good code example
191
+ \`\`\`
192
+ ```
193
+
194
+ ### Adding a Common Mistake
195
+
196
+ ```markdown
197
+ ### Common Mistake: Description
198
+
199
+ **Symptom**: What goes wrong
200
+
201
+ **Cause**: Why this happens
202
+
203
+ **Fix**: How to correct it
204
+
205
+ **Prevention**: How to avoid it in the future
206
+ ```
207
+
208
+ ### Adding a Gotcha
209
+
210
+ ```markdown
211
+ > **Warning**: Brief description of the non-obvious behavior.
212
+ >
213
+ > Details about when this happens and how to handle it.
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Interactive Mode
219
+
220
+ If you're unsure what to update, answer these prompts:
221
+
222
+ 1. **What did you just finish?**
223
+ - [ ] Fixed a bug
224
+ - [ ] Implemented a feature
225
+ - [ ] Refactored code
226
+ - [ ] Had a discussion about approach
227
+
228
+ 2. **What did you learn or decide?**
229
+ - Design decision (why X over Y)
230
+ - Project convention (how we do X)
231
+ - Non-obvious behavior (gotcha)
232
+ - Better approach (pattern)
233
+
234
+ 3. **Would future AI/developers need to know this?**
235
+ - To understand how the code works → Yes, update spec
236
+ - To maintain or extend the feature → Yes, update spec
237
+ - To avoid repeating mistakes → Yes, update spec
238
+ - Purely one-off implementation detail → Maybe skip
239
+
240
+ 4. **Which area does it relate to?**
241
+ - [ ] Backend code
242
+ - [ ] Frontend code
243
+ - [ ] Cross-layer data flow
244
+ - [ ] Code organization/reuse
245
+ - [ ] Quality/testing
246
+
247
+ ---
248
+
249
+ ## Quality Checklist
250
+
251
+ Before finishing your spec update:
252
+
253
+ - [ ] Is the content specific and actionable?
254
+ - [ ] Did you include a code example?
255
+ - [ ] Did you explain WHY, not just WHAT?
256
+ - [ ] Is it in the right spec file?
257
+ - [ ] Does it duplicate existing content?
258
+ - [ ] Would a new team member understand it?
259
+
260
+ ---
261
+
262
+ ## Relationship to Other Commands
263
+
264
+ ```
265
+ Development Flow:
266
+ Learn something → /trellis:update-spec → Knowledge captured
267
+ ↑ ↓
268
+ /trellis:break-loop ←──────────────────── Future sessions benefit
269
+ (deep bug analysis)
270
+ ```
271
+
272
+ - `/trellis:break-loop` - Analyzes bugs deeply, often reveals spec updates needed
273
+ - `/trellis:update-spec` - Actually makes the updates (this command)
274
+ - `/trellis:finish-work` - Reminds you to check if specs need updates
275
+
276
+ ---
277
+
278
+ ## Core Philosophy
279
+
280
+ > **Specs are living documents. Every debugging session, every "aha moment" is an opportunity to make the spec better.**
281
+
282
+ The goal is **institutional memory**:
283
+ - What one person learns, everyone benefits from
284
+ - What AI learns in one session, persists to future sessions
285
+ - Mistakes become documented guardrails