feat(flow-next): Add MCP review backend option#65
feat(flow-next): Add MCP review backend option#65Ranudar wants to merge 6 commits intogmickel:mainfrom
Conversation
Add `mcp` as a new review backend for flow-next, enabling RepoPrompt integration via MCP server instead of `rp-cli` subprocess calls. Benefits: - No rp-cli dependency - works anywhere RepoPrompt MCP is connected - Cross-platform (Linux containers, Windows, macOS) - Direct integration without subprocess overhead - Better error handling via MCP tool responses Changes: - Add `mcp` to valid backends in flowctl.py - Add MCP backend rules to plan-review and impl-review SKILL.md - Add MCP Backend Workflow sections to workflow.md files - Add MCP tool mapping documentation - Update ralph.md with MCP backend documentation and troubleshooting MCP Tool Mapping: - rp setup-review → manage_workspaces (list_tabs, select_tab) - rp select-add → manage_selection (op: "add") - rp chat-send → chat_send - rp prompt-get → prompt (op: "get") Co-Authored-By: Claude <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
I'm not sure rp-cli is not necessary any more. I don't think it is, but i've removed this part from ralph.md
There was a problem hiding this comment.
PR Review: MCP Review Backend
Thanks for the contribution! The concept is solid - MCP backend provides an alternative path to RepoPrompt that doesn't require rp-cli installation (useful for MCP proxying from sandboxes/containers). Found some issues that need addressing before merge.
🔴 Critical: Ralph Mode Broken
plugins/flow-next/skills/flow-next-ralph-init/templates/ralph.sh lines 919, 931
Receipt verification only checks rp and codex:
if [[ "$status" == "plan" && ( "$PLAN_REVIEW" == "rp" || "$PLAN_REVIEW" == "codex" ) ]]; thenImpact: MCP reviews skip receipt verification entirely in Ralph mode - tasks marked complete without proof. Silent failure.
Fix: Add || "$PLAN_REVIEW" == "mcp" to both conditions (lines 919 and 931).
🔴 Critical: UI Functions Missing MCP
ralph.sh lines 241-264 - ui_plan_review() and ui_impl_review() don't handle mcp:
ui_plan_review() {
if [[ "$mode" == "rp" ]]; then
...
elif [[ "$mode" == "codex" ]]; then
...
fi
# mcp falls through silently
}Fix: Add elif [[ "$mode" == "mcp" ]] branch with appropriate UI message.
🟡 Medium: No Guard Hook Support
ralph-guard.py enforces workflow rules for rp/codex (blocks --json, validates receipts, etc). MCP calls go directly to MCP tools, bypassing all guards.
Options:
- Add
flowctl mcp *wrappers (consistent with rp/codex pattern) - significant work - Document that MCP backend is manual-mode only (not supported in Ralph) - quick fix
- Accept the gap for now and track as follow-up issue
I'd suggest option 2 for this PR, option 1 as follow-up.
🟡 Medium: Workflow Doc Inconsistency
flow-next-plan-review/workflow.md MCP tool mapping includes:
| `rp builder` | `mcp__RepoPrompt__context_builder` |
But flow-next-impl-review/workflow.md doesn't have this entry. Should be consistent - either both have it or neither.
🟢 Minor: No Tests
Consider adding a basic smoke test or note in the PR that testing was manual-only.
Summary
The core documentation additions are good. Main gaps:
- ralph.sh needs MCP handling (receipt checks + UI) - this is the blocker
- Document Ralph limitation or add guard support
- Fix workflow.md inconsistency
Happy to help if you have questions on any of these!
- ralph-guard.py: Add MCP tool handlers (pre/post), state tracking, receipt validation, and tool filtering for mcp__RepoPrompt__* tools - prompt_plan.md: Add MCP mode rules and dynamic receipt mode - prompt_work.md: Add MCP explanation and dynamic receipt mode - ralph.sh: Add MCP display name in ui_config() - config.env: Update comments to include mcp option - workflow.md: Remove outdated "manual mode only" warnings MCP backend now works in Ralph autonomous mode with full hook enforcement. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The ralph-guard.py already had code to track MCP review tools, but hooks.json only registered the hook for Bash tool. This caused MCP reviews to not be tracked, blocking receipt writes after SHIP verdicts. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- ralph-guard.py: Only set chat_send_succeeded when verdict tag found (previously set for any non-error response, allowing premature receipts) - impl-review/workflow.md: Combine two MCP calls into single call with verdict requirement included in the review prompt - plan-review/workflow.md: Same single-call pattern with verdict requirement Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Defense-in-depth: NEEDS_WORK and MAJOR_RETHINK verdicts now block receipt writes until code is fixed and re-reviewed to get SHIP. Updated both MCP and Codex handlers for consistency. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
I currently run flow-next in a linux sandbox and rp-cli over ssh which works well enough, but I don't keep track of rp-cli failures where the model has to retry due to json issues and wastes time/tokens (have seen it in the logs often), would mcp help with that? I guess it helps in the sense of keeping the rp prompts up to date but I though flow-next used a controlled subset of rp-cli commands to avoid errors? @gmickel whats your veredict would you use this over rp-cli even for controlled flows? |
Summary
Add
mcpas a new review backend for flow-next, enabling RepoPrompt integration via MCP server instead ofrp-clisubprocess calls.Benefits:
Changes
mcpto valid backends inflowctl.pySKILL.mdworkflow.mdfilesralph.mdwith MCP backend documentation and troubleshootingMCP Tool Mapping
rp setup-reviewmcp__RepoPrompt__manage_workspaces(list_tabs, select_tab)rp select-addmcp__RepoPrompt__manage_selection(op: "add")rp chat-sendmcp__RepoPrompt__chat_sendrp prompt-getmcp__RepoPrompt__prompt(op: "get")Testing
Tested MCP backend workflow manually - all operations work:
🤖 Generated with Claude Code