@pennixrv/trellis 0.6.45 → 0.7.0-beta.11

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 (117) hide show
  1. package/dist/cli/index.d.ts.map +1 -1
  2. package/dist/cli/index.js +21 -3
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/commands/channel/adapters/codex.d.ts +2 -1
  5. package/dist/commands/channel/adapters/codex.d.ts.map +1 -1
  6. package/dist/commands/channel/adapters/codex.js +10 -7
  7. package/dist/commands/channel/adapters/codex.js.map +1 -1
  8. package/dist/commands/channel/adapters/index.d.ts +2 -0
  9. package/dist/commands/channel/adapters/index.d.ts.map +1 -1
  10. package/dist/commands/channel/adapters/index.js +1 -1
  11. package/dist/commands/channel/adapters/index.js.map +1 -1
  12. package/dist/commands/channel/index.d.ts.map +1 -1
  13. package/dist/commands/channel/index.js +6 -0
  14. package/dist/commands/channel/index.js.map +1 -1
  15. package/dist/commands/channel/profiles.d.ts +26 -0
  16. package/dist/commands/channel/profiles.d.ts.map +1 -0
  17. package/dist/commands/channel/profiles.js +186 -0
  18. package/dist/commands/channel/profiles.js.map +1 -0
  19. package/dist/commands/channel/spawn.d.ts +3 -0
  20. package/dist/commands/channel/spawn.d.ts.map +1 -1
  21. package/dist/commands/channel/spawn.js +22 -3
  22. package/dist/commands/channel/spawn.js.map +1 -1
  23. package/dist/commands/channel/supervisor.d.ts +8 -0
  24. package/dist/commands/channel/supervisor.d.ts.map +1 -1
  25. package/dist/commands/channel/supervisor.js +19 -0
  26. package/dist/commands/channel/supervisor.js.map +1 -1
  27. package/dist/commands/mem.d.ts.map +1 -1
  28. package/dist/commands/mem.js +6 -13
  29. package/dist/commands/mem.js.map +1 -1
  30. package/dist/commands/workflow.d.ts +17 -0
  31. package/dist/commands/workflow.d.ts.map +1 -1
  32. package/dist/commands/workflow.js +222 -0
  33. package/dist/commands/workflow.js.map +1 -1
  34. package/dist/configurators/claude.d.ts.map +1 -1
  35. package/dist/configurators/claude.js.map +1 -1
  36. package/dist/configurators/dsh.d.ts +16 -19
  37. package/dist/configurators/dsh.d.ts.map +1 -1
  38. package/dist/configurators/dsh.js +38 -26
  39. package/dist/configurators/dsh.js.map +1 -1
  40. package/dist/configurators/gemini.d.ts.map +1 -1
  41. package/dist/configurators/gemini.js.map +1 -1
  42. package/dist/configurators/opencode.d.ts.map +1 -1
  43. package/dist/configurators/opencode.js +4 -0
  44. package/dist/configurators/opencode.js.map +1 -1
  45. package/dist/migrations/manifests/0.6.17.json +2 -2
  46. package/dist/migrations/manifests/0.7.0-beta.10.json +9 -0
  47. package/dist/migrations/manifests/0.7.0-beta.11.json +9 -0
  48. package/dist/migrations/manifests/0.7.0-beta.4.json +9 -0
  49. package/dist/migrations/manifests/0.7.0-beta.4.pennix.1.json +9 -0
  50. package/dist/migrations/manifests/0.7.0-beta.5.json +9 -0
  51. package/dist/migrations/manifests/0.7.0-beta.6.json +9 -0
  52. package/dist/migrations/manifests/0.7.0-beta.7.json +9 -0
  53. package/dist/migrations/manifests/0.7.0-beta.8.json +9 -0
  54. package/dist/migrations/manifests/0.7.0-beta.9.json +9 -0
  55. package/dist/templates/claude/hooks/statusline.py +7 -0
  56. package/dist/templates/claude/settings.json +22 -0
  57. package/dist/templates/codex/hooks/session-start.py +20 -1
  58. package/dist/templates/codex/hooks.json +25 -0
  59. package/dist/templates/common/bundled-skills/trellis-channel/references/subnode-work.md +32 -3
  60. package/dist/templates/common/bundled-skills/trellis-meta/SKILL.md +2 -2
  61. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-task-lifecycle.md +1 -0
  62. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +2 -1
  63. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/hooks-and-settings.md +3 -2
  64. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/overview.md +1 -1
  65. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/platform-map.md +5 -4
  66. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/skills-and-commands.md +1 -0
  67. package/dist/templates/common/bundled-skills/trellis-session-insight/SKILL.md +2 -2
  68. package/dist/templates/common/bundled-skills/trellis-session-insight/references/cli-quick-reference.md +3 -2
  69. package/dist/templates/common/commands/continue.md +4 -2
  70. package/dist/templates/common/skills/brainstorm.md +14 -6
  71. package/dist/templates/copilot/hooks/session-start.py +20 -1
  72. package/dist/templates/copilot/prompts/brainstorm.prompt.md +16 -6
  73. package/dist/templates/dsh/DSH.md +61 -37
  74. package/dist/templates/dsh/agents/trellis-check.md +99 -0
  75. package/dist/templates/dsh/agents/trellis-implement.md +106 -0
  76. package/dist/templates/dsh/agents/trellis-research.md +134 -0
  77. package/dist/templates/dsh/index.d.ts +12 -11
  78. package/dist/templates/dsh/index.d.ts.map +1 -1
  79. package/dist/templates/dsh/index.js +14 -12
  80. package/dist/templates/dsh/index.js.map +1 -1
  81. package/dist/templates/opencode/plugins/inject-spec-context.js +121 -0
  82. package/dist/templates/opencode/plugins/inject-workflow-state.js +111 -10
  83. package/dist/templates/pi/extensions/trellis/index.ts.txt +164 -10
  84. package/dist/templates/shared-hooks/index.d.ts +8 -2
  85. package/dist/templates/shared-hooks/index.d.ts.map +1 -1
  86. package/dist/templates/shared-hooks/index.js +13 -1
  87. package/dist/templates/shared-hooks/index.js.map +1 -1
  88. package/dist/templates/shared-hooks/inject-shell-session-context.py +3 -3
  89. package/dist/templates/shared-hooks/inject-spec-context.py +844 -0
  90. package/dist/templates/shared-hooks/inject-workflow-state.py +35 -9
  91. package/dist/templates/shared-hooks/session-start.py +22 -1
  92. package/dist/templates/trellis/agents/subnode-profiles.json +14 -0
  93. package/dist/templates/trellis/agents/subnode.md +11 -4
  94. package/dist/templates/trellis/config.yaml +49 -0
  95. package/dist/templates/trellis/index.d.ts +4 -0
  96. package/dist/templates/trellis/index.d.ts.map +1 -1
  97. package/dist/templates/trellis/index.js +8 -0
  98. package/dist/templates/trellis/index.js.map +1 -1
  99. package/dist/templates/trellis/scripts/common/active_task.py +26 -4
  100. package/dist/templates/trellis/scripts/common/cli_adapter.py +38 -6
  101. package/dist/templates/trellis/scripts/common/config.py +18 -0
  102. package/dist/templates/trellis/scripts/common/context_projection.py +2 -2
  103. package/dist/templates/trellis/scripts/common/git_context.py +34 -2
  104. package/dist/templates/trellis/scripts/common/paths.py +28 -0
  105. package/dist/templates/trellis/scripts/common/spec_inject.py +439 -0
  106. package/dist/templates/trellis/scripts/common/spec_match.py +395 -0
  107. package/dist/templates/trellis/scripts/common/task_store.py +88 -1
  108. package/dist/templates/trellis/scripts/common/trellis_config.py +46 -7
  109. package/dist/templates/trellis/scripts/common/workflow_phase.py +3 -2
  110. package/dist/templates/trellis/scripts/common/workflow_selection.py +177 -0
  111. package/dist/templates/trellis/scripts/subnode_artifact.py +416 -15
  112. package/dist/templates/trellis/scripts/task.py +160 -0
  113. package/dist/templates/trellis/workflow.md +49 -34
  114. package/dist/types/ai-tools.d.ts.map +1 -1
  115. package/dist/types/ai-tools.js +26 -13
  116. package/dist/types/ai-tools.js.map +1 -1
  117. package/package.json +2 -2
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "0.7.0-beta.11",
3
+ "description": "Pennix v0.7 beta parallel evidence workflow contracts",
4
+ "breaking": false,
5
+ "recommendMigrate": false,
6
+ "changelog": "**Improvements:**\n- Add project-local subnode evidence profiles with deterministic model/reasoning resolution and durable spawn receipts.\n- Add a write-once FIFO queue helper with fail-closed claims and abandonment markers for coordinator-driven dispatch.\n- Align the Marketplace workflow with profile selection, acceptance gates, recovery, and queue boundaries.",
7
+ "migrations": [],
8
+ "notes": "Run npm install -g @pennixrv/trellis@beta then trellis update. No --migrate required."
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "0.7.0-beta.4",
3
+ "description": "Sync v0.6.15–v0.6.17; dsh native sub-agents; YAML flow lists; task.py workflow NameError",
4
+ "breaking": false,
5
+ "recommendMigrate": false,
6
+ "changelog": "**Enhancements:**\n- Synced from main: v0.6.15 (DeepSeek Harness `trellis init --dsh`), v0.6.16 (context-manifest gate, task lifecycle, ablation, OpenCode mem, hook/channel fixes), v0.6.17 (Devin CLI `--platform devin`, lazy SQLite pages, Pi headless ask, active-task isolation, archive unlink restore).\n- On beta, `trellis init --dsh` installs native research/implement/check sub-agents (`trellis-agent-{research,implement,check}`). Stable 0.6.15 still runs those phases inline. (#548)\n\n**Bug Fixes:**\n- `parse_simple_yaml` accepts scalar flow sequences such as `spec_injection.tools: []`.\n- `task.py workflow` imports `read_json` from `common.io` (no `NameError` when pinning a workflow).",
7
+ "migrations": [],
8
+ "notes": "Run `npm install -g @mindfoldhq/trellis@beta` then `trellis update`. No `--migrate` required."
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "0.7.0-beta.4.pennix.1",
3
+ "description": "Pennix v0.7 beta reconciliation on upstream v0.7.0-beta.4.",
4
+ "breaking": false,
5
+ "recommendMigrate": false,
6
+ "changelog": "**Enhancements:**\n- Reconciled Pennix Channel, lifecycle, ownership, handoff, analysis-only, managed subnode, telemetry, memory, and release contracts with upstream v0.7 beta.\n- Permitted clearly bounded direct small work with an immediate verification path across the bundled and Marketplace workflows.\n\n**Bug Fixes:**\n- Preserved upstream active-session isolation while keeping Pennix unbound task projections read-only and non-binding.\n- Centralized context projection and fixed UTF-8 boundary truncation.",
7
+ "migrations": [],
8
+ "notes": "Run `trellis update` to install the Pennix v0.7 beta workflow assets. No `--migrate` required."
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "0.7.0-beta.5",
3
+ "description": "Pennix v0.7 beta completeness audit fixes",
4
+ "breaking": false,
5
+ "recommendMigrate": false,
6
+ "changelog": "**Bug Fixes:**\n- Claude statusline preserves the explicit `unbound_ambiguous` state instead of suppressing it as no active task.\n- Release preflight recognizes npm's exact-version JSON array response, so already-published beta releases are not planned again.",
7
+ "migrations": [],
8
+ "notes": "Run `npm install -g @pennixrv/trellis@beta` then `trellis update`. No `--migrate` required."
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "0.7.0-beta.6",
3
+ "description": "Pennix v0.7 beta release tag isolation",
4
+ "breaking": false,
5
+ "recommendMigrate": false,
6
+ "changelog": "**Bug Fixes:**\n- Beta release pushes only its newly-created tag, preventing unrelated local tags from triggering npm publish workflows.",
7
+ "migrations": [],
8
+ "notes": "Run `npm install -g @pennixrv/trellis@beta` then `trellis update`. No `--migrate` required."
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "0.7.0-beta.7",
3
+ "description": "Pennix v0.7 beta release verification normalization",
4
+ "breaking": false,
5
+ "recommendMigrate": false,
6
+ "changelog": "**Bug Fixes:**\n- Normalize npm's single-item JSON array response during local and CI visibility verification.",
7
+ "migrations": [],
8
+ "notes": "Run `npm install -g @pennixrv/trellis@beta` then `trellis update`. No `--migrate` required."
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "0.7.0-beta.8",
3
+ "description": "Pennix v0.7 beta decision-chain replanning",
4
+ "breaking": false,
5
+ "recommendMigrate": false,
6
+ "changelog": "**Features:**\n- Add an auditable same-task replan transition for material implementation-time decisions.\n- Preserve every planning interval in `trellis mem --phase brainstorm`.",
7
+ "migrations": [],
8
+ "notes": "Run `npm install -g @pennixrv/trellis@beta` then `trellis update`. No `--migrate` required."
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "0.7.0-beta.9",
3
+ "description": "Pennix v0.7 beta planning and evidence governance",
4
+ "breaking": false,
5
+ "recommendMigrate": false,
6
+ "changelog": "**Features:**\n- Require complex analysis to use normal planning and a sealed decision chain.\n- Add evidence units and schema-v2 subnode reports with coordinator-only acceptance.",
7
+ "migrations": [],
8
+ "notes": "Run npm install -g @pennixrv/trellis@beta then trellis update. No --migrate required."
9
+ }
@@ -111,6 +111,13 @@ def _get_current_task_for_input(trellis_dir: Path, cc_data: dict) -> dict | None
111
111
  return None
