Skip to content

Commit 2aeb4f0

Browse files
committed
fix: use flowctl opencode commands instead of Task subagent
Skills were using Task tool with subagent_type opencode-reviewer but OpenCode doesn't recognize agents from opencode.json as Task subagent types. Updated to use flowctl opencode plan-review and impl-review commands which internally call opencode run --agent.
1 parent 74edb33 commit 2aeb4f0

5 files changed

Lines changed: 38 additions & 68 deletions

File tree

.opencode/skill/flow-next-opencode-impl-review/SKILL.md

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,9 @@ fi
9797
5. **Re-reviews MUST stay in SAME chat** - omit `--new-chat` after first review
9898

9999
**For opencode backend:**
100-
1. Use the **task tool** with subagent_type `opencode-reviewer`
101-
2. Reviewer gathers context via tools (git diff/log, read files)
102-
3. Parse verdict from reviewer output
103-
4. Extract `session_id` from `<task_metadata>` and reuse it for re-reviews
100+
1. Use `$FLOWCTL opencode impl-review` command
101+
2. Pass `--base` for diff scope and `--receipt` for session continuity
102+
3. Parse verdict from command output
104103

105104
**For all backends:**
106105
- If `REVIEW_RECEIPT_PATH` set: write receipt after review (any verdict)
@@ -135,30 +134,17 @@ Run backend detection from SKILL.md above. Then branch:
135134

136135
### OpenCode Backend
137136

138-
Use the task tool with subagent_type `opencode-reviewer`.
139-
140-
Prompt must require:
141-
- `git log main..HEAD --oneline`
142-
- `git diff main..HEAD --stat`
143-
- `git diff main..HEAD`
144-
- Read any changed files needed for correctness
145-
- No questions, no code changes, no TodoWrite
146-
- End with `<verdict>SHIP</verdict>` or `<verdict>NEEDS_WORK</verdict>` or `<verdict>MAJOR_RETHINK</verdict>`
147-
148-
Parse verdict from the subagent response.
149-
Extract `session_id` from `<task_metadata>` and reuse for re-review.
150-
151-
On NEEDS_WORK: fix code, commit, re-run review (same backend).
152-
153-
Write receipt if `REVIEW_RECEIPT_PATH` set:
154137
```bash
155-
mkdir -p "$(dirname "$RECEIPT_PATH")"
156-
ts="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
157-
cat > "$RECEIPT_PATH" <<EOF
158-
{"type":"impl_review","id":"$TASK_ID","mode":"opencode","verdict":"<VERDICT>","timestamp":"$ts"}
159-
EOF
138+
TASK_ID="${1:-}"
139+
BASE_COMMIT="${BASE_COMMIT:-main}"
140+
RECEIPT_PATH="${REVIEW_RECEIPT_PATH:-/tmp/impl-review-receipt.json}"
141+
142+
$FLOWCTL opencode impl-review "$TASK_ID" --base "$BASE_COMMIT" --receipt "$RECEIPT_PATH"
143+
# Output includes VERDICT=SHIP|NEEDS_WORK|MAJOR_RETHINK
160144
```
161145

146+
On NEEDS_WORK: fix code, commit, re-run (receipt enables session continuity).
147+
162148
### RepoPrompt Backend
163149

