@mindfoldhq/trellis 0.3.10-beta.0 → 0.3.10

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 (173) hide show
  1. package/dist/cli/index.js +0 -2
  2. package/dist/cli/index.js.map +1 -1
  3. package/dist/commands/init.d.ts +0 -1
  4. package/dist/commands/init.d.ts.map +1 -1
  5. package/dist/commands/init.js +31 -203
  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 +6 -154
  9. package/dist/commands/update.js.map +1 -1
  10. package/dist/configurators/workflow.d.ts +2 -6
  11. package/dist/configurators/workflow.d.ts.map +1 -1
  12. package/dist/configurators/workflow.js +58 -88
  13. package/dist/configurators/workflow.js.map +1 -1
  14. package/dist/migrations/index.d.ts +0 -1
  15. package/dist/migrations/index.d.ts.map +1 -1
  16. package/dist/migrations/index.js +0 -2
  17. package/dist/migrations/index.js.map +1 -1
  18. package/dist/migrations/manifests/0.3.10.json +9 -0
  19. package/dist/templates/claude/agents/dispatch.md +2 -1
  20. package/dist/templates/claude/agents/implement.md +3 -2
  21. package/dist/templates/claude/commands/trellis/before-backend-dev.md +13 -0
  22. package/dist/templates/claude/commands/trellis/before-frontend-dev.md +13 -0
  23. package/dist/templates/claude/commands/trellis/check-backend.md +13 -0
  24. package/dist/templates/claude/commands/trellis/check-frontend.md +13 -0
  25. package/dist/templates/claude/commands/trellis/create-command.md +2 -2
  26. package/dist/templates/claude/commands/trellis/onboard.md +13 -13
  27. package/dist/templates/claude/commands/trellis/parallel.md +2 -1
  28. package/dist/templates/claude/commands/trellis/record-session.md +2 -2
  29. package/dist/templates/claude/commands/trellis/start.md +4 -8
  30. package/dist/templates/claude/hooks/inject-subagent-context.py +13 -21
  31. package/dist/templates/claude/hooks/session-start.py +2 -170
  32. package/dist/templates/codex/skills/before-backend-dev/SKILL.md +18 -0
  33. package/dist/templates/codex/skills/before-frontend-dev/SKILL.md +18 -0
  34. package/dist/templates/codex/skills/check-backend/SKILL.md +18 -0
  35. package/dist/templates/codex/skills/check-frontend/SKILL.md +18 -0
  36. package/dist/templates/codex/skills/create-command/SKILL.md +2 -2
  37. package/dist/templates/codex/skills/onboard/SKILL.md +11 -11
  38. package/dist/templates/codex/skills/record-session/SKILL.md +2 -2
  39. package/dist/templates/codex/skills/start/SKILL.md +3 -8
  40. package/dist/templates/cursor/commands/trellis-before-backend-dev.md +13 -0
  41. package/dist/templates/cursor/commands/trellis-before-frontend-dev.md +13 -0
  42. package/dist/templates/cursor/commands/trellis-check-backend.md +13 -0
  43. package/dist/templates/cursor/commands/trellis-check-frontend.md +13 -0
  44. package/dist/templates/cursor/commands/trellis-create-command.md +2 -2
  45. package/dist/templates/cursor/commands/trellis-onboard.md +13 -13
  46. package/dist/templates/cursor/commands/trellis-record-session.md +2 -2
  47. package/dist/templates/cursor/commands/trellis-start.md +16 -7
  48. package/dist/templates/gemini/commands/trellis/before-backend-dev.toml +17 -0
  49. package/dist/templates/gemini/commands/trellis/before-frontend-dev.toml +17 -0
  50. package/dist/templates/gemini/commands/trellis/check-backend.toml +17 -0
  51. package/dist/templates/gemini/commands/trellis/check-frontend.toml +17 -0
  52. package/dist/templates/gemini/commands/trellis/create-command.toml +2 -2
  53. package/dist/templates/gemini/commands/trellis/onboard.toml +2 -2
  54. package/dist/templates/gemini/commands/trellis/record-session.toml +2 -2
  55. package/dist/templates/gemini/commands/trellis/start.toml +4 -9
  56. package/dist/templates/iflow/agents/dispatch.md +2 -1
  57. package/dist/templates/iflow/agents/implement.md +3 -2
  58. package/dist/templates/iflow/commands/trellis/before-backend-dev.md +13 -0
  59. package/dist/templates/iflow/commands/trellis/before-frontend-dev.md +13 -0
  60. package/dist/templates/iflow/commands/trellis/check-backend.md +13 -0
  61. package/dist/templates/iflow/commands/trellis/check-frontend.md +13 -0
  62. package/dist/templates/iflow/commands/trellis/create-command.md +2 -2
  63. package/dist/templates/iflow/commands/trellis/onboard.md +13 -13
  64. package/dist/templates/iflow/commands/trellis/parallel.md +2 -1
  65. package/dist/templates/iflow/commands/trellis/record-session.md +2 -2
  66. package/dist/templates/iflow/commands/trellis/start.md +4 -8
  67. package/dist/templates/iflow/hooks/inject-subagent-context.py +13 -21
  68. package/dist/templates/iflow/hooks/session-start.py +1 -156
  69. package/dist/templates/kilo/workflows/before-backend-dev.md +13 -0
  70. package/dist/templates/kilo/workflows/before-frontend-dev.md +13 -0
  71. package/dist/templates/kilo/workflows/check-backend.md +13 -0
  72. package/dist/templates/kilo/workflows/check-frontend.md +13 -0
  73. package/dist/templates/kilo/workflows/create-command.md +2 -2
  74. package/dist/templates/kilo/workflows/onboard.md +13 -13
  75. package/dist/templates/kilo/workflows/parallel.md +2 -1
  76. package/dist/templates/kilo/workflows/record-session.md +2 -2
  77. package/dist/templates/kilo/workflows/start.md +3 -8
  78. package/dist/templates/kiro/skills/before-backend-dev/SKILL.md +18 -0
  79. package/dist/templates/kiro/skills/before-frontend-dev/SKILL.md +18 -0
  80. package/dist/templates/kiro/skills/check-backend/SKILL.md +18 -0
  81. package/dist/templates/kiro/skills/check-frontend/SKILL.md +18 -0
  82. package/dist/templates/kiro/skills/create-command/SKILL.md +2 -2
  83. package/dist/templates/kiro/skills/onboard/SKILL.md +11 -11
  84. package/dist/templates/kiro/skills/record-session/SKILL.md +2 -2
  85. package/dist/templates/kiro/skills/start/SKILL.md +3 -8
  86. package/dist/templates/markdown/spec/backend/script-conventions.md +0 -93
  87. package/dist/templates/opencode/agents/dispatch.md +2 -1
  88. package/dist/templates/opencode/agents/implement.md +2 -2
  89. package/dist/templates/opencode/agents/research.md +2 -1
  90. package/dist/templates/opencode/commands/trellis/before-backend-dev.md +13 -0
  91. package/dist/templates/opencode/commands/trellis/before-frontend-dev.md +13 -0
  92. package/dist/templates/opencode/commands/trellis/check-backend.md +13 -0
  93. package/dist/templates/opencode/commands/trellis/check-frontend.md +13 -0
  94. package/dist/templates/opencode/commands/trellis/create-command.md +2 -2
  95. package/dist/templates/opencode/commands/trellis/onboard.md +13 -13
  96. package/dist/templates/opencode/commands/trellis/parallel.md +2 -1
  97. package/dist/templates/opencode/commands/trellis/record-session.md +2 -2
  98. package/dist/templates/opencode/commands/trellis/start.md +3 -8
  99. package/dist/templates/opencode/plugin/inject-subagent-context.js +18 -45
  100. package/dist/templates/opencode/plugin/session-start.js +1 -149
  101. package/dist/templates/qoder/skills/before-backend-dev/SKILL.md +18 -0
  102. package/dist/templates/qoder/skills/before-frontend-dev/SKILL.md +18 -0
  103. package/dist/templates/qoder/skills/check-backend/SKILL.md +18 -0
  104. package/dist/templates/qoder/skills/check-frontend/SKILL.md +18 -0
  105. package/dist/templates/qoder/skills/create-command/SKILL.md +2 -2
  106. package/dist/templates/qoder/skills/onboard/SKILL.md +13 -13
  107. package/dist/templates/qoder/skills/record-session/SKILL.md +2 -2
  108. package/dist/templates/qoder/skills/start/SKILL.md +3 -8
  109. package/dist/templates/trellis/config.yaml +0 -20
  110. package/dist/templates/trellis/index.d.ts +0 -11
  111. package/dist/templates/trellis/index.d.ts.map +1 -1
  112. package/dist/templates/trellis/index.js +0 -22
  113. package/dist/templates/trellis/index.js.map +1 -1
  114. package/dist/templates/trellis/scripts/add_session.py +7 -52
  115. package/dist/templates/trellis/scripts/common/cli_adapter.py +45 -33
  116. package/dist/templates/trellis/scripts/common/config.py +0 -152
  117. package/dist/templates/trellis/scripts/common/git_context.py +586 -23
  118. package/dist/templates/trellis/scripts/common/paths.py +0 -46
  119. package/dist/templates/trellis/scripts/common/phase.py +49 -50
  120. package/dist/templates/trellis/scripts/common/registry.py +72 -41
  121. package/dist/templates/trellis/scripts/common/task_queue.py +98 -27
  122. package/dist/templates/trellis/scripts/common/task_utils.py +6 -96
  123. package/dist/templates/trellis/scripts/create_bootstrap.py +26 -31
  124. package/dist/templates/trellis/scripts/multi_agent/cleanup.py +48 -43
  125. package/dist/templates/trellis/scripts/multi_agent/create_pr.py +45 -336
  126. package/dist/templates/trellis/scripts/multi_agent/plan.py +26 -2
  127. package/dist/templates/trellis/scripts/multi_agent/start.py +57 -126
  128. package/dist/templates/trellis/scripts/multi_agent/status.py +753 -12
  129. package/dist/templates/trellis/scripts/task.py +975 -50
  130. package/dist/templates/trellis/workflow.md +34 -21
  131. package/dist/types/migration.d.ts +1 -3
  132. package/dist/types/migration.d.ts.map +1 -1
  133. package/dist/utils/project-detector.d.ts +0 -23
  134. package/dist/utils/project-detector.d.ts.map +1 -1
  135. package/dist/utils/project-detector.js +0 -364
  136. package/dist/utils/project-detector.js.map +1 -1
  137. package/dist/utils/template-fetcher.d.ts +10 -2
  138. package/dist/utils/template-fetcher.d.ts.map +1 -1
  139. package/dist/utils/template-fetcher.js +43 -12
  140. package/dist/utils/template-fetcher.js.map +1 -1
  141. package/package.json +1 -1
  142. package/dist/migrations/manifests/0.4.0-beta.1.json +0 -228
  143. package/dist/templates/claude/commands/trellis/before-dev.md +0 -29
  144. package/dist/templates/claude/commands/trellis/check.md +0 -25
  145. package/dist/templates/codex/skills/before-dev/SKILL.md +0 -34
  146. package/dist/templates/codex/skills/check/SKILL.md +0 -30
  147. package/dist/templates/cursor/commands/trellis-before-dev.md +0 -29
  148. package/dist/templates/cursor/commands/trellis-check.md +0 -25
  149. package/dist/templates/gemini/commands/trellis/before-dev.toml +0 -33
  150. package/dist/templates/gemini/commands/trellis/check.toml +0 -29
  151. package/dist/templates/iflow/commands/trellis/before-dev.md +0 -29
  152. package/dist/templates/iflow/commands/trellis/check.md +0 -25
  153. package/dist/templates/kilo/workflows/before-dev.md +0 -29
  154. package/dist/templates/kilo/workflows/check.md +0 -25
  155. package/dist/templates/kiro/skills/before-dev/SKILL.md +0 -34
  156. package/dist/templates/kiro/skills/check/SKILL.md +0 -30
  157. package/dist/templates/opencode/commands/trellis/before-dev.md +0 -29
  158. package/dist/templates/opencode/commands/trellis/check.md +0 -25
  159. package/dist/templates/qoder/skills/before-dev/SKILL.md +0 -34
  160. package/dist/templates/qoder/skills/check/SKILL.md +0 -30
  161. package/dist/templates/trellis/scripts/common/git.py +0 -31
  162. package/dist/templates/trellis/scripts/common/io.py +0 -37
  163. package/dist/templates/trellis/scripts/common/log.py +0 -45
  164. package/dist/templates/trellis/scripts/common/packages_context.py +0 -233
  165. package/dist/templates/trellis/scripts/common/session_context.py +0 -466
  166. package/dist/templates/trellis/scripts/common/task_context.py +0 -384
  167. package/dist/templates/trellis/scripts/common/task_store.py +0 -534
  168. package/dist/templates/trellis/scripts/common/tasks.py +0 -109
  169. package/dist/templates/trellis/scripts/common/types.py +0 -112
  170. package/dist/templates/trellis/scripts/hooks/linear_sync.py +0 -243
  171. package/dist/templates/trellis/scripts/multi_agent/_bootstrap.py +0 -17
  172. package/dist/templates/trellis/scripts/multi_agent/status_display.py +0 -542
  173. package/dist/templates/trellis/scripts/multi_agent/status_monitor.py +0 -225