112
112
 
113
113
  active = resolve_active_task(trellis_dir.parent, cc_data, platform="claude")
114
+ if active.source_type == "unbound_ambiguous":
115
+ return {
116
+ "title": f"Task binding ambiguous ({len(active.candidate_paths)} candidates)",
117
+ "status": "unbound_ambiguous",
118
+ "priority": "P?",
119
+ "source": active.source,
120
+ }
114
121
  if not active.task_path:
115
122
  return None
116
123
 
@@ -21,6 +21,11 @@
21
21
  "type": "command",
22
22
  "command": "{{PYTHON_CMD}} .claude/hooks/session-start.py",
23
23
  "timeout": 30
24
+ },
25
+ {
26
+ "type": "command",
27
+ "command": "{{PYTHON_CMD}} .claude/hooks/inject-spec-context.py",
28
+ "timeout": 30
24
29
  }
25
30
  ]
26
31
  },
@@ -31,6 +36,11 @@
31
36
  "type": "command",
32
37
  "command": "{{PYTHON_CMD}} .claude/hooks/session-start.py",
33
38
  "timeout": 30
39
+ },
40
+ {
41
+ "type": "command",
42
+ "command": "{{PYTHON_CMD}} .claude/hooks/inject-spec-context.py",
43
+ "timeout": 30
34
44
  }
