@mindfoldhq/trellis 0.6.0-beta.7 → 0.6.0-beta.8

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 (58) hide show
  1. package/dist/configurators/codex.d.ts.map +1 -1
  2. package/dist/configurators/codex.js +5 -3
  3. package/dist/configurators/codex.js.map +1 -1
  4. package/dist/configurators/shared.js +4 -4
  5. package/dist/configurators/shared.js.map +1 -1
  6. package/dist/migrations/manifests/0.6.0-beta.8.json +9 -0
  7. package/dist/templates/claude/agents/trellis-check.md +2 -2
  8. package/dist/templates/claude/agents/trellis-implement.md +8 -7
  9. package/dist/templates/codebuddy/agents/trellis-check.md +2 -2
  10. package/dist/templates/codebuddy/agents/trellis-implement.md +8 -7
  11. package/dist/templates/codex/agents/trellis-check.toml +4 -4
  12. package/dist/templates/codex/agents/trellis-implement.toml +4 -4
  13. package/dist/templates/codex/hooks/session-start.py +183 -119
  14. package/dist/templates/codex/skills/before-dev/SKILL.md +12 -6
  15. package/dist/templates/codex/skills/brainstorm/SKILL.md +113 -51
  16. package/dist/templates/codex/skills/check/SKILL.md +86 -18
  17. package/dist/templates/codex/skills/start/SKILL.md +33 -323
  18. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-context-loading.md +7 -4
  19. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-spec-structure.md +1 -1
  20. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-workflow.md +3 -2
  21. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/context-injection.md +5 -5
  22. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/spec-system.md +1 -1
  23. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +8 -6
  24. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +5 -4
  25. package/dist/templates/common/commands/continue.md +6 -5
  26. package/dist/templates/common/commands/start.md +7 -6
  27. package/dist/templates/common/skills/before-dev.md +12 -6
  28. package/dist/templates/common/skills/brainstorm.md +56 -42
  29. package/dist/templates/common/skills/check.md +7 -1
  30. package/dist/templates/copilot/hooks/session-start.py +183 -90
  31. package/dist/templates/copilot/prompts/before-dev.prompt.md +12 -6
  32. package/dist/templates/copilot/prompts/brainstorm.prompt.md +146 -84
  33. package/dist/templates/copilot/prompts/check.prompt.md +86 -18
  34. package/dist/templates/copilot/prompts/parallel.prompt.md +16 -8
  35. package/dist/templates/copilot/prompts/start.prompt.md +33 -367
  36. package/dist/templates/cursor/agents/trellis-check.md +2 -2
  37. package/dist/templates/cursor/agents/trellis-implement.md +8 -7
  38. package/dist/templates/droid/droids/trellis-check.md +2 -2
  39. package/dist/templates/droid/droids/trellis-implement.md +8 -7
  40. package/dist/templates/gemini/agents/trellis-implement.md +7 -6
  41. package/dist/templates/kiro/agents/trellis-check.json +1 -1
  42. package/dist/templates/kiro/agents/trellis-implement.json +1 -1
  43. package/dist/templates/opencode/agents/trellis-check.md +2 -2
  44. package/dist/templates/opencode/agents/trellis-implement.md +9 -8
  45. package/dist/templates/opencode/lib/session-utils.js +212 -123
  46. package/dist/templates/opencode/plugins/inject-subagent-context.js +23 -7
  47. package/dist/templates/opencode/plugins/inject-workflow-state.js +1 -4
  48. package/dist/templates/pi/extensions/trellis/index.ts.txt +7 -5
  49. package/dist/templates/qoder/agents/trellis-implement.md +7 -6
  50. package/dist/templates/shared-hooks/inject-subagent-context.py +36 -14
  51. package/dist/templates/shared-hooks/inject-workflow-state.py +18 -42
  52. package/dist/templates/shared-hooks/session-start.py +197 -163
  53. package/dist/templates/trellis/scripts/common/task_context.py +3 -3
  54. package/dist/templates/trellis/scripts/common/task_store.py +39 -7
  55. package/dist/templates/trellis/scripts/common/workflow_phase.py +7 -10
  56. package/dist/templates/trellis/scripts/task.py +3 -3
  57. package/dist/templates/trellis/workflow.md +98 -98
  58. package/package.json +1 -1
