New
Apps 6,305Makers 6,284This week 13
Promote your app−30%
JevLadder screenshot 1
3views in
the last 30 days

JevLadder

Jev — rules first, a cheap judge only when in doubt, humans for the irreversible

Built with Cursor

by haraldsigvartsen · Unclaimed · from NONorway · added Nov 3, 2026
no ratings0 comments
JevLadder icon

JevLadder

JevLadder — rules first, a judge only when in doubt, humans for the irreversible. Measurable model routing and merge gates for coding agents.

JevLadder is a small decision authority for coding agents: deterministic rules run first (free, auditable), a cheap judge covers only the grey zone, and every uncertain or irreversible action goes to a human. Use it as a Codex-first advisory plugin, a TypeScript library, or a CLI merge gate / router. The maintainer develops and tests JevLadder on Codex; Claude Code support is validated structurally (manifest validation + hook simulation).

Who it is for: anyone wiring merge safety or model-tier routing into an agent workflow who wants measurable exits (allow / block / human) instead of free-text "LGTM".

Terminal demo: jevladder check on safe and risky diffs (exit 3 and 2) and route to frontier — recorded from the built CLI without a judge API key

Install for Codex · Advanced CLI / CI · Config · Claude Code · How it works · FAQ · Contributors

License: MIT Node: >=20 Version: 0.6.0


Install: Codex

Automatic host — marketplace install; hooks and MCP wire up without copying files.

codex plugin marketplace add HaraldSigvartsen/jevladder
codex plugin add jevladder@jevladder

Codex asks you to review/trust the plugin's hooks once (/hooks). This is Codex's own safety prompt, not config editing. Node is needed for the MCP server; without Node the hooks exit 0 silently. No clone or build is required.

Day 1: set the TypeSafe / Jev key

Right after install, set a TypeSafe (Jev) API key so grey-zone decide / check actually consult the judge:

export JEVLADDER_TYPESAFE_API_KEY='…'   # preferred; or TYPESAFE_API_KEY

Put it in your shell profile or host env so every Codex session sees it. Hooks, jevladder_route, and jevladder_explain work without a key; without one, advisory jevladder_decide and CLI check fail closed to human on the grey zone (never a silent auto-allow). Set the key early when you take JevLadder into use — it is part of onboarding, not an advanced optional later.

Then use Codex normally. JevLadder supplies:

  • SessionStart guidance: start well-scoped tasks cheap and escalate one tier at a time when work fails or verification is weak.
  • An automatic routing skill: sizes coding work and preserves the same cheap-first escalation and human safety rules.
  • Advisory hooks: prompt submission adds tier/signals and writes a local observe log containing only ts, session_id, cwd, tier, signals, and promptChars — never prompt text. SessionStart does not log. PreToolUse adds context before file writes and merge-like shell commands, and does not log tool input or set a permission decision.
  • Voluntary MCP tools: jevladder_decide runs an advisory miniature pre-merge check; jevladder_route returns tier/signals; jevladder_explain adds explanation lines. Route and explain make no remote calls; with the day-1 key set, advisory jevladder_decide calls the TypeSafe judge on the grey zone (compact diff summary only; see docs/SECURITY.md). They log no task or diff text. Merge enforcement stays in CI/merge.

Claude Code is also a supported automatic host; see Claude Code. Cursor and ZCode need a short manual install step; see the FAQ (Which hosts today?).

A tier is never permission. Uncertainty or abstention escalates up, and humans approve irreversible actions. The plugin never swaps the main session model; the host controls any available delegation. Bundled agents/*.md are for Claude Code only. Codex custom agents are TOML in ~/.codex/agents, not plugin-bundled agents.

Advanced: CLI / CI

Install the published CLI with npm i -D jevladder or pnpm add -D jevladder (available once the maintainer completes npm login), or try its help after publication:

npx jevladder --help
# or: pnpm dlx jevladder --help

Clone and build

Prerequisites: Node >=20 (package.json engines.node).

git clone https://github.com/HaraldSigvartsen/jevladder.git && cd jevladder
pnpm install
pnpm run build

Demo: merge gate

# Safe change (greeting copy + its test) — no rule hit; without a judge key, fail closed:
node dist/src/cli.js check --diff examples/merge-gate/sample.diff --tests-passed
outcome: human
source:  human
reason:  judge abstained: no judge key configured
judge:   abstain 0 — no judge key configured

Exit code 3 → human review. Set a judge API key (see Using a real judge model below) to consult TypeSafe on the grey zone.

# Touches protected path src/payments/charge.ts — first-hit rule stops before judge:
node dist/src/cli.js check --diff examples/merge-gate/sample-risky.diff --tests-passed
outcome: block
source:  rule (protected-paths)
reason:  protected path requires human review: src/payments/charge.ts

Exit code 2 → block (stop for human review). The risky sample also contains a fake secret literal; protected-paths wins because it is earlier in the pack.

Demo: route

node dist/src/cli.js route --explain "Migrate the payments database in production"
tier:          frontier
abstained:     false
difficulty:    0.550
consequence:   1.000
verifiability: 0.000
signals:
  - deploy/production (+0.7) deployment or production surface ("production")
  - money (+0.65) money/billing surface ("payments")
  - cross-domain (+0.55) spans db + payment
  - migration/irreversible (+0.5) migration or irreversible change ("migrate")
explanation:   score=0.73 (= 0.6·difficulty + 0.4·consequence) | axes: …

Eval (optional)

pnpm run eval
pnpm run eval:independent
Eval Accuracy What it measures
Consistency (pnpm run eval) 100% (35/35) Labels aligned with the same heuristics under test — intended-policy consistency, not external validity.
Independent (pnpm run eval:independent) 33 scenarios Prose scenarios labelled from eval/independent/policy.md (M1–M5 / R1–R5) before running jevladder, including predicted adversarial misses. Latest run: 25/33 correct (76%).

They differ on purpose: 100% consistency means the gate matches its own rule pack; the independent result preserves policy-labelled disagreements without tuning rules to fit them. See the policy doc and generated (gitignored) reports under eval/.

Exit codes

Code Meaning
0 allow
2 block
3 human decision required
1 usage / IO error (empty diff, empty route text, bad flags, unreadable file, …)
node dist/src/cli.js check --diff examples/merge-gate/sample.diff --tests-passed
echo $?    # 0

node dist/src/cli.js check --diff examples/merge-gate/sample-risky.diff --tests-passed
echo $?    # 2

Unspecified test status is treated as not green (only --tests-passed claims green). Empty or non-diff input is exit 1, never an implicit allow.


Use in your own project

a) Library

After pnpm run build in a clone, import from the built package (path / git dependency — not npm install jevladder). Real exports from src/index.ts:

import {
  defineGate,
  makeMergeRules,
  MockJudge,
  type Decision,
} from 'jevladder'; // or: from './dist/src/index.js' in a clone

const gate = defineGate({
  rules: makeMergeRules(),
  judge: new MockJudge(), // free, no network; swap for OpenAICompatibleJudge below
  threshold: 0.7,
  onUncertain: ({ reason }) => {
    console.error(`human needed: ${reason}`);
  },
});

const decision: Decision = await gate.decide({
  action: 'merge',
  diff: unifiedDiff, // treat as data, never instructions
  files: ['src/greet.ts'],
  irreversible: false,
  context: { testsPassed: true },
});

// decision.outcome: 'allow' | 'block' | 'human'
// decision.source:  'rule' | 'judge' | 'human' | 'none'
// decision.log:     structured audit trail

The judge is JevLadder's type-safe contract: the TypeScript Judge interface is validated at runtime by parseJudgeVerdict (verdict must be allow, block, or abstain; score must be finite and in [0,1]; evidence must be non-empty). Invalid output abstains and goes to a human. Tests and evals use MockJudge explicitly; the stock CLI uses createDefaultJudge() (see below).

Using a real judge model

If you followed Install: Codex day 1, the TypeSafe key is already set. Otherwise set JEVLADDER_TYPESAFE_API_KEY or TYPESAFE_API_KEY for the stock TypeSafe judge (JEVLADDER_TYPESAFE_API_KEY wins when both are set). Keys are never shared across providers: JEVLADDER_JUDGE_API_KEY is only for an explicitly wired OpenAICompatibleJudge. The CLI check command, createDefaultJudge() in the library, and the bundled MCP jevladder_decide tool then call TypeSafe System One on the grey zone after deterministic rules pass. Only a compact diff summary is sent (paths, line counts, truncated changed-line excerpt); see docs/SECURITY.md.

Without a key, behaviour is fail closed: the judge abstains with no judge key configured and the gate returns human (exit 3 for CLI) — never a fixed-score auto-allow. That safety default is why install treats the key as an early onboarding step.

import { createDefaultJudge, defineGate, makeMergeRules } from 'jevladder';

const gate = defineGate({
  rules: makeMergeRules(),
  judge: createDefaultJudge({ userAgentVersion: '0.6.0' }),
});

Advanced example (use a model selected from your own configured model ladder, starting with its cheap tier; JevLadder does not recommend a vendor model):

import { defineGate, makeMergeRules, OpenAICompatibleJudge } from 'jevladder';

const gate = defineGate({
  rules: makeMergeRules(),
  judge: new OpenAICompatibleJudge({
    baseUrl: process.env.JEVLADDER_JUDGE_BASE_URL ?? 'https://provider.example/v1',
    model: process.env.JEVLADDER_JUDGE_MODEL ?? '', // Empty/missing throws; no key → abstain → human.
    apiKeyEnv: 'JEVLADDER_JUDGE_API_KEY', // default if omitted
  }),
  threshold: 0.7,
});

Irreversible: even if the judge allows, the gate returns human:

const decision = await gate.decide({
  action: 'merge',
  diff: unifiedDiff,
  files: ['src/greet.ts'],
  irreversible: true, // judge allow → always human
  context: { testsPassed: true },
});
// outcome: human — "irreversible action: judge allow cannot approve without a human"

b) CLI in a real workflow

git diff > /tmp/change.diff
node /path/to/jevladder/dist/src/cli.js check --diff /tmp/change.diff --tests-passed
echo $?

Pipe / stdin (supported — --diff - or omit --diff):

git diff | node /path/to/jevladder/dist/src/cli.js check --diff - --tests-passed
# same: git diff | node /path/to/jevladder/dist/src/cli.js check --tests-passed

Example GitHub Actions job (adapt paths / base branch; not a drop-in for every repo). Exit 2 or 3 fails the job (= needs human review). Without a judge API key the stock CLI fails closed to human (exit 3) on grey-zone diffs. For CI that should consult the judge on the grey zone, add JEVLADDER_TYPESAFE_API_KEY or TYPESAFE_API_KEY as a secret (same day-1 key as local install):

# .github/workflows/jevladder-check.yml — EXAMPLE to adapt
name: jevladder merge gate
on:
  pull_request:
jobs:
  jevladder-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
      - name: Build jevladder (from clone / submodule / path)
        run: |
          git clone --depth 1 https://github.com/HaraldSigvartsen/jevladder.git /tmp/jevladder
          cd /tmp/jevladder && corepack enable && pnpm install --frozen-lockfile && pnpm run build
      - name: Diff vs base and run gate
        run: |
          git diff origin/${{ github.base_ref }}...HEAD > /tmp/change.diff
          node /tmp/jevladder/dist/src/cli.js check --diff /tmp/change.diff --tests-passed
          # exit 0 allow · 2 block · 3 human · 1 usage error

Put judge keys in Actions secrets — never commit them. The stock CLI reads TypeSafe keys (JEVLADDER_TYPESAFE_API_KEY / TYPESAFE_API_KEY) automatically when set; it does not use JEVLADDER_JUDGE_API_KEY.

c) Write your own rule

Shape from src/gate.ts: id + evaluate returning a RuleHit or null. First hit wins — put stricter / cheaper checks first.

import { defineGate, makeMergeRules, MockJudge, type Rule } from 'jevladder';

const blockLockfiles: Rule = {
  id: 'block-lockfiles',
  evaluate(input) {
    const files = input.files ?? [];
    const hit = files.find((f) => f.endsWith('.lock') || f.endsWith('-lock.json'));
    if (!hit) return null;
    if (input.context?.allowLockChange === true) return null;
    return {
      outcome: 'block',
      reason: `lockfile change requires context.allowLockChange: ${hit}`,
    };
  },
};

// Custom rule first → it can stop the merge before makeMergeRules runs.
const gate = defineGate({
  rules: [blockLockfiles, ...makeMergeRules()],
  judge: new MockJudge(),
});

Config

There is no auto-loaded config file. The CLI does not read jevladder.config.ts; jevladder plugin --config <json> explicitly reads a plugin-only JSON config. The typed example is for you to copy fields into defineGate / makeMergeRules({ protectedGlobs }) / your own wiring. See examples/config/README.md and examples/config/jevladder.config.example.ts.

Field Purpose Honesty (v0.2)
protectedPaths Globs for paths that always stop for human review (makeMergeRules({ protectedGlobs })). Wired when you pass them into makeMergeRules.
modelLadder tier / model / placeholder inputPer1M / outputPer1M per cheap | mid | frontier. Illustrative prices; scoreRoute only returns a tier — you map model yourself.
plugin.subagentModels Claude Code aliases per route tier. Pass config.plugin into the plugin generator API, or its contents as plugin --config <json>; baked into generated agent files.
irreversibleActions Example phrases (deploy production, run migration, delete *). Informational — the engine does not match this list yet. The gate keys off input.irreversible (CLI: --irreversible).
skillsByTaskType Planned mapping of task type → skill/policy docs. Informational — the gate ignores it today.
judge.threshold Minimum judge score to act on allow/block (default 0.7). Pass into defineGate({ threshold }).

Claude Code (secondary host)

Automatic host — marketplace install; same plugin tree as Codex.

/plugin marketplace add HaraldSigvartsen/jevladder
/plugin install jevladder@jevladder

Day 1: set the TypeSafe / Jev key

Same as Codex — set it when you start using JevLadder:

export JEVLADDER_TYPESAFE_API_KEY='…'   # preferred; or TYPESAFE_API_KEY

Without a key, hooks / route / explain still work; grey-zone jevladder_decide fails closed to human. With the key, decide consults the TypeSafe judge.

The plugin runs automatically with sensible defaults. SessionStart provides delegation guidance; UserPromptSubmit adds advisory routing and logs only tier, signals, prompt character count, and session metadata (never prompt text). PreToolUse adds advisory context before file writes (Write, Edit, MultiEdit, NotebookEdit, apply_patch) and merge-like shell commands (git merge, git push, git rebase, gh pr merge). It does not approve or deny the tool, and it does not log the command or file contents. The shell launcher exits silently with status 0 if Node is unavailable. The CLI is not needed for normal use.

For contributors who need a generated copy, see the CLI commands below.

Tree (relative to the out dir):

my-jevladder-plugin/
  .codex-plugin/plugin.json
  .claude-plugin/plugin.json
  .mcp.json
  hooks/hooks.json
  scripts/jevladder-hook.sh
  scripts/jevladder-observe.mjs
  scripts/jevladder-mcp.mjs
  skills/jevladder-routing/SKILL.md
  agents/jevladder-cheap.md
  agents/jevladder-mid.md
  agents/jevladder-frontier.md
  config.json
  README.md

Optional protected globs (embedded in config.json for the plugin). They stay informational: PreToolUse does not enforce them, and blocking remains in CI/merge:

node dist/src/cli.js plugin --out ./my-jevladder-plugin --protected '**/payments/**' --protected '*.lock'

The agents use Claude Code model aliases, configurable through JevLadderPluginConfig.subagentModels or an explicit plugin JSON file:

{
  "subagentModels": { "cheap": "haiku", "mid": "sonnet", "frontier": "inherit" }
}

Save as jevladder-plugin.json, then generate with:

node dist/src/cli.js plugin --out ./my-jevladder-plugin --config ./jevladder-plugin.json

Omitted tiers use the defaults shown. Allowed values are haiku, sonnet, opus, and inherit; invalid aliases are rejected before files are written. inherit uses the main session's model for the subagent, so the frontier tier does not guarantee frontier capability or a lower cost. Choose opus explicitly if wanted. The JSON also accepts protectedPaths and logFileName; --protected replaces configured globs. Regenerate after config changes: editing the emitted config.json does not change agent frontmatter. See Claude Code's subagent docs for the host format and model selection behavior.

Generate / validate (contributors)

What is verified today:

pnpm run build
node dist/src/cli.js plugin --out ./my-jevladder-plugin
claude plugin validate ./my-jevladder-plugin

The repository marketplace points at the checked-in generated plugin under plugin/. Marketplace metadata and plugin manifest are validated together by the test suite.

A checked-in dogfood copy lives under plugin/.

Cost report

Summarize observed routed tiers from the privacy-safe log (never prompt text):

node dist/src/cli.js report
# or inspect another log
node dist/src/cli.js report --log ./observe.jsonl --json

Tier counts and percentages are measured (from log). Cost per routed task and cumulative costs are simulated using JevLadder's mock tier prices; they are not actual provider spend. Missing logs are reported as an advisory message.

Config proposal

jevladder check appends {ts, outcome, source, ruleId?} to ~/.jevladder/decisions.jsonl (override with JEVLADDER_DECISION_LOG). Diff text, paths, and reasons are not stored. JEVLADDER_NO_LOG=1 skips the write.

node dist/src/cli.js propose --log ./decision

Description taken from the repository README.

Ratings

–
0 ratings
5 0
4 0
3 0
2 0
1 0

Rate this app

Sign in to rate

Comments 0

Sign in to comment

No comments yet.

Related apps

#decision-making · #rules