35
45
  ]
36
46
  }
@@ -57,6 +67,18 @@
57
67
  ]
58
68
  }
59
69
  ],
70
+ "PostToolUse": [
71
+ {
72
+ "matcher": "Read|Edit|Write|MultiEdit",
73
+ "hooks": [
74
+ {
75
+ "type": "command",
76
+ "command": "{{PYTHON_CMD}} .claude/hooks/inject-spec-context.py",
77
+ "timeout": 15
78
+ }
79
+ ]
80
+ }
81
+ ],
60
82
  "UserPromptSubmit": [
61
83
  {
62
84
  "hooks": [
@@ -464,6 +464,25 @@ def _strip_breadcrumb_tag_blocks(content: str) -> str:
464
464
  return re.sub(r"\n{3,}", "\n\n", stripped).strip()
465
465
 
466
466
 
467
+ def _resolve_workflow_md(root: Path, input_data: dict) -> Path:
468
+ """Resolve the active task's workflow file, falling back to the global one.
469
+
470
+ The per-task resolution rule lives in common.workflow_selection inside
471
+ .trellis/scripts. Older installed projects may not ship that module, and
472
+ hooks must never crash the session — ANY failure (import error, old
473
+ scripts tree, resolver bug) falls back to the global workflow.md.
474
+ """
475
+ try:
476
+ scripts_dir = root / ".trellis" / "scripts"
477
+ if str(scripts_dir) not in sys.path:
478
+ sys.path.insert(0, str(scripts_dir))
479
+ from common.workflow_selection import resolve_workflow_md # type: ignore[import-not-found]
480
+
481
+ return resolve_workflow_md(root, input_data, platform="codex")
482
+ except Exception:
483
+ return root / ".trellis" / "workflow.md"
484
+
485
+
467
486
  def _build_workflow_toc(workflow_path: Path) -> str:
468
487
  """Inject only the compact Phase Index summary for SessionStart."""
469
488
  content = read_file(workflow_path)
@@ -517,7 +536,7 @@ Trellis compact SessionStart context. Use it to orient the session; load details
517
536
  output.write("\n</current-state>\n\n")
518
537
 
519
538
  output.write("<trellis-workflow>\n")
520
- output.write(_build_workflow_toc(trellis_dir / "workflow.md"))
539
+ output.write(_build_workflow_toc(_resolve_workflow_md(project_dir, hook_input)))
521
540
  output.write("\n</trellis-workflow>\n\n")
522
541
 
523
542
  output.write("<guidelines>\n")
@@ -1,5 +1,17 @@
1
1
  {
2
2
  "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "matcher": "^(?:clear|compact)$",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "{{PYTHON_CMD}} -X utf8 .codex/hooks/inject-spec-context.py",
10
+ "timeout": 15
11
+ }
12
+ ]
13
+ }
14
+ ],
3
15
  "UserPromptSubmit": [
4
16
  {
5
17
  "hooks": [
@@ -22,6 +34,19 @@
22
34
  }
23
35
  ]
24
36
  }
37
+ ],
38
+ "PreToolUse": [
39
+ {
40
+ "matcher": "Edit|Write",
41
+ "hooks": [
42
+ {
43
+ "type": "command",
44
+ "command": "{{PYTHON_CMD}} -X utf8 .codex/hooks/inject-spec-context.py",
45
+ "timeout": 15,
46
+ "additionalContextLimit": 0
47
+ }
48
+ ]
49
+ }
25
50
  ]
26
51
  }
27
52
  }
@@ -50,12 +50,15 @@ and its status; the Codex supervisor projects that reply into the durable
50
50
  Channel message and `done` events. The durable JSON file carries the
51
51
  reviewable result.
52
52
 
53
- The subnode copies identity, scope, and lens from `brief.json`. The minimal
53
+ The subnode copies identity, scope, and lens from `brief.json`. Schema version 2
54
+ requires one `scope_assessment` entry for every brief scope item, structured
55
+ findings with evidence references, and typed uncertainties or corrections when
56
+ present. Schema version 1 is retired and the validator rejects it. The minimal
54
57
  complete report is:
55
58
 
56
59
  ```json
57
60
  {
58
- "schema_version": 1,
61
+ "schema_version": 2,
59
62
  "task_id": "task-id-from-brief",
60
63
  "work_id": "work-id-from-brief",
61
64
  "subnode_id": "subnode-id-from-brief",
@@ -63,6 +66,14 @@ complete report is:
63
66
  "status": "complete",
64
67
  "scope": ["exact scope copied from brief"],
65
68
  "lens": "exact lens copied from brief",
69
+ "scope_assessment": [
70
+ {
71
+ "scope": "exact scope item from brief",
72
+ "status": "covered",
73
+ "conclusion": "What this scope establishes.",
74
+ "evidence_ids": ["stable-evidence-id"]
75
+ }
76
+ ],
66
77
  "evidence": [
67
78
  {
68
79
  "id": "stable-evidence-id",
@@ -70,12 +81,30 @@ complete report is:
70
81
  "summary": "What this independently reviewable evidence establishes."
71
82
  }
72
83
  ],
73
- "findings": ["Bounded conclusion."],
84
+ "findings": [
85
+ {
86
+ "id": "finding-id",
87
+ "conclusion": "Bounded conclusion.",
88
+ "evidence_ids": ["stable-evidence-id"]
89
+ }
90
+ ],
74
91
  "uncertainties": [],
75
92
  "corrections": []
76
93
  }
77
94
  ```
