oclaw/docs/plan_agent_v2_gateway_cutover_patch.md
oliver 37522f492a feat: plan agent v2, global chat mode, and user-mode v2 flag sync
- Add runtime/plan_agent_v2 package and shims; gateway/direct_loop/WS wiring

- Admin chat: interaction mode and specialist only in user menu; session API stores memory_mode and execution_mode only

- POST /admin/api/chat/user-mode mirrors plan_agent_version to AIA_EXPERT_PLAN_AGENT_V2_ENABLED (v2 to 1, v1 to 0)

- Composer cleanup (hidden mode select, no reasoning toggle in meta bar); tests and _local/system.env.example

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-02 18:41:45 +08:00

36 lines
1.5 KiB
Markdown

# Plan Agent V2 Gateway Cutover Draft
## Purpose
- Provide a minimal, reviewable gateway cutover sketch without changing production routing yet.
- Keep existing `runtime/gateway.py` behavior unchanged until explicit cutover approval.
## Draft Helper
- New module:
- `runtime/plan_agent_v2_gateway_cutover.py`
- Entrypoint:
- `maybe_handle_expert_turn_v2_draft(...)`
## Draft Behavior
- If v2 shadow is not selected:
- returns `handled=False`, gateway should continue legacy flow.
- If decision is `enter_plan` or `stay_plan`:
- returns `handled=True` with an `OclawGatewayResult` built from v2 shadow compatibility mapper.
- If decision is `run_agent`:
- returns `handled=False` and provides `system_prompt_override`.
- gateway would continue legacy execution path but with injected approved-plan context.
## Why This Is Safe
- No import or call-site changes in `runtime/gateway.py` yet.
- Feature remains effectively dormant unless future cutover patch wires this helper.
- Existing tests continue to validate legacy and shadow independently.
## Future Minimal Cutover (single commit)
- In `OclawGateway.handle_turn(...)` expert path, add one early branch:
1) call `maybe_handle_expert_turn_v2_draft(...)`
2) if `handled=True`, return result immediately
3) else continue existing flow; if `system_prompt_override` exists, use it as specialist system prompt
## Rollback
- Revert only the gateway wiring commit.
- Keep shadow modules and tests as dormant assets.