What this example does
The runnable example inexamples/vercel-chat/ uses the real Chat SDK and its official Web adapter. A local authenticated chat accepts three commands:
This is explicit save and recall. It does not capture conversations automatically, inject memories into a model, or connect a Slack or Discord account. No model or platform account is required for the local Web workflow.
Tested on macOS with Bun 1.4.4,
chat 4.44.0, @chat-adapter/web 4.44.0 and @chat-adapter/state-memory 4.44.0. Windows and Linux were not tested.
Official references: Chat SDK, Web adapter and authentication, and memory state adapter.
Setup
Use a checkout of Claude-Mem with a running local worker. For testing, use a separate worker/database as described in Development. The demo never starts or configures the worker itself. From the Claude-Mem checkout, install the example’s separate dependencies:37700 + (your user ID % 100), on macOS and Linux. If CLAUDE_MEM_WORKER_PORT is set in ~/.claude-mem/settings.json, use that port instead. Check it with curl -s "$CLAUDE_MEM_WORKER_URL/api/health". The demo has no default and exits if CLAUDE_MEM_WORKER_URL is unset. The worker URL must be a plain http://127.0.0.1:PORT origin without credentials, path or query parameters. The demo listens only on 127.0.0.1. The token must have at least 24 characters and is not printed by the example. Keep it in the environment of your HTTP client too.
The Web adapter’s official getUser callback checks the bearer token and identifies one local owner. The project comes only from CHAT_MEMORY_PROJECT, not from client message fields or thread names. Do not expose this single-owner example as a public or shared application. A deployed application needs its own authenticated user-to-project authorization.
Try the commands
In the same terminal, send a message using the Web adapter’s AI SDK HTTP protocol:data: events. Its text-delta contains the worker’s JSON save receipt. Keep the numeric observation ID.
For later recall, send the same request with a new message ID and text set to search restore snapshots, then get <the returned numeric ID>. The conversation id can also change: saved memory belongs to the configured project and survives chat restarts. Message IDs should be stable for redelivery of the same event and new for a new command.
Only save writes a memory. Plain conversation returns help. Repeated delivery of an identical save uses the worker’s existing transactional sourceFingerprint deduplication. The fingerprint includes the thread, message ID and exact command text. No model is called, and there is no automatic retry after an ambiguous write.
The demo passes its working directory to explicit saves so the worker’s project exclusion check applies. A skipped or unconfirmed save is reported as an error. Existing worker retention and synchronization settings still apply to successfully saved notes.
Repeatable verification
From the Claude-Mem checkout, with the example dependencies installed and current bundles built:Troubleshooting and disconnect
- HTTP 401: ensure the client and server use the same token. No token is sent to the worker.
- Worker error in a
text-delta: an HTTP stream can succeed while the command fails. Inspect the returned JSON forerror; do not treat HTTP 200 alone as a successful save. - Empty retrieval: use the saved numeric ID and the same server-configured project. An ID from another project is intentionally withheld.
- Excluded project: run from the intended directory and check the worker’s exclusion settings. The demo does not override them.
kill "$CHAT_DEMO_PID" in the same terminal to stop the demo process you started. Its chat state is held only in RAM, and message history persistence is disabled. Saved worker memories remain. No Claude, Codex or platform configuration is installed or changed; removing the example dependencies disconnects nothing else.
