What is TypeSafe.ai? I’m considering this plan:...

------ Chat Conversation ------

User: What is TypeSafe.ai? I’m considering this plan:

AVENTURE BACK-END · ISSUE #2374 · TYPESAFE SYSTEM ONE / JEV
Typed Decision Slice
One data-class file, one endpoint method on the existing inference controller, one service method on the existing inference service. The generator, the catalog YAML, and the provider adapter do not change.

1. The chain, and the one place it grows

NEW
domain/model/inference/Decision.kt
InferenceController + decisions()
InferenceService + decide()
docs/mcp/api-endpoints.md +1 line
springdoc
/v3/api-docs
make docs-local
postman/openapi.json
api-schemas (Zod)
generator-policy.mjs, unchanged
MCP + aventure-cli
build-mcp.ts, unchanged
callers
aventure-cli inference
decisions create
--from-file q.json
skills: enrich / mutate
EXISTING, reused as-is
InferenceService.dispatchChatCompletion · ChatResponseFormat(jsonschema, strict) · gateway default-chat-model
Confidence enum · --from-file reader · x-aventure-tool cli naming · Jev later = a gateway route
NEEDED ALREADY OWNED BY EVIDENCE
Strict JSON-schema answer decoded into a typed Kotlin verdict ChatResponseFormat, ChatJsonSchema, ChatObjectSchema, ChatStringSchema(enumValue) application/usecase/job/support/ChatResponseFormat.kt:8-39; used by EntityClosureSweepAdjudicator.kt:141-151, BlogPostIngestAdjudicator.kt:113-116, RssNewsLinkerLlm.kt:167
Provider-neutral dispatch with model override InferenceService.dispatchChatCompletion application/usecase/inference/InferenceService.kt:70; model precedence AppInferenceProperties.kt:161
A default model that supports strict jsonschema app.inference.profiles.llm-gateway.default-chat-model: qwen3.8-27b, already required to application-domain.yml:1708-1723
Confidence that licenses an action, with "abstain at LOW" documented Confidence { HIGH, MEDIUM, LOW }, exported domain/model/confidence/Confidence.kt:14-28
CLI body input, JSON output, noun/verb naming --from-file reader; x-aventure-tool.cli on the @Operation mcp/aventure-cli/commands/json-input.ts:16-30; InferenceController.kt:74-75
Callers that hold the dossier skill steps and harness runs already call generated CLI operations aventure-enrich §0.2 Phase 1; §0.2.1.2
2. Minimum schema

One primitive, Choice. Every slice-1 decision is a choice; yes/no is two options. That removes any need for a oneOf union. Lives in the existing domain/model/inference package.

// domain/model/inference/Decision.kt
@Schema(name = "DecisionQuestion", description = "One choice question over a bounded state; option keys are the closed answer set.")
data class DecisionQuestion(
 @field:Schema(description = "Caller-owned key naming the decision, e.g. entity.typeRecord.structuralRole. Opaque to the server.")
 val decisionKey: String,
 @field:Schema(description = "State the model judges: dossier excerpt as text or JSON text.")
 val state: String,
 @field:Schema(description = "The question, phrased so exactly one option answers it.")
 val instruction: String,
 @ArraySchema(arraySchema = Schema(description = "Closed answer set."), minItems = 2, maxItems = 255)
 val option: List,
 @field:Schema(description = "Gateway model id override; null uses the profile default chat model.")
 val model: String? = null,
)

@Schema(name = "DecisionOption", description = "One answer key and what it means.")
data class DecisionOption(val key: String, val description: String)

@Schema(name = "Decision", description = "Typed answer with its full probability distribution. confidence LOW means abstain.")
data class Decision(
 val decisionKey: String,
 @field:Schema(description = "Chosen option key; always one of the request's option keys.")
 val choice: String,
 @ArraySchema(arraySchema = Schema(description = "One row per option key, normalised to sum to 1."))
 val probability: List,
 @field:Schema(description = "HIGH licenses an automatic write, MEDIUM a reviewed write, LOW abstains.")
 val confidence: Confidence,
 @ArraySchema(arraySchema = Schema(description = "Short factual phrases from the state that support the choice."))
 val evidence: List,
 @field:Schema(description = "Resolved gateway model id.")
 val model: String,
 @field:Schema(description = "Provider round-trip in milliseconds.")
 val latencyMs: Long,
)

