OpenClaw
OpenClaw is a personal-agent gateway: one agent, reachable over WhatsApp, Telegram, Discord, Slack, Signal, iMessage and 15+ other channels. The catch with multi-channel agents is that memory usually fragments per channel. Korely fixes that: one SDK integration in your gateway's agent code and the agent carries the same memory into every conversation, no matter where you message it from. Your notes, your facts, your graph. Tell it something on Telegram, ask about it on Slack, it knows.
The connection uses the korely-memory Python SDK inside
OpenClaw's agent runtime. No plugin, no glue code beyond a standard
pip install and a kor_live_ API key.
Requirements
OpenClaw v2026.6.1 or newer. The agent hook API used
below requires v2026.6.1. Check with openclaw --version and
upgrade if you're behind.
You also need a Korely API key. Get one free — the hobby tier is free and no credit card is required. Install the SDK in the Python environment OpenClaw uses:
pip install korely-memorySetup
Set your API key as an environment variable on the machine running your gateway, then wire the Korely client into OpenClaw's agent hook:
export KORELY_API_KEY=kor_live_...# openclaw_agent.py — agent hook (Python runtime)from korely_memory import Korely
korely = Korely() # reads KORELY_API_KEY from env
def before_turn(user_id: str, message: str) -> str: """Fetch memory context before the agent generates a reply.""" ctx = korely.get_context(query=message, user_id=user_id, token_budget=800) return ctx.context # fact-assembled recall: active typed facts + relevant memories
def after_turn(user_id: str, agent_reply: str) -> None: """Persist notable agent output as a memory.""" korely.add(agent_reply, user_id=user_id, agent_id="openclaw")Example session: WhatsApp
Here is what the connection looks like in practice. You message your
agent on WhatsApp, the agent calls korely.get_context before
answering, and replies with your own context.
You › When is my lease renewal due, and what did the landlord
say about the rent?
# agent calls get_context before generating a reply
→ korely.get_context(query="lease renewal landlord rent", user_id="whatsapp:+39...")
← context string returned by get_context:
"Lease renewal call with Anna (2026-05-28): Renewal deadline is
July 1. Anna confirmed a 3% increase, 1,200 to 1,236 EUR per
month starting August. She wants the signed copy by post.
Apartment documents checklist (2026-04-12): Lease, insurance
certificate, meter readings, deposit receipt..."
Agent › Your lease renewal is due July 1. On the May 28 call Anna
confirmed a 3% increase, 1,236 EUR per month starting in August,
and she asked for the signed copy by post. Want me to create a
task with a reminder for the last week of June?
What your agent receives from get_context is pure retrieval:
Korely assembles the active typed facts for that user (with their
bi-temporal validity) plus the most relevant memories into a compact
Markdown block. No generative model composes output on the read path;
your agent's own model does the reasoning. That is also why read quotas
are an order of magnitude more generous than write quotas.
Read-only vs read-write
A multi-channel agent that anyone can message over WhatsApp is a bigger
surface than a coding assistant on your laptop. If you want to start
cautious, begin with read-only by calling only get_context
and search in your hook, and omit add. Once
you trust the loop, add writes:
# read-only hook (safe default)def before_turn(user_id: str, message: str) -> str: ctx = korely.get_context(query=message, user_id=user_id, token_budget=800) return ctx.context
# add writes once you trust the loopdef after_turn(user_id: str, agent_reply: str) -> None: korely.add(agent_reply, user_id=user_id, agent_id="openclaw")In our own use, the write path is where the integration gets genuinely good: the agent saves a draft from a Telegram conversation, you open Korely later and the note is already there.
Troubleshooting
| Symptom | Fix |
|---|---|
401 invalid_key from Korely |
The error body is {"code":"invalid_key","message":"Invalid
or missing API key"}. Check that
KORELY_API_KEY is set in the environment where the
gateway process runs and starts with kor_live_.
|
429 quota_exceeded |
You've hit the write quota for your tier (the error body is
{"code":"quota_exceeded","message":"Monthly memory write
limit reached..."}). The hobby tier allows 1,000 writes
and 25,000 queries per month.
Upgrade if you need more.
|
| Context returned is empty or irrelevant |
Add memories first with korely.add() — the agent can't
retrieve what hasn't been stored. Check that user_id is
consistent between writes and reads.
|
| SDK not found at runtime |
Run pip install korely-memory in the same Python
environment OpenClaw uses, not a separate virtualenv.
|
How the agent reaches for memory
Hook-driven by design: Korely does not auto-inject
memory into every turn. Your before_turn hook calls
get_context, and you pass the result into the agent's
system prompt or message. This keeps the memory path explicit, fast,
and testable. In practice, wiring it into the hook makes the agent
reach for memory reliably on every channel with no extra prompting.
What your agent can do once connected
From any channel, WhatsApp, Telegram, Slack, wherever:
- "What do you know about me?" The agent calls
korely.get_facts()and gets back your cross-session memory: typed facts from the entity graph (preferences, people, work, places...), with bi-temporal validity. Facts reads are deterministic and typically return in under 50 ms, so it's fast on every channel. - Persist any output. Paste a link summary, a decision,
a draft into the chat and the agent calls
korely.add(). It lands in your memory, gets embedded, and entities are extracted into the graph automatically. - The shared human and agent loop. The agent saves a draft from a Telegram conversation; you open the Korely app later and the memory is already there. Same graph, human and agent working on the same knowledge base. The Memory Panel in the app lets you review, correct, or delete anything the agent learned about you.
For the full SDK surface and method signatures, see the SDK reference. For how facts, supersession and time work, see temporal facts.
Something not working? Email
[email protected] with your OpenClaw
version, SDK version (pip show korely-memory), and the
error you're seeing. We read every message.