@mindfoldhq/trellis 0.5.0-beta.8 → 0.5.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 (210) hide show
  1. package/README.md +60 -95
  2. package/dist/cli/index.js +7 -0
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/commands/init.d.ts +13 -0
  5. package/dist/commands/init.d.ts.map +1 -1
  6. package/dist/commands/init.js +474 -210
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/update.d.ts.map +1 -1
  9. package/dist/commands/update.js +295 -54
  10. package/dist/commands/update.js.map +1 -1
  11. package/dist/configurators/antigravity.d.ts.map +1 -1
  12. package/dist/configurators/antigravity.js +2 -8
  13. package/dist/configurators/antigravity.js.map +1 -1
  14. package/dist/configurators/claude.d.ts.map +1 -1
  15. package/dist/configurators/claude.js +4 -10
  16. package/dist/configurators/claude.js.map +1 -1
  17. package/dist/configurators/codebuddy.d.ts.map +1 -1
  18. package/dist/configurators/codebuddy.js +3 -3
  19. package/dist/configurators/codebuddy.js.map +1 -1
  20. package/dist/configurators/codex.d.ts.map +1 -1
  21. package/dist/configurators/codex.js +5 -13
  22. package/dist/configurators/codex.js.map +1 -1
  23. package/dist/configurators/copilot.d.ts.map +1 -1
  24. package/dist/configurators/copilot.js +5 -19
  25. package/dist/configurators/copilot.js.map +1 -1
  26. package/dist/configurators/cursor.d.ts.map +1 -1
  27. package/dist/configurators/cursor.js +3 -3
  28. package/dist/configurators/cursor.js.map +1 -1
  29. package/dist/configurators/droid.d.ts.map +1 -1
  30. package/dist/configurators/droid.js +3 -3
  31. package/dist/configurators/droid.js.map +1 -1
  32. package/dist/configurators/gemini.d.ts.map +1 -1
  33. package/dist/configurators/gemini.js +3 -5
  34. package/dist/configurators/gemini.js.map +1 -1
  35. package/dist/configurators/index.d.ts.map +1 -1
  36. package/dist/configurators/index.js +44 -55
  37. package/dist/configurators/index.js.map +1 -1
  38. package/dist/configurators/kilo.d.ts.map +1 -1
  39. package/dist/configurators/kilo.js +2 -8
  40. package/dist/configurators/kilo.js.map +1 -1
  41. package/dist/configurators/kiro.d.ts.map +1 -1
  42. package/dist/configurators/kiro.js +3 -3
  43. package/dist/configurators/kiro.js.map +1 -1
  44. package/dist/configurators/opencode.d.ts.map +1 -1
  45. package/dist/configurators/opencode.js +7 -4
  46. package/dist/configurators/opencode.js.map +1 -1
  47. package/dist/configurators/pi.d.ts +3 -0
  48. package/dist/configurators/pi.d.ts.map +1 -0
  49. package/dist/configurators/pi.js +44 -0
  50. package/dist/configurators/pi.js.map +1 -0
  51. package/dist/configurators/qoder.d.ts +7 -6
  52. package/dist/configurators/qoder.d.ts.map +1 -1
  53. package/dist/configurators/qoder.js +18 -12
  54. package/dist/configurators/qoder.js.map +1 -1
  55. package/dist/configurators/shared.d.ts +30 -6
  56. package/dist/configurators/shared.d.ts.map +1 -1
  57. package/dist/configurators/shared.js +65 -15
  58. package/dist/configurators/shared.js.map +1 -1
  59. package/dist/configurators/windsurf.d.ts.map +1 -1
  60. package/dist/configurators/windsurf.js +2 -8
  61. package/dist/configurators/windsurf.js.map +1 -1
  62. package/dist/constants/paths.d.ts +2 -0
  63. package/dist/constants/paths.d.ts.map +1 -1
  64. package/dist/constants/paths.js +2 -0
  65. package/dist/constants/paths.js.map +1 -1
  66. package/dist/migrations/manifests/0.5.0-beta.0.json +2 -0
  67. package/dist/migrations/manifests/0.5.0-beta.10.json +9 -0
  68. package/dist/migrations/manifests/0.5.0-beta.11.json +9 -0
  69. package/dist/migrations/manifests/0.5.0-beta.12.json +9 -0
  70. package/dist/migrations/manifests/0.5.0-beta.13.json +9 -0
  71. package/dist/migrations/manifests/0.5.0-beta.14.json +9 -0
  72. package/dist/migrations/manifests/0.5.0-beta.15.json +116 -0
  73. package/dist/migrations/manifests/0.5.0-beta.16.json +9 -0
  74. package/dist/migrations/manifests/0.5.0-beta.17.json +9 -0
  75. package/dist/migrations/manifests/0.5.0-beta.18.json +9 -0
  76. package/dist/migrations/manifests/0.5.0-beta.19.json +9 -0
  77. package/dist/migrations/manifests/0.5.0-beta.5.json +2 -0
  78. package/dist/migrations/manifests/0.5.0-beta.9.json +48 -0
  79. package/dist/migrations/manifests/0.5.0-rc.0.json +9 -0
  80. package/dist/templates/claude/agents/trellis-research.md +1 -1
  81. package/dist/templates/claude/settings.json +0 -4
  82. package/dist/templates/codebuddy/agents/trellis-research.md +1 -1
  83. package/dist/templates/codex/agents/trellis-research.toml +3 -2
  84. package/dist/templates/codex/hooks/session-start.py +126 -26
  85. package/dist/templates/codex/skills/finish-work/SKILL.md +41 -109
  86. package/dist/templates/codex/skills/start/SKILL.md +12 -9
  87. package/dist/templates/common/bundled-skills/trellis-meta/SKILL.md +73 -0
  88. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/add-project-local-conventions.md +83 -0
  89. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-agents.md +54 -0
  90. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-context-loading.md +81 -0
  91. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-hooks.md +57 -0
  92. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-skills-or-commands.md +78 -0
  93. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-spec-structure.md +83 -0
  94. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-task-lifecycle.md +90 -0
  95. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-workflow.md +64 -0
  96. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/overview.md +55 -0
  97. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/context-injection.md +68 -0
  98. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/generated-files.md +80 -0
  99. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/overview.md +51 -0
  100. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/spec-system.md +102 -0
  101. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +101 -0
  102. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workflow.md +75 -0
  103. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workspace-memory.md +71 -0
  104. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +79 -0
  105. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/hooks-and-settings.md +69 -0
  106. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/overview.md +59 -0
  107. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/platform-map.md +74 -0
  108. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/skills-and-commands.md +83 -0
  109. package/dist/templates/common/commands/continue.md +9 -5
  110. package/dist/templates/common/commands/finish-work.md +34 -10
  111. package/dist/templates/common/index.d.ts +22 -2
  112. package/dist/templates/common/index.d.ts.map +1 -1
  113. package/dist/templates/common/index.js +53 -4
  114. package/dist/templates/common/index.js.map +1 -1
  115. package/dist/templates/common/skills/brainstorm.md +50 -4
  116. package/dist/templates/copilot/hooks/session-start.py +127 -30
  117. package/dist/templates/copilot/prompts/finish-work.prompt.md +44 -112
  118. package/dist/templates/copilot/prompts/start.prompt.md +12 -9
  119. package/dist/templates/cursor/agents/trellis-check.md +1 -1
  120. package/dist/templates/cursor/agents/trellis-implement.md +1 -1
  121. package/dist/templates/cursor/agents/trellis-research.md +2 -2
  122. package/dist/templates/cursor/hooks.json +7 -1
  123. package/dist/templates/droid/droids/trellis-research.md +1 -1
  124. package/dist/templates/extract.d.ts +6 -0
  125. package/dist/templates/extract.d.ts.map +1 -1
  126. package/dist/templates/extract.js +14 -0
  127. package/dist/templates/extract.js.map +1 -1
  128. package/dist/templates/gemini/agents/trellis-research.md +1 -1
  129. package/dist/templates/kiro/agents/trellis-research.json +1 -1
  130. package/dist/templates/markdown/agents.md +19 -12
  131. package/dist/templates/markdown/gitignore.txt +3 -0
  132. package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +24 -0
  133. package/dist/templates/opencode/agents/trellis-check.md +1 -1
  134. package/dist/templates/opencode/agents/trellis-implement.md +7 -4
  135. package/dist/templates/opencode/agents/trellis-research.md +2 -2
  136. package/dist/templates/opencode/lib/trellis-context.js +100 -13
  137. package/dist/templates/opencode/plugins/inject-subagent-context.js +70 -5
  138. package/dist/templates/opencode/plugins/inject-workflow-state.js +38 -44
  139. package/dist/templates/opencode/plugins/session-start.js +76 -31
  140. package/dist/templates/pi/agents/trellis-check.md +28 -0
  141. package/dist/templates/pi/agents/trellis-implement.md +33 -0
  142. package/dist/templates/pi/agents/trellis-research.md +25 -0
  143. package/dist/templates/pi/extensions/trellis/index.ts.txt +997 -0
  144. package/dist/templates/pi/index.d.ts +5 -0
  145. package/dist/templates/pi/index.d.ts.map +1 -0
  146. package/dist/templates/pi/index.js +12 -0
  147. package/dist/templates/pi/index.js.map +1 -0
  148. package/dist/templates/pi/settings.json +12 -0
  149. package/dist/templates/qoder/agents/trellis-research.md +1 -1
  150. package/dist/templates/shared-hooks/index.d.ts +31 -0
  151. package/dist/templates/shared-hooks/index.d.ts.map +1 -1
  152. package/dist/templates/shared-hooks/index.js +59 -0
  153. package/dist/templates/shared-hooks/index.js.map +1 -1
  154. package/dist/templates/shared-hooks/inject-shell-session-context.py +180 -0
  155. package/dist/templates/shared-hooks/inject-subagent-context.py +156 -27
  156. package/dist/templates/shared-hooks/inject-workflow-state.py +85 -92
  157. package/dist/templates/shared-hooks/session-start.py +232 -36
  158. package/dist/templates/trellis/config.yaml +6 -0
  159. package/dist/templates/trellis/gitignore.txt +3 -0
  160. package/dist/templates/trellis/index.d.ts +1 -1
  161. package/dist/templates/trellis/index.d.ts.map +1 -1
  162. package/dist/templates/trellis/index.js +2 -2
  163. package/dist/templates/trellis/index.js.map +1 -1
  164. package/dist/templates/trellis/scripts/common/__init__.py +8 -0
  165. package/dist/templates/trellis/scripts/common/active_task.py +593 -0
  166. package/dist/templates/trellis/scripts/common/cli_adapter.py +72 -14
  167. package/dist/templates/trellis/scripts/common/paths.py +61 -58
  168. package/dist/templates/trellis/scripts/common/session_context.py +12 -0
  169. package/dist/templates/trellis/scripts/common/task_context.py +27 -194
  170. package/dist/templates/trellis/scripts/common/task_store.py +102 -26
  171. package/dist/templates/trellis/scripts/common/tasks.py +4 -1
  172. package/dist/templates/trellis/scripts/common/types.py +0 -2
  173. package/dist/templates/trellis/scripts/common/workflow_phase.py +15 -3
  174. package/dist/templates/trellis/scripts/task.py +99 -34
  175. package/dist/templates/trellis/workflow.md +332 -64
  176. package/dist/types/ai-tools.d.ts +12 -3
  177. package/dist/types/ai-tools.d.ts.map +1 -1
  178. package/dist/types/ai-tools.js +29 -0
  179. package/dist/types/ai-tools.js.map +1 -1
  180. package/dist/utils/file-writer.d.ts.map +1 -1
  181. package/dist/utils/file-writer.js +7 -2
  182. package/dist/utils/file-writer.js.map +1 -1
  183. package/dist/utils/posix.d.ts +13 -0
  184. package/dist/utils/posix.d.ts.map +1 -0
  185. package/dist/utils/posix.js +15 -0
  186. package/dist/utils/posix.js.map +1 -0
  187. package/dist/utils/project-detector.d.ts +2 -0
  188. package/dist/utils/project-detector.d.ts.map +1 -1
  189. package/dist/utils/project-detector.js +120 -11
  190. package/dist/utils/project-detector.js.map +1 -1
  191. package/dist/utils/task-json.d.ts +46 -0
  192. package/dist/utils/task-json.d.ts.map +1 -0
  193. package/dist/utils/task-json.js +49 -0
  194. package/dist/utils/task-json.js.map +1 -0
  195. package/dist/utils/template-fetcher.d.ts +22 -6
  196. package/dist/utils/template-fetcher.d.ts.map +1 -1
  197. package/dist/utils/template-fetcher.js +405 -27
  198. package/dist/utils/template-fetcher.js.map +1 -1
  199. package/dist/utils/template-hash.d.ts +22 -3
  200. package/dist/utils/template-hash.d.ts.map +1 -1
  201. package/dist/utils/template-hash.js +99 -19
  202. package/dist/utils/template-hash.js.map +1 -1
  203. package/package.json +7 -7
  204. package/dist/templates/markdown/spec/backend/directory-structure.md +0 -292
  205. package/dist/templates/markdown/spec/backend/index.md +0 -40
  206. package/dist/templates/markdown/spec/backend/script-conventions.md +0 -742
  207. package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md +0 -118
  208. package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md +0 -394
  209. package/dist/templates/shared-hooks/statusline.py +0 -218
  210. package/dist/templates/trellis/scripts/create_bootstrap.py +0 -298
