Coding agents
OpenCode
Give OpenCode memory that survives the session. Add the Korely MCP server to one config file, no OAuth dance, no package to install, just your API key in a header.
OpenCode forgets everything between sessions. Connect Korely's MCP server and it doesn't: before answering, OpenCode can pull the active typed facts and relevant memories it has stored, and write new ones as it learns. The intelligence, entity and typed-fact extraction, contradiction resolution, bi-temporal validity, runs server-side. OpenCode just calls the tools.
Prerequisites
- A Korely API key (
kor_live_...). The hobby tier is free. - OpenCode installed (
opencode --version).
Add the Korely MCP server
Korely's agent memory is a remote MCP server at
https://api.korely.ai/agent/mcp, authenticated with your key in a
header, no browser login. OpenCode configures MCP servers in
opencode.json (there is no mcp add CLI command), so
add the server under mcp with type: "remote" and a
static bearer header:
{ "$schema": "https://opencode.ai/config.json", "mcp": { "korely": { "type": "remote", "url": "https://api.korely.ai/agent/mcp", "enabled": true, "headers": { "Authorization": "Bearer kor_live_..." } } }}
Put this in your global config at
~/.config/opencode/opencode.json, or in a project-local
opencode.json at the repo root. Replace
kor_live_... with the real key from
agent signup. The
"type": "remote" transport is Streamable HTTP, matching Korely's
agent endpoint. JSONC comments are supported if you prefer to annotate the
block.
Restart OpenCode and the korely server connects automatically,
the static bearer header is the correct and sufficient method for the agent
endpoint, so no auth flow is triggered.
What OpenCode can do
Once connected, OpenCode has four memory tools:
| Tool | What it does |
|---|---|
korely_get_context | The recall path: assembles the active typed facts plus the most relevant memories into a prompt-ready block. Pure retrieval, no model runs on the read path. |
korely_add | Store a memory. Typed (subject, predicate, object) facts are extracted server-side and contradictions are superseded automatically. |
korely_search | Semantic search over stored memories, ranked. |
korely_get_facts | The typed bi-temporal facts known about a user, with point-in-time (as_of) queries. |
Use it
Now OpenCode reaches for memory on its own. Tell it something durable and
it calls korely_add; ask it something personal and it calls
korely_get_context first:
You › Remember that this repo deploys to Hetzner, not Render. → korely_add("This repo deploys to Hetzner, not Render")
# next session, days laterYou › How do we deploy this? → korely_get_context("deploy") → "This repo deploys to Hetzner..."OpenCode › This repo deploys to Hetzner (you told me earlier), not Render. ...Scoping
Every tool accepts an optional user_id so one key can serve many
end users, a memory written for "user-a" never surfaces for
"user-b". Omit it and everything is scoped to the key's default.
Why this is more than a notepad. Korely doesn't store raw
chat logs, it extracts typed facts with bi-temporal
validity. When something changes ("we moved off Render"), the old fact is
superseded, not duplicated, so korely_get_context returns
what's true now, and as_of can still replay what was
true before. EU-hosted.
Related
- Korely MCP, the full MCP surface and other clients.
- Get context, the call behind
korely_get_context. - Memory as a tool, the same pattern when you build the agent loop yourself.