# `SuperPi.Plugins.JevRouter`
[🔗](https://github.com/oleksandr/super-pi-beam/blob/v0.1.0/lib/super_pi/plugins/jev_router.ex#L1)

Jev Router Plugin (migrated from Pi ecosystem `jev-router.ts`).

Dynamic model cascading and phase-based routing:
- Planning Phase: Routes to a high-reasoning frontier model (`planning_model`, e.g. `gemini-3.1-pro-preview`)
  while the agent is exploring, inspecting, and formulating architectural plans.
- Implementation Phase: Once the first `write` or `edit` tool is executed, automatically cascades
  the session to a fast, cost-effective model (`implementation_model`, e.g. `gemini-3-flash-preview`).

Reduces end-to-end token expenditure by 60–80% without sacrificing planning depth.

### Configuration Options (`ctx[:config]` or harness tuple):
- `:planning_model` - Model identifier for planning phase.
- `:implementation_model` - Model identifier for implementation phase.
- `:edit_tools` - List of tool names that trigger transition to implementation phase (default: `["write", "edit"]`).
- Environment variables: `JEV_PLANNING_MODEL`, `JEV_IMPLEMENTATION_MODEL`.

# `description`

# `determine_phase`

Determines the current work phase (:planning or :implementation) by inspecting
whether any edit tools have been called in previous turns.

# `id`

# `name`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
