KAIBO_URL and KAIBO_KEY are set, so new Kaibo() and Kaibo() need no arguments.1234567891011import { Kaibo } from "kaibo"; const kaibo = new Kaibo(); async function answer(question: string) { // Text you can paste into a prompt: cited, with outdated and untrusted items marked. const memory = await kaibo.context(question); return callYourModel({ system: `Answer from the memory below. If it does not contain the answer, say you do not know.\n\n${memory}`, user: question, }); }
recall and its helpers:123const pack = await kaibo.recall("who owns billing?"); if (!pack.found) return `I do not know (${pack.reason}).`; return `${pack.answer} (source events: ${pack.sources.map((s) => s.eventId).join(", ")})`;
12await kaibo.remember("Maya took over billing from Dana on Nov 3."); await kaibo.remember("Dana is out until January.");
explain shows Dana's version as replaced, with both source events.12const before = await kaibo.recall({ query: "who owns billing?", asOf: "2026-10-01T00:00:00Z" }); console.log(before.answer); // Dana, and only because that was true on that date
remember the new fact. If it is wrong because it was recorded badly, edit it. The old text stays as history either way.12const pack = await kaibo.recall("release target"); if (pack.found) await kaibo.memories.edit(pack.top, "The release target is July 17.");
12345const target = { query: "home address" }; const preview = await kaibo.forget(target, { reason: "asked by user", dryRun: true }); // changes nothing console.log(preview); // what would go const { receipt } = await kaibo.forget(target, { reason: "asked by user" }); console.log(await kaibo.forget.verify(receipt.id)); // checks the receipt against the ledger
12345const pack = await kaibo.recall("refund policy"); const saved = JSON.stringify(pack); // ...later, in another process: const check = await kaibo.verifyPack(JSON.parse(saved)); if (!check.valid) throw new Error(check.reasons.join("; "));
1const pack = await kaibo.recall({ query: "who may approve refunds?", minTrust: "trusted" });
123kaibo projects create "Support agent" kaibo keys create --label support-agent --scope read_write --for-project <project-id> --json kaibo webhooks create https://example.com/kaibo --event memory.forgotten
kaibo.projects, kaibo.keys, kaibo.webhooks) and the dashboard.fetch:12345const kaibo = new Kaibo({ apiKey: "kaibo_aaaaaaaa.bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", baseUrl: "http://localhost", fetch: async () => Response.json({ items: [], abstain: { abstained: true, reason: "test" }, version: 1, tokens: 0, asOf: new Date().toISOString() }), });