@mindfoldhq/trellis 0.3.9 → 0.4.0-beta.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 (172) hide show
  1. package/dist/cli/index.js +2 -0
  2. package/dist/cli/index.js.map +1 -1
  3. package/dist/commands/init.d.ts +1 -0
  4. package/dist/commands/init.d.ts.map +1 -1
  5. package/dist/commands/init.js +203 -31
  6. package/dist/commands/init.js.map +1 -1
  7. package/dist/commands/update.d.ts.map +1 -1
  8. package/dist/commands/update.js +154 -6
  9. package/dist/commands/update.js.map +1 -1
  10. package/dist/configurators/workflow.d.ts +6 -2
  11. package/dist/configurators/workflow.d.ts.map +1 -1
  12. package/dist/configurators/workflow.js +88 -58
  13. package/dist/configurators/workflow.js.map +1 -1
  14. package/dist/migrations/index.d.ts +1 -0
  15. package/dist/migrations/index.d.ts.map +1 -1
  16. package/dist/migrations/index.js +2 -0
  17. package/dist/migrations/index.js.map +1 -1
  18. package/dist/migrations/manifests/0.4.0-beta.1.json +228 -0
  19. package/dist/templates/claude/agents/dispatch.md +1 -2
  20. package/dist/templates/claude/agents/implement.md +2 -3
  21. package/dist/templates/claude/commands/trellis/before-dev.md +29 -0
  22. package/dist/templates/claude/commands/trellis/check.md +25 -0
  23. package/dist/templates/claude/commands/trellis/create-command.md +2 -2
  24. package/dist/templates/claude/commands/trellis/onboard.md +13 -13
  25. package/dist/templates/claude/commands/trellis/parallel.md +1 -2
  26. package/dist/templates/claude/commands/trellis/record-session.md +1 -1
  27. package/dist/templates/claude/commands/trellis/start.md +8 -4
  28. package/dist/templates/claude/hooks/inject-subagent-context.py +21 -13
  29. package/dist/templates/claude/hooks/session-start.py +170 -2
  30. package/dist/templates/codex/skills/before-dev/SKILL.md +34 -0
  31. package/dist/templates/codex/skills/check/SKILL.md +30 -0
  32. package/dist/templates/codex/skills/create-command/SKILL.md +2 -2
  33. package/dist/templates/codex/skills/onboard/SKILL.md +11 -11
  34. package/dist/templates/codex/skills/record-session/SKILL.md +1 -1
  35. package/dist/templates/codex/skills/start/SKILL.md +8 -3
  36. package/dist/templates/cursor/commands/trellis-before-dev.md +29 -0
  37. package/dist/templates/cursor/commands/trellis-check.md +25 -0
  38. package/dist/templates/cursor/commands/trellis-create-command.md +2 -2
  39. package/dist/templates/cursor/commands/trellis-onboard.md +13 -13
  40. package/dist/templates/cursor/commands/trellis-record-session.md +1 -1
  41. package/dist/templates/cursor/commands/trellis-start.md +7 -16
  42. package/dist/templates/gemini/commands/trellis/before-dev.toml +33 -0
  43. package/dist/templates/gemini/commands/trellis/check.toml +29 -0
  44. package/dist/templates/gemini/commands/trellis/create-command.toml +2 -2
  45. package/dist/templates/gemini/commands/trellis/onboard.toml +2 -2
  46. package/dist/templates/gemini/commands/trellis/record-session.toml +1 -1
  47. package/dist/templates/gemini/commands/trellis/start.toml +9 -4
  48. package/dist/templates/iflow/agents/dispatch.md +1 -2
  49. package/dist/templates/iflow/agents/implement.md +2 -3
  50. package/dist/templates/iflow/commands/trellis/before-dev.md +29 -0
  51. package/dist/templates/iflow/commands/trellis/check.md +25 -0
  52. package/dist/templates/iflow/commands/trellis/create-command.md +2 -2
  53. package/dist/templates/iflow/commands/trellis/onboard.md +13 -13
  54. package/dist/templates/iflow/commands/trellis/parallel.md +1 -2
  55. package/dist/templates/iflow/commands/trellis/record-session.md +1 -1
  56. package/dist/templates/iflow/commands/trellis/start.md +8 -4
  57. package/dist/templates/iflow/hooks/inject-subagent-context.py +21 -13
  58. package/dist/templates/iflow/hooks/session-start.py +156 -1
  59. package/dist/templates/kilo/workflows/before-dev.md +29 -0
  60. package/dist/templates/kilo/workflows/check.md +25 -0
  61. package/dist/templates/kilo/workflows/create-command.md +2 -2
  62. package/dist/templates/kilo/workflows/onboard.md +13 -13
  63. package/dist/templates/kilo/workflows/parallel.md +1 -2
  64. package/dist/templates/kilo/workflows/record-session.md +1 -1
  65. package/dist/templates/kilo/workflows/start.md +8 -3
  66. package/dist/templates/kiro/skills/before-dev/SKILL.md +34 -0
  67. package/dist/templates/kiro/skills/check/SKILL.md +30 -0
  68. package/dist/templates/kiro/skills/create-command/SKILL.md +2 -2
  69. package/dist/templates/kiro/skills/onboard/SKILL.md +11 -11
  70. package/dist/templates/kiro/skills/record-session/SKILL.md +1 -1
  71. package/dist/templates/kiro/skills/start/SKILL.md +8 -3
  72. package/dist/templates/markdown/spec/backend/script-conventions.md +93 -0
  73. package/dist/templates/opencode/agents/dispatch.md +1 -2
  74. package/dist/templates/opencode/agents/implement.md +2 -2
  75. package/dist/templates/opencode/agents/research.md +1 -2
  76. package/dist/templates/opencode/commands/trellis/before-dev.md +29 -0
  77. package/dist/templates/opencode/commands/trellis/check.md +25 -0
  78. package/dist/templates/opencode/commands/trellis/create-command.md +2 -2
  79. package/dist/templates/opencode/commands/trellis/onboard.md +13 -13
  80. package/dist/templates/opencode/commands/trellis/parallel.md +1 -2
  81. package/dist/templates/opencode/commands/trellis/record-session.md +1 -1
  82. package/dist/templates/opencode/commands/trellis/start.md +8 -3
  83. package/dist/templates/opencode/plugin/inject-subagent-context.js +45 -18
  84. package/dist/templates/opencode/plugin/session-start.js +149 -1
  85. package/dist/templates/qoder/skills/before-dev/SKILL.md +34 -0
  86. package/dist/templates/qoder/skills/check/SKILL.md +30 -0
  87. package/dist/templates/qoder/skills/create-command/SKILL.md +2 -2
  88. package/dist/templates/qoder/skills/onboard/SKILL.md +13 -13
  89. package/dist/templates/qoder/skills/record-session/SKILL.md +1 -1
  90. package/dist/templates/qoder/skills/start/SKILL.md +8 -3
  91. package/dist/templates/trellis/config.yaml +20 -0
  92. package/dist/templates/trellis/index.d.ts +11 -0
  93. package/dist/templates/trellis/index.d.ts.map +1 -1
  94. package/dist/templates/trellis/index.js +22 -0
  95. package/dist/templates/trellis/index.js.map +1 -1
  96. package/dist/templates/trellis/scripts/add_session.py +52 -7
  97. package/dist/templates/trellis/scripts/common/cli_adapter.py +33 -45
  98. package/dist/templates/trellis/scripts/common/config.py +152 -0
  99. package/dist/templates/trellis/scripts/common/git.py +31 -0
  100. package/dist/templates/trellis/scripts/common/git_context.py +23 -586
  101. package/dist/templates/trellis/scripts/common/io.py +37 -0
  102. package/dist/templates/trellis/scripts/common/log.py +45 -0
  103. package/dist/templates/trellis/scripts/common/packages_context.py +233 -0
  104. package/dist/templates/trellis/scripts/common/paths.py +46 -0
  105. package/dist/templates/trellis/scripts/common/phase.py +50 -49
  106. package/dist/templates/trellis/scripts/common/registry.py +41 -72
  107. package/dist/templates/trellis/scripts/common/session_context.py +466 -0
  108. package/dist/templates/trellis/scripts/common/task_context.py +384 -0
  109. package/dist/templates/trellis/scripts/common/task_queue.py +27 -98
  110. package/dist/templates/trellis/scripts/common/task_store.py +534 -0
  111. package/dist/templates/trellis/scripts/common/task_utils.py +96 -6
  112. package/dist/templates/trellis/scripts/common/tasks.py +109 -0
  113. package/dist/templates/trellis/scripts/common/types.py +112 -0
  114. package/dist/templates/trellis/scripts/create_bootstrap.py +31 -26
  115. package/dist/templates/trellis/scripts/hooks/linear_sync.py +243 -0
  116. package/dist/templates/trellis/scripts/multi_agent/_bootstrap.py +17 -0
  117. package/dist/templates/trellis/scripts/multi_agent/cleanup.py +43 -48
  118. package/dist/templates/trellis/scripts/multi_agent/create_pr.py +336 -45
  119. package/dist/templates/trellis/scripts/multi_agent/plan.py +2 -26
  120. package/dist/templates/trellis/scripts/multi_agent/start.py +126 -57
  121. package/dist/templates/trellis/scripts/multi_agent/status.py +12 -753
  122. package/dist/templates/trellis/scripts/multi_agent/status_display.py +542 -0
  123. package/dist/templates/trellis/scripts/multi_agent/status_monitor.py +225 -0
  124. package/dist/templates/trellis/scripts/task.py +50 -975
  125. package/dist/templates/trellis/workflow.md +21 -34
  126. package/dist/types/migration.d.ts +3 -1
  127. package/dist/types/migration.d.ts.map +1 -1
  128. package/dist/utils/project-detector.d.ts +23 -0
  129. package/dist/utils/project-detector.d.ts.map +1 -1
  130. package/dist/utils/project-detector.js +364 -0
  131. package/dist/utils/project-detector.js.map +1 -1
  132. package/dist/utils/template-fetcher.d.ts +2 -2
  133. package/dist/utils/template-fetcher.d.ts.map +1 -1
  134. package/dist/utils/template-fetcher.js +5 -5
  135. package/dist/utils/template-fetcher.js.map +1 -1
  136. package/package.json +1 -1
  137. package/dist/templates/claude/commands/trellis/before-backend-dev.md +0 -13
  138. package/dist/templates/claude/commands/trellis/before-frontend-dev.md +0 -13
  139. package/dist/templates/claude/commands/trellis/check-backend.md +0 -13
  140. package/dist/templates/claude/commands/trellis/check-frontend.md +0 -13
  141. package/dist/templates/codex/skills/before-backend-dev/SKILL.md +0 -18
  142. package/dist/templates/codex/skills/before-frontend-dev/SKILL.md +0 -18
  143. package/dist/templates/codex/skills/check-backend/SKILL.md +0 -18
  144. package/dist/templates/codex/skills/check-frontend/SKILL.md +0 -18
  145. package/dist/templates/cursor/commands/trellis-before-backend-dev.md +0 -13
  146. package/dist/templates/cursor/commands/trellis-before-frontend-dev.md +0 -13
  147. package/dist/templates/cursor/commands/trellis-check-backend.md +0 -13
  148. package/dist/templates/cursor/commands/trellis-check-frontend.md +0 -13
  149. package/dist/templates/gemini/commands/trellis/before-backend-dev.toml +0 -17
  150. package/dist/templates/gemini/commands/trellis/before-frontend-dev.toml +0 -17
  151. package/dist/templates/gemini/commands/trellis/check-backend.toml +0 -17
  152. package/dist/templates/gemini/commands/trellis/check-frontend.toml +0 -17
  153. package/dist/templates/iflow/commands/trellis/before-backend-dev.md +0 -13
  154. package/dist/templates/iflow/commands/trellis/before-frontend-dev.md +0 -13
  155. package/dist/templates/iflow/commands/trellis/check-backend.md +0 -13
  156. package/dist/templates/iflow/commands/trellis/check-frontend.md +0 -13
  157. package/dist/templates/kilo/workflows/before-backend-dev.md +0 -13
  158. package/dist/templates/kilo/workflows/before-frontend-dev.md +0 -13
  159. package/dist/templates/kilo/workflows/check-backend.md +0 -13
  160. package/dist/templates/kilo/workflows/check-frontend.md +0 -13
  161. package/dist/templates/kiro/skills/before-backend-dev/SKILL.md +0 -18
  162. package/dist/templates/kiro/skills/before-frontend-dev/SKILL.md +0 -18
  163. package/dist/templates/kiro/skills/check-backend/SKILL.md +0 -18
  164. package/dist/templates/kiro/skills/check-frontend/SKILL.md +0 -18
  165. package/dist/templates/opencode/commands/trellis/before-backend-dev.md +0 -13
  166. package/dist/templates/opencode/commands/trellis/before-frontend-dev.md +0 -13
  167. package/dist/templates/opencode/commands/trellis/check-backend.md +0 -13
  168. package/dist/templates/opencode/commands/trellis/check-frontend.md +0 -13
  169. package/dist/templates/qoder/skills/before-backend-dev/SKILL.md +0 -18
  170. package/dist/templates/qoder/skills/before-frontend-dev/SKILL.md +0 -18
  171. package/dist/templates/qoder/skills/check-backend/SKILL.md +0 -18
  172. package/dist/templates/qoder/skills/check-frontend/SKILL.md +0 -18
