Skip to content

About

Portable JevRouter setup for cost-aware Codex subagent model selection, with English and Russian instructions

Resources

Stars

13 stars

Watchers

0 watching

Forks

Repository files navigation

Codex Jev Router

Русский · 简体中文 · 繁體中文

Recommended use: opt-in deterministic evidence selection for noisy-log investigations. A local MCP tool searches a workspace and gives Codex a few exact, cited excerpts instead of a large raw log result. The continuing Codex session keeps its configured model and reasoning effort. The default selector is deterministic and needs no Jev account, API key, or local model. Laya remains optional for experiments; it did not improve cost over deterministic selection in our holdout.

The former subagent-model router remains in the source tree for reproducibility, but it is not recommended or installed. Its four-arm benchmark found that Jev-selected children were 27.2% cheaper than fixed Sol-high children, yet 69.7% more expensive than one Sol-xhigh agent. These historical routing results are separate from the new evidence benchmark. Economics audit.

What Codex gets

  • search_workspace_evidence: search code or logs within the configured workspace and return short, exact excerpts with relative paths and line numbers. Use it for broad investigations likely to produce large search output. An ordinary exact lookup can use Codex's normal tools.
  • read_selected_evidence: expand a returned reference to a wider bounded excerpt when the first result is insufficient.
  • Local deterministic selection by default. With --selector laya, a locally running Laya service may reorder sufficiently large candidate sets; small sets and failed decisions use the deterministic fallback. The result states which selector was used.

The tool limits search and response size and excludes hidden files and directories, known sensitive paths, and paths outside the workspace. It does not promise to detect every secret in ordinary visible source text; the selected excerpts still enter Codex context. It neither changes past conversation history nor forces a tool choice. Other local decision adapters remain experimental legacy interfaces and are not selectors for this MCP tool.

Install for one workspace

Requires Node.js 20+, rg (ripgrep), and a Codex installation that supports local MCP servers. From this repository:

npm ci
node scripts/install.mjs --root /absolute/workspace --dry-run
node scripts/install.mjs --root /absolute/workspace

The installer adds a codex-local-evidence-* server to global ~/.codex/config.toml (or CODEX_HOME/config.toml). Its file access is limited to the chosen workspace root, but the server may appear in other workspaces. Remove its marked MCP section from that config to disable it. The installer backs up changed files under ~/.codex/backups/codex-jev-router/. If AGENTS.md still contains this project's old <!-- codex-jev-router:start --> / <!-- codex-jev-router:end --> routing block, the installer removes only that block. An incomplete block stops installation for manual inspection. It does not alter Codex's model, reasoning effort, role files, or skill hooks. Pass --codex-home /absolute/path for a nonstandard Codex directory. Review the dry run and restart Codex after installation.

Ask Codex to use search_workspace_evidence on a broad code or log investigation, then read_selected_evidence if it needs more surrounding lines. Confirm the search result starts with Selection: deterministic; tool discovery alone does not prove a token or cost saving. After migration, Jev remains disabled unless the user explicitly invokes a legacy routing command.

Optional local Laya

Start Laya's Jev-compatible local server before installing with:

node scripts/install.mjs --root /absolute/workspace --selector laya

Laya is consulted only when there are enough candidates. Its service must be reachable from the environment that launches Codex; by default the adapter uses a loopback address. The MCP result explicitly reports deterministic fallback if Laya is unavailable or gives an unusable answer. In the holdout, 14 searches used genuine local Laya selection, yet Laya cost 8.8% more than deterministic selection on eligible tasks. It is not the default. Hosted Jev is never selected by this installer.

Measured outcome

The audited holdout report contains 144 complete Codex runs across stock, deterministic, and local Laya arms, plus replay of 36 edit patches. Every arm used one gpt-6-sol root at xhigh, with no subagents. The estimated API cost includes input, cached input, cache writes, output, and retries. It excludes local compute and is not a Codex subscription bill. Four noisy incident logs were deterministic overlays on two pinned public repositories, not production logs.

Tasks Stock → deterministic Strict passes Paired 95% cost-saving interval Interpretation
All 16 tasks, 3 repeats $2.060703 → $1.653006 (19.8% less) 45/48 → 48/48 4.4% to 33.3% Aggregate result; includes tasks where the tool was unused.
Eligible log and multi-file tasks $1.097944 → $0.769878 (29.9% less) 21/24 → 24/24 5.7% to 46.0% Prespecified eligible group.
Noisy-log tasks $0.771064 → $0.450921 (41.5% less) 9/12 → 12/12 17.4% to 56.8% Supported opt-in use case.

Codex never called the MCP search on the multi-file tasks, so the 2.4% difference there does not demonstrate a tool benefit. It also made no MCP calls on exact lookups or edits; differences in those categories are run variation. Two earlier diagnostic attempts were excluded: one exposed a log grading rule, the other a read-answer format rule. The exposed read tasks were replaced before the final holdout. See the pilot and format diagnostic. Hidden-path exclusion was added after the measured runs; those log fixtures were visible files, but the percentages describe the measured revision. The result supports this bounded use case, not a general Codex savings claim. Historical routing measurements remain in the audit.

The design draws on jev-codex-token-saver for selecting evidence before it enters context. jev-gateway and jev-routing report mixed results for tool advice and context editing; jev-router and jev-harness-router mainly address model or effort selection at another boundary. These are their authors' mechanisms and results, not measurements of this tool. See the research notes.

Legacy interfaces

The repository still contains src/route.mjs, batch-routing commands, alternative decider bridges, and a skill-suggestion hook for historical experiments. The default installer does not enable any of them. They have not demonstrated an end-to-end saving against one continuing Sol session; the skill hook has not demonstrated savings in Codex. Do not treat the older worker-only estimates as complete task cost. See alternative backends for experimental compatibility details.

About

Portable JevRouter setup for cost-aware Codex subagent model selection, with English and Russian instructions

Resources

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages