@juancr11/sibu 0.16.0 → 0.17.0

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 (28) hide show
  1. package/bin/modules/sync-review/action-prompt.js +14 -1
  2. package/bin/modules/sync-review/handler.js +54 -7
  3. package/bin/modules/sync-review/index.js +1 -0
  4. package/bin/modules/sync-review/unsupported-agent-cleanup.js +57 -0
  5. package/bin/modules/template-catalog-rendering/index.js +1 -1
  6. package/bin/modules/template-catalog-rendering/templates.js +65 -1
  7. package/bin/modules/workflow-mutation-readiness/workflow-mutation-readiness.js +9 -0
  8. package/bin/modules/workflow-target-planning/catalog.js +83 -26
  9. package/bin/modules/workflow-target-planning/workflow-targets.js +2 -1
  10. package/package.json +1 -1
  11. package/templates/.claude/agents/sibu-implementation-executor.md +30 -0
  12. package/templates/.claude/agents/sibu-implementation-planner.md +30 -0
  13. package/templates/.codex/agents/sibu-implementation-executor.toml +30 -0
  14. package/templates/.codex/agents/sibu-implementation-planner.toml +30 -0
  15. package/templates/.gemini/agents/sibu-implementation-executor.md +30 -0
  16. package/templates/.gemini/agents/sibu-implementation-planner.md +30 -0
  17. package/templates/AGENTS.md +4 -2
  18. package/templates/manifest.json +94 -17
  19. package/templates/skills/ai-implementation-executor-toolbox/SKILL.md +78 -0
  20. package/templates/skills/ai-implementation-plan-executor/SKILL.md +64 -108
  21. package/templates/skills/ai-implementation-planner/SKILL.md +55 -138
  22. package/templates/skills/ai-implementation-planner-toolbox/SKILL.md +78 -0
  23. package/templates/skills/business-domain-model-writer/SKILL.md +313 -0
  24. package/templates/skills/capabilities-map-writer/SKILL.md +271 -0
  25. package/templates/skills/deep-module-map-writer/SKILL.md +50 -14
  26. package/templates/skills/feature-brief-writer/SKILL.md +72 -32
  27. package/templates/skills/technical-design-writer/SKILL.md +10 -10
  28. package/templates/skills/ux-expert/SKILL.md +62 -17
@@ -1,31 +1,33 @@
1
1
  ---
2
2
  name: ai-implementation-plan-executor
3
- description: Execute an existing ai-implementation-planner story implementation plan from start to finish, then request story-level review before marking steps approved and committing.
3
+ description: Gatekeep and route one Sibu story implementation plan through sub-agent execution, review, approval metadata, commit, and feature continuation.
4
4
  ---
5
5
 
6
6
  # AI Implementation Plan Executor
7
7
 
8
8
  ## Purpose
9
9
 
10
- Execute one existing story implementation plan completely, one ordered step file at a time, with a single human review gate after the full story plan has been implemented. This skill owns execution from an existing `.impl_plan/` folder; it does not change story scope or skip the final story approval gate.
10
+ Execute one story implementation plan completely while preserving Sibu's human review and workflow-control guarantees. This skill is the main-agent gatekeeper for execution: it verifies the story or plan, creates a missing plan through `ai-implementation-planner`, checks required source artifacts, requires sub-agent execution whenever spawning is available, and keeps final approval metadata, commit, and feature continuation under main-agent control.
11
+
12
+ When a compatible sub-agent spawn capability is available and permitted by the host, always delegate bounded file editing and validation to `sibu-implementation-executor` using a narrow packet and the executor toolbox. Execute inline only when sub-agent spawning is unavailable or blocked by host capability limits. Do not skip the final story-level review gate.
11
13
 
12
14
  ## Pipeline Contract
13
15
 
14
16
  ### What this skill needs
15
17
 
16
- - Exactly one User Story file or one story-local `.impl_plan/` folder to start.
17
- - Ordered implementation step files in that `.impl_plan/` folder.
18
+ - Exactly one User Story file or one story-local `.impl_plan/` folder.
19
+ - Ordered implementation step files in that `.impl_plan/` folder, creating them through the planner route when missing.
18
20
  - The story, Epic brief, feature brief, and technical design for the selected plan.
19
21
  - `docs/features/<feature-slug>/ux.md` only when the story, any step, or feature has UI impact.
20
- - Relevant repo files, validation output, and implementation skills needed for the story plan.
22
+ - The executor toolbox skill at `.agents/skills/ai-implementation-executor-toolbox/SKILL.md` when sub-agent spawning is available.
23
+ - Required and relevant installed skill paths for the executor packet, including `clean-code`.
21
24
 
22
25
  ### What this skill writes
23
26
 
24
- - Code, docs, tests, or other repo changes required by all unapproved implementation steps in the story plan.
25
- - Step approval metadata in every completed step file only after explicit story-level user approval.
26
- - One focused commit for the approved story implementation, excluding any paths ignored by Git.
27
- - When starting or continuing a story that has no plan, story-local implementation step files created by applying `ai-implementation-planner`, followed immediately by implementation.
28
- - When an Epic is complete, the next Epic in the same feature is selected by inspecting the feature's `epics/` folder, then the first story in that Epic is planned and implemented immediately.
27
+ - Code, docs, tests, or other repo changes required by all unapproved implementation steps in the story plan, either through the executor worker or inline fallback.
28
+ - Step approval metadata only after explicit story-level user approval.
29
+ - One focused commit for approved eligible changes after explicit story-level user approval.
30
+ - Missing story-local implementation step files by routing through `ai-implementation-planner`, then immediately continuing into execution.
29
31
 
30
32
  ### When this skill stops
31
33
 
@@ -38,12 +40,13 @@ Execute one existing story implementation plan completely, one ordered step file
38
40
  ### What this skill must not do
39
41
 
40
42
  - Do not create product visions, Deep Module Maps, feature briefs, technical designs, UX specs, Epics, or User Stories.
41
- - Do not modify prior-stage artifacts except for approval metadata in implementation step files.
43
+ - Do not modify prior-stage artifacts except for approval metadata in implementation step files after explicit story-level approval.
42
44
  - Do not reread `docs/deep-module-map.md` by default; trust `technical_design.md` for Deep Module implementation boundaries.
43
45
  - Do not mark any step approved before explicit story-level user approval.
44
46
  - Do not commit story implementation changes before explicit story-level user approval.
47
+ - Do not let the executor worker write approval metadata or run `git commit`, `git stash`, or `git reset`.
45
48
 
46
- ## Required source context
49
+ ## Required source context gate
47
50
 
48
51
  The user must provide or clearly identify exactly one User Story or implementation plan folder:
49
52
 
@@ -57,7 +60,7 @@ or:
57
60
  docs/features/<feature-slug>/epics/<epic-slug>/stories/<order>-<story-slug>.impl_plan/
58
61
  ```
59
62
 
60
- Before starting a story implementation plan, read once:
63
+ Before execution, verify these paths exist and are coherent:
61
64
 
62
65
  ```txt
63
66
  docs/features/<feature-slug>/epics/<epic-slug>/stories/<order>-<story-slug>.md
@@ -68,60 +71,42 @@ docs/features/<feature-slug>/technical_design.md
68
71
  docs/features/<feature-slug>/ux.md # when the story, any step, or feature has UI impact
