Remove plan mode, skill toolcall path, and inline netx tools.

Wave C subtraction: keep skills as prompt-only, route netx via MCP with a shared netx_http client for xlsx/context inject, and delete plan_agent_v2 from the gateway.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-08-11 01:17:39 +08:00
parent 628a9dffd2
commit efa72df362
40 changed files with 169 additions and 3033 deletions

View file

@ -4,7 +4,7 @@ Wire **oclaw** (or any MCP host) to the standard **netx HTTP MCP** in `D:/projec
netx 侧通用安装/更新说明:`D:/project/chatgpt/netx/docs/MCP.md`。
Default path: **stdio MCP → netx REST API** (`NETX_API_URL`). Legacy inline HTTP tools in oclaw are opt-in via `OCLAW_NETX_BUILTIN_TOOLS=1`.
Default path: **stdio MCP → netx REST API** (`NETX_API_URL`). oclaw also uses the same REST base for ops context inject and `ume_alarm_xlsx_report` via shared `netx_http`.
## 1) Start netx API
@ -115,14 +115,16 @@ Then run **Health** → **Sync Tools**.
In Admin **MCP specialist binding**, include server **`netx`** for the ops workspace/specialist.
## 4) Dual-track: builtin vs MCP
## 4) Shared REST helpers in oclaw
| Setting | Effect |
|---------|--------|
| `OCLAW_NETX_BUILTIN_TOOLS=0` (default) | Only MCP tools (`mcp__netx__*`); no duplicate inline `netx_*` in catalog |
| `OCLAW_NETX_BUILTIN_TOOLS=1` | Registers legacy inline HTTP tools **and** MCP if installed — avoid binding both unless testing migration |
oclaw keeps a small HTTP client (`runtime/tools/experts/network_ops/netx_http.py`) for:
Runtime anchor inject (`OCLAW_OPS_NETX_CONTEXT_INJECT=1`) still works without builtin tools; it only needs netx API reachable at `NETX_API_URL` / `OCLAW_NETX_BASE_URL`.
- ops system-context anchor inject (`OCLAW_OPS_NETX_CONTEXT_INJECT`)
- always-on `ume_alarm_xlsx_report` (Excel export shortcut)
Interactive alarm/NE tools are **MCP only** (`mcp__netx__*`). Inline `netx_*` expert tools were removed.
Runtime anchor inject still needs netx API reachable at `NETX_API_URL` / `OCLAW_NETX_BASE_URL`.
## 5) Cursor / Claude Desktop

View file

@ -1,103 +0,0 @@
# Plan Agent V2 (Shadow) Design
## Goal
- Build a complete plan/agent pipeline in shadow mode first.
- Keep legacy runtime path unchanged until final one-shot cutover.
- Support instant rollback via a single feature switch.
## Scope
- Target only `interaction_mode=expert`.
- `interaction_mode=comprehensive` remains on legacy path.
- Current implementation is dry-run/shadow ready, not wired into gateway production flow.
## Runtime Components
- Package root: `runtime/plan_agent_v2/`
- `models.py`: state model (`PlanAgentStateV2`)
- `state_store.py`: session state persistence
- `manager.py`: plan lifecycle (`enter/confirm/exit`)
- `tool_policy.py`: plan-mode tool filtering policy
- `prompt_injector.py`: plan-mode and approved-plan prompt injection
- `tool_specs.py`: shadow plan tools (`enter_plan_mode_v2`, `exit_plan_mode_v2`)
- `switch.py`: feature switch and routing predicate
- `adapter.py`: expert-mode plan decision logic
- `gateway_adapter.py`: gateway-side shadow adapter
- `trace.py`: plan events trace helper
- `compat.py`: legacy result-shape compatibility helpers
## Legacy Compatibility
- Flat module paths are still available and now forward to package modules:
- `runtime/plan_agent_v2_*.py` -> `runtime/plan_agent_v2/*`
- This prevents existing imports from breaking during migration.
## Session State Contract
- Stored under key:
- `AIA_PLAN_AGENT_V2_STATE:<session_id>`
- Serialized JSON fields:
- `mode`: `normal|plan`
- `owner_specialist`
- `plan_id`
- `plan_path`
- `plan_content`
- `plan_confirmed`
- `entered_at_ms`
- `updated_at_ms`
## Feature Switches
- `AIA_EXPERT_PLAN_AGENT_V2_ENABLED`
- default: off
- effect: allow expert path to route to shadow v2 when wired
- `AIA_EXPERT_PLAN_FILE_DIR`
- optional plan file root override
- `AIA_EXPERT_PLAN_CONFIRM_STRATEGY`
- `strict` (default): confirmation in `plan` mode is blocked until user switches to `agent`
- `auto`: confirmation in `plan` mode auto-switches to execution
- `off`: disable confirmation-mode gate (same confirm behavior as `auto`)
## Admin API Mode Fields
- `GET /admin/api/chat/sessions/{session_id}/mode`
- now returns `confirm_strategy` together with `interaction_mode/specialist/memory_mode/execution_mode`.
- `POST /admin/api/chat/sessions/{session_id}/mode`
- accepts optional `confirm_strategy` (`strict|auto|off`)
- persists per-user and per-session mode settings
- mirrors to runtime key `AIA_EXPERT_PLAN_CONFIRM_STRATEGY` for immediate effect in expert v2 turns
## Routing Contract (Shadow)
- Predicate:
- `should_route_to_v2(store, interaction_mode, force_flag=False)`
- Rules:
- non-expert mode: always false
- expert + `force_flag=True`: true
- expert + feature on: true
- otherwise: false
## Adapter Outputs
- `evaluate_for_expert_mode(...)` returns:
- `action`: `enter_plan|stay_plan|run_agent`
- `reply_text`
- `plan_state`
- `system_prompt_override` (set on `run_agent`)
## Trace Events
- Emitted by `emit_plan_agent_v2_trace(...)`:
- `plan_mode_entered`
- `plan_mode_active`
- `plan_mode_confirmed`
## Tests
- Shadow core tests:
- `tests/test_plan_agent_v2_shadow.py`
- Gateway dry-run comparison tests:
- `tests/test_plan_agent_v2_gateway_dryrun.py`
## Cutover Plan (Later, Not Yet Applied)
- Add one gateway branch:
- if `should_route_to_v2(...)` then call `evaluate_gateway_expert_turn_shadow(...)`
- else keep legacy path
- Keep cutover in one commit for easy rollback.
## Rollback
- Runtime rollback:
- set `AIA_EXPERT_PLAN_AGENT_V2_ENABLED=false`
- Code rollback:
- revert only gateway branch commit; shadow modules can remain dormant.