Skip to content
The memory layer for AI agents

You should never have to tell it twice.

The memory layer for AI agents. Khwan captures the corrections you give your agent, distils them into standing rules, and hands them back next session. Bring any model — Khwan never calls it.

Model-agnostic · Hosted or on-prem · No credit card to start

Raw LLMs forget every session — turn 1,000 costs the same as turn 1. Khwan remembers what works and turns it into lower cost.

3 calls

the whole loop: prepare → your model → record

0

of your model's tokens metered or marked up by us

The loop

Three calls. Your model in the middle.

You never hand Khwan your model or your key. It prepares the context, you call your own model, and it learns from the answer — so the next run starts sharper than the last.

Read the docs →
agent.ts
import { Khwan } from "@khwan/client";
 
const kw = new Khwan({ apiKey: process.env.KHWAN_API_KEY });
 
// 1 — Khwan builds the context (memory + coherence). No LLM call.
const turn = await kw.prepare(input);
 
// 2 — You call your own model. Your provider, your key.
const answer = await yourModel(turn.messages);
 
// 3 — Hand it back. Khwan persists + learns; next prepare is sharper.
await kw.record(turn, answer);
01

Remembers

One brain per user, across every session. No re-learning the same context on each call.

02

Compounds

Each task builds on what the last one learned, so the brief stays tight — and your model spends fewer tokens on repeat work.

03

Sharpens

A coherence gate checks each response against the agent's written identity before it ships — so behavior stays consistent instead of drifting. A better prompt, not a longer one.

04

Isolated cores

One account, many separate brains — test, staging, per-client. Pick one with a single line; memory never crosses over.

How it works

Wrap your model. Keep the memory.

1

Bring your model.

Khwan wraps it, never replaces it.

2

It remembers as it runs.

Every turn evolves the brain — memory, axes, coherence.

3

It compounds.

Lessons synthesize into lower cost and sharper answers. The longer it runs, the more you save.

Bring your own model

Your agent already has a model. Khwan is the memory it's missing.

Khwan plugs into the agent you already run — it never replaces the model, and never touches your key. Isolated cores give you a separate brain per repo, per client, or per end user, natively.

Claude Code

Live

Over MCP. Claude itself is the model — no key to wire, no provider to trust. Khwan is the memory that survives the session.

$claude mcp add khwan
Install guide

CrewAI

No plugin needed. Prepare in a Flow step before kickoff, verify between the draft and the send, record after.

$prepare → kickoff → record
Wire it up

Also works with OpenAI · open weights · anything you can call

Differentiation

Memory that thinks, not just recalls.

vs. a raw LLM

It forgets every session and never gets cheaper. Khwan remembers and compounds cost down.

vs. memory tools

They store and retrieve. Khwan also synthesizes, gates for coherence, and improves the agent itself.

vs. agent frameworks

Orchestration isn't memory. Khwan is a model-agnostic layer, not a stack you rebuild around.

Fit

Khwan remembers how to work with someone. Not the state of everything.

Memory is retrieved by meaning and ranked by confidence, and synthesis distils corrections into standing rules. That makes it strong at what a person or a project expects of your agent — and weaker than a temporal knowledge graph at tracking a fact that keeps being replaced.

Built for this
  • Preferences — tone, language, format, how much detail
  • Standing rules distilled from corrections you made once
  • Project and codebase context that survives the session
  • A separate brain per customer, repo, or end user
Reach for something else
  • Entity state that changes — “the PM moved from A to B”. Retrieval can still surface A; a knowledge graph invalidates that edge outright. A recorded correction outranks the old fact, but that is weaker than an explicit edge.
  • Point-in-time queries — “who owned this in March”. There is no temporal index to ask.
  • Bulk document search. That is a vector store's job, not a memory layer's.
What synthesis writesreal output

“Always open PRs to stage when suggesting changes, and confirm merges only when the user gives a nod.”

distilled from 23 turnsGET /lessonsDELETE /lessons/{id}

Nobody wrote that rule down. It is not in that repo's CLAUDE.md, or a .cursorrules, or an AGENTS.md — those hold what someone remembered to type. This was derived from 23 turns where it was practised and never stated.

One rule, standing in for 23 turns that no longer have to be re-read. It carries the turns it came from, so you can check the reasoning — and delete it when it is wrong, which stops the agent following it on the very next turn. Retrieval finds what is relevant; this is the part that decides what is worth keeping, and it is the part a vector store does not have.

The overnight pass that produced it read 266 turns across six isolated brains and wrote 14 rules, for $0.011 of model spend — measured, not modelled, on one account's own data.

FAQ

Questions builders ask first.

I already pay for Claude / ChatGPT — why Khwan?
Claude is the brain. Khwan is that brain's long-term memory. You don't pick one — you take the model you already have and make it remember across sessions, people, and time. A chat subscription is for chatting; Khwan is for when you build a product, an agent, or a multi-user system that has to remember. If you just want to chat, you don't need Khwan yet.
Does Khwan run or host my model?
No. Khwan is a pure memory layer — it never calls your model, meters its tokens, or marks it up. The only loop is prepare → your model → record: Khwan builds the context before your call and learns from the answer after. You run any model, your key, and pay your provider directly.
How does it make my agent cheaper?
Synthesis distills what worked into standing lessons, so each prompt gets shorter and sharper instead of re-stuffing context every call — you spend fewer of your own tokens on repeat work as the agent runs. The savings compound the longer it runs; how much depends on how repetitive your workload is.
What is a coherence gate?
A written identity (a constitution) that the agent is held to. Before a response ships, the gate checks it against that identity so behavior stays consistent across long-running sessions instead of drifting.
Can I run it where my data lives?
Yes. Khwan runs hosted, or single-tenant and on-prem for teams with compliance and data-residency requirements. Talk to us about the Scale plan.

Pay for the memory, not the model.

Start free. You bring the model; Khwan is the memory that makes each run cheaper — no tokens metered, no markup.

Run Khwan where your data lives.

On-prem and single-tenant — run your own model where your data lives, with the controls and SLA your security team asks for.

Talk to us →
Token economics

Memory that pays for itself — across sessions

Caching already makes a single session cheap. Khwan's edge is across cold sessions: it recalls only what's relevant instead of reloading your whole memory file every time. Here's when that wins — and, honestly, when it doesn't.

52%
fewer context tokens with Khwan over 12 sessions
Modeled, not measured
Khwan wins
Khwan 24,048 tok
CLAUDE.md 49,800 tok
crossover · session 1
CLAUDE.md — reload whole fileKhwan MCP — bounded recall
2,500 tok

Accumulated decisions, conventions, gotchas — the size of your CLAUDE.md.

300 tok

How much fresh context each session adds (and Khwan stores).

12
3 facts

The server ranks a wider pool and returns its top three — that ceiling is why recall stays bounded however large memory grows.

Back-to-back sessions keep CLAUDE.md cached at ~0.1× — that regime favors CLAUDE.md.

Modeled from measured constants, re-measured 2026-08-25 — the MCP costs ~1,374 tokens in every session (1,074 of tool definitions plus a 300-token instructions block), and the server returns at most three facts per recall. A fact is priced at 110 tokens, the median of real agent turns in a live brain; longer records run to ~385, so the model is optimistic for those. This is arithmetic over those constants for the inputs above, not a measurement of your workload: it counts context tokens, and does not include recall latency or the embedding step. A controlled A/B study is in progress, and no number from it appears here until it has run.

Give your agent a memory that pays for itself.

Start free — feel the compounding before you pay for it. No credit card.