@Schema(name = "DecisionProbability", description = "Probability mass on one option key.")
data class DecisionProbability(val key: String, val probability: Double)
Generated, unchanged generator
// api-schemas/inference/decision.ts
export const DecisionSchema = z.object({
 decisionKey: z.string(),
 choice: z.string(),
 probability: z.array(DecisionProbabilitySchema),
 confidence: ConfidenceSchema,
 evidence: z.array(z.string()),
 model: z.string(),
 latencyMs: z.number().int(),
});
Called
aventure-cli inference decisions create \
 --from-file q.json --data

{ "decisionKey": "entity.typeRecord.structuralRole",
 "state": "",
 "instruction": "Which structural role does this entity play?",
 "option": [
 {"key":"Company","description":"Raises rounds, sells products or services"},
 {"key":"InvestmentFirm","description":"Its own primary activity is deploying capital"},
 {"key":"Fund","description":"A pooled vehicle managed by an investment firm"},
 {"key":"Government","description":"Public-sector agency, regulator, or program"} ] }
Company
0.91
InvestmentFirm
0.06
Fund
0.02
Government
0.01
confidence = HIGH → the skill writes typeRecord. Example values.
Jev mapping, no adapter
AVENTURE JEV POST /V1/SYSTEMONE
state / decisionKey / instruction state / question id / questions[id].instructions
option[].key, description questions[id].criteria map, type: "choice", ≤255 keys
choice / probability[] / confidence answers[id].choice / .probabilities (sum 1) / .confidence 0–1
model "jev-latest"
When the gateway exposes jev-latest as a chat route, the caller passes it as model. Back-end code does not change. Jev: $0.042/MTok input, output free, early access as of 2026-09-15.

3. What was cut, and why

REMOVED REASON
Separate DecisionController + DecisionService Existed only to stay under the 500-line file cap. The endpoint is an inference operation; it belongs on InferenceController / InferenceService next to chat completions create.
Pinned model slot (InferenceModelSlot, STRUCTUREDOUTPUTS check) The profile default already has to support strict jsonschema (application-domain.yml:1708-1713). An override that cannot is rejected by the gateway and surfaces as the existing provider failure.
Confidence thresholds YAML (0.85 / 0.60) + banding code The three existing adjudicators have the model report the Confidence band inside the schema. Same here: zero config, zero code. ponytail: self-reported band; derive from the distribution once a calibrated provider (Jev) is routed.
input-char-limit, max-token config Request size and serving limits are already enforced by Spring and the gateway.
New docs/domain-contracts/decision.md The route lint accepts one line in the existing docs/mcp/api-endpoints.md.
decisionSchemaVersion, separate abstention fields, Score/Noul, audit table, Jev adapter No reader today. Abstention is LOW; the envelope in the run ledger is the audit record; Jev is a gateway route.
4. Build order

Decision.kt as above.
InferenceService.decide(question): ChatResponseFormat(ChatJsonSchema("decision", ChatObjectSchema(properties = {choice: enum(keys), probability: array, confidence: enum(Confidence), evidence: array}, required = all))); dispatch; normalise the vector; reject choice ∉ keys or a missing key as InferenceFailure.providerInvalidJson (503), as EntityClosureSweepAdjudicator.invalidProviderJson does.
InferenceController: POST /v1/inference/decisions, x-aventure-visibility private, x-aventure-tool cli = "inference decisions create", admin key like the sibling operations. One line in docs/mcp/api-endpoints.md.
make docs-local; commit generated Zod, MCP, CLI with the source.
One service test on a canned provider body: valid answer decodes; out-of-set choice throws; missing key throws.
5. Enrichment wiring

The dossier lives in the skill run, so each decision is a skill step reading one band.

DOMAIN DECISIONKEY STEP HIGH MEDIUM LOW
Entity entity.typeRecord.structuralRole aventure-enrich §0.2 Phase 1, before entities update --type-record write keep current, ledger abstain, ledger
Person person.association.isCurrent aventure-mutate §6 step 5a association rows write write, endDate null, ledger skip row
News news.article.material news.discovery "material" floor in aventure-completion §1 count join, do not count do not join
A 503 from the provider path means the step falls through to today's rule text, which is the "existing behavior intact" acceptance line at no cost.

