Selective memory governance for AI agents โ branch the timeline, never merge back
Project description
๐ซฅ forgetted
Your AI agent remembers everything. Now it doesn't have to.
forgetted gives AI agents selective memory governance. One line of code, and your agent keeps full context but writes nothing to memory.
Traditional incognito is dumb: no past, no future, fully isolated. forgetted gives you: full continuity + selective non-persistence.
from forgetted import ForgetSession
with ForgetSession("/path/to/workspace"):
agent.chat("this conversation never happened")
# โ No trace in memory, logs, or vector DB. Agent resumes normally.
Why?
AI agents write everything: memory files, session logs, vector embeddings, deliverables. Sometimes you need context without consequences:
- ๐ฌ Sensitive conversations that shouldn't persist in agent memory
- ๐งช Experiments you don't want polluting your agent's knowledge base
- ๐ Client data discussed but not stored
- ๐ค Brainstorming that shouldn't bias future responses
forgetted is not a prompt. It's software that wraps the agent's persistence layer โ writes silently vanish, reads still work, and the agent resumes normally after.
Install
pip install forgetted
Quick Start
Simple (file-level protection)
from forgetted import ForgetSession
# Everything inside is forgetted โ writes to memory/, logs, deliverables vanish
with ForgetSession("/path/to/agent/workspace"):
agent.chat("tell me about the secret project")
With vector DB protection
from forgetted import ForgetSession
from forgetted.adapters.mem0 import Mem0Adapter
session = ForgetSession(
workspace="/path/to/workspace",
adapters=[Mem0Adapter(memory_instance, user_id="roli")],
)
session.start(checkpoint_summary="Discussing API design")
# ... conversation happens with full context, zero persistence ...
session.stop() # re-enables all layers, cleans up
Trigger detection (for chat agents)
from forgetted import is_forget_trigger, ForgetSession
if is_forget_trigger(user_message): # "/forget", "off the record", etc.
with ForgetSession(workspace):
handle_conversation()
What Gets Blocked
| Layer | How | Status |
|---|---|---|
Memory files (memory/*.md) |
builtins.open patch |
โ Blocked |
| Deliverables / audit logs | builtins.open patch |
โ Blocked |
Session logs (*.jsonl) |
Blocked + deleted on exit | โ Blocked |
| mem0 / semantic memory | Method patch on add/update |
โ Blocked |
| Any custom persistence | Write your own adapter | ๐ Extensible |
How It Works
forgetted uses a layered defense:
-
FileWriteAdapter(always on) โ patchesbuiltins.opento intercept writes to protected paths. Returns no-op file handles instead of raising โ agent code doesn't crash, writes just vanish. -
Mem0Adapter(opt-in) โ patchesmemory.add()andmemory.update()during the window. Post-window cleanup deletes any memories that leaked through. -
ForgetSessionorchestrates everything: checkpoint โ disable adapters โ run conversation โ enable adapters โ cleanup โ delete session log.
Reads are never blocked. The agent has full context โ it just can't write new context.
Write Your Own Adapter
Any persistence layer can be controlled:
from forgetted.adapters.base import PersistenceAdapter
class RedisAdapter(PersistenceAdapter):
name = "redis"
def disable(self):
self._client.config_set("save", "")
self._active = True
def enable(self):
self._client.config_set("save", "3600 1")
self._active = False
def cleanup(self):
for key in self._window_keys:
self._client.delete(key)
@property
def is_active(self): return self._active
Register it: ForgetSession(workspace, adapters=[RedisAdapter(client)])
Trigger Phrases
Built-in detection for natural-language triggers:
| Trigger | Example |
|---|---|
/forgetted |
"/forgetted" |
/forget |
"/forget" |
forget this |
"hey, forget this conversation" |
off the record |
"let's go off the record" |
forgetted mode |
"enable forgetted mode" |
don't remember this |
"don't remember this" |
Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ForgetSession โ
โ (orchestrator โ context manager) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ FileWrite โ โ Mem0 โ โ
โ โ Adapter โ โ Adapter โ ... โ
โ โ (safety net) โ โ (opt-in) โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ checkpoint โ disable โ conversation โ
โ โ enable โ cleanup โ delete log โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
What This Really Is
This is not a UX toggle. It's a memory governance primitive.
Like git: you branch, but you never merge back. The conversation exists in context but is never written to the agent's persistent state. After the window closes, it's as if it never happened.
"I want contextโฆ but I don't want consequences."
Tested
97 tests including an adversarial suite:
- โ Write blocking (open w/a/x/wb/r+, symlinks, binary)
- โ Trigger detection (zero false positives on "forgot password", "forgetful", etc.)
- โ Adapter error isolation (one failing adapter doesn't break others)
- โ Exception safety (cleanup runs even if conversation crashes)
- โ Idempotency (double-start, stop-before-start, double-stop all safe)
Known limitations are documented as xfail tests โ not hidden.
Threat Model
What forgetted blocks: Everything the agent controls โ memory files, vector DB writes, session logs, deliverables.
What forgetted does NOT block: LLM API provider logs, network telemetry, OS-level forensics. That's not the point.
The guarantee: "If someone looks through the agent's memory and logs, they won't find what you forgetted."
License
Apache-2.0 โ Hermes Labs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file forgetted-0.2.0.tar.gz.
File metadata
- Download URL: forgetted-0.2.0.tar.gz
- Upload date:
- Size: 21.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a68cc057ffa6b5d8c9e6e0cf1d7b59e82d99c89a7077241a9794f28a041e97e9
|
|
| MD5 |
5d3928cd4f6970b06c387a659bff8da2
|
|
| BLAKE2b-256 |
caf589d36e538a0d72094c0738e722c207811c939bb2bc4ad0153e2f22522a77
|
File details
Details for the file forgetted-0.2.0-py3-none-any.whl.
File metadata
- Download URL: forgetted-0.2.0-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b34dd7c9a7c02e420772472a854fbcf560fc1c410f1fb700b7276fd76e1a9754
|
|
| MD5 |
cd4bab0b9a0d706a8c1e3326855d585f
|
|
| BLAKE2b-256 |
a2351b57170c13a5446dea2e1e9831bcfb2b04c668aa2f3b1fc7493c1db6f91c
|