Skip to Content
ChatGPT (Custom GPT)

ChatGPT (Custom GPT)

Use Khwan as durable memory inside ChatGPT — on the web, free tier included. Khwan never runs a model; in ChatGPT, ChatGPT is the model. Khwan is the memory it forgets between chats. Each person signs in with their own account, so memories are isolated per user.

Free ChatGPT accounts can use a published Custom GPT (they just can’t build one). MCP connectors need Plus/Pro — a Custom GPT + OAuth Action does not, which is why this path reaches free users.

For users

  1. Open the Khwan GPT on chatgpt.com  (works in any browser).
  2. The first time it needs memory, a “Sign in to Khwan” button appears — click it, authorize once, and you’re back in the chat.
  3. That’s it. Ask things; Khwan quietly recalls what matters and remembers new facts. The same brain follows you into the dashboard  and any other host you connect (it’s linked by your verified email).

The loop

Under the hood the GPT runs Khwan’s pure-memory loop — the same one as every other host (see Bring Your Own Model):

  • prepareTurn(input) → memory-grounded context for your message. No LLM call.
  • ChatGPT answers, grounded in that context.
  • recordAnswer(turn_token, answer) → Khwan persists + learns; the next prepare is sharper. Always pass the exact turn_token back — never invent one.

For operators — publishing the GPT

Setting this up yourself. The only moving parts are a managed IdP (for per-user OAuth) and the GPT itself; the engine change is minimal.

Configure the IdP (WorkOS AuthKit)

Khwan uses WorkOS AuthKit  as the OAuth 2.1 authorization server (free to ~1M MAU; Auth0 works as a fallback).

  • Create an OAuth Application (third-party) → note the Client ID + Secret.
  • Enable Google + email/passwordless login, and the offline_access scope (refresh).
  • In the JWT template, include email and email_verified — Khwan links a user’s ChatGPT and dashboard logins by verified email, so both reach one brain.
  • Note the Issuer, JWKS URL, and (optionally) Audience.

Point the engine at the IdP

Set on the engine (absent → the OAuth path is simply disabled):

KHWAN_OIDC_ISSUER=https://your-tenant.workos.com KHWAN_OIDC_JWKS_URL=https://your-tenant.workos.com/oauth2/jwks KHWAN_OIDC_AUDIENCE=khwan-api # optional; verified only when set

The engine then accepts the IdP’s access token as Authorization: Bearer <jwt>, verifies it offline against the JWKS, and auto-provisions a free account per user.

Build the Custom GPT

  • In the GPT editor, add an Action and paste chatgpt-action.yaml (prepare / record / memory, trimmed for ChatGPT).
  • Set Authentication → OAuth: paste the Client ID/Secret, the Authorization URL (…/oauth2/authorize), Token URL (…/oauth2/token), and scope khwan.memory.
  • Give it these instructions:
You have durable memory via Khwan. At the start of a task, or whenever you need a fact that may have come up before, call prepareTurn(input) and ground your answer in the returned context. After you answer, when a durable fact, preference, or decision emerges, call recordAnswer(turn_token, answer) using the EXACT turn_token from the matching prepareTurn — never invent one. Do not put secrets, passwords, or sensitive personal data into memory.

Publish

Verify the khwan.ai domain in your OpenAI builder profile, then publish. GPTs with OAuth actions are usually reviewed by OpenAI, so allow a little lead time.

Privacy. A public free GPT invites strangers. Keep prod rate limiting on (KHWAN_REDIS_URL), and cap the synthesis cost of auto-provisioned free accounts with KHWAN_FREE_SYNTHESIS_DISABLED=1 (or leave free on its weekly cadence). Tell users, in the consent screen, not to store sensitive personal data.

Last updated on