@@ -126,13 +126,13 @@ AI needs the same onboarding - but compressed into seconds at session start.
126
126
 
127
127
  ---
128
128
 
129
- ### /trellis-before-frontend-dev and /trellis-before-backend-dev - Inject Specialized Knowledge
129
+ ### /trellis-before-dev - Inject Specialized Knowledge
130
130
 
131
131
  **WHY IT EXISTS**:
132
132
  AI models have "pre-trained knowledge" - general patterns from millions of codebases. But YOUR project has specific conventions that differ from generic patterns.
133
133
 
134
134
  **WHAT IT ACTUALLY DOES**:
135
- 1. Reads `.trellis/spec/frontend/` or `.trellis/spec/backend/`
135
+ 1. Discovers spec layers via `get_context.py --mode packages` and reads relevant guidelines
136
136
  2. Loads project-specific patterns into AI's working context:
137
137
  - Component naming conventions
138
138
  - State management patterns
@@ -140,12 +140,12 @@ AI models have "pre-trained knowledge" - general patterns from millions of codeb
140
140
  - Error handling standards
141
141
 
142
142
  **WHY THIS MATTERS**:
143
- - Without before-*-dev: AI writes generic code that doesn't match project style.
144
- - With before-*-dev: AI writes code that looks like the rest of the codebase.
143
+ - Without before-dev: AI writes generic code that doesn't match project style.
144
+ - With before-dev: AI writes code that looks like the rest of the codebase.
145
145
 
146
146
  ---
147
147
 
148
- ### /trellis-check-frontend and /trellis-check-backend - Combat Context Drift
148
+ ### /trellis-check - Combat Context Drift
149
149
 
150
150
  **WHY IT EXISTS**:
151
151
  AI context window has limited capacity. As conversation progresses, guidelines injected at session start become less influential. This causes "context drift."
@@ -211,9 +211,9 @@ All the context AI built during this session will be lost when session ends. The
211
211
 
212
212
  **[1/8] /trellis-start** - AI needs project context before touching code
213
213
  **[2/8] python3 ./.trellis/scripts/task.py create "Fix bug" --slug fix-bug** - Track work for future reference
214
- **[3/8] /trellis-before-frontend-dev** - Inject project-specific frontend knowledge
214
+ **[3/8] /trellis-before-dev** - Inject project-specific development guidelines
215
215
  **[4/8] Investigate and fix the bug** - Actual development work
216
- **[5/8] /trellis-check-frontend** - Re-verify code against guidelines
216
+ **[5/8] /trellis-check** - Re-verify code against guidelines
217
217
  **[6/8] /trellis-finish-work** - Holistic cross-layer review
218
218
  **[7/8] Human tests and commits** - Human validates before code enters repo
219
219
  **[8/8] /trellis-record-session** - Persist memory for future sessions
@@ -228,9 +228,9 @@ All the context AI built during this session will be lost when session ends. The
228
228
  ### Example 3: Code Review Fixes
229
229
 
230
230
  **[1/6] /trellis-start** - Resume context from previous session
231
- **[2/6] /trellis-before-backend-dev** - Re-inject guidelines before fixes
231
+ **[2/6] /trellis-before-dev** - Re-inject guidelines before fixes
232
232
  **[3/6] Fix each CR issue** - Address feedback with guidelines in context
233
- **[4/6] /trellis-check-backend** - Verify fixes didn't introduce new issues
233
+ **[4/6] /trellis-check** - Verify fixes did not introduce new issues
234
234
  **[5/6] /trellis-finish-work** - Document lessons from CR
235
235
  **[6/6] Human commits, then /trellis-record-session** - Preserve CR lessons
236
236
 
@@ -238,16 +238,16 @@ All the context AI built during this session will be lost when session ends. The
238
238
 
239
239
  **[1/5] /trellis-start** - Clear baseline before major changes
240
240
  **[2/5] Plan phases** - Break into verifiable chunks
241
- **[3/5] Execute phase by phase with /check-* after each** - Incremental verification
241
+ **[3/5] Execute phase by phase with /trellis-check after each** - Incremental verification
242
242
  **[4/5] /trellis-finish-work** - Check if new patterns should be documented
243
243
  **[5/5] Record with multiple commit hashes** - Link all commits to one feature
244
244
 
245
245
  ### Example 5: Debug Session
246
246
 
247
247
  **[1/6] /trellis-start** - See if this bug was investigated before
248
- **[2/6] /trellis-before-backend-dev** - Guidelines might document known gotchas
248
+ **[2/6] /trellis-before-dev** - Guidelines might document known gotchas
249
249
  **[3/6] Investigation** - Actual debugging work
250
- **[4/6] /trellis-check-backend** - Verify debug changes don't break other things
250
+ **[4/6] /trellis-check** - Verify debug changes do not break other things
251
251
  **[5/6] /trellis-finish-work** - Debug findings might need documentation
252
252
  **[6/6] Human commits, then /trellis-record-session** - Debug knowledge is valuable
253
253
 
@@ -256,7 +256,7 @@ All the context AI built during this session will be lost when session ends. The
256
256
  ## KEY RULES TO EMPHASIZE
257
257
 
258
258
  1. **AI NEVER commits** - Human tests and approves. AI prepares, human validates.
259
- 2. **Guidelines before code** - /before-*-dev commands inject project knowledge.
259
+ 2. **Guidelines before code** - /before-dev command injects project knowledge.
260
260
  3. **Check after code** - /check-* commands catch context drift.
261
261
  4. **Record everything** - /trellis-record-session persists memory.
262
262
 
@@ -31,7 +31,7 @@ python3 ./.trellis/scripts/add_session.py \
31
31
  --summary "Brief summary of what was done"
32
32
 
33
33
  # Method 2: Pass detailed content via stdin
34
- cat << 'EOF' | python3 ./.trellis/scripts/add_session.py --title "Title" --commit "hash"
34
+ cat << 'EOF' | python3 ./.trellis/scripts/add_session.py --stdin --title "Title" --commit "hash"
35
35
  | Feature | Description |
36
36
  |---------|-------------|
37
37
  | New API | Added user authentication endpoint |
@@ -38,24 +38,17 @@ This returns:
38
38
  - Active tasks
39
39
  - Journal file status
40
40
 
41
- ### Step 3: Read Project Code-Spec Index `[AI]`
41
+ ### Step 3: Read Guidelines Index `[AI]`
42
42
 
43
- Based on the upcoming task, read appropriate code-spec docs:
44
-
45
- **For Frontend Work**:
46
43
  ```bash
47
- cat .trellis/spec/frontend/index.md
44
+ python3 ./.trellis/scripts/get_context.py --mode packages
48
45
  ```
49
46
 
50
- **For Backend Work**:
51
- ```bash
52
- cat .trellis/spec/backend/index.md
53
- ```
47
+ This shows available packages and their spec layers. Read the relevant spec indexes:
54
48
 
55
- **For Cross-Layer Features**:
56
49
  ```bash
57
- cat .trellis/spec/guides/index.md
58
- cat .trellis/spec/guides/cross-layer-thinking-guide.md
50
+ cat .trellis/spec/<package>/<layer>/index.md # Package-specific guidelines
51
+ cat .trellis/spec/guides/index.md # Thinking guides (always read)
59
52
  ```
60
53
 
61
54
  > **Important**: The index files are navigation — they list the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`).
@@ -331,10 +324,8 @@ The following slash commands are for users (not AI):
331
324
  |---------|-------------|
332
325
  | `/trellis-start` | Start development session (this command) |
333
326
  | `/trellis-brainstorm` | Clarify vague requirements before implementation |
334
- | `/trellis-before-frontend-dev` | Read frontend guidelines |
335
- | `/trellis-before-backend-dev` | Read backend guidelines |
336
- | `/trellis-check-frontend` | Check frontend code |
337
- | `/trellis-check-backend` | Check backend code |
327
+ | `/trellis-before-dev` | Read development guidelines |
328
+ | `/trellis-check` | Check code quality |
338
329
  | `/trellis-check-cross-layer` | Cross-layer verification |
339
330
  | `/trellis-finish-work` | Pre-commit checklist |
340
331
  | `/trellis-record-session` | Record session progress |
@@ -0,0 +1,33 @@
1
+ description = "Read the relevant development guidelines before starting your task"
2
+
3
+ prompt = """
4
+ Read the relevant development guidelines before starting your task.
5
+
6
+ Execute these steps:
7
+
8
+ 1. **Discover packages and their spec layers**:
9
+ ```bash
10
+ python3 ./.trellis/scripts/get_context.py --mode packages
11
+ ```
12
+
13
+ 2. **Identify which specs apply** to your task based on:
14
+ - Which package you're modifying (e.g., `cli/`, `docs-site/`)
15
+ - What type of work (backend, frontend, unit-test, docs, etc.)
16
+
17
+ 3. **Read the spec index** for each relevant module:
18
+ ```bash
19
+ cat .trellis/spec/<package>/<layer>/index.md
20
+ ```
21
+ Follow the **"Pre-Development Checklist"** section in the index.
22
+
23
+ 4. **Read the specific guideline files** listed in the Pre-Development Checklist that are relevant to your task. The index is NOT the goal -> it points you to the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`). Read those files to understand the coding standards and patterns.
24
+
25
+ 5. **Always read shared guides**:
26
+ ```bash
27
+ cat .trellis/spec/guides/index.md
28
+ ```
29
+
30
+ 6. Understand the coding standards and patterns you need to follow, then proceed with your development plan.
31
+
32
+ This step is **mandatory** before writing any code.
33
+ """
@@ -0,0 +1,29 @@
1
+ description = "Check if the code you just wrote follows the development guidelines"
2
+
3
+ prompt = """
4
+ Check if the code you just wrote follows the development guidelines.
5
+
6
+ Execute these steps:
7
+
8
+ 1. **Identify changed files**:
9
+ ```bash
10
+ git diff --name-only HEAD
11
+ ```
12
+
13
+ 2. **Determine which spec modules apply** based on the changed file paths:
14
+ ```bash
15
+ python3 ./.trellis/scripts/get_context.py --mode packages
16
+ ```
17
+
18
+ 3. **Read the spec index** for each relevant module:
19
+ ```bash
20
+ cat .trellis/spec/<package>/<layer>/index.md
21
+ ```
22
+ Follow the **"Quality Check"** section in the index.
23
+
24
+ 4. **Read the specific guideline files** referenced in the Quality Check section (e.g., `quality-guidelines.md`, `conventions.md`). The index is NOT the goal -> it points you to the actual guideline files. Read those files and review your code against them.
25
+
26
+ 5. **Run lint and typecheck** for the affected package.
27
+
28
+ 6. **Report any violations** and fix them if found.
29
+ """
@@ -110,8 +110,8 @@ Description:
110
110
  | Command Type | Prefix | Example |
111
111
  |--------------|--------|---------|
112
112
  | Session Start | `start` | `start` |
113
- | Pre-development | `before-` | `before-frontend-dev` |
114
- | Check | `check-` | `check-frontend` |
113
+ | Pre-development | `before-` | `before-dev` |
114
+ | Check | `check-` | `check` |
115
115
  | Record | `record-` | `record-session` |
116
116
  | Generate | `generate-` | `generate-api-doc` |
117
117
  | Update | `update-` | `update-changelog` |
@@ -69,8 +69,8 @@ The `/check-*` commands re-verify code against guidelines AFTER writing, catchin
69
69
  ## COMMAND DEEP DIVE
70
70
 
71
71
  ### /trellis:start - Restore AI Memory
72
- ### /trellis:before-frontend-dev and /trellis:before-backend-dev - Inject Specialized Knowledge
73
- ### /trellis:check-frontend and /trellis:check-backend - Combat Context Drift
72
+ ### /trellis:before-dev - Inject Specialized Knowledge
73
+ ### /trellis:check - Combat Context Drift
74
74
  ### /trellis:check-cross-layer - Multi-Dimension Verification
75
75
  ### /trellis:finish-work - Holistic Pre-Commit Review
76
76
  ### /trellis:record-session - Persist Memory for Future
@@ -34,7 +34,7 @@ python3 ./.trellis/scripts/add_session.py \\
34
34
  --summary "Brief summary of what was done"
35
35
 
36
36
  # Method 2: Pass detailed content via stdin
37
- cat << 'EOF' | python3 ./.trellis/scripts/add_session.py --title "Title" --commit "hash"
37
+ cat << 'EOF' | python3 ./.trellis/scripts/add_session.py --stdin --title "Title" --commit "hash"
38
38
  | Feature | Description |
39
39
  |---------|-------------|
40
40
  | New API | Added user authentication endpoint |
@@ -43,12 +43,17 @@ This shows: developer identity, git status, current task (if any), active tasks.
43
43
  ### Step 3: Read Guidelines Index
44
44
 
45
45
  ```bash
46
- cat .trellis/spec/frontend/index.md # Frontend guidelines
47
- cat .trellis/spec/backend/index.md # Backend guidelines
48
- cat .trellis/spec/guides/index.md # Thinking guides
46
+ python3 ./.trellis/scripts/get_context.py --mode packages
49
47
  ```
50
48
 
51
- > **Important**: The index files are navigation they list the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`).
49
+ This shows available packages and their spec layers. Read the relevant spec indexes:
50
+
51
+ ```bash
52
+ cat .trellis/spec/<package>/<layer>/index.md # Package-specific guidelines
53
+ cat .trellis/spec/guides/index.md # Thinking guides (always read)
54
+ ```
55
+
56
+ > **Important**: The index files are navigation -- they list the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`).
52
57
  > At this step, just read the indexes to understand what's available.
53
58
  > When you start actual development, you MUST go back and read the specific guideline files relevant to your task, as listed in the index's Pre-Development Checklist.
54
59
 
@@ -99,8 +99,7 @@ Hook will auto-inject:
99
99
 
100
100
  - finish-work.md
101
101
  - check-cross-layer.md
102
- - check-backend.md
103
- - check-frontend.md
102
+ - check.md
104
103
  - All spec files from check.jsonl
105
104
 
106
105
  ### action: "debug"
@@ -41,9 +41,8 @@ Before implementing, read:
41
41
 
42
42
  Read relevant specs based on task type:
43
43
 
44
- - Backend: `.trellis/spec/backend/`
45
- - Frontend: `.trellis/spec/frontend/`
46
- - Guides: `.trellis/spec/guides/`
44
+ - Spec layers: `.trellis/spec/<package>/<layer>/`
45
+ - Shared guides: `.trellis/spec/guides/`
47
46
 
48
47
  ### 2. Understand Requirements
49
48
 
@@ -0,0 +1,29 @@
1
+ Read the relevant development guidelines before starting your task.
2
+
3
+ Execute these steps:
4
+
5
+ 1. **Discover packages and their spec layers**:
6
+ ```bash
7
+ python3 ./.trellis/scripts/get_context.py --mode packages
8
+ ```
9
+
10
+ 2. **Identify which specs apply** to your task based on:
11
+ - Which package you're modifying (e.g., `cli/`, `docs-site/`)
12
+ - What type of work (backend, frontend, unit-test, docs, etc.)
13
+
14
+ 3. **Read the spec index** for each relevant module:
15
+ ```bash
16
+ cat .trellis/spec/<package>/<layer>/index.md
17
+ ```
18
+ Follow the **"Pre-Development Checklist"** section in the index.
19
+
20
+ 4. **Read the specific guideline files** listed in the Pre-Development Checklist that are relevant to your task. The index is NOT the goal — it points you to the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`). Read those files to understand the coding standards and patterns.
21
+
22
+ 5. **Always read shared guides**:
23
+ ```bash
24
+ cat .trellis/spec/guides/index.md
25
+ ```
26
+
27
+ 6. Understand the coding standards and patterns you need to follow, then proceed with your development plan.
28
+
29
+ This step is **mandatory** before writing any code.
@@ -0,0 +1,25 @@
1
+ Check if the code you just wrote follows the development guidelines.
2
+
3
+ Execute these steps:
4
+
5
+ 1. **Identify changed files**:
6
+ ```bash
7
+ git diff --name-only HEAD
8
+ ```
9
+
10
+ 2. **Determine which spec modules apply** based on the changed file paths:
11
+ ```bash
12
+ python3 ./.trellis/scripts/get_context.py --mode packages
13
+ ```
14
+
15
+ 3. **Read the spec index** for each relevant module:
16
+ ```bash
17
+ cat .trellis/spec/<package>/<layer>/index.md
18
+ ```
19
+ Follow the **"Quality Check"** section in the index.
20
+
21
+ 4. **Read the specific guideline files** referenced in the Quality Check section (e.g., `quality-guidelines.md`, `conventions.md`). The index is NOT the goal — it points you to the actual guideline files. Read those files and review your code against them.
22
+
23
+ 5. **Run lint and typecheck** for the affected package.
24
+
25
+ 6. **Report any violations** and fix them if found.
@@ -99,8 +99,8 @@ Description:
99
99
  | Command Type | Prefix | Example |
100
100
  |--------------|--------|---------|
101
101
  | Session Start | `start` | `start` |
102
- | Pre-development | `before-` | `before-frontend-dev` |
103
- | Check | `check-` | `check-frontend` |
102
+ | Pre-development | `before-` | `before-dev` |
103
+ | Check | `check-` | `check` |
104
104
  | Record | `record-` | `record-session` |
105
105
  | Generate | `generate-` | `generate-api-doc` |
106
106
  | Update | `update-` | `update-changelog` |
@@ -126,13 +126,13 @@ AI needs the same onboarding - but compressed into seconds at session start.
126
126
 
127
127
  ---
128
128
 
129
- ### /trellis:before-frontend-dev and /trellis:before-backend-dev - Inject Specialized Knowledge
129
+ ### /trellis:before-dev - Inject Specialized Knowledge
130
130
 
131
131
  **WHY IT EXISTS**:
132
132
  AI models have "pre-trained knowledge" - general patterns from millions of codebases. But YOUR project has specific conventions that differ from generic patterns.
133
133
 
134
134
  **WHAT IT ACTUALLY DOES**:
135
- 1. Reads `.trellis/spec/frontend/` or `.trellis/spec/backend/`
135
+ 1. Discovers spec layers via `get_context.py --mode packages` and reads relevant guidelines
136
136
  2. Loads project-specific patterns into AI's working context:
137
137
  - Component naming conventions
138
138
  - State management patterns
@@ -140,12 +140,12 @@ AI models have "pre-trained knowledge" - general patterns from millions of codeb
140
140
  - Error handling standards
141
141
 
142
142
  **WHY THIS MATTERS**:
143
- - Without before-*-dev: AI writes generic code that doesn't match project style.
144
- - With before-*-dev: AI writes code that looks like the rest of the codebase.
143
+ - Without before-dev: AI writes generic code that doesn't match project style.
144
+ - With before-dev: AI writes code that looks like the rest of the codebase.
145
145
 
146
146
  ---
147
147
 
148
- ### /trellis:check-frontend and /trellis:check-backend - Combat Context Drift
148
+ ### /trellis:check - Combat Context Drift
149
149
 
150
150
  **WHY IT EXISTS**:
151
151
  AI context window has limited capacity. As conversation progresses, guidelines injected at session start become less influential. This causes "context drift."
@@ -211,9 +211,9 @@ All the context AI built during this session will be lost when session ends. The
211
211
 
212
212
  **[1/8] /trellis:start** - AI needs project context before touching code
213
213
  **[2/8] python3 ./.trellis/scripts/task.py create "Fix bug" --slug fix-bug** - Track work for future reference
214
- **[3/8] /trellis:before-frontend-dev** - Inject project-specific frontend knowledge
214
+ **[3/8] /trellis:before-dev** - Inject project-specific development guidelines
215
215
  **[4/8] Investigate and fix the bug** - Actual development work
216
- **[5/8] /trellis:check-frontend** - Re-verify code against guidelines
216
+ **[5/8] /trellis:check** - Re-verify code against guidelines
217
217
  **[6/8] /trellis:finish-work** - Holistic cross-layer review
218
218
  **[7/8] Human tests and commits** - Human validates before code enters repo
219
219
  **[8/8] /trellis:record-session** - Persist memory for future sessions
@@ -228,9 +228,9 @@ All the context AI built during this session will be lost when session ends. The
228
228
  ### Example 3: Code Review Fixes
229
229
 
230
230
  **[1/6] /trellis:start** - Resume context from previous session
231
- **[2/6] /trellis:before-backend-dev** - Re-inject guidelines before fixes
231
+ **[2/6] /trellis:before-dev** - Re-inject guidelines before fixes
232
232
  **[3/6] Fix each CR issue** - Address feedback with guidelines in context
233
- **[4/6] /trellis:check-backend** - Verify fixes didn't introduce new issues
233
+ **[4/6] /trellis:check** - Verify fixes did not introduce new issues
234
234
  **[5/6] /trellis:finish-work** - Document lessons from CR
235
235
  **[6/6] Human commits, then /trellis:record-session** - Preserve CR lessons
236
236
 
@@ -238,16 +238,16 @@ All the context AI built during this session will be lost when session ends. The
238
238
 
239
239
  **[1/5] /trellis:start** - Clear baseline before major changes
240
240
  **[2/5] Plan phases** - Break into verifiable chunks
241
- **[3/5] Execute phase by phase with /check-* after each** - Incremental verification
241
+ **[3/5] Execute phase by phase with /trellis:check after each** - Incremental verification
242
242
  **[4/5] /trellis:finish-work** - Check if new patterns should be documented
243
243
  **[5/5] Record with multiple commit hashes** - Link all commits to one feature
244
244
 
245
245
  ### Example 5: Debug Session
246
246
 
247
247
  **[1/6] /trellis:start** - See if this bug was investigated before
248
- **[2/6] /trellis:before-backend-dev** - Guidelines might document known gotchas
248
+ **[2/6] /trellis:before-dev** - Guidelines might document known gotchas
249
249
  **[3/6] Investigation** - Actual debugging work
250
- **[4/6] /trellis:check-backend** - Verify debug changes don't break other things
250
+ **[4/6] /trellis:check** - Verify debug changes do not break other things
251
251
  **[5/6] /trellis:finish-work** - Debug findings might need documentation
252
252
  **[6/6] Human commits, then /trellis:record-session** - Debug knowledge is valuable
253
253
 
@@ -256,7 +256,7 @@ All the context AI built during this session will be lost when session ends. The
256
256
  ## KEY RULES TO EMPHASIZE
257
257
 
258
258
  1. **AI NEVER commits** - Human tests and approves. AI prepares, human validates.
259
- 2. **Guidelines before code** - /before-*-dev commands inject project knowledge.
259
+ 2. **Guidelines before code** - /before-dev command injects project knowledge.
260
260
  3. **Check after code** - /check-* commands catch context drift.
261
261
  4. **Record everything** - /trellis:record-session persists memory.
262
262
 
@@ -41,8 +41,7 @@ python3 ./.trellis/scripts/get_context.py
41
41
  ### Step 3: Read Project Guidelines `[AI]`
42
42
 
43
43
  ```bash
44
- cat .trellis/spec/frontend/index.md # Frontend guidelines index
45
- cat .trellis/spec/backend/index.md # Backend guidelines index
44
+ python3 ./.trellis/scripts/get_context.py --mode packages # Discover available spec layers
46
45
  cat .trellis/spec/guides/index.md # Thinking guides
47
46
  ```
48
47
 
@@ -31,7 +31,7 @@ python3 ./.trellis/scripts/add_session.py \
31
31
  --summary "Brief summary of what was done"
32
32
 
33
33
  # Method 2: Pass detailed content via stdin
34
- cat << 'EOF' | python3 ./.trellis/scripts/add_session.py --title "Title" --commit "hash"
34
+ cat << 'EOF' | python3 ./.trellis/scripts/add_session.py --stdin --title "Title" --commit "hash"
35
35
  | Feature | Description |
36
36
  |---------|-------------|
37
37
  | New API | Added user authentication endpoint |
@@ -40,10 +40,14 @@ This shows: developer identity, git status, current task (if any), active tasks.
40
40
  ### Step 3: Read Guidelines Index
41
41
 
42
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
- cat .trellis/spec/unit-test/index.md # Testing guidelines
43
+ python3 ./.trellis/scripts/get_context.py --mode packages
44
+ ```
45
+
46
+ This shows available packages and their spec layers. Read the relevant spec indexes:
47
+
48
+ ```bash
49
+ cat .trellis/spec/<package>/<layer>/index.md # Package-specific guidelines
50
+ cat .trellis/spec/guides/index.md # Thinking guides (always read)
47
51
  ```
48
52
 
49
53
  > **Important**: The index files are navigation — they list the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`).
@@ -339,8 +339,7 @@ def get_check_context(repo_root: str, task_dir: str) -> str:
339
339
  check_files = [
340
340
  (".iflow/commands/trellis/finish-work.md", "Finish work checklist"),
341
341
  (".iflow/commands/trellis/check-cross-layer.md", "Cross-layer check spec"),
342
- (".iflow/commands/trellis/check-backend.md", "Backend check spec"),
343
- (".iflow/commands/trellis/check-frontend.md", "Frontend check spec"),
342
+ (".iflow/commands/trellis/check.md", "Code quality check spec"),
344
343
  ]
345
344
  for file_path, description in check_files:
346
345
  content = read_file_content(repo_root, file_path)
@@ -432,8 +431,7 @@ def get_debug_context(repo_root: str, task_dir: str) -> str:
432
431
  context_parts.append(f"=== {file_path} (Dev spec) ===\n{content}")
433
432
 
434
433
  check_files = [
435
- (".iflow/commands/trellis/check-backend.md", "Backend check spec"),
436
- (".iflow/commands/trellis/check-frontend.md", "Frontend check spec"),
434
+ (".iflow/commands/trellis/check.md", "Code quality check spec"),
437
435
  (".iflow/commands/trellis/check-cross-layer.md", "Cross-layer check spec"),
438
436
  ]
439
437
  for file_path, description in check_files:
@@ -603,24 +601,34 @@ def get_research_context(repo_root: str, task_dir: str | None) -> str:
603
601
  """
