@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.
Files changed (51) hide show
  1. package/dist/agents/codex-review/body.md +98 -0
  2. package/dist/agents/team-reviewer/body.md +78 -0
  3. package/dist/agents/team-worker/body.md +46 -0
  4. package/dist/scripts/codex-review.js +237 -0
  5. package/dist/scripts/detect-base-branch.js +185 -0
  6. package/dist/scripts/resolve-session.js +76 -0
  7. package/dist/skills/soda-brief/body.md +73 -0
  8. package/dist/skills/soda-discuss/README.md +25 -0
  9. package/dist/skills/soda-discuss/body.md +216 -0
  10. package/dist/skills/soda-fix/body.md +137 -0
  11. package/dist/skills/soda-plan/body.md +333 -0
  12. package/dist/skills/soda-research/body.md +127 -0
  13. package/dist/skills/soda-review/body.md +165 -0
  14. package/dist/skills/soda-review-todos/body.md +19 -0
  15. package/dist/skills/soda-team-init/body.md +313 -0
  16. package/dist/skills/soda-team-init/references/coordination-files.md +188 -0
  17. package/dist/skills/soda-team-run/body.md +329 -0
  18. package/dist/skills/soda-todo/body.md +86 -0
  19. package/dist/src/cli/commands/agent.js +29 -0
  20. package/dist/src/cli/commands/codex-review.js +14 -0
  21. package/dist/src/cli/commands/decision.js +103 -0
  22. package/dist/src/cli/commands/import.js +174 -0
  23. package/dist/src/cli/commands/link.js +52 -0
  24. package/dist/src/cli/commands/list.js +12 -0
  25. package/dist/src/cli/commands/node.js +118 -0
  26. package/dist/src/cli/commands/review.js +23 -0
  27. package/dist/src/cli/commands/session.js +23 -0
  28. package/dist/src/cli/commands/skill.js +29 -0
  29. package/dist/src/cli/commands/tag.js +31 -0
  30. package/dist/src/cli/helpers.js +51 -0
  31. package/dist/src/cli/index.js +48 -0
  32. package/dist/src/cli.js +59 -0
  33. package/dist/src/core/database.js +209 -0
  34. package/dist/src/core/ensure-dirs.js +8 -0
  35. package/dist/src/core/index.js +1 -0
  36. package/dist/src/core/kinds.js +46 -0
  37. package/dist/src/core/schema.sql +36 -0
  38. package/dist/src/core/schemas.js +41 -0
  39. package/dist/src/core/search.js +80 -0
  40. package/dist/src/core/types.js +0 -0
  41. package/dist/src/tui/App.js +130 -0
  42. package/dist/src/tui/actions.js +9 -0
  43. package/dist/src/tui/components/FilterBar.js +46 -0
  44. package/dist/src/tui/components/LinkList.js +53 -0
  45. package/dist/src/tui/components/NodeDetail.js +111 -0
  46. package/dist/src/tui/components/NodeList.js +62 -0
  47. package/dist/src/tui/components/StatusBar.js +90 -0
  48. package/dist/src/tui/hooks/useNavigation.js +57 -0
  49. package/dist/src/tui/hooks/useNodes.js +44 -0
  50. package/dist/src/tui/index.js +4 -0
  51. package/package.json +29 -0
