Concepts
Human-in-the-loop memory
Show a person what your agent remembers about them, and let them correct it, forget it or erase it.
Korely turns each memory your agent saves into short facts, such as Sofia / works_at / Acme Corp. Each fact belongs to one end user and has an id. Your product can show a "what do you remember about me" screen and correct or forget a fact with one call.
Terms
The Glossary defines the words used across the docs. These are the ones specific to this page.
- Human in the loop: the person a memory is about can see, correct and remove it.
- Correct (supersede) a fact: replace a fact with a corrected one. The old fact becomes a closed fact, kept as history.
- Forget a fact: close one fact, so reads stop returning it. Forget, delete or erase compares it with the other two.
- Source memory: the memory a fact was read from. Each fact names it in
source_memory_id.
Quick start
Install pip install korely-memory (Python 3.9 or later) or
npm install korely-memory (Node.js 18 or later). Then
get a free API key and run
export KORELY_API_KEY=kor_live_.... Tested with SDK 0.1.28
(Python) and 0.1.17 (Node.js).
The code saves one memory for customer-4812, waits for
extraction, shows the facts,
corrects the Acme fact, reads the history and forgets the correction.
import timefrom korely_memory import Korely
korely = Korely() # reads KORELY_API_KEY from the environmentUSER = "customer-4812"
mem = korely.add("Sofia works at Acme Corp as a product manager.", user_id=USER)while korely.get(mem.id).status == "processing": time.sleep(2) # extraction takes about ten seconds
# 1. Show the facts of this end user.facts = korely.get_facts(user_id=USER)acme = next((f for f in facts if "Acme" in (f.object or "")), None)if acme is None: raise SystemExit("No Acme fact: see the note below.")print(acme.subject, acme.predicate, acme.object)
# 2. Correct: Sofia moved to Beacon Labs.fixed = korely.correct_fact(acme.id, object="Beacon Labs")
# 3. History, closed facts included.for f in korely.get_facts(user_id=USER, include_invalidated=True): print(f.object, f.invalid_at)
# 4. Forget.print(korely.forget_fact(fixed.id).status)You see lines like these (illustrative):
Sofia works_at Acme CorpBeacon Labs NoneAcme Corp 2026-06-09T14:02:11.418203+00:00forgotten
Beacon Labs is the current fact: its invalid_at is empty
(null in Node.js and JSON). The Acme fact is closed, not
deleted. forgotten means Beacon Labs is now closed too.
A memory can finish with status ready and no facts. If there
is no Acme fact, save the sentence again, simple and in the present tense,
with the same API key and user_id.
Show a person what the agent knows
korely.get_profile(user_id=...) (GET /v1/profile)
returns the current facts of one end user, at most 200.
by_family groups them by family: the group a predicate belongs
to, such as work or health. truncated is true
when there are more than 200.
profile = korely.get_profile(user_id="customer-4812")for family, facts in profile.by_family.items(): for f in facts: print(family, f.id, f.subject, f.predicate, f.object, f.source_memory_id)print(profile.total, profile.truncated)
For more than 200 facts, page with get_facts
(limit up to 200, default 50, and offset). Show
source_memory_id so the person can open the sentence behind a
fact. Always pass user_id: without it, fact reads cover every
end user of the project. Reference:
get_profile,
get_facts.
Let the person correct a fact
korely.correct_fact(fact_id, object="Beacon Labs")
(PATCH /v1/facts/{id}) replaces a fact with a
corrected one. Pass at least one of subject, predicate or object. The answer
is the new fact, and the next read returns it.
- The new fact is current from the moment of the correction.
- The old fact is closed at that moment, kept as history and linked to the new one.
- When a newer fact contradicts an older one, Korely may close the older one. So a correction can close other facts too: the answer lists them all in
invalidated. - The new fact keeps the old source memory, which says Acme Corp. A correction stays only while that memory is neither edited nor deleted: if the memory is edited, the new text is read again and the correction is lost; if it is deleted, the corrected fact is closed too.
Korely can miss a change; a correction fixes it. Only a current fact can
be corrected: on a closed one the answer is
409, with current_fact_id to correct instead. A
correction asks a language model. If none answers, you get 503
and nothing is written, so retry. Reference:
correct_fact.
Let the person forget a fact
korely.forget_fact(fact_id)
(POST /v1/facts/{id}/forget) closes the fact. It
leaves get_facts, get_profile and the facts part
of the context block at once.
It stays readable as history with include_invalidated=True.
A forget asks no model and counts no write.
Optionally pass at, an ISO date, for when the fact stopped being true. A fact
already closed answers already_forgotten; an unknown id answers
404. Reference:
forget_fact.
Forgetting a fact leaves the memory that stated it.
Search, the memory list and get_context can still return
that sentence. If the memory still states another true fact,
get_context shows it as plain text, not marked as history, so
your agent can still read the old value. To remove it, delete or erase the memory.
A forgotten or corrected value can come back if its memory is edited
(PATCH /v1/memories/{id}) or the same sentence is
saved again. To avoid it, do not edit that memory or repeat the sentence.
Forget, delete or erase
| Action | What it does | What is left |
|---|---|---|
Forget a fact (forget_fact) | Closes one fact. | The fact as history, and its memory. |
Delete a memory (DELETE /v1/memories/{id}) | Hides the memory from every read and closes the facts only it stated. A fact it had closed can become true again. | The row in the database. No API call brings it back. |
Erase (?erase=true on one memory, or a whole end user) | Removes rows, text and vectors for good. | Nothing, except encrypted backups for up to 35 days. |
Erase everything about one person
When a person closes their account in your app, call
DELETE /v1/users/{end_user}/memories (SDK:
korely.delete_all(user_id=...)). It deletes everything Korely
stored for that end user in the key's project, for good, closed facts
included. Invented values:
curl -X DELETE https://api.korely.ai/v1/users/customer-4812/memories \ -H "Authorization: Bearer $KORELY_API_KEY"
# 200 OK{ "user_id": "customer-4812", "memories_deleted": 218, "facts_deleted": 64, "erasure": "permanent", "audit_id": "aud_91xb"}- Korely writes one audit record with the counts;
audit_idis your receipt. - An end user in several projects needs one call per project, with that project's key.
- Memories without a
user_idstay. A wrong id answers200with zero counts.
Reference: erase an end user.
Use the same controls in the dashboard
The Facts page of the dashboard at agent.korely.ai lists the facts of the selected project, a page at a time. You can filter by end user and family and turn on "Show history". Each current fact has Correct and Forget. A correction there also counts as one write. The Graph page has a slider that shows the facts as they were on a date between the first fact and today.
Details
- Reads after a change. Fact reads use no model and see a correction or a forget at once. A copy cached in your agent survives a forget, so read the facts again at the start of each session.
- Costs. A correction counts as one write (
429when the month's writes are used); forget and erase count none. Each read counts against your plan's monthly reads, under a rate limit. Read quotas are much larger than write quotas: see pricing. - Permissions. Correct, forget and erase need
memories:write;get_profileandget_factsneedmemories:read. A confined key gets404on other end users' facts. - Check ownership. A project key can correct or forget any end user's fact by id: your app must check that it belongs to the person signed in.
- Surfaces. REST, the SDKs and the CLI
(
korely correct-fact,forget-fact,profile,delete-all). The MCP server haskorely_correct_fact(close=trueforgets a fact) andkorely_forget_memory, but no profile or delete-all. - Plans and region. All of this works on every Cloud
plan. Stored data sits on EU infrastructure. Each project picks the
region of the model that reads its
memories,
euorglobal: see Data governance. For healthcare, legal or support apps, the regulatory review of your application stays yours.
See also
- Temporal facts: how
valid_fromandinvalid_atwork and how a newer fact closes an older one. - The memory model: memories, facts and the
run_idlabel. - Data governance: where data lives, which region reads it, erasing an end user, the audit record, and why reads never reach a language model.
- Glossary: the words used across the docs.