@@ -1,148 +1,80 @@
1
1
  ---
2
2
  name: finish-work
3
- description: "Pre-commit quality checklist covering lint, typecheck, tests, code-spec sync, API changes, database migrations, cross-layer verification, and manual testing. Blocks commit if infra or cross-layer specs lack executable depth. Use when code is written and tested but not yet committed, before submitting changes, or as a final review before git commit."
3
+ description: "Wrap up an active Trellis task: archive it (and any other completed-but-unarchived tasks the user wants to clean up) and record a session journal. Refuses to run if the working tree has uncommitted code changes (those belong in workflow Phase 3.4 first). Use when the user asks to finish / wrap up / call it a day, or invokes $finish-work."
4
4
  ---
5
5
 
6
- # Finish Work - Pre-Commit Checklist
6
+ # Finish Work
7
7
 
8
- Before submitting or committing, use this checklist to ensure work completeness.
8
+ Wrap up the current session: archive the active task (and any other completed-but-unarchived tasks the user wants to clean up) and record the session journal. Code commits are NOT done here — those happen in workflow Phase 3.4 before you invoke this skill.
9
9
 
10
- **Timing**: After code is written and tested, before commit
11
-
12
- ---
13
-
14
- ## Checklist
15
-
16
- ### 1. Code Quality
10
+ ## Step 1: Survey current state
17
11
 