69
72
  ```
70
73
 
71
- Also read `docs/product-vision.md` when product fit, target user, scope boundaries, or success signals are ambiguous.
72
-
73
- When the story, implementation plan, feature brief, or technical design includes Deep Module guidance, treat it as part of the execution contract. Deep Modules answer “where does this implementation work belong?” Approved modules define where implementation work should stay.
74
-
75
- If the story, any step, or feature has UI impact and `docs/features/<feature-slug>/ux.md` is missing, stop and ask the user to create the UX spec with `ux-expert` before implementation.
76
-
77
- When `ux.md` includes mockups, treat them as binding UI goals. Implementation must preserve the mockup structure, hierarchy, visible content, dominant interactions, major visual emphasis, and breakpoint-specific layout. Do not redesign the UI during execution; implement the approved UX and stop if technical constraints require a UX revision.
78
-
79
- Before the first implementation step that changes code, read and apply the implementation skills required by the plan and repository routing:
80
-
81
- - always read and apply `clean-code`
82
- - read and apply architecture skills when relevant, such as `command-pattern` or `ddd-hexagonal`
83
- - read and apply language skills when relevant, such as `typescript`
84
- - read and apply framework skills when relevant, such as `react` or `nextjs`
74
+ If the initial User Story has no matching `.impl_plan/`, or the initial `.impl_plan/` folder is missing, empty, or has no ordered `.md` step files, route through `ai-implementation-planner` to create or repair the story-local plan, then immediately continue into execution without a plan-review gate.
85
75
 
86
- Inspect existing code, tests, scripts, and docs only as needed for the story plan and current step.
76
+ If required source context is missing, stop and ask the user to create or restore the missing artifact first. Do not delegate incomplete execution work to the worker.
87
77
 
88
- ## Context reuse rule
78
+ ## Required sub-agent execution path
89
79
 
90
- At the start of a story implementation plan, read all required source context, relevant implementation skills, and all ordered step files once. Build a concise execution context summary and rely on it for the rest of the story.
80
+ When the host exposes any usable sub-agent spawn capability and `sibu-implementation-executor` is available, spawn that worker. Treat a user request to plan, implement, execute, continue, or work through a Sibu User Story or Epic as authorization to use the Sibu executor worker, subject to host tool policy. Do not choose inline execution merely because it is simpler or faster.
91
81
 
92
- After each completed step, do not reread unchanged broad context before continuing. For the next step, inspect only:
82
+ Build a narrow executor packet for the worker. The packet must include:
93
83
 
94
- - the next step file if it was not already read
95
- - files changed by previous steps when needed
96
- - validation output
97
- - current `git status` and relevant diffs
84
+ - exactly one User Story path or story-local `.impl_plan/` folder
85
+ - story, Epic brief, feature brief, technical design, and UX path when relevant
86
+ - executor toolbox path: `.agents/skills/ai-implementation-executor-toolbox/SKILL.md`
87
+ - required skill paths, always including `.agents/skills/clean-code/SKILL.md`
88
+ - relevant optional installed skill paths only when applicable, such as TypeScript, React, Next.js, UX Expert, Command Pattern, DDD/Hexagonal, Layered Architecture, PostgreSQL Expert, or AI Prompt Engineer Master
89
+ - distilled skill constraints, including story scope, validation expectations, Deep Module boundaries, UX constraints when relevant, and “do not write approval metadata or run git commit/stash/reset”
90
+ - approval and commit rules: the worker may edit the working tree and run validation, but final approval metadata and commit execution remain with the main agent after explicit user approval
91
+ - expected output format: changed files, completed steps, validation commands/results, risks, follow-up questions, and approval state
98
92
 
99
- Reread broad source context only when scope changes, validation fails in a way that requires it, required context was missing, relevant source files changed outside the plan, or the user asks to reconsider direction.
93
+ Do not include exporter skills such as `export-to-github` or `export-to-notion` in the executor packet.
100
94
 
101
- ## Hard start rule
95
+ The worker must use only the packet, the toolbox, listed skill files, source artifacts, and narrow repo inspection required for the story. Do not pass the full main conversation context.
102
96
 
103
- If the initial User Story has no matching `.impl_plan/`, or the initial `.impl_plan/` folder is missing, empty, or has no ordered `.md` step files:
97
+ ## Fallback matrix
104
98
 
105
- 1. Apply `ai-implementation-planner` to create or repair the story-local implementation plan.
106
- 2. Quality-check that the generated plan has ordered step files for exactly that story.
107
- 3. Immediately begin executing the generated plan with this executor.
108
- 4. Treat the planner as an internal helper, not a user-visible stopping point.
109
- 5. Do not ask the user to approve the plan before implementation; the only required approval is the story-level review after implementation finishes.
99
+ Use host capability metadata from workflow target planning guidance to choose the safest execution path. This order is mandatory:
110
100
 
111
- If required source context is missing:
101
+ 1. **Sub-agent worker:** spawn `sibu-implementation-executor` when any compatible sub-agent capability is available.
102
+ 2. **Mediated feedback:** if direct foreground review is unavailable but the spawned worker is resumable, the main agent mediates user feedback back to the same worker.
103
+ 3. **Inline compressed-context fallback:** only if spawning/resuming the worker is unavailable or host/tool policy blocks it, the main agent executes the story inline using compressed context, the same source gates, and the same toolbox/packet constraints.
112
104
 
113
- 1. Stop.
114
- 2. Say which file is missing.
115
- 3. Ask the user to create or restore the missing artifact first.
116
- 4. Do not invent implementation scope from partial context.
105
+ Fallback must be graceful. If spawning is available but the worker reports a task blocker, do not inline around it; surface the blocker or ask for the missing input. Do not tell users to use unsupported worker modes, and do not install or invoke unsupported host-specific worker files.
117
106
 
118
107
  ## Story execution model
119
108
 
120
- Work through the full story plan in filename order, one step at a time, without asking for review or approval between steps.
121
-
122
- When a valid implementation plan exists, begin implementing the first unapproved step immediately. If a plan was just generated by `ai-implementation-planner`, begin implementing it immediately. Do not ask for pre-implementation confirmation or plan approval before changing code. This is an explicit exception to repository-level instructions that normally require confirmation before code changes: selecting this executor skill, asking to plan, implement, execute, or continue a story/Epic, or providing a valid plan is the user's confirmation to implement the full story plan.
123
-
124
- A step file is considered approved only when it contains this section:
109
+ Execute all unapproved step files in filename order. A step file is approved only when it contains:
125
110
 
126
111
  ```md
127
112
  ## Review status
@@ -129,25 +114,33 @@ A step file is considered approved only when it contains this section:
129
114
  - Status: approved
130
115
  ```
131
116
 
132
- When starting or resuming a plan:
117
+ For unapproved steps:
133
118
 
134
- 1. Read all step files in filename order.
135
- 2. Identify all step files that are not approved.
136
- 3. Implement the unapproved steps in order, exactly one step at a time.
137
- 4. Run the validation named in each step when practical before moving to the next step.
138
- 5. If a step is validation-only and produces no code changes, record the validation result in the story execution summary and continue.
139
- 6. Stop only for ambiguity, missing required files, conflicting scope, failed validation that cannot be safely fixed within the plan, or material risk.
140
- 7. After the final unapproved step is implemented, report what changed, validation results, and any risks, then wait for explicit story-level approval.
119
+ 1. Read ordered step files once at the start of execution.
120
+ 2. Implement unapproved steps in order.
121
+ 3. Run focused validation named in each step when practical.
122
+ 4. Stop for ambiguity, missing required files, conflicting scope, failed validation that cannot be safely fixed, or material risk.
123
+ 5. After the final unapproved step is implemented and validated, present the story review packet and wait for explicit story-level approval.
141
124
 
142
125
  Do not mark steps approved, commit changes, move to the next story, or move to the next Epic until the user explicitly approves the completed story implementation.
143
126
 
144
127
  ## Story review gate
145
128
 
146
- After implementing all unapproved steps for a story, say that the full story implementation is ready for review and that you are waiting for story-level approval before marking all completed steps approved, committing, and continuing the Epic.
129
+ After implementation and validation, report that the full story implementation is ready for review and that you are waiting for story-level approval before marking steps approved, committing eligible non-ignored changes, and continuing the Epic.
130
+
131
+ The review packet should include:
132
+
133
+ - story path and implementation plan folder
134
+ - changed files
135
+ - completed steps
136
+ - validation commands and results
137
+ - risks or follow-up questions
147
138
 
148
139
  If the user asks questions or requests changes, keep working within the same story until those changes are complete. If requested changes exceed the approved story plan, stop and ask whether the plan should be revised.
149
140
 
150
- When the user explicitly approves the completed story, update every step file completed in this story by adding or updating:
141
+ ## Approval metadata and commit control
142
+
143
+ Only after explicit story-level user approval, update every completed step file by adding or updating:
151
144
 
152
145
  ```md
