@mindfoldhq/trellis 0.6.2 → 0.6.4

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 (109) hide show
  1. package/README.md +1 -1
  2. package/dist/cli/index.js +11 -2
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/commands/init.d.ts +5 -0
  5. package/dist/commands/init.d.ts.map +1 -1
  6. package/dist/commands/init.js +49 -2
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/mem.d.ts.map +1 -1
  9. package/dist/commands/mem.js +4 -3
  10. package/dist/commands/mem.js.map +1 -1
  11. package/dist/commands/update.d.ts.map +1 -1
  12. package/dist/commands/update.js +1 -2
  13. package/dist/commands/update.js.map +1 -1
  14. package/dist/configurators/antigravity.d.ts +1 -1
  15. package/dist/configurators/antigravity.js +1 -1
  16. package/dist/configurators/claude.d.ts +5 -2
  17. package/dist/configurators/claude.d.ts.map +1 -1
  18. package/dist/configurators/claude.js +37 -4
  19. package/dist/configurators/claude.js.map +1 -1
  20. package/dist/configurators/codebuddy.d.ts +1 -1
  21. package/dist/configurators/codebuddy.js +1 -1
  22. package/dist/configurators/codex.d.ts.map +1 -1
  23. package/dist/configurators/codex.js +3 -17
  24. package/dist/configurators/codex.js.map +1 -1
  25. package/dist/configurators/copilot.d.ts +1 -1
  26. package/dist/configurators/copilot.js +1 -1
  27. package/dist/configurators/cursor.d.ts +1 -1
  28. package/dist/configurators/cursor.js +1 -1
  29. package/dist/configurators/devin.d.ts +7 -0
  30. package/dist/configurators/devin.d.ts.map +1 -0
  31. package/dist/configurators/{windsurf.js → devin.js} +7 -7
  32. package/dist/configurators/devin.js.map +1 -0
  33. package/dist/configurators/droid.d.ts +1 -1
  34. package/dist/configurators/droid.js +1 -1
  35. package/dist/configurators/gemini.d.ts +1 -1
  36. package/dist/configurators/gemini.js +1 -1
  37. package/dist/configurators/index.d.ts +2 -1
  38. package/dist/configurators/index.d.ts.map +1 -1
  39. package/dist/configurators/index.js +22 -15
  40. package/dist/configurators/index.js.map +1 -1
  41. package/dist/configurators/kilo.d.ts +1 -1
  42. package/dist/configurators/kilo.js +1 -1
  43. package/dist/configurators/kiro.d.ts +4 -2
  44. package/dist/configurators/kiro.d.ts.map +1 -1
  45. package/dist/configurators/kiro.js +12 -3
  46. package/dist/configurators/kiro.js.map +1 -1
  47. package/dist/configurators/shared.d.ts +18 -24
  48. package/dist/configurators/shared.d.ts.map +1 -1
  49. package/dist/configurators/shared.js +19 -39
  50. package/dist/configurators/shared.js.map +1 -1
  51. package/dist/configurators/zcode.d.ts +19 -0
  52. package/dist/configurators/zcode.d.ts.map +1 -0
  53. package/dist/configurators/zcode.js +54 -0
  54. package/dist/configurators/zcode.js.map +1 -0
  55. package/dist/migrations/manifests/0.6.3.json +24 -0
  56. package/dist/migrations/manifests/0.6.4.json +9 -0
  57. package/dist/templates/claude/hooks/statusline.py +324 -0
  58. package/dist/templates/claude/index.d.ts +10 -1
  59. package/dist/templates/claude/index.d.ts.map +1 -1
  60. package/dist/templates/claude/index.js +12 -1
  61. package/dist/templates/claude/index.js.map +1 -1
  62. package/dist/templates/common/bundled-skills/trellis-meta/SKILL.md +4 -4
  63. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-agents.md +2 -0
  64. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-skills-or-commands.md +2 -1
  65. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/overview.md +2 -2
  66. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/bundled-skills.md +3 -3
  67. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/generated-files.md +2 -2
  68. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/overview.md +1 -1
  69. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +3 -1
  70. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/hooks-and-settings.md +2 -0
  71. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/overview.md +2 -2
  72. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/platform-map.md +4 -2
  73. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/skills-and-commands.md +3 -1
  74. package/dist/templates/common/bundled-skills/trellis-session-insight/SKILL.md +2 -2
  75. package/dist/templates/common/bundled-skills/trellis-session-insight/references/cli-quick-reference.md +23 -24
  76. package/dist/templates/common/skills/brainstorm.md +43 -0
  77. package/dist/templates/common/skills/break-loop.md +59 -0
  78. package/dist/templates/kiro/agents/trellis.json +34 -0
  79. package/dist/templates/kiro/hooks/trellis-workflow-state.kiro.hook +14 -0
  80. package/dist/templates/kiro/index.d.ts +16 -2
  81. package/dist/templates/kiro/index.d.ts.map +1 -1
  82. package/dist/templates/kiro/index.js +13 -3
  83. package/dist/templates/kiro/index.js.map +1 -1
  84. package/dist/templates/shared-hooks/index.d.ts +12 -4
  85. package/dist/templates/shared-hooks/index.d.ts.map +1 -1
  86. package/dist/templates/shared-hooks/index.js +17 -5
  87. package/dist/templates/shared-hooks/index.js.map +1 -1
  88. package/dist/templates/shared-hooks/inject-workflow-state.py +13 -3
  89. package/dist/templates/shared-hooks/session-start.py +8 -0
  90. package/dist/templates/trellis/scripts/add_session.py +26 -6
  91. package/dist/templates/trellis/scripts/common/cli_adapter.py +46 -32
  92. package/dist/templates/trellis/scripts/common/safe_commit.py +46 -16
  93. package/dist/templates/trellis/scripts/common/task_store.py +2 -2
  94. package/dist/templates/trellis/scripts/common/workflow_phase.py +1 -1
  95. package/dist/templates/trellis/workflow.md +23 -23
  96. package/dist/templates/zcode/agents/trellis-check.md +102 -0
  97. package/dist/templates/zcode/agents/trellis-implement.md +102 -0
  98. package/dist/templates/zcode/index.d.ts +15 -0
  99. package/dist/templates/zcode/index.d.ts.map +1 -0
  100. package/dist/templates/zcode/index.js +18 -0
  101. package/dist/templates/zcode/index.js.map +1 -0
  102. package/dist/types/ai-tools.d.ts +4 -4
  103. package/dist/types/ai-tools.d.ts.map +1 -1
  104. package/dist/types/ai-tools.js +25 -7
  105. package/dist/types/ai-tools.js.map +1 -1
  106. package/package.json +2 -2
  107. package/dist/configurators/windsurf.d.ts +0 -7
  108. package/dist/configurators/windsurf.d.ts.map +0 -1
  109. package/dist/configurators/windsurf.js.map +0 -1