18
12
  ```bash
19
- # Must pass
20
- pnpm lint
21
- pnpm type-check
22
- pnpm test
13
+ python3 ./.trellis/scripts/get_context.py --mode record
23
14
  ```
24
15
 
25
- - [ ] `pnpm lint` passes with 0 errors?
26
- - [ ] `pnpm type-check` passes with no type errors?
27
- - [ ] Tests pass?
28
- - [ ] No `console.log` statements (use logger)?
29
- - [ ] No non-null assertions (the `x!` operator)?
30
- - [ ] No `any` types?
31
-
32
- ### 2. Code-Spec Sync
33
-
34
- **Code-Spec Docs**:
35
- - [ ] Does `.trellis/spec/backend/` need updates?
36
- - New patterns, new modules, new conventions
37
- - [ ] Does `.trellis/spec/frontend/` need updates?
38
- - New components, new hooks, new patterns
39
- - [ ] Does `.trellis/spec/guides/` need updates?
40
- - New cross-layer flows, lessons from bugs
41
-
42
- **Key Question**:
43
- > "If I fixed a bug or discovered something non-obvious, should I document it so future me (or others) won't hit the same issue?"
16
+ This prints:
44
17
 
45
- If YES -> Update the relevant code-spec doc.
18
+ - **My active tasks** — review whether any besides the current one are actually done (code merged, AC met) and should be archived this round.
19
+ - **Git status** — quick visual on what's dirty.
20
+ - **Recent commits** — you'll need their hashes in Step 4 for `--commit`.
46
21
 
