Try it
Copy the code ↓- Data source
- Decision schema
- Model inference
- Structured result
2 Decision schema 3 typed questions
memory_typechoicepreferencefacttask_stateepisodediscardimportancescoretrivialusefulimportantcriticalsensitivenoulprobability 0–1
3 Model inference typesafe/jev-1.13
Waiting for a run.
4 Structured result
Raw JSON
Run the demo to see the JSON answers, the highlighted pick and the final action.
FLATKEY_API_KEY and run.curl -sS https://router.flatkey.ai/api/alpha/decisions \
-H "Authorization: Bearer $FLATKEY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "typesafe/jev-1.13",
"state": "Turn 14, billing assistant. User: \"Please stop emailing me invoices, just put them in the dashboard. Also my card ending 4242 expires next month.\" Proposed memory: user prefers dashboard-only invoices; card 4242 expires next month.",
"questions": {
"memory_type": {
"type": "choice",
"instructions": "What kind of memory is this, if any?",
"criteria": {
"preference": "A stable user preference or instruction about how to be served",
"fact": "A durable fact about the user, their account or their world",
"task_state": "Progress on an ongoing task that matters for the next steps",
"episode": "A one-off event worth recalling briefly, not a lasting fact",
"discard": "Small talk, repetition or nothing worth storing"
}
},
"importance": {
"type": "score",
"instructions": "How much would forgetting this hurt future conversations?",
"criteria": [
"trivial",
"useful",
"important",
"critical"
]
},
"sensitive": {
"type": "noul",
"instructions": "Contains payment details, credentials, health or other personal data that must not be stored as-is."
}
}
}'// Node.js 18+ (built-in fetch). Run: FLATKEY_API_KEY=... node jev.mjs
const body = {
"model": "typesafe/jev-1.13",
"state": "Turn 14, billing assistant. User: \"Please stop emailing me invoices, just put them in the dashboard. Also my card ending 4242 expires next month.\" Proposed memory: user prefers dashboard-only invoices; card 4242 expires next month.",
"questions": {
"memory_type": {
"type": "choice",
"instructions": "What kind of memory is this, if any?",
"criteria": {
"preference": "A stable user preference or instruction about how to be served",
"fact": "A durable fact about the user, their account or their world",
"task_state": "Progress on an ongoing task that matters for the next steps",
"episode": "A one-off event worth recalling briefly, not a lasting fact",
"discard": "Small talk, repetition or nothing worth storing"
}
},
"importance": {
"type": "score",
"instructions": "How much would forgetting this hurt future conversations?",
"criteria": [
"trivial",
"useful",
"important",
"critical"
]
},
"sensitive": {
"type": "noul",
"instructions": "Contains payment details, credentials, health or other personal data that must not be stored as-is."
}
}
};
const res = await fetch("https://router.flatkey.ai/api/alpha/decisions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.FLATKEY_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});
if (!res.ok) throw new Error(`Jev request failed: ${res.status} ${await res.text()}`);
const { answers, usage } = await res.json();
console.log(JSON.stringify(answers, null, 2), usage);# Python 3.8+ (pip install requests). Run: FLATKEY_API_KEY=... python jev.py
import json, os, requests
body = json.loads(r"""{
"model": "typesafe/jev-1.13",
"state": "Turn 14, billing assistant. User: \"Please stop emailing me invoices, just put them in the dashboard. Also my card ending 4242 expires next month.\" Proposed memory: user prefers dashboard-only invoices; card 4242 expires next month.",
"questions": {
"memory_type": {
"type": "choice",
"instructions": "What kind of memory is this, if any?",
"criteria": {
"preference": "A stable user preference or instruction about how to be served",
"fact": "A durable fact about the user, their account or their world",
"task_state": "Progress on an ongoing task that matters for the next steps",
"episode": "A one-off event worth recalling briefly, not a lasting fact",
"discard": "Small talk, repetition or nothing worth storing"
}
},
"importance": {
"type": "score",
"instructions": "How much would forgetting this hurt future conversations?",
"criteria": [
"trivial",
"useful",
"important",
"critical"
]
},
"sensitive": {
"type": "noul",
"instructions": "Contains payment details, credentials, health or other personal data that must not be stored as-is."
}
}
}""")
res = requests.post(
"https://router.flatkey.ai/api/alpha/decisions",
headers={"Authorization": f"Bearer {os.environ['FLATKEY_API_KEY']}"},
json=body,
timeout=60,
)
res.raise_for_status()
data = res.json()
print(json.dumps(data["answers"], indent=2), data.get("usage"))
No Flatkey key yet? Get one for Jev 1.13 →
About this use case

Who / when
Audience
- agent builders whose memory store fills with noise and stale facts
- assistant teams that must keep personal data out of long-term memory
- platform teams adding budgets and audit trails to agent memory
Triggers
- every turn, the agent proposes a new memory to store
- long-term memory is polluted with small talk and one-off details
- memories can contain card numbers, secrets or health details
- an LLM call per memory write is too slow or too expensive
The workflow
- 01Candidate memoryProposed note plus turn contextInput
- 02Choicepreference / fact / task / episode / discardJev
- 03Score + NoulImportance, sensitive-data flagJev
- 04Code gateWrite, redact, expire or dropYour code
Question shape
{
"memory_type": {
"type": "choice",
"instructions": "What kind of memory is this, if any?",
"criteria": {
"preference": "A stable user preference or instruction about how to be served",
"fact": "A durable fact about the user, their account or their world",
"task_state": "Progress on an ongoing task that matters for the next steps",
"episode": "A one-off event worth recalling briefly, not a lasting fact",
"discard": "Small talk, repetition or nothing worth storing"
}
},
"importance": {
"type": "score",
"instructions": "How much would forgetting this hurt future conversations?",
"criteria": [
"trivial",
"useful",
"important",
"critical"
]
},
"sensitive": {
"type": "noul",
"instructions": "Contains payment details, credentials, health or other personal data that must not be stored as-is."
}
}Gate policy
≥ 0.90
Write to the chosen store; code sets the expiry.
0.65–0.90
Write to short-term memory only; redact flagged details.
< 0.65
Don't write. Keep it in the transcript only.
Failure modes
Pre-launch checks before you trust auto-routing:
- Two memories in one proposal (a preference plus a payment detail);
- Temporary states stored as permanent facts ("I'm in Berlin this week");
- Sensitive data hidden in casual wording or partial numbers;
- Contradictions with memories already stored;
- Prompt injection that asks the agent to remember instructions;
FAQ
What does "typed memory" mean?
Dark Factor's summary of four production papers (post below) describes putting memory under control: typed writes, routed reads and a budget for every query, with the expensive model waking only for synthesis. It reports memory builds 6.6× faster and queries taking 0.93 s. This page covers the write side.
What about reads?
Use the same idea at query time: a Choice picks which store to read (preferences, facts, task state or none), code enforces a per-query budget, and only then does a larger model synthesize an answer from what came back.
Why not let the agent's LLM decide what to remember?
It works, but every write becomes another generation call, and the decision is buried in prose. A typed answer with a probability is cheap, auditable and easy to gate, and a sensitive-data flag can block the write before anything is stored.
Can I bring my own API key?
Yes. Try the free demo above without signing in. To run it live on your own text, sign in with Google and connect a Flatkey or OpenRouter key (a quick test call runs when you save it). Manage or delete it anytime under Dashboard → BYOK. Keys are stored encrypted on the server, used only for runs you trigger, and never sent back to the browser. Need a Flatkey key? Get one for Jev 1.13 on Flatkey.
Is this the official TypeSafe Jev product page?
No. jev-llm.com is an independent research and practice site. Verify pricing, models and terms at the original TypeSafe sources.
Sources
4 papers just showed how to use Jev in 4 completely different production systems … this is a 7-step blueprint on how to move judgment off the LLM and make any AI system faster, cheaper and easier to audit … step 6 → put memory under control: typed writes, routed reads and a budget for every query. the expensive model wakes up only for synthesis. memory build is 6.6× faster and queries take 0.93 s
— @DarkFactorr View the post on X →
Wire this gate with your own key
Bring your own key through Flatkey / OpenRouter. Keep exact checks in code.