153
146
  ## Review status
@@ -157,51 +150,20 @@ When the user explicitly approves the completed story, update every step file co
157
150
  - Approved at: <ISO-8601 timestamp>
158
151
  ```
159
152
 
160
- Before writing approval markers, identify the current Git user with `git config user.name`; if it is unavailable, use `git config user.email`. Use that value for `Approved by`.
153
+ Before writing approval markers, identify the current Git user with `git config user.name`; if unavailable, use `git config user.email`.
161
154
 
162
- After writing approval markers, commit only the non-ignored changes produced by the approved story before continuing. Do not attempt to stage or commit paths ignored by Git, including `docs/features/**` paths when the repository ignores them. The commit must include files intentionally changed while implementing the story that are eligible to be committed, and it must include step file approval markers only when those step files are not ignored. Ignored approval marker changes remain local and uncommitted; report that clearly. If every story change is ignored and there is nothing eligible to commit, skip the commit, report that no commit was created, and continue only according to the Epic continuation rules that do not depend on a commit hash. The commit must not include unrelated local edits or pre-existing worktree changes. Use the files tracked during story execution, `git check-ignore` when needed, and a focused `git status --short` check to stage the correct paths. Do not run broad `git diff` investigations or other "what changed?" archaeology unless it is required to avoid committing unrelated changes and the user has approved that extra inspection.
155
+ After writing approval markers, commit only eligible non-ignored changes produced by the approved story. Do not stage or commit ignored paths, including ignored `docs/features/**` paths. Do not include unrelated local edits or pre-existing worktree changes. Use a Conventional Commits 1.0.0 message describing the completed story.
163
156
 
164
- Use a Conventional Commits 1.0.0 message that describes the completed story. If the commit fails, stop and report the failure instead of continuing.
157
+ If every story change is ignored and nothing is eligible to commit, skip the commit and report that clearly.
165
158
 
166
159
  ## Feature continuation check
167
160
 
168
161
  After the approved story implementation is committed, continue through the current feature unless there is no next story or Epic to implement.
169
162
 
170
163
  1. Inspect the current Epic's `stories/` folder in filename order.
171
- 2. Identify whether there is a next User Story after the completed story.
172
- 3. If a next User Story exists and its `.impl_plan/` folder exists with ordered step files, immediately begin implementing that next story plan using this same story execution model.
173
- 4. If a next User Story exists but its `.impl_plan/` folder is missing or empty, immediately create the implementation plan for that story by applying `ai-implementation-planner`, then immediately begin implementing the generated plan.
174
- 5. If there is no next User Story in the current Epic, inspect the current feature's `epics/` folder and choose the next logical Epic to implement. Do not choose by filename alone. Base the choice on dependencies, prerequisite capabilities, technical sequencing, risk reduction, feature value, story readiness, and whether the Epic can be implemented without violating the feature brief or technical design. Briefly report the selected Epic and why it is the logical next step.
175
- 6. If a next logical Epic exists, inspect its `stories/` folder, select the first logical unapproved User Story to implement, create its implementation plan if needed with `ai-implementation-planner`, and immediately begin implementing it. Prefer story order when it reflects dependencies; otherwise choose based on prerequisites, risk, and value sequence.
176
- 7. If no logical next Epic exists or every Epic in the feature has all stories approved, tell the user the feature appears ready and stop.
177
-
178
- This continuation behavior is an explicit exception to the normal hard-start rule only after a story has been approved and committed. It lets the executor keep a feature moving across stories and Epics while preserving only the story-level review gate after each story implementation.
179
-
180
- ## Implementation rules
181
-
182
- Do:
183
-
184
- - preserve the source story scope and acceptance criteria
185
- - preserve approved Deep Module boundaries when present
186
- - follow each step file exactly unless it conflicts with source context
187
- - keep each step focused on its `## Scope` and `## Files`
188
- - complete all unapproved steps in order before requesting story review
189
- - keep work inside the contexts named by the approved steps and technical design
190
- - use existing project patterns and the relevant skills
191
- - run focused validation for each step when possible
192
- - stop and ask if a step is ambiguous, missing required files, or conflicts with the technical design
193
- - stop and ask before moving work into an unrelated Deep Module unless the approved step or technical design explicitly justifies it
194
-
195
- Do not:
196
-
197
- - invent a missing plan manually instead of applying `ai-implementation-planner`
198
- - mark any step approved before the user explicitly approves the completed story
199
- - commit story implementation changes before story approval
200
- - add product scope absent from the story, Epic, feature brief, technical design, or step files
201
- - silently move work into unrelated or unapproved Deep Modules
202
- - continue past a failed validation without reporting it and asking how to proceed
203
- - leave committable approved story changes uncommitted before moving to the next story or Epic
204
- - attempt to stage or commit story files, approval markers, or other paths that are ignored by Git
164
+ 2. If a next User Story exists, plan it through `ai-implementation-planner` when needed, then immediately begin execution.
165
+ 3. If no next story exists, inspect the feature's `epics/` folder and choose the next logical Epic based on dependencies, sequencing, risk reduction, and feature value.
166
+ 4. If no logical next Epic exists or every Epic has all stories approved, tell the user the feature appears ready and stop.
205
167
 
206
168
  ## Final response behavior
207
169
 
@@ -212,12 +174,6 @@ After implementing all unapproved steps in one story, briefly report:
212
174
  - the steps completed
213
175
  - validations run and their results
214
176
  - notable risks or follow-up questions, if any
215
- - that you are waiting for story approval before marking all completed steps approved, committing eligible non-ignored changes, and continuing the feature
216
-
217
- After approving and committing a story implementation, briefly report the commit and the feature continuation result:
177
+ - that you are waiting for story approval before marking steps approved, committing eligible non-ignored changes, and continuing
218
178
 
219
- - commit hash when a commit was created, or a note that only ignored changes existed and no commit was created
220
- - next story in the current Epic is being implemented immediately because it already has a plan
221
- - next story in the current Epic was planned and implementation started immediately
222
- - next Epic selected and its first unapproved story is being planned/implemented immediately
223
- - or the feature appears ready
179
+ After approving and committing a story implementation, briefly report the commit hash or why no commit was created, then continue to the next story/Epic according to the feature continuation check.
@@ -1,13 +1,15 @@
1
1
  ---
2
2
  name: ai-implementation-planner
3
- description: Turn one approved User Story Markdown file into LLM-sized implementation step files, then continue directly into execution when implementation is requested. Use when asked to create an implementation plan, coding checklist, step-by-step execution plan, or baby-step plan for completing a specific User Story from docs/features/<feature-slug>/epics/<epic-slug>/stories/.
3
+ description: Gatekeep and route one approved User Story into story-local implementation step files, requiring a fresh-context Sibu planner sub-agent whenever spawning is available.
4
4
  ---
5
5
 
6
6
  # AI Implementation Planner
7
7
 
8
8
  ## Purpose
9
9
 
10
- Turn one approved User Story into concrete Markdown step files an AI coding agent can execute safely and completely. This skill owns implementation planning for one story at a time, not product scope, technical design decisions, Scrum planning, or code implementation. This planner is normally an internal helper for `ai-implementation-plan-executor`; after writing a valid plan, implementation must continue immediately through the executor unless the user explicitly requested planning-only.
10
+ Route exactly one approved User Story into a valid story-local implementation plan. This skill is the main-agent gatekeeper for planning: it verifies the story, required source artifacts, UX requirements when relevant, and skill context before planning work begins. When a sub-agent spawn capability is available and permitted by the host, always spawn `sibu-implementation-planner` using a narrow packet and the planner toolbox. Use the inline fallback rules only when sub-agent spawning is unavailable or blocked by host capability limits.
11
+
12
+ This planner is normally an internal helper for `ai-implementation-plan-executor`; after a valid plan exists, implementation must continue immediately through the executor unless the user explicitly requested planning-only.
11
13
 
12
14
  ## Pipeline Contract
13
15
 
@@ -18,18 +20,20 @@ Turn one approved User Story into concrete Markdown step files an AI coding agen
18
20
  - The feature's `feature_brief.md`.
19
21
  - The feature's `technical_design.md`.
20
22
  - `docs/features/<feature-slug>/ux.md` only when the story or feature has UI impact.
21
- - Relevant repo files, tests, scripts, and implementation skills needed to make concrete step files.
23
+ - The planner toolbox skill at `.agents/skills/ai-implementation-planner-toolbox/SKILL.md` when sub-agent spawning is available.
24
+ - Required and relevant installed skill paths for the planner packet, including `clean-code`.
22
25
 
23
26
  ### What this skill writes
24
27
 
25
- - Story-local implementation step files under `docs/features/<feature-slug>/epics/<epic-slug>/stories/<order>-<story-slug>.impl_plan/*.md`.
28
+ - Story-local implementation step files under `docs/features/<feature-slug>/epics/<epic-slug>/stories/<order>-<story-slug>.impl_plan/*.md`, either through the planner worker or inline fallback.
26
29
 
27
30
  ### When this skill stops
28
31
 
29
32
  - The user does not provide or clearly identify exactly one User Story file.
30
33
  - Any required source artifact is missing, incomplete, or invalid in a way its owning stage should repair.
31
34
  - The story or feature has UI impact and `ux.md` is missing; direct the user to `ux-expert`.
32
- - This planner was invoked directly for a request that should route to another pipeline stage, such as writing production code, executing an existing implementation plan, creating stories, or performing another pipeline stage.
35
+ - The request belongs to another pipeline stage, such as writing production code, executing an existing implementation plan, creating stories, or performing another pipeline stage.
36
+ - Worker delegation is requested but required worker packet context cannot be assembled.
33
37
 
34
38
  ### What this skill must not do
35
39
 
@@ -37,7 +41,7 @@ Turn one approved User Story into concrete Markdown step files an AI coding agen
37
41
  - Do not modify prior-stage artifacts.
38
42
  - Do not reread `docs/deep-module-map.md` by default; trust `technical_design.md` for Deep Module implementation boundaries.
39
43
  - Do not infer implementation scope from an Epic brief, feature brief, or technical design without exactly one User Story.
40
- - Do not write production code directly from this planner; hand off to `ai-implementation-plan-executor` for implementation. The executor is the orchestrator for planning, implementation, execution, continuation, and combined plan-and-execute requests.
44
+ - Do not ask for a plan-approval gate before executor handoff unless the user explicitly requested planning-only.
41
45
 
42
46
  ## Required input
43
47
 
@@ -49,9 +53,9 @@ docs/features/<feature-slug>/epics/<epic-slug>/stories/<order>-<story-slug>.md
49
53
 
50
54
  Do not create an implementation plan from a vague request, Epic brief, feature brief, or technical design alone.
51
55
 
52
- ## Required source context
56
+ ## Required source context gate
53
57
 
54
- Before planning, read:
58
+ Before delegating or planning inline, verify these paths exist and are coherent:
55
59
 
56
60
  ```txt
57
61
  docs/features/<feature-slug>/epics/<epic-slug>/stories/<order>-<story-slug>.md
@@ -61,39 +65,49 @@ docs/features/<feature-slug>/technical_design.md
61
65
  docs/features/<feature-slug>/ux.md # when the story or feature has UI impact
62
66
  ```
63
67
 
64
- Also read `docs/product-vision.md` when product fit, target user, scope boundaries, or success signals are ambiguous.
68
+ Also read `docs/product-vision.md` only when product fit, target user, scope boundaries, or success signals are ambiguous.
69
+
70
+ If the story or feature has UI impact and `docs/features/<feature-slug>/ux.md` is missing, stop and ask the user to create the UX spec with `ux-expert` before implementation planning.
71
+
72
+ If the technical design is missing, stop and ask the user to create it with `technical-design-writer`. Do not delegate incomplete planning work to the worker.
65
73
 
66
74
  When the feature brief or technical design includes Deep Module guidance, treat it as required planning context. Deep Modules answer “where does this implementation work belong?” Implementation steps must preserve approved module boundaries.
67
75
 
68
- If the story or feature has UI impact and `docs/features/<feature-slug>/ux.md` is missing, stop and ask the user to create the UX spec with `ux-expert` before implementation planning.
76
+ ## Required sub-agent planning path
69
77
 
70
- When `ux.md` includes mockups, treat them as binding UI goals. Implementation steps must preserve the mockup structure, hierarchy, visible content, dominant interactions, major visual emphasis, and breakpoint-specific layout. Do not redesign the UI in the implementation plan; plan code steps that implement the approved UX and stop if technical constraints require a UX revision.
78
+ When the host exposes any usable sub-agent spawn capability and `sibu-implementation-planner` is available, spawn that worker. Treat a user request to plan, implement, execute, continue, or work through a Sibu User Story or Epic as authorization to use the Sibu planner worker, subject to host tool policy. Do not choose inline planning merely because it is simpler or faster.
71
79
 
72
- Before writing the step files, read and apply the required planning skills as source context:
80
+ Build a narrow planner packet for the worker. The packet must include:
73
81
 
74
- - always read and apply `clean-code`
75
- - read and apply the selected architecture skill when relevant, such as `command-pattern` or `ddd-hexagonal`
76
- - read and apply language skills when relevant, such as `typescript`
77
- - read and apply framework skills when relevant, such as `react` or `nextjs`
82
+ - exactly one User Story path
83
+ - Epic brief, feature brief, technical design, and UX path when relevant
84
+ - planner toolbox path: `.agents/skills/ai-implementation-planner-toolbox/SKILL.md`
85
+ - required skill paths, always including `.agents/skills/clean-code/SKILL.md`
86
+ - relevant optional installed skill paths only when applicable, such as TypeScript, React, Next.js, UX Expert, Command Pattern, DDD/Hexagonal, Layered Architecture, PostgreSQL Expert, or AI Prompt Engineer Master
87
+ - distilled skill constraints, such as “create only `.impl_plan/*.md` files,” “do not write production code,” “inspect narrowly,” and any story-specific architecture or UX constraints
88
+ - expected output format: plan folder, ordered step files created or updated, source artifacts and skills used, and risks/blockers
78
89
 
79
- Use those skills to shape implementation steps. Do not copy their full guidance into the step files.
90
+ Do not include exporter skills such as `export-to-github` or `export-to-notion` in the planner packet.
80
91
 
81
- Inspect existing code, tests, scripts, and docs only as much as needed to make the step files concrete. Avoid broad codebase analysis.
92
+ The worker must use only the packet, the toolbox, listed skill files, source artifacts, and narrow repo inspection required for the story. Do not pass the full main conversation context.
82
93
 
83
- ## Hard start rule
94
+ After the worker returns, verify that a valid story-local `.impl_plan/` exists with ordered `.md` step files for exactly that story. If it does not, repair through the same worker when possible. Use inline fallback only when spawning or resuming the worker is unavailable or failed because the host cannot support it.
84
95
 
85
- If the User Story file is missing or unclear:
96
+ ## Inline fallback planning path
86
97
 
87
- 1. Stop.
88
- 2. Ask the user for the exact User Story file path.
89
- 3. Do not infer the story from nearby files.
98
+ Use inline fallback only when no compatible sub-agent spawn/resume capability is available, the host/tool policy blocks spawning, or the planner worker cannot be reached for capability reasons. If spawning is available but the worker reports a task blocker, do not inline around it; surface the blocker or ask for the missing input.
90
99
 
91
- If any required source context file is missing:
100
+ Before writing step files inline, read and apply:
92
101
 
93
- 1. Stop.
94
- 2. Say which file is missing.
95
- 3. Ask the user to create or restore the missing artifact first.
96
- 4. Do not invent implementation scope from partial context.
102
+ - `clean-code` always
103
+ - relevant installed language skills such as `typescript` for `.ts` or `.tsx` work
104
+ - relevant installed framework skills such as `react` or `nextjs`
105
+ - relevant installed architecture skills such as `command-pattern`, `ddd-hexagonal`, or `layered-architecture`
106
+ - relevant installed database skills such as `postgresql-expert`
107
+ - `ux-expert` only when UI/UX implementation planning is in scope and the skill is installed
108
+ - `ai-prompt-engineer-master` when prompt, agent, or reusable AI instruction templates are in scope
109
+
110
+ If a required skill path is missing, stop and report the blocker. If an optional relevant skill is not installed and the story involves an unmapped language, framework, database, or architecture pattern, continue only when safe and flag the gap as a plan risk.
97
111
 
98
112
  ## Output location
99
113
 
@@ -105,88 +119,9 @@ docs/features/<feature_slug>/epics/<epic_slug>/stories/<order>-<story_slug>.impl
105
119
 
106
120
  Use the source story filename, without its `.md` extension, as the implementation plan folder name plus `.impl_plan`.
107
121
 
108
- Examples:
109
-
110
- ```txt
111
- stories/01-resolve-a-selectable-skill-by-name.md
112
- stories/01-resolve-a-selectable-skill-by-name.impl_plan/01-add-skill-resolution-domain-step.md
113
- stories/01-resolve-a-selectable-skill-by-name.impl_plan/02-wire-skill-resolution-command-step.md
114
- ```
115
-
116
- File naming rules:
117
-
118
- - use two-digit step order prefixes (`01`, `02`, `03`) unless the repository uses another explicit convention
119
- - use lowercase kebab-case step slugs
120
- - keep each step file focused on exactly one executable implementation step
121
- - use the lowercase `.md` extension exactly as shown
122
- - if the correct story slug, step order, or step slug is unclear, stop and ask before writing files
123
-
124
- ## Planning rules
125
-
126
- Create pragmatic implementation step files, not a second technical design. Each step must be concrete—not discovery, scope confirmation, or generic review—and tell the AI what to change, where, at what high level, and how to know it is done.
127
-
128
- Do:
129
-
130
- - preserve the User Story scope and acceptance criteria
131
- - sequence concrete implementation, test, validation, and cleanup steps across separate step files
132
- - map acceptance criteria to one or more step files
133
- - call out dependencies, sequencing constraints, and risk checkpoints
134
- - include test, build, lint, or manual validation commands when known
135
- - include a stop-and-ask condition when the implementation would exceed the technical design
136
- - keep work inside the approved Deep Modules unless cross-module work is explicit in the source artifacts
137
- - call out cross-module ownership and coordination in the relevant step files
138
-
139
- Do not:
140
-
141
- - write or modify production code
142
- - add product scope absent from the story, Epic, feature brief, or technical design
143
- - duplicate the full technical design
144
- - include prerequisite reading, scope confirmation, or repository inspection as step files
145
- - create task noise such as “review the code” without a specific implementation or validation purpose
146
- - prescribe architecture that conflicts with the selected architecture skill or technical design
147
- - move work into unrelated or unapproved Deep Modules; add a stop-and-ask condition instead
122
+ ## Step file contract
148
123
 
149
- ## Workflow
150
-
151
- ### 1. Read and bound the story
152
-
153
- Identify:
154
-
155
- - story title and source path
156
- - target user or contributor
157
- - desired outcome
158
- - in-scope work
159
- - out-of-scope boundaries
160
- - acceptance criteria
161
- - validation expectations
162
-
163
- If the story lacks testable acceptance criteria, stop and ask for the User Story to be clarified.
164
-
165
- ### 2. Read feature and technical context
166
-
167
- From the Epic and feature brief, identify delivery boundaries, user value, and approved Deep Module ownership when present.
168
-
169
- From the technical design, identify:
170
-
171
- - intended implementation approach
172
- - Deep Module boundaries, ownership, and any explicit cross-module work
173
- - affected commands, modules, files, adapters, docs, or tests
174
- - known risks or unresolved decisions
175
- - expected validation commands or checks
176
-
177
- ### 3. Inspect the repository narrowly
178
-
179
- Inspect only files and commands needed to make the checklist actionable, such as:
180
-
181
- - existing feature folders or handlers related to the story
182
- - entrypoints or command wiring mentioned by the technical design
183
- - tests covering similar behavior
184
- - package scripts, build commands, or validation commands
185
- - docs that must be updated by the story
186
-
187
- ### 4. Write the implementation step files
188
-
189
- Create one `.md` file per step in the story-local `.impl_plan` folder. Use this structure for every step file:
124
+ Every step file must use this structure:
190
125
 
191
126
  ```md
192
127
  # Step: <Imperative step title>
@@ -213,47 +148,29 @@ Create one `.md` file per step in the story-local `.impl_plan` folder. Use this
213
148
  - <Relevant compile, test, lint, build, or manual validation passes>
214
149
  ```
215
150
 
216
- Step-file requirements:
151
+ Step files must be concrete, scoped, validation-oriented, and small enough for one AI coding pass. They must not include prerequisite reading, generic review tasks, or implementation scope absent from the story, Epic, feature brief, or technical design.
217
152
 
218
- - the first line must be `# Step: <Imperative step title>`
219
- - use exactly these Markdown section headings: `## Goal`, `## Scope`, `## Files`, `## Done when`
220
- - keep each step small enough for one AI coding pass
221
- - name every known file, module, command, or artifact to change or validate
222
- - include explicit out-of-scope boundaries in `Scope` when they prevent scope creep
223
- - preserve Deep Module boundaries in `Scope`; call out cross-module work explicitly when required
224
- - include validation commands in `Done when` when known
225
- - ensure the full set of step files covers every acceptance criterion
153
+ ## Plan quality gate
226
154
 
227
- If something required for a concrete step is unclear or missing, do not assume. Stop and ask before proceeding.
228
-
229
- ### 5. Check plan quality
230
-
231
- Before finishing, verify:
155
+ Before considering planning complete, verify:
232
156
 
233
157
  - the step files are for exactly one User Story
234
158
  - every acceptance criterion maps to at least one step file
235
- - every step file names the file, module, command, or artifact to change when known
236
- - every step file explains the high-level implementation goal and scope
237
- - every step file has clear done conditions
159
+ - every step names the file, module, command, or artifact to change when known
238
160
  - validation is explicit enough to prove the story is complete
239
- - the step files do not add scope beyond the source artifacts
240
- - the step files preserve approved Deep Module boundaries and stop before unrelated module movement
241
- - architecture and code-quality steps align with the relevant skills
161
+ - the plan preserves approved Deep Module, architecture, and UX boundaries
162
+ - the plan does not add product or implementation scope beyond the source artifacts
242
163
 
243
- ### 6. Continue or report
164
+ ## Continue or report
244
165
 
245
166
  After writing and quality-checking the implementation step files, do not ask for plan approval before execution. Unless the user explicitly requested planning-only, immediately hand off to `ai-implementation-plan-executor` for the newly created plan in the same turn. The user's story or Epic planning/execution request plus a valid generated plan is enough pre-implementation confirmation; the only required user approval is the story-level review after execution finishes.
246
167
 
247
- If the user explicitly asked for planning-only, said not to implement, or asked to create the plan without execution, stop after creating the plan and report where it was written. Make clear that no plan approval is required before a later executor run.
248
-
249
- When this skill is invoked as the next-story or next-Epic planning handoff from `ai-implementation-plan-executor`, create the plan and immediately return control to the executor so it can implement that story without a plan-review gate.
250
-
251
- The final planning-only response must briefly include:
168
+ If the user explicitly asked for planning-only, said not to implement, or asked to create the plan without execution, stop after creating the plan and report:
252
169
 
253
170
  - the source User Story path
254
171
  - the implementation plan folder path
255
172
  - the ordered step files created
256
- - any assumptions, risks, or validation commands worth noting
257
- - that no separate plan approval is required before execution
173
+ - assumptions, risks, or validation commands worth noting
174
+ - that no separate plan approval is required before a later executor run
258
175
 
259
- Do not paste step-file bodies, excerpts, outlines, task text, done conditions, or section summaries. Only include generated step files when the user explicitly asks for inline review in the current request.
176
+ Do not paste step-file bodies, excerpts, outlines, task text, done conditions, or section summaries unless the user explicitly asks for inline review.