47
- ### 2.5. Code-Spec Hard Block (Infra/Cross-Layer)
22
+ If `--mode record` surfaces other completed tasks not tied to the current session, surface them to the user with a one-shot confirmation: "These N tasks look done — archive them too in this round? [y/N]". Default is no; the current active task is always archived in Step 3 regardless.
48
23
 
49
- If this change touches infra or cross-layer contracts, this is a blocking checklist:
24
+ ## Step 2: Sanity check working tree must be clean
50
25
 
51
- - [ ] Spec content is executable (real signatures/contracts), not principle-only text
52
- - [ ] Includes file path + command/API name + payload field names
53
- - [ ] Includes validation and error matrix
54
- - [ ] Includes Good/Base/Bad cases
55
- - [ ] Includes required tests and assertion points
26
+ Run:
56
27
 
57
- **Block Rule**:
58
- If infra/cross-layer changed but the related spec is still abstract, do NOT finish. Run `$update-spec` manually first.
59
-
60
- ### 3. API Changes
61
-
62
- If you modified API endpoints:
63
-
64
- - [ ] Input schema updated?
65
- - [ ] Output schema updated?
66
- - [ ] API documentation updated?
67
- - [ ] Client code updated to match?
68
-
69
- ### 4. Database Changes
28
+ ```bash
29
+ git status --porcelain
30
+ ```
70
31
 
71
- If you modified database schema:
32
+ Filter out paths under `.trellis/workspace/` and `.trellis/tasks/` — those are managed by `add_session.py` and `task.py archive` auto-commits and will appear dirty as part of this skill's own work.
72
33
 
73
- - [ ] Migration file created?
74
- - [ ] Schema file updated?
75
- - [ ] Related queries updated?
76
- - [ ] Seed data updated (if applicable)?
34
+ If anything else is dirty (any path outside those two prefixes), **stop and bail out** with:
77
35
 
78
- ### 5. Cross-Layer Verification
36
+ > "Working tree has uncommitted code changes. Return to workflow Phase 3.4 to commit them before running `$finish-work`."
79
37
 
80
- If the change spans multiple layers:
38
+ Do NOT run `git commit` here. Do NOT prompt the user to commit. The user goes back to Phase 3.4 and the AI drives the batched commit there.
81
39
 
82
- - [ ] Data flows correctly through all layers?
83
- - [ ] Error handling works at each boundary?
84
- - [ ] Types are consistent across layers?
85
- - [ ] Loading states handled?
40
+ ## Step 3: Archive task(s)
86
41
 
87
- ### 6. Manual Testing
42
+ ```bash
43
+ python3 ./.trellis/scripts/task.py archive <task-name>
44
+ ```
88
45
 
89
- - [ ] Feature works in browser/app?
90
- - [ ] Edge cases tested?
91
- - [ ] Error states tested?
92
- - [ ] Works after page refresh?
46
+ At minimum: the current active task (if any). Plus any extra tasks the user confirmed in Step 1. Each archive produces a `chore(task): archive ...` commit via the script's auto-commit.
93
47
 
94
- ---
48
+ If there is no active task and the user did not confirm any cleanup archives, skip this step.
95
49
 
96
- ## Quick Check Flow
50
+ ## Step 4: Record session journal
97
51
 
98
52
  ```bash
99
- # 1. Code checks
100
- pnpm lint && pnpm type-check
101
-
102
- # 2. View changes
103
- git status
104
- git diff --name-only
105
-
106
- # 3. Based on changed files, check relevant items above
53
+ python3 ./.trellis/scripts/add_session.py \
54
+ --title "Session Title" \
55
+ --commit "hash1,hash2" \
56
+ --summary "Brief summary"
107
57
  ```
108
58
 