@@ -5,7 +5,7 @@
5
5
  Therefore, when an AI uses this skill, the default customization target is local files inside the user project:
6
6
 
7
7
  - `.trellis/`: workflow, tasks, specs, memory, scripts, and runtime state.
8
- - Platform directories: `.claude/`, `.codex/`, `.cursor/`, `.opencode/`, `.kiro/`, `.gemini/`, `.qoder/`, `.codebuddy/`, `.github/`, `.factory/`, `.pi/`, `.kilocode/`, `.agent/`, `.windsurf/`, and similar directories.
8
+ - Platform directories: `.claude/`, `.codex/`, `.cursor/`, `.opencode/`, `.kiro/`, `.gemini/`, `.qoder/`, `.codebuddy/`, `.github/`, `.factory/`, `.pi/`, `.kilocode/`, `.agent/`, `.devin/`, `.reasonix/`, `.zcode/`, and similar directories.
9
9
  - Shared skill layer: `.agents/skills/`.
10
10
 
11
11
  Do not default to guiding the user to fork the Trellis CLI repository. Treat upstream source code as the operating target only when the user explicitly says they want to change Trellis upstream source, publish an npm package, or contribute a PR.
@@ -32,10 +32,12 @@ Agent files should not become generic chat prompts. They should define input sou
32
32
  | CodeBuddy | `.codebuddy/agents/trellis-*.md` |
33
33
  | Factory Droid | `.factory/droids/trellis-*.md` |
34
34
  | Pi Agent | `.pi/agents/trellis-*.md` |
35
+ | Reasonix | `.reasonix/skills/trellis-*/SKILL.md` (subagent frontmatter) |
36
+ | ZCode | `.zcode/cli/agents/trellis-*.md` |
35
37
 
36
38
  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.
37
39
 
38
- Main-session workflow platforms such as Kilo, Antigravity, and Windsurf may not have Trellis sub-agent files. They usually rely on workflows/skills to guide the main session.
40
+ Main-session workflow platforms such as Kilo, Antigravity, and Devin may not have Trellis sub-agent files. They usually rely on workflows/skills to guide the main session.
39
41
 
40
42
  ## Two Context Loading Modes
41
43
 
@@ -28,6 +28,8 @@ Common files:
28
28
  | Factory Droid | `.factory/settings.json` |
29
29
  | Pi Agent | `.pi/settings.json`, `.pi/extensions/trellis/` |
30
30
 
31
+ Reasonix and ZCode are pull-based platforms that do not use hooks or settings files; their agent files contain prelude instructions to read context after startup.
32
+
31
33
  Whether these files exist in a project depends on which `trellis init --<platform>` flags the user ran.
32
34
 
33
35
  ## Hook Script Types
@@ -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/`, `.codex/`, `.cursor/`, `.opencode/`, `.kiro/`, `.gemini/`, `.qoder/`, `.codebuddy/`, `.github/`, `.factory/`, `.pi/`, `.kilocode/`, `.agent/`, `.windsurf/`, and similar directories.
8
+ - **Platform files**: `.claude/`, `.codex/`, `.cursor/`, `.opencode/`, `.kiro/`, `.gemini/`, `.qoder/`, `.codebuddy/`, `.github/`, `.factory/`, `.pi/`, `.kilocode/`, `.agent/`, `.devin/`, `.reasonix/`, `.zcode/`, 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
 
@@ -17,7 +17,7 @@ Platform files do not store business state. They let the corresponding AI tool r
17
17
  | hooks/plugins/extensions | `.claude/hooks/`, `.opencode/plugins/`, `.pi/extensions/` | Inject context at session start, user input, agent startup, shell execution, and similar events. |
18
18
  | agents | `.claude/agents/`, `.codex/agents/`, `.kiro/agents/` | Define `trellis-research`, `trellis-implement`, and `trellis-check`. |
19
19
  | skills | `.claude/skills/`, `.agents/skills/`, `.qoder/skills/` | Capability descriptions that auto-trigger or can be read on demand. |
20
- | commands/prompts/workflows | `.cursor/commands/`, `.github/prompts/`, `.windsurf/workflows/` | Entry points explicitly invoked by the user. |
20
+ | commands/prompts/workflows | `.cursor/commands/`, `.github/prompts/`, `.devin/workflows/` | Entry points explicitly invoked by the user. |
21
21
 
22
22
  ## Three Platform Integration Modes
23
23
 
@@ -14,13 +14,14 @@ This page lists common Trellis file locations in a user project by platform. Whe
14
14
  | Kiro | `--kiro` | `.kiro/` | `.kiro/skills/` | `.kiro/agents/` | `.kiro/hooks/` |
15
15
  | Gemini CLI | `--gemini` | `.gemini/` | `.agents/skills/` | `.gemini/agents/` | `.gemini/settings.json` + `.gemini/hooks/` |
16
16
  | Antigravity | `--antigravity` | `.agent/` | `.agent/skills/` | Usually none | `.agent/workflows/` |
17
- | Windsurf | `--windsurf` | `.windsurf/` | `.windsurf/skills/` | Usually none | `.windsurf/workflows/` |
17
+ | Devin | `--devin` | `.devin/` | `.devin/skills/` | Usually none | `.devin/workflows/` |
18
18
  | Qoder | `--qoder` | `.qoder/` | `.qoder/skills/` | `.qoder/agents/` | `.qoder/hooks/` + `.qoder/settings.json` |
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
22
  | Pi Agent | `--pi` | `.pi/` | `.pi/skills/` | `.pi/agents/` | `.pi/extensions/trellis/` (native `trellis_subagent` tool) + `.pi/settings.json` |
23
23
  | Reasonix | `--reasonix` | `.reasonix/` | `.reasonix/skills/` | None — sub-agents are skills with `runAs: subagent` frontmatter | None |
24
+ | ZCode | `--zcode` | `.zcode/` | `.agents/skills/` | `.zcode/cli/agents/` | pull-based prelude (no hooks) |
24
25
 
25
26
  ## Capability Groups
26
27
 
@@ -40,6 +41,7 @@ These platforms usually have `trellis-research`, `trellis-implement`, and `trell
40
41
  - Factory Droid
