JEVX

JevX docs

JevX finds hardcoded rules that are really judgment calls and replaces them with a Jev decision (TypeSafe noul / choice / score). The old rule stays as the fallback. Current version: 0.4.0.

Quick start

npm i -g @vij-sameerb5/jevx
export XAI_API_KEY=…         # your key (or OPENROUTER_API_KEY)
cd your-project
jevx --dry-run               # preview, writes nothing
jevx                         # change strong fits, run your tests
jevx undo                    # put everything back

After a real run, open VS Code or Cursor → Source Control. Every change is there in red/green. .jevx/report.html has every scorecard and diff.

Keys

JevX uses your AI key and never ships one. Anything inside an npm package can be extracted, so it never will.

  • XAI_API_KEY (xAI / Grok) or OPENROUTER_API_KEY: required for the terminal version.
  • TYPESAFE_API_KEY: optional. Adds Jev's own opinion to every scorecard. The code JevX writes also needs it at runtime, in your app's environment.

To keep keys in a file, put KEY=value lines in it and point to it once:

echo 'export JEVX_ENV_FILE="$HOME/path/to/.env"' >> ~/.zshrc
source ~/.zshrc

Anything you export in your shell always wins over the file. The run's header says where the keys came from, never what they are. Keep that file out of git.

What a run does

  1. Index: functions, callers and types, on your machine. Free.
  2. Read: your AI reads the source files in parts of about 23k tokens, API routes and libraries first, UI last. It names every spot where a rule looks like a judgment. Tests, .d.ts files, UI kits and configs are skipped.
  3. Re-check: each spot is read again with its surrounding code (callers, types) and exact logic is dropped.
  4. Score: AI + TypeSafe + patterns, averaged (see Scorecard).
  5. Write: for fits at or above your minimum, the smallest change. The old rule becomes a named fallback, callers are updated (e.g. await), and @typesafe-ai/sdk is added.
  6. Verify: your test script and tsc --noEmit run before and after. If a check that passed now fails, JevX re-applies the changes one at a time and reverts the ones that break it.

Files with your own uncommitted changes are never touched. Backups go to .jevx/backup/, and .jevx/ ignores itself in git.

Commands

Command / flagWhat it does
jevx [path]Run on a folder (default: the current one)
--dry-runPreview every fit from 50% with diffs. Writes nothing
--min-fit <n>Lowest fit that gets written, 50–100 (default 70)
--include-possibleSame as --min-fit 50
--include-disagreeAlso write fits the sources disagree on, if they reach --min-fit
--provider xai|openrouterPick the AI when both keys are set
--model <id>Model for that provider (default Grok 4.6 on xAI)
--max <n>Most spots to check in depth (default 12)
--budget <tokens>Token cap for the run (default 400,000). Half is for reading
--fastLess reasoning while reading. Cheaper, may miss spots
--no-verifyDon't run your tests / typecheck
--no-installDon't install @typesafe-ai/sdk
-y, --yesDon't ask before sending code (for scripts and CI)
--shareShare anonymous outcomes (see Privacy)
--report-json <file>Save the full result as JSON on your machine
--welcomeShow the JEVX welcome again
jevx undo [path]Restore every file the last run changed
jevx mcp installAdd JevX to Claude Code, Claude Desktop, Cursor, Windsurf, VS Code, Gemini CLI and Codex
jevx mcp uninstallRemove it from all of them
jevx mcpThe MCP server itself (editors start it)

Scorecard & fit

Every spot gets three independent scores from 0 to 100%:

  • AI: your AI's confidence, after reading the code, that Jev improves this decision.
  • TypeSafe: Jev's own opinion. Is it a judgment, are the outcomes bounded, and is exact code not the better tool?
  • Patterns: how this spot compares with real Jev projects (8 features such as ambiguity and rule stability), blended with outcomes shared by other users once a pattern has at least 5 of them.
VerdictWhenWhat JevX does
STRONGAverage ≥ 70%, all sources agreeWrites it
POSSIBLEAverage 50–69%Previews it. Writes it with --min-fit
SOURCES DISAGREESome sources above 50%, some belowShows who said what. Writes it only with --include-disagree
WEAKAverage under 50%Left alone

The bands are for people, not a proof. The three scores are always shown next to the average.

Lower fits, on purpose

Some teams want Jev even where the fit is 55–69%. That's fine, as long as it's your call:

jevx --dry-run --min-fit 55   # see exactly what would be written
jevx --min-fit 55             # write it
  • Below 70, JevX prints a warning before writing.
  • Below 50 it refuses. A fit under 50% means the sources think exact code is better.
  • Your tests still run, breaks are still reverted, and jevx undo still works.

MCP: Claude Code, Claude Desktop & more

jevx mcp install

It finds and configures every supported app on your machine: Claude Code, Claude Desktop, Cursor, Windsurf, VS Code (Copilot), Gemini CLI and Codex. Each config file is backed up once, and anything else in it is left alone. Restart the app, open a project and say "use jevx to find where Jev fits in this repo".

Claude Desktop: it has no open project, so name the folder ("…in ~/code/my-app"). Or install jevx.mcpb: double-click it, pick your project folder once, and optionally paste your TypeSafe key. Claude Desktop stores the key, not JevX. It can't edit files itself, so it uses jevx_apply, which backs up, runs your tests and reverts on failure.

Any other MCP app: the install output prints the command and arguments to paste.

Step-by-step setup for each app (the .mcpb, config snippets, Claude Code commands, the TypeSafe key, uninstall and fixes) is on the home page: Add JevX to Claude and other apps →

The AI uses these tools with its own tokens:

ToolWhat it gives the AI
jevx_guideWhat a Jev opportunity is (and isn't), and how to write the change
jevx_scanRepo summary, where Jev is already used, candidates, and the reading order
jevx_readA file, outline, folder, function or the repo overview. Secrets scrubbed
jevx_relatedCallers, callees, types and constants of a function
jevx_searchFind a function, type or file by name
jevx_scorecardScores a proposal: patterns + AI + TypeSafe
jevx_preview_changeRed/green diff of a change. Edits nothing
jevx_applyApply a previewed change: backup, tests before/after, auto-revert. Never under 50%
jevx_undoRestore what the last change touched
jevx_reportWrites .jevx/report.html
jevx_shareOpt-in anonymous outcomes (off unless JEVX_SHARE=1)

It changes strong fits by default. Say "use Jev where the fit is at least 55%" to go lower. It never goes under 50%.

Privacy & data

Sent to your AI

Your source files, with secrets scrubbed, sent to the provider's official address using your key. Never .env files, tests, builds or node_modules. JevX asks once per provider, and again when what it sends changes.

Stored by JevX: only with --share

One anonymous row per checked spot:

  • The kind of code: e.g. error-message-regex-classifier, the input kind, the rule kind, the code shape in generic words, why Jev fits, and an invented example the rule gets wrong.
  • The three scores, the verdict, your --min-fit, and what happened: changed, reverted by tests, undone, previewed or left.

Never stored: code, file or function names, identifiers, string literals, paths, your repo's name or your keys. The AI is asked to write generic text, and JevX also strips every name it finds in the spot's code before sending. The dataset only accepts inserts: nobody can read it with the key JevX uses.

That's how JevX learns which kinds of changes hold up. Outcomes feed back into the patterns score in later releases.

Configuration

VariableWhat
XAI_API_KEYxAI key (Grok)
OPENROUTER_API_KEYOpenRouter key
TYPESAFE_API_KEYTypeSafe key: scorecards, and at runtime for the changed code
XAI_MODEL · XAI_TIMEOUT_MSModel and per-call timeout for xAI
JEVX_ENV_FILEA KEY=value file to read keys from (default ~/.jevx/.env)
JEVX_HOMEWhere consent and the welcome marker live (default ~/.jevx)
JEVX_SHARE1 = always share anonymous outcomes
JEVX_SUPABASE_URL · JEVX_SUPABASE_ANON_KEYWhere shared outcomes go (insert-only)
JEVX_ALLOW_CUSTOM_BASE_URL1 = allow a custom AI address (off by default, so a stray variable can't redirect your code)

Troubleshooting

  • "No AI key found": the key isn't in this terminal. Exports only apply to the terminal you typed them in. Use JEVX_ENV_FILE or ~/.zshrc.
  • "TypeSafe not set" although it's in your file: JEVX_ENV_FILE isn't set. The header line Keys should say from … + your shell.
  • "No Jev opportunities found": the result box lists why each spot was left alone. The full answers are in .jevx/debug/. Many apps are mostly UI and plumbing, and zero is a valid answer.
  • A part "could not be read (timed out)": each AI call gets 4 minutes. Try again, or set XAI_TIMEOUT_MS.
  • "Stats not shared": JEVX_SUPABASE_URL / JEVX_SUPABASE_ANON_KEY aren't set in this run.
  • Something changed you didn't want: jevx undo, or revert that one change in Source Control.

Versions

0.4.02026-09-23 · first public release candidate
  • Learns where and why Jev fits: every finding carries a generic pattern. It's shared only with --share, scrubbed in code, and learned outcomes feed the patterns score.
  • --min-fit (50–100) and --include-disagree. Warns below 70, refuses below 50.
  • Claude Code / Cursor now match the CLI: a balanced guide, a reading order, the pattern on scorecards, the minimum-fit rule, and jevx_share.
  • jevx mcp install covers Claude Desktop, Windsurf, VS Code, Gemini CLI and Codex too. There's also a one-click jevx.mcpb for Claude Desktop, plus jevx_apply and jevx_undo for apps that can't edit files.
  • The TypeSafe score now weights judgment double, so fixed mappings no longer look like fits.
  • A first-run JEVX welcome, --report-json, MIT license, Node ≥ 20.10, and a release check that installs the package into a clean folder.
0.3.02026-09-23 · the AI reads your code
  • The AI reads the source itself, part by part. Static analysis only sets the order, and is the fallback if reading fails.
  • Balanced second check: small spots get low scores instead of a flat no.
  • Fixed: AI calls were cut off after 30 s (now 4 minutes). That's why 0.2 found nothing on a real app.
  • POSSIBLE previews, --fast, keys from an env file, .jevx/debug/, and opt-in anonymous outcomes.
0.2.02026-09-22 · one command
  • jevx finds, judges and changes strong fits. No picking, no accepting.
  • Safety in the tool: the old rule as fallback, callers updated, your uncommitted files skipped, tests before/after with auto-revert, backups and jevx undo.
  • --dry-run, jevx mcp install, and terminal scorecards and diffs.
0.1.02026-09-22 · MCP server
  • JevX as tools for Claude Code / Cursor: scan, read, related, search, a three-source scorecard, red/green preview and an HTML report.
Research2026-09-19 → 09-21 · not released
  • A static decision detector, TypeSafe validation and calibration on real apps.
  • Code analysts on Gemini, OpenRouter and direct xAI, with adaptive repository context.
  • A study of 30 real Jev projects that produced the first pattern profile. Its lesson: patterns alone can't decide where Jev belongs, so an AI must read the code. That became 0.1.