forgetted 0.2.0__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- forgetted-0.2.2/LICENSE +190 -0
- {forgetted-0.2.0/forgetted.egg-info → forgetted-0.2.2}/PKG-INFO +58 -27
- forgetted-0.2.0/PKG-INFO → forgetted-0.2.2/README.md +44 -45
- {forgetted-0.2.0 → forgetted-0.2.2}/forgetted/__init__.py +1 -1
- {forgetted-0.2.0 → forgetted-0.2.2}/forgetted/adapters/mem0.py +23 -6
- forgetted-0.2.2/forgetted.egg-info/PKG-INFO +250 -0
- {forgetted-0.2.0 → forgetted-0.2.2}/forgetted.egg-info/SOURCES.txt +1 -0
- forgetted-0.2.2/forgetted.egg-info/requires.txt +8 -0
- {forgetted-0.2.0 → forgetted-0.2.2}/pyproject.toml +13 -12
- {forgetted-0.2.0 → forgetted-0.2.2}/tests/test_adapters.py +37 -0
- forgetted-0.2.0/README.md +0 -190
- forgetted-0.2.0/forgetted.egg-info/requires.txt +0 -8
- {forgetted-0.2.0 → forgetted-0.2.2}/forgetted/adapters/__init__.py +0 -0
- {forgetted-0.2.0 → forgetted-0.2.2}/forgetted/adapters/base.py +0 -0
- {forgetted-0.2.0 → forgetted-0.2.2}/forgetted/adapters/file_write.py +0 -0
- {forgetted-0.2.0 → forgetted-0.2.2}/forgetted/checkpoint.py +0 -0
- {forgetted-0.2.0 → forgetted-0.2.2}/forgetted/cleaner.py +0 -0
- {forgetted-0.2.0 → forgetted-0.2.2}/forgetted/guard.py +0 -0
- {forgetted-0.2.0 → forgetted-0.2.2}/forgetted/session.py +0 -0
- {forgetted-0.2.0 → forgetted-0.2.2}/forgetted/trigger.py +0 -0
- {forgetted-0.2.0 → forgetted-0.2.2}/forgetted.egg-info/dependency_links.txt +0 -0
- {forgetted-0.2.0 → forgetted-0.2.2}/forgetted.egg-info/top_level.txt +0 -0
- {forgetted-0.2.0 → forgetted-0.2.2}/setup.cfg +0 -0
- {forgetted-0.2.0 → forgetted-0.2.2}/tests/test_adversarial.py +0 -0
- {forgetted-0.2.0 → forgetted-0.2.2}/tests/test_forgetted.py +0 -0
- {forgetted-0.2.0 → forgetted-0.2.2}/tests/test_session.py +0 -0
forgetted-0.2.2/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Rolando Bosch / Hermes Labs
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: forgetted
|
|
3
|
-
Version: 0.2.
|
|
4
|
-
Summary: Selective memory governance for AI agents — branch the timeline, never merge back
|
|
5
|
-
Author-email: Hermes Labs <
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: Selective memory governance for AI agents — branch the timeline, never merge back. By Hermes Labs.
|
|
5
|
+
Author-email: Hermes Labs <roli@hermes-labs.ai>
|
|
6
6
|
License: Apache-2.0
|
|
7
|
-
Project-URL: Homepage, https://
|
|
8
|
-
Project-URL: Repository, https://github.com/
|
|
9
|
-
Project-URL:
|
|
7
|
+
Project-URL: Homepage, https://hermes-labs.ai
|
|
8
|
+
Project-URL: Repository, https://github.com/hermes-labs-ai/forgetted
|
|
9
|
+
Project-URL: Documentation, https://github.com/hermes-labs-ai/forgetted#readme
|
|
10
|
+
Project-URL: Issues, https://github.com/hermes-labs-ai/forgetted/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/hermes-labs-ai/forgetted/blob/main/CHANGELOG.md
|
|
10
12
|
Keywords: llm,agent,memory,privacy,ai-safety,fork,selective-forget
|
|
11
13
|
Classifier: Development Status :: 3 - Alpha
|
|
12
14
|
Classifier: Intended Audience :: Developers
|
|
13
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
15
|
Classifier: Programming Language :: Python :: 3
|
|
15
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
16
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -20,36 +21,44 @@ Classifier: Topic :: Security
|
|
|
20
21
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
22
|
Requires-Python: >=3.9
|
|
22
23
|
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
23
25
|
Provides-Extra: trash
|
|
24
|
-
Requires-Dist: send2trash>=1.
|
|
26
|
+
Requires-Dist: send2trash>=2.1.0; extra == "trash"
|
|
25
27
|
Provides-Extra: dev
|
|
26
|
-
Requires-Dist: pytest>=
|
|
27
|
-
Requires-Dist: pytest-cov>=
|
|
28
|
-
Requires-Dist: ruff>=0.
|
|
28
|
+
Requires-Dist: pytest>=8.4.2; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov>=7.1.0; extra == "dev"
|
|
30
|
+
Requires-Dist: ruff>=0.16.0; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
29
32
|
|
|
30
33
|
<p align="center">
|
|
31
34
|
<h1 align="center">🫥 forgetted</h1>
|
|
32
35
|
<p align="center"><strong>Your AI agent remembers everything. Now it doesn't have to.</strong></p>
|
|
33
36
|
<p align="center">
|
|
34
|
-
<a href="https://pypi.org/project/forgetted/"><img src="https://img.shields.io/pypi/v/forgetted
|
|
35
|
-
<a href="https://
|
|
36
|
-
<a href="https://
|
|
37
|
+
<a href="https://pypi.org/project/forgetted/"><img src="https://img.shields.io/pypi/v/forgetted" alt="PyPI"></a>
|
|
38
|
+
<a href="https://pypi.org/project/forgetted/"><img src="https://img.shields.io/pypi/dm/forgetted" alt="Downloads"></a>
|
|
39
|
+
<a href="https://github.com/hermes-labs-ai/forgetted"><img src="https://img.shields.io/github/stars/hermes-labs-ai/forgetted" alt="Stars"></a>
|
|
40
|
+
<a href="https://github.com/hermes-labs-ai/forgetted/blob/main/LICENSE"><img src="https://img.shields.io/pypi/l/forgetted" alt="License"></a>
|
|
41
|
+
<a href="https://pypi.org/project/forgetted/"><img src="https://img.shields.io/pypi/pyversions/forgetted" alt="Python"></a>
|
|
42
|
+
<a href="https://github.com/hermes-labs-ai/forgetted/actions/workflows/ci.yml"><img src="https://github.com/hermes-labs-ai/forgetted/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
37
43
|
</p>
|
|
38
44
|
</p>
|
|
39
45
|
|
|
40
46
|
---
|
|
41
47
|
|
|
42
|
-
**forgetted** gives AI agents selective memory governance. One
|
|
48
|
+
**forgetted** is a small Python library that gives AI agents selective memory governance: inside a context-managed window the agent keeps full read access but its writes to memory files, session logs, deliverables, and (optionally) a vector store silently vanish and are cleaned up on exit. One `with` block, and your agent keeps full context but persists nothing.
|
|
43
49
|
|
|
44
|
-
> Traditional incognito is
|
|
45
|
-
> **forgetted**
|
|
50
|
+
> Traditional incognito is all-or-nothing: no past, no future, fully isolated.
|
|
51
|
+
> **forgetted** keeps full read continuity while making the write side non-persistent for the duration of a window.
|
|
52
|
+
|
|
53
|
+
Part of the [Hermes Labs reliability stack](https://github.com/hermes-labs-ai).
|
|
46
54
|
|
|
47
55
|
```python
|
|
48
56
|
from forgetted import ForgetSession
|
|
49
57
|
|
|
50
58
|
with ForgetSession("/path/to/workspace"):
|
|
51
59
|
agent.chat("this conversation never happened")
|
|
52
|
-
# ↑
|
|
60
|
+
# ↑ Writes through `builtins.open` to protected workspace paths do not persist.
|
|
61
|
+
# Add an adapter for mem0 or another persistence layer; reads still work.
|
|
53
62
|
```
|
|
54
63
|
|
|
55
64
|
## Why?
|
|
@@ -191,29 +200,51 @@ Built-in detection for natural-language triggers:
|
|
|
191
200
|
|
|
192
201
|
This is not a UX toggle. It's a **memory governance primitive**.
|
|
193
202
|
|
|
194
|
-
Like git: you branch, but you never merge back. The conversation exists in context
|
|
203
|
+
Like git: you branch, but you never merge back. The conversation exists in context, and the writes it would normally make to the agent's persistent state are intercepted instead. After the window closes, a normal read of the agent's memory and logs shows no trace of it — within the scope described in [Limitations](#limitations).
|
|
195
204
|
|
|
196
205
|
> *"I want context… but I don't want consequences."*
|
|
197
206
|
|
|
198
207
|
## Tested
|
|
199
208
|
|
|
200
|
-
|
|
201
|
-
- ✅ Write blocking
|
|
202
|
-
- ✅ Trigger detection (
|
|
209
|
+
99 tests (97 pass, 2 xfail) including an adversarial suite:
|
|
210
|
+
- ✅ Write blocking via `builtins.open` (modes `w`/`a`/`x`/`wb`/`r+`, symlinks resolved, binary)
|
|
211
|
+
- ✅ Trigger detection (no false positive on "I'm so forgetful today", etc.)
|
|
203
212
|
- ✅ Adapter error isolation (one failing adapter doesn't break others)
|
|
204
|
-
- ✅ Exception safety (cleanup runs even if conversation crashes)
|
|
213
|
+
- ✅ Exception safety (cleanup runs even if the conversation crashes)
|
|
205
214
|
- ✅ Idempotency (double-start, stop-before-start, double-stop all safe)
|
|
206
215
|
|
|
207
|
-
Known
|
|
216
|
+
Known bypasses (writes that do **not** go through `builtins.open`, such as `Path.write_text`/`write_bytes` and `os.open`) are documented as [xfail tests](tests/test_adversarial.py) rather than hidden. See [Limitations](#limitations) below.
|
|
208
217
|
|
|
209
218
|
## Threat Model
|
|
210
219
|
|
|
211
|
-
**What forgetted blocks:**
|
|
220
|
+
**What forgetted blocks:** Writes that go through `builtins.open` to protected workspace paths (`memory/`, `DELIVERABLES.md`, `*.jsonl`), plus mem0 `add`/`update` when the Mem0Adapter is registered.
|
|
221
|
+
|
|
222
|
+
**What forgetted does NOT block:** LLM API provider logs, network telemetry, OS-level forensics, and writes that bypass `builtins.open` (see [Limitations](#limitations)). It is a convenience layer for agent-controlled persistence, not a security or containment boundary.
|
|
223
|
+
|
|
224
|
+
**What you can rely on, within that scope:** writes routed through `builtins.open` to protected paths are intercepted and return no-op handles, so a normal read of the agent's memory and logs afterward does not surface what happened inside the window. This is enforcement by effect (no-op handles + post-window cleanup), not a prompt instruction.
|
|
225
|
+
|
|
226
|
+
## Limitations
|
|
227
|
+
|
|
228
|
+
forgetted is a software convenience layer, not a security boundary. Grounded in the code and the [xfail test suite](tests/test_adversarial.py), it does **not**:
|
|
212
229
|
|
|
213
|
-
**
|
|
230
|
+
- **Catch writes that bypass `builtins.open`.** `Path.write_text`, `Path.write_bytes`, `os.open`, C-extension writes, and subprocesses write directly and are not intercepted. These are documented as xfail tests.
|
|
231
|
+
- **Erase data written before the window opened.** It governs writes during the window only; pre-existing memory is untouched.
|
|
232
|
+
- **Block reads.** By design — the agent keeps full read context.
|
|
233
|
+
- **Intercept writes outside the declared workspace path.**
|
|
234
|
+
- **Block network calls, API calls, or external tool use.**
|
|
235
|
+
- **Support concurrent or nested forgetted sessions on the same workspace** — overlapping windows can break the guard's restore chain (xfail tests).
|
|
236
|
+
- **Defend against an adversary inspecting LLM-provider logs, network traffic, or raw disk forensics.**
|
|
214
237
|
|
|
215
|
-
|
|
238
|
+
For the full machine-readable behavior contract, see [`INTENT.md`](INTENT.md).
|
|
239
|
+
|
|
240
|
+
If forgetted is useful to you, please [star the repo](https://github.com/hermes-labs-ai/forgetted) — it helps others find it.
|
|
216
241
|
|
|
217
242
|
## License
|
|
218
243
|
|
|
219
244
|
[Apache-2.0](LICENSE) — Hermes Labs
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## About Hermes Labs
|
|
249
|
+
|
|
250
|
+
Hermes Labs is an independent AI-reliability lab building open-source tools that catch silent failure modes in production AI. More at [hermes-labs.ai](https://hermes-labs.ai).
|
|
@@ -1,55 +1,32 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: forgetted
|
|
3
|
-
Version: 0.2.0
|
|
4
|
-
Summary: Selective memory governance for AI agents — branch the timeline, never merge back
|
|
5
|
-
Author-email: Hermes Labs <lpcisystems@gmail.com>
|
|
6
|
-
License: Apache-2.0
|
|
7
|
-
Project-URL: Homepage, https://github.com/roli-lpci/forgetted
|
|
8
|
-
Project-URL: Repository, https://github.com/roli-lpci/forgetted
|
|
9
|
-
Project-URL: Issues, https://github.com/roli-lpci/forgetted/issues
|
|
10
|
-
Keywords: llm,agent,memory,privacy,ai-safety,fork,selective-forget
|
|
11
|
-
Classifier: Development Status :: 3 - Alpha
|
|
12
|
-
Classifier: Intended Audience :: Developers
|
|
13
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
-
Classifier: Topic :: Security
|
|
20
|
-
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
-
Requires-Python: >=3.9
|
|
22
|
-
Description-Content-Type: text/markdown
|
|
23
|
-
Provides-Extra: trash
|
|
24
|
-
Requires-Dist: send2trash>=1.8.0; extra == "trash"
|
|
25
|
-
Provides-Extra: dev
|
|
26
|
-
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
27
|
-
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
28
|
-
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
29
|
-
|
|
30
1
|
<p align="center">
|
|
31
2
|
<h1 align="center">🫥 forgetted</h1>
|
|
32
3
|
<p align="center"><strong>Your AI agent remembers everything. Now it doesn't have to.</strong></p>
|
|
33
4
|
<p align="center">
|
|
34
|
-
<a href="https://pypi.org/project/forgetted/"><img src="https://img.shields.io/pypi/v/forgetted
|
|
35
|
-
<a href="https://
|
|
36
|
-
<a href="https://
|
|
5
|
+
<a href="https://pypi.org/project/forgetted/"><img src="https://img.shields.io/pypi/v/forgetted" alt="PyPI"></a>
|
|
6
|
+
<a href="https://pypi.org/project/forgetted/"><img src="https://img.shields.io/pypi/dm/forgetted" alt="Downloads"></a>
|
|
7
|
+
<a href="https://github.com/hermes-labs-ai/forgetted"><img src="https://img.shields.io/github/stars/hermes-labs-ai/forgetted" alt="Stars"></a>
|
|
8
|
+
<a href="https://github.com/hermes-labs-ai/forgetted/blob/main/LICENSE"><img src="https://img.shields.io/pypi/l/forgetted" alt="License"></a>
|
|
9
|
+
<a href="https://pypi.org/project/forgetted/"><img src="https://img.shields.io/pypi/pyversions/forgetted" alt="Python"></a>
|
|
10
|
+
<a href="https://github.com/hermes-labs-ai/forgetted/actions/workflows/ci.yml"><img src="https://github.com/hermes-labs-ai/forgetted/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
37
11
|
</p>
|
|
38
12
|
</p>
|
|
39
13
|
|
|
40
14
|
---
|
|
41
15
|
|
|
42
|
-
**forgetted** gives AI agents selective memory governance. One
|
|
16
|
+
**forgetted** is a small Python library that gives AI agents selective memory governance: inside a context-managed window the agent keeps full read access but its writes to memory files, session logs, deliverables, and (optionally) a vector store silently vanish and are cleaned up on exit. One `with` block, and your agent keeps full context but persists nothing.
|
|
17
|
+
|
|
18
|
+
> Traditional incognito is all-or-nothing: no past, no future, fully isolated.
|
|
19
|
+
> **forgetted** keeps full read continuity while making the write side non-persistent for the duration of a window.
|
|
43
20
|
|
|
44
|
-
|
|
45
|
-
> **forgetted** gives you: full continuity + selective non-persistence.
|
|
21
|
+
Part of the [Hermes Labs reliability stack](https://github.com/hermes-labs-ai).
|
|
46
22
|
|
|
47
23
|
```python
|
|
48
24
|
from forgetted import ForgetSession
|
|
49
25
|
|
|
50
26
|
with ForgetSession("/path/to/workspace"):
|
|
51
27
|
agent.chat("this conversation never happened")
|
|
52
|
-
# ↑
|
|
28
|
+
# ↑ Writes through `builtins.open` to protected workspace paths do not persist.
|
|
29
|
+
# Add an adapter for mem0 or another persistence layer; reads still work.
|
|
53
30
|
```
|
|
54
31
|
|
|
55
32
|
## Why?
|
|
@@ -191,29 +168,51 @@ Built-in detection for natural-language triggers:
|
|
|
191
168
|
|
|
192
169
|
This is not a UX toggle. It's a **memory governance primitive**.
|
|
193
170
|
|
|
194
|
-
Like git: you branch, but you never merge back. The conversation exists in context
|
|
171
|
+
Like git: you branch, but you never merge back. The conversation exists in context, and the writes it would normally make to the agent's persistent state are intercepted instead. After the window closes, a normal read of the agent's memory and logs shows no trace of it — within the scope described in [Limitations](#limitations).
|
|
195
172
|
|
|
196
173
|
> *"I want context… but I don't want consequences."*
|
|
197
174
|
|
|
198
175
|
## Tested
|
|
199
176
|
|
|
200
|
-
|
|
201
|
-
- ✅ Write blocking
|
|
202
|
-
- ✅ Trigger detection (
|
|
177
|
+
99 tests (97 pass, 2 xfail) including an adversarial suite:
|
|
178
|
+
- ✅ Write blocking via `builtins.open` (modes `w`/`a`/`x`/`wb`/`r+`, symlinks resolved, binary)
|
|
179
|
+
- ✅ Trigger detection (no false positive on "I'm so forgetful today", etc.)
|
|
203
180
|
- ✅ Adapter error isolation (one failing adapter doesn't break others)
|
|
204
|
-
- ✅ Exception safety (cleanup runs even if conversation crashes)
|
|
181
|
+
- ✅ Exception safety (cleanup runs even if the conversation crashes)
|
|
205
182
|
- ✅ Idempotency (double-start, stop-before-start, double-stop all safe)
|
|
206
183
|
|
|
207
|
-
Known
|
|
184
|
+
Known bypasses (writes that do **not** go through `builtins.open`, such as `Path.write_text`/`write_bytes` and `os.open`) are documented as [xfail tests](tests/test_adversarial.py) rather than hidden. See [Limitations](#limitations) below.
|
|
208
185
|
|
|
209
186
|
## Threat Model
|
|
210
187
|
|
|
211
|
-
**What forgetted blocks:**
|
|
188
|
+
**What forgetted blocks:** Writes that go through `builtins.open` to protected workspace paths (`memory/`, `DELIVERABLES.md`, `*.jsonl`), plus mem0 `add`/`update` when the Mem0Adapter is registered.
|
|
189
|
+
|
|
190
|
+
**What forgetted does NOT block:** LLM API provider logs, network telemetry, OS-level forensics, and writes that bypass `builtins.open` (see [Limitations](#limitations)). It is a convenience layer for agent-controlled persistence, not a security or containment boundary.
|
|
191
|
+
|
|
192
|
+
**What you can rely on, within that scope:** writes routed through `builtins.open` to protected paths are intercepted and return no-op handles, so a normal read of the agent's memory and logs afterward does not surface what happened inside the window. This is enforcement by effect (no-op handles + post-window cleanup), not a prompt instruction.
|
|
193
|
+
|
|
194
|
+
## Limitations
|
|
195
|
+
|
|
196
|
+
forgetted is a software convenience layer, not a security boundary. Grounded in the code and the [xfail test suite](tests/test_adversarial.py), it does **not**:
|
|
212
197
|
|
|
213
|
-
**
|
|
198
|
+
- **Catch writes that bypass `builtins.open`.** `Path.write_text`, `Path.write_bytes`, `os.open`, C-extension writes, and subprocesses write directly and are not intercepted. These are documented as xfail tests.
|
|
199
|
+
- **Erase data written before the window opened.** It governs writes during the window only; pre-existing memory is untouched.
|
|
200
|
+
- **Block reads.** By design — the agent keeps full read context.
|
|
201
|
+
- **Intercept writes outside the declared workspace path.**
|
|
202
|
+
- **Block network calls, API calls, or external tool use.**
|
|
203
|
+
- **Support concurrent or nested forgetted sessions on the same workspace** — overlapping windows can break the guard's restore chain (xfail tests).
|
|
204
|
+
- **Defend against an adversary inspecting LLM-provider logs, network traffic, or raw disk forensics.**
|
|
214
205
|
|
|
215
|
-
|
|
206
|
+
For the full machine-readable behavior contract, see [`INTENT.md`](INTENT.md).
|
|
207
|
+
|
|
208
|
+
If forgetted is useful to you, please [star the repo](https://github.com/hermes-labs-ai/forgetted) — it helps others find it.
|
|
216
209
|
|
|
217
210
|
## License
|
|
218
211
|
|
|
219
212
|
[Apache-2.0](LICENSE) — Hermes Labs
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## About Hermes Labs
|
|
217
|
+
|
|
218
|
+
Hermes Labs is an independent AI-reliability lab building open-source tools that catch silent failure modes in production AI. More at [hermes-labs.ai](https://hermes-labs.ai).
|
|
@@ -10,13 +10,33 @@ Requires: ``pip install mem0ai`` (optional dependency).
|
|
|
10
10
|
|
|
11
11
|
import logging
|
|
12
12
|
import time
|
|
13
|
-
from
|
|
13
|
+
from datetime import datetime
|
|
14
|
+
from typing import Any, Optional
|
|
14
15
|
|
|
15
16
|
from .base import PersistenceAdapter
|
|
16
17
|
|
|
17
18
|
logger = logging.getLogger(__name__)
|
|
18
19
|
|
|
19
20
|
|
|
21
|
+
def _created_at_epoch(value: Any) -> Optional[float]:
|
|
22
|
+
"""Return an epoch for unambiguous mem0 timestamps, else ``None``."""
|
|
23
|
+
if isinstance(value, (int, float)) and not isinstance(value, bool):
|
|
24
|
+
return float(value)
|
|
25
|
+
if not isinstance(value, str):
|
|
26
|
+
return None
|
|
27
|
+
|
|
28
|
+
normalized = value.strip()
|
|
29
|
+
if normalized.endswith(("Z", "z")):
|
|
30
|
+
normalized = normalized[:-1] + "+00:00"
|
|
31
|
+
try:
|
|
32
|
+
parsed = datetime.fromisoformat(normalized)
|
|
33
|
+
except ValueError:
|
|
34
|
+
return None
|
|
35
|
+
if parsed.tzinfo is None:
|
|
36
|
+
return None
|
|
37
|
+
return parsed.timestamp()
|
|
38
|
+
|
|
39
|
+
|
|
20
40
|
class Mem0Adapter(PersistenceAdapter):
|
|
21
41
|
"""Adapter for mem0 (semantic memory layer).
|
|
22
42
|
|
|
@@ -108,11 +128,8 @@ class Mem0Adapter(PersistenceAdapter):
|
|
|
108
128
|
memories = all_memories if isinstance(all_memories, list) else all_memories.get("results", [])
|
|
109
129
|
deleted = 0
|
|
110
130
|
for mem in memories:
|
|
111
|
-
created = mem.get("created_at"
|
|
112
|
-
|
|
113
|
-
if isinstance(created, str):
|
|
114
|
-
continue # Skip string timestamps for now — timestamp comparison is fragile
|
|
115
|
-
if created >= self._window_start:
|
|
131
|
+
created = _created_at_epoch(mem.get("created_at"))
|
|
132
|
+
if created is not None and created >= self._window_start:
|
|
116
133
|
try:
|
|
117
134
|
self._memory.delete(mem["id"])
|
|
118
135
|
deleted += 1
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: forgetted
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: Selective memory governance for AI agents — branch the timeline, never merge back. By Hermes Labs.
|
|
5
|
+
Author-email: Hermes Labs <roli@hermes-labs.ai>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://hermes-labs.ai
|
|
8
|
+
Project-URL: Repository, https://github.com/hermes-labs-ai/forgetted
|
|
9
|
+
Project-URL: Documentation, https://github.com/hermes-labs-ai/forgetted#readme
|
|
10
|
+
Project-URL: Issues, https://github.com/hermes-labs-ai/forgetted/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/hermes-labs-ai/forgetted/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: llm,agent,memory,privacy,ai-safety,fork,selective-forget
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Security
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Provides-Extra: trash
|
|
26
|
+
Requires-Dist: send2trash>=2.1.0; extra == "trash"
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=8.4.2; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov>=7.1.0; extra == "dev"
|
|
30
|
+
Requires-Dist: ruff>=0.16.0; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
<p align="center">
|
|
34
|
+
<h1 align="center">🫥 forgetted</h1>
|
|
35
|
+
<p align="center"><strong>Your AI agent remembers everything. Now it doesn't have to.</strong></p>
|
|
36
|
+
<p align="center">
|
|
37
|
+
<a href="https://pypi.org/project/forgetted/"><img src="https://img.shields.io/pypi/v/forgetted" alt="PyPI"></a>
|
|
38
|
+
<a href="https://pypi.org/project/forgetted/"><img src="https://img.shields.io/pypi/dm/forgetted" alt="Downloads"></a>
|
|
39
|
+
<a href="https://github.com/hermes-labs-ai/forgetted"><img src="https://img.shields.io/github/stars/hermes-labs-ai/forgetted" alt="Stars"></a>
|
|
40
|
+
<a href="https://github.com/hermes-labs-ai/forgetted/blob/main/LICENSE"><img src="https://img.shields.io/pypi/l/forgetted" alt="License"></a>
|
|
41
|
+
<a href="https://pypi.org/project/forgetted/"><img src="https://img.shields.io/pypi/pyversions/forgetted" alt="Python"></a>
|
|
42
|
+
<a href="https://github.com/hermes-labs-ai/forgetted/actions/workflows/ci.yml"><img src="https://github.com/hermes-labs-ai/forgetted/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
43
|
+
</p>
|
|
44
|
+
</p>
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
**forgetted** is a small Python library that gives AI agents selective memory governance: inside a context-managed window the agent keeps full read access but its writes to memory files, session logs, deliverables, and (optionally) a vector store silently vanish and are cleaned up on exit. One `with` block, and your agent keeps full context but persists nothing.
|
|
49
|
+
|
|
50
|
+
> Traditional incognito is all-or-nothing: no past, no future, fully isolated.
|
|
51
|
+
> **forgetted** keeps full read continuity while making the write side non-persistent for the duration of a window.
|
|
52
|
+
|
|
53
|
+
Part of the [Hermes Labs reliability stack](https://github.com/hermes-labs-ai).
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from forgetted import ForgetSession
|
|
57
|
+
|
|
58
|
+
with ForgetSession("/path/to/workspace"):
|
|
59
|
+
agent.chat("this conversation never happened")
|
|
60
|
+
# ↑ Writes through `builtins.open` to protected workspace paths do not persist.
|
|
61
|
+
# Add an adapter for mem0 or another persistence layer; reads still work.
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Why?
|
|
65
|
+
|
|
66
|
+
AI agents write everything: memory files, session logs, vector embeddings, deliverables. Sometimes you need context without consequences:
|
|
67
|
+
|
|
68
|
+
- 💬 **Sensitive conversations** that shouldn't persist in agent memory
|
|
69
|
+
- 🧪 **Experiments** you don't want polluting your agent's knowledge base
|
|
70
|
+
- 🔒 **Client data** discussed but not stored
|
|
71
|
+
- 🤔 **Brainstorming** that shouldn't bias future responses
|
|
72
|
+
|
|
73
|
+
**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.
|
|
74
|
+
|
|
75
|
+
## Install
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install forgetted
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Quick Start
|
|
82
|
+
|
|
83
|
+
### Simple (file-level protection)
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from forgetted import ForgetSession
|
|
87
|
+
|
|
88
|
+
# Everything inside is forgetted — writes to memory/, logs, deliverables vanish
|
|
89
|
+
with ForgetSession("/path/to/agent/workspace"):
|
|
90
|
+
agent.chat("tell me about the secret project")
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### With vector DB protection
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
from forgetted import ForgetSession
|
|
97
|
+
from forgetted.adapters.mem0 import Mem0Adapter
|
|
98
|
+
|
|
99
|
+
session = ForgetSession(
|
|
100
|
+
workspace="/path/to/workspace",
|
|
101
|
+
adapters=[Mem0Adapter(memory_instance, user_id="roli")],
|
|
102
|
+
)
|
|
103
|
+
session.start(checkpoint_summary="Discussing API design")
|
|
104
|
+
# ... conversation happens with full context, zero persistence ...
|
|
105
|
+
session.stop() # re-enables all layers, cleans up
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Trigger detection (for chat agents)
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
from forgetted import is_forget_trigger, ForgetSession
|
|
112
|
+
|
|
113
|
+
if is_forget_trigger(user_message): # "/forget", "off the record", etc.
|
|
114
|
+
with ForgetSession(workspace):
|
|
115
|
+
handle_conversation()
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## What Gets Blocked
|
|
119
|
+
|
|
120
|
+
| Layer | How | Status |
|
|
121
|
+
|---|---|---|
|
|
122
|
+
| Memory files (`memory/*.md`) | `builtins.open` patch | ✅ Blocked |
|
|
123
|
+
| Deliverables / audit logs | `builtins.open` patch | ✅ Blocked |
|
|
124
|
+
| Session logs (`*.jsonl`) | Blocked + deleted on exit | ✅ Blocked |
|
|
125
|
+
| mem0 / semantic memory | Method patch on `add`/`update` | ✅ Blocked |
|
|
126
|
+
| Any custom persistence | Write your own adapter | 🔌 Extensible |
|
|
127
|
+
|
|
128
|
+
## How It Works
|
|
129
|
+
|
|
130
|
+
**forgetted** uses a layered defense:
|
|
131
|
+
|
|
132
|
+
1. **`FileWriteAdapter`** (always on) — patches `builtins.open` to intercept writes to protected paths. Returns no-op file handles instead of raising — agent code doesn't crash, writes just vanish.
|
|
133
|
+
|
|
134
|
+
2. **`Mem0Adapter`** (opt-in) — patches `memory.add()` and `memory.update()` during the window. Post-window cleanup deletes any memories that leaked through.
|
|
135
|
+
|
|
136
|
+
3. **`ForgetSession`** orchestrates everything: checkpoint → disable adapters → run conversation → enable adapters → cleanup → delete session log.
|
|
137
|
+
|
|
138
|
+
Reads are **never** blocked. The agent has full context — it just can't write new context.
|
|
139
|
+
|
|
140
|
+
## Write Your Own Adapter
|
|
141
|
+
|
|
142
|
+
Any persistence layer can be controlled:
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
from forgetted.adapters.base import PersistenceAdapter
|
|
146
|
+
|
|
147
|
+
class RedisAdapter(PersistenceAdapter):
|
|
148
|
+
name = "redis"
|
|
149
|
+
|
|
150
|
+
def disable(self):
|
|
151
|
+
self._client.config_set("save", "")
|
|
152
|
+
self._active = True
|
|
153
|
+
|
|
154
|
+
def enable(self):
|
|
155
|
+
self._client.config_set("save", "3600 1")
|
|
156
|
+
self._active = False
|
|
157
|
+
|
|
158
|
+
def cleanup(self):
|
|
159
|
+
for key in self._window_keys:
|
|
160
|
+
self._client.delete(key)
|
|
161
|
+
|
|
162
|
+
@property
|
|
163
|
+
def is_active(self): return self._active
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Register it: `ForgetSession(workspace, adapters=[RedisAdapter(client)])`
|
|
167
|
+
|
|
168
|
+
## Trigger Phrases
|
|
169
|
+
|
|
170
|
+
Built-in detection for natural-language triggers:
|
|
171
|
+
|
|
172
|
+
| Trigger | Example |
|
|
173
|
+
|---|---|
|
|
174
|
+
| `/forgetted` | "/forgetted" |
|
|
175
|
+
| `/forget` | "/forget" |
|
|
176
|
+
| `forget this` | "hey, forget this conversation" |
|
|
177
|
+
| `off the record` | "let's go off the record" |
|
|
178
|
+
| `forgetted mode` | "enable forgetted mode" |
|
|
179
|
+
| `don't remember this` | "don't remember this" |
|
|
180
|
+
|
|
181
|
+
## Architecture
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
┌─────────────────────────────────────────┐
|
|
185
|
+
│ ForgetSession │
|
|
186
|
+
│ (orchestrator — context manager) │
|
|
187
|
+
├─────────────────────────────────────────┤
|
|
188
|
+
│ ┌──────────────┐ ┌──────────────┐ │
|
|
189
|
+
│ │ FileWrite │ │ Mem0 │ │
|
|
190
|
+
│ │ Adapter │ │ Adapter │ ... │
|
|
191
|
+
│ │ (safety net) │ │ (opt-in) │ │
|
|
192
|
+
│ └──────────────┘ └──────────────┘ │
|
|
193
|
+
├─────────────────────────────────────────┤
|
|
194
|
+
│ checkpoint → disable → conversation │
|
|
195
|
+
│ → enable → cleanup → delete log │
|
|
196
|
+
└─────────────────────────────────────────┘
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## What This Really Is
|
|
200
|
+
|
|
201
|
+
This is not a UX toggle. It's a **memory governance primitive**.
|
|
202
|
+
|
|
203
|
+
Like git: you branch, but you never merge back. The conversation exists in context, and the writes it would normally make to the agent's persistent state are intercepted instead. After the window closes, a normal read of the agent's memory and logs shows no trace of it — within the scope described in [Limitations](#limitations).
|
|
204
|
+
|
|
205
|
+
> *"I want context… but I don't want consequences."*
|
|
206
|
+
|
|
207
|
+
## Tested
|
|
208
|
+
|
|
209
|
+
99 tests (97 pass, 2 xfail) including an adversarial suite:
|
|
210
|
+
- ✅ Write blocking via `builtins.open` (modes `w`/`a`/`x`/`wb`/`r+`, symlinks resolved, binary)
|
|
211
|
+
- ✅ Trigger detection (no false positive on "I'm so forgetful today", etc.)
|
|
212
|
+
- ✅ Adapter error isolation (one failing adapter doesn't break others)
|
|
213
|
+
- ✅ Exception safety (cleanup runs even if the conversation crashes)
|
|
214
|
+
- ✅ Idempotency (double-start, stop-before-start, double-stop all safe)
|
|
215
|
+
|
|
216
|
+
Known bypasses (writes that do **not** go through `builtins.open`, such as `Path.write_text`/`write_bytes` and `os.open`) are documented as [xfail tests](tests/test_adversarial.py) rather than hidden. See [Limitations](#limitations) below.
|
|
217
|
+
|
|
218
|
+
## Threat Model
|
|
219
|
+
|
|
220
|
+
**What forgetted blocks:** Writes that go through `builtins.open` to protected workspace paths (`memory/`, `DELIVERABLES.md`, `*.jsonl`), plus mem0 `add`/`update` when the Mem0Adapter is registered.
|
|
221
|
+
|
|
222
|
+
**What forgetted does NOT block:** LLM API provider logs, network telemetry, OS-level forensics, and writes that bypass `builtins.open` (see [Limitations](#limitations)). It is a convenience layer for agent-controlled persistence, not a security or containment boundary.
|
|
223
|
+
|
|
224
|
+
**What you can rely on, within that scope:** writes routed through `builtins.open` to protected paths are intercepted and return no-op handles, so a normal read of the agent's memory and logs afterward does not surface what happened inside the window. This is enforcement by effect (no-op handles + post-window cleanup), not a prompt instruction.
|
|
225
|
+
|
|
226
|
+
## Limitations
|
|
227
|
+
|
|
228
|
+
forgetted is a software convenience layer, not a security boundary. Grounded in the code and the [xfail test suite](tests/test_adversarial.py), it does **not**:
|
|
229
|
+
|
|
230
|
+
- **Catch writes that bypass `builtins.open`.** `Path.write_text`, `Path.write_bytes`, `os.open`, C-extension writes, and subprocesses write directly and are not intercepted. These are documented as xfail tests.
|
|
231
|
+
- **Erase data written before the window opened.** It governs writes during the window only; pre-existing memory is untouched.
|
|
232
|
+
- **Block reads.** By design — the agent keeps full read context.
|
|
233
|
+
- **Intercept writes outside the declared workspace path.**
|
|
234
|
+
- **Block network calls, API calls, or external tool use.**
|
|
235
|
+
- **Support concurrent or nested forgetted sessions on the same workspace** — overlapping windows can break the guard's restore chain (xfail tests).
|
|
236
|
+
- **Defend against an adversary inspecting LLM-provider logs, network traffic, or raw disk forensics.**
|
|
237
|
+
|
|
238
|
+
For the full machine-readable behavior contract, see [`INTENT.md`](INTENT.md).
|
|
239
|
+
|
|
240
|
+
If forgetted is useful to you, please [star the repo](https://github.com/hermes-labs-ai/forgetted) — it helps others find it.
|
|
241
|
+
|
|
242
|
+
## License
|
|
243
|
+
|
|
244
|
+
[Apache-2.0](LICENSE) — Hermes Labs
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## About Hermes Labs
|
|
249
|
+
|
|
250
|
+
Hermes Labs is an independent AI-reliability lab building open-source tools that catch silent failure modes in production AI. More at [hermes-labs.ai](https://hermes-labs.ai).
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools>=
|
|
2
|
+
requires = ["setuptools>=82.0.1", "wheel"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "forgetted"
|
|
7
|
-
version = "0.2.
|
|
8
|
-
description = "Selective memory governance for AI agents — branch the timeline, never merge back"
|
|
7
|
+
version = "0.2.2"
|
|
8
|
+
description = "Selective memory governance for AI agents — branch the timeline, never merge back. By Hermes Labs."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = {text = "Apache-2.0"}
|
|
11
11
|
requires-python = ">=3.9"
|
|
12
12
|
authors = [
|
|
13
|
-
{name = "Hermes Labs", email = "
|
|
13
|
+
{name = "Hermes Labs", email = "roli@hermes-labs.ai"},
|
|
14
14
|
]
|
|
15
15
|
keywords = ["llm", "agent", "memory", "privacy", "ai-safety", "fork", "selective-forget"]
|
|
16
16
|
classifiers = [
|
|
17
17
|
"Development Status :: 3 - Alpha",
|
|
18
18
|
"Intended Audience :: Developers",
|
|
19
|
-
"License :: OSI Approved :: Apache Software License",
|
|
20
19
|
"Programming Language :: Python :: 3",
|
|
21
20
|
"Programming Language :: Python :: 3.9",
|
|
22
21
|
"Programming Language :: Python :: 3.10",
|
|
@@ -28,17 +27,19 @@ classifiers = [
|
|
|
28
27
|
dependencies = []
|
|
29
28
|
|
|
30
29
|
[project.optional-dependencies]
|
|
31
|
-
trash = ["send2trash>=1.
|
|
30
|
+
trash = ["send2trash>=2.1.0"]
|
|
32
31
|
dev = [
|
|
33
|
-
"pytest>=
|
|
34
|
-
"pytest-cov>=
|
|
35
|
-
"ruff>=0.
|
|
32
|
+
"pytest>=8.4.2",
|
|
33
|
+
"pytest-cov>=7.1.0",
|
|
34
|
+
"ruff>=0.16.0",
|
|
36
35
|
]
|
|
37
36
|
|
|
38
37
|
[project.urls]
|
|
39
|
-
Homepage = "https://
|
|
40
|
-
Repository = "https://github.com/
|
|
41
|
-
|
|
38
|
+
Homepage = "https://hermes-labs.ai"
|
|
39
|
+
Repository = "https://github.com/hermes-labs-ai/forgetted"
|
|
40
|
+
Documentation = "https://github.com/hermes-labs-ai/forgetted#readme"
|
|
41
|
+
Issues = "https://github.com/hermes-labs-ai/forgetted/issues"
|
|
42
|
+
Changelog = "https://github.com/hermes-labs-ai/forgetted/blob/main/CHANGELOG.md"
|
|
42
43
|
|
|
43
44
|
[tool.setuptools.packages.find]
|
|
44
45
|
include = ["forgetted*"]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Tests for persistence adapters."""
|
|
2
2
|
|
|
3
3
|
import shutil
|
|
4
|
+
from datetime import datetime, timedelta, timezone
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
from unittest.mock import MagicMock
|
|
6
7
|
|
|
@@ -133,6 +134,42 @@ class TestMem0Adapter:
|
|
|
133
134
|
adapter.enable()
|
|
134
135
|
adapter.cleanup() # should not raise
|
|
135
136
|
|
|
137
|
+
def test_cleanup_deletes_new_timezone_aware_iso_memories_only(self):
|
|
138
|
+
from forgetted.adapters.mem0 import Mem0Adapter
|
|
139
|
+
|
|
140
|
+
boundary = datetime(2026, 7, 31, 12, 0, tzinfo=timezone.utc)
|
|
141
|
+
mock_memory = self._make_mock_memory()
|
|
142
|
+
mock_memory.get_all.return_value = {
|
|
143
|
+
"results": [
|
|
144
|
+
{"id": "old", "created_at": (boundary - timedelta(seconds=1)).isoformat()},
|
|
145
|
+
{"id": "new-offset", "created_at": (boundary + timedelta(seconds=1)).isoformat()},
|
|
146
|
+
{"id": "new-z", "created_at": "2026-07-31T12:00:02Z"},
|
|
147
|
+
{"id": "ambiguous", "created_at": "2026-07-31T12:00:03"},
|
|
148
|
+
{"id": "invalid", "created_at": "not-a-timestamp"},
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
adapter = Mem0Adapter(mock_memory)
|
|
152
|
+
adapter._window_start = boundary.timestamp()
|
|
153
|
+
|
|
154
|
+
adapter.cleanup()
|
|
155
|
+
|
|
156
|
+
assert [call.args[0] for call in mock_memory.delete.call_args_list] == ["new-offset", "new-z"]
|
|
157
|
+
|
|
158
|
+
def test_cleanup_keeps_support_for_epoch_timestamps(self):
|
|
159
|
+
from forgetted.adapters.mem0 import Mem0Adapter
|
|
160
|
+
|
|
161
|
+
mock_memory = self._make_mock_memory()
|
|
162
|
+
mock_memory.get_all.return_value = [
|
|
163
|
+
{"id": "old", "created_at": 99.0},
|
|
164
|
+
{"id": "new", "created_at": 101.0},
|
|
165
|
+
]
|
|
166
|
+
adapter = Mem0Adapter(mock_memory)
|
|
167
|
+
adapter._window_start = 100.0
|
|
168
|
+
|
|
169
|
+
adapter.cleanup()
|
|
170
|
+
|
|
171
|
+
mock_memory.delete.assert_called_once_with("new")
|
|
172
|
+
|
|
136
173
|
def test_idempotent_disable(self):
|
|
137
174
|
from forgetted.adapters.mem0 import Mem0Adapter
|
|
138
175
|
|
forgetted-0.2.0/README.md
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<h1 align="center">🫥 forgetted</h1>
|
|
3
|
-
<p align="center"><strong>Your AI agent remembers everything. Now it doesn't have to.</strong></p>
|
|
4
|
-
<p align="center">
|
|
5
|
-
<a href="https://pypi.org/project/forgetted/"><img src="https://img.shields.io/pypi/v/forgetted?color=blue" alt="PyPI"></a>
|
|
6
|
-
<a href="https://github.com/roli-lpci/forgetted/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-green" alt="License"></a>
|
|
7
|
-
<a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.9+-blue" alt="Python"></a>
|
|
8
|
-
</p>
|
|
9
|
-
</p>
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
**forgetted** gives AI agents selective memory governance. One line of code, and your agent keeps full context but writes nothing to memory.
|
|
14
|
-
|
|
15
|
-
> Traditional incognito is dumb: no past, no future, fully isolated.
|
|
16
|
-
> **forgetted** gives you: full continuity + selective non-persistence.
|
|
17
|
-
|
|
18
|
-
```python
|
|
19
|
-
from forgetted import ForgetSession
|
|
20
|
-
|
|
21
|
-
with ForgetSession("/path/to/workspace"):
|
|
22
|
-
agent.chat("this conversation never happened")
|
|
23
|
-
# ↑ No trace in memory, logs, or vector DB. Agent resumes normally.
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Why?
|
|
27
|
-
|
|
28
|
-
AI agents write everything: memory files, session logs, vector embeddings, deliverables. Sometimes you need context without consequences:
|
|
29
|
-
|
|
30
|
-
- 💬 **Sensitive conversations** that shouldn't persist in agent memory
|
|
31
|
-
- 🧪 **Experiments** you don't want polluting your agent's knowledge base
|
|
32
|
-
- 🔒 **Client data** discussed but not stored
|
|
33
|
-
- 🤔 **Brainstorming** that shouldn't bias future responses
|
|
34
|
-
|
|
35
|
-
**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.
|
|
36
|
-
|
|
37
|
-
## Install
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
pip install forgetted
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Quick Start
|
|
44
|
-
|
|
45
|
-
### Simple (file-level protection)
|
|
46
|
-
|
|
47
|
-
```python
|
|
48
|
-
from forgetted import ForgetSession
|
|
49
|
-
|
|
50
|
-
# Everything inside is forgetted — writes to memory/, logs, deliverables vanish
|
|
51
|
-
with ForgetSession("/path/to/agent/workspace"):
|
|
52
|
-
agent.chat("tell me about the secret project")
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### With vector DB protection
|
|
56
|
-
|
|
57
|
-
```python
|
|
58
|
-
from forgetted import ForgetSession
|
|
59
|
-
from forgetted.adapters.mem0 import Mem0Adapter
|
|
60
|
-
|
|
61
|
-
session = ForgetSession(
|
|
62
|
-
workspace="/path/to/workspace",
|
|
63
|
-
adapters=[Mem0Adapter(memory_instance, user_id="roli")],
|
|
64
|
-
)
|
|
65
|
-
session.start(checkpoint_summary="Discussing API design")
|
|
66
|
-
# ... conversation happens with full context, zero persistence ...
|
|
67
|
-
session.stop() # re-enables all layers, cleans up
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### Trigger detection (for chat agents)
|
|
71
|
-
|
|
72
|
-
```python
|
|
73
|
-
from forgetted import is_forget_trigger, ForgetSession
|
|
74
|
-
|
|
75
|
-
if is_forget_trigger(user_message): # "/forget", "off the record", etc.
|
|
76
|
-
with ForgetSession(workspace):
|
|
77
|
-
handle_conversation()
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## What Gets Blocked
|
|
81
|
-
|
|
82
|
-
| Layer | How | Status |
|
|
83
|
-
|---|---|---|
|
|
84
|
-
| Memory files (`memory/*.md`) | `builtins.open` patch | ✅ Blocked |
|
|
85
|
-
| Deliverables / audit logs | `builtins.open` patch | ✅ Blocked |
|
|
86
|
-
| Session logs (`*.jsonl`) | Blocked + deleted on exit | ✅ Blocked |
|
|
87
|
-
| mem0 / semantic memory | Method patch on `add`/`update` | ✅ Blocked |
|
|
88
|
-
| Any custom persistence | Write your own adapter | 🔌 Extensible |
|
|
89
|
-
|
|
90
|
-
## How It Works
|
|
91
|
-
|
|
92
|
-
**forgetted** uses a layered defense:
|
|
93
|
-
|
|
94
|
-
1. **`FileWriteAdapter`** (always on) — patches `builtins.open` to intercept writes to protected paths. Returns no-op file handles instead of raising — agent code doesn't crash, writes just vanish.
|
|
95
|
-
|
|
96
|
-
2. **`Mem0Adapter`** (opt-in) — patches `memory.add()` and `memory.update()` during the window. Post-window cleanup deletes any memories that leaked through.
|
|
97
|
-
|
|
98
|
-
3. **`ForgetSession`** orchestrates everything: checkpoint → disable adapters → run conversation → enable adapters → cleanup → delete session log.
|
|
99
|
-
|
|
100
|
-
Reads are **never** blocked. The agent has full context — it just can't write new context.
|
|
101
|
-
|
|
102
|
-
## Write Your Own Adapter
|
|
103
|
-
|
|
104
|
-
Any persistence layer can be controlled:
|
|
105
|
-
|
|
106
|
-
```python
|
|
107
|
-
from forgetted.adapters.base import PersistenceAdapter
|
|
108
|
-
|
|
109
|
-
class RedisAdapter(PersistenceAdapter):
|
|
110
|
-
name = "redis"
|
|
111
|
-
|
|
112
|
-
def disable(self):
|
|
113
|
-
self._client.config_set("save", "")
|
|
114
|
-
self._active = True
|
|
115
|
-
|
|
116
|
-
def enable(self):
|
|
117
|
-
self._client.config_set("save", "3600 1")
|
|
118
|
-
self._active = False
|
|
119
|
-
|
|
120
|
-
def cleanup(self):
|
|
121
|
-
for key in self._window_keys:
|
|
122
|
-
self._client.delete(key)
|
|
123
|
-
|
|
124
|
-
@property
|
|
125
|
-
def is_active(self): return self._active
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
Register it: `ForgetSession(workspace, adapters=[RedisAdapter(client)])`
|
|
129
|
-
|
|
130
|
-
## Trigger Phrases
|
|
131
|
-
|
|
132
|
-
Built-in detection for natural-language triggers:
|
|
133
|
-
|
|
134
|
-
| Trigger | Example |
|
|
135
|
-
|---|---|
|
|
136
|
-
| `/forgetted` | "/forgetted" |
|
|
137
|
-
| `/forget` | "/forget" |
|
|
138
|
-
| `forget this` | "hey, forget this conversation" |
|
|
139
|
-
| `off the record` | "let's go off the record" |
|
|
140
|
-
| `forgetted mode` | "enable forgetted mode" |
|
|
141
|
-
| `don't remember this` | "don't remember this" |
|
|
142
|
-
|
|
143
|
-
## Architecture
|
|
144
|
-
|
|
145
|
-
```
|
|
146
|
-
┌─────────────────────────────────────────┐
|
|
147
|
-
│ ForgetSession │
|
|
148
|
-
│ (orchestrator — context manager) │
|
|
149
|
-
├─────────────────────────────────────────┤
|
|
150
|
-
│ ┌──────────────┐ ┌──────────────┐ │
|
|
151
|
-
│ │ FileWrite │ │ Mem0 │ │
|
|
152
|
-
│ │ Adapter │ │ Adapter │ ... │
|
|
153
|
-
│ │ (safety net) │ │ (opt-in) │ │
|
|
154
|
-
│ └──────────────┘ └──────────────┘ │
|
|
155
|
-
├─────────────────────────────────────────┤
|
|
156
|
-
│ checkpoint → disable → conversation │
|
|
157
|
-
│ → enable → cleanup → delete log │
|
|
158
|
-
└─────────────────────────────────────────┘
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
## What This Really Is
|
|
162
|
-
|
|
163
|
-
This is not a UX toggle. It's a **memory governance primitive**.
|
|
164
|
-
|
|
165
|
-
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.
|
|
166
|
-
|
|
167
|
-
> *"I want context… but I don't want consequences."*
|
|
168
|
-
|
|
169
|
-
## Tested
|
|
170
|
-
|
|
171
|
-
97 tests including an adversarial suite:
|
|
172
|
-
- ✅ Write blocking (open w/a/x/wb/r+, symlinks, binary)
|
|
173
|
-
- ✅ Trigger detection (zero false positives on "forgot password", "forgetful", etc.)
|
|
174
|
-
- ✅ Adapter error isolation (one failing adapter doesn't break others)
|
|
175
|
-
- ✅ Exception safety (cleanup runs even if conversation crashes)
|
|
176
|
-
- ✅ Idempotency (double-start, stop-before-start, double-stop all safe)
|
|
177
|
-
|
|
178
|
-
Known limitations are [documented as xfail tests](tests/test_adversarial.py) — not hidden.
|
|
179
|
-
|
|
180
|
-
## Threat Model
|
|
181
|
-
|
|
182
|
-
**What forgetted blocks:** Everything the agent controls — memory files, vector DB writes, session logs, deliverables.
|
|
183
|
-
|
|
184
|
-
**What forgetted does NOT block:** LLM API provider logs, network telemetry, OS-level forensics. That's not the point.
|
|
185
|
-
|
|
186
|
-
**The guarantee:** *"If someone looks through the agent's memory and logs, they won't find what you forgetted."*
|
|
187
|
-
|
|
188
|
-
## License
|
|
189
|
-
|
|
190
|
-
[Apache-2.0](LICENSE) — Hermes Labs
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|