41
42
  - Pi Agent
42
43
  - Reasonix (delivered as skills with `runAs: subagent` under `.reasonix/skills/`, not as a separate `agents/` directory)
44
+ - ZCode
43
45
 
44
46
  When changing implementation/check/research behavior, look for the corresponding platform agent files first.
45
47
 
@@ -57,7 +59,7 @@ These platforms rely more on workflows/skills to guide the main session:
57
59
 
58
60
  - Kilo
59
61
  - Antigravity
60
- - Windsurf
62
+ - Devin
61
63
 
62
64
  When changing behavior, inspect workflows and skills first. Do not assume Trellis sub-agents exist.
63
65
 
@@ -25,12 +25,14 @@ Trellis workflow skills usually share one semantic set: brainstorm, before-dev,
25
25
  | Kiro | `.kiro/skills/` |
26
26
  | Gemini CLI | `.agents/skills/`, `.gemini/commands/` |
27
27
  | Antigravity | `.agent/skills/`, `.agent/workflows/` |
28
- | Windsurf | `.windsurf/skills/`, `.windsurf/workflows/` |
28
+ | Devin | `.devin/skills/`, `.devin/workflows/` |
29
29
  | Qoder | `.qoder/skills/`, `.qoder/commands/` |
30
30
  | CodeBuddy | `.codebuddy/skills/`, `.codebuddy/commands/` |
31
31
  | GitHub Copilot | `.github/skills/`, `.github/prompts/` |
32
32
  | Factory Droid | `.factory/skills/`, `.factory/commands/` |
33
33
  | Pi Agent | `.pi/skills/` |
34
+ | Reasonix | `.reasonix/skills/` |
35
+ | ZCode | `.agents/skills/`, `.zcode/commands/` |
34
36
 
35
37
  In a user project, use the files actually generated by init as authoritative.
36
38
 
@@ -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 and Codex conversation logs (the JSONL files each platform stores under `~/.claude/projects/` and `~/.codex/sessions/`) and lets you list, search, slice by Trellis task boundaries, and dump cleaned dialogue from them. 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, and Pi Agent conversation logs (the JSONL files each platform stores under `~/.claude/projects/`, `~/.codex/sessions/`, and `~/.pi/agent/sessions/`) and lets you list, search, slice by Trellis task boundaries, and dump cleaned dialogue from them. OpenCode logs are not yet indexable (provider adapter pending) — when an OpenCode session is the obvious target, surface that limitation rather than guessing.
15
15
 
16
16
  Nothing in `mem` is uploaded. All reads are local.
17
17
 
@@ -64,7 +64,7 @@ trellis mem extract <session-id> --grep "<keyword>"
64
64
  trellis mem context <session-id> --turns 3 --around 2
65
65
 
66
66
  # When you do not know the session id yet, start with list + filter.
67
- trellis mem list --task <task-dir>
67
+ trellis mem list --cwd <project-path>
68
68
  trellis mem projects # → list active project cwds, then narrow
69
69
  ```
70
70
 
@@ -4,32 +4,31 @@ Full flag reference for the five subcommands. Pin this as the authoritative sour
4
4
 
5
5
  ## Subcommands
6
6
 
7
- | Command | Purpose |
8
- |---|---|
9
- | `list` | List sessions. Default subcommand when none is given. |
10
- | `search <keyword>` | Find sessions whose contents match a keyword. |
11
- | `context <session-id>` | Drill into one session: top-N hit turns + surrounding context. Pair with `--grep` for keyword anchoring. |
12
- | `extract <session-id>` | Dump cleaned dialogue. Combine with `--phase` / `--grep` to slice. |
13
- | `projects` | List active project `cwd` values with session counts. Use this to discover which `--cwd` to pass to other subcommands. |
7
+ | Command | Purpose |
8
+ | ---------------------- | ---------------------------------------------------------------------------------------------------------------------- |
9
+ | `list` | List sessions. Default subcommand when none is given. |
10
+ | `search <keyword>` | Find sessions whose contents match a keyword. |
11
+ | `context <session-id>` | Drill into one session: top-N hit turns + surrounding context. Pair with `--grep` for keyword anchoring. |
12
+ | `extract <session-id>` | Dump cleaned dialogue. Combine with `--phase` / `--grep` to slice. |
13
+ | `projects` | List active project `cwd` values with session counts. Use this to discover which `--cwd` to pass to other subcommands. |
14
14
 
15
15
  ## Flags (apply where meaningful)
16
16
 
17
- | Flag | Subcommands | Meaning |
18
- |---|---|---|
19
- | `--platform claude\|codex\|opencode\|all` | all | Default `all`. OpenCode adapter is currently a stub on `0.6.0-beta.*` — see "Caveats" below. |
20
- | `--since YYYY-MM-DD` | list / search | Inclusive lower date bound. |
21
- | `--until YYYY-MM-DD` | list / search | Inclusive upper date bound. |
22
- | `--global` | list / search | Include sessions from every project on this machine. Default is the current project `cwd`. |
23
- | `--cwd <path>` | list / search | Force a specific project cwd instead of inferring from where you are. |
24
- | `--limit N` | list / search | Cap output rows. Default `50`. |
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` = `[task.py start, task.py finish)` window. Default `all`. |
27
- | `--turns N` | context | Number of hit turns to return. Default `3`. |
28
- | `--around N` | context | Surrounding turns to include per hit. Default `1`. |
29
- | `--max-chars N` | context | Total character budget. Default `6000` (~1500 tokens). |
30
- | `--include-children` | search / context | Merge OpenCode sub-agent sessions into their parent session. |
31
- | `--json` | all | Emit machine-parseable JSON instead of human-readable output. |
32
- | `--task <task-dir>` | list | Narrow to sessions whose context-key resolved to a given task directory (uses `.trellis/.runtime/sessions/*.json`). |
17
+ | Flag | Subcommands | Meaning |
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. |
20
+ | `--since YYYY-MM-DD` | list / search | Inclusive lower date bound. |
21
+ | `--until YYYY-MM-DD` | list / search | Inclusive upper date bound. |
22
+ | `--global` | list / search | Include sessions from every project on this machine. Default is the current project `cwd`. |
23
+ | `--cwd <path>` | list / search | Force a specific project cwd instead of inferring from where you are. |
24
+ | `--limit N` | list / search | Cap output rows. Default `50`. |
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`. |
27
+ | `--turns N` | context | Number of hit turns to return. Default `3`. |
28
+ | `--around N` | context | Surrounding turns to include per hit. Default `1`. |
29
+ | `--max-chars N` | context | Total character budget. Default `6000` (~1500 tokens). |
30
+ | `--include-children` | search / context | Merge OpenCode sub-agent sessions into their parent session. |
31
+ | `--json` | all | Emit machine-parseable JSON instead of human-readable output. |
33
32
 
34
33
  ## Common one-liners
35
34
 
@@ -58,7 +57,7 @@ trellis mem projects
58
57
 
59
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.
60
59
  - **`--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.
61
- - **`mem` indexes platform JSONL files directly.** If the user has cleared their Claude / Codex session storage, `mem` cannot recover what is no longer on disk.
60
+ - **`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.
62
61
  - **`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.
63
62
 
64
63
  ## When you need more than this reference
@@ -64,6 +64,49 @@ Each question must include:
64
64
 
65
65
  Do not ask process questions such as whether to search, inspect files, or continue brainstorming. Do the evidence work directly. Ask the user only when the remaining issue is a product decision, preference, scope boundary, or risk tolerance choice.
66
66
 
67
+ ## Thinking Framework: First Principles Analysis
68
+
69
+ When requirements are vague, solutions feel over-engineered, or you're about to add complexity "because everyone does" — decompose to fundamental truths before reasoning upward.
70
+
71
+ ### Step 1: Restate the Problem
72
+
73
+ Strip away implementation details to one sentence.
74
+
75
+ > Bad: "We need to add Redis caching to the user profile endpoint"
76
+ > Good: "User profile data takes too long to load"
77
+
78
+ ### Step 2: List Fundamental Truths
79
+
80
+ What is absolutely true (not opinion or convention)?
81
+
82
+ | Category | Examples |
83
+ |----------|----------|
84
+ | **Physical constraints** | Network latency ≥ 0, disk I/O has limits |
85
+ | **Business rules** | "Users must see their own data" |
86
+ | **Technical invariants** | "Data must be consistent" |
87
+ | **User needs** | "The user wants X within Y seconds" |
88
+
89
+ ### Step 3: Challenge Assumptions
90
+
91
+ For each component of the current plan:
92
+
93
+ - **Fact or convention?** "We always use REST" — why?
94
+ - **What if we removed this?** If nothing breaks, it's unnecessary.
95
+ - **Solving the actual problem or a symptom?** Trace the causal chain.
96
+ - **Who benefits from this complexity?** If "nobody", simplify.
97
+
98
+ ### Step 4: Build Up from Truths
99
+
100
+ 1. Start with the minimum viable mechanism satisfying all truths
101
+ 2. Add complexity only when a specific truth demands it
102
+ 3. Each addition must answer: "Which truth requires this?"
103
+
104
+ ### Step 5: Validate
105
+
106
+ - Does the solution solve the original problem?
107
+ - What assumptions need verification?
108
+ - What's the simplest experiment to test this?
109
+
67
110
  ## Artifact Rules
68
111
 
69
112
  `prd.md` records requirements and acceptance:
@@ -106,6 +106,65 @@ Three levels of insight:
106
106
 
107
107
  30 minutes of analysis saves 30 hours of future debugging.
108
108
 
109
+
110
+ ## Thinking Framework: Bayesian Reasoning
111
+
112
+ When multiple root causes are plausible and evidence is incomplete, update your beliefs proportionally to new evidence rather than clinging to initial assumptions.
113
+
114
+ ### Step 1: Establish Priors
115
+
116
+ Before investigating, state what you believe and why:
117
+
118
+ | Hypothesis | Prior | Reasoning |
119
+ |------------|-------|-----------|
120
+ | H1: [cause A] | 40% | Most common for this pattern |
121
+ | H2: [cause B] | 30% | Plausible given environment |
122
+ | H3: [other] | 30% | Catch-all |
123
+
124
+ Priors must sum to 100%. If you can't assign probabilities, investigate first.
125
+
126
+ ### Step 2: Observe Evidence
127
+
128
+ Document what you found — be specific about reliability:
129
+
130
+ - What exactly did you observe?
131
+ - How reliable? (test output > log message > user report > hunch)
132
+ - Could multiple hypotheses explain this?
133
+
134
+ ### Step 3: Update Beliefs
135
+
136
+ For each hypothesis, ask: **How likely is this evidence if this hypothesis were true?**
137
+
138
+ Direction of update matters more than calculation:
139
+ - Evidence strongly predicted by H1 → H1 probability increases
140
+ - Evidence contradicts H2 → H2 probability decreases
141
+ - Evidence equally likely under all → no update
142
+
143
+ ### Step 4: Seek Discriminating Evidence
144
+
145
+ Don't gather more of the same. Find evidence that **differs strongly** between top hypotheses.
146
+
147
+ > If H1 and H3 are close: "What would I see if H1 is true but not if H3 is true?" Then check for that.
148
+
149
+ ### Step 5: State Confidence
150
+
151
+ | Confidence | Action |
152
+ |------------|--------|
153
+ | 90%+ | Proceed with fix, monitor |
154
+ | 70-90% | Proceed, add fallback check |
155
+ | 50-70% | Test hypothesis before committing |
156
+ | <50% | Need more evidence, don't guess |
157
+
158
+ Never express binary certainty when evidence is incomplete. Use "most likely", "plausible but unlikely", "worth investigating".
159
+
160
+ ### Common Fallacies
161
+
162
+ | Fallacy | Example | Correction |
163
+ |---------|---------|------------|
164
+ | **Base rate neglect** | "Test failed → code is broken" | How often do tests fail for other reasons? |
165
+ | **Confirmation bias** | "Must be a race condition, let me find race evidence" | Actively seek evidence AGAINST your top hypothesis |
166
+ | **Anchoring** | "Last time it was caching, probably caching again" | Establish priors from current context, not yesterday's bug |
167
+
109
168
  ---
110
169
 
111
170
  ## After Analysis: Immediate Actions
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "trellis",
3
+ "description": "Trellis workflow main agent. Drives the Trellis development workflow: reads .trellis/workflow.md, classifies each turn, and routes work through plan / implement / check phases. Use as the default Kiro agent for projects that run Trellis.",
4
+ "prompt": "# Trellis Workflow Agent\n\nYou are the main session agent for a project that uses the Trellis workflow.\n\n## On Every Turn\n\nA `userPromptSubmit` hook injects a `<workflow-state>` breadcrumb each turn telling you the active task and its current phase. An `agentSpawn` hook injects a `<session-context>` overview when this agent starts. Trust those injections to orient yourself — do not re-derive context from scratch.\n\n## How to Work\n\n1. **Follow the workflow.** `.trellis/workflow.md` is the single source of truth for phases and steps. It is also attached as a resource for this agent. Read it (or the injected Phase Index) and follow the matching phase.\n2. **Resolve the active task** with `python3 ./.trellis/scripts/task.py current --source` when the breadcrumb is missing or stale.\n3. **Classify the turn** before acting: simple conversation, small edit, or a complex task that needs a Trellis task directory + planning. Do not create a task for trivial turns.\n4. **Plan before implementing.** For complex work, write `prd.md` (and `design.md` / `implement.md` when warranted) and get the user's confirmation before entering implementation.\n5. **Load task context in order** for implementation/check: jsonl entries -> `prd.md` -> `design.md` (if present) -> `implement.md` (if present).\n6. **Verify** with the project's lint / type-check / test commands before declaring work done.\n\n## Constraints\n\n- Do NOT run `git commit` / `git push` / `git merge` unless the user explicitly asks.\n- Keep changes surgical and scoped to the request.\n- Discover guidelines on demand: `python3 ./.trellis/scripts/get_context.py --mode packages`.\n",
5
+ "tools": [
6
+ "read",
7
+ "write",
8
+ "shell",
9
+ "glob",
10
+ "grep"
11
+ ],
12
+ "allowedTools": [
13
+ "read",
14
+ "write",
15
+ "shell",
16
+ "glob",
17
+ "grep"
18
+ ],
19
+ "resources": [
20
+ "file://.trellis/workflow.md"
21
+ ],
22
+ "hooks": {
23
+ "agentSpawn": [
24
+ {
25
+ "command": "{{PYTHON_CMD}} .kiro/hooks/session-start.py"
26
+ }
27
+ ],
28
+ "userPromptSubmit": [
29
+ {
30
+ "command": "{{PYTHON_CMD}} .kiro/hooks/inject-workflow-state.py"
31
+ }
32
+ ]
33
+ }
34
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "enabled": true,
4
+ "name": "trellis-workflow-state",
5
+ "description": "Inject Trellis workflow state on each prompt",
6
+ "when": {
7
+ "type": "promptSubmit"
8
+ },
9
+ "then": {
10
+ "type": "runCommand",
11
+ "command": "{{PYTHON_CMD}} .kiro/hooks/inject-workflow-state.py",
12
+ "timeout": 30
13
+ }
14
+ }
@@ -2,11 +2,14 @@
2
2
  * Kiro templates
3
3
  *
4
4
  * Kiro uses pure JSON agent definitions, not Markdown.
5
- * Hooks are embedded in agent JSON, not in a separate config file.
5
+ * CLI agents embed hooks in their JSON (`hooks.agentSpawn`,
6
+ * `hooks.userPromptSubmit`); the IDE surface reads standalone `.kiro.hook`
7
+ * JSON files (`when`/`then` schema).
6
8
  *
7
9
  * Directory structure:
8
10
  * kiro/
9
- * └── agents/ # Agent definitions (JSON)
11
+ * ├── agents/ # Agent definitions (JSON) — main `trellis` + 3 sub-agents
12
+ * └── hooks/ # IDE `.kiro.hook` definitions (JSON)
10
13
  */
11
14
  import { type AgentTemplate } from "../template-utils.js";
12
15
  export type { AgentTemplate };
@@ -15,4 +18,15 @@ export type { AgentTemplate };
15
18
  * Content contains {{PYTHON_CMD}} placeholder that must be resolved before writing.
16
19
  */
17
20
  export declare const getAllAgents: () => AgentTemplate[];
21
+ export interface IdeHookTemplate {
22
+ /** Filename (e.g. "trellis-workflow-state.kiro.hook") */
23
+ name: string;
24
+ /** Raw JSON content; contains {{PYTHON_CMD}} placeholder. */
25
+ content: string;
26
+ }
27
+ /**
28
+ * Get all Kiro IDE hook templates (`*.kiro.hook` JSON files).
29
+ * Content contains {{PYTHON_CMD}} placeholder that must be resolved before writing.
30
+ */
31
+ export declare const getIdeHooks: () => IdeHookTemplate[];
18
32
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/kiro/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAChF,YAAY,EAAE,aAAa,EAAE,CAAC;AAI9B;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAO,aAAa,EAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/kiro/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAChF,YAAY,EAAE,aAAa,EAAE,CAAC;AAM9B;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAO,aAAa,EAAsB,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC9B,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,QAAO,eAAe,EAGqB,CAAC"}
@@ -2,17 +2,27 @@
2
2
  * Kiro templates
3
3
  *
4
4
  * Kiro uses pure JSON agent definitions, not Markdown.
5
- * Hooks are embedded in agent JSON, not in a separate config file.
5
+ * CLI agents embed hooks in their JSON (`hooks.agentSpawn`,
6
+ * `hooks.userPromptSubmit`); the IDE surface reads standalone `.kiro.hook`
7
+ * JSON files (`when`/`then` schema).
6
8
  *
7
9
  * Directory structure:
8
10
  * kiro/
9
- * └── agents/ # Agent definitions (JSON)
11
+ * ├── agents/ # Agent definitions (JSON) — main `trellis` + 3 sub-agents
12
+ * └── hooks/ # IDE `.kiro.hook` definitions (JSON)
10
13
  */
11
14
  import { createTemplateReader } from "../template-utils.js";
12
- const { listJsonAgents } = createTemplateReader(import.meta.url);
15
+ const { listFiles, readTemplate, listJsonAgents } = createTemplateReader(import.meta.url);
13
16
  /**
14
17
  * Get all Kiro agent templates (JSON format).
15
18
  * Content contains {{PYTHON_CMD}} placeholder that must be resolved before writing.
16
19
  */
17
20
  export const getAllAgents = () => listJsonAgents();
21
+ /**
22
+ * Get all Kiro IDE hook templates (`*.kiro.hook` JSON files).
23
+ * Content contains {{PYTHON_CMD}} placeholder that must be resolved before writing.
24
+ */
25
+ export const getIdeHooks = () => listFiles("hooks")
26
+ .filter((f) => f.endsWith(".kiro.hook"))
27
+ .map((f) => ({ name: f, content: readTemplate(`hooks/${f}`) }));
18
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/kiro/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,oBAAoB,EAAsB,MAAM,sBAAsB,CAAC;AAGhF,MAAM,EAAE,cAAc,EAAE,GAAG,oBAAoB,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEjE;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAoB,EAAE,CAAC,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/kiro/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,oBAAoB,EAAsB,MAAM,sBAAsB,CAAC;AAGhF,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,oBAAoB,CACtE,MAAM,CAAC,IAAI,CAAC,GAAG,CAChB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAoB,EAAE,CAAC,cAAc,EAAE,CAAC;AASpE;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAsB,EAAE,CACjD,SAAS,CAAC,OAAO,CAAC;KACf,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;KACvC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC"}
@@ -29,11 +29,19 @@ export type SharedHookPlatform = "claude" | "cursor" | "codex" | "gemini" | "qod
29
29
  * Class-2 (pull-based) platforms (codex, copilot, gemini, qoder) can't
30
30
  * have hooks mutate sub-agent prompts — their sub-agents load context
31
31
  * via a prelude instead.
