context
The commonest integration by far is "put what you know in front of my model". Done with search, that is
the same ten lines in every project: call, loop, format each memory with where it came from, join, and
handle the empty case. context() is those lines, written once.
context = mem.context("When can I call Devika?", limit=12)const context = await mem.context("When can I call Devika?", { limit: 12 });It takes limit (1 to 50, default 12), kind (people, plan, pref or detail) and
with_sources (default true). context_full() in Python and contextFull() in TypeScript return the
same block with the memories behind it and an empty flag.
Each line names its source and when it was said or learned:
- Priya Nair signs the Lumen renewal. [note, 2026-10-05]
- The Lumen renewal comes up in March 2027. [GTM plan, 2026-10-05]A note added with a title is cited by that title, a file by its name and a page by its title; a note
without a title is cited as note. The memories behind the block come first by how much of each the
answer restates.
The block also carries what happened, the rules that apply and where things stand, as they bear on the question, after the memories (the same parts the briefing reads):
- Priya Nair signs the Lumen renewal. [note, 2026-10-05]
What happened (episodes):
- [2026-10-02 14:10] Renewal terms agreed: Priya asked for a March start. Outcome: signed off by legalThat part is up to 3,000 characters, cut at the end of a line, and comes only when something bears on the
question; a block of one kind holds that kind of memory alone. Your code does not change for it. For an
agent that opens a session, the briefing itself holds more: what is due, the open items,
and where the whole project stands.