Korely
Officialby korely-ai
README.md
<p align="center">
<img src="dashboard/public/korely-mark.svg" width="72" height="72" alt="Korely logo: a blue pyramid">
</p>
<h1 align="center">Korely Agent</h1>
<p align="center">
<strong>Memory for AI agents that can answer: why did it say that in March?</strong><br>
Self-hosted, Postgres-only, Apache 2.0.
</p>
<p align="center">
<a href="docs/guide/README.md">Documentation</a> •
<a href="docs/benchmarks.md">Benchmarks</a> •
<a href="https://korely.ai">Korely Cloud</a> •
<a href="CHANGELOG.md">Changelog</a>
</p>
<p align="center">
<a href="CHANGELOG.md"><img src="https://img.shields.io/github/v/tag/korely-ai/korely?label=release" alt="Latest release"></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-blue" alt="License: Apache 2.0"></a>
<a href="https://pypi.org/project/korely-memory/"><img src="https://img.shields.io/pypi/v/korely-memory?label=python%20client" alt="Python client on PyPI"></a>
<a href="https://glama.ai/mcp/servers/korely-ai/korely"><img src="https://glama.ai/mcp/servers/korely-ai/korely/badges/score.svg" alt="Korely MCP server on Glama"></a>
</p>
Korely Agent gives your AI agents a memory that keeps its history. When
something stops being true, the old fact is closed instead of overwritten: your
agent knows what is true now, and you can see what was true, and what it knew,
at any moment in the past. It runs on your servers, with your Postgres and your
model key.
<p align="center">
<a href="#one-memory-every-agent">One memory</a> ·
<a href="#why-korely">Why Korely</a> ·
<a href="#what-is-in-this-repository">What is open</a> ·
<a href="#quick-start">Quick start</a> ·
<a href="#facts-with-dates-why-did-it-say-that-in-march">Facts with dates</a> ·
<a href="#benchmarks">Benchmarks</a> ·
<a href="#connect-your-agent">Connect your agent</a> ·
<a href="#how-it-works">How it works</a> ·
<a href="#your-data">Your data</a> ·
<a href="#honest-limits">Limits</a>
</p>
## One memory, every agent