604
602
  context_parts = []
605
603
 
606
- # 1. Project structure overview (uses constants for paths)
604
+ # 1. Project structure overview (dynamically discover spec directories)
607
605
  spec_path = f"{DIR_WORKFLOW}/{DIR_SPEC}"
606
+ spec_root = Path(repo_root) / DIR_WORKFLOW / DIR_SPEC
607
+
608
+ # Build spec tree dynamically
609
+ tree_lines = [f"{spec_path}/"]
610
+ if spec_root.is_dir():
611
+ pkg_dirs = sorted(d for d in spec_root.iterdir() if d.is_dir())
612
+ for i, pkg_dir in enumerate(pkg_dirs):
613
+ is_last = i == len(pkg_dirs) - 1
614
+ prefix = "└── " if is_last else "├── "
615
+ layers = sorted(d.name for d in pkg_dir.iterdir() if d.is_dir())
616
+ layer_info = f" ({', '.join(layers)})" if layers else ""
617
+ tree_lines.append(f"{prefix}{pkg_dir.name}/{layer_info}")
618
+
619
+ spec_tree = "\n".join(tree_lines)
620
+
608
621
  project_structure = f"""## Project Spec Directory Structure
609
622
 
610
623
  ```
611
- {spec_path}/
612
- ├── shared/ # Cross-project common specs (TypeScript, code quality, git)
613
- ├── frontend/ # Frontend standards
614
- ├── backend/ # Backend standards
615
- └── guides/ # Thinking guides (cross-layer, code reuse, etc.)
616
-
617
- {DIR_WORKFLOW}/big-question/ # Known issues and pitfalls
624
+ {spec_tree}
618
625
  ```
619
626
 
627
+ To get structured package info, run: `python3 ./{DIR_WORKFLOW}/scripts/get_context.py --mode packages`
628
+
620
629
  ## Search Tips
621
630
 
622
631
  - Spec files: `{spec_path}/**/*.md`
623
- - Known issues: `{DIR_WORKFLOW}/big-question/`
624
632
  - Code search: Use Glob and Grep tools
625
633
  - Tech solutions: Use mcp__exa__web_search_exa or mcp__exa__get_code_context_exa"""
626
634