78
95
 
96
+ Append a checkpoint marker to `worklog.md` when a material unit is complete or
97
+ blocked. It is a bounded recovery projection, not coordinator acceptance:
98
+
99
+ ```text
100
+ <!-- trellis-checkpoint: {"id":"checkpoint-1","covered_scope":["exact scope item"],"evidence_ids":["stable-evidence-id"],"conclusion_or_blocker":"Current conclusion or blocker.","unknowns":[],"safe_resume_point":"Next safe action."} -->
101
+ ```
102
+
103
+ The validator returns `review_concern` for missing or incomplete checkpoint
104
+ coverage and for inconclusive scope assessments so the coordinator can inspect
105
+ them. Identity, schema, path, and malformed-structure failures remain hard
106
+ errors. A concern is never automatic acceptance or rejection.
107
+
79
108
  For `blocked`, `incomplete`, or `error`, include the same base fields plus a
80
109
  `completed_scope` list (empty when no assigned scope started) and a non-empty
81
110
  `blocker` string. Never use
@@ -12,7 +12,7 @@ Trellis v0.6 adds three architectural surfaces on top of the pre-v0.6 workflow /
12
12
  The default operating scope is local files in the user project:
13
13
 
14
14
  - `.trellis/`: workflow, config, tasks, spec, workspace, scripts, bundled runtime agents, and runtime state.
15
- - Platform directories: `.claude/`, `.codex/`, `.cursor/`, `.opencode/`, `.kiro/`, `.gemini/`, `.qoder/`, `.codebuddy/`, `.github/`, `.factory/`, `.pi/`, `.reasonix/`, `.kilocode/`, `.agent/`, `.devin/`, `.kimi-code/`, and similar directories. Pi additionally exposes a native `trellis_subagent` tool with `single` / `parallel` / `chain` dispatch modes, throttled progress cards, and `isTrellisAgent()` validation on top of the file layout. Reasonix stores both workflow skills and subagent skills as `.reasonix/skills/<name>/SKILL.md`; subagent skills carry `runAs: subagent` frontmatter. Kimi Code keeps workflow skills in the shared `.agents/skills/` layer, delivers commands plus agent prompts as `.kimi-code/skills/<name>/SKILL.md`, and installs the same agent prompts as custom sub-agents under `.kimi-code/agents/<name>.md`.
15
+ - Platform directories: `.claude/`, `.codex/`, `.cursor/`, `.opencode/`, `.kiro/`, `.gemini/`, `.qoder/`, `.codebuddy/`, `.github/`, `.factory/`, `.pi/`, `.reasonix/`, `.kilocode/`, `.agent/`, `.devin/`, `.kimi-code/`, `.dsh/`, and similar directories. Pi additionally exposes a native `trellis_subagent` tool with `single` / `parallel` / `chain` dispatch modes, throttled progress cards, and `isTrellisAgent()` validation on top of the file layout. Reasonix stores both workflow skills and subagent skills as `.reasonix/skills/<name>/SKILL.md`; subagent skills carry `runAs: subagent` frontmatter. Kimi Code keeps workflow skills in the shared `.agents/skills/` layer and delivers commands plus agent prompts as `.kimi-code/skills/<name>/SKILL.md`. DeepSeek Harness keeps shared workflow skills under `.agents/skills/` and DSH-private commands plus `trellis-agent-*` role skills under `.dsh/skills/`; with the optional `dsh-trellis` plugin its continuable subagents use event-driven settlement waits, otherwise required children are dispatched in the foreground from the start.
16
16
  - Shared skill layer: `.agents/skills/`.
17
17
  - User-owned channel store outside the project tree: `~/.trellis/channels/<project>/<channel>/events.jsonl`.
18
18
  - Raw platform conversation logs queryable via `trellis mem`: `~/.claude/projects/`, `~/.codex/sessions/`, and `~/.pi/agent/sessions/` (OpenCode adapter degraded for the v0.6 line).
@@ -44,7 +44,7 @@ Do not assume the user has the Trellis source repository. Do not default to modi
44
44
  ### Platform Files
45
45
 
46
46
  - `references/platform-files/overview.md`: How shared `.trellis/` files relate to platform directories and the four platform integration modes (hook-driven, agent prelude, main-session workflow, channel runtime).
47
- - `references/platform-files/platform-map.md`: Platform directories and paths for skills, agents, hooks, and extensions across all supported platforms including Reasonix and Pi's native `trellis_subagent` extension.
47
+ - `references/platform-files/platform-map.md`: Platform directories and paths for skills, agents, hooks, and extensions across all supported platforms including DeepSeek Harness, Reasonix, and Pi's native `trellis_subagent` extension.
48
48
  - `references/platform-files/hooks-and-settings.md`: How settings/config files, hooks, plugins, and extensions connect to Trellis; covers `channel.worker_guard.*`, `channel.subnode.*`, and `codex.dispatch_mode`.
49
49
  - `references/platform-files/agents.md`: Per-platform `trellis-research` / `trellis-implement` / `trellis-check` sub-agent files plus bundled `.trellis/agents/{check,implement}.md` for the channel runtime.
50
50
  - `references/platform-files/skills-and-commands.md`: Differences between skills, commands, prompts, and workflows, plus how to change them.
@@ -17,6 +17,7 @@ Task lifecycle includes creation, start, context configuration, finish, archive,
17
17
  | --- | --- |
18
18
  | Automatically sync an external system after task creation | `hooks.after_create` in `.trellis/config.yaml`. |
19
19
  | Automatically update status after task start | `hooks.after_start` in `.trellis/config.yaml`. |
20
+ | Return an in-progress task to planning | `hooks.after_replan` in `.trellis/config.yaml`. |
20
21
  | Run a script after task finish | `hooks.after_finish` in `.trellis/config.yaml`. |
21
22
  | Clean external resources after archive | `hooks.after_archive` in `.trellis/config.yaml`. |
22
23
  | Change default task fields | `.trellis/scripts/common/task_store.py`. |
@@ -34,7 +34,8 @@ Agent files should not become generic chat prompts. They should define input sou
34
34
  | Pi Agent | `.pi/agents/trellis-*.md` |
35
35
  | Reasonix | `.reasonix/skills/trellis-*/SKILL.md` (subagent frontmatter) |
36
36
  | ZCode | `.zcode/agents/trellis-*.md` |
37
- | Kimi Code | `.kimi-code/agents/trellis-*.md` (custom sub-agents; the same prompts also ship as `.kimi-code/skills/trellis-*/SKILL.md`) |
37
+ | Kimi Code | `.kimi-code/skills/trellis-*/SKILL.md` (agent prompts as skills, dispatched to the built-in `coder`; research needs its file-editing tools to persist findings) |
38
+ | DeepSeek Harness | `.dsh/skills/trellis-agent-*/SKILL.md` (role prompts as child-only skills; optional `trellis_wait` enables continuable background settlement; without it, dispatch every child with `run_in_background: false` from the outset) |
38
39
 
