Back to Journal
Cover image for Jev as a coding harness — cut Claude and Cursor spend with typed routing
2026-09-20
Research Entry

Jev as a coding harness — cut Claude and Cursor spend with typed routing

jevtypesafeclaude-codecursoragent-harnesstoken-routing

I burn Claude and Cursor tokens the same way a lot of engineers do: default to the strong model, then notice the bill after a week of “quick fixes.” Most of those turns did not need Opus. Some did not need an LLM at all. The fix is not a spreadsheet of vibes — it is a cheap, typed gate that runs before generation.

That gate is TypeSafe Jev (System One), wrapped in a small package we call jev-harness. Same library, two surfaces: Cursor picks which model to wake; Claude Code picks which worker runs next. Code owns control flow. Jev only returns Choice / Noul / Score over a closed set.

Two surfaces

System One vs System Two (plain words)

System One here means: fast judgment over a closed option list. You hand Jev a short goal plus compact JSON context. It returns something like cursor-grok or planner-fable, plus a confidence and an optional “this needs expensive reasoning” signal. No prose plan. No code. No vision.

System Two is the expensive part you already know: Cursor Grok writing a patch, Fable drafting architecture, Opus doing a hard multi-file impl, Hermes chewing a long research draft.

The TypeSafe docs call this pattern Harness Engineering / Model routing. We already proved the same idea on a computer-use spike: Jev Choice over action ids beats scraping UI labels. Coding harness is the same gate, pointed at models and agents instead of buttons.

Shared package: jev-harness

Package path: /workspace/jev-harness.

Python surface:

  • route_task — Cursor-side model route
  • route_agent — Claude-side worker route (ratified multi-agent orchestrator)
  • select_option — pick among labeled options (PRs, tools, files)
  • should_escalate — Noul / Choice escalate check
  • CLI: python -m jev_harness.cli {route|agent|select|escalate|spend}

Hard rules we keep in v0:

  • Serial workers only — one expensive worker at a time
  • Jev never writes code — text/JSON judgments only
  • No vision — compact state JSON, no screenshots
  • Spend proxy cap for spikes: JEV_HARNESS_CAP_USD=0.50

Cursor surface — model route

On Cursor we install a skill named jev-harness, next to the upstream typesafe-ai skill from github.com/typesafe-ai/skills. Before opening Opus, Fable, or a long Hermes run, the agent calls the CLI:

python -m jev_harness.cli route "Fix reconnect timeout in bridge.py" \
  -c '{"repo":"amr-agent"}'

Closed Choice set:

Choice Meaning in this stack
cursor-grok Standard coding — stay in Cursor / Grok
fable Plan / architecture / tradeoffs
opus Hard novel impl, subtle multi-file invariants
hermes Long research / draft capacity
skip Rules, scripts, or context enough — no LLM

Parallel Noul needs_expensive_reasoning: if ≥ 0.55, treat as escalate even when Choice was cheap — confirm before waking Opus/Fable.

Cursor path

Example session. Goal: “small reconnect timeout fix in bridge.py.”

  1. Skill fires cli route with repo context.
  2. Jev returns cursor-grok, escalate false, Noul low.
  3. Agent stays on Cursor Grok, edits the file, runs tests.
  4. Opus never opens. That is the whole point.

If the goal had been “Plan M7 fleet architecture,” we expect fable and a plan-only escalate — not an immediate impl blast.

Claude Code surface — multi-agent orchestrator

Claude Code gets the TypeSafe plugin installed, and repo CLAUDE.md turns the session into an orchestrator: cheap Claude builds state, calls Jev, spawns exactly one worker, merges, re-routes if incomplete. Implementation does not live in the orchestrator by default.

Agent Choice set (no cursor-grok — that stays on the Cursor surface):

Choice Spawn
planner-fable Fable — plan only
impl-opus Opus — hard impl
impl-sonnet Sonnet — mid-tier coding
review-fable Fable — diff / PR review
research-hermes Hermes — long research/draft
skip Scripts / tests / gh — no LLM
python -m jev_harness.cli agent "Reduce E3 FA" \
  -c '{"phase":"plan","repo":"amr-agent","risk":"med"}'

Worker briefs live under /workspace/jev-harness/claude/briefs/. Planner output is plan-only; impl waits for a second route (phase=implement) or an explicit user GO. If confirm_upgrade is true (cheap Choice + Noul ≥ 0.55), confirm with the human before upgrading to Opus / planner Fable.

Claude loop