@@ -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-dev - Inject Specialized Knowledge
129
+ ### /trellis:before-frontend-dev and /trellis:before-backend-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. Discovers spec layers via `get_context.py --mode packages` and reads relevant guidelines
135
+ 1. Reads `.trellis/spec/frontend/` or `.trellis/spec/backend/`
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 - Combat Context Drift
148
+ ### /trellis:check-frontend and /trellis:check-backend - 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-dev** - Inject project-specific development guidelines
214
+ **[3/8] /trellis:before-frontend-dev** - Inject project-specific frontend knowledge
215
215
  **[4/8] Investigate and fix the bug** - Actual development work
216
- **[5/8] /trellis:check** - Re-verify code against guidelines
216
+ **[5/8] /trellis:check-frontend** - 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-dev** - Re-inject guidelines before fixes
231
+ **[2/6] /trellis:before-backend-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** - Verify fixes did not introduce new issues
233
+ **[4/6] /trellis:check-backend** - Verify fixes didn't 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 /trellis:check after each** - Incremental verification
241
+ **[3/5] Execute phase by phase with /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-dev** - Guidelines might document known gotchas
248
+ **[2/6] /trellis:before-backend-dev** - Guidelines might document known gotchas
249
249
  **[3/6] Investigation** - Actual debugging work