Self-reported confidence is uncalibrated. Do not let any decision write unattended until replayed envelopes have been scored against adjudicated answers.

Assistant: ### What TypeSafe.ai Is

TypeSafe AI builds specialized System One models designed explicitly for programmatic decision-making in software back-ends rather than conversational text generation. Their flagship model, Jev, bypasses token-by-token generation entirely to return direct, typed discrete outputs with calibrated probabilities and confidence scores, running significantly faster and cheaper than general-purpose frontier LLMs typesafe.ai.

---

### Plan Evaluation: Aventure Back-End Issue #2374

The proposed architecture is exceptionally lean, practical, and well-sequenced. It establishes a contract-first abstraction using your existing chat completion gateway today, leaving zero friction when routing directly to Jev later.

#### Key Strengths
- Zero-Waste Abstraction: Reusing InferenceService.dispatchChatCompletion with strict jsonschema gives you the exact target interface (Choice, probability, confidence, evidence) without writing disposable provider adapters.
- Contract Symmetry with Jev: The DecisionQuestion and Decision schemas directly map to Jev’s POST /v1/systemone format (criteria map, choice, probabilities), turning future Jev adoption into a simple gateway model-route addition.
- Sensible Scope Pruning: Cutting pinned model slots, separate controllers, and ad-hoc threshold YAML keeps changes confined to a single clean slice while honoring your 500-line file cap.
- Graceful Degradation: Treating provider failures (503s or non-conforming JSON) as an automatic fall-through to existing rule logic guarantees backward compatibility during rollout.

#### Considerations & Failure Modes

| Area | Observation | Recommendation |
| :--- | :--- | :--- |
| Probability & Confidence | Standard chat models (qwen3.8-27b) generate pseudo-probabilities and uncalibrated self-confidence via JSON schema text. | Treat generative probabilities as heuristic rankings until a true classifier like Jev routes the response. |
| Schema Normalization | LLMs occasionally fail strict floating-point sums to 1.0 or hallucinate invalid distribution floats. | Ensure your Kotlin deserializer or domain service normalizes the probability array so $\sum p = 1.0$ unconditionally. |
| Evidence Grounding** | Chat models may hallucinate citations not present in the dossier. | Keep evidence optional or validate substring presence in state during replay auditing. |

The execution order and fall-through mechanics are solid; proceeding with the Decision.kt slice and canned provider unit tests is safe to implement.

Working notes:
- Check what TypeSafe.ai and Jev System One are in 2026.

Sources:
- Introducing System One Models and Jev: https://typesafe.ai/blog/introducing-system-one-models-and-jev (search result only)
- TypeSafe AI: Home: https://typesafe.ai/ (search result only)
- Introducing System One Models and Jev: https://news.ycombinator.com/item?id=49717558 (search result only)
- Jev skips token generation entirely, and the speed...: https://daily.dev/posts/jev-skips-token-generation-entirely-and-the-speed-numbers-are-hard-to-ignore-nv8tizgl7 (search result only)
- TYPESAFE AI LAUNCHES JEV, ITS FIRST “SYSTEM ONE ...: https://x.com/wallstengine/status/2099927802405654900 (search result only)

User: And do they have documented procedures for using / creating cli and mcp servers?

Assistant: TypeSafe AI does not publish prescriptive official manuals or formal guides for creating CLI tools or Model Context Protocol (MCP) servers.

Instead, they treat Jev as a hosted decision API and leave CLI and MCP implementations to ecosystem integrations jevtypesafeai.com:

 Model Context Protocol (MCP): Official materials highlight open community connectors like jev-mcp rather than documenting internal server construction patterns jevtypesafeai.com. Community servers expose tools such as askjev and listjevmodels directly to agents in environments like Claude Code and Codex without added dependencies aiskill.market.
 Command-Line Interfaces (CLI):** TypeSafe AI provides no dedicated CLI documentation or first-party CLI client. Standard agent-ready CLI patterns rely on general command design: non-interactive invocation, file inputs, and structured outputs mcp.so.

