Agent harness
Pi Agent
Pi Agent reaches Korely's memory through the community pi-mcp-adapter, which speaks Streamable HTTP and lets you set a static Authorization header, so you point it straight at the remote server, no bridge.
Pi Agent ships with no native MCP support of its own. MCP, both remote servers and local stdio ones, is provided entirely by a third-party community extension, pi-mcp-adapter (MIT-licensed, authored by nicobailon, not an official Pi / pi.dev product). The good news: that adapter supports a static Bearer header over Streamable HTTP, so you can connect to Korely's remote MCP endpoint directly, the intelligence (entity and typed-fact extraction, contradiction resolution, bi-temporal validity) runs server-side, and Pi just calls the tools.
Prerequisites
- A Korely API key (
kor_live_...). The hobby tier is free. - Pi Agent installed.
-
The community adapter (one time):
Terminal window pi install npm:pi-mcp-adapter
Third-party adapter. pi-mcp-adapter is a
community extension (MIT, by nicobailon), not an official Pi product and not
affiliated with the Pi core team. Pi Agent itself has no built-in MCP client,
all MCP capability here comes from this adapter (alternatives like
pi-mcp or pi-mcp-tools are also third-party). Verify
the adapter against its
README
before relying on it.
Connect Korely (recommended, native remote header)
The adapter reads its MCP config from one of these files (precedence high to
low): ~/.config/mcp/mcp.json (user-global),
~/.pi/agent/mcp.json (Pi global override),
.mcp.json (project-local), .pi/mcp.json (Pi project
override). Use ~/.config/mcp/mcp.json or
~/.pi/agent/mcp.json for a machine-wide connection, or
.mcp.json in a repo for project scope.
Korely's agent memory is a remote MCP server at
https://api.korely.ai/agent/mcp (Streamable HTTP), authenticated
with your key in a static header, no browser login. Point the adapter
straight at it:
{ "mcpServers": { "korely": { "url": "https://api.korely.ai/agent/mcp", "headers": { "Authorization": "Bearer ${KORELY_API_KEY}" }, "auth": "bearer", "bearerToken": "${KORELY_API_KEY}" } }}
Set KORELY_API_KEY=kor_live_... in your environment, the adapter
interpolates ${KORELY_API_KEY}. You can also inline the
literal key, e.g. "Authorization": "Bearer kor_live_...". The
"headers" object alone is enough for Korely's static-key auth; the
"auth" / "bearerToken" fields are the adapter's
explicit Bearer form and are optional.
Fallback, mcp-remote stdio bridge
Only if the native remote path misbehaves, you can route through the standard
mcp-remote proxy instead. It runs as a local stdio MCP server and
forwards every call to Korely over HTTP with your header attached, useful
because the adapter also accepts command-based (stdio) servers.
Requires Node.js / npx on the machine.
{ "mcpServers": { "korely": { "command": "npx", "args": [ "-y", "mcp-remote", "https://api.korely.ai/agent/mcp", "--header", "Authorization: Bearer ${KORELY_API_KEY}" ] } }}
By default the adapter routes all MCP tools through a single proxy tool to save
context. To expose korely_get_context, korely_add,
korely_search and korely_get_facts as first-class
tools, use the adapter's directTools config or its
/mcp interactive panel to promote them.
What Pi Agent can do
Once connected, Pi Agent 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 Pi Agent 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..."Pi › 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.