39
40
  GitHub Copilot agent/prompt support is provided by a combination of directories such as `.github/agents/`, `.github/prompts/`, and `.github/skills/`; inspect the files actually generated in the user project.
40
41
 
@@ -19,7 +19,7 @@ Common files:
19
19
  | Claude Code | `.claude/settings.json` |
20
20
  | Cursor | `.cursor/hooks.json` |
21
21
  | Codex | `.codex/hooks.json`, `.codex/config.toml` |
22
- | OpenCode | `.opencode/package.json`, `.opencode/plugins/*` |
22
+ | OpenCode | `.opencode/package.json`, `.opencode/plugins/*`, `.opencode/hooks/inject-spec-context.py` |
23
23
  | Kiro | `.kiro/hooks/` + platform config |
24
24
  | Gemini CLI | `.gemini/settings.json` |
25
25
  | Qoder | `.qoder/settings.json` |
@@ -29,7 +29,7 @@ Common files:
29
29
  | Pi Agent | `.pi/settings.json`, `.pi/extensions/trellis/` |
30
30
  | Trae IDE | `.trae/hooks.json` |
31
31
 
32
- Reasonix is a pull-based platform whose agent files contain prelude instructions to read context after startup. ZCode uses `.zcode/config.json` with shared hooks, including PreToolUse for sub-agent prompt injection. Kimi Code is likewise pull-based and has no project-level settings/hooks file Trellis writes (hooks live only in the user-level `~/.kimi-code/config.toml`), so its agent prompts ship as skills and `.kimi-code/agents/` sub-agent definitions with the same prelude.
32
+ Reasonix is a pull-based platform whose agent files contain prelude instructions to read context after startup. ZCode uses `.zcode/config.json` with shared hooks, including PreToolUse for sub-agent prompt injection. Kimi Code is likewise pull-based and has no project-level settings/hooks file Trellis writes (hooks live only in the user-level `~/.kimi-code/config.toml`), so its agent prompts ship as skills with the same prelude. DeepSeek Harness also has no project-level hook/settings surface Trellis writes; the optional `dsh-trellis` profile plugin supplies per-turn breadcrumbs and event-driven `trellis_wait`, while DSH role skills pull task context in both plugin and no-plugin paths.
33
33
 
34
34
  Whether these files exist in a project depends on which `trellis init --<platform>` flags the user ran.
35
35
 
@@ -40,6 +40,7 @@ Whether these files exist in a project depends on which `trellis init --<platfor
40
40
  | `session-start.py` | Generates session-start context. |
41
41
  | `inject-workflow-state.py` | Parses `[workflow-state:STATUS]` blocks in `.trellis/workflow.md` and emits the body matching the current task status. Falls back to `Refer to workflow.md for current step.` when no matching block exists. |
42
42
  | `inject-subagent-context.py` | Injects PRD, JSONL context, and related spec/research into sub-agents. |
43
+ | `inject-spec-context.py` | Matches path-scoped specs and manages budgeted delivery state. |
43
44
  | `inject-shell-session-context.py` | Lets shell commands inherit Trellis session identity. |
44
45
 
45
46
  Not every platform has every hook. Do not copy files from another platform just because a platform lacks a hook; first confirm whether that platform supports the corresponding event.
@@ -5,7 +5,7 @@ Trellis connects the same local architecture to different AI tools. `.trellis/`
5
5
  When a local AI modifies Trellis, it should distinguish two file categories first:
6
6
 
7
7
  - **Shared files**: `.trellis/workflow.md`, `.trellis/tasks/`, `.trellis/spec/`, `.trellis/scripts/`.
8
- - **Platform files**: `.claude/`, `.snow/`, `.codex/`, `.cursor/`, `.opencode/`, `.kiro/`, `.gemini/`, `.qoder/`, `.codebuddy/`, `.github/`, `.factory/`, `.pi/`, `.trae/`, `.kilocode/`, `.agent/`, `.devin/`, `.reasonix/`, `.zcode/`, `.kimi-code/`, and similar directories.
8
+ - **Platform files**: `.claude/`, `.snow/`, `.codex/`, `.cursor/`, `.opencode/`, `.kiro/`, `.gemini/`, `.qoder/`, `.codebuddy/`, `.github/`, `.factory/`, `.pi/`, `.trae/`, `.kilocode/`, `.agent/`, `.devin/`, `.reasonix/`, `.zcode/`, `.kimi-code/`, `.dsh/`, and similar directories.
9
9
 
10
10
  Platform files do not store business state. They let the corresponding AI tool read Trellis state, call Trellis scripts, and load Trellis skills/agents/hooks.
11
11
 
@@ -19,14 +19,14 @@ This page lists common Trellis file locations in a user project by platform. Whe
19
19
  | CodeBuddy | `--codebuddy` | `.codebuddy/` | `.codebuddy/skills/` | `.codebuddy/agents/` | `.codebuddy/hooks/` + `.codebuddy/settings.json` |
20
20
  | GitHub Copilot | `--copilot` | `.github/` | `.github/skills/` | `.github/agents/` | `.github/copilot/hooks/` + prompts |
21
21
  | Factory Droid | `--droid` | `.factory/` | `.factory/skills/` | `.factory/droids/` | `.factory/hooks/` + settings |
22
- | DeepSeek Harness (dsh) | `--dsh` | `.dsh/` | `.agents/skills/` (shared) + `.dsh/skills/` (entry skills) | None (workflow skills run implement/check inline) | None (class-2 pull-based; no project hooks/settings) |
23
22
  | Pi Agent | `--pi` | `.pi/` | `.agents/skills/` | `.pi/agents/` | `.pi/extensions/trellis/` (native `trellis_subagent` tool) + `.pi/settings.json` |
24
23
  | Trae IDE | `--trae` | `.trae/` | `.trae/skills/` | `.trae/agents/` | `.trae/hooks/` + `.trae/hooks.json` |
25
24
  | Reasonix | `--reasonix` | `.reasonix/` | `.reasonix/skills/` | None — sub-agents are skills with `runAs: subagent` frontmatter | None |
26
25
  | ZCode | `--zcode` | `.zcode/` | `.zcode/skills/` | `.zcode/agents/` | `.zcode/hooks/` + `.zcode/config.json` (SessionStart + UserPromptSubmit + PreToolUse Agent/Task); sub-agents use hook-injected context |
27
26
  | Grok Build | `--grok` | `.grok/` | `.grok/skills/` | `.grok/agents/` | pull-based prelude (no hooks; flat `.grok/commands/trellis-*.md`) |
28
- | Kimi Code | `--kimi` | `.kimi-code/` | `.agents/skills/` (shared) + `.kimi-code/skills/` | `.kimi-code/agents/` (custom sub-agents; same prompts also ship as skills) | None (pull-based prelude; no project hooks/settings) |
27
+ | Kimi Code | `--kimi` | `.kimi-code/` | `.agents/skills/` (shared) + `.kimi-code/skills/` | None — agent prompts are skills under `.kimi-code/skills/` and dispatch to the built-in `coder` | None (pull-based prelude; no project hooks/settings) |
29
28
  | Snow CLI | `--snow` | `.snow/` | `.snow/skills/` | `.snow/agents/` (auto-discovered; primary path) | class-1: auto inject + project agents + `beforeSubAgentStart` (`.snow/hooks/` `session`/`user`/`subagent` modes -> `additionalContext` JSON); no legacy sub-agent JSON; commands `.snow/commands/trellis-*.json` |
29
+ | DeepSeek Harness | `--dsh` | `.dsh/` | `.agents/skills/` (shared) + `.dsh/skills/` | None — role prompts are collision-free `trellis-agent-*` skills under `.dsh/skills/` | None installed by Trellis (pull-based roles; optional `dsh-trellis` adds event-driven wait, otherwise foreground dispatch) |
30
30
 
31
31
  ## Capability Groups
32
32
 
@@ -49,8 +49,9 @@ These platforms usually have `trellis-research`, `trellis-implement`, and `trell
49
49
  - Reasonix (delivered as skills with `runAs: subagent` under `.reasonix/skills/`, not as a separate `agents/` directory)