@@ -16,7 +16,8 @@ Context Source: Trellis active task resolver points to task directory
16
16
  - implement.jsonl - Implement agent dedicated context
17
17
  - check.jsonl - Check agent dedicated context
18
18
  - prd.md - Requirements document
19
- - info.md - Technical design
19
+ - design.md - Technical design for complex tasks
20
+ - implement.md - Execution plan for complex tasks
20
21
  - codex-review-output.txt - Code Review results
21
22
  """
22
23
  from __future__ import annotations
@@ -207,7 +208,7 @@ def read_jsonl_entries(base_path: str, jsonl_path: str) -> list[tuple[str, str]]
207
208
  if not os.path.exists(full_path):
208
209
  print(
209
210
  f"[inject-subagent-context] WARN: {jsonl_path} not found — "
210
- f"sub-agent will receive only prd.md",
211
+ f"sub-agent will receive only task artifacts",
211
212
  file=sys.stderr,
212
213
  )
213
214
  return []
@@ -248,7 +249,7 @@ def read_jsonl_entries(base_path: str, jsonl_path: str) -> list[tuple[str, str]]
248
249
  print(
249
250
  f"[inject-subagent-context] WARN: {jsonl_path} has no curated "
250
251
  f"entries (only seed / empty) — sub-agent will receive only "
251
- f"prd.md. See workflow.md Phase 1.3 for curation guidance.",
252
+ f"task artifacts. See workflow.md planning artifact guidance.",
252
253
  file=sys.stderr,
253
254
  )
254
255
 
@@ -276,9 +277,10 @@ def get_implement_context(repo_root: str, task_dir: str) -> str:
276
277
  Complete context for Implement Agent
277
278
 
278
279
  Read order:
279
- 1. All files in implement.jsonl (dev specs)
280
+ 1. All files in implement.jsonl (spec/research manifests)
280
281
  2. prd.md (requirements)
281
- 3. info.md (technical design)
282
+ 3. design.md if present (technical design)
283
+ 4. implement.md if present (execution plan)
282
284
  """
283
285
  context_parts = []
284
286
 
@@ -292,11 +294,18 @@ def get_implement_context(repo_root: str, task_dir: str) -> str:
292
294
  if prd_content:
293
295
  context_parts.append(f"=== {task_dir}/prd.md (Requirements) ===\n{prd_content}")
294
296
 
295
- # 3. Technical design
296
- info_content = read_file_content(repo_root, f"{task_dir}/info.md")
297
- if info_content:
297
+ # 3. Technical design for complex tasks
298
+ design_content = read_file_content(repo_root, f"{task_dir}/design.md")
299
+ if design_content:
298
300
  context_parts.append(
299
- f"=== {task_dir}/info.md (Technical Design) ===\n{info_content}"
301
+ f"=== {task_dir}/design.md (Technical Design) ===\n{design_content}"
302
+ )
303
+
304
+ # 4. Execution plan for complex tasks
305
+ implement_plan_content = read_file_content(repo_root, f"{task_dir}/implement.md")
306
+ if implement_plan_content:
307
+ context_parts.append(
308
+ f"=== {task_dir}/implement.md (Execution Plan) ===\n{implement_plan_content}"
300
309
  )
301
310
 
302
311
  return "\n\n".join(context_parts)
@@ -304,7 +313,7 @@ def get_implement_context(repo_root: str, task_dir: str) -> str:
304
313
 
305
314
  def get_check_context(repo_root: str, task_dir: str) -> str:
306
315
  """
307
- Context for Check Agent: check.jsonl + prd.md
316
+ Context for Check Agent: check.jsonl + task artifacts.
308
317
  """
309
318
  context_parts = []
310
319
 
@@ -315,6 +324,18 @@ def get_check_context(repo_root: str, task_dir: str) -> str:
315
324
  if prd_content:
316
325
  context_parts.append(f"=== {task_dir}/prd.md (Requirements) ===\n{prd_content}")
317
326
 
327
+ design_content = read_file_content(repo_root, f"{task_dir}/design.md")
328
+ if design_content:
329
+ context_parts.append(
330
+ f"=== {task_dir}/design.md (Technical Design) ===\n{design_content}"
331
+ )
332
+
333
+ implement_plan_content = read_file_content(repo_root, f"{task_dir}/implement.md")
334
+ if implement_plan_content:
335
+ context_parts.append(
336
+ f"=== {task_dir}/implement.md (Execution Plan) ===\n{implement_plan_content}"
337
+ )
338
+
318
339
  return "\n\n".join(context_parts)
319
340
 
320
341
 
@@ -351,8 +372,8 @@ All the information you need has been prepared for you:
351
372
  ## Workflow
352
373
 
353
374
  1. **Understand specs** - All dev specs are injected above, understand them
354
- 2. **Understand requirements** - Read requirements document and technical design
355
- 3. **Implement feature** - Implement following specs and design
375
+ 2. **Understand task artifacts** - Read requirements, technical design if present, and execution plan if present
376
+ 3. **Implement feature** - Implement following specs and task artifacts
356
377
  4. **Self-check** - Ensure code quality against check specs
357
378
 
358
379
  ## Important Constraints
@@ -421,7 +442,7 @@ Finish checklist and requirements:
421
442
  ## Workflow
422
443
 
423
444
  1. **Review changes** - Run `git diff --name-only` to see all changed files
424
- 2. **Verify requirements** - Check each requirement in prd.md is implemented
445
+ 2. **Verify task artifacts** - Check requirements in prd.md and, when present, design.md / implement.md
425
446
  3. **Spec sync** - Analyze whether changes introduce new patterns, contracts, or conventions
426
447
  - If new pattern/convention found: read target spec file → update it → update index.md if needed
427
448
  - If infra/cross-layer change: follow the 7-section mandatory template from update-spec.md
@@ -435,7 +456,8 @@ Finish checklist and requirements:
435
456
  - MUST read the target spec file BEFORE editing (avoid duplicating existing content)
436
457
  - Do NOT update specs for trivial changes (typos, formatting, obvious fixes)
437
458
  - If critical CODE issues found, report them clearly (fix specs, not code)
438
- - Verify all acceptance criteria in prd.md are met"""
459
+ - Verify all acceptance criteria in prd.md are met
460
+ - Verify design.md and implement.md constraints when those files are present"""
439
461
 
440
462
 
441
463
 
@@ -36,44 +36,11 @@ from pathlib import Path
36
36
  from typing import Optional
37
37
 
38
38
 
39
- CODEX_SUB_AGENT_NOTICE = """<sub-agent-notice>
40
- SUB-AGENT NOTICE - READ FIRST IF SPAWNED VIA spawn_agent
41
-
42
- If your parent session spawned you via spawn_agent with an explicit task
43
- message above this hook output, that message is your only job.
44
- - Execute the parent message exactly as written, then return.
45
- - Ignore all Trellis workflow guidance below this notice.
46
- - Do NOT call task.py start, task.py add-context, or task.py archive.
47
- - Do NOT call wait_agent or spawn_agent.
48
- - Do NOT modify .trellis/tasks/* or any other file unless the parent message
49
- explicitly asks for that.
50
-
51
- If you are the main interactive Codex session and the user is typing at the
52
- terminal with no parent agent, use the workflow guidance below normally.
53
- </sub-agent-notice>"""
54
-
55
-
56
- # Bootstrap notice for Codex while the session has no active task. Replaces the
57
- # heavyweight SessionStart context injection — instead of pushing 9.5 KB of
58
- # workflow text up front, we just nudge the AI to read the `trellis-start` skill once.
59
- # The nudge keeps showing up while status == "no_task" (cheap text, AI won't
60
- # re-read after the first time). Once a task is created the breadcrumb status
61
- # flips and this notice stops appearing automatically. Sub-agents are warded
62
- # off by the <sub-agent-notice> above plus the explicit exemption below.
39
+ # Bootstrap notice for Codex while the session has no active task. Codex does not
40
+ # get the full SessionStart overview; this short reminder points the main session
41
+ # at the start skill once and leaves the per-turn state block compact.
63
42
  CODEX_NO_TASK_BOOTSTRAP_NOTICE = """<trellis-bootstrap>
64
- You are running in a Trellis-managed Codex session and there is no active task yet.
65
- If you have not already loaded Trellis context this session, read the `trellis-start` skill once:
66
-
67
- $trellis-start
68
-
69
- (equivalent to reading `.agents/skills/trellis-start/SKILL.md` and following its Steps 1-3)
70
-
71
- The skill walks you through workflow.md, dev profile, git status, active tasks, and spec
72
- indexes. Then route the user's request per the <workflow-state> A/B/C rules below.
73
-
74
- Sub-agent exemption: if you are a sub-agent (spawned via spawn_agent with a parent task
75
- message), DO NOT read `$trellis-start`. Execute the parent message directly as instructed by the
76
- <sub-agent-notice> above.
43
+ If you have not already loaded Trellis context this session, read the `trellis-start` skill once.
77
44
  </trellis-bootstrap>"""
78
45
 
79
46
 
@@ -245,7 +212,17 @@ def _codex_mode_banner(config: dict) -> str:
245
212
  cfg_mode = codex_cfg.get("dispatch_mode")
246
213
  if cfg_mode in ("inline", "sub-agent"):
247
214
  mode = cfg_mode
248
- return f"<codex-mode>{mode}</codex-mode>"
215
+ if mode == "sub-agent":
216
+ meaning = (
217
+ "sub-agent: implement/check work defaults to Trellis sub-agents; "
218
+ "the main session still coordinates, clarifies, updates specs, commits, and finishes."
219
+ )
220
+ else:
221
+ meaning = (
222
+ "inline: the main session implements/checks directly; "
223
+ "do not dispatch implement/check sub-agents."
224
+ )
225
+ return f"<codex-mode>{meaning}</codex-mode>"
249
226
 
250
227
 
251
228
  def resolve_breadcrumb_key(
@@ -294,8 +271,6 @@ def build_breadcrumb(
294
271
  if body is None:
295
272
  body = "Refer to workflow.md for current step."
296
273
  header = f"Status: {status}" if task_id is None else f"Task: {task_id} ({status})"
297
- if source:
298
- header = f"{header}\nSource: {source}"
299
274
  return f"<workflow-state>\n{header}\n{body}\n</workflow-state>"
300
275
 
301
276
 
@@ -333,11 +308,12 @@ def main() -> int:
333
308
  else:
334
309
  task_id, status, source = task
335
310
  status_key = resolve_breadcrumb_key(status, platform, config)
311
+ source_for_breadcrumb = None if platform == "codex" else source
336
312
  breadcrumb = build_breadcrumb(
337
- task_id, status, templates, source, breadcrumb_key=status_key
313
+ task_id, status, templates, source_for_breadcrumb, breadcrumb_key=status_key
338
314
  )
339
315
  if platform == "codex":
340
- parts: list[str] = [CODEX_SUB_AGENT_NOTICE]
316
+ parts: list[str] = []
341
317
  if task is None:
342
318
  parts.append(CODEX_NO_TASK_BOOTSTRAP_NOTICE)
343
319
  parts.append(_codex_mode_banner(config))