164150
```bash
@@ -188,7 +174,7 @@ If verdict is NEEDS_WORK, loop internally until SHIP:
188174
2. **Fix code** and run tests/lints
189175
3. **Commit fixes** (mandatory before re-review)
190176
4. **Re-review**:
191-
- **OpenCode**: re-run reviewer subagent with updated diff
177+
- **OpenCode**: `$FLOWCTL opencode impl-review "$TASK_ID" --base "$BASE_COMMIT" --receipt "$RECEIPT_PATH"`
192178
- **RP**: `$FLOWCTL rp chat-send --window "$W" --tab "$T" --message-file /tmp/re-review.md` (NO `--new-chat`)
193179
5. **Repeat** until `<verdict>SHIP</verdict>`
194180

.opencode/skill/flow-next-opencode-impl-review/workflow.md

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,16 @@ Include:
7171
- Review criteria (correctness, security, performance, tests, risks)
7272
- Required verdict tag
7373

74-
### Step 3: Execute review (subagent)
74+
### Step 3: Execute review via flowctl
7575

76-
Use the **task** tool with subagent_type `opencode-reviewer`. The reviewer must gather context itself via tools, including Flow task/epic specs.
76+
Use the `flowctl opencode impl-review` command:
7777

78-
**Task tool call** (example):
79-
```json
80-
{
81-
"description": "Impl review",
82-
"prompt": "You are the OpenCode reviewer. Review current branch vs main. Rules: no questions, no code changes, no TodoWrite. REQUIRED: set FLOWCTL to `.opencode/bin/flowctl`, then run `$FLOWCTL show <TASK_ID> --json` and `$FLOWCTL cat <TASK_ID>`. Then get epic id from task JSON and run `$FLOWCTL show <EPIC_ID> --json` and `$FLOWCTL cat <EPIC_ID>`. REQUIRED: run `git log main..HEAD --oneline` (fallback master), `git diff main..HEAD --stat`, `git diff main..HEAD`. Read any changed files needed for correctness. Then output issues grouped by severity and end with exactly one verdict tag: <verdict>SHIP</verdict> or <verdict>NEEDS_WORK</verdict> or <verdict>MAJOR_RETHINK</verdict>.",
83-
"subagent_type": "opencode-reviewer"
84-
}
78+
```bash
79+
$FLOWCTL opencode impl-review "$TASK_ID" --base "$BASE_BRANCH" --receipt "$RECEIPT_PATH"
80+
# Output includes VERDICT=SHIP|NEEDS_WORK|MAJOR_RETHINK
8581
```
8682

87-
**After the task completes**:
88-
- Parse `VERDICT` from the subagent output.
89-
- Extract `session_id` from the `<task_metadata>` block (used for re-reviews).
83+
Parse `VERDICT` from the command output.
9084

9185
If `VERDICT` is empty, output `<promise>RETRY</promise>` and stop.
9286

@@ -107,7 +101,7 @@ EOF
107101
If `VERDICT=NEEDS_WORK`:
108102
1. Parse issues from output
109103
2. Fix code, commit, run tests
110-
3. Re-run Step 3 **with the same task session_id** (pass `session_id` to the task tool)
104+
3. Re-run: `$FLOWCTL opencode impl-review "$TASK_ID" --base "$BASE_BRANCH" --receipt "$RECEIPT_PATH"`
111105
4. Repeat until SHIP
112106

113107
---

.opencode/skill/flow-next-opencode-plan-review/SKILL.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,9 @@ fi
9797
5. **Re-reviews MUST stay in SAME chat** - omit `--new-chat` after first review
9898

9999
**For opencode backend:**
100-
1. Use the **task tool** with subagent_type `opencode-reviewer`
101-
2. Reviewer gathers context via tools (`flowctl show/cat`)
102-
3. Parse verdict from reviewer output
103-
4. Extract `session_id` from `<task_metadata>` and reuse it for re-reviews
100+
1. Use `$FLOWCTL opencode plan-review` command
101+
2. Pass `--receipt` for session continuity on re-reviews
102+
3. Parse verdict from command output
104103

105104
**For all backends:**
106105
- If `REVIEW_RECEIPT_PATH` set: write receipt after review (any verdict)
@@ -133,18 +132,15 @@ Run backend detection from SKILL.md above. Then branch:
133132

134133
### OpenCode Backend
135134

136-
Use the task tool with subagent_type `opencode-reviewer`.
137-
138-
Prompt must require:
139-
- `flowctl show <EPIC_ID> --json`
140-
- `flowctl cat <EPIC_ID>`
141-
- No questions, no code changes, no TodoWrite
142-
- End with `<verdict>SHIP</verdict>` or `<verdict>NEEDS_WORK</verdict>` or `<verdict>MAJOR_RETHINK</verdict>`
135+
```bash
136+
EPIC_ID="${1:-}"
137+
RECEIPT_PATH="${REVIEW_RECEIPT_PATH:-/tmp/plan-review-receipt.json}"
143138

144-
Parse verdict from the subagent response.
145-
Extract `session_id` from `<task_metadata>` and reuse for re-review.
139+
$FLOWCTL opencode plan-review "$EPIC_ID" --receipt "$RECEIPT_PATH"
140+
# Output includes VERDICT=SHIP|NEEDS_WORK|MAJOR_RETHINK
141+
```
146142