Generating your own CLI commands and MCP surfaces from your internal OpenAPI specification mirrors standard ecosystem practice and avoids depending on unverified vendor-specific tooling.

Working notes:
- Investigate TypeSafe.ai documentation, GitHub, and procedures for CLI tools and Model Context Protocol (MCP) servers.
- Find details on jev-mcp and whether TypeSafe provides explicit CLI or MCP server documentation or packages.
- Check medium article explaining open source projects around Jev, particularly jev-mcp and CLI/MCP tooling.
- Scrape aiskill market entry for jev-mcp to see the standard conventions and procedures.

Sources:
- modelcontextprotocol.io: https://modelcontextprotocol.io/docs/2026-07-28/getting-started/intro (fetched/scraped page)
- mcpmarket.com: https://mcpmarket.com/es/server/claude-cli (fetched/scraped page)
- jevtypesafeai.com: https://jevtypesafeai.com/decide?demo=model-routing (fetched/scraped page)
- aiskill.market: https://aiskill.market/skills/jev-mcp-codeia-academy (fetched/scraped page)
- mcp.so: https://mcp.so/cli (fetched/scraped page)
- CLI Engage: https://public.cliengage.org/ (search result only)
- Online Dance Conservatory | Pre-Professional Training | CLI ...: https://www.clistudios.com/ (search result only)
- philschmid/mcp-cli: Lighweight CLI to interact with ...: https://github.com/philschmid/mcp-cli (search result only)
- Model Context Protocol: https://en.wikipedia.org/wiki/Model_Context_Protocol (search result only)
- Exposing a CLI as an MCP tool in standard-library Go: https://dev.to/muhammetsafak/exposing-a-cli-as-an-mcp-tool-in-standard-library-go-faa (search result only)
- cli package - gitlab.com/phpboyscout/go/mcp/cli: https://pkg.go.dev/gitlab.com/phpboyscout/go/mcp/cli (search result only)
- I Built a CLI That Gives Your LLM Accurate Library Docs: https://dev.to/vedanthb/i-built-a-cli-that-gives-your-llm-accurate-library-docs-no-mcp-server-needed-47g (search result only)
- TypeSafe AI Releases Jev: A System One Model That ...: https://www.reddit.com/r/AIDeveloperNews/comments/1wku8xe/typesafe_ai_releases_jev_a_system_one_model_that/ (search result only; fetch failed)
- Try the System One model & API - Jev by TypeSafe AI: https://jevtypesafeai.com/decide/?demo=context-compaction (search result only)
- Try the System One model & API - Jev by TypeSafe AI: https://jevtypesafeai.com/decide?demo=extraction (search result only)
- Jev -A Complete Guide to TypeSafe's “System One” Model: https://medium.com/@koustubharole9/jev-a-complete-guide-to-typesafes-system-one-model-83546d4aba12 (search result only)
- jev_triage by Axiumine: https://glama.ai/mcp/servers/Axiumine/jev-claude-code (search result only)
- Jev MCP in Opencode : r/opencodeCLI: https://www.reddit.com/r/opencodeCLI/comments/1wm3mg7/jev_mcp_in_opencode/ (search result only)
- 10 Best Open-Source Projects Built with Jev - Arvind Singh: https://arvindsiingh.medium.com/10-best-open-source-projects-built-with-jev-5069943598cf (search result only; fetch failed)
- Ashfaqbs/jev-mcp-spring — GitHub trending stats & insights: https://trendshift.io/repositories/250598 (search result only)


------ Research Draft Summary ------

# TypeSafe AI and the Aventure Typed Decision Slice