32
- * - Kiro supports only `agentSpawn` (no SessionStart / UserPromptSubmit
33
- * event), so it takes just `inject-subagent-context.py`.
32
+ * - Kiro supports per-turn + spawn hooks on both surfaces (per the official
33
+ * docs https://kiro.dev/docs/cli/hooks/): the CLI custom agent declares
34
+ * `hooks.userPromptSubmit` + `hooks.agentSpawn`, and the IDE declares a
35
+ * `.kiro.hook` with `when.type=promptSubmit`. So Kiro ships
36
+ * `session-start.py` (agentSpawn overview), `inject-workflow-state.py`
37
+ * (per-turn breadcrumb), and `inject-subagent-context.py` (sub-agent
38
+ * spawn). The scripts emit a plain-text Kiro branch — Kiro adds a hook's
39
+ * stdout directly to the conversation context (no JSON envelope).
34
40
  * - Claude Code `statusLine` is intentionally not installed by default.
35
- * Users can add their own statusLine command in `.claude/settings.json`
36
- * without Trellis owning a generated hook file.
41
+ * Users can add their own statusLine command in `.claude/settings.json`,
42
+ * or opt in to the Trellis one via `trellis init --with-statusline`
43
+ * (installed from `templates/claude/hooks/`, not from this table — no
44
+ * other platform has a statusLine event).
37
45
  */
38
46
  export declare const SHARED_HOOKS_BY_PLATFORM: Record<SharedHookPlatform, readonly SharedHookName[]>;
39
47
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/shared-hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,MAAM,WAAW,UAAU;IACzB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,cAAc,GACtB,kBAAkB,GAClB,iCAAiC,GACjC,0BAA0B,GAC1B,4BAA4B,CAAC;AAEjC,MAAM,MAAM,kBAAkB,GAC1B,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,OAAO,GACP,SAAS,GACT,WAAW,GACX,OAAO,GACP,MAAM,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAC3C,kBAAkB,EAClB,SAAS,cAAc,EAAE,CA2B1B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,UAAU,EAAE,CAWnD;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,kBAAkB,GAC3B,UAAU,EAAE,CAGd"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/shared-hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,MAAM,WAAW,UAAU;IACzB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,cAAc,GACtB,kBAAkB,GAClB,iCAAiC,GACjC,0BAA0B,GAC1B,4BAA4B,CAAC;AAEjC,MAAM,MAAM,kBAAkB,GAC1B,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,OAAO,GACP,SAAS,GACT,WAAW,GACX,OAAO,GACP,MAAM,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAC3C,kBAAkB,EAClB,SAAS,cAAc,EAAE,CA+B1B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,UAAU,EAAE,CAWnD;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,kBAAkB,GAC3B,UAAU,EAAE,CAGd"}
@@ -29,11 +29,19 @@ function readTemplate(relativePath) {
29
29
  * Class-2 (pull-based) platforms (codex, copilot, gemini, qoder) can't
30
30
  * have hooks mutate sub-agent prompts — their sub-agents load context
31
31
  * via a prelude instead.
32
- * - Kiro supports only `agentSpawn` (no SessionStart / UserPromptSubmit
33
- * event), so it takes just `inject-subagent-context.py`.
32
+ * - Kiro supports per-turn + spawn hooks on both surfaces (per the official
33
+ * docs https://kiro.dev/docs/cli/hooks/): the CLI custom agent declares
34
+ * `hooks.userPromptSubmit` + `hooks.agentSpawn`, and the IDE declares a
35
+ * `.kiro.hook` with `when.type=promptSubmit`. So Kiro ships
36
+ * `session-start.py` (agentSpawn overview), `inject-workflow-state.py`
37
+ * (per-turn breadcrumb), and `inject-subagent-context.py` (sub-agent
38
+ * spawn). The scripts emit a plain-text Kiro branch — Kiro adds a hook's
39
+ * stdout directly to the conversation context (no JSON envelope).
34
40
  * - Claude Code `statusLine` is intentionally not installed by default.
35
- * Users can add their own statusLine command in `.claude/settings.json`
36
- * without Trellis owning a generated hook file.
41
+ * Users can add their own statusLine command in `.claude/settings.json`,
42
+ * or opt in to the Trellis one via `trellis init --with-statusline`
43
+ * (installed from `templates/claude/hooks/`, not from this table — no
44
+ * other platform has a statusLine event).
37
45
  */
38
46
  export const SHARED_HOOKS_BY_PLATFORM = {
39
47
  claude: [
@@ -60,7 +68,11 @@ export const SHARED_HOOKS_BY_PLATFORM = {
60
68
  "inject-workflow-state.py",
61
69
  "inject-subagent-context.py",
62
70
  ],
63
- kiro: ["inject-subagent-context.py"],
71
+ kiro: [
72
+ "session-start.py",
73
+ "inject-workflow-state.py",
74
+ "inject-subagent-context.py",
75
+ ],
64
76
  };
65
77
  /**
66
78
  * Get all shared hook scripts. Content is platform-independent and can be
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/shared-hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,SAAS,YAAY,CAAC,YAAoB;IACxC,OAAO,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC;AA0BD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAGjC;IACF,MAAM,EAAE;QACN,kBAAkB;QAClB,0BAA0B;QAC1B,4BAA4B;KAC7B;IACD,MAAM,EAAE;QACN,kBAAkB;QAClB,iCAAiC;QACjC,4BAA4B;KAC7B;IACD,KAAK,EAAE,CAAC,0BAA0B,CAAC;IACnC,MAAM,EAAE,CAAC,kBAAkB,EAAE,0BAA0B,CAAC;IACxD,KAAK,EAAE,CAAC,kBAAkB,EAAE,0BAA0B,CAAC;IACvD,OAAO,EAAE,CAAC,0BAA0B,CAAC;IACrC,SAAS,EAAE;QACT,kBAAkB;QAClB,0BAA0B;QAC1B,4BAA4B;KAC7B;IACD,KAAK,EAAE;QACL,kBAAkB;QAClB,0BAA0B;QAC1B,4BAA4B;KAC7B;IACD,IAAI,EAAE,CAAC,4BAA4B,CAAC;CACrC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC;SACjC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAChC,IAAI,EAAE,CAAC;IAEV,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAC7C,QAA4B;IAE5B,MAAM,OAAO,GAAG,IAAI,GAAG,CAAS,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpE,OAAO,oBAAoB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACnE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/shared-hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,SAAS,YAAY,CAAC,YAAoB;IACxC,OAAO,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC;AA0BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAGjC;IACF,MAAM,EAAE;QACN,kBAAkB;QAClB,0BAA0B;QAC1B,4BAA4B;KAC7B;IACD,MAAM,EAAE;QACN,kBAAkB;QAClB,iCAAiC;QACjC,4BAA4B;KAC7B;IACD,KAAK,EAAE,CAAC,0BAA0B,CAAC;IACnC,MAAM,EAAE,CAAC,kBAAkB,EAAE,0BAA0B,CAAC;IACxD,KAAK,EAAE,CAAC,kBAAkB,EAAE,0BAA0B,CAAC;IACvD,OAAO,EAAE,CAAC,0BAA0B,CAAC;IACrC,SAAS,EAAE;QACT,kBAAkB;QAClB,0BAA0B;QAC1B,4BAA4B;KAC7B;IACD,KAAK,EAAE;QACL,kBAAkB;QAClB,0BAA0B;QAC1B,4BAA4B;KAC7B;IACD,IAAI,EAAE;QACJ,kBAAkB;QAClB,0BAA0B;QAC1B,4BAA4B;KAC7B;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC;SACjC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAChC,IAAI,EAAE,CAAC;IAEV,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAC7C,QAA4B;IAE5B,MAAM,OAAO,GAAG,IAAI,GAAG,CAAS,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpE,OAAO,oBAAoB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACnE,CAAC"}
@@ -18,9 +18,11 @@ missing or a tag is absent, the breadcrumb degrades to a generic
18
18
  the broken state instead of the hook silently masking it.
19
19
 
20
20
  Shared across all hook-capable platforms (Claude, Cursor, Codex, Qoder,
21
- CodeBuddy, Droid, Gemini, Copilot). Kiro is not wired (no per-turn
22
- hook entry point). Written to each platform's hooks directory via
23
- writeSharedHooks() at init time.
21
+ CodeBuddy, Droid, Gemini, Copilot, Kiro). Kiro wires this via the CLI
22
+ custom agent's ``hooks.userPromptSubmit`` and the IDE ``.kiro.hook``
23
+ ``promptSubmit`` event; its output branch emits a plain-text breadcrumb
24
+ (Kiro adds hook stdout directly to the conversation context). Written to
25
+ each platform's hooks directory via writeSharedHooks() at init time.
24
26
 
25
27
  Silent exit 0 cases (no output):
26
28
  - No .trellis/ directory found (not a Trellis project)
@@ -342,6 +344,14 @@ def main() -> int:
342
344
  parts.append(breadcrumb)
343
345
  breadcrumb = "\n\n".join(parts)
344
346
 
347
+ # Kiro (CLI userPromptSubmit / IDE promptSubmit) adds a hook's stdout
348
+ # directly to the conversation context — no JSON envelope. Emit the bare
349
+ # breadcrumb text. Conditionally isolated: all other platforms keep the
350
+ # hookSpecificOutput JSON path below unchanged.
351
+ if platform == "kiro":
352
+ print(breadcrumb)
353
+ return 0
354
+
345
355
  # Gemini CLI 0.40.x rejects "UserPromptSubmit" — its per-turn event is
346
356
  # named "BeforeAgent". Other platforms (Claude/Cursor/Qoder/CodeBuddy/
347
357
  # Droid/Codex/Copilot) accept the original Claude-style name.
@@ -813,6 +813,14 @@ Context loaded. Follow <task-status>. Load workflow/spec/task details only when
813
813
  </ready>""")
814
814
 
815
815
  context_text = output.getvalue()
816
+
817
+ # Kiro (CLI trellis agent agentSpawn) adds a hook's stdout directly to the
818
+ # conversation context — no JSON envelope. Emit the bare overview text.
819
+ # Conditionally isolated: all other platforms keep the JSON path below.
820
+ if _detect_platform(hook_input) == "kiro":
821
+ print(context_text, flush=True)
822
+ return
823
+
816
824
  result = {
817
825
  # Claude Code / Qoder / CodeBuddy / Droid / Gemini / Copilot format
818
826
  "hookSpecificOutput": {
@@ -28,6 +28,8 @@ from datetime import datetime
28
28
  from pathlib import Path
29
29
 
30
30
  from common.paths import (
31
+ DIR_TASKS,
32
+ DIR_WORKFLOW,
31
33
  FILE_JOURNAL_PREFIX,
32
34
  get_repo_root,
33
35
  get_current_task,
@@ -319,12 +321,14 @@ def update_index(
319
321
  # =============================================================================
320
322
 
321
323
  def _auto_commit_workspace(repo_root: Path) -> None:
322
- """Stage Trellis-owned workspace + task paths and commit.
324
+ """Stage Trellis-owned workspace + current-task paths and commit.
323
325
 
324
- Path scope is restricted to specific products (journal files, index.md,
325
- active task dirs, the archive subtree). We never `git add` the whole
326
- `.trellis/` tree, and if `.gitignore` blocks the specific paths we
327
- warn + skip never retry with ``-f``.
326
+ Path scope is restricted to specific products: the current developer's
327
+ journal files + index.md, and ONLY the current task directory (resolved
328
+ via ``get_current_task``). We never `git add` the whole `.trellis/` tree
329
+ or iterate over all active task dirs (#303: parallel-window dirty task
330
+ dirs must not be bundled into the session auto-commit). If `.gitignore`
331
+ blocks the specific paths we warn + skip — never retry with ``-f``.
328
332
 
329
333
  Honors ``session_auto_commit`` in ``.trellis/config.yaml``: when set to
330
334
  ``false``, this function returns immediately without touching git
@@ -338,7 +342,23 @@ def _auto_commit_workspace(repo_root: Path) -> None:
338
342
  return
339
343
 
340
344
  commit_msg = get_session_commit_message(repo_root)
341
- paths = safe_trellis_paths_to_add(repo_root)
345
+ # Resolve the current task so staging is scoped to its dir only. The ref
346
+ # is ``.trellis/tasks/<name>`` (or under archive/) — pass the bare name.
347
+ current = get_current_task(repo_root)
348
+ if current:
349
+ task_name = Path(current).name
350
+ paths = safe_trellis_paths_to_add(repo_root, task_name=task_name)
351
+ else:
352
+ # Current task unknown (0 or >=2 parallel sessions — exactly the
353
+ # parallel-window case #303 is about). Do NOT fall back to the wide
354
+ # `tasks_dir.iterdir()` scan; that would re-leak other tasks' dirty
355
+ # dirs into the session commit. Stage only the developer's journal/
356
+ # index and skip every task dir.
357
+ paths = [
358
+ p
359
+ for p in safe_trellis_paths_to_add(repo_root, task_name=None)
360
+ if not p.startswith(f"{DIR_WORKFLOW}/{DIR_TASKS}/")
361
+ ]
342
362
  if not paths:
343
363
  print("[OK] No workspace changes to commit.", file=sys.stderr)
344
364
  return