Skip to content

sapho

Rust library and CLI for compound decisions: ask Jev small questions, combine answers with rules in a YAML/JSON decision graph.

CLIbetaAGPL-3.0-or-later

Overview

Sapho is a Rust library and command-line tool for making compound decisions with System One models such as Jev. It splits a decision into simple questions, asks the model each one, and combines the answers with rules you write using operators like and, or, min and max, which can be nested into larger rules. Questions and rules are written as a decision graph in YAML or JSON, and code-computed facts can be mixed in through registered Rust functions.

The README's example decides whether a code change needs closer review: code answers whether the public API changed, Jev answers in one request how likely the change breaks a contract (0.79) and whether tests miss new behaviour (0.61), and the rule needs_review = public_api_changed AND (contract_risk >= 0.7 OR test_gap >= 0.8) returns true with a full trace. Because answers are numbers, changing a threshold re-decides without calling the model again, so recorded answers can be replayed to tune rules against labelled examples. Layered decisions let later or more detailed questions run only when earlier answers are uncertain. A CLM adapter and Claude Code skills are also provided.

What the decision model decides

TypeQuestionAnswers
Yes / noCould this change break an existing contract?—
Yes / noAre important cases missing from the tests?—
ChoiceWhich requirement pattern does this sentence follow?—

How it works

  1. Write a decision graph of questions, thresholds and rules
  2. Code supplies facts; Jev answers model questions in one request
  3. Rules combine thresholded answers into a decision
  4. Keep the trace and replay recorded answers to tune thresholds offline

Strengths

  • Transparent trace of how each decision was made
  • Threshold tuning without new model calls
  • Mixes code facts and model judgments

Caveats

  • AGPL-3.0-or-later licence
  • Rules and thresholds must be designed and validated by you

Getting started

cargo install --path crates/sapho-cli --locked --features jev, set TYPESAFE_API_KEY, then run a decision graph on your input.json.

At a glance

Type
CLI
Status
beta
Language
Rust
Runtime
Rust library and CLI
Has code
yes
License
AGPL-3.0-or-later
Stars
1

Use cases and integrations

How curated lists describe it

  • Compound decisions with System One models like Jev: ask small questions, combine the answers with rules you write in a decision graph. Rust library and CLI.

    wh000wh000/awesome-jev-live

Frequently asked questions

What does Sapho add over calling Jev directly?

A decision graph that combines many small answers and code facts with your own rules, plus a trace and offline replay.

Can I tune thresholds without paying again?

Yes; recorded answers can be replayed with new thresholds.

Does it only work with Jev?

No; it also has a CLM adapter for another decision service.

Related projects

  • Rust CLI and library that asks Jev typed questions via OpenRouter and combines the probabilities with fuzzy-logic rules into decisions.

    CLIbetaRust
  • TypeScript library for typed semantic decisions via Zod schemas or native batches, defaulting to Jev, with confidence-gated policies.

    LibrarybetaTypeScript
  • CLI, MCP server and Claude Code plugin for closed-form yes/no, choice, score and rank decisions via Jev, OpenAI Decisions or Claude.

    MCP serverbetaTypeScript
  • Gives Claude Code, Codex, Pi and OpenCode five typed Jev tools (classify, check, score, rank, ask) plus a skill on when to use them.

    MCP serverbetaTypeScript
  • MCP server exposing Jev Noul, Choice and Score via OpenRouter so coding agents can make quick decisions without reasoning tokens.

    MCP serverbetaTypeScript
  • Natural-language linter combining ast-grep selectors with Jev to catch misleading names, stale comments and tests that miss their claims.

    ProjectbetaTypeScript