Jev Router for Cursor
Cursor executes. LLMs write and build. Jev decides how much intelligence the task deserves.
Honest promise: pick the cheapest available route likely to complete successfully under policy — not a mathematically optimal model.
TypeSafe Jev is a decision layer only (Choice / Score / Noul). It does not browse, write prose, edit files, or operate accounts. Env: TYPESAFE_API_KEY.
In the Cursor Agents window for this project, paste:
Find today's most popular public posts about TypeSafe Jev on X/Twitter (by views if available). Rank the top 5 and say why each is popular. Do not log in or post anything.
Expected: Jev routes first (often BALANCED), then work uses web/research tools. In chat this is soft routing; for hard model switch use SDK --run.
| Mode | What changes | What does not |
|---|---|---|
| Cursor Chat + MCP | Parent calls jev_route, may delegate to jev-cost / jev-balanced / jev-intelligence |
Parent chat model is not hot-swapped |
SDK --run |
Jev decides tier, then Agent.create uses the resolved model from your catalog |
Needs CURSOR_API_KEY |
Approval gates (production_deploy, financial_transaction, …) stop SDK runs unless you pass --approve.
| Mode | Enforcement | How routing works |
|---|---|---|
| Chat (soft) | Rule + MCP + subagents | Parent calls jev_route, then delegates to jev-cost / jev-balanced / jev-intelligence. Does not hot-swap the parent model. |
| SDK (hard) | Code path | route → validate → discover models → Agent.create/send with selected model / auto-smart optimize_for. Supports dry-run and escalation. |
confidence < 0.70→ BALANCED- Security-sensitive → at least INTELLIGENCE
- Financial / production deploy → INTELLIGENCE + human approval flag
- Send/delete email, publish → approval required
- Read-only research OK; simple reversible edit may be COST
- COST fail → BALANCED → INTELLIGENCE → stop
- Max 2 escalations; no infinite retry; no same-tier retry unless error says retry can succeed
- Jev unavailable → BALANCED +
degradedRouting: true
This repo is enough to run end-to-end if you bring keys and follow the right mode.
- Node.js 20+ (22.13+ recommended; 22+ for
--use-system-caon Windows TLS issues) TYPESAFE_API_KEYin local.env(never commit)npm install && npm test && npm run demo
CURSOR_API_KEYin.envnpm install @cursor/sdk(optionalDependency / peer)- Run:
npx tsx sdk-runner/cli.ts --run "your task"
# Windows TLS/antivirus MITM:
# $env:NODE_OPTIONS="--use-system-ca"- Symlink/copy this folder into
~/.cursor/plugins/local/Jev-chooses-a-LLM(seescripts/setup.sh) - Enable MCP
jev-router - Honest limit: chat parent model is not hot-swapped. Jev decides the tier; the parent (e.g. Grok) may still execute unless you use SDK
--run.
- Your personal API keys
- Guaranteed Cursor Router
auto-smart(account-dependent; we fall back to catalog models) - Automatic X login / posting
- Dollar cost when the plan does not expose billed cents
git clone https://github.com/Bodila51/Jev-chooses-a-LLM.git
cd jev-router-for-cursor
cp .env.example .env
# put TYPESAFE_API_KEY (and CURSOR_API_KEY for SDK --run) in .env — never commit it
npm install
npm test
npm run democd jev-router-for-cursor
cp .env.example .env # set TYPESAFE_API_KEY; CURSOR_API_KEY for live SDK
npm install
npm test
npm run demo./scripts/setup.sh
# or: ln -s "$(pwd)" ~/.cursor/plugins/local/jev-router-for-cursorEnable the plugin in Cursor. Set variable TYPESAFE_API_KEY (Plugins → Configure) or export it for the MCP process. Restart Cursor if needed.
npm run mcp
# or: npx tsx mcp/server.tsTools: jev_route, jev_dry_run, jev_status.
mcp.json wires the server for the plugin via ${CURSOR_PLUGIN_ROOT}.
| Command | Effect |
|---|---|
/jev-route |
Route only |
/jev-run |
Route then delegate to subagent |
/jev-dry-run |
Dry-run routing |
/jev-bypass |
Skip Jev this turn |
/jev-status |
Config + hard rules |
# Dry-run (no CURSOR_API_KEY required for routing path)
npm run dry-run -- "Rename foo to bar in util.ts"
# Route only
npm run route -- "Research TS test runners"
# Status
npx tsx sdk-runner/cli.ts --status
# Live run (needs CURSOR_API_KEY and Node >= 22.13 for @cursor/sdk)
npx tsx sdk-runner/cli.ts --run "Fix the failing auth test"Programmatic:
import { runRoutedTask } from "./sdk-runner/index.js";
const result = await runRoutedTask({
facts: { task: "…", repoPresent: true, needsEdit: true },
dryRun: true,
});- Prefer Cursor Router:
auto-smart+optimize_for:cost|balanced|intelligencewhenCursor.models.list()shows it. - If missing: pick real catalog IDs for the three tiers; never invent IDs.
- Offline/static fallback in
config.example.jsondocumentscomposer-2.5only as a last resort label.
run.usage / agent.getUsage() — if cost is unavailable it is labeled unavailable. This product never invents dollar amounts.
See config.example.json:
{
"enabled": true,
"defaultMode": "balanced",
"confidenceThreshold": 0.7,
"maximumEscalations": 2,
"maximumTaskCostUsd": 1.0,
"showRoutingTrace": true,
"logPromptContent": false,
"requireApprovalFor": ["send_email","delete_data","publish","production_deploy","financial_transaction"]
}Kill switch: "enabled": false or /jev-bypass.
User task
├─ Chat: rule → MCP jev_route → subagent jev-{cost|balanced|intelligence}
└─ SDK: facts → Jev → policy → model catalog → Agent.create/send → escalate
Shared: shared/config.ts, shared/telemetry.ts, shared/redaction.ts
MCP: mcp/server.ts, mcp/router.ts, mcp/policy.ts, mcp/typesafe-client.ts
SDK: sdk-runner/*
email-triage— Jev classify/rank only; no sendresearch-rank— Jev ranks candidates; Cursor browses/writes
npm testUses mock TypeSafe client and fixtures (11 product scenarios). No real API keys required in CI.
Chat mode is soft-enforced (rule + agents). SDK mode is hard-enforced in code.
See SECURITY.md. Never commit .env. Telemetry redacts secrets; prompts off by default.
- Chat cannot force the parent model ID; it delegates to subagents.
- Live
@cursor/sdkneeds Node >= 22.13 andCURSOR_API_KEY. - Without
TYPESAFE_API_KEY, dry-run/demo uses a deterministic mock; live Chat routing should set the key or expectdegradedRouting. - Optional Gmail/X are not bundled OAuth apps — skills document the pattern only.
rm -f ~/.cursor/plugins/local/jev-router-for-cursor
# remove MCP entry / disable plugin in CursorMIT — see LICENSE.