# jevcore

> TypeSafe Jev integration for DeepSeek Harness and MCP hosts that delivers typed judgments (yes/no, choice, score) instead of prose, offline by default with explicit egress disclosure.

jevcore is an open-source TypeScript library that wires TypeSafe's Jev decision model into DeepSeek Harness (DSH) and any Model Context Protocol (MCP) host. It is published under the Apache License 2.0 by PerryLink and part of a stated 40+ plugin family for DeepSeek Harness. The project is offline by default, with every network transmission named explicitly at startup before any data leaves the process.

## What It Is

jevcore is a decision-layer adapter, not a chat integration. Jev answers typed questions — `noul` (yes/no), `choice`, and `score` — and returns calibrated probabilities. The project exposes exactly that surface to agents running in DeepSeek Harness or any MCP-capable host, and nothing more. It ships as three coordinated packages: `jevcore` (the core decision primitives, no harness dependency), `jevcore-dsh` (the DSH plugin with three tools and two opt-in gates), and `jevcore-mcp` (the same three tools over stdio MCP).

## Three-Package Architecture

The adapter layer is intentionally thin. All decision logic — primitives, providers, egress contract, policy, gates — lives in `jevcore` (core), so new adapters cannot drift from the guarantees the others make:

- **`jevcore`** — plain Node ≥20, no Cordis or DSH dependency; use in scripts, services, or custom harnesses
- **`jevcore-dsh`** — DSH plugin requiring Node `^22.19.0 || >=24.0.0`; registers one service, three tools (`jev_ask`, `jev_rank`, `jev_check`), and two opt-in gates (`safety`, `context`)
- **`jevcore-mcp`** — stdio MCP binary (`npx -y jevcore-mcp`); same three tools for any MCP host that is not DSH

## Egress Contract and Privacy Design

The README describes the egress model as "the part worth reading before installing." Every feature defaults to off, and the plugin prints a machine-readable contract at load time listing either `egress=OFF` or `SENDS <feature> { fields }` for each active feature. Key design properties documented in the source:

- Default provider is an offline mock; the live path requires both `provider: live` and a resolved credential
- A disabled gate registers no event listener at all — verified by test, not policy
- The model cannot widen its own constraints; no tool exposes gate configuration
- An undecided judge answer resolves through explicit config, defaulting to `ask` (not `allow`)
- Redaction (`src/redact.ts`) runs two passes — sensitive field names and known secret shapes — before any transmission, with an honest caveat that unrecognised secret shapes in free text will pass through

Two live provider routes are supported: TypeSafe directly (`api.typesafe.ai`) and OpenRouter (`openrouter.ai/api`), both using the `@typesafe-ai/sdk` client. The startup report names the active endpoint so operators read the destination rather than infer it.

## Tools and Gates

Three tools are exposed to the model, deliberately few and orthogonal:

- **`jev_ask`** — a batch of typed questions over one state snapshot
- **`jev_rank`** — score and sort candidates against one criterion in a single round-trip; probabilities are independent per-candidate judgments, not a distribution
- **`jev_check`** — claim/evidence verification returning `supported`, `contradicted`, `conflicted`, `insufficient`, `undecided`, or `unknown`; contradiction outranks support

Two opt-in gates intercept the harness event loop:

- **`gate:safety`** — judges tool calls before dispatch; opt-in because it runs on every matching call, not just model-initiated ones
- **`gate:context`** — withholds large, uninformative tool results from reaching the agent; fails open unconditionally because losing a real result to a phantom "irrelevant" verdict is treated as worse than keeping an uninformative one

A bundled skill (`typesafe-ai-dsh`) is registered through the DSH skill registry, teaching an agent when a Jev judgment is appropriate and when it is a category error.

## Current Status

The repository was created on 2026-09-20 and last pushed on 2026-09-24. The README documents 410 tests across three packages (314 core, 66 DSH, 30 MCP), all passing without network access or a live API key. The OpenRouter route has been verified against real System One models (`typesafe/jev-1.13-20260917`). The TypeSafe direct route has been exercised lightly. Gate behaviour on live traffic and long-running or adversarial testing are listed as not yet verified. One known cosmetic issue — a corrupted em dash in `jev_ask`'s description in the currently running process — is noted as fixed on disk but requiring a restart to take effect.

## Features
- Typed decision model integration (noul, choice, score)
- Offline by default with mock provider
- Explicit egress disclosure at startup
- Three tools: jev_ask, jev_rank, jev_check
- Two opt-in gates: safety and context
- DeepSeek Harness (DSH) plugin support
- MCP stdio server support
- TypeSafe and OpenRouter provider routes
- Credential redaction before transmission
- Bundled agent skill registration
- Configurable confidence and probability thresholds
- No model-accessible gate configuration
- Fail-safe undecided resolution (defaults to ask)
- 410 tests with no network dependency in CI

## Integrations
DeepSeek Harness (DSH), Model Context Protocol (MCP), TypeSafe AI API, OpenRouter, @typesafe-ai/sdk, Cordis, Node.js

## Platforms
API, CLI, DEVELOPER_SDK

## Pricing
Open Source

## Links
- Website: https://github.com/PerryLink/jevcore
- Repository: https://github.com/PerryLink/jevcore
- EveryDev.ai: https://www.everydev.ai/tools/jevcore