TypeSafe AI builds “System One” models for automated decisions inside software, but it publishes no official manuals or specifications for building custom CLI tools or Model Context Protocol (MCP) servers [typesafe.ai](https://typesafe.ai/) [jevtypesafeai.com](https://jevtypesafeai.com/decide?demo=model-routing). Aventure's internal typed-choice contract fits Jev's stated purpose, but client and protocol tooling remains open ecosystem work rather than vendor-documented standard procedure [daily.dev](https://daily.dev/posts/jev-skips-token-generation-entirely-and-the-speed-numbers-are-hard-to-ignore-nv8tizgl7) [jevtypesafeai.com](https://jevtypesafeai.com/decide?demo=model-routing).

## TypeSafe AI and Jev

Jev is a hosted decision model accessible over an API to replace token-by-token generative text with structured, calibrated values [jevtypesafeai.com](https://jevtypesafeai.com/decide?demo=model-routing). TypeSafe AI claims the architecture executes System One tasks two orders of magnitude faster than conventional LLMs [typesafe.ai](https://typesafe.ai/blog/introducing-system-one-models-and-jev).

Secondary reports confirm Jev returns typed choices with probabilities and confidence scores [daily.dev](https://daily.dev/posts/jev-skips-token-generation-entirely-and-the-speed-numbers-are-hard-to-ignore-nv8tizgl7). The model operates strictly on hosted TypeSafe AI infrastructure rather than local runtimes [jevtypesafeai.com](https://jevtypesafeai.com/decide?demo=model-routing).

## CLI and MCP Server Ecosystem

TypeSafe AI provides no documented internal guidelines or first-party client implementations for creating CLIs or MCP servers [jevtypesafeai.com](https://jevtypesafeai.com/decide?demo=model-routing). Instead, TypeSafe AI points to open community projects:

- **Ecosystem projects**: TypeSafe AI acknowledges open tools including `awesome-jev`, `jev-mcp`, and LangChain integrations, while keeping the model itself closed and hosted [jevtypesafeai.com](https://jevtypesafeai.com/decide?demo=model-routing).
- **MCP server integrations**: Community implementations such as `jev-mcp` expose tools like `ask_jev` and `list_jev_models` directly to agent environments including Claude Code, Codex, and Hermes [aiskill.market](https://aiskill.market/skills/jev-mcp-codeia-academy).
- **CLI status**: No first-party Jev CLI client exists, leaving command-line interactions to generic agent CLI patterns that emphasize non-interactive flags, structured input and output, and parseable exit codes [mcp.so](https://mcp.so/cli).

## Fit with the proposed architecture

A provider-neutral `Choice` contract protects Aventure from relying on undocumented vendor client tooling:

- Add `DecisionQuestion`, `DecisionOption`, `Decision`, and `DecisionProbability`.
- Add `POST /v1/inference/decisions` to the existing inference controller.
- Dispatch through the existing inference service and strict JSON-schema response path.
- Preserve the model override for future routing.
- Generate the existing OpenAPI-derived Zod, MCP, and CLI artifacts internally without changing generators.
- Fall back to existing rules when the provider fails or returns an invalid answer.

No cited source confirms that Jev exposes standard chat-model endpoints or that `jev-latest` functions through existing model gateways without custom translation.

## Contract safeguards

Model outputs must not be treated as calibrated probabilities or authorization tokens without validation:

- Reject choices missing from the request's option set.
- Reject duplicate, missing, or unexpected probability keys.
- Reject non-finite, negative, or all-zero probability distributions.
- Reject missing evidence or confidence payloads.
- Treat `LOW` confidence as an explicit abstention signal.
- Prohibit `MEDIUM` and `HIGH` confidence from executing automatic mutations prior to replay calibration.

## Rollout

Adopting the typed contract does not require activating third-party execution:

1. Deploy the typed endpoint behind existing authorization checks.
2. Log raw provider responses, normalized outcomes, model identifiers, and latencies.
3. Shadow-run incoming traffic against adjudicated test suites.
4. Evaluate calibration and error distribution by decision key.
5. Establish operational mutation policies only after verifying reliability.
6. Connect external providers such as Jev only after public API specifications and schemas are verified.

## What would sharpen this

- Official TypeSafe AI API reference docs detailing endpoint paths, request payloads, authentication, and error formats.
- Verified pricing terms confirming the claimed `$0.042/MTok` input price and free output tier.
- Published calibration data validating whether returned probabilities reflect true empirical frequencies.
- Protocol specifications showing whether official first-party MCP tools or CLI packages are planned.

## Related questions

- Does TypeSafe AI plan an official MCP server package or maintain community repositories directly?
- What schema does the `ask_jev` tool accept in the community `jev-mcp` packages?
- What payload format does Jev's hosted HTTP API expect for custom decision options?
- Can existing OpenAPI-to-MCP generation pipelines fully satisfy Jev tool definitions without custom adapters?