flowchart TD
  U["User goal"] --> O["Orchestrator builds compact state JSON"]
  O --> J["Jev cli agent / route_agent"]
  J -->|skip| T["Run tools / scripts"]
  J -->|planner-fable| P["Spawn Fable plan-only"]
  J -->|impl-opus / impl-sonnet| I["Spawn one impl worker"]
  J -->|review-fable| R["Spawn Fable review"]
  J -->|research-hermes| H["Spawn Hermes research"]
  P --> M["Merge result"]
  I --> M
  R --> M
  H --> M
  T --> M
  M -->|incomplete| O2["Update prior_agent / prior_outcome"]
  O2 --> J
  M -->|done or budget| S["Stop"]

Example: plan → impl → review

You say: “Drop E3 false aborts — plan first, then code.”

  1. Orchestrator state: goal=reduce E3 FA, phase=plan, risk=med, repo=amr-agent.
  2. Jev → planner-fable. Only Fable spawns; brief says plan only.
  3. Plan merges. State flips to phase=implement with prior_outcome.
  4. Jev again → impl-opus or impl-sonnet. Exactly one impl worker.
  5. Done coding → phase=review → review-fable.
  6. Anywhere along the way, if tests/scripts suffice, Jev can say skip and no LLM opens.

Orchestrator is traffic cop. Jev is the light.

Side-by-side: what differs

Cursor Claude Code
Gate API cli route / route_task cli agent / route_agent
Choice includes Grok? Yes — cursor-grok No
Session role Coding agent gated by model pick Orchestrator that spawns workers
Wiring Cursor skill jev-harness CLAUDE.md + TypeSafe plugin
Parallel workers N/A (single session) Serial only in v0
Typical escalate Opus / Fable from Grok default Opus only when Choice says so

Same package. Same spend cap. Different closed sets because the products are different.

What we measured

Live smoke, model route (cli route), 10 cases, cap $0.50:

  • Total proxy spend ≈ $0.00035
  • Sensible picks across cursor-grok / fable / opus / hermes / skip (fix → Grok, plan → Fable, hard PLC → Opus, pytest → skip)

Live smoke, agent route (cli agent), 9 labeled cases:

  • 9/9 match expected worker ids
  • Total proxy spend ≈ $0.00038 under the same $0.50 cap

Latency honesty from prior M5 (WAN Jev over public HTTP): p95 ~500 ms. That is fine for an async coding harness — you are already waiting on humans and editors. It is not fine for 3–5 Hz robot control loops. We do not claim tick-rate use here. Dollar figures are token proxies, not invoices.

What we do not use Jev for

  • Writing code or free-text plans
  • Vision / screenshot decisions
  • Real-time control (latency already misses those budgets)
  • Auto-spend without a hard USD cap
  • Safety / ASIL / PL / SIL claims of any kind

Jev closes the schema. It can still pick the wrong legal option. The harness’s job is cheap routing and escalation discipline, not magic correctness.

How to try it

No secrets in this post. You need a TypeSafe API key in the environment (we load from ~/.config/typesafe.env on the box — never log it).

1. Package

cd /workspace/jev-harness   # or your sync path
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
export TYPESAFE_API_KEY=...   # your key
export JEV_HARNESS_CAP_USD=0.50

2. Cursor

  • Install skill jev-harness from cursor-skill/SKILL.md
  • Keep upstream typesafe-ai skill from github.com/typesafe-ai/skills for designing new judgments

3. Claude Code

# upstream skill / plugin (pick one method)
npx skills add typesafe-ai/skills --skill typesafe-ai
# or: claude plugin marketplace add typesafe-ai/skills
#     claude plugin install typesafe@typesafe-ai

Append /workspace/jev-harness/claude/CLAUDE.md.snippet into the repo’s CLAUDE.md so the session is an orchestrator.

4. One-liners

python -m jev_harness.cli route "Fix reconnect timeout in bridge.py"
python -m jev_harness.cli agent "Reduce E3 FA" \
  -c '{"phase":"plan","repo":"amr-agent","risk":"med"}'
python -m jev_harness.cli spend

Offline: JEV_HARNESS_MOCK=1 for deterministic tests without spend.

Closing — programmable common sense before generation

Expensive models as the default is wasteful. A typed System One gate is programmable common sense: closed options, code-owned control flow, escalate only when the cheap judgment says so.

Same jev-harness package. Cursor gets a model router. Claude Code gets a ratified multi-agent orchestrator where Jev picks the next worker. Serial, JSON-only, no vision, hard spend cap.

That is the harness. Generation stays expensive on purpose — and rare when it should be.

End of Protocol — jev-coding-harness-cursor-claude.md