250
- **[4/6] /trellis:check** - Verify debug changes do not break other things
250
+ **[4/6] /trellis:check-backend** - Verify debug changes don't 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 command injects project knowledge.
259
+ 2. **Guidelines before code** - /before-*-dev commands inject 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,7 +41,8 @@ python3 ./.trellis/scripts/get_context.py
41
41
  ### Step 3: Read Project Guidelines `[AI]`
42
42
 
43
43
  ```bash
44
- python3 ./.trellis/scripts/get_context.py --mode packages # Discover available spec layers
44
+ cat .trellis/spec/frontend/index.md # Frontend guidelines index
45
+ cat .trellis/spec/backend/index.md # Backend guidelines index
45
46
  cat .trellis/spec/guides/index.md # Thinking guides
46
47
  ```
47
48
 
@@ -1,6 +1,6 @@
1
1
  [!] **Prerequisite**: This command should only be used AFTER the human has tested and committed the code.
2
2
 
3
- **AI must NOT execute git commit** - only read history (`git log`, `git status`, `git diff`).
3
+ **Do NOT run `git commit` directly** the scripts below handle their own commits for `.trellis/` metadata. You only need to read git history (`git log`, `git status`, `git diff`) and run the Python scripts.
4
4
 
5
5
  ---
6
6
 
