Paste this into Claude Code, Cursor, Codex or any coding agent, inside your project. It installs the
Geniffy SDK, gives every one of your users a memory of their own, and puts what is known into your
prompts. Set GENIFFY_API_KEY in your environment first.
Agent Prompt
Add long-term memory to this project with Geniffy (docs: https://docs.geniffy.com).
1. Install the SDK for this project's language: `pip install geniffy` (Python) or `npm install geniffy`
(TypeScript/JavaScript). Read the key from the GENIFFY_API_KEY environment variable; never hard-code
it, never send it to a browser, and never log it.
2. Create one client for the process and reuse it: `Geniffy()` in Python (or `AsyncGeniffy()` in async
code), `new Geniffy()` in TypeScript.
3. Give every end user their own memory. Where this app knows which user a request is for, bind a client
to them once: `mem = client.space(f"user_{user_id}")` in Python, `const mem = client.space(`user_${userId}`)`
in TypeScript, and use only `mem` below that point. A space is created by the first write to it.
Never call memory methods on the unbound client for an end user's data: that writes to the account
owner's own memory, where every user would be mixed together.
4. Save what is worth remembering. After a user tells the app something about themselves, their work or
their plans, call `mem.memories.add(text)`. To save a whole conversation, pass it as the framework
holds it: `mem.memories.add(messages=history)` / `mem.memories.add({ messages: history })`. Files:
`memories.add_file(path)` / `memories.addFile(blob, { filename })` (PDF or Word .docx). Web pages:
`memories.add(url=...)` / `memories.add({ url })`.
5. Use it before the model answers. Open each turn with `mem.briefing(cue=user_message)` (Python) or
`mem.briefing({ cue: userMessage })` (TypeScript) and put the string it returns above the user's message in
the prompt. It is read without a model call, so it is fast enough for every turn. When nothing is known yet
it comes back empty: then put a line saying nothing is known about this user yet, so the model says so
rather than guessing. Where an answer must be checked, use `mem.context(question)` instead, which is never
empty (pass it through as is), or `mem.ask(question)`; when its `answer` is null, say nothing is known.
6. Let users be forgotten. Wherever this app deletes a user or their data, also call
`client.forget_space(f"user_{user_id}")` / `client.forgetSpace(`user_${userId}`)`.
7. Handle errors: catch `AuthenticationError` (a wrong or revoked key) and `UnreadableError` (a file or
link that could not be read; `error.source.error` says why). The SDK already retries busy and network
errors. Log the `X-Request-ID` of any failed call: it finds the call on the Requests page.
8. Add one small test that writes a note into a test space, waits with `mem.sources.wait(id)`, checks that
`mem.briefing(cue=...)` mentions it, then erases the test space.
Keep the change minimal and match this project's style.
What it asks your agent to do
Install the SDK for your project's language, and read the key only from GENIFFY_API_KEY.
Bind a client to one space per end user, and never write an end user's data to the unbound client.
Save what users tell your app, whole conversations as your framework holds them, files and pages.
Open every turn with briefing() above the user's message, with a line of your own for when it comes back
empty, and use context() or ask() where an answer must be checked.
Call forget_space wherever your app deletes a user.
Catch AuthenticationError and UnreadableError, and log the request id of any failed call.
Add one small test that writes to a test space, checks briefing(), and erases the space.
It has three tools, all reading: search_docs finds the page for a task, read_doc reads a page as Markdown,
and ask_docs answers from the docs only, with the pages it rests on, or says the docs do not say.