@@ -0,0 +1,76 @@
1
+ import { readdir } from "node:fs/promises";
2
+ async function findInIndex(indexPath, sessionId) {
3
+ const file = Bun.file(indexPath);
4
+ if (!await file.exists())
5
+ return null;
6
+ const index = await file.json();
7
+ const entry = index.entries?.find((e) => e.sessionId === sessionId);
8
+ return entry?.fullPath ?? null;
9
+ }
10
+ async function findClaudePid() {
11
+ let pid = process.ppid;
12
+ const home = process.env.HOME;
13
+ if (!home)
14
+ return null;
15
+ for (let depth = 0;depth < 3; depth++) {
16
+ const sessionFile = Bun.file(`${home}/.claude/sessions/${pid}.json`);
17
+ if (await sessionFile.exists())
18
+ return pid;
19
+ const proc = Bun.spawn(["ps", "-o", "ppid=", "-p", String(pid)], {
20
+ stdout: "pipe",
21
+ stderr: "pipe"
22
+ });
23
+ const output = (await new Response(proc.stdout).text()).trim();
24
+ await proc.exited;
25
+ const parentPid = parseInt(output, 10);
26
+ if (isNaN(parentPid) || parentPid <= 1)
27
+ return null;
28
+ pid = parentPid;
29
+ }
30
+ return null;
31
+ }
32
+ async function main() {
33
+ const home = process.env.HOME;
34
+ if (!home) {
35
+ console.error("⚠ HOME environment variable is not set");
36
+ process.exit(0);
37
+ }
38
+ const projectsDir = `${home}/.claude/projects`;
39
+ const claudePid = await findClaudePid();
40
+ if (!claudePid) {
41
+ console.error("⚠ Claude セッションプロセスが見つかりません");
42
+ process.exit(0);
43
+ }
44
+ const pidFile = Bun.file(`${home}/.claude/sessions/${claudePid}.json`);
45
+ if (!await pidFile.exists()) {
46
+ console.error(`⚠ セッションPIDファイルが見つかりません (PID: ${claudePid})`);
47
+ process.exit(0);
48
+ }
49
+ const { sessionId, cwd } = await pidFile.json();
50
+ const escapedPath = cwd.replace(/\//g, "-");
51
+ const directPath = `${projectsDir}/${escapedPath}/${sessionId}.jsonl`;
52
+ if (await Bun.file(directPath).exists()) {
53
+ console.log(directPath);
54
+ return;
55
+ }
56
+ const indexResult = await findInIndex(`${projectsDir}/${escapedPath}/sessions-index.json`, sessionId);
57
+ if (indexResult) {
58
+ console.log(indexResult);
59
+ return;
60
+ }
61
+ const dirs = await readdir(projectsDir).catch(() => []);
62
+ for (const dir of dirs) {
63
+ const jsonlPath = `${projectsDir}/${dir}/${sessionId}.jsonl`;
64
+ if (await Bun.file(jsonlPath).exists()) {
65
+ console.log(jsonlPath);
66
+ return;
67
+ }
68
+ const result = await findInIndex(`${projectsDir}/${dir}/sessions-index.json`, sessionId);
69
+ if (result) {
70
+ console.log(result);
71
+ return;
72
+ }
73
+ }
74
+ console.error(`⚠ セッション ${sessionId} がインデックスに見つかりません`);
75
+ }
76
+ main();
@@ -0,0 +1,73 @@
1
+
2
+ Perform a lightweight investigation on the given topic and produce a Discussion Briefing that frames the discussion for `/soda-discuss`.
3
+
4
+ Use English for internal reasoning (thinking). Discussion Briefing content must be in English. Next-step suggestion must be in Japanese.
5
+
6
+ If $ARGUMENTS is empty, output a brief message in Japanese asking the user what topic they want to explore, then stop.
7
+
8
+ ## Purpose
9
+
10
+ This skill is a **non-interactive preparation step** for `/soda-discuss`. It gathers enough context to start a productive discussion without requiring the depth of `/soda-research`.
11
+
12
+ **Position in skill chain**: `soda-research → soda-brief → soda-discuss → soda-plan`. soda-brief and soda-research are alternatives at the preparation stage — soda-brief for quick kickoff, soda-research for deep investigation.
13
+
14
+ ## Procedure
15
+
16
+ ### Step 1: Topic Parsing
17
+
18
+ Identify the core topic from $ARGUMENTS. Determine:
19
+ - What area of the codebase or design space is involved
20
+ - What kind of discussion this will lead to (new feature, refactoring, skill design, architecture, etc.)
21
+
22
+ ### Step 2: Survey Investigation
23
+
24
+ Launch a sub-agent (Task, subagent_type: Explore) to survey the relevant area.
25
+
26
+ **Sub-agent prompt constraints**: Every sub-agent prompt MUST begin with:
27
+ > 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.
28
+
29
+ **Sub-agent output contract**: Every sub-agent prompt MUST end with:
30
+ > Return findings in this exact format:
31
+ > ### Files
32
+ > - `path/to/file` — relevance to the topic
33
+ > ### Patterns
34
+ > - pattern name — description of the convention or pattern found
35
+ > ### Dependencies
36
+ > - dependency — how it relates to the topic
37
+ > ### Open Questions
38
+ > - question — what remains unclear from this investigation alone
39
+
40
+ The survey prompt should include the topic and ask for: relevant files, existing patterns, dependencies, and current state of the area.
41
+
42
+ ### Step 3: Focused Investigation (optional)
43
+
44
+ If the survey reveals a specific area that needs deeper understanding to frame the discussion well, launch 1 focused sub-agent (Task, subagent_type: Explore) with the survey findings as context. Apply the same constraint block and output contract.
45
+
46
+ Skip this step if the survey provides sufficient context for framing.
47
+
48
+ ### Step 4: Discussion Briefing
49
+
50
+ Synthesize findings into a Discussion Briefing block:
51
+
52
+ ```
53
+ ## Discussion Briefing
54
+ - **Topic**: what needs to be discussed
55
+ - **Background**: relevant codebase findings and current state
56
+ - **Key Questions**: 2-4 questions that should guide the discussion (ordered by dependency)
57
+ - **Constraints**: known technical or design constraints
58
+ ```
59
+
60
+ Then suggest the next step in Japanese:
61
+
62
+ ```
63
+ 調査完了。以下のコマンドで議論を開始できます:
64
+ /soda-discuss [topic]
65
+ ```
66
+
67
+ ## Constraints
68
+
69
+ - This skill is **non-interactive**. Do NOT use AskUserQuestion.
70
+ - Do NOT modify any code (read-only investigation only).
71
+ - Do NOT enter plan mode (no EnterPlanMode).
72
+ - Keep investigation lightweight — max 2 sub-agent launches (1 survey + 1 optional focused). For deep research, use `/soda-research` instead.
73
+ - The Discussion Briefing is a session artifact. Downstream skills use it naturally from the conversation context.
@@ -0,0 +1,25 @@
1
+ # soda-discuss — Design Rationale
2
+
3
+ ## Background
4
+
5
+ soda-discuss was originally a design discussion skill that persisted decisions to Living Discussion Document (LDD) files (`.agent-discussions/*.md`). sb-brainstorm was a separate skill in soda-agent-tools for freeform brainstorming with knowledge graph persistence.
6
+
7
+ ## Integration (2026-03-28)
8
+
9
+ The two skills were merged based on the following observations:
10
+
11
+ 1. **Overlapping purpose**: Both were interactive dialogue skills with nearly identical Core Values and Interaction Principles
12
+ 2. **Complementary persistence**: soda-discuss had structured decision recording (DD-N), sb-brainstorm had incremental memo capture + conversation wrap-up
13
+ 3. **LDD worktree problem**: LDD files were repo-local, breaking in git worktrees
14
+
15
+ ## Key Design Decisions
16
+
17
+ - **DB-first persistence**: Decisions write directly to soda-agent-tools SQLite DB via `sd decision create`, replacing LDD files entirely
18
+ - **Natural flow**: No explicit mode switching between exploration and decision-making — the conversation flows naturally, with only wrap-up being an explicit phase
19
+ - **Decision immediate, memos batched**: Design decisions are recorded immediately (Bash permission = approval checkpoint). Memos are captured as text during discussion and batch-written during wrap-up
20
+ - **Conversation node as link hub**: The wrap-up conversation node stores session metadata (context, key_points, open_questions) and links to decisions/memos. It does NOT duplicate decision content
21
+ - **allowed-tools restriction**: `Bash(sd *)` only — no arbitrary shell access. Investigation via Task sub-agents
22
+
23
+ ## References
24
+
25
+ - LDD: `.agent-discussions/2026-03-28-decision-persistence-integration.md` (concluded, DD-1 through DD-32)
@@ -0,0 +1,216 @@
1
+ Use English for internal reasoning (thinking). User interaction (discussion, presentations) must be in Japanese.
2
+
3
+ ## Purpose
4
+
5
+ This skill is for **designing new features, skills, or concepts when details are not yet solidified**. It facilitates an open-ended, interactive dialogue where the direction emerges through collaborative exploration rather than following a predetermined workflow.
6
+
7
+ Unlike procedural skills (soda-plan, soda-brief), this skill defines **values and principles** that guide the conversation, not a fixed sequence of steps.
8
+
9
+ **Position in skill chain**: `soda-research → soda-brief → soda-discuss → soda-plan`. Downstream skills (soda-plan) query decisions from the DB via CLI. This skill's responsibility ends at recording decisions.
10
+
11
+ If `$ARGUMENTS` is empty, ask the user what they want to explore before proceeding.
12
+
13
+ ## Core Values
14
+
15
+ These values govern how the discussion unfolds. They are not steps to follow in order — they are principles to uphold throughout the conversation.
16
+
17
+ ### 理解してから決める — Understand Before Committing
18
+
19
+ Always explore and investigate the current state before deciding on a direction. Don't jump to solutions.
20
+
21
+ - Use sub-agents (Task, subagent_type: Explore) to investigate the codebase, existing patterns, and prior art
22
+ - Present what you found before asking the user to make decisions
23
+ - Let understanding accumulate before narrowing options
24
+
25
+ ### 事実に基づく判断 — Ground Decisions in Observed Reality
26
+
27
+ Base decisions on actual code, real sessions, and genuine friction — not on speculation or theoretical best practices.
28
+
29
+ - When the user describes a pattern they've been using, search for evidence of it
30
+ - When proposing a direction, ground it in what exists, not what could theoretically exist
31
+ - Prefer "I found X in the codebase" over "typically, Y is a good practice"
32
+
33
+ ### 柔軟性の保持 — Preserve Flexibility
34
+
35
+ Don't lock into a specific approach prematurely. Keep options open until understanding is sufficient.
36
+
37
+ - Avoid narrowing to a single option prematurely — present a recommendation, but keep other options visible
38
+ - Frame observations as possibilities, not conclusions
39
+ - It's fine for a discussion to end with open questions — that's what soda-plan is for
40
+
41
+ ### フィードバックは方向の精緻化 — Feedback Shapes Direction
42
+
43
+ User input refines and shapes the emerging direction. It's not about correcting right or wrong answers.
44
+
45
+ - When the user provides feedback, treat it as steering input, not error correction
46
+ - Build on the user's observations rather than evaluating them
47
+ - The discussion is collaborative — both sides contribute to the emerging understanding
48
+
49
+ ## Interaction Principles
50
+
51
+ These principles govern how to conduct the dialogue with the user. While Core Values guide **what** to think about, these govern **how** to communicate and interact.
52
+
53
+ ### 対話に徹する — Stay in Discussion Mode
54
+
55
+ This skill is an interactive dialogue for shaping direction, not for producing implementation artifacts. Before presenting any concrete code changes or detailed implementation proposals, summarize the discussion points so far and confirm the user wants to move toward implementation.
56
+
57
+ - When the conversation naturally drifts toward implementation detail, pause and summarize the discussion so far before proceeding
58
+ - Code snippets for illustrating a design point or unblocking a decision are fine — but do not frame them as proposed changes to be applied
59
+ - If the user is ready for implementation, guide them to soda-plan rather than producing implementation output inline
60
+ - When in doubt, summarize the discussion so far and ask the user whether to continue exploring or transition to planning
61
+
62
+ **Anti-pattern**: Producing file-by-file change lists, detailed code diffs, or step-by-step implementation instructions as part of the discussion — even when no files are actually modified. This turns an exploratory dialogue into an unsolicited implementation proposal.
63
+
64
+ ### 一度に一つ、承認を待つ — One Topic at a Time, Wait for Approval
65
+
66
+ Present one decision point at a time. Wait for the user's response before moving to the next topic.
67
+
68
+ - Present one topic as text output and wait for the user's response before moving on
69
+ - Don't bundle multiple decisions into one message
70
+ - When the user responds with a short confirmation ("OK", "いいね"), that's a sign the framing was right
71
+ - Use AskUserQuestion only when there are 3 or more concrete options to compare — otherwise, present as text and let the user respond freely
72
+
73
+ **Anti-pattern**: Presenting multiple topics at once ("Here are decisions A, B, and C with their respective options..."), forcing the user into a lengthy response.
74
+
75
+ ### 選択肢には根拠と推奨を添える — Options Come with Evidence and Recommendation
76
+
77
+ When presenting choices, include tradeoffs for each option and a recommendation with reasoning. Use comparison tables when there are 3 or more options.
78
+
79
+ - Each option should have a clear tradeoff description
80
+ - State which option you recommend and why
81
+ - The user can override — the recommendation reduces evaluation burden, not decision authority
82
+
83
+ **Anti-pattern**: Listing options without tradeoff comparison or recommendation, leaving the user to evaluate independently.
84
+
85
+ ### データが先、判断が後 — Data Before Decisions
86
+
87
+ Share investigation results and evidence before asking the user for a decision. Structure findings in tables or organized formats.
88
+
89
+ - Present sub-agent findings before asking for direction
90
+ - Investigation data may overturn initial assumptions — let the data speak first
91
+ - The user and assistant should be looking at the same evidence when discussing
92
+
93
+ **Anti-pattern**: Asking "what should we do?" before sharing what was found. Or investigating but presenting only conclusions without the underlying data.
94
+
95
+ ### 判断の保留は深掘りのシグナル — Deferred Judgment Signals Need for Deeper Analysis
96
+
97
+ When the user defers a decision or asks for more detail, don't repeat the same question. Provide deeper analysis — more detailed tradeoffs, code examples, concrete implications — then re-present the decision.
98
+
99
+ - A deferral means "I don't have enough information to decide"
100
+ - Bridge the information gap before re-asking
101
+ - The re-presented question may have different or refined options based on the deeper analysis
102
+
103
+ **Anti-pattern**: Rewording the same question after a deferral. Or interpreting deferral as "undecided on direction" and switching topics.
104
+
105
+ ### 議題は依存順に並べる — Order Topics by Dependencies
106
+
107
+ When multiple topics need discussion, identify dependency relationships between them and propose an order that progresses from foundational decisions to dependent ones. Make dependencies explicit.
108
+
109
+ - State "X's conclusion constrains Y's options" when presenting the order
110
+ - The user may reorder if they have different priorities — present the proposed order, don't impose it
111
+ - Foundational decisions first prevents backtracking
112
+
113
+ **Anti-pattern**: Presenting topics in arbitrary order, then discovering "given what we decided about X, we need to reconsider Y."
114
+
115
+ ### 提示して委ねる — Present and Let the User Steer
116
+
117
+ Share findings, analysis, and recommendations as text output. Don't wrap every interaction in AskUserQuestion. The user will naturally respond with confirmation, correction, or additional context.
118
+
119
+ - Present investigation results, analysis, and recommendations as regular text output
120
+ - End with your observation or recommendation — not necessarily a question. The user will respond when they have input
121
+ - The user's free-form response often carries richer context than a selection from predefined options
122
+ - Reserve AskUserQuestion for moments with 3+ concrete, comparable options (e.g., approach A vs B vs C with tradeoff tables)
123
+
124
+ **Anti-pattern**: Using AskUserQuestion for every interaction point, turning an open-ended discussion into a rigid Q&A flow. This prevents the user from volunteering context that wasn't anticipated by the predefined options.
125
+
126
+ ## Available CLI Commands (wat)
127
+
128
+ | Command | Description |
129
+ |---|---|
130
+ | `sd decision create` | Create a decision with `--constraint`, `--why`, `--scope`, `--repo-owner`, `--repo-name`, `--tag`, `--rejected-alt-json`, or `--stdin` |
131
+ | `sd decision list` | List decisions with `--tag`, `--repo <owner/repo>`, `--limit` |
132
+ | `sd node create` | Create a node with `--kind`, `--body`, `--tags`, `--prop`, `--props-json`, or `--stdin` |
133
+ | `sd node update <id>` | Update a node's `--body`, `--kind`, `--prop`, `--props-json`, or via `--stdin` |
134
+ | `sd node delete <id>` | Delete a node |
135
+ | `sd node get <id>` | Retrieve a node with all its relations |
136
+ | `sd node search` | Search nodes with `--query`, `--kind`, `--tags`, `--limit`, `--offset` |
137
+ | `sd tag add <id> <tags...>` | Add tags to a node |
138
+ | `sd tag remove <id> <tags...>` | Remove tags from a node |
139
+ | `sd link create <from> <to> --type <t>` | Create a typed directional link |
140
+ | `sd link delete <from> <to> --type <t>` | Delete a link |
141
+ | `sd link list <id>` | List links for a node (`--direction from\|to\|both`) |
142
+
143
+ For complex properties, use `--stdin` with a heredoc:
144
+ ```sh
145
+ sd node create --stdin <<'EOF'
146
+ {"kind":"conversation","body":"...","properties":{...},"tags":[...]}
147
+ EOF
148
+ ```
149
+
150
+ ## Sub-agent Usage
151
+
152
+ Every sub-agent prompt MUST begin with:
153
+
154
+ > 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.
155
+
156
+ Every sub-agent prompt MUST end with the standard investigation output contract:
157
+
158
+ > Return findings in this exact format:
159
+ > ### Files
160
+ > - `path/to/file` — relevance to the topic
161
+ > ### Patterns
162
+ > - pattern name — description of the convention or pattern found
163
+ > ### Dependencies
164
+ > - dependency — how it relates to the topic
165
+ > ### Open Questions
166
+ > - question — what remains unclear from this investigation alone
167
+
168
+ ## Guidelines
169
+
170
+ These are flexible guidance, not mandatory steps. Adapt to the conversation.
171
+
172
+ - **Start with understanding**: Grasp what the user wants to explore. If `$ARGUMENTS` is vague, ask clarifying questions — but don't over-interrogate. One or two questions is usually enough to get started.
173
+ - **Investigate with sub-agents**: Use sub-agents (Task, subagent_type: Explore) for codebase investigation. Apply the standard constraint block (above). Investigation informs the discussion but doesn't replace it.
174
+ - **Iterate naturally**: Some discussions need multiple investigation rounds; others converge quickly. Follow the conversation's natural rhythm.
175
+ - **Record decisions immediately**: When the user approves a design decision, persist it to the DB via `sd decision create`. The Bash tool permission prompt serves as a natural approval checkpoint. Include `--repo-owner` and `--repo-name` when working in a git repository, and `--tag topic:<topic-slug>` for grouping.
176
+ - **Capture memos as text during discussion**: When a notable idea or insight emerges, present it as text ("メモ:〇〇") without writing to the DB. Memos are batched and written during wrap-up.
177
+ - **Surface cross-cutting Open Questions**: When multiple decisions have accumulated, step back and consider questions that emerge from the interaction between decisions — patterns, tensions, or implications visible only in aggregate. This is a habit of periodic reflection, not a procedural step with a fixed trigger.
178
+
179
+ ## Wrap-up Procedure
180
+
181
+ Wrap-up can be initiated by the user ("まとめて", "終わり") or suggested by the skill at natural conversation boundaries ("他に議論したいことはありますか?なければ wrap-up に進められます"). The skill does not unilaterally enter wrap-up.
182
+
183
+ ### Steps
184
+
185
+ 1. **Memo batch write**: Present a list of memos captured as text during discussion. Let the user review — discard, keep, or adjust. Write accepted memos to DB:
186
+ ```sh
187
+ sd node create --kind memo --body "<memo content>" --tag "topic:<slug>"
188
+ ```
189
+
190
+ 2. **Conversation node creation**: Create a conversation node summarizing the session:
191
+ ```sh
192
+ sd node create --stdin <<'EOF'
193
+ {"kind":"conversation","body":"<session title>","properties":{"context":"...","key_points":[...],"open_questions":[...],"summary_en":"...","keywords_en":[...]},"tags":["topic:<slug>"]}
194
+ EOF
195
+ ```
196
+
197
+ 3. **Link decisions and memos to conversation**:
198
+ ```sh
199
+ sd link create <decision_id> <conversation_id> --type decided_during
200
+ sd link create <memo_id> <conversation_id> --type captured_during
201
+ ```
202
+
203
+ 4. **Optional memo promotion**: Ask "昇格したいメモはありますか?" If the user wants to promote memos to idea/todo:
204
+ ```sh
205
+ sd node update <memo_id> --kind idea --props-json '{"summary_en":"...","keywords_en":[...]}'
206
+ ```
207
+ Link promoted nodes: `sd link create <promoted_id> <conversation_id> --type derived_from`
208
+
209
+ 5. **Summarize**: Present the final state — conversation node + linked decisions + memos + promotions.
210
+
211
+ ## Skill Boundaries
212
+
213
+ - **Don't force a fixed sequence of steps.** The conversation flow should emerge from the topic, not from a template.
214
+ - **Don't make autonomous decisions about direction.** Always confirm with the user before narrowing the discussion.
215
+ - **Don't produce detailed implementation plans.** That's what `/soda-plan` is for.
216
+ - **Don't produce implementation artifacts — whether as file edits or as text output.** DB writes via `wat` CLI are discussion artifacts, not implementation artifacts — writing decisions and memos is expected. This boundary prohibits file-by-file change lists, detailed diffs, and step-by-step implementation instructions. Code snippets for illustrating design points are fine; framing them as actionable proposals is not. When the user is ready to implement, transition to `/soda-plan`.
@@ -0,0 +1,137 @@
1
+
2
+ Review current branch changes using codex-review (findings mode), classify issues by severity, and apply fixes with appropriate user decision gates.
3
+
4
+ Use English for internal reasoning (thinking). All user-facing output must be in Japanese.
5
+
6
+ ## Phase 1: Collect Changes
7
+
8
+ 1. Run `sd review detect-base-branch` and use the `baseBranch` and `mergeBase` from its JSON output. If the script fails, default to `main`. If the JSON contains an `error` field, present the error to the user and use AskUserQuestion: "ベースブランチを指定する" / "中止". If the user specifies a base branch, re-compute the diff using that base. If the user cancels, stop.
9
+ 2. Run `git diff <base>...HEAD` to collect the current branch's changes.
10
+ 3. If the diff is empty, inform the user and stop.
11
+ 4. Present a brief summary to the user:
12
+ > **変更概要**
13
+ > - 変更ファイル数: N
14
+ > - 追加行数: +X / 削除行数: -Y
15
+
16
+ ## Phase 2: Review via codex-review
17
+
18
+ Invoke codex-review in findings mode:
19
+
20
+ ```
21
+ Task(subagent_type: soda:codex-review)
22
+ ```
23
+
24
+ Prompt:
25
+
26
+ ```
27
+ ## Codex Review Request
28
+ - **Mode**: findings
29
+ - **Instruction**: "Review these code changes. For each issue found, output in the following structured format:
30
+
31
+ ISSUE
32
+ Severity: Critical | High | Medium | Low
33
+ Summary: <one-line description>
34
+ File: <file path>
35
+ Location: <line range or function name>
36
+ Fix Strategy: <description of the suggested fix>
37
+ Alternative: <alternative fix strategy, if applicable — omit if only one clear approach>
38
+ ---
39
+
40
+ Focus on correctness, security, performance, and maintainability. Do not report style-only issues."
41
+
42
+ ### Content
43
+ <git diff output>
44
+ ```
45
+
46
+ If the codex-review sub-agent returns Status: "Skipped", inform the user that review is unavailable and stop.
47
+
48
+ ## Phase 3: Classify Issues
49
+
50
+ Parse the codex-review output from the Issues section. For each issue, classify into one of three categories:
51
+
52
+ - **Auto-fix**: Severity is Critical or High, AND the issue has a single clear fix strategy (no Alternative field, or Alternative is trivially equivalent)
53
+ - **User-confirm**: Severity is Critical or High, AND one of:
54
+ - Multiple meaningfully different fix strategies exist (Alternative field present and distinct)
55
+ - The fix necessity itself is debatable (e.g., trade-off between correctness and performance)
56
+ - **Skip**: Severity is Medium or Low
57
+
58
+ **Fallback rule**: If the codex output cannot be parsed into the structured format above, treat ALL issues as User-confirm. Do NOT auto-fix unparseable findings.
59
+
60
+ ## Phase 4: Present Summary
61
+
62
+ Present the classification summary to the user:
63
+
64
+ > **レビュー結果**
65
+ > - 自動修正: N件 (Critical/High, 修正方針が明確)
66
+ > - 確認待ち: M件 (Critical/High, 複数の選択肢あり)
67
+ > - スキップ: K件 (Medium/Low, 報告のみ)
68
+ >
69
+ > **スキップ対象の指摘** (Medium/Low):
70
+ > - [issue summary] (file) — Severity
71
+ > - ...
72
+
73
+ Use AskUserQuestion with the following options:
74
+ - "すべて進める" — Apply auto-fixes, then proceed to user-confirm issues one by one
75
+ - "自動修正のみ先に適用" — Apply auto-fixes only, skip user-confirm issues
76
+ - "すべて個別に確認" — Treat all issues (including auto-fix) as user-confirm
77
+ - "中止" — Stop without making any changes
78
+
79
+ If the user selects "中止", stop immediately.
80
+
81
+ If the user selects "すべて進める", proceed to Phase 5, then Phase 6 for any remaining User-confirm issues.
82
+
83
+ If the user selects "自動修正のみ先に適用", proceed to Phase 5, then skip Phase 6 and go directly to Phase 7.
84
+
85
+ If the user selects "すべて個別に確認", reclassify all Auto-fix issues as User-confirm and proceed to Phase 6 (skip Phase 5).
86
+
87
+ ## Phase 5: Apply Auto-fixes
88
+
89
+ For each Auto-fix issue (in file order to minimize conflicts):
90
+
91
+ 1. Read the target file.
92
+ 2. Apply the fix using the Edit tool.
93
+ 3. Commit with a descriptive message: `fix(<scope>): <issue summary>`
94
+
95
+ If an edit fails (e.g., the target code has changed), skip the issue and add it to the User-confirm list with a note explaining the failure.
96
+
97
+ After all auto-fixes are applied, follow the routing selected in Phase 4 (Phase 6 for "すべて進める", or Phase 7 for "自動修正のみ先に適用").
98
+
99
+ ## Phase 6: User Decision Gates
100
+
101
+ For each User-confirm issue, present the issue details and use AskUserQuestion:
102
+
103
+ > **指摘内容**: [issue summary]
104
+ > **重要度**: [severity]
105
+ > **ファイル**: [file path] ([location])
106
+ > **詳細**: [full issue description from codex output]
107
+
108
+ Options:
109
+ - Each available fix strategy as a separate option (2-4 options max), with a brief description of the trade-off
110
+ - "修正しない(スキップ)" — Skip this issue
111
+
112
+ If the user selects a fix strategy:
113
+ 1. Read the target file.
114
+ 2. Apply the selected fix using the Edit tool.
115
+ 3. Commit: `fix(<scope>): <issue summary>`
116
+
117
+ If the user selects "修正しない(スキップ)", move to the next issue.
118
+
119
+ ## Phase 7: Summary Report
120
+
121
+ Present the final summary:
122
+
123
+ > **修正結果**
124
+ > - 自動修正: N件 適用済み
125
+ > - ユーザー確認修正: M件 (適用: X, スキップ: Y)
126
+ > - 未対応 (Medium/Low): K件
127
+
128
+ Use AskUserQuestion:
129
+ - "再レビューを実行" — Run codex-review (findings mode, fresh session) on the updated diff to verify fixes and check for new issues. If new issues are found, restart from Phase 3 with the new results.
130
+ - "完了" — End the skill execution.
131
+
132
+ ## Constraints
133
+
134
+ - This skill modifies code. Use Edit tool for precise changes, not Write tool for full file rewrites.
135
+ - Each fix must be committed individually for easy revert.
136
+ - Never auto-fix issues that cannot be parsed from the codex output (fallback rule).
137
+ - All user-facing text must be in Japanese.