Three checks
Name, password, boat
Before trusting memory in a real app, test three cases side-by-side: a safe personal fact that should be remembered, a secret that must be refused, and a document fact that belongs in a Knowledge note instead of memory.
Check the name, the password, and a fact that belongs in the note.
The name comes from memory. The password was not saved. The boat colour comes from the note.
Expected output: the saved name is recalled, the secret reports not saved, and the document fact comes cleanly from the note.
Example
from praisonai.knowledge import KeywordIndex
from praisonai.memory import FileMemory
index = KeywordIndex()
index.add_documents(["The secret colour of the boat is blue."])
memory = FileMemory(user_id="learner")
memory.add_long_term("The learner name is Nila.")
print("Name")
print(memory.search("name")[0]["item"]["content"])
print("Password")
print(memory.search("password") or "Not saved.")
print("Boat")
print(index.query("colour", top_k=1)[0]["text"])Example explained
- Name — A fact about the person.
- Password — Not stored.
- Boat — A line from the note, not from memory.
Automate your memory hygiene checks in CI
Turn these three checks — recall saved preference, keep shared notes separate, and refuse secrets — into a fast pytest test whenever you change your memory backend or prompt wording.
Common pitfall: testing only that saving succeeds without verifying that secret rejection and tenant isolation also hold.
Reference: documentation