50
50
  - ZCode
51
51
  - Grok Build (`.grok/agents/`; dispatch via `spawn_subagent` with `subagent_type`)
52
- - Kimi Code (`.kimi-code/agents/`; the same prompts are also delivered as skills under `.kimi-code/skills/`)
52
+ - Kimi Code (delivered as skills under `.kimi-code/skills/`; dispatched to the built-in `coder`, including research because it must persist files)
53
53
  - Snow CLI (`.snow/agents/`; auto-discovered project agents + class-1 hooks)
54
+ - DeepSeek Harness (role prompts delivered as `.dsh/skills/trellis-agent-*/SKILL.md`; dispatched through the continuable `subagent` tool)
54
55
 
55
56
  When changing implementation/check/research behavior, look for the corresponding platform agent files first.
56
57
 
@@ -74,7 +75,7 @@ When changing behavior, inspect workflows and skills first. Do not assume Trelli
74
75
 
75
76
  ### Shared `.agents/skills/`
76
77
 
77
- Codex, Gemini CLI, Pi Agent, Kimi Code, and DeepSeek Harness (dsh) write the shared `.agents/skills/` layer. Some tools that support agentskills.io can also read this directory. If the user wants multiple compatible tools to share one skill, consider `.agents/skills/` first, but do not assume every platform reads it. ZCode keeps Trellis-managed skills under `.zcode/skills/`.
78
+ Codex, Gemini CLI, Pi Agent, Kimi Code, and DeepSeek Harness write the shared `.agents/skills/` layer. Some tools that support agentskills.io can also read this directory. If the user wants multiple compatible tools to share one skill, consider `.agents/skills/` first, but do not assume every platform reads it. ZCode keeps Trellis-managed skills under `.zcode/skills/`.
78
79
 
79
80
  ## Decision Rules When Modifying Platform Files
80
81
 
@@ -34,6 +34,7 @@ Trellis workflow skills usually share one semantic set: brainstorm, before-dev,
34
34
  | Reasonix | `.reasonix/skills/` |
35
35
  | ZCode | `.zcode/skills/`, `.zcode/commands/` |
36
36
  | Kimi Code | `.agents/skills/`, `.kimi-code/skills/` (commands delivered as `/skill:trellis-*` skills) |
37
+ | DeepSeek Harness | `.agents/skills/`, `.dsh/skills/` (entry skills load by bare `trellis-*` names; role prompts use `trellis-agent-*`) |
37
38
 
38
39
  In a user project, use the files actually generated by init as authoritative.
39
40
 
@@ -11,7 +11,7 @@ It is intentionally a **capability skill, not a workflow**. There is no fixed ou
11
11
 
12
12
  ## What `trellis mem` is
13
13
 
14
- A local CLI that indexes the user's past Claude Code, Codex, Pi Agent, and ZCode conversation logs and lets you list, search, slice by Trellis task boundaries, and dump cleaned dialogue from them. Claude and Codex use `~/.claude/projects/` and `~/.codex/sessions/`. Pi uses its default or environment-configured session root, global `~/.pi/agent/settings.json`, and the scoped project's `.pi/settings.json`; relative `sessionDir` values resolve from the settings file directory. Project-local Pi settings require project-scoped lookup through the current cwd or `--cwd`. ZCode uses `~/.zcode/cli/db/db.sqlite`. OpenCode logs are not yet indexable (provider adapter pending) — when an OpenCode session is the obvious target, surface that limitation rather than guessing.
14
+ A local CLI that indexes the user's past Claude Code, Codex, Devin CLI, Grok, OpenCode, Pi Agent, and ZCode conversation logs and lets you list, search, slice by Trellis task boundaries, and dump cleaned dialogue from them. Claude and Codex use `~/.claude/projects/` and `~/.codex/sessions/`. Devin CLI (Cognition terminal agent, not `trellis init --devin` Desktop) uses `~/.local/share/devin/cli/sessions.db`. Grok uses `~/.grok/sessions/`. OpenCode uses `~/.local/share/opencode/opencode.db` (zero-dependency SQLite reader). Pi uses its default or environment-configured session root, global `~/.pi/agent/settings.json`, and the scoped project's `.pi/settings.json`; relative `sessionDir` values resolve from the settings file directory. Project-local Pi settings require project-scoped lookup through the current cwd or `--cwd`. ZCode uses `~/.zcode/cli/db/db.sqlite`.
15
15
 
16
16
  Nothing in `mem` is uploaded. All reads are local.
17
17
 
@@ -68,7 +68,7 @@ trellis mem list --cwd <project-path>
68
68
  trellis mem projects # → list active project cwds, then narrow
69
69
  ```
70
70
 
71
- Phase slicing (`--phase brainstorm|implement|all`) cuts the session at `task.py create` and `task.py start` boundaries. For a finish-work review of the current task, `--phase brainstorm` recovers the planning discussion and `--phase implement` recovers the execution loop. Default is `all`.
71
+ Phase slicing (`--phase brainstorm|implement|all`) cuts the session at `task.py create`/`replan` and `task.py start` boundaries. For a finish-work review of the current task, `--phase brainstorm` recovers the planning discussion and `--phase implement` recovers the execution loop. Default is `all`.
72
72
 
73
73
  ## Triggering patterns
74
74
 
@@ -16,14 +16,14 @@ Full flag reference for the five subcommands. Pin this as the authoritative sour
16
16
 
17
17
  | Flag | Subcommands | Meaning |
18
18
  | --------------------------------------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
19
- | `--platform claude\|codex\|opencode\|pi\|all` | all | Default `all`. OpenCode adapter is currently a stub on `0.6.0-beta.*` — see "Caveats" below. |
19
+ | `--platform claude\|codex\|devin\|grok\|opencode\|pi\|zcode\|all` | all | Default `all`. `devin` is Cognition Devin CLI (`sessions.db`), not `trellis init --devin` (Desktop). |
20
20
  | `--since YYYY-MM-DD` | list / search | Inclusive lower date bound. |
21
21
  | `--until YYYY-MM-DD` | list / search | Inclusive upper date bound. |
22
22
  | `--global` | list / search | Include sessions from every project on this machine. Default is the current project `cwd`. |
23
23
  | `--cwd <path>` | list / search | Force a specific project cwd instead of inferring from where you are. |
24
24
  | `--limit N` | list / search | Cap output rows. Default `50`. |
25
25
  | `--grep KW` | extract / context | Filter turns by keyword. Multi-token AND when whitespace-separated. |
26
- | `--phase brainstorm\|implement\|all` | extract | Slice session by Trellis task boundaries. `brainstorm` = `[task.py create, task.py start)`. `implement` = turns outside brainstorm windows. Default `all`. |
26
+ | `--phase brainstorm\|implement\|all` | extract | Slice session by Trellis task boundaries. `brainstorm` = `[task.py create/replan, task.py start)`. `implement` = turns outside brainstorm windows. Default `all`. |
27
27
  | `--turns N` | context | Number of hit turns to return. Default `3`. |
28
28
  | `--around N` | context | Surrounding turns to include per hit. Default `1`. |
29
29
  | `--max-chars N` | context | Total character budget. Default `6000` (~1500 tokens). |
@@ -56,6 +56,7 @@ trellis mem projects
56
56
  ## Caveats
57
57
 
58
58
  - **OpenCode adapter is a stub on `0.6.0-beta.*`.** When `--platform` resolves to OpenCode (or `all` and OpenCode would be included), `mem` prints a one-line "reader unavailable" notice and continues with the other platforms. Don't promise OpenCode coverage in your reply until the adapter ships.
59
+ - **`--platform devin` is Cognition Devin CLI** (`~/.local/share/devin/cli/sessions.db`). It is not `trellis init --devin` (Devin Desktop / Cascade) and not Factory Droid.
59
60
  - **`--phase` slicing depends on `task.py create` / `task.py start` invocations appearing in the recorded bash calls of the session.** Sessions where the user ran `task.py` from a different terminal — outside the recorded AI loop — will not have phase boundaries. `--phase all` is the safe fallback.
60
61
  - **`mem` indexes platform JSONL files directly.** If the user has cleared their Claude / Codex / Pi session storage, `mem` cannot recover what is no longer on disk.
61
62
  - **`mem` is read-only.** No remote sync, no edits to platform JSONL. Any write you do based on `mem` findings is your own follow-up call into the editing tools available to you.
@@ -24,11 +24,13 @@ Shows the Phase Index (Plan / Execute / Finish) with routing + skill mapping.
24
24
 
25
25
  `get_context.py` shows the active task's `status` field. Route by `status` + artifact presence. This command replaces the user needing to remember the Trellis flow; it does not itself approve implementation.
26
26
 
27
- - `status=planning` + `task.json.meta.delivery_mode = "analysis_only"` → complete the PRD's bounded evidence work, verify its acceptance criteria and no-change boundary, then commit task artifacts and archive directly. Do not run `task.py start`; a protected-target change requires a separate change-bearing task.
27
+ - `status=planning` + `task.json.meta.delivery_mode = "analysis_only"` → first confirm the task still satisfies the bounded evidence-only eligibility rule; then complete the PRD's evidence work, verify its acceptance criteria and no-change boundary, and archive directly. Do not run `task.py start`; a protected-target change requires a separate change-bearing task.
28
28
  - `status=planning` + no `prd.md` → **1.1** (load `trellis-brainstorm`)
29
+ - `status=planning` + a recorded `decision-needed` or unsealed decision chain → return to the planning frontier and load `pennix-decision-gates` when independent material questions can be batched.
30
+ - `status=in_progress` + a material unresolved decision → record the reason and run `task.py replan <task> "<reason>"`; do not ask a native question during implementation.
29
31
  - `status=planning` + `prd.md` only → decide whether the task is lightweight or complex. Lightweight can move to **1.4** review; complex returns to **1.1** to add `design.md` + `implement.md`.
30
32
  - `status=planning` + complex artifacts complete + sub-agent jsonl not curated (empty, or only a legacy `_example` placeholder row) → **1.3**
31
- - `status=planning` + required artifacts complete + required jsonl curated or inline mode → **1.4** (ask for start review; only run `task.py start` after user confirms)
33
+ - `status=planning` + required artifacts complete + required jsonl curated or inline mode → run the Planning Seal closure pass, then **1.4** (ask for start review; only run `task.py start` after user confirms)
32
34
  - `status=in_progress` + implementation not started → **2.1**
33
35
  - `status=in_progress` + implementation done, not yet checked → **2.2**
34
36
  - `status=in_progress` + check passed → **3.3** (spec update) → **3.4** (commit)
@@ -6,12 +6,14 @@ A request to build, implement, fix, refactor, or "go ahead" is not approval to l
6
6
 
7
7
  For every non-trivial task, the user must respond at least once after the initial request before implementation begins. If no clarification is needed, that response must approve the final planning summary described below.
8
8
 
9
- While any user-owned product, scope, UX, compatibility, risk, or acceptance decision remains unresolved, end the turn with exactly one highest-value question. Do not edit product code, dispatch implementation, or run `task.py start`.
9
+ While any user-owned product, scope, UX, compatibility, risk, or acceptance decision remains unresolved, keep the task in planning. First inventory evidence and decision dependencies. If at least two independent material decisions remain and `pennix-decision-gates` is available, delegate one bounded batch of up to three frontier questions; otherwise ask the single highest-value question. Do not edit product code, dispatch implementation, or run `task.py start` until the decision chain is sealed.
10
10
 
11
11
  ## Analysis-Only Exception
12
12
 
13
13
  When `task.json.meta.delivery_mode = "analysis_only"` exactly and the PRD names a bounded evidence deliverable plus a no-change boundary for product source, runtime configuration, deployment, credentials, and external systems, task-creation consent authorizes that evidence work. Do not require a second planning approval or run `task.py start`: perform the declared research, audit, or design work while status remains `planning`, record the evidence, verify acceptance criteria and the boundary, commit task artifacts, and archive directly. If the evidence recommends a protected-target change, record it and create a separate change-bearing task before doing it.
14
14
 
15
+ This exception is eligible only for a bounded evidence deliverable with no material user decision, design or implementation plan, cross-owner coordination, security or deployment change, release or credential action, or protected downstream task. Calling work "research", deferring source edits, or working in an audit/root repository does not make it analysis-only. If any of those conditions apply, use the normal complex planning and implementation-approval path.
16
+
15
17
  All other tasks follow the planning and implementation approval gates below.
16
18
 
17
19
  ## Non-Negotiable Evidence Rule
@@ -24,6 +26,10 @@ Do not ask the user to confirm facts that the repository can answer. Ask only fo
24
26
 
25
27
  Repository evidence establishes current behavior and technical constraints. The user's intended behavior, feature scope boundaries, and UX preferences are never answerable by repository evidence alone, even when an existing pattern exists; existing patterns are options and recommendation evidence, not decisions.
26
28
 
29
+ ## Evidence Units For Read-Heavy Work
30
+
31
+ When research, audit, review, or investigation is too large to leave one independently useful conclusion in the current bounded session, split it into evidence units. Each unit must have one question or scope, a minimal evidence range, a destination artifact, and a stop condition; write its facts, conclusion or blocker, unknowns, and recovery point before starting another unit. Size units so one normal context window can finish and persist one useful result; do not promise an exact token or time limit. Routine navigation and transient tool output do not need an artifact. Create a child task only when the unit has an independent owner, lifecycle, and acceptance contract.
32
+
27
33
  ---
28
34
 
29
35
  Use this skill during Phase 1 planning to turn the user's request into clear requirements and planning artifacts.
@@ -54,18 +60,18 @@ Use a concise title from the user's request. Both the title and `--description`
54
60
  - product intent still needed from the user
55
61
  - scope or risk decisions still needed from the user
56
62
  - likely out-of-scope items
57
- 4. If a user-owned decision remains, ask the single highest-value question, include your recommendation and trade-off, then stop. Do not perform implementation work in the same turn.
58
- 5. After each user answer, update `prd.md`, recompute the decision inventory, and repeat from step 2.
63
+ 4. If user-owned decisions remain, calculate the independent frontier. Use `pennix-decision-gates` for a bounded batch when two or more independent material decisions are ready; otherwise ask the single highest-value question. Include recommendation and trade-off. Yield only while the answer is unavailable.
64
+ 5. When the host returns the current continuation's answer, immediately persist it in `prd.md` or the decision artifact, recheck evidence and conflicts, recalculate the frontier, and continue the same planning loop. Do not create a second Trellis lifecycle for the same decision chain. Stop only for a new unresolved frontier, a real capability or authority block, or a final sealed summary awaiting implementation approval.
59
65
  6. When no user-owned decision remains, create or update `design.md` and `implement.md` for complex tasks.
60
- 7. Run the requirement convergence gate, then the PRD convergence pass.
66
+ 7. Run the requirement convergence gate, then the PRD convergence pass. Finish with one Planning Seal closure pass.
61
67
  8. Present the final planning summary and stop. Do not run `task.py start` or edit product code in the same turn.
62
- 9. Only a subsequent user message that explicitly approves the latest planning summary authorizes `task.py start` and implementation. If the artifacts change materially after approval, repeat the final review.
68
+ 9. Only a subsequent user message that explicitly approves the latest planning summary authorizes `task.py start` and implementation. If implementation reveals a material unresolved decision, record `decision-needed`, run `task.py replan <task> "<reason>"`, and return through this planning flow; do not open a popup during implementation.
63
69
 
64
70
  Do not invent a project-specific product/spec hierarchy. If the repository already has product, domain, or spec docs, use them. If it does not, proceed with the evidence that exists.
65
71
 
66
72
  ## Question Rules
67
73
 
68
- Ask only one question per message.
74
+ Ask one bounded batch per message: include up to three independent material frontier questions. Ask exactly one question only when it is the sole remaining material decision or later decisions depend on its answer.
69
75
 
70
76
  Each question must include:
71
77
 
@@ -140,6 +146,8 @@ Lightweight tasks may omit `design.md` and `implement.md`; they may not skip evi
140
146
 
141
147
  The final planning summary must show Goal, In Scope, Out of Scope, Acceptance Criteria, Key Decisions, relevant Risks or Deferred Items, and artifact status.
142
148
 
149
+ The Planning Seal closure pass must reconcile `task.json`, `prd.md`, `design.md`, `implement.md`, research, decision records, and manifests; verify the actual modification targets and branches, ordered dependencies and release steps, validation and rollback, dynamic-fact dispositions and replan triggers, and that every material decision has an owner and a fixed outcome. Remove static ambiguity before implementation: no `TBD`, `TODO`, `decision-needed`, unowned option, unspecified branch, open implementation path, validation gap, or conditional acceptance may remain. A material discovery invalidates the seal and returns to planning; implementation may consume only a sealed plan.
150
+
143
151
  ## Artifact Rules
144
152
 
145
153
  `prd.md` records requirements and acceptance:
@@ -452,6 +452,25 @@ def _strip_breadcrumb_tag_blocks(content: str) -> str:
452
452
  return re.sub(r"\n{3,}", "\n\n", stripped).strip()
453
453
 
454
454
 
455
+ def _resolve_workflow_md(root: Path, input_data: dict) -> Path:
456
+ """Resolve the active task's workflow file, falling back to the global one.
457
+
458
+ The per-task resolution rule lives in common.workflow_selection inside
459
+ .trellis/scripts. Older installed projects may not ship that module, and
460
+ hooks must never crash the session — ANY failure (import error, old
461
+ scripts tree, resolver bug) falls back to the global workflow.md.
462
+ """
463
+ try:
464
+ scripts_dir = root / ".trellis" / "scripts"
465
+ if str(scripts_dir) not in sys.path:
466
+ sys.path.insert(0, str(scripts_dir))
467
+ from common.workflow_selection import resolve_workflow_md # type: ignore[import-not-found]
468
+
469
+ return resolve_workflow_md(root, input_data, platform="copilot")
470
+ except Exception:
471
+ return root / ".trellis" / "workflow.md"
472
+
473
+
455
474
  def _build_workflow_toc(workflow_path: Path) -> str:
456
475
  """Inject only the compact Phase Index summary for SessionStart."""
457
476
  content = read_file(workflow_path)
@@ -503,7 +522,7 @@ Trellis compact SessionStart context. Use it to orient the session; load details
503
522
  output.write("\n</current-state>\n\n")
504
523
 
505
524
  output.write("<trellis-workflow>\n")
506
- output.write(_build_workflow_toc(trellis_dir / "workflow.md"))
525
+ output.write(_build_workflow_toc(_resolve_workflow_md(project_dir, hook_input)))
507
526
  output.write("\n</trellis-workflow>\n\n")
508
527
 
509
528
  output.write("<guidelines>\n")