109
- ---
110
-
111
- ## Common Oversights
59
+ Use the work-commit hashes produced in Phase 3.4 (visible in Step 1's `Recent commits` list, or via `git log --oneline`) for `--commit`. Do not include the archive commit hashes from Step 3. This produces a `chore: record journal` commit.
112
60
 
113
- | Oversight | Consequence | Check |
114
- |-----------|-------------|-------|
115
- | Code-spec docs not updated | Others don't know the change | Check .trellis/spec/ |
116
- | Spec text is abstract only | Easy regressions in infra/cross-layer changes | Require signature/contract/matrix/cases/tests |
117
- | Migration not created | Schema out of sync | Check db/migrations/ |
118
- | Types not synced | Runtime errors | Check shared types |
119
- | Tests not updated | False confidence | Run full test suite |
120
- | Console.log left in | Noisy production logs | Search for console.log |
61
+ Final git log order: `<work commits from 3.4>` → `chore(task): archive ...` (one or more) → `chore: record journal`.
121
62
 
122
63
  ---
123
64
 
124
- ## Relationship to Other Commands
65
+ ## Relationship to Other Skills
125
66
 
126
67
  ```
127
68
  Development Flow:
128
- Write code -> Test -> $finish-work -> git commit -> $record-session
129
- | |
130
- Ensure completeness Record progress
131
-
69
+ Phase 3.4 (workflow.md) -> AI drafts batched commits -> user confirms -> git commit
70
+ |
71
+ v
72
+ $finish-work
73
+ (survey + archive + journal)
74
+
132
75
  Debug Flow:
133
76
  Hit bug -> Fix -> $break-loop -> Knowledge capture
134
- |
135
- Deep analysis
136
77
  ```
137
78
 
138
- - `$finish-work` - Check work completeness (this skill)
139
- - `$record-session` - Record session and commits
140
- - `$break-loop` - Deep analysis after debugging
141
-
142
- ---
143
-
144
- ## Core Principle
145
-
146
- > **Delivery includes not just code, but also documentation, verification, and knowledge capture.**
147
-
148
- Complete work = Code + Docs + Tests + Verification
79
+ - `$finish-work` this skill, survey + archive + record session
80
+ - `$break-loop` deep analysis after debugging
@@ -244,17 +244,21 @@ Use this output format:
244
244
 
245
245
  **Step 6: Configure Context** `[AI]`
246
246
 
247
- Initialize default context:
247
+ `implement.jsonl` and `check.jsonl` were seeded on `task.py create` with a single self-describing `_example` line. Curate real entries now (see workflow.md Phase 1.3 for the full rule):
248
+
249
+ - Put **spec files** (`.trellis/spec/<package>/<layer>/*.md`) and **research files** (`{TASK_DIR}/research/*.md`) only.
250
+ - Do NOT put code files (`src/**`, `packages/**`) — those are read during implementation, not pre-registered here.
251
+ - Split: `implement.jsonl` = specs the implement sub-agent needs; `check.jsonl` = specs the check sub-agent needs.
252
+
253
+ Discover available specs:
248
254
 
249
255
  ```bash
250
- python3 ./.trellis/scripts/task.py init-context "$TASK_DIR" <type>
251
- # type: backend | frontend | fullstack
256
+ python3 ./.trellis/scripts/get_context.py --mode packages
252
257
  ```
253
258
 
254
- Add specs found in your research pass:
259
+ Append entries (either edit the jsonl file directly, or):
255
260
 
256
261
  ```bash
257
- # For each relevant spec and code pattern:
258
262
  python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" implement "<path>" "<reason>"
259
263
  python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" check "<path>" "<reason>"
260
264
  ```
@@ -265,7 +269,7 @@ python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" check "<path>" "<reas
265
269
  python3 ./.trellis/scripts/task.py start "$TASK_DIR"
266
270
  ```
267
271
 
268
- This sets `.current-task` so hooks can inject context.
272
+ This sets the active task through Trellis' session resolver so hooks can inject context for this AI session. If the command fails because no session identity is available, rerun it from an IDE/session that exposes session identity or set `TRELLIS_CONTEXT_ID`.
269
273
 
270
274
  ---
271
275
 
@@ -325,9 +329,8 @@ If yes, resume from the appropriate step (usually Step 7 or 8).
325
329
  | Script | Purpose |
326
330
  |--------|---------|
327
331
  | `python3 ./.trellis/scripts/get_context.py` | Get session context |
328
- | `python3 ./.trellis/scripts/task.py create` | Create task directory |
329
- | `python3 ./.trellis/scripts/task.py init-context` | Initialize jsonl files |
330
- | `python3 ./.trellis/scripts/task.py add-context` | Add spec to jsonl |
332
+ | `python3 ./.trellis/scripts/task.py create` | Create task directory (seeds jsonl on sub-agent platforms) |
333
+ | `python3 ./.trellis/scripts/task.py add-context` | Append spec/research entry to jsonl |
331
334
  | `python3 ./.trellis/scripts/task.py start` | Set current task |
332
335
  | `python3 ./.trellis/scripts/task.py finish` | Clear current task |
333
336
  | `python3 ./.trellis/scripts/task.py archive` | Archive completed task |
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: trellis-meta
3
+ description: "Understand and customize the local Trellis architecture inside a user project. Use when modifying .trellis plus platform hooks, settings, agents, skills, commands, prompts, or workflows generated by trellis init."
4
+ ---
5
+
6
+ # Trellis Meta
7
+
8
+ This skill is for local Trellis users who have already run `trellis init` in a project. After reading it, an AI should understand the Trellis architecture, operating model, and customization entry points inside that user project, then modify the generated `.trellis/` and platform directory files according to the user's request.
9
+
10
+ The default operating scope is local files in the user project:
11
+
12
+ - `.trellis/`: workflow, config, tasks, spec, workspace, scripts, and runtime state.
13
+ - Platform directories: `.claude/`, `.codex/`, `.cursor/`, `.opencode/`, `.kiro/`, `.gemini/`, `.qoder/`, `.codebuddy/`, `.github/`, `.factory/`, `.pi/`, `.kilocode/`, `.agent/`, `.windsurf/`, and similar directories.
14
+ - Shared skill layer: `.agents/skills/`.
15
+
16
+ Do not assume the user has the Trellis source repository. Do not default to modifying the global npm install directory or `node_modules`.
17
+
18
+ ## How To Use
19
+
20
+ 1. Read `references/local-architecture/overview.md` first to establish the local Trellis system model.
21
+ 2. If the request involves a specific AI tool, read `references/platform-files/platform-map.md` and the relevant platform file notes.
22
+ 3. If the user wants to change behavior, read `references/customize-local/overview.md`, then open the specific customization topic.
23
+ 4. Before editing, read the actual files in the user project and treat local content as authoritative.
24
+
25
+ ## References
26
+
27
+ ### Local Architecture
28
+
29
+ - `references/local-architecture/overview.md`: The three-layer local Trellis architecture and customization principles.
30
+ - `references/local-architecture/generated-files.md`: Files generated by `trellis init` and their customization boundaries.
31
+ - `references/local-architecture/workflow.md`: Phases, routing, and workflow-state blocks in `.trellis/workflow.md`.
32
+ - `references/local-architecture/task-system.md`: Task directories, active tasks, JSONL context, and task runtime.
33
+ - `references/local-architecture/spec-system.md`: How `.trellis/spec/` is organized and injected.
34
+ - `references/local-architecture/workspace-memory.md`: `.trellis/workspace/`, journals, and cross-session memory.
35
+ - `references/local-architecture/context-injection.md`: Hooks, sub-agent preludes, and context injection paths.
36
+
37
+ ### Platform Files
38
+
39
+ - `references/platform-files/overview.md`: How shared `.trellis/` files relate to platform directories.
40
+ - `references/platform-files/platform-map.md`: Platform directories and paths for skills, agents, hooks, and extensions.
41
+ - `references/platform-files/hooks-and-settings.md`: How settings/config files, hooks, plugins, and extensions connect to Trellis.
42
+ - `references/platform-files/agents.md`: Local file responsibilities for `trellis-research`, `trellis-implement`, and `trellis-check`.
43
+ - `references/platform-files/skills-and-commands.md`: Differences between skills, commands, prompts, and workflows, plus how to change them.
44
+
45
+ ### Local Customization
46
+
47
+ - `references/customize-local/overview.md`: Choose the right local customization entry point for the user's request.
48
+ - `references/customize-local/change-workflow.md`: Change phases, routing, next actions, and workflow-state.
49
+ - `references/customize-local/change-task-lifecycle.md`: Change task creation, status, archive behavior, and hooks.
50
+ - `references/customize-local/change-context-loading.md`: Change how tasks, specs, journals, and hook context are loaded.
51
+ - `references/customize-local/change-hooks.md`: Change platform hooks, settings, and shell session bridges.
52
+ - `references/customize-local/change-agents.md`: Change research, implement, and check agent behavior.
53
+ - `references/customize-local/change-skills-or-commands.md`: Add or modify local skills, commands, prompts, and workflows.
54
+ - `references/customize-local/change-spec-structure.md`: Adjust the project spec structure under `.trellis/spec/`.
55
+ - `references/customize-local/add-project-local-conventions.md`: Put team rules into project-local specs or local skills.
56
+
57
+ ## Current Rules
58
+
59
+ - `.trellis/workflow.md` is the local workflow source of truth.
60
+ - `.trellis/config.yaml` is the project-level Trellis configuration and task hook configuration entry point.
61
+ - `.trellis/spec/` stores the user's project-specific coding conventions and design constraints.
62
+ - `.trellis/tasks/` stores task PRDs, technical notes, research files, and JSONL context.
63
+ - `.trellis/workspace/` stores developer journals and cross-session memory.
64
+ - Platform settings/config files decide which hooks, agents, skills, commands, prompts, and workflows actually run.
65
+ - `.trellis/.template-hashes.json` and `.trellis/.runtime/` are management/runtime state files. Confirm necessity before editing them.
66
+
67
+ ## Do Not
68
+
69
+ - Do not treat Trellis upstream source code as the default target for local customization.
70
+ - Do not modify the global npm install directory or `node_modules/@mindfoldhq/trellis` to implement project needs.
71
+ - Do not overwrite user-modified local files with default templates.
72
+ - Do not put team-private project rules into the public `trellis-meta`; put project rules in `.trellis/spec/` or a project-local skill.
73
+ - Do not describe removed historical mechanisms as current Trellis behavior.
@@ -0,0 +1,83 @@
1
+ # Add Project-Local Conventions
2
+
3
+ Often the user does not need to change Trellis mechanics; they need local AI to understand their team's conventions. In that case, prefer `.trellis/spec/` or a project-local skill instead of editing `trellis-meta`.
4
+
5
+ ## Where To Put Things
6
+
7
+ | Content type | Location |
8
+ | --- | --- |
9
+ | Rules code must follow | `.trellis/spec/<layer>/` |
10
+ | Cross-layer thinking methods | `.trellis/spec/guides/` |
11
+ | AI capability for a project-specific flow | Platform-local skill |
12
+ | One-off task material | `.trellis/tasks/<task>/` |
13
+ | Session summary | `.trellis/workspace/<developer>/journal-N.md` |
14
+
15
+ ## Create A Project-Local Skill
16
+
17
+ If the user wants AI to know "how this project customizes Trellis," create a local skill:
18
+
19
+ ```text
20
+ .claude/skills/trellis-local/
21
+ └── SKILL.md
22
+ ```
23
+
24
+ Example:
25
+
26
+ ```md
27
+ ---
28
+ name: trellis-local
29
+ description: "Project-local Trellis customizations for this repository. Use when changing this project's Trellis workflow, hooks, local agents, or team-specific conventions."
30
+ ---
31
+
32
+ # Trellis Local
33
+
34
+ ## Local Scope
35
+
36
+ This skill documents this repository's Trellis customizations only.
37
+
38
+ ## Custom Workflow Rules
39
+
40
+ - ...
41
+
42
+ ## Local Hook Changes
43
+
44
+ - ...
45
+
46
+ ## Local Agent Changes
47
+
48
+ - ...
49
+ ```
50
+
51
+ For multi-platform projects, place equivalent versions in other platform skill directories, or use `.agents/skills/` for platforms that support the shared layer.
52
+
53
+ ## Write To `.trellis/spec/`
54
+
55
+ If the content is a coding convention, write it to spec. Examples:
56
+
57
+ ```text
58
+ .trellis/spec/backend/error-handling.md
59
+ .trellis/spec/frontend/components.md
60
+ .trellis/spec/guides/cross-platform-thinking-guide.md
61
+ ```
62
+
63
+ After writing it, update the corresponding `index.md` so AI can find the new rule from the entry point.
64
+
65
+ ## Make The Current Task Use New Conventions
66
+
67
+ After writing a spec, add it to the current task context:
68
+
69
+ ```bash
70
+ python3 ./.trellis/scripts/task.py add-context <task> implement ".trellis/spec/backend/error-handling.md" "Error handling conventions"
71
+ python3 ./.trellis/scripts/task.py add-context <task> check ".trellis/spec/backend/error-handling.md" "Review error handling"
72
+ ```
73
+
74
+ ## Do Not Store Project-Private Rules In `trellis-meta`
75
+
76
+ `trellis-meta` is a public skill for understanding Trellis architecture and local customization entry points. Put project-private content in:
77
+
78
+ - `.trellis/spec/`
79
+ - a project-local skill
80
+ - the current task
81
+ - workspace journal
82
+
83
+ This prevents future updates to Trellis's built-in `trellis-meta` from overwriting the team's own conventions.
@@ -0,0 +1,54 @@
1
+ # Change Local Agents
2
+
3
+ When the user wants to change `trellis-research`, `trellis-implement`, or `trellis-check` behavior, edit platform agent files in the user project.
4
+
5
+ ## Read These Files First
6
+
7
+ 1. Target platform agent directory
8
+ 2. `.trellis/workflow.md` Phase 2 / research routing
9
+ 3. Current task `prd.md`
10
+ 4. Current task `implement.jsonl` / `check.jsonl`
11
+ 5. Relevant hook or agent prelude
12
+
13
+ ## Common Paths
14
+
15
+ | Platform | Path |
16
+ | --- | --- |
17
+ | Claude Code | `.claude/agents/trellis-*.md` |
18
+ | Cursor | `.cursor/agents/trellis-*.md` |
19
+ | OpenCode | `.opencode/agents/trellis-*.md` |
20
+ | Codex | `.codex/agents/trellis-*.toml` |
21
+ | Kiro | `.kiro/agents/trellis-*.json` |
22
+ | Gemini CLI | `.gemini/agents/trellis-*.md` |
23
+ | Qoder | `.qoder/agents/trellis-*.md` |
24
+ | CodeBuddy | `.codebuddy/agents/trellis-*.md` |
25
+ | Factory Droid | `.factory/droids/trellis-*.md` |
26
+ | Pi Agent | `.pi/agents/trellis-*.md` |
27
+
28
+ Use the actual paths in the user project as authoritative.
29
+
30
+ ## Common Needs
31
+
32
+ | Need | Which agent to edit |
33
+ | --- | --- |
34
+ | Research must write files, not only reply in chat | `trellis-research` |
35
+ | Certain local specs must be read before implementation | `trellis-implement` + `implement.jsonl` configuration rules |
36
+ | Specific commands must run during checking | `trellis-check` |
37
+ | Agent must not modify certain directories | The corresponding agent's write boundary instructions |
38
+ | Agent output format must be fixed | The corresponding agent's final/reporting instructions |
39
+
40
+ ## Modification Principles
41
+
42
+ 1. **Preserve role boundaries**: research investigates and persists; implement writes implementation; check reviews and fixes.
43
+ 2. **Do not hard-code project specs into agents**: long-term specs belong in `.trellis/spec/`; agents are responsible for reading them.
44
+ 3. **Make read order explicit**: active task -> PRD -> info -> JSONL -> spec/research.
45
+ 4. **Make write boundaries explicit**: which directories may be written and which may not.
46
+ 5. **Synchronize across platforms**: when the user configured multiple platforms, decide whether to change only the current platform or all platform agents.
47
+
48
+ ## Agent Pull Platforms
49
+
50
+ If an agent file contains a prelude for "read task/context after startup," do not remove those steps when editing. Otherwise the agent will work only from chat context and bypass Trellis's core mechanism.
51
+
52
+ ## Hook Push Platforms
53
+
54
+ If context is injected by a hook, the agent file should still retain responsibility boundaries. Do not remove PRD/spec requirements from the agent just because a hook injects context.
@@ -0,0 +1,81 @@
1
+ # Change Local Context Loading
2
+
3
+ Context loading determines when AI reads workflow, task, spec, research, workspace, and git status. Read this page when the user says "AI does not know the current task," "the agent did not read specs," or "there is too much/too little context."
4
+
5
+ ## Read These Files First
6
+
7
+ 1. `.trellis/workflow.md`
8
+ 2. `.trellis/scripts/get_context.py`
9
+ 3. `.trellis/scripts/common/session_context.py`
10
+ 4. `.trellis/scripts/common/task_context.py`
11
+ 5. `.trellis/scripts/common/active_task.py`
12
+ 6. Current platform hooks or agent files
13
+ 7. The current task's `implement.jsonl` / `check.jsonl`
14
+
15
+ ## Context Sources
16
+
17
+ | Source | Purpose |
18
+ | --- | --- |
19
+ | `.trellis/workflow.md` | Workflow and next-action hints. |
20
+ | `.trellis/tasks/<task>/prd.md` | Current task requirements. |
21
+ | `.trellis/tasks/<task>/implement.jsonl` | Spec/research to read before implementation. |
22
+ | `.trellis/tasks/<task>/check.jsonl` | Spec/research to read during checking. |
23
+ | `.trellis/spec/` | Project specs. |
24
+ | `.trellis/workspace/` | Session records. |
25
+ | git status | Current working tree changes. |
26
+
27
+ ## Common Needs And Edit Points
28
+
29
+ | Need | Edit point |
30
+ | --- | --- |
31
+ | Inject more/less information in new sessions | `session_context.py` or the platform `session-start` hook. |
32
+ | Change hints on each user input | `[workflow-state:STATUS]` block in `.trellis/workflow.md`. The `inject-workflow-state` hook is parser-only and reads the block verbatim. |
33
+ | Agent did not read specs | Task JSONL, agent prelude, `inject-subagent-context` hook. |
34
+ | Active task is lost | `active_task.py` and platform session identity propagation. |
35
+ | Change JSONL validation rules | `task_context.py`. |
36
+
37
+ ## JSONL Rules
38
+
39
+ `implement.jsonl` / `check.jsonl` are the key context loading interface:
40
+
41
+ ```jsonl
42
+ {"file": ".trellis/spec/backend/index.md", "reason": "Backend conventions"}
43
+ {"file": ".trellis/tasks/04-28-x/research/api.md", "reason": "API research"}
44
+ ```
45
+
46
+ Include only spec/research files. Do not put code files that will be modified into these manifests; agents read code files themselves during implementation.
47
+
48
+ ## Change Session Context
49
+
50
+ If the user wants every new session to see more project state, edit:
51
+
52
+ - `.trellis/scripts/common/session_context.py`
53
+ - the corresponding platform `session-start` hook
54
+
55
+ Context cannot grow without bound. Prefer injecting indexes and paths so the AI can read detailed files on demand.
56
+
57
+ ## Change Sub-Agent Context
58
+
59
+ First determine which mode the platform uses:
60
+
61
+ - hook push: edit the `inject-subagent-context` hook.
62
+ - agent pull: edit the read steps in the corresponding `trellis-implement` / `trellis-check` agent file.
63
+
64
+ In both modes, make sure the agent ultimately reads:
65
+
66
+ 1. active task
67
+ 2. `prd.md`
68
+ 3. `info.md` if present
69
+ 4. the corresponding JSONL
70
+ 5. spec/research referenced by the JSONL
71
+
72
+ ## Troubleshooting Order
73
+
74
+ ```bash
75
+ python3 ./.trellis/scripts/task.py current --source
76
+ python3 ./.trellis/scripts/task.py list-context <task>
77
+ python3 ./.trellis/scripts/task.py validate <task>
78
+ python3 ./.trellis/scripts/get_context.py --mode packages
79
+ ```
80
+
81
+ Confirm the task and JSONL are correct before editing hooks/agents.
@@ -0,0 +1,57 @@
1
+ # Change Local Hooks
2
+
3
+ Hooks are the automation layer that connects a platform to Trellis. When the user wants to change "when context is injected," "how shell commands inherit a session," or "which files are read before an agent starts," hooks are usually the edit point.
4
+
5
+ ## Read These Files First
6
+
7
+ 1. Target platform settings/config, such as `.claude/settings.json`, `.codex/hooks.json`, `.cursor/hooks.json`
8
+ 2. Target platform hooks directory
9
+ 3. `.trellis/scripts/common/active_task.py`
10
+ 4. `.trellis/scripts/common/session_context.py`
11
+ 5. `.trellis/workflow.md`
12
+
13
+ ## Common Hook Types
14
+
15
+ | Hook | Purpose |
16
+ | --- | --- |
17
+ | session-start | Injects a Trellis overview when a session starts, clears, or compacts. |
18
+ | workflow-state | Injects a state hint on each user input. |
19
+ | sub-agent context | Injects PRD/spec/research before an agent starts. |
20
+ | shell session bridge | Lets `task.py` commands in shell see the same session identity. |
21
+
22
+ ## Modification Steps
23
+
24
+ 1. Find the hook registration in settings/config.
25
+ 2. Confirm the registered script path exists.
26
+ 3. Read the hook script and identify inputs, outputs, and called `.trellis/scripts/`.
27
+ 4. Modify hook behavior.
28
+ 5. If the hook depends on workflow content, synchronize `.trellis/workflow.md`.
29
+
30
+ ## Example: Change New-Session Injection Content
31
+
32
+ First find the session-start hook:
33
+
34
+ ```text
35
+ .claude/settings.json
36
+ .claude/hooks/session-start.py
37
+ ```
38
+
39
+ If the hook ultimately calls `.trellis/scripts/get_context.py` or `session_context.py`, editing the local script is usually more robust than hard-coding content in the hook.
40
+
41
+ ## Example: Agent Did Not Read JSONL
42
+
43
+ First confirm:
44
+
45
+ ```bash
46
+ python3 ./.trellis/scripts/task.py current --source
47
+ python3 ./.trellis/scripts/task.py validate <task>
48
+ ```
49
+
50
+ If the task and JSONL are correct, determine whether the platform uses hook push or agent pull. For hook push, edit `inject-subagent-context`; for agent pull, edit the agent file.
51
+
52
+ ## Notes
53
+
54
+ - Settings handle registration, hook scripts handle behavior; inspect both together.
55
+ - Different platforms support different hook events. Do not directly copy another platform's settings.
56
+ - Hooks should read project-local `.trellis/`; they should not depend on Trellis upstream source paths.
57
+ - Hook failures should produce visible errors so AI does not silently lose context.