s1-rs
Rust derive layer that turns enums and structs into Choice, Score and Noul questions with compile-checked, confidence-gated answers.
Overview
s1-rs gives Rust typed System One decisions through derive macros. An enum annotated with #[derive(Choice)] or #[derive(Score)] becomes a question with described options or ordered levels, and a struct with #[derive(Questions)] combines several fields, including bool fields as Noul questions, into one request. Answers come back typed, and adding a new enum variant breaks every match that does not handle it.
Confidence gating is built in: a Policy maps confidence onto Verdict::Act, Review or Escalate (for example act at 0.85, review at 0.6), and NoulPolicy handles yes/no bands. Decoding errors are explicit for unknown labels, out-of-range values and missing answers. An s1-test crate provides a FakeClient for network-free tests with scripted answers, while HTTP goes through the published typesafe-rs crate via an optional backend feature. MSRV is Rust 1.85.
What the decision model decides
| Type | Question | Answers |
|---|---|---|
| Choice | Which team should handle this ticket? | Billing · Technical · Sales |
| Score | How frustrated does the customer appear? | Calm · Annoyed · Furious |
| Yes / no | The message conveys urgency or time pressure | — |
How it works
- Derive Choice/Score/Questions on your enums and structs
- s1.ask::<Triage>(&state) via a typesafe-rs backend or FakeClient
- Gate each answer with a Policy into Act, Review or Escalate
- Match exhaustively on the typed verdict
Strengths
- Compile-time exhaustiveness over options
- Built-in act/review/escalate gating
- Network-free tests with FakeClient
Caveats
- Installed from git, not crates.io
- HTTP depends on the separate typesafe-rs crate
Getting started
Add s1 = { git = "https://github.com/AbdelStark/s1-rs", features = ["backend-typesafe-rs"] } and typesafe-rs = "0.1" to Cargo.toml.At a glance
- Type
- Library
- Status
- beta
- Language
- Rust
- Runtime
- Rust library
- Has code
- yes
- Has tests
- yes
Use cases and integrations
How curated lists describe it
Rust derive layer for Choice / Score / Noul, typed question sets, confidence gates, and network-free tests.
AnotiaWang/awesome-decision-modelsTyped System One layer for Rust (Choice/Score/Noul).
hellogumbo/awesome-jev
Frequently asked questions
What does s1-rs add over a plain client?
Derive macros that map Rust types to questions, typed answers, and confidence gating into act/review/escalate.
Can I test without the API?
Yes, s1-test's FakeClient scripts answers in process.
How does it talk to TypeSafe?
Through the typesafe-rs crate with the backend-typesafe-rs feature.
Related projects
Rust CLI and library that asks Jev typed questions via OpenRouter and combines the probabilities with fuzzy-logic rules into decisions.
CLIbetaRustUnofficial standard-library Go client for Jev with generic typed Choice values and local confidence thresholds.
ProjectbetaGoRust CLI for Jev: ask yes/no, choice and rubric questions about text and branch on exit codes, JSON or MCP tools.
MCP serverbetaRustTypeScript library for typed semantic decisions via Zod schemas or native batches, defaulting to Jev, with confidence-gated policies.
LibrarybetaTypeScriptMonitoring proxy and client that records Jev answer probabilities and alerts on version changes, drift, edge crowding or accuracy drops.
ProxybetaPythonComposable Python toolkit for Jev: question builders, confidence gates, batch evaluator, calibration, CLI, MCP server and agent skill.
MCP serverbetaPython