Any agent that speaks MCP, and your own code, reads and writes the same memory.
Here Claude Code saves, and Gemini CLI, which never saw that conversation,
answers from Korely's dated facts:
[](docs/assets/shared-memory.mp4)
---
## Why Korely
- **It remembers how things change.** When something stops being true, Korely
closes the old fact instead of overwriting it. Your agent knows what is true
now and what was true before, and you can check what it knew at any moment
in the past.
- **You can see why it said that.** Every fact links back to the memory it came
from, and every read of a person's data leaves an entry in the audit trail.
- **One database you already know.** Korely runs on Postgres with pgvector, both
open source. No separate vector database, graph database, queue or cache to
run.
- **Built for personal data.** Data stays on your servers and you use your own
model key, with a model hosted in Europe if you want one. An erasure deletes
the person's data and leaves a record that proves it, and the logs never
contain what people said.
- **Works with the tools you use.** Claude Code, Cursor, Gemini CLI, Codex,
ChatGPT and any MCP client, plus Python and JavaScript SDKs and a REST API.
- **Measured in public.** Benchmark scores below, with the scripts to run them
again.
**Not the right fit if** you want a memory that rewrites how your agent behaves
as it learns: Korely stores facts about people and things, it does not change
your agent's instructions. And for one user with no questions about the past, a
plain file is simpler.
---
## What is in this repository
Everything an install of your own runs, under Apache 2.0:
- **The memory**: memories searched by meaning, the facts a model reads from
them with their dates and both clocks, corrections, and erasure.
- **Projects**: one install holds many, each with its own keys, which read and
write that project only.
- **Agent notices**: an agent that names itself when it reads (`reader`)
learns, in its next context block, which of the facts it was given have
ended since ([how](docs/guide/api.md)).
- **The MCP server, the REST API and webhooks.**
- **The dashboard** of your install: memories, facts, projects, keys, webhooks
and the audit trail.
- **The benchmark scripts** behind the numbers below.
[Korely Cloud](https://korely.ai) runs this code, plus what a public hosted
service needs on top: sign-up, plans and payments, and spending limits per
account. That part is not in this repository. Neither is a way to ask
questions of your documents or folders: Korely remembers what your agents and
your code send it.
---
## Quick start

[](docs/assets/install.mp4)
**What the installer prints, line by line.** Two programs run: Korely and its
database. The other lines are Docker setting them up.
| Name | What it is |
|---|---|
| `korely-api-1` | Korely: the dashboard, the API and the MCP server, on port 8000. |
| `korely-db-1` | The database: Postgres with pgvector. |
| `korely_pgdata` | The disk the database keeps its data on. It stays when Korely is stopped, and goes with `./korely uninstall --yes`. |
| `korely_default` | The private network the two programs talk over. |
| `korely-facts-dir-1` | A one-off helper: it lets Korely write to the `facts` folder, then stops. "Exited" is normal. |
1. **Install [Docker Desktop](https://docs.docker.com/get-docker/)** and open
it (on Windows, use it inside WSL2 with Docker: tested). Korely needs 4 GB of free memory.
2. **Download and run the installer.** Open a terminal (on a Mac: the Terminal
app), paste this line and press Enter:
```bash
curl -fsSL https://raw.githubusercontent.com/korely-ai/korely/main/install.sh | sh
```
`curl` downloads the installer and `| sh` runs it. The installer works in a new folder,
`korely`, and nowhere else: it downloads Korely (about 0.7 GB to download and about 2.4 GB on disk,
the first time), starts it and creates your account.
3. **Open the address it prints**, [http://127.0.0.1:8000](http://127.0.0.1:8000),
and sign in with the login and password it prints. It also prints an API key:
that is what your agents use. The password and the key are shown once. The
key expires after 90 days (the installer prints the date); make a new one on
the dashboard's API keys page ([Keys and account limits](docs/guide/keys-and-limits.md)).
**On a Mac, without a terminal:** download
[Korely Installer](https://github.com/korely-ai/korely/releases/latest/download/Korely-Installer.dmg),
open it and double-click **Korely Installer**. It checks Docker Desktop, asks
where to install and, if you want, your model key, then installs in a Terminal
window you can watch, and opens your dashboard at the end. It runs the same
installer as the line above.
Running the line again starts what is there and creates nothing new. To read
the installer before running it: `curl -fsSLO …/install.sh`, then
`sh install.sh --help`.
**Your model key.** The one model call is the writer that turns memories into
facts, and it is billed to you. Name your provider and the installer asks for
the key without showing it:
```bash
curl -fsSL https://raw.githubusercontent.com/korely-ai/korely/main/install.sh | KORELY_PROVIDER=gemini sh
```
Gemini, Scaleway, Mistral, OpenAI and OpenRouter work; Scaleway writes in
Europe, in Paris. Without a key the install completes and the dashboard's first
screen asks for one (**Skip for now** works too: memories are stored and
searched, and facts arrive when your agents write them).
To stop it, start it again or remove it, use `./korely` in that folder
([Install](docs/guide/install.md) has the commands).
**Without installing anything:** the same code runs as Korely Cloud, with a free
plan, at [korely.ai](https://korely.ai).
**On a server, with your domain and a certificate:** [Install](docs/guide/install.md).
> **Using Claude Code, Cursor or another coding agent?** Connect it over MCP
> with the key the installer printed:
>
> ```bash
> read -rs KORELY_API_KEY # paste the key, it is not shown
> claude mcp add --transport http korely http://127.0.0.1:8000/mcp \
> --header "Authorization: Bearer $KORELY_API_KEY"
> ```
>
> Your agent can then save a memory, search its memories, and read what is
> true about a person, now or on any past day.
> [Connect your agent](#connect-your-agent) has Cursor, ChatGPT and the SDKs.
---
## Facts with dates: why did it say that in March?
A support agent tells customer 4821 they have priority support. That is March.
In June they move to a cheaper plan. Today they are angry, quoting your bot back
at you. Was the bot wrong, or right at the time?

Claude Code, in a new session with no memory of its own, asked about today and about April:
[](docs/assets/agent-memory.mp4)
The same history in the dashboard, with the clock dragged back to 1 April:
[](docs/assets/demo.mp4)
<details>
<summary><b>The commands, with curl</b></summary>
[](docs/assets/story-4821.mp4)
With no model key, as in the recording, an agent writes the facts itself. Each
write answers with the fact's `id` (`fct_...`):
```bash
# the plan from 15 March
curl -X POST https://your-domain/v1/facts \
-H "Authorization: Bearer kor_self_..." -H "Content-Type: application/json" \
-d '{"user_id":"c4821","subject":"c4821","predicate":"subscribes_to","object":"Priority Support plan","valid_from":"2026-03-15"}'
# it stopped being true on 20 June (use the id the first call returned)
curl -X POST https://your-domain/v1/facts/fct_.../forget \
-H "Authorization: Bearer kor_self_..." -H "Content-Type: application/json" \
-d '{"at":"2026-06-20"}'
# and the new plan starts that day
curl -X POST https://your-domain/v1/facts \
-H "Authorization: Bearer kor_self_..." -H "Content-Type: application/json" \
-d '{"user_id":"c4821","subject":"c4821","predicate":"subscribes_to","object":"Basic plan","valid_from":"2026-06-20"}'
```
To change a fact you know is wrong while it is still open, correct it by its
id (`PATCH /v1/facts/{id}`). A date with no time is midnight UTC: when a fact read from
a memory may come later that day, give the time too
([Honest limits](docs/guide/limits.md#honest-limits)).
With a model key, you can send sentences to `POST /v1/memories` instead, and a
model turns them into facts. Without a key a memory is stored and searched, but
no fact comes out of it, and `GET /v1/facts` stays empty. Every write says whose
memory it is, with a `user_id` (the person it belongs to) or an `agent_id` (the
agent writing it): with neither, the answer is a 422 `identity_required` (since
1.0.19).
```bash
curl -X POST https://your-domain/v1/memories \
-H "Authorization: Bearer kor_self_..." -H "Content-Type: application/json" \
-d '{"content":"Customer 4821 is on the Priority Support plan.","user_id":"c4821","timestamp":"2026-03-15"}'
# then the same with "Customer 4821 moved to the Basic plan." and "timestamp":"2026-06-20"
```
What the store held on the day of the conversation:
```bash
curl "https://your-domain/v1/facts?user_id=c4821&as_of=2026-04-01" \
-H "Authorization: Bearer kor_self_..."
```
```
c4821 -subscribes_to-> Priority Support plan
```
</details>
The bot was right at the time, and that is a row, not a reconstruction. Nobody
wrote the second fact as an update to the first: a model read the second
sentence, saw it was about the same thing, and the older fact was closed on
20 June. `include_invalidated=true` returns both rows with their dates. (The
relation's name is the word the model chose, so yours may read `is_on`: the
example is about the dates.)
There are two clocks. `as_of` asks what was true on a date; `known_as_of` asks
what the store knew on a date, which differs when a change is told late. And
when a model in the write path is not acceptable, an agent can write and close
facts itself (`POST /v1/facts`, `POST /v1/facts/{id}/forget` with the date it
stopped being true), with no model involved.
[Time: what was true, and what the store knew](docs/guide/time.md) has all of it.
---
## Benchmarks
| Benchmark | Score | Reader and judge |
|---|---|---|
| [LongMemEval](docs/benchmarks.md#longmemeval), oracle split, 500 questions | **87.2%** | gpt-4o, with the benchmark's own prompts |
| [LoCoMo](docs/benchmarks.md#locomo), 1,540 questions, Mem0's judge prompt | **86.9%** | gpt-4o-mini |
| [LoCoMo](docs/benchmarks.md#locomo), the same context read by an open-weight model | 80.8% | gpt-oss-120b |
| [LoCoMo, the whole conversation in the prompt instead](docs/benchmarks.md#full-context-baseline) | 79.9% | gpt-4o-mini |
Measured on version 0.1.36 in October 2026, not yet rerun on this release.
The judge alone moves a LoCoMo score by several points, so compare numbers
only under the same judge; [the benchmarks page](docs/benchmarks.md) has the
protocol, the cost and the command for each row.
---
## Connect your agent
**Python.** Install the client, then three lines:
```bash
pip install korely-memory
```
```python
from korely_memory import Korely
korely = Korely(api_key="kor_self_...", base_url="http://127.0.0.1:8000")
korely.add("I prefer to be called Max.", user_id="max")
print(korely.search("What should I call the user?", user_id="max")[0].snippet)
```
JavaScript works the same way: `npm install korely-memory`.
[](docs/assets/python-sdk.mp4)
**MCP.** Any MCP client connects to `https://your-domain/mcp` with the same key.
Your agent can then save a memory, search its memories, read the facts about a
person (now or on a past day) and get a ready-made context block for its
prompt.
```bash
# Claude Code
claude mcp add --transport http korely https://your-domain/mcp \
--header "Authorization: Bearer kor_self_..."
```
<details>
<summary><b>Cursor and other MCP clients</b></summary>
```json
{ "mcpServers": { "korely": {
"url": "https://your-domain/mcp",
"headers": { "Authorization": "Bearer kor_self_..." } } } }
```
This is the shape Cursor and most clients read. ChatGPT and
Claude on the web connect as a custom connector at the same address and sign in
through your install's own consent page, choosing the project they may read.
</details>
**REST.** `/docs` on your install is the whole contract, served by the install
itself. [Talking to it](docs/guide/api.md) covers the SDKs, the context block
for prompts, errors and the shell commands.
---
## How it works

An agent writes a memory; it is stored and searchable at once. A worker sends
its text to the model provider you chose, gets facts back, and asks the model
whether each new fact replaces an older one about the same thing; the older one
is closed, never deleted. No read calls the model: a search and a context
compute one vector of the question, on your server by default, and every other
read is SQL.
---
## Your data
- **What leaves the machine** is text sent to the model provider whose key you
set, and only to write facts: the memory with the end user's id as your agent
sent it (prefer an opaque id to an email address or a name), a few of the
same person's earlier memories for context, and the facts the judge compares.
[Install](docs/guide/install.md) lists exactly what goes. Nothing is sent to
Korely, and nothing phones home. Vectors are computed on your server by
default (EmbeddingGemma-300m).
- **Europe or Global** is chosen per project. Europe writes with gpt-oss-120b on
Scaleway, in Paris; a region with no provider keeps its memories waiting and
never falls back to the other one.
- **One install, many projects.** Give each app or customer its own project:
its key reads and writes that project only, so the shop's agent never sees
the clinic's memories. A project key cannot manage keys or webhooks, and
reads the audit trail of its own project only (`GET /v1/audit`), without
the name of the operator behind the dashboard's acts there; an admin key,
and you signed in to the dashboard, reach every project of the account.
The dashboard shows the project chosen at its top, or all of them together
with **All projects**.

- **An audit trail that stores no content**: who read or changed which person's
data, when, with what result, kept 400 days by default.
- **Erasure that erases**: `DELETE /v1/users/{id}/memories` removes the person's
memories and facts in the key's project, history included, and leaves a
record with counts and a keyed pseudonym instead of their id; the account's
administrator can erase them in every project at once.
- **Logs carry no end-user words**: errors and access lines hold ids and route
shapes, never the text of memories, facts or questions.
[What is in the box](docs/guide/data-and-privacy.md) details the facts, the
trail and every form of erasure.
---
## Status
Actively maintained: releases come out every few days, each with upgrade notes in the [CHANGELOG](CHANGELOG.md).
The same code runs Korely Cloud, the hosted service at
[korely.ai](https://korely.ai). The issues this version ships with are listed in
[Honest limits and known issues](docs/guide/limits.md#known-issues-in-this-version);
none of them shows one account's data to another, loses data or keeps an erased
person's data. Upgrades, backups and restores are in
[Keeping it running](docs/guide/operations.md).
---
## Honest limits
- **Facts are mined by a model.** It misses things, invents relation names, and
sometimes closes a fact that was still true. A closed fact stays readable, and
an agent can close or correct one itself.
- **Whether a relation holds one value at a time is a model's answer.** A change
of plan closes the old plan; a change of employer may leave both employers
open.
- **More than one process needs sticky MCP sessions.** Two processes on one
Postgres took 2,000 memories at once: each memory reached the model once and
sent its webhook once, with no error
([scripts/two_processes.sh](scripts/two_processes.sh), no key needed). Thirty
agents of one account, 15 on REST and 15 on MCP, wrote 600 memories and
read 600 times in 26 seconds on the same two processes, with no client
retry: none lost, none stored twice, no read refused
([scripts/concurrent_agents.sh](scripts/concurrent_agents.sh)). Twelve hours of load on one
process (36,027 memories, a restart at the twelfth hour, writer faked) kept the API's memory flat
at about 590 MiB, with no error in its log
([scripts/soak.sh](scripts/soak.sh)). An MCP session lives in the process
that opened it, so a load balancer in front must keep each MCP client on the
same process; REST calls can go to any of them.
[Honest limits and known issues](docs/guide/limits.md) has each one with what
was measured.
---
## Documentation
[docs/guide](docs/guide/README.md): install, the two clocks, the API and MCP,
webhooks, keys and limits, data and privacy, operations, troubleshooting.
---
## Support
Bugs and ideas: [GitHub issues](https://github.com/korely-ai/korely/issues),
where everybody can read them; the form asks for the version and whether it is
an install of your own or the Cloud, and real people's data stays out of it.
Vulnerabilities: security@korely.ai, never an issue ([SECURITY.md](.github/SECURITY.md)).
Commercial support and setup for your domain: info@korely.ai. The Cloud's plans
are at [korely.ai/pricing](https://korely.ai/pricing).
## License
Apache License 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE). In plain words,
and the file is what governs: you can use it, change it, pass it on and sell it,
run it for yourself or host it for other people. A copy you pass on carries
LICENSE and NOTICE, and a file you changed says so. Whoever contributes code
also licenses the patents that code needs (section 3), and it comes with no
warranty. The licence gives no right to the name and logo "Korely" (section 6):
saying your work is built on Korely Agent is fine, calling it Korely is not. A
contribution you send is taken under the same licence (section 5);
[CONTRIBUTING.md](.github/CONTRIBUTING.md) says how. The `korely-memory` clients on PyPI
and npm are MIT. Every third-party licence in the tree is listed in
[docs/DEPENDENCIES.md](docs/DEPENDENCIES.md).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues