@whatasoda/agent-tools 0.1.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.
- package/dist/agents/codex-review/body.md +98 -0
- package/dist/agents/team-reviewer/body.md +78 -0
- package/dist/agents/team-worker/body.md +46 -0
- package/dist/scripts/codex-review.js +237 -0
- package/dist/scripts/detect-base-branch.js +185 -0
- package/dist/scripts/resolve-session.js +76 -0
- package/dist/skills/soda-brief/body.md +73 -0
- package/dist/skills/soda-discuss/README.md +25 -0
- package/dist/skills/soda-discuss/body.md +216 -0
- package/dist/skills/soda-fix/body.md +137 -0
- package/dist/skills/soda-plan/body.md +333 -0
- package/dist/skills/soda-research/body.md +127 -0
- package/dist/skills/soda-review/body.md +165 -0
- package/dist/skills/soda-review-todos/body.md +19 -0
- package/dist/skills/soda-team-init/body.md +313 -0
- package/dist/skills/soda-team-init/references/coordination-files.md +188 -0
- package/dist/skills/soda-team-run/body.md +329 -0
- package/dist/skills/soda-todo/body.md +86 -0
- package/dist/src/cli/commands/agent.js +29 -0
- package/dist/src/cli/commands/codex-review.js +14 -0
- package/dist/src/cli/commands/decision.js +103 -0
- package/dist/src/cli/commands/import.js +174 -0
- package/dist/src/cli/commands/link.js +52 -0
- package/dist/src/cli/commands/list.js +12 -0
- package/dist/src/cli/commands/node.js +118 -0
- package/dist/src/cli/commands/review.js +23 -0
- package/dist/src/cli/commands/session.js +23 -0
- package/dist/src/cli/commands/skill.js +29 -0
- package/dist/src/cli/commands/tag.js +31 -0
- package/dist/src/cli/helpers.js +51 -0
- package/dist/src/cli/index.js +48 -0
- package/dist/src/cli.js +59 -0
- package/dist/src/core/database.js +209 -0
- package/dist/src/core/ensure-dirs.js +8 -0
- package/dist/src/core/index.js +1 -0
- package/dist/src/core/kinds.js +46 -0
- package/dist/src/core/schema.sql +36 -0
- package/dist/src/core/schemas.js +41 -0
- package/dist/src/core/search.js +80 -0
- package/dist/src/core/types.js +0 -0
- package/dist/src/tui/App.js +130 -0
- package/dist/src/tui/actions.js +9 -0
- package/dist/src/tui/components/FilterBar.js +46 -0
- package/dist/src/tui/components/LinkList.js +53 -0
- package/dist/src/tui/components/NodeDetail.js +111 -0
- package/dist/src/tui/components/NodeList.js +62 -0
- package/dist/src/tui/components/StatusBar.js +90 -0
- package/dist/src/tui/hooks/useNavigation.js +57 -0
- package/dist/src/tui/hooks/useNodes.js +44 -0
- package/dist/src/tui/index.js +4 -0
- package/package.json +29 -0
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
|
|
2
|
+
Create a detailed implementation plan for the given task.
|
|
3
|
+
|
|
4
|
+
Use English for internal reasoning (thinking). Plan content (written to plan mode file) must be in English — use structured data, code snippets, and technical English for maximum AI interpretability and compaction resilience. User interaction (AskUserQuestion options, confirmation messages, investigation summaries presented before plan mode) must be in Japanese.
|
|
5
|
+
|
|
6
|
+
If $ARGUMENTS is empty, ask the user what they want to implement before proceeding.
|
|
7
|
+
|
|
8
|
+
## Procedure
|
|
9
|
+
|
|
10
|
+
1. **Investigate**: Explore the codebase to understand the scope, affected areas, and existing patterns.
|
|
11
|
+
- **Design Decision check**: Before launching sub-agents, query existing decisions via `sd decision list --repo <owner/repo>` (detect owner/repo from git remote).
|
|
12
|
+
- If decisions found:
|
|
13
|
+
- Present the found decisions and ask the user which apply to this task (always confirm — some may be stale or unrelated)
|
|
14
|
+
- Extract decisions as **mandatory constraints** — every applicable decision must be traceable to a plan step
|
|
15
|
+
- Extract `rejected_alternatives` from each decision as **exclusion constraints** — approaches listed as rejected must not be re-proposed
|
|
16
|
+
- If no decisions found: proceed normally (conversation-context-based input)
|
|
17
|
+
- **Sub-agent output contract**: Every sub-agent prompt MUST end with the following output format requirement:
|
|
18
|
+
> Return findings in this exact format:
|
|
19
|
+
> ### Files
|
|
20
|
+
> - `path/to/file` — relevance to the task
|
|
21
|
+
> ### Patterns
|
|
22
|
+
> - pattern name — description of the convention or pattern found
|
|
23
|
+
> ### Dependencies
|
|
24
|
+
> - dependency — how it affects the task
|
|
25
|
+
> ### Open Questions
|
|
26
|
+
> - question — what remains unclear from this investigation alone
|
|
27
|
+
- Launch a sub-agent (Task, subagent_type: Explore) to survey project structure, dependencies, and conventions relevant to the task.
|
|
28
|
+
- Summarize the agent's findings into a Common Context block.
|
|
29
|
+
- Based on findings, optionally launch 1-2 focused sub-agents in parallel. Each prompt must include the Common Context block (summarized, not raw output), the specific investigation question, and both the constraint block and output contract.
|
|
30
|
+
- **Sub-agent prompt constraints**: Every sub-agent prompt (both survey and focused) MUST begin with the following constraint block:
|
|
31
|
+
> You are a research-only agent. Do NOT use AskUserQuestion, EnterPlanMode, or any interactive/planning tools. Return your findings in the output format specified below.
|
|
32
|
+
- Summarize investigation results before proceeding.
|
|
33
|
+
- If investigation reveals multiple fundamentally different approaches, use AskUserQuestion to let the user decide: "方針を調整して続行" / "ここで中断して方針を整理". Do not choose an approach autonomously.
|
|
34
|
+
2. **Branch Strategy**: Use AskUserQuestion to determine branch strategy before planning:
|
|
35
|
+
- "新ブランチ作成"
|
|
36
|
+
- "現ブランチ続行"
|
|
37
|
+
|
|
38
|
+
If the user chooses a new branch, derive the branch name from the task description.
|
|
39
|
+
Do NOT proceed to Step 3 until the user confirms branch strategy.
|
|
40
|
+
3. **Plan**:
|
|
41
|
+
|
|
42
|
+
**Technical Pre-Gathering (M/L tasks only)**: After task scale classification, if the task is scale M or L, pre-gather technical details before entering plan mode:
|
|
43
|
+
- Identify rough step areas from investigation findings (affected areas, key files, functional groupings)
|
|
44
|
+
- For each area (up to 3), launch a sub-agent (Task, subagent_type: Explore, model: sonnet) in parallel with the Step Detail Template below
|
|
45
|
+
- Sub-agent prompts must include the constraint block, the specific area to investigate, and the Step Detail Template
|
|
46
|
+
- Use gathered details to write the plan with concrete technical context (type signatures, API contracts, test patterns) rather than re-investigating during plan writing
|
|
47
|
+
|
|
48
|
+
**Step Detail Template**: When pre-gathering technical details for M/L tasks, each sub-agent prompt MUST end with the following output format:
|
|
49
|
+
> Return findings in this exact format:
|
|
50
|
+
> ### File State
|
|
51
|
+
> - `path/to/file` — current exports, key functions, line count
|
|
52
|
+
> ### Type Signatures
|
|
53
|
+
> - `TypeName` — definition (from source)
|
|
54
|
+
> ### API Contracts
|
|
55
|
+
> - endpoint/function — signature and behavior
|
|
56
|
+
> ### Test Patterns
|
|
57
|
+
> - test file — existing test patterns, coverage gaps
|
|
58
|
+
> ### Validation Approaches
|
|
59
|
+
> - (how to verify changes in this area)
|
|
60
|
+
|
|
61
|
+
Compose the plan content as markdown text (do not enter plan mode yet). Include the following elements. Do not follow a fixed template — organize and format them as best fits the task. Follow the Compact-Resilience Guidelines below when authoring plan content. After composition, proceed to the Codex Review sub-section before entering plan mode.
|
|
62
|
+
|
|
63
|
+
**Required elements:**
|
|
64
|
+
- **Task summary and branch name**
|
|
65
|
+
- **Investigation summary** — key findings, affected areas, relevant patterns discovered
|
|
66
|
+
- **Steps** — each step must include:
|
|
67
|
+
- Progress marker: `- [ ]` prefix (updated to `- [x]` during implementation as each step completes)
|
|
68
|
+
- Commit message (imperative mood)
|
|
69
|
+
- File changes with full paths and rationale (`path/to/file` — what and why)
|
|
70
|
+
- Validation criteria — how to verify this step is correct (test command, expected behavior, manual check)
|
|
71
|
+
- Dependencies on prior steps and what this step produces for later steps (do not rely on ordering alone)
|
|
72
|
+
- **Risks and mitigation** — at least one risk with a concrete mitigation strategy
|
|
73
|
+
|
|
74
|
+
**Conditional elements** (include when applicable):
|
|
75
|
+
- **Technical context per step** — type signatures, API contracts, data shapes, algorithms
|
|
76
|
+
- **Design rationale** — for non-obvious decisions, state "why" explicitly as a labeled callout, not embedded in prose
|
|
77
|
+
- **Cross-step shared context** — types, constants, or contracts used by multiple steps. Define once and reference by name in each step.
|
|
78
|
+
- **Subagent utilization plan** (include for scale M and L) — for each step, indicate whether it should be executed in a subagent or in the main context. See Subagent Criteria below for the decision rules.
|
|
79
|
+
- **Transition note** (include for scale L only) — note that execution transitions to `/soda-team-init` → `/soda-team-run`. The plan serves as input context for task decomposition. See Execution Phase for details.
|
|
80
|
+
- **Design decisions** (include when the plan involves architecture, external contracts, or user-facing behavior choices) — present each decision as a labeled callout in the plan body:
|
|
81
|
+
> **Design Decision: [topic]**
|
|
82
|
+
> Option A: ... — [trade-off]
|
|
83
|
+
> Option B: ... — [trade-off]
|
|
84
|
+
> Recommended: [option] — [rationale]
|
|
85
|
+
|
|
86
|
+
Design decisions are discussed individually during the Plan Discussion Phase before ExitPlanMode. If a decision significantly changes the plan structure, note this dependency explicitly.
|
|
87
|
+
|
|
88
|
+
Examples of decisions that require callouts:
|
|
89
|
+
- Architecture patterns (e.g., monolith vs microservice, event-driven vs request-response)
|
|
90
|
+
- Library or framework selection
|
|
91
|
+
- Data model design (schema, relationships)
|
|
92
|
+
- API contract design (endpoints, request/response shapes)
|
|
93
|
+
- State management approach
|
|
94
|
+
- Authentication/authorization strategy
|
|
95
|
+
|
|
96
|
+
Examples that do NOT require callouts (implementation details):
|
|
97
|
+
- Variable/function naming
|
|
98
|
+
- Internal helper structure
|
|
99
|
+
- Iteration order
|
|
100
|
+
- File organization within an already-decided architecture
|
|
101
|
+
- **Ambiguities** — if there are ambiguous requirements or missing information, note them as labeled callouts in the plan body rather than asking separately.
|
|
102
|
+
|
|
103
|
+
### Codex Review (pre-plan-mode)
|
|
104
|
+
|
|
105
|
+
Delegate codex review to a subagent in findings-only mode. The subagent reports issues but does NOT revise the content — the plan author incorporates findings to preserve original intent.
|
|
106
|
+
|
|
107
|
+
1. Resolve session JSONL path (for context-aware review):
|
|
108
|
+
Run via Bash: `sd session resolve`
|
|
109
|
+
Capture stdout as session path. If empty, proceed without session context.
|
|
110
|
+
|
|
111
|
+
2. Launch a codex review subagent:
|
|
112
|
+
- Tool: `Task(subagent_type: soda:codex-review)`
|
|
113
|
+
- Prompt: Include the review request with composed content.
|
|
114
|
+
- Review request:
|
|
115
|
+
```
|
|
116
|
+
## Codex Review Request
|
|
117
|
+
- **Mode**: findings
|
|
118
|
+
- **Instruction**: "Review this plan. Skip trivial issues — only flag critical problems"
|
|
119
|
+
- **Session Path**: <resolved session path from step 1, or omit if empty>
|
|
120
|
+
|
|
121
|
+
### Content
|
|
122
|
+
[composed plan content]
|
|
123
|
+
```
|
|
124
|
+
3. Use the subagent's response:
|
|
125
|
+
- If **critical issues found**: read the `Issues` section and revise the plan in the main context to address them, preserving the original intent and voice.
|
|
126
|
+
- If **no critical issues**, **Status: Skipped**, or subagent failure: continue without changes.
|
|
127
|
+
|
|
128
|
+
After the codex review completes, use the EnterPlanMode tool to enter plan mode. Write the reviewed plan content to the plan file. Proceed with the Plan Discussion Phase below, then exit plan mode via ExitPlanMode.
|
|
129
|
+
|
|
130
|
+
## Plan Discussion Phase
|
|
131
|
+
|
|
132
|
+
After writing the plan, extract **discussion items** — areas that benefit from interactive confirmation before implementation. Discussion items fall into two categories:
|
|
133
|
+
|
|
134
|
+
- **Review points**: Steps where user domain knowledge would improve plan quality (business logic, unverified assumptions, context-dependent risks)
|
|
135
|
+
- **Design decisions**: Choices presented as `**Design Decision: [topic]**` callouts in the plan
|
|
136
|
+
|
|
137
|
+
### Procedure
|
|
138
|
+
|
|
139
|
+
1. **Extract and present**: List all discussion items with their category and dependency relationships:
|
|
140
|
+
|
|
141
|
+
> **議論アイテム**: 以下の項目を順に確認します:
|
|
142
|
+
> 1. [category] Step N: {{description}}
|
|
143
|
+
> 2. [category] Step M: {{description}}
|
|
144
|
+
>
|
|
145
|
+
> 依存関係: Item 1 の結論が Item 2 の選択肢に影響します。
|
|
146
|
+
|
|
147
|
+
The user may reorder items or mark some as skip.
|
|
148
|
+
|
|
149
|
+
2. **Discuss one at a time**: Present each item individually, following soda-discuss Interaction Principles (referenced from `/soda-discuss` SKILL.md — not duplicated here):
|
|
150
|
+
|
|
151
|
+
- **提示して委ねる**: Present context/options as text output, let the user respond freely
|
|
152
|
+
- **一度に一つ、承認を待つ**: Wait for the user's response before moving to the next item
|
|
153
|
+
- **選択肢には根拠と推奨を添える**: For design decisions, include tradeoffs and a recommendation
|
|
154
|
+
- **データが先、判断が後**: Present investigation data before asking for a decision
|
|
155
|
+
- **判断の保留は深掘りのシグナル**: If the user defers, provide deeper analysis before re-presenting
|
|
156
|
+
|
|
157
|
+
For each item type:
|
|
158
|
+
- **Review point**: Present the relevant plan section and what is uncertain → wait for domain knowledge
|
|
159
|
+
- **Design decision**: Present options, tradeoffs, and recommendation → wait for direction
|
|
160
|
+
|
|
161
|
+
3. **Reflect conclusions**: After each item is resolved, immediately update the plan:
|
|
162
|
+
- Review point conclusions: mark as `**User Context**: {{correction or additional information}}`
|
|
163
|
+
- Design decision conclusions: update the callout to show the confirmed option
|
|
164
|
+
|
|
165
|
+
These labeled callouts ensure domain knowledge and decisions survive context compaction.
|
|
166
|
+
|
|
167
|
+
4. **Handle emergent items**: If discussion reveals new items, add them to the list at the appropriate position based on dependency relationships.
|
|
168
|
+
|
|
169
|
+
5. **Complete**: When all items are resolved (or the user signals readiness), proceed to ExitPlanMode.
|
|
170
|
+
|
|
171
|
+
If no discussion items are identified, skip this phase and proceed directly to ExitPlanMode.
|
|
172
|
+
|
|
173
|
+
## Execution Phase
|
|
174
|
+
|
|
175
|
+
After plan approval (ExitPlanMode), execution routing depends on the task scale classification.
|
|
176
|
+
|
|
177
|
+
### Scale S — Main Context
|
|
178
|
+
|
|
179
|
+
Execute all steps in the main context sequentially. No worktree isolation or review cycle.
|
|
180
|
+
|
|
181
|
+
### Scale M — Worker → Reviewer Core Loop
|
|
182
|
+
|
|
183
|
+
Subagent-eligible steps are executed via `team-worker` → `team-reviewer` cycle on isolated worktrees. Main-context steps execute in the main context as before.
|
|
184
|
+
|
|
185
|
+
**For each subagent-eligible step:**
|
|
186
|
+
|
|
187
|
+
1. **Create worktree**:
|
|
188
|
+
```bash
|
|
189
|
+
git worktree add .worktrees/step-{{N}} -b plan/step-{{N}} HEAD
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
2. **Launch Worker** via `Task(subagent_type: soda:team-worker)` with prompt:
|
|
193
|
+
```
|
|
194
|
+
## Task
|
|
195
|
+
### Definition
|
|
196
|
+
{{step description and file changes from plan}}
|
|
197
|
+
### Design Constraints
|
|
198
|
+
{{design decisions and constraints from plan, if any}}
|
|
199
|
+
### Context
|
|
200
|
+
{{investigation summary and cross-step shared context from plan}}
|
|
201
|
+
### Validation
|
|
202
|
+
{{validation criteria from plan step}}
|
|
203
|
+
|
|
204
|
+
## Commit Message
|
|
205
|
+
{{commit message from plan step}}
|
|
206
|
+
|
|
207
|
+
## Working Directory
|
|
208
|
+
{{worktree absolute path}}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
3. **On Worker DONE** → launch Reviewer via `Task(subagent_type: soda:team-reviewer)`:
|
|
212
|
+
```
|
|
213
|
+
## Task Definition
|
|
214
|
+
{{same task sections as Worker input (Definition, Design Constraints, Context, Validation)}}
|
|
215
|
+
## Working Directory
|
|
216
|
+
{{worktree path}}
|
|
217
|
+
## Changes to Review
|
|
218
|
+
{{git diff of worktree branch vs base}}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
> **Why no `## Architecture Decisions`**: soda-plan context does not maintain ARCHITECTURE.md. Reviewer evaluates against the step's own Design Constraints and Validation criteria instead.
|
|
222
|
+
|
|
223
|
+
4. **Handle verdict**:
|
|
224
|
+
- **PASS / PASS_WITH_FIX** → merge worktree branch to current branch, clean up:
|
|
225
|
+
```bash
|
|
226
|
+
git checkout {{current_branch}}
|
|
227
|
+
git merge --squash plan/step-{{N}}
|
|
228
|
+
git commit -m "{{commit message}} (plan/step-{{N}})"
|
|
229
|
+
git worktree remove .worktrees/step-{{N}}
|
|
230
|
+
git branch -D plan/step-{{N}}
|
|
231
|
+
```
|
|
232
|
+
**Merge conflict handling**: If merge fails due to conflicts:
|
|
233
|
+
```bash
|
|
234
|
+
git reset --merge
|
|
235
|
+
```
|
|
236
|
+
Report conflicting files to user via AskUserQuestion with options:
|
|
237
|
+
- "コンフリクトを手動で解決する" → user resolves, then resume
|
|
238
|
+
- "このステップをスキップ" → clean up worktree and branch:
|
|
239
|
+
```bash
|
|
240
|
+
git worktree remove .worktrees/step-{{N}}
|
|
241
|
+
git branch -D plan/step-{{N}}
|
|
242
|
+
```
|
|
243
|
+
- **FAIL** → append Reviewer's "For Next Worker" findings to the step's Context section, reset worktree to the base commit, retry Worker once:
|
|
244
|
+
```bash
|
|
245
|
+
cd .worktrees/step-{{N}}
|
|
246
|
+
git clean -fd
|
|
247
|
+
git reset --hard {{current_branch}}
|
|
248
|
+
```
|
|
249
|
+
> **Why `{{current_branch}}` not `~1`**: Worker may create multiple commits. Resetting to the branch the worktree was created from guarantees a clean slate, matching soda-team-run's pattern.
|
|
250
|
+
|
|
251
|
+
If second attempt also FAILs → report to user via AskUserQuestion with Reviewer findings and options:
|
|
252
|
+
- "実装を受け入れる" → merge worktree branch as-is (same as PASS flow)
|
|
253
|
+
- "このステップをスキップ" → clean up worktree and branch, skip this step:
|
|
254
|
+
```bash
|
|
255
|
+
git worktree remove .worktrees/step-{{N}}
|
|
256
|
+
git branch -D plan/step-{{N}}
|
|
257
|
+
```
|
|
258
|
+
- **ESCALATE** → report to user via AskUserQuestion with escalation details and options:
|
|
259
|
+
- "実装を受け入れる" → merge worktree branch as-is (same as PASS flow)
|
|
260
|
+
- "このステップをスキップ" → clean up worktree and branch, skip this step:
|
|
261
|
+
```bash
|
|
262
|
+
git worktree remove .worktrees/step-{{N}}
|
|
263
|
+
git branch -D plan/step-{{N}}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
5. **On Worker BLOCKED** → read BLOCKER.md from worktree root, report to user via AskUserQuestion.
|
|
267
|
+
|
|
268
|
+
**Sequencing**: Subagent-eligible steps with no mutual dependencies may run in parallel (separate worktrees). Steps with dependencies execute sequentially — wait for the dependency to merge before creating the next worktree.
|
|
269
|
+
|
|
270
|
+
### Scale L — Transition to /soda-team-init
|
|
271
|
+
|
|
272
|
+
Scale L tasks are too large for soda-plan's inline execution. After plan approval, present transition guidance:
|
|
273
|
+
|
|
274
|
+
> このタスクは規模が大きいため、`/soda-team-init` でタスク分解し `/soda-team-run` で実行することを推奨します。
|
|
275
|
+
> プランの内容を `/soda-team-init` の入力コンテキストとして活用できます。
|
|
276
|
+
|
|
277
|
+
Do NOT execute implementation inline. The approved plan serves as input context for `/soda-team-init`.
|
|
278
|
+
|
|
279
|
+
## Constraints
|
|
280
|
+
|
|
281
|
+
- Do NOT begin implementation until the user approves the plan.
|
|
282
|
+
- Branch strategy is determined by the user in Step 2 (Branch Strategy). If the user chooses a new branch, create it from the current branch unless a different base is specified.
|
|
283
|
+
- The plan must include incremental commits throughout the work.
|
|
284
|
+
- The plan must be self-contained: include enough technical context (as code snippets and structured data, not prose) that implementation can proceed from the plan alone, even after context compaction.
|
|
285
|
+
- Each step must define a commit with an imperative-mood message, explicit dependencies on prior steps, and validation criteria.
|
|
286
|
+
- The plan must identify at least one risk and its mitigation.
|
|
287
|
+
- Design decisions must be presented as labeled callouts in the plan body. Each decision is discussed individually during the Plan Discussion Phase before ExitPlanMode.
|
|
288
|
+
- During implementation, update the plan's step markers from `- [ ]` to `- [x]` as each step's commit is completed. This provides at-a-glance progress visibility.
|
|
289
|
+
- If design decisions are loaded from the DB, all applicable decisions must be reflected in plan steps. Each step that implements a decision must reference it by name. Rejected alternatives from each decision must not be re-proposed as approaches.
|
|
290
|
+
|
|
291
|
+
## Compact-Resilience Guidelines
|
|
292
|
+
|
|
293
|
+
Plans must survive context compaction. Follow these rules when authoring plan content:
|
|
294
|
+
|
|
295
|
+
- **Explicit dependency chains**: State what each step depends on and produces. Do not rely on step ordering alone — ordering is lost during compaction.
|
|
296
|
+
- **Code over prose**: Prefer code snippets and structured data (`interface Foo { bar: string }`) over prose descriptions ("Foo has a bar field of type string"). Code survives intact; prose gets summarized away.
|
|
297
|
+
- **Labeled callouts**: State design rationale as "Why: ..." callouts, not embedded in paragraphs. Labeled callouts are retained as structure; prose rationale is dropped.
|
|
298
|
+
|
|
299
|
+
## Subagent Criteria
|
|
300
|
+
|
|
301
|
+
When executing the approved plan, use subagents (Task tool) for steps that meet ALL of the following:
|
|
302
|
+
|
|
303
|
+
1. **Self-contained** — The step does not need to read results from a prior step's execution at runtime. All inputs are defined in the plan (file paths, type signatures, expected behavior).
|
|
304
|
+
2. **No cross-step file conflicts** — The step does not modify files that a concurrent step also modifies.
|
|
305
|
+
3. **Verifiable in isolation** — The step has validation criteria that can be checked without running the full application or depending on other steps' output.
|
|
306
|
+
|
|
307
|
+
Use the main context for steps that:
|
|
308
|
+
- Depend on runtime output from a prior step (e.g., "adjust based on test results from Step 2")
|
|
309
|
+
- Modify shared files (e.g., a central config, shared type file) that other steps also touch
|
|
310
|
+
- Require iterative adjustment based on integration feedback
|
|
311
|
+
- Are the final integration or verification step
|
|
312
|
+
|
|
313
|
+
When the plan includes a subagent utilization plan, annotate each step with one of:
|
|
314
|
+
- **Subagent-eligible** — meets all three criteria above
|
|
315
|
+
- **Main-context** — state which criterion is not met
|
|
316
|
+
|
|
317
|
+
## Task Scale Classification
|
|
318
|
+
|
|
319
|
+
Immediately after investigation (Step 1) completes, classify the task scale based on investigation results. The classification determines which conditional elements to include and how execution is routed.
|
|
320
|
+
|
|
321
|
+
**Classification criteria** (use the first matching category):
|
|
322
|
+
|
|
323
|
+
- **S (Small)** — 1-3 steps, no cross-step dependencies beyond sequential ordering
|
|
324
|
+
- Subagent utilization plan: omit (no benefit from subagent overhead)
|
|
325
|
+
- Execution method: main context (see Execution Phase)
|
|
326
|
+
- **M (Medium)** — 4-6 steps, fewer than 2 independent subtrees in the dependency graph
|
|
327
|
+
- Subagent utilization plan: include (per-step annotation as before)
|
|
328
|
+
- Execution method: Worker → Reviewer core loop for subagent-eligible steps (see Execution Phase)
|
|
329
|
+
- **L (Large)** — 7+ steps, OR 4+ steps with 2+ independent subtrees in the dependency graph
|
|
330
|
+
- Subagent utilization plan: include (per-step annotation)
|
|
331
|
+
- Execution method: transition to `/soda-team-init` → `/soda-team-run` (see Execution Phase)
|
|
332
|
+
|
|
333
|
+
State the classification at the top of the plan body: `**Task Scale: [S|M|L]**`
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
|
|
2
|
+
Perform deep, structured codebase research on the given topic and produce a reusable Research Summary artifact.
|
|
3
|
+
|
|
4
|
+
Use English for internal reasoning (thinking). All user-facing output — topic framing, findings presentation, and AskUserQuestion options — must be in Japanese. The Research Summary block must use the exact English template format for downstream compatibility.
|
|
5
|
+
|
|
6
|
+
If $ARGUMENTS is empty, ask the user what they want to research before proceeding.
|
|
7
|
+
|
|
8
|
+
## Procedure
|
|
9
|
+
|
|
10
|
+
### Step 1: Topic Framing
|
|
11
|
+
|
|
12
|
+
Restate the research topic described in $ARGUMENTS. Identify:
|
|
13
|
+
|
|
14
|
+
- **Research scope**: What specific areas of the codebase to investigate (files, patterns, architecture, dependencies)
|
|
15
|
+
- **Research questions**: 2-3 concrete questions this research should answer
|
|
16
|
+
- **Expected output**: What kind of understanding the user needs (architecture overview, dependency mapping, pattern discovery, implementation details)
|
|
17
|
+
|
|
18
|
+
Present this framing briefly. Do NOT use AskUserQuestion — proceed directly to Step 2.
|
|
19
|
+
|
|
20
|
+
### Step 2: Investigation
|
|
21
|
+
|
|
22
|
+
**Sub-agent prompt constraints**: Every sub-agent prompt MUST begin with the following constraint block:
|
|
23
|
+
> You are a research-only agent. Do NOT use AskUserQuestion, EnterPlanMode, or any interactive/planning tools. Return your findings in the output format specified below.
|
|
24
|
+
|
|
25
|
+
**Sub-agent output contract**: Every sub-agent prompt MUST end with the following output format requirement:
|
|
26
|
+
> Return findings in this exact format:
|
|
27
|
+
> ### Files
|
|
28
|
+
> - `path/to/file` — relevance to the topic
|
|
29
|
+
> ### Patterns
|
|
30
|
+
> - pattern name — description of the convention or pattern found
|
|
31
|
+
> ### Dependencies
|
|
32
|
+
> - dependency — how it relates to the topic
|
|
33
|
+
> ### Open Questions
|
|
34
|
+
> - question — what remains unclear from this investigation alone
|
|
35
|
+
|
|
36
|
+
#### Round 1: Survey
|
|
37
|
+
|
|
38
|
+
Launch a sub-agent (Task, subagent_type: Explore) with a prompt that includes the constraint block, then:
|
|
39
|
+
- The research topic and scope from Step 1
|
|
40
|
+
- Instruction to survey: project structure, key files, dependencies, and conventions related to the topic
|
|
41
|
+
- The output contract
|
|
42
|
+
|
|
43
|
+
Synthesize the agent's findings into a Common Context block.
|
|
44
|
+
|
|
45
|
+
#### Round 2: Focused Investigation
|
|
46
|
+
|
|
47
|
+
Based on Round 1 findings, launch 1-2 focused sub-agents in parallel (Task, subagent_type: Explore). Each prompt must include:
|
|
48
|
+
1. The constraint block
|
|
49
|
+
2. The Common Context block from Round 1 (summarized, not raw output)
|
|
50
|
+
3. A specific research question from Step 1 or a new question that emerged from Round 1
|
|
51
|
+
4. The output contract
|
|
52
|
+
|
|
53
|
+
### Step 3: Findings Presentation
|
|
54
|
+
|
|
55
|
+
Synthesize all investigation results into a structured findings report. Organize by theme (not by agent). Present in Japanese:
|
|
56
|
+
|
|
57
|
+
- **主要な発見**: Key discoveries with file paths and specific code references (`path/to/file:L42-L78`)
|
|
58
|
+
- **パターンと規約**: Patterns and conventions found in the codebase
|
|
59
|
+
- **アーキテクチャと依存関係**: Architecture relationships, dependency chains, data flow
|
|
60
|
+
- **未解決の疑問**: Open questions and areas of uncertainty
|
|
61
|
+
- **調査範囲**: What was covered and what was not
|
|
62
|
+
|
|
63
|
+
### Step 4: Annotation Cycle
|
|
64
|
+
|
|
65
|
+
This is the core differentiator of this skill — iterative refinement through user feedback, inspired by Boris Tane's annotation-driven workflow. Optimal depth is typically 2-3 rounds, but there is no hard limit.
|
|
66
|
+
|
|
67
|
+
Use AskUserQuestion:
|
|
68
|
+
- "特定の領域をさらに深掘り" — user specifies what to investigate more deeply
|
|
69
|
+
- "この理解に補足・修正を加える" — user provides domain knowledge corrections or additions
|
|
70
|
+
- "別の角度から調査" — pivot the investigation to a different perspective
|
|
71
|
+
- "十分理解できた(Research Summary を出力)" — finalize and emit Research Summary
|
|
72
|
+
|
|
73
|
+
**If "特定の領域をさらに深掘り"**: Ask the user which area to investigate. Launch 1 focused sub-agent with the accumulated context and the user's direction. Present additional findings, then return to this AskUserQuestion.
|
|
74
|
+
|
|
75
|
+
**If "この理解に補足・修正を加える"**: Accept the user's free-text input. Record it as domain knowledge. Revise any affected findings to reflect the correction. Present the updated findings, then return to this AskUserQuestion.
|
|
76
|
+
|
|
77
|
+
**If "別の角度から調査"**: Ask the user what angle to take. Launch 1 sub-agent with the new perspective. Present findings from the new angle alongside existing findings, then return to this AskUserQuestion.
|
|
78
|
+
|
|
79
|
+
**If "十分理解できた"**: Proceed to Step 5.
|
|
80
|
+
|
|
81
|
+
### Step 5: Research Summary
|
|
82
|
+
|
|
83
|
+
Emit the following structured handoff block. This enables same-session chaining to `/soda-discuss` or `/soda-plan`.
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
## Research Summary
|
|
87
|
+
|
|
88
|
+
**Topic**: (one-sentence research question)
|
|
89
|
+
**Scope**: (what areas were investigated)
|
|
90
|
+
|
|
91
|
+
### Key Findings
|
|
92
|
+
- `path/to/file` — (discovery with specific details)
|
|
93
|
+
- (pattern or convention found)
|
|
94
|
+
|
|
95
|
+
### Architecture & Dependencies
|
|
96
|
+
- (relationship discovered)
|
|
97
|
+
- (dependency chain)
|
|
98
|
+
|
|
99
|
+
### Code References
|
|
100
|
+
- `path/to/file:L42-L78` — (what this code does and why it matters)
|
|
101
|
+
|
|
102
|
+
### Open Questions
|
|
103
|
+
- (unresolved question that could not be answered from code alone)
|
|
104
|
+
|
|
105
|
+
### Domain Knowledge
|
|
106
|
+
- (corrections or additions provided by user during annotation cycle)
|
|
107
|
+
(omit this section if no user annotations were provided)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Then print next steps:
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
Research complete:
|
|
114
|
+
- Research Summary emitted for handoff
|
|
115
|
+
|
|
116
|
+
Next:
|
|
117
|
+
/soda-discuss — Discuss direction and explore approaches using this research
|
|
118
|
+
/soda-plan — Plan implementation directly using this research
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Constraints
|
|
122
|
+
|
|
123
|
+
- This skill only investigates. Do NOT modify any code.
|
|
124
|
+
- Do NOT enter plan mode (no EnterPlanMode).
|
|
125
|
+
- The Research Summary block format should be stable — downstream skills use it as conversation context.
|
|
126
|
+
- Findings presentation must be organized by theme, not by agent. Merge and deduplicate findings across agents.
|
|
127
|
+
- Domain Knowledge entries from user annotations are authoritative — they override investigation findings when there is a conflict.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
|
|
2
|
+
Review branch changes for design conformance — checking implementation against Design Decisions (DD-N) from Living Discussion Documents and detecting implicit design decisions introduced during implementation.
|
|
3
|
+
|
|
4
|
+
Use English for internal reasoning (thinking). All user-facing output must be in Japanese.
|
|
5
|
+
|
|
6
|
+
## Current Branch Context
|
|
7
|
+
|
|
8
|
+
!`sd review detect-base-branch`
|
|
9
|
+
|
|
10
|
+
The above JSON provides `baseBranch`, `mergeBase`, `changedFiles`, `potentialConflicts`, and ready-to-use `commands.diff` / `commands.log`.
|
|
11
|
+
|
|
12
|
+
If $ARGUMENTS is not empty, treat it as the review focus or an alternative base branch specification. When an alternative base is specified, re-compute the diff using that base instead of the detected one.
|
|
13
|
+
|
|
14
|
+
## Procedure
|
|
15
|
+
|
|
16
|
+
1. **Identify the diff**: Use the pre-fetched branch context JSON above. Run `commands.diff` to get the full diff. If $ARGUMENTS specifies a different base, re-compute the merge-base and diff accordingly. If the JSON contains an `error` field, present the error to the user and use AskUserQuestion: "別のベースブランチを指定" / "レビューを中止". If the diff is empty, inform the user and use AskUserQuestion: "別のベースブランチを指定" / "レビューを終了".
|
|
17
|
+
|
|
18
|
+
2. **Load design decisions**: Query `sd decision list --repo <owner/repo>` (detect owner/repo from git remote).
|
|
19
|
+
- **If decisions found**: Present the found decisions and use AskUserQuestion to ask which apply to this review. Extract:
|
|
20
|
+
- Decision constraints as **verification targets**
|
|
21
|
+
- `rejected_alternatives` as **exclusion reference** (for context, not verification)
|
|
22
|
+
- **If no decisions found** (degraded mode): Note that no design decisions exist. Skip decision verification in step 4. The implicit decision detection agent will run in discovery mode — identifying all non-trivial design judgments as formalization candidates rather than checking against a baseline.
|
|
23
|
+
|
|
24
|
+
3. **Prepare diff content**: Run `commands.diff` via Bash and capture the full diff output.
|
|
25
|
+
|
|
26
|
+
4. **Launch conformance check sub-agents**: Launch two sub-agents in parallel using Task tool. Both sub-agent prompts MUST begin with the standard constraint block.
|
|
27
|
+
|
|
28
|
+
**Sub-agent A — DD Verification Agent** (skip if no-decisions mode):
|
|
29
|
+
```
|
|
30
|
+
Task(subagent_type: Explore)
|
|
31
|
+
```
|
|
32
|
+
Prompt structure:
|
|
33
|
+
> You are a research-only agent. Do NOT use AskUserQuestion, EnterPlanMode, or any interactive/planning tools. Return your findings in the output format specified below.
|
|
34
|
+
>
|
|
35
|
+
> ## Task
|
|
36
|
+
> Verify whether the following Design Decisions (DD-N) from a Living Discussion Document are satisfied by the implementation changes in the diff below.
|
|
37
|
+
>
|
|
38
|
+
> For each DD-N, determine:
|
|
39
|
+
> - **SATISFIED**: The implementation clearly fulfills the constraint
|
|
40
|
+
> - **VIOLATED**: The implementation contradicts or fails to implement the constraint
|
|
41
|
+
> - **UNCLEAR**: Cannot determine from the diff alone (may need broader codebase context)
|
|
42
|
+
>
|
|
43
|
+
> When checking, read the actual source files (not just the diff) to understand the full implementation context. The diff shows what changed, but the constraint may be about the resulting state.
|
|
44
|
+
>
|
|
45
|
+
> ## Design Decisions
|
|
46
|
+
> {{extracted DD-N entries with full Constraint/Why/Scope text}}
|
|
47
|
+
>
|
|
48
|
+
> ## Diff
|
|
49
|
+
> {{full diff output}}
|
|
50
|
+
>
|
|
51
|
+
> Return findings in this exact format:
|
|
52
|
+
> ### DD Verification
|
|
53
|
+
> - **DD-N**: {{SATISFIED | VIOLATED | UNCLEAR}} — {{evidence with file:line references}}
|
|
54
|
+
> ### Violation Details
|
|
55
|
+
> - **DD-N**: {{what was required}} vs {{what was found}} — {{file:line}}
|
|
56
|
+
> ### Notes
|
|
57
|
+
> - {{any additional context or caveats}}
|
|
58
|
+
|
|
59
|
+
**Sub-agent B — Implicit Decision Detection Agent**:
|
|
60
|
+
```
|
|
61
|
+
Task(subagent_type: Explore)
|
|
62
|
+
```
|
|
63
|
+
Prompt structure:
|
|
64
|
+
> You are a research-only agent. Do NOT use AskUserQuestion, EnterPlanMode, or any interactive/planning tools. Return your findings in the output format specified below.
|
|
65
|
+
>
|
|
66
|
+
> ## Task
|
|
67
|
+
> Examine the following diff and identify design decisions that were made during implementation. A "design decision" is a non-trivial judgment about architecture, data modeling, API shape, error handling strategy, or behavioral semantics — NOT routine implementation details like variable naming, loop structure, or formatting.
|
|
68
|
+
>
|
|
69
|
+
> Examples of design decisions to detect:
|
|
70
|
+
> - Introducing a new data structure or type that defines a contract
|
|
71
|
+
> - Choosing an error handling strategy (throw vs return vs union type)
|
|
72
|
+
> - Defining an API shape (function signatures, parameter types, return types)
|
|
73
|
+
> - Selecting an architectural pattern (observer, middleware, pipeline)
|
|
74
|
+
> - Adding a new dependency or integration point
|
|
75
|
+
>
|
|
76
|
+
> Examples of routine implementation details to SKIP:
|
|
77
|
+
> - Variable/function naming choices
|
|
78
|
+
> - Import ordering
|
|
79
|
+
> - Iteration approach (for vs map vs reduce)
|
|
80
|
+
> - Formatting and style
|
|
81
|
+
> - Adding type annotations to existing code
|
|
82
|
+
>
|
|
83
|
+
> {{IF DD-N entries available}}
|
|
84
|
+
> The following Design Decisions are already recorded. Only report decisions NOT covered by these entries:
|
|
85
|
+
> {{DD-N list with Constraint text}}
|
|
86
|
+
> {{ELSE}}
|
|
87
|
+
> No prior Design Decisions are recorded. Report all non-trivial design judgments found in the diff as candidates for formalization.
|
|
88
|
+
> {{END}}
|
|
89
|
+
>
|
|
90
|
+
> ## Diff
|
|
91
|
+
> {{full diff output}}
|
|
92
|
+
>
|
|
93
|
+
> Return findings in this exact format:
|
|
94
|
+
> ### Implicit Design Decisions
|
|
95
|
+
> - **[file:line]** {{decision description}} — {{why this is a design decision, not routine implementation}}
|
|
96
|
+
> ### Formalization Candidates
|
|
97
|
+
> - {{which of the above should be recorded as formal DD entries, and why}}
|
|
98
|
+
> ### Notes
|
|
99
|
+
> - {{any additional context}}
|
|
100
|
+
|
|
101
|
+
5. **Integrate results**: Combine both sub-agent outputs into a unified conformance report.
|
|
102
|
+
|
|
103
|
+
6. **Present report**: Output the conformance report to the user in the format specified below.
|
|
104
|
+
|
|
105
|
+
7. **Next steps**: Use AskUserQuestion with context-dependent options:
|
|
106
|
+
- If violations found:
|
|
107
|
+
- "違反箇所の修正をプランする" (suggest `/soda-plan`)
|
|
108
|
+
- "DD を実装に合わせて更新する"
|
|
109
|
+
- "メモして後で対応"
|
|
110
|
+
- If implicit decisions found but no violations:
|
|
111
|
+
- "暗黙の判断を DD として記録する"
|
|
112
|
+
- "問題なし、このまま進める"
|
|
113
|
+
- If clean (no violations, no implicit decisions):
|
|
114
|
+
- "設計適合性に問題なし"
|
|
115
|
+
- "別の観点でレビュー"
|
|
116
|
+
|
|
117
|
+
## Report Format
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
## 設計適合性レポート
|
|
121
|
+
|
|
122
|
+
### 対象
|
|
123
|
+
- ブランチ: {{branch name}}
|
|
124
|
+
- ベース: {{base branch}} ({{merge-base commit}})
|
|
125
|
+
- 参照: {{selected design decisions, or "なし (探索モード)"}}
|
|
126
|
+
|
|
127
|
+
### DD 検証結果
|
|
128
|
+
| DD | 制約 | 判定 | 根拠 |
|
|
129
|
+
|---|---|---|---|
|
|
130
|
+
| DD-N | {{constraint summary}} | SATISFIED / VIOLATED / UNCLEAR | {{file:line — evidence}} |
|
|
131
|
+
|
|
132
|
+
### DD 違反の詳細
|
|
133
|
+
{{For each VIOLATED DD:}}
|
|
134
|
+
#### DD-N: {{name}}
|
|
135
|
+
- **制約**: {{what was required}}
|
|
136
|
+
- **実装**: {{what was found}} ({{file:line}})
|
|
137
|
+
- **推奨対応**: 実装を修正 / DD を更新
|
|
138
|
+
|
|
139
|
+
### 暗黙の設計判断
|
|
140
|
+
| # | ファイル | 判断内容 | DD化推奨 |
|
|
141
|
+
|---|---|---|---|
|
|
142
|
+
| 1 | {{file:line}} | {{description}} | Yes / No |
|
|
143
|
+
|
|
144
|
+
### サマリー
|
|
145
|
+
- DD 検証: {{N}} 件中 {{satisfied}} 件適合、{{violated}} 件違反、{{unclear}} 件不明
|
|
146
|
+
- 暗黙の設計判断: {{N}} 件検出 (うち {{M}} 件 DD 化推奨)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
When in no-decisions mode (no Living Discussion Document), omit the "DD 検証結果" and "DD 違反の詳細" sections and update the summary. Replace with:
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
### DD 検証結果
|
|
153
|
+
Living Discussion Document が見つからないため、DD 検証はスキップしました。
|
|
154
|
+
暗黙の設計判断の探索のみ実行しています。
|
|
155
|
+
|
|
156
|
+
### サマリー
|
|
157
|
+
- DD 検証: スキップ (Living Discussion Document なし)
|
|
158
|
+
- 暗黙の設計判断: {{N}} 件検出 (うち {{M}} 件 DD 化推奨)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Constraints
|
|
162
|
+
|
|
163
|
+
- **Report only** — do NOT modify any code or files. If a fix is needed, suggest a direction but do not apply it.
|
|
164
|
+
- **No code quality review** — this skill focuses exclusively on design conformance. Code quality concerns (bugs, style, performance) are handled by `/soda-fix` and manual review.
|
|
165
|
+
- Sub-agent prompts MUST begin with: "You are a research-only agent. Do NOT use AskUserQuestion, EnterPlanMode, or any interactive/planning tools."
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
## Available CLI Commands (wat)
|
|
3
|
+
|
|
4
|
+
| Command | Description |
|
|
5
|
+
|---|---|
|
|
6
|
+
| `sd node search` | Search nodes with `--query`, `--kind`, `--tags`, `--limit`, `--offset` |
|
|
7
|
+
| `sd node update <id>` | Update a node's `--body`, `--kind`, `--prop`, `--props-json`, or via `--stdin` |
|
|
8
|
+
| `sd node get <id>` | Retrieve a node with all its relations (tags, links) |
|
|
9
|
+
| `sd list kinds` | List all node kinds with counts |
|
|
10
|
+
|
|
11
|
+
## Instructions
|
|
12
|
+
1. Fetch all TODOs: `sd node search --kind todo`
|
|
13
|
+
2. If tags provided, filter: `sd node search --kind todo --tags <tag1>,<tag2>`
|
|
14
|
+
3. Present TODOs grouped by status (pending → in_progress → done)
|
|
15
|
+
4. For each pending TODO, discuss with user:
|
|
16
|
+
- Priority assessment (suggest based on deadlines, dependencies)
|
|
17
|
+
- Status update if needed → `sd node update <id> --prop status=in_progress --prop priority=high`
|
|
18
|
+
5. Identify blocked or stale TODOs
|
|
19
|
+
6. Summarize changes made
|