Skip to content
@khwanlabs

khwanlabs

The memory layer for AI agents. Bring any model — Khwan adds long-term memory, self-improving recall, and a coherence gate, and never runs your model.

Khwan — the memory layer for AI agents

You should never have to tell it twice.

Khwan is not a model and does not replace one. It wraps the agent you already run and gives it memory that survives the session, rules distilled from the times you corrected it, and a gate that can refuse an answer before it ships.

The whole contract is three calls:

POST /prepare   → recalled memory + your constitution + a coherence gate   (no model call)
      your model answers                                                    (Khwan is absent)
POST /record    → persist the turn, and learn from it                       (no model call)

Khwan never runs your model and never holds your provider key. There is no hosted chat path in the engine — it produces context, not answers.

The only inference Khwan ever runs is one nightly pass that distils stored turns into standing rules. A real production run: 8 brains, 245 packets → 11 lessons, $0.0094. Memory layers that compress, graph, or consolidate in the background pay a model per turn or per episode. The read and write paths here pay nothing.

Works with

Host Getting started
Claude Code, over MCP claude mcp add khwan · docs
ChatGPT, as a Custom GPT docs — reaches free accounts, no Plus required
CrewAI docs — prepare in a Flow step, verify before the send, record after
Anything else Connect your agent — the pattern, and the rules an integration has to follow

Repositories here

khwan-client-python Python SDK — pip install khwan
khwan-client-ts TypeScript SDK — npm i @khwan/client
khwan-mcp MCP server — uvx khwan-mcp
khwan-crewai CrewAI integration — recall/remember/verify as tools
khwan-chat A reference chat app built on the loop

All MIT. The hosted engine is closed; everything that runs on your machine and touches your data is not.

Memory you can audit

Synthesis distils your corrections into standing rules. Retrieval only ever reinforces a rule — a wrong one that stays relevant would be renewed forever — so every rule is listable, traceable to the turns it came from, and deletable:

for l in kw.lessons():
    print(l["response_text"], "←", l["source_link"])
kw.delete_lesson(bad_id)

What it is good at, and what it is not

Retrieval is by meaning, ranked by confidence. That makes Khwan strong on preferences, standing rules, and project context that has to survive the session — per person, per repo, per customer.

It is weaker than a temporal knowledge graph at tracking an entity whose state keeps changing, and it has no point-in-time index. The architecture page says which is which, including a section on where it is weak.

Reading this as an agent

The documentation is published as text, not only as HTML — a rendered docs page is about 3% prose by weight, and the navigation renders before the content.

https://docs.khwan.ai/llms.txt        index of every page, one line each
https://docs.khwan.ai/llms-full.txt   all of it in one fetch
https://docs.khwan.ai/quickstart.md   Markdown source of any page — append .md

Khwan (ขวัญ) is Thai: the essence that inhabits a body without being it. It is not the Qwen model family.


khwan.ai · docs · dashboard

Popular repositories Loading

  1. khwan-client-python khwan-client-python Public

    Khwan Python client (pip) — hosted, BYOM

    Python

  2. khwan-client-ts khwan-client-ts Public

    Khwan TypeScript client (npm)

    TypeScript

  3. khwan-chat khwan-chat Public

    Reference chat app built on the Khwan loop — prepare → your model → record, with the answer-gate wired in

    TypeScript

  4. .github .github Public

    Organization profile for khwanlabs

  5. khwan-crewai khwan-crewai Public

    Khwan memory for CrewAI — recall/remember/verify as tools, and a prepare→record wrapper around a crew run

    Python

  6. khwan-mcp khwan-mcp Public

    Durable memory for Claude Code and any MCP client — a brain per project, corrections captured as they happen, distilled overnight. Zero model calls at runtime.

    Python

Repositories

Showing 6 of 6 repositories

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…