@@ -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 --stdin --title "Title" --commit "hash"
34
+ cat << 'EOF' | python3 ./.trellis/scripts/add_session.py --title "Title" --commit "hash"
35
35
  | Feature | Description |
36
36
  |---------|-------------|
37
37
  | New API | Added user authentication endpoint |
@@ -40,14 +40,9 @@ 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
- 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)
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
51
46
  ```
52
47
 
53
48
  > **Important**: The index files are navigation — they list the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`).
@@ -9,7 +9,7 @@
9
9
  * - Otherwise, this plugin handles injection
10
10
  */
11
11
 
12
- import { existsSync, writeFileSync, readdirSync } from "fs"
12
+ import { existsSync, writeFileSync } from "fs"
13
13
  import { join } from "path"
14
14
  import { TrellisContext, debugLog } from "../lib/trellis-context.js"
15
15
 
@@ -119,7 +119,8 @@ function getCheckContext(ctx, taskDir) {
119
119
  const checkFiles = [
120
120
  [".opencode/commands/trellis/finish-work.md", "Finish work checklist"],
121
121
  [".opencode/commands/trellis/check-cross-layer.md", "Cross-layer check spec"],
122
- [".opencode/commands/trellis/check.md", "Check spec"],
122
+ [".opencode/commands/trellis/check-backend.md", "Backend check spec"],
123
+ [".opencode/commands/trellis/check-frontend.md", "Frontend check spec"],
123
124
  ]
124
125
  for (const [f, description] of checkFiles) {
125
126
  const content = ctx.readProjectFile(f)
@@ -201,7 +202,8 @@ function getDebugContext(ctx, taskDir) {
201
202
  }
202
203
 
203
204
  const checkFiles = [
204
- [".opencode/commands/trellis/check.md", "Check spec"],
205
+ [".opencode/commands/trellis/check-backend.md", "Backend check spec"],
206
+ [".opencode/commands/trellis/check-frontend.md", "Frontend check spec"],
205
207
  [".opencode/commands/trellis/check-cross-layer.md", "Cross-layer check spec"],
206
208
  ]
207
209
  for (const [f, description] of checkFiles) {
@@ -227,46 +229,17 @@ function getDebugContext(ctx, taskDir) {
227
229
  function getResearchContext(ctx, taskDir) {
228
230
  const parts = []
229
231
 
230
- // Dynamic project structure (scan actual spec directory)
231
- const specPath = ".trellis/spec"
232
- const specFull = join(ctx.directory, specPath)
233
-
234
- const structureLines = [`## Project Spec Directory Structure\n\n\`\`\`\n${specPath}/`]
235
- if (existsSync(specFull)) {
236
- try {
237
- const entries = readdirSync(specFull, { withFileTypes: true })
238
- .filter(d => d.isDirectory() && !d.name.startsWith("."))
239
- .sort((a, b) => a.name.localeCompare(b.name))
240
-
241
- for (const entry of entries) {
242
- const entryPath = join(specFull, entry.name)
243
- // Check if this is a direct spec layer (has index.md)
244
- if (existsSync(join(entryPath, "index.md"))) {
245
- structureLines.push(`├── ${entry.name}/`)
246
- } else {
247
- // Check for nested package dirs (monorepo)
248
- try {
249
- const nested = readdirSync(entryPath, { withFileTypes: true })
250
- .filter(d => d.isDirectory() && existsSync(join(entryPath, d.name, "index.md")))
251
- .sort((a, b) => a.name.localeCompare(b.name))
252
- if (nested.length > 0) {
253
- structureLines.push(`├── ${entry.name}/`)
254
- for (const n of nested) {
255
- structureLines.push(`│ ├── ${n.name}/`)
256
- }
257
- }
258
- } catch {
259
- // Ignore nested read errors
260
- }
261
- }
262
- }
263
- } catch {
264
- // Ignore read errors
265
- }
266
- }
267
- structureLines.push("```")
232
+ parts.push(`## Project Spec Directory Structure
233
+
234
+ \`\`\`
235
+ .trellis/spec/
236
+ ├── shared/ # Cross-project common specs
237
+ ├── frontend/ # Frontend standards
238
+ ├── backend/ # Backend standards
239
+ └── guides/ # Thinking guides
268
240
 
269
- parts.push(structureLines.join("\n") + `
241
+ .trellis/big-question/ # Known issues and pitfalls
242
+ \`\`\`
270
243
 
271
244
  ## Search Tips
272
245
 
@@ -277,10 +250,10 @@ function getResearchContext(ctx, taskDir) {
277
250
 
278
251
  if (taskDir) {
279
252
  const jsonlPath = join(ctx.directory, taskDir, "research.jsonl")
280
- const researchEntries = ctx.readJsonlWithFiles(jsonlPath)
281
- if (researchEntries.length > 0) {
253
+ const entries = ctx.readJsonlWithFiles(jsonlPath)
254
+ if (entries.length > 0) {
282
255
  parts.push("\n## Additional Search Context\n")
283
- parts.push(ctx.buildContextFromEntries(researchEntries))
256
+ parts.push(ctx.buildContextFromEntries(entries))
284
257
  }
285
258
  }
286
259
 
@@ -12,12 +12,8 @@
12
12
 
13
13
  import { existsSync, readFileSync, readdirSync, statSync } from "fs"
14
14
  import { join } from "path"
15
- import { execFileSync } from "child_process"
16
- import { platform } from "os"
17
15
  import { TrellisContext, contextCollector, debugLog } from "../lib/trellis-context.js"
18
16
 
19
- const PYTHON_CMD = platform() === "win32" ? "python" : "python3"
20
-
21
17
 
22
18
  /**
23
19
  * Check current task status and return structured status string.
@@ -105,124 +101,6 @@ function getTaskStatus(directory) {
105
101
  return `Status: READY\nTask: ${taskTitle}\nNext: Continue with implement or check`
106
102
  }
107
103
 
108
- /**
109
- * Load Trellis config for session-start decisions.
110
- * Calls get_context.py --mode packages --json for reliable config data.
111
- */
112
- function loadTrellisConfig(directory) {
113
- const scriptPath = join(directory, ".trellis", "scripts", "get_context.py")
114
- if (!existsSync(scriptPath)) {
115
- return { isMonorepo: false, packages: {}, specScope: null, activeTaskPackage: null, defaultPackage: null }
116
- }
117
- try {
118
- const output = execFileSync(PYTHON_CMD, [scriptPath, "--mode", "packages", "--json"], {
119
- cwd: directory,
120
- timeout: 5000,
121
- encoding: "utf-8",
122
- stdio: ["pipe", "pipe", "pipe"],
123
- })
124
- const data = JSON.parse(output)
125
- if (data.mode !== "monorepo") {
126
- return { isMonorepo: false, packages: {}, specScope: null, activeTaskPackage: null, defaultPackage: null }
127
- }
128
- // Convert packages array to dict keyed by name
129
- const pkgDict = {}
130
- for (const pkg of (data.packages || [])) {
131
- pkgDict[pkg.name] = pkg
132
- }
133
- return {
134
- isMonorepo: true,
135
- packages: pkgDict,
136
- specScope: data.specScope || null,
137
- activeTaskPackage: data.activeTaskPackage || null,
138
- defaultPackage: data.defaultPackage || null,
139
- }
140
- } catch (e) {
141
- debugLog("session", "loadTrellisConfig error:", e.message)
142
- return { isMonorepo: false, packages: {}, specScope: null, activeTaskPackage: null, defaultPackage: null }
143
- }
144
- }
145
-
146
-
147
- /**
148
- * Check for legacy spec directory structure in monorepo.
149
- */
150
- function checkLegacySpec(directory, config) {
151
- if (!config.isMonorepo || Object.keys(config.packages).length === 0) {
152
- return null
153
- }
154
-
155
- const specDir = join(directory, ".trellis", "spec")
156
- if (!existsSync(specDir)) return null
157
-
158
- // Check for legacy flat spec dirs
159
- let hasLegacy = false
160
- for (const name of ["backend", "frontend"]) {
161
- if (existsSync(join(specDir, name, "index.md"))) {
162
- hasLegacy = true
163
- break
164
- }
165
- }
166
- if (!hasLegacy) return null
167
-
168
- // Check which packages are missing spec/<pkg>/ directory
169
- const pkgNames = Object.keys(config.packages).sort()
170
- const missing = pkgNames.filter(name => !existsSync(join(specDir, name)))
171
-
172
- if (missing.length === 0) return null
173
-
174
- if (missing.length === pkgNames.length) {
175
- return (
176
- `[!] Legacy spec structure detected: found \`spec/backend/\` or \`spec/frontend/\` ` +
177
- `but no package-scoped \`spec/<package>/\` directories.\n` +
178
- `Monorepo packages: ${pkgNames.join(", ")}\n` +
179
- `Please reorganize: \`spec/backend/\` -> \`spec/<package>/backend/\``
180
- )
181
- }
182
- return (
183
- `[!] Partial spec migration detected: packages ${missing.join(", ")} ` +
184
- `still missing \`spec/<pkg>/\` directory.\n` +
185
- `Please complete migration for all packages.`
186
- )
187
- }
188
-
189
-
190
- /**
191
- * Resolve which packages should have their specs injected.
192
- * Returns a Set of allowed package names, or null for full scan.
193
- */
194
- function resolveSpecScope(config) {
195
- if (!config.isMonorepo || Object.keys(config.packages).length === 0) {
196
- return null
197
- }
198
-
199
- const { specScope, activeTaskPackage, defaultPackage, packages } = config
200
- if (specScope == null) return null
201
-
202
- if (specScope === "active_task") {
203
- if (activeTaskPackage && activeTaskPackage in packages) return new Set([activeTaskPackage])
204
- if (defaultPackage && defaultPackage in packages) return new Set([defaultPackage])
205
- return null
206
- }
207
-
208
- if (Array.isArray(specScope)) {
209
- const valid = new Set()
210
- for (const entry of specScope) {
211
- if (entry in packages) {
212
- valid.add(entry)
213
- }
214
- }
215
- if (valid.size > 0) return valid
216
- // All invalid: fallback
217
- if (activeTaskPackage && activeTaskPackage in packages) return new Set([activeTaskPackage])
218
- if (defaultPackage && defaultPackage in packages) return new Set([defaultPackage])
219
- return null
220
- }
221
-
222
- return null
223
- }
224
-
225
-
226
104
  /**
227
105
  * Build session context for injection
228
106
  */
@@ -232,10 +110,6 @@ function buildSessionContext(ctx) {
232
110
  const claudeDir = join(directory, ".claude")
233
111
  const opencodeDir = join(directory, ".opencode")
234
112
 
235
- // Load config for scope filtering and legacy detection
236
- const config = loadTrellisConfig(directory)
237
- const allowedPkgs = resolveSpecScope(config)
238
-
239
113
  const parts = []
240
114
 
241
115
  // 1. Header
@@ -244,12 +118,6 @@ You are starting a new session in a Trellis-managed project.
244
118
  Read and follow all instructions below carefully.
245
119
  </trellis-context>`)
246
120
 
247
- // Legacy migration warning
248
- const legacyWarning = checkLegacySpec(directory, config)
249
- if (legacyWarning) {
250
- parts.push(`<migration-warning>\n${legacyWarning}\n</migration-warning>`)
251
- }
252
-
253
121
  // 2. Current Context (dynamic)
254
122
  const contextScript = join(trellisDir, "scripts", "get_context.py")
255
123
  if (existsSync(contextScript)) {
@@ -287,31 +155,15 @@ Read and follow all instructions below carefully.
287
155
  }).sort()
288
156
 
289
157
  for (const sub of subs) {
290
- // Always include guides/ regardless of scope
291
- if (sub === "guides") {
292
- const indexFile = join(specDir, sub, "index.md")
293
- if (existsSync(indexFile)) {
294
- const content = ctx.readFile(indexFile)
295
- if (content) {
296
- parts.push(`## ${sub}\n${content}\n`)
297
- }
298
- }
299
- continue
300
- }
301
-
302
158
  const indexFile = join(specDir, sub, "index.md")
303
159
  if (existsSync(indexFile)) {
304
- // Flat spec dir: spec/<layer>/index.md (single-repo)
160
+ // Flat spec dir: spec/<layer>/index.md
305
161
  const content = ctx.readFile(indexFile)
306
162
  if (content) {
307
163
  parts.push(`## ${sub}\n${content}\n`)
308
164
  }
309
165
  } else {
310
166
  // Nested package dirs (monorepo): spec/<pkg>/<layer>/index.md
311
- // Apply scope filter
312
- if (allowedPkgs !== null && !allowedPkgs.has(sub)) {
313
- continue
314
- }
315
167
  try {
316
168
  const nested = readdirSync(join(specDir, sub)).filter(name => {
317
169
  try {
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: before-backend-dev
3
+ description: "Read the backend development guidelines before starting your development task."
4
+ ---
5
+
6
+ Read the backend development guidelines before starting your development task.
7
+
8
+ Execute these steps:
9
+ 1. Read `.trellis/spec/backend/index.md` to understand available guidelines
10
+ 2. Based on your task, read the relevant guideline files:
11
+ - Database work → `.trellis/spec/backend/database-guidelines.md`
12
+ - Error handling → `.trellis/spec/backend/error-handling.md`
13
+ - Logging → `.trellis/spec/backend/logging-guidelines.md`
14
+ - Type questions → `.trellis/spec/backend/type-safety.md`
15
+ 3. Understand the coding standards and patterns you need to follow
16
+ 4. Then proceed with your development plan
17
+
18
+ This step is **mandatory** before writing any backend code.
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: before-frontend-dev
3
+ description: "Read the frontend development guidelines before starting your development task."
4
+ ---
5
+
6
+ Read the frontend development guidelines before starting your development task.
7
+
8
+ Execute these steps:
9
+ 1. Read `.trellis/spec/frontend/index.md` to understand available guidelines
10
+ 2. Based on your task, read the relevant guideline files:
11
+ - Component work → `.trellis/spec/frontend/component-guidelines.md`
12
+ - Hook work → `.trellis/spec/frontend/hook-guidelines.md`
13
+ - State management → `.trellis/spec/frontend/state-management.md`
14
+ - Type questions → `.trellis/spec/frontend/type-safety.md`
15
+ 3. Understand the coding standards and patterns you need to follow
16
+ 4. Then proceed with your development plan
17
+
18
+ This step is **mandatory** before writing any frontend code.
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: check-backend
3
+ description: "Check if the code you just wrote follows the backend development guidelines."
4
+ ---
5
+
6
+ Check if the code you just wrote follows the backend development guidelines.
7
+
8
+ Execute these steps:
9
+ 1. Run `git status` to see modified files
10
+ 2. Read `.trellis/spec/backend/index.md` to understand which guidelines apply
11
+ 3. Based on what you changed, read the relevant guideline files:
12
+ - Database changes → `.trellis/spec/backend/database-guidelines.md`
13
+ - Error handling → `.trellis/spec/backend/error-handling.md`
14
+ - Logging changes → `.trellis/spec/backend/logging-guidelines.md`
15
+ - Type changes → `.trellis/spec/backend/type-safety.md`
16
+ - Any changes → `.trellis/spec/backend/quality-guidelines.md`
17
+ 4. Review your code against the guidelines
18
+ 5. Report any violations and fix them if found
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: check-frontend
3
+ description: "Check if the code you just wrote follows the frontend development guidelines."
4
+ ---
5
+
6
+ Check if the code you just wrote follows the frontend development guidelines.
7
+
8
+ Execute these steps:
9
+ 1. Run `git status` to see modified files
10
+ 2. Read `.trellis/spec/frontend/index.md` to understand which guidelines apply
11
+ 3. Based on what you changed, read the relevant guideline files:
12
+ - Component changes → `.trellis/spec/frontend/component-guidelines.md`
13
+ - Hook changes → `.trellis/spec/frontend/hook-guidelines.md`
14
+ - State changes → `.trellis/spec/frontend/state-management.md`
15
+ - Type changes → `.trellis/spec/frontend/type-safety.md`
16
+ - Any changes → `.trellis/spec/frontend/quality-guidelines.md`
17
+ 4. Review your code against the guidelines
18
+ 5. Report any violations and fix them if found
@@ -93,8 +93,8 @@ Description:
93
93
  | Skill Type | Prefix | Example |
94
94
  |------------|--------|---------|
95
95
  | Session Start | `start` | `start` |
96
- | Pre-development | `before-` | `before-dev` |
97
- | Check | `check-` | `check` |
96
+ | Pre-development | `before-` | `before-frontend-dev` |
97
+ | Check | `check-` | `check-frontend` |
98
98
  | Record | `record-` | `record-session` |
99
99
  | Generate | `generate-` | `generate-api-doc` |
100
100
  | Update | `update-` | `update-changelog` |
@@ -131,13 +131,13 @@ AI needs the same onboarding - but compressed into seconds at session start.
131
131
 
132
132
  ---
133
133
 
134
- ### $before-dev - Inject Specialized Knowledge
134
+ ### $before-frontend-dev and $before-backend-dev - Inject Specialized Knowledge
135
135
 
136
136
  **WHY IT EXISTS**:
137
137
  AI models have "pre-trained knowledge" - general patterns from millions of codebases. But YOUR project has specific conventions that differ from generic patterns.
138
138
 
139
139
  **WHAT IT ACTUALLY DOES**:
140
- 1. Discovers spec layers via `get_context.py --mode packages` and reads relevant guidelines
140
+ 1. Reads `.trellis/spec/frontend/` or `.trellis/spec/backend/`
141
141
  2. Loads project-specific patterns into AI's working context:
142
142
  - Component naming conventions
143
143
  - State management patterns
@@ -145,12 +145,12 @@ AI models have "pre-trained knowledge" - general patterns from millions of codeb
145
145
  - Error handling standards
146
146
 
147
147
  **WHY THIS MATTERS**:
148
- - Without before-dev: AI writes generic code that doesn't match project style.
149
- - With before-dev: AI writes code that looks like the rest of the codebase.
148
+ - Without before-*-dev: AI writes generic code that doesn't match project style.
149
+ - With before-*-dev: AI writes code that looks like the rest of the codebase.
150
150
 
151
151
  ---
152
152
 
153
- ### $check - Combat Context Drift
153
+ ### $check-frontend and $check-backend - Combat Context Drift
154
154
 
155
155
  **WHY IT EXISTS**:
156
156
  AI context window has limited capacity. As conversation progresses, guidelines injected at session start become less influential. This causes "context drift."
@@ -216,9 +216,9 @@ All the context AI built during this session will be lost when session ends. The
216
216
 
217
217
  **[1/8] $start** - AI needs project context before touching code
218
218
  **[2/8] python3 ./.trellis/scripts/task.py create "Fix bug" --slug fix-bug** - Track work for future reference
219
- **[3/8] $before-dev** - Inject project-specific development guidelines
219
+ **[3/8] $before-frontend-dev** - Inject project-specific frontend knowledge
220
220
  **[4/8] Investigate and fix the bug** - Actual development work
221
- **[5/8] $check** - Re-verify code against guidelines
221
+ **[5/8] $check-frontend** - Re-verify code against guidelines
222
222
  **[6/8] $finish-work** - Holistic cross-layer review
223
223
  **[7/8] Human tests and commits** - Human validates before code enters repo
224
224
  **[8/8] $record-session** - Persist memory for future sessions
@@ -233,9 +233,9 @@ All the context AI built during this session will be lost when session ends. The
233
233
  ### Example 3: Code Review Fixes
234
234
 
235
235
  **[1/6] $start** - Resume context from previous session
236
- **[2/6] $before-dev** - Re-inject guidelines before fixes
236
+ **[2/6] $before-backend-dev** - Re-inject guidelines before fixes
237
237
  **[3/6] Fix each CR issue** - Address feedback with guidelines in context
238
- **[4/6] $check** - Verify fixes did not introduce new issues
238
+ **[4/6] $check-backend** - Verify fixes didn't introduce new issues
239
239
  **[5/6] $finish-work** - Document lessons from CR
240
240
  **[6/6] Human commits, then $record-session** - Preserve CR lessons
241
241
 
@@ -243,16 +243,16 @@ All the context AI built during this session will be lost when session ends. The
243
243
 
244
244
  **[1/5] $start** - Clear baseline before major changes
245
245
  **[2/5] Plan phases** - Break into verifiable chunks
246
- **[3/5] Execute phase by phase with $check after each** - Incremental verification
246
+ **[3/5] Execute phase by phase with /check-* after each** - Incremental verification
247
247
  **[4/5] $finish-work** - Check if new patterns should be documented
248
248
  **[5/5] Record with multiple commit hashes** - Link all commits to one feature
249
249
 
250
250
  ### Example 5: Debug Session
251
251
 
252
252
  **[1/6] $start** - See if this bug was investigated before
253
- **[2/6] $before-dev** - Guidelines might document known gotchas
253
+ **[2/6] $before-backend-dev** - Guidelines might document known gotchas
254
254
  **[3/6] Investigation** - Actual debugging work
255
- **[4/6] $check** - Verify debug changes do not break other things
255
+ **[4/6] $check-backend** - Verify debug changes don't break other things
256
256
  **[5/6] $finish-work** - Debug findings might need documentation
257
257
  **[6/6] Human commits, then $record-session** - Debug knowledge is valuable
258
258
 
@@ -261,7 +261,7 @@ All the context AI built during this session will be lost when session ends. The
261
261
  ## KEY RULES TO EMPHASIZE
262
262
 
263
263
  1. **AI NEVER commits** - Human tests and approves. AI prepares, human validates.
264
- 2. **Guidelines before code** - $before-dev command injects project knowledge.
264
+ 2. **Guidelines before code** - /before-*-dev commands inject project knowledge.
265
265
  3. **Check after code** - /check-* commands catch context drift.
266
266
  4. **Record everything** - $record-session persists memory.
267
267
 
@@ -5,7 +5,7 @@ description: "Record work progress after human has tested and committed code"
5
5
 
6
6
  [!] **Prerequisite**: This command should only be used AFTER the human has tested and committed the code.
7
7
 
8
- **AI must NOT execute git commit** - only read history (`git log`, `git status`, `git diff`).
8
+ **Do NOT run `git commit` directly** the scripts below handle their own commits for `.trellis/` metadata. You only need to read git history (`git log`, `git status`, `git diff`) and run the Python scripts.
9
9
 
10
10
  ---
11
11
 
@@ -36,7 +36,7 @@ python3 ./.trellis/scripts/add_session.py \
36
36
  --summary "Brief summary of what was done"
37
37
 
38
38
  # Method 2: Pass detailed content via stdin
39
- cat << 'EOF' | python3 ./.trellis/scripts/add_session.py --stdin --title "Title" --commit "hash"
39
+ cat << 'EOF' | python3 ./.trellis/scripts/add_session.py --title "Title" --commit "hash"
40
40
  | Feature | Description |
41
41
  |---------|-------------|
42
42
  | New API | Added user authentication endpoint |
@@ -45,14 +45,9 @@ This shows: developer identity, git status, current task (if any), active tasks.
45
45
  ### Step 3: Read Guidelines Index
46
46
 
47
47
  ```bash
48
- python3 ./.trellis/scripts/get_context.py --mode packages
49
- ```
50
-
51
- This shows available packages and their spec layers. Read the relevant spec indexes:
52
-
53
- ```bash
54
- cat .trellis/spec/<package>/<layer>/index.md # Package-specific guidelines
55
- cat .trellis/spec/guides/index.md # Thinking guides (always read)
48
+ cat .trellis/spec/frontend/index.md # Frontend guidelines
49
+ cat .trellis/spec/backend/index.md # Backend guidelines
50
+ cat .trellis/spec/guides/index.md # Thinking guides
56
51
  ```
57
52
 
58
53
  > **Important**: The index files are navigation — they list the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`).
@@ -31,23 +31,3 @@ max_journal_lines: 2000
31
31
  # - "echo 'Task finished'"
32
32
  # after_archive:
33
33
  # - "echo 'Task archived'"
34
-
35
- #-------------------------------------------------------------------------------
36
- # Monorepo / Packages
37
- #-------------------------------------------------------------------------------
38
-
39
- # Declare packages for monorepo projects.
40
- # Trellis auto-detects workspaces during `trellis init`, but you can also
41
- # configure them manually here.
42
- #
43
- # packages:
44
- # frontend:
45
- # path: packages/frontend
46
- # backend:
47
- # path: packages/backend
48
- # docs:
49
- # path: docs-site
50
- # type: submodule
51
-
52
- # Default package used when --package is not specified.
53
- # default_package: frontend