147-
On NEEDS_WORK: fix plan via `$FLOWCTL epic set-plan`, then re-run review (same backend).
143+
On NEEDS_WORK: fix plan via `$FLOWCTL epic set-plan`, then re-run (receipt enables session continuity).
148144

149145
### RepoPrompt Backend
150146

.opencode/skill/flow-next-opencode-plan-review/workflow.md

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,16 @@ Include:
6565
- Review criteria (completeness, feasibility, clarity, architecture, risks, scope, testability)
6666
- Required verdict tag
6767

68-
### Step 3: Execute review (subagent)
68+
### Step 3: Execute review via flowctl
6969

70-
Use the **task** tool with subagent_type `opencode-reviewer`. The reviewer must gather context itself via tools, including Flow plan/spec.
70+
Use the `flowctl opencode plan-review` command:
7171

72-
**Task tool call** (example):
73-
```json
74-
{
75-
"description": "Plan review",
76-
"prompt": "You are the OpenCode reviewer. Review the plan for EPIC_ID. Rules: no questions, no code changes, no TodoWrite. REQUIRED: set FLOWCTL to `.opencode/bin/flowctl`, then run `$FLOWCTL show <EPIC_ID> --json` and `$FLOWCTL cat <EPIC_ID>`. Review for completeness, feasibility, clarity, architecture, risks (incl security), scope, and testability. End with exactly one verdict tag: <verdict>SHIP</verdict> or <verdict>NEEDS_WORK</verdict> or <verdict>MAJOR_RETHINK</verdict>.",
77-
"subagent_type": "opencode-reviewer"
78-
}
72+
```bash
73+
$FLOWCTL opencode plan-review "$EPIC_ID" --receipt "$RECEIPT_PATH"
74+
# Output includes VERDICT=SHIP|NEEDS_WORK|MAJOR_RETHINK
7975
```
8076

81-
**After the task completes**:
82-
- Parse `VERDICT` from the subagent output.
83-
- Extract `session_id` from the `<task_metadata>` block (used for re-reviews).
77+
Parse `VERDICT` from the command output.
8478

8579
If `VERDICT` is empty, output `<promise>RETRY</promise>` and stop.
8680

@@ -110,7 +104,7 @@ EOF
110104
If `VERDICT=NEEDS_WORK`:
111105
1. Parse issues from output
112106
2. Fix plan via `$FLOWCTL epic set-plan`
113-
3. Re-run Step 3 **with the same task session_id** (pass `session_id` to the task tool)
107+
3. Re-run: `$FLOWCTL opencode plan-review "$EPIC_ID" --receipt "$RECEIPT_PATH"`
114108
4. Repeat until SHIP
115109

116110
---

.opencode/skill/flow-next-opencode-ralph-init/templates/prompt_plan.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Steps:
1717

1818
Ralph mode rules (must follow):
1919
- If PLAN_REVIEW=rp: use `flowctl rp` wrappers (setup-review, select-add, prompt-get, chat-send).
20-
- If PLAN_REVIEW=opencode: use the task tool with subagent_type `opencode-reviewer`.
20+
- If PLAN_REVIEW=opencode: use `scripts/ralph/flowctl opencode plan-review` command.
2121
- Write receipt via bash heredoc (no Write tool) if REVIEW_RECEIPT_PATH is set.
2222
- Do NOT run /flow-next:* as shell commands.
2323
- If any rule is violated, output `<promise>RETRY</promise>` and stop.
@@ -26,7 +26,7 @@ Ralph mode rules (must follow):
2626
- Call the skill tool: flow-next-opencode-plan-review.
2727
- Follow the workflow in the skill using the exact arguments above.
2828
- Do NOT stop after loading the skill.
29-
- For opencode: run reviewer via task tool and require `<verdict>` tag.
29+
- For opencode: run `flowctl opencode plan-review` and require `<verdict>` tag.
3030
- For rp: use flowctl rp wrappers (no --json, no --new-chat on re-review).
3131
- For export: follow export flow in skill.
3232
- If PLAN_REVIEW=none:

0 commit comments

Comments
 (0)