forgetsafe 0.1.0__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.
- forgetsafe-0.1.0/.gitignore +12 -0
- forgetsafe-0.1.0/CHANGELOG.md +50 -0
- forgetsafe-0.1.0/LICENSE +21 -0
- forgetsafe-0.1.0/PKG-INFO +236 -0
- forgetsafe-0.1.0/README.md +150 -0
- forgetsafe-0.1.0/pyproject.toml +99 -0
- forgetsafe-0.1.0/src/forgetsafe/__init__.py +41 -0
- forgetsafe-0.1.0/src/forgetsafe/_version.py +3 -0
- forgetsafe-0.1.0/src/forgetsafe/api.py +52 -0
- forgetsafe-0.1.0/src/forgetsafe/backups.py +117 -0
- forgetsafe-0.1.0/src/forgetsafe/forget/__init__.py +1 -0
- forgetsafe-0.1.0/src/forgetsafe/forget/execute.py +733 -0
- forgetsafe-0.1.0/src/forgetsafe/forget/plan.py +372 -0
- forgetsafe-0.1.0/src/forgetsafe/forget/rederive.py +140 -0
- forgetsafe-0.1.0/src/forgetsafe/forget/resolve.py +436 -0
- forgetsafe-0.1.0/src/forgetsafe/integrations/__init__.py +1 -0
- forgetsafe-0.1.0/src/forgetsafe/integrations/langgraph.py +1302 -0
- forgetsafe-0.1.0/src/forgetsafe/integrations/letta.py +1664 -0
- forgetsafe-0.1.0/src/forgetsafe/integrations/mem0.py +1331 -0
- forgetsafe-0.1.0/src/forgetsafe/lineage/__init__.py +1 -0
- forgetsafe-0.1.0/src/forgetsafe/lineage/capture.py +301 -0
- forgetsafe-0.1.0/src/forgetsafe/lineage/graph.py +944 -0
- forgetsafe-0.1.0/src/forgetsafe/lineage/hashing.py +60 -0
- forgetsafe-0.1.0/src/forgetsafe/lineage/model.py +180 -0
- forgetsafe-0.1.0/src/forgetsafe/pipeline/__init__.py +1 -0
- forgetsafe-0.1.0/src/forgetsafe/pipeline/embedder.py +99 -0
- forgetsafe-0.1.0/src/forgetsafe/pipeline/errors.py +11 -0
- forgetsafe-0.1.0/src/forgetsafe/pipeline/extractor.py +363 -0
- forgetsafe-0.1.0/src/forgetsafe/pipeline/llm.py +147 -0
- forgetsafe-0.1.0/src/forgetsafe/pipeline/memory.py +326 -0
- forgetsafe-0.1.0/src/forgetsafe/pipeline/profile.py +162 -0
- forgetsafe-0.1.0/src/forgetsafe/pipeline/retrieval.py +189 -0
- forgetsafe-0.1.0/src/forgetsafe/pipeline/summarizer.py +124 -0
- forgetsafe-0.1.0/src/forgetsafe/py.typed +0 -0
- forgetsafe-0.1.0/src/forgetsafe/server/__init__.py +1 -0
- forgetsafe-0.1.0/src/forgetsafe/server/api.py +480 -0
- forgetsafe-0.1.0/src/forgetsafe/server/cli.py +317 -0
- forgetsafe-0.1.0/src/forgetsafe/server/config.py +135 -0
- forgetsafe-0.1.0/src/forgetsafe/server/logs.py +94 -0
- forgetsafe-0.1.0/src/forgetsafe/stores/__init__.py +1 -0
- forgetsafe-0.1.0/src/forgetsafe/stores/base.py +120 -0
- forgetsafe-0.1.0/src/forgetsafe/stores/sqlite.py +97 -0
- forgetsafe-0.1.0/src/forgetsafe/stores/vector/__init__.py +1 -0
- forgetsafe-0.1.0/src/forgetsafe/stores/vector/chroma.py +201 -0
- forgetsafe-0.1.0/src/forgetsafe/stores/vector/faiss.py +217 -0
- forgetsafe-0.1.0/src/forgetsafe/stores/vector/numpy.py +146 -0
- forgetsafe-0.1.0/src/forgetsafe/stores/vector/pgvector.py +161 -0
- forgetsafe-0.1.0/src/forgetsafe/stores/vector/qdrant.py +195 -0
- forgetsafe-0.1.0/src/forgetsafe/testing/__init__.py +1 -0
- forgetsafe-0.1.0/src/forgetsafe/testing/fake_embedder.py +35 -0
- forgetsafe-0.1.0/src/forgetsafe/testing/fake_llm.py +220 -0
- forgetsafe-0.1.0/src/forgetsafe/testing/fixtures.py +61 -0
- forgetsafe-0.1.0/src/forgetsafe/verify/__init__.py +1 -0
- forgetsafe-0.1.0/src/forgetsafe/verify/behavioural.py +153 -0
- forgetsafe-0.1.0/src/forgetsafe/verify/certificate.py +412 -0
- forgetsafe-0.1.0/src/forgetsafe/verify/content.py +184 -0
- forgetsafe-0.1.0/src/forgetsafe/verify/probes.py +260 -0
- forgetsafe-0.1.0/src/forgetsafe/verify/run.py +451 -0
- forgetsafe-0.1.0/src/forgetsafe/verify/structural.py +73 -0
- forgetsafe-0.1.0/tests/forget_helpers.py +102 -0
- forgetsafe-0.1.0/tests/snapshots/three_sessions.json +1258 -0
- forgetsafe-0.1.0/tests/test_api.py +26 -0
- forgetsafe-0.1.0/tests/test_backups.py +135 -0
- forgetsafe-0.1.0/tests/test_benchmarks.py +128 -0
- forgetsafe-0.1.0/tests/test_forget_engine.py +638 -0
- forgetsafe-0.1.0/tests/test_integration_langgraph.py +582 -0
- forgetsafe-0.1.0/tests/test_integration_letta.py +385 -0
- forgetsafe-0.1.0/tests/test_integration_mem0.py +364 -0
- forgetsafe-0.1.0/tests/test_integrations_bench.py +120 -0
- forgetsafe-0.1.0/tests/test_lineage_graph.py +594 -0
- forgetsafe-0.1.0/tests/test_lineage_model.py +94 -0
- forgetsafe-0.1.0/tests/test_pipeline_e2e.py +205 -0
- forgetsafe-0.1.0/tests/test_pipeline_extract.py +282 -0
- forgetsafe-0.1.0/tests/test_pipeline_llm.py +238 -0
- forgetsafe-0.1.0/tests/test_pipeline_retrieval.py +162 -0
- forgetsafe-0.1.0/tests/test_pipeline_summary_profile.py +164 -0
- forgetsafe-0.1.0/tests/test_server_api.py +308 -0
- forgetsafe-0.1.0/tests/test_server_cli.py +111 -0
- forgetsafe-0.1.0/tests/test_server_logs.py +87 -0
- forgetsafe-0.1.0/tests/test_stores_conformance.py +311 -0
- forgetsafe-0.1.0/tests/test_verify.py +592 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
|
|
5
|
+
[Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-12-02
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- Lineage graph (SQLite or PostgreSQL) of items, derivations and **context lineage**, with recursive-CTE closure
|
|
11
|
+
(100k items in about 0.3 s on SQLite), per-item classification (fully tainted, mixed, context only) and salted,
|
|
12
|
+
per-tenant hashing.
|
|
13
|
+
- Text and vector stores with honest deletion reporting: SQLite, numpy, FAISS (flat and HNSW), Chroma, Qdrant and
|
|
14
|
+
pgvector, each with `compact()` and `residual_risk()` where deletion is not immediate.
|
|
15
|
+
- A small agent memory pipeline (fact extraction with subject tags, summaries, incremental profile, embeddings,
|
|
16
|
+
retrieval with cache lineage, a minimal answering agent) that records lineage on every step, plus deterministic
|
|
17
|
+
fakes for offline use.
|
|
18
|
+
- Forget engine: eight scope types (item, session, time, subject, origin, user, natural language, supersede),
|
|
19
|
+
dry-run plans with cost estimates, write-ahead execution with crash-safe `resume()`, rederivation of mixed items
|
|
20
|
+
from clean inputs, a per-user writer lock and commit-time guards, and a content-free audit record per request.
|
|
21
|
+
- Verification: structural, content (exact, fuzzy and embedding) and behavioural checks, and Ed25519-signed deletion
|
|
22
|
+
certificates with HTML rendering, conservative status (`VERIFIED`, `VERIFIED_WITH_PENDING`, `FAILED`, `INCOMPLETE`)
|
|
23
|
+
and escalation of failed requests.
|
|
24
|
+
- Integrations for Mem0, Letta (Python 3.11+, PostgreSQL) and LangGraph, each documented with the stores it uses and the
|
|
25
|
+
gaps in the library's own delete.
|
|
26
|
+
- REST API (FastAPI) with per-tenant API keys, rate limiting and an allow-list log filter; Typer CLI; Dockerfile and
|
|
27
|
+
compose setup with PostgreSQL and Qdrant.
|
|
28
|
+
- ForgetBench: a seeded synthetic benchmark with baselines, held-out calibration, bootstrap confidence intervals and an
|
|
29
|
+
integration comparison.
|
|
30
|
+
- Documentation site, examples and a threat model.
|
|
31
|
+
- Backup registry (`register_backup`, `list_backups`, `retire_backup`), with REST and CLI commands. A certificate stays
|
|
32
|
+
`VERIFIED_WITH_PENDING` while a backup taken before the deletion can still hold the data, and `recheck` /
|
|
33
|
+
`recheck_pending` issue a new signed certificate (`previous_certificate_id`) once backups expire or are retired.
|
|
34
|
+
- `supersede_restatements` policy (default on): superseding a fact also removes other facts that share a named entity with it.
|
|
35
|
+
- ForgetBench: natural-language requests with accepted candidates (`FSC`), `benchmarks.real` for a real model and embedder,
|
|
36
|
+
`benchmarks.judge_check` for measuring the behavioural judge on labelled answers.
|
|
37
|
+
- Documentation: introduction, architecture, installation and backups pages.
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
- An embedding hit on a live, known item counts as a trace only when its text shares wording with the forgotten material or is a
|
|
41
|
+
near copy (similarity 0.97). The benchmark calibrates the threshold on near-copies only.
|
|
42
|
+
- The behavioural judge prompt carries worked examples of denial and correction answers, and a leak needs 2 of 3 verdicts.
|
|
43
|
+
- Role references such as "my brother" no longer count as identifying spans.
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
- Entity-extraction prompts for natural-language requests and probes now state the JSON shape; a hosted model crashed on them.
|
|
47
|
+
- The fake judge no longer flags a different person's templated sentence as a leak.
|
|
48
|
+
|
|
49
|
+
### Known limitations
|
|
50
|
+
See `benchmarks/KNOWN_LIMITATIONS.md` and the documentation's Limitations page.
|
forgetsafe-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shihab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: forgetsafe
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Lineage-complete deletion for AI agent memory, with verifiable deletion certificates.
|
|
5
|
+
Project-URL: Homepage, https://github.com/neuroxyz/forgetsafe
|
|
6
|
+
Project-URL: Repository, https://github.com/neuroxyz/forgetsafe
|
|
7
|
+
Project-URL: Documentation, https://github.com/neuroxyz/forgetsafe/tree/main/docs
|
|
8
|
+
Project-URL: Changelog, https://github.com/neuroxyz/forgetsafe/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Issues, https://github.com/neuroxyz/forgetsafe/issues
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: agents,gdpr,lineage,llm,machine-unlearning,memory,privacy,right-to-erasure
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
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 :: Software Development :: Libraries
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: cryptography>=42
|
|
25
|
+
Requires-Dist: numpy
|
|
26
|
+
Requires-Dist: pydantic>=2
|
|
27
|
+
Requires-Dist: rapidfuzz>=3
|
|
28
|
+
Requires-Dist: sqlalchemy>=2
|
|
29
|
+
Provides-Extra: all
|
|
30
|
+
Requires-Dist: asyncpg; (python_version >= '3.11') and extra == 'all'
|
|
31
|
+
Requires-Dist: chromadb; extra == 'all'
|
|
32
|
+
Requires-Dist: faiss-cpu; extra == 'all'
|
|
33
|
+
Requires-Dist: fastapi; extra == 'all'
|
|
34
|
+
Requires-Dist: langgraph; extra == 'all'
|
|
35
|
+
Requires-Dist: letta<0.17,>=0.16; (python_version >= '3.11') and extra == 'all'
|
|
36
|
+
Requires-Dist: mem0ai; extra == 'all'
|
|
37
|
+
Requires-Dist: pg8000; (python_version >= '3.11') and extra == 'all'
|
|
38
|
+
Requires-Dist: pgvector; extra == 'all'
|
|
39
|
+
Requires-Dist: pgvector; (python_version >= '3.11') and extra == 'all'
|
|
40
|
+
Requires-Dist: psycopg2-binary; (python_version >= '3.11') and extra == 'all'
|
|
41
|
+
Requires-Dist: psycopg[binary]; extra == 'all'
|
|
42
|
+
Requires-Dist: qdrant-client<1.19,>=1.16; extra == 'all'
|
|
43
|
+
Requires-Dist: sentence-transformers; extra == 'all'
|
|
44
|
+
Requires-Dist: typer; extra == 'all'
|
|
45
|
+
Requires-Dist: uvicorn; extra == 'all'
|
|
46
|
+
Provides-Extra: bench
|
|
47
|
+
Requires-Dist: matplotlib; extra == 'bench'
|
|
48
|
+
Provides-Extra: chroma
|
|
49
|
+
Requires-Dist: chromadb; extra == 'chroma'
|
|
50
|
+
Provides-Extra: dev
|
|
51
|
+
Requires-Dist: coverage; extra == 'dev'
|
|
52
|
+
Requires-Dist: httpx; extra == 'dev'
|
|
53
|
+
Requires-Dist: hypothesis; extra == 'dev'
|
|
54
|
+
Requires-Dist: mypy; extra == 'dev'
|
|
55
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
56
|
+
Requires-Dist: pytest-asyncio; extra == 'dev'
|
|
57
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
58
|
+
Provides-Extra: docs
|
|
59
|
+
Requires-Dist: mkdocs-material; extra == 'docs'
|
|
60
|
+
Requires-Dist: mkdocstrings[python]; extra == 'docs'
|
|
61
|
+
Requires-Dist: pymdown-extensions<12; extra == 'docs'
|
|
62
|
+
Provides-Extra: faiss
|
|
63
|
+
Requires-Dist: faiss-cpu; extra == 'faiss'
|
|
64
|
+
Provides-Extra: langgraph
|
|
65
|
+
Requires-Dist: langgraph; extra == 'langgraph'
|
|
66
|
+
Provides-Extra: letta
|
|
67
|
+
Requires-Dist: asyncpg; (python_version >= '3.11') and extra == 'letta'
|
|
68
|
+
Requires-Dist: letta<0.17,>=0.16; (python_version >= '3.11') and extra == 'letta'
|
|
69
|
+
Requires-Dist: pg8000; (python_version >= '3.11') and extra == 'letta'
|
|
70
|
+
Requires-Dist: pgvector; (python_version >= '3.11') and extra == 'letta'
|
|
71
|
+
Requires-Dist: psycopg2-binary; (python_version >= '3.11') and extra == 'letta'
|
|
72
|
+
Provides-Extra: mem0
|
|
73
|
+
Requires-Dist: mem0ai; extra == 'mem0'
|
|
74
|
+
Provides-Extra: pgvector
|
|
75
|
+
Requires-Dist: pgvector; extra == 'pgvector'
|
|
76
|
+
Requires-Dist: psycopg[binary]; extra == 'pgvector'
|
|
77
|
+
Provides-Extra: qdrant
|
|
78
|
+
Requires-Dist: qdrant-client<1.19,>=1.16; extra == 'qdrant'
|
|
79
|
+
Provides-Extra: server
|
|
80
|
+
Requires-Dist: fastapi; extra == 'server'
|
|
81
|
+
Requires-Dist: typer; extra == 'server'
|
|
82
|
+
Requires-Dist: uvicorn; extra == 'server'
|
|
83
|
+
Provides-Extra: st
|
|
84
|
+
Requires-Dist: sentence-transformers; extra == 'st'
|
|
85
|
+
Description-Content-Type: text/markdown
|
|
86
|
+
|
|
87
|
+
# ForgetSafe
|
|
88
|
+
|
|
89
|
+
ForgetSafe makes AI agent memory truly forgettable: one request removes a memory from raw logs, extracted facts, summaries, profiles, vector indexes and caches, and proves it with a signed certificate.
|
|
90
|
+
|
|
91
|
+

|
|
92
|
+
|
|
93
|
+
## Quickstart
|
|
94
|
+
|
|
95
|
+
Offline, with deterministic fakes (no model, no network):
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from forgetsafe import ForgetRequest, forget
|
|
99
|
+
from forgetsafe.forget.resolve import ItemScope
|
|
100
|
+
from forgetsafe.testing.fixtures import make_memory_graph
|
|
101
|
+
|
|
102
|
+
memory = make_memory_graph()
|
|
103
|
+
turn = memory.add_turn("u1", "s1", "user", "I adore Zebramark the pet. I like green tea.")
|
|
104
|
+
memory.end_session("u1", "s1")
|
|
105
|
+
|
|
106
|
+
request = ForgetRequest(
|
|
107
|
+
tenant_id="tenant-a", user_id="u1", scope=ItemScope(ids=[turn.id]), dry_run=False
|
|
108
|
+
)
|
|
109
|
+
result = forget(memory, request)
|
|
110
|
+
print(result.certificate.status) # VERIFIED
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The same with Mem0:
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
from mem0 import Memory
|
|
117
|
+
from forgetsafe.forget.resolve import ItemScope
|
|
118
|
+
from forgetsafe.integrations.mem0 import ForgetSafeMem0
|
|
119
|
+
from forgetsafe.pipeline.llm import OpenAICompatibleLLM
|
|
120
|
+
|
|
121
|
+
fs = ForgetSafeMem0(Memory(), tenant_id="acme", llm=OpenAICompatibleLLM("gpt-4o-mini"))
|
|
122
|
+
secret = fs.add("I adore Zebramark the pet.", user_id="ann", run_id="s1")["forgetsafe"]
|
|
123
|
+
result = fs.forget(ItemScope(ids=secret["raw_item_ids"]), user_id="ann")
|
|
124
|
+
print(result.certificate.status)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
`dry_run` defaults to `True`: you get a plan (ids and kinds only) and nothing changes. See the [quickstart](docs/quickstart.md) for Docker, the REST API and the CLI.
|
|
128
|
+
|
|
129
|
+
## Why deleting the raw text is not enough
|
|
130
|
+
|
|
131
|
+
Agent memory is derived. A turn becomes a fact; facts feed a profile and summaries; each is embedded; retrieval results are cached. ForgetSafe records which item came from which, and which items were merely visible when something was produced (**context lineage**), then follows both kinds of edge.
|
|
132
|
+
|
|
133
|
+
## ForgetBench results
|
|
134
|
+
|
|
135
|
+
A seeded, fully synthetic benchmark (20 personas x 3 fresh seeds, offline fakes; held-out calibration; 95% bootstrap CIs). Lower is better
|
|
136
|
+
for leak, trace and over-deletion. **This is not a real-model result**; the real-model harness is `python -m benchmarks.real`.
|
|
137
|
+
|
|
138
|
+
| System | n | Leak rate | Trace rate | Retention | Over-deletion | LLM calls | Tokens | Wall s | Cert accuracy | False VERIFIED |
|
|
139
|
+
|---|---|---|---|---|---|---|---|---|---|---|
|
|
140
|
+
| B0 raw turns only | 360 | 100.0% [100.0, 100.0] | 100.0% [100.0, 100.0] | 100.0% [100.0, 100.0] | 0.0% [0.0, 0.0] | 0.0 [0.0, 0.0] | 0 [0, 0] | 0.32 [0.27, 0.38] | n/a | n/a |
|
|
141
|
+
| B1 + direct vectors | 360 | 100.0% [100.0, 100.0] | 100.0% [100.0, 100.0] | 100.0% [100.0, 100.0] | 0.0% [0.0, 0.0] | 0.0 [0.0, 0.0] | 0 [0, 0] | 0.42 [0.35, 0.49] | n/a | n/a |
|
|
142
|
+
| B2 + direct children | 360 | 100.0% [100.0, 100.0] | 100.0% [100.0, 100.0] | 100.0% [100.0, 100.0] | 0.0% [0.0, 0.0] | 0.0 [0.0, 0.0] | 0 [0, 0] | 0.54 [0.45, 0.62] | n/a | n/a |
|
|
143
|
+
| B3 full input lineage, no rederivation | 360 | 25.1% [21.0, 29.7] | 80.3% [76.1, 84.2] | 96.2% [95.4, 96.9] | 0.0% [0.0, 0.0] | 0.0 [0.0, 0.0] | 0 [0, 0] | 0.63 [0.55, 0.72] | n/a | n/a |
|
|
144
|
+
| ForgetSafe (same seeds) | 360 | 0.0% [0.0, 0.0] | 0.0% [0.0, 0.0] | 100.0% [100.0, 100.0] | 0.0% [0.0, 0.0] | 64.7 [61.4, 68.1] | 15014 [14396, 15619] | 3.61 [3.36, 3.87] | 67.2% [62.5, 72.2] | 0.0% [0.0, 0.0] |
|
|
145
|
+
| ForgetSafe (native scope) | 360 | 0.0% [0.0, 0.0] | 16.7% [13.1, 20.6] | 100.0% [100.0, 100.0] | 0.0% [0.0, 0.0] | 65.2 [62.0, 68.5] | 14941 [14333, 15508] | 3.65 [3.41, 3.90] | 67.5% [62.5, 72.2] | 0.0% [0.0, 0.0] |
|
|
146
|
+
| ForgetSafe (natural language, matched candidates accepted) | 60 | 0.0% [0.0, 0.0] | 0.0% [0.0, 0.0] | 97.7% [96.5, 98.8] | 2.3% [1.2, 3.5] | 55.1 [53.0, 57.5] | 18601 [17598, 19718] | 2.58 [2.42, 2.74] | 98.3% [95.0, 100.0] | 0.0% [0.0, 0.0] |
|
|
147
|
+
|
|
148
|
+

|
|
149
|
+
|
|
150
|
+
Deleting raw text (B0), plus its vectors (B1), plus direct children (B2) leaves every forgotten fact answerable. Following input lineage
|
|
151
|
+
only (B3) still leaks 25% through context-only contamination. ForgetSafe leaked nothing and never certified a deletion that was not clean
|
|
152
|
+
(0 false `VERIFIED` in 780 certificates). Its certificates are stricter than the benchmark's gold label (67% agreement): they flag retained
|
|
153
|
+
restatements and copies of forgotten wording that the gold label ignores. See [docs/benchmarks.md](docs/benchmarks.md) and
|
|
154
|
+
[KNOWN_LIMITATIONS.md](benchmarks/KNOWN_LIMITATIONS.md) for every failure, including the verifier bugs found and fixed along the way.
|
|
155
|
+
|
|
156
|
+
**With a real model.** One persona against a hosted model (`gpt-5.6-luna`) and the real MiniLM embedder: deleting only the raw turn leaked 100%;
|
|
157
|
+
ForgetSafe leaked 0% and left no trace in any store. Certificates: subject, natural language and accepted-candidates `VERIFIED`; item `INCOMPLETE`
|
|
158
|
+
(six retained items still hold the forgotten wording). The first real-model run found two bugs the fakes hid (an entity prompt without its JSON schema,
|
|
159
|
+
and a judge that flagged denials as leaks), both fixed and measured. This is one persona and one model, so it shows the pipeline works but gives no rates:
|
|
160
|
+
[details](docs/benchmarks.md#real-model-and-embedder).
|
|
161
|
+
|
|
162
|
+
Library delete API versus the same library wrapped by ForgetSafe:
|
|
163
|
+
|
|
164
|
+
| library | backend | arm | leak | trace exact | trace casefold | retention | certificate |
|
|
165
|
+
|---|---|---|---|---|---|---|---|
|
|
166
|
+
| mem0 2.2.1 | qdrant-sqlite | native | no | yes | yes | 1.00 | n/a |
|
|
167
|
+
| mem0 2.2.1 | qdrant-sqlite | wrapped | no | no | no | 1.00 | VERIFIED |
|
|
168
|
+
| langgraph 1.2.24 | sqlite | native | no | yes | yes | 1.00 | n/a |
|
|
169
|
+
| langgraph 1.2.24 | sqlite | wrapped | no | no | no | 1.00 | VERIFIED |
|
|
170
|
+
| langgraph 1.2.24 | memory | native | no | no | no | 1.00 | n/a |
|
|
171
|
+
| langgraph 1.2.24 | memory | wrapped | no | no | no | 1.00 | VERIFIED |
|
|
172
|
+
| letta 0.16.8 | postgres | native | no | yes | yes | 0.67 | n/a |
|
|
173
|
+
| letta 0.16.8 | postgres | wrapped | no | yes | yes | 0.67 | VERIFIED_WITH_PENDING |
|
|
174
|
+
|
|
175
|
+
Mem0's own `delete` leaves the deleted text in its history database; Letta's leaves block history and prompt copies, and PostgreSQL's write-ahead log
|
|
176
|
+
still holds the secret after either arm. Reproduce with `python -m benchmarks.run --quick` ([details](benchmarks/README.md)).
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
## How it works
|
|
180
|
+
|
|
181
|
+
1. **Lineage graph.** Every item, derivation and the context an operator saw is stored as ids and salted hashes, never content. Closure over 100k items takes about 0.3 s on SQLite.
|
|
182
|
+
2. **Context lineage.** A summary written while a profile was in its prompt can repeat that profile even though the profile was never a source. Deletion follows input and context edges.
|
|
183
|
+
3. **Rederivation.** Fully tainted items are deleted. Items that mixed forgotten and clean material are rebuilt from the clean inputs with the original operator.
|
|
184
|
+
4. **Verification.** Structural, content (exact, fuzzy, embedding) and behavioural checks, then an Ed25519-signed [certificate](docs/certificate.md) whose status is never better than what was proven.
|
|
185
|
+
|
|
186
|
+
Execution is write-ahead and idempotent, so an interrupted request resumes where it stopped; writers for that user wait, and derivations from forgotten items are rejected inside the database transaction.
|
|
187
|
+
|
|
188
|
+
## Use cases
|
|
189
|
+
|
|
190
|
+
Personal assistants, health apps (consent withdrawal), enterprise copilots, customer support, tutoring, poisoned-memory cleanup (remove a bad tool output and everything it influenced) and fact correction (`SupersedeScope`).
|
|
191
|
+
|
|
192
|
+
## Stores and integrations
|
|
193
|
+
|
|
194
|
+
SQLite, numpy, FAISS, Chroma, Qdrant and pgvector, each reporting honestly whether a delete is physical or pending compaction ([deletion guarantees](docs/stores.md)). Integrations for [Mem0](docs/integrations/mem0.md), [Letta](docs/integrations/letta.md) and [LangGraph](docs/integrations/langgraph.md) record lineage, delete through the library's API and through its underlying stores, and surface what the library's own delete leaves behind.
|
|
195
|
+
|
|
196
|
+
## Compliance notes
|
|
197
|
+
|
|
198
|
+
Certificates are engineering evidence that can support erasure requests under GDPR Art. 17 (right to erasure), the CCPA right to delete and India's DPDP Act. They record what was removed, from which stores, what could not be proven, and when backups expire. **This is engineering support, not legal advice.** A certificate does not cover backups, provider-side logs of hosted model APIs, or copies outside the system; consult counsel for what your obligations require.
|
|
199
|
+
|
|
200
|
+
## Related work
|
|
201
|
+
|
|
202
|
+
- *AfterDeleteBench* audits post-deletion information persistence in LLM agents with synthetic exact-string secrets ([arXiv 2610.31366](https://arxiv.org/pdf/2610.31366)).
|
|
203
|
+
- *Forgetting Residue Score* measures post-deletion leakage across memory tiers and reports that deleting raw chunks alone leaves secrets in derived summaries ([arXiv 2606.10062](https://arxiv.org/html/2606.10062)).
|
|
204
|
+
- *Can Agents Forget When Asked?* benchmarks whether memory systems act on natural-language deletion requests ([arXiv 2610.18052](https://arxiv.org/pdf/2610.18052)).
|
|
205
|
+
- *MemCut* ([arXiv 2610.21405](https://arxiv.org/pdf/2610.21405)) and *MemLeak* ([arXiv 2606.29788](https://arxiv.org/pdf/2606.29788)) study leaks through derived and linked data in agent memory.
|
|
206
|
+
|
|
207
|
+
These are measurement and diagnosis papers; the descriptions above come from their abstracts and were not independently reproduced. Memory systems such as Mem0, Letta and LangGraph store and update memory; ForgetSafe adds lineage and verified deletion on top of them rather than replacing them.
|
|
208
|
+
|
|
209
|
+
## Roadmap
|
|
210
|
+
|
|
211
|
+
**Tier 2 (planned, not implemented):** consolidating memory into sharded LoRA adapters with exact deletion by retraining only the affected shards.
|
|
212
|
+
|
|
213
|
+
## Installation
|
|
214
|
+
|
|
215
|
+
Python 3.10 or newer. Not on PyPI yet; install from the repository:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
pip install "forgetsafe[server] @ git+https://github.com/neuroxyz/forgetsafe"
|
|
219
|
+
python examples/standalone_demo.py # offline, no model or key needed
|
|
220
|
+
docker compose up --build -d # or run the API with PostgreSQL and Qdrant
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Extras, Docker, configuration variables and the secrets to set for production are in [docs/installation.md](docs/installation.md).
|
|
224
|
+
|
|
225
|
+
## Limitations
|
|
226
|
+
|
|
227
|
+
ForgetSafe cannot reach backups or provider-side logs of hosted model APIs, and integrations without context lineage fall back to input-only lineage. The benchmark's own failures are recorded in [KNOWN_LIMITATIONS.md](benchmarks/KNOWN_LIMITATIONS.md); the [threat model](docs/threat-model.md) lists what is out of scope.
|
|
228
|
+
|
|
229
|
+
## Development
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
pip install -e ".[dev]"
|
|
233
|
+
ruff check . && ruff format --check . && mypy && pytest
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). Report privacy bugs as described in [SECURITY.md](SECURITY.md). MIT licensed.
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# ForgetSafe
|
|
2
|
+
|
|
3
|
+
ForgetSafe makes AI agent memory truly forgettable: one request removes a memory from raw logs, extracted facts, summaries, profiles, vector indexes and caches, and proves it with a signed certificate.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Quickstart
|
|
8
|
+
|
|
9
|
+
Offline, with deterministic fakes (no model, no network):
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
from forgetsafe import ForgetRequest, forget
|
|
13
|
+
from forgetsafe.forget.resolve import ItemScope
|
|
14
|
+
from forgetsafe.testing.fixtures import make_memory_graph
|
|
15
|
+
|
|
16
|
+
memory = make_memory_graph()
|
|
17
|
+
turn = memory.add_turn("u1", "s1", "user", "I adore Zebramark the pet. I like green tea.")
|
|
18
|
+
memory.end_session("u1", "s1")
|
|
19
|
+
|
|
20
|
+
request = ForgetRequest(
|
|
21
|
+
tenant_id="tenant-a", user_id="u1", scope=ItemScope(ids=[turn.id]), dry_run=False
|
|
22
|
+
)
|
|
23
|
+
result = forget(memory, request)
|
|
24
|
+
print(result.certificate.status) # VERIFIED
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The same with Mem0:
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from mem0 import Memory
|
|
31
|
+
from forgetsafe.forget.resolve import ItemScope
|
|
32
|
+
from forgetsafe.integrations.mem0 import ForgetSafeMem0
|
|
33
|
+
from forgetsafe.pipeline.llm import OpenAICompatibleLLM
|
|
34
|
+
|
|
35
|
+
fs = ForgetSafeMem0(Memory(), tenant_id="acme", llm=OpenAICompatibleLLM("gpt-4o-mini"))
|
|
36
|
+
secret = fs.add("I adore Zebramark the pet.", user_id="ann", run_id="s1")["forgetsafe"]
|
|
37
|
+
result = fs.forget(ItemScope(ids=secret["raw_item_ids"]), user_id="ann")
|
|
38
|
+
print(result.certificate.status)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`dry_run` defaults to `True`: you get a plan (ids and kinds only) and nothing changes. See the [quickstart](docs/quickstart.md) for Docker, the REST API and the CLI.
|
|
42
|
+
|
|
43
|
+
## Why deleting the raw text is not enough
|
|
44
|
+
|
|
45
|
+
Agent memory is derived. A turn becomes a fact; facts feed a profile and summaries; each is embedded; retrieval results are cached. ForgetSafe records which item came from which, and which items were merely visible when something was produced (**context lineage**), then follows both kinds of edge.
|
|
46
|
+
|
|
47
|
+
## ForgetBench results
|
|
48
|
+
|
|
49
|
+
A seeded, fully synthetic benchmark (20 personas x 3 fresh seeds, offline fakes; held-out calibration; 95% bootstrap CIs). Lower is better
|
|
50
|
+
for leak, trace and over-deletion. **This is not a real-model result**; the real-model harness is `python -m benchmarks.real`.
|
|
51
|
+
|
|
52
|
+
| System | n | Leak rate | Trace rate | Retention | Over-deletion | LLM calls | Tokens | Wall s | Cert accuracy | False VERIFIED |
|
|
53
|
+
|---|---|---|---|---|---|---|---|---|---|---|
|
|
54
|
+
| B0 raw turns only | 360 | 100.0% [100.0, 100.0] | 100.0% [100.0, 100.0] | 100.0% [100.0, 100.0] | 0.0% [0.0, 0.0] | 0.0 [0.0, 0.0] | 0 [0, 0] | 0.32 [0.27, 0.38] | n/a | n/a |
|
|
55
|
+
| B1 + direct vectors | 360 | 100.0% [100.0, 100.0] | 100.0% [100.0, 100.0] | 100.0% [100.0, 100.0] | 0.0% [0.0, 0.0] | 0.0 [0.0, 0.0] | 0 [0, 0] | 0.42 [0.35, 0.49] | n/a | n/a |
|
|
56
|
+
| B2 + direct children | 360 | 100.0% [100.0, 100.0] | 100.0% [100.0, 100.0] | 100.0% [100.0, 100.0] | 0.0% [0.0, 0.0] | 0.0 [0.0, 0.0] | 0 [0, 0] | 0.54 [0.45, 0.62] | n/a | n/a |
|
|
57
|
+
| B3 full input lineage, no rederivation | 360 | 25.1% [21.0, 29.7] | 80.3% [76.1, 84.2] | 96.2% [95.4, 96.9] | 0.0% [0.0, 0.0] | 0.0 [0.0, 0.0] | 0 [0, 0] | 0.63 [0.55, 0.72] | n/a | n/a |
|
|
58
|
+
| ForgetSafe (same seeds) | 360 | 0.0% [0.0, 0.0] | 0.0% [0.0, 0.0] | 100.0% [100.0, 100.0] | 0.0% [0.0, 0.0] | 64.7 [61.4, 68.1] | 15014 [14396, 15619] | 3.61 [3.36, 3.87] | 67.2% [62.5, 72.2] | 0.0% [0.0, 0.0] |
|
|
59
|
+
| ForgetSafe (native scope) | 360 | 0.0% [0.0, 0.0] | 16.7% [13.1, 20.6] | 100.0% [100.0, 100.0] | 0.0% [0.0, 0.0] | 65.2 [62.0, 68.5] | 14941 [14333, 15508] | 3.65 [3.41, 3.90] | 67.5% [62.5, 72.2] | 0.0% [0.0, 0.0] |
|
|
60
|
+
| ForgetSafe (natural language, matched candidates accepted) | 60 | 0.0% [0.0, 0.0] | 0.0% [0.0, 0.0] | 97.7% [96.5, 98.8] | 2.3% [1.2, 3.5] | 55.1 [53.0, 57.5] | 18601 [17598, 19718] | 2.58 [2.42, 2.74] | 98.3% [95.0, 100.0] | 0.0% [0.0, 0.0] |
|
|
61
|
+
|
|
62
|
+

|
|
63
|
+
|
|
64
|
+
Deleting raw text (B0), plus its vectors (B1), plus direct children (B2) leaves every forgotten fact answerable. Following input lineage
|
|
65
|
+
only (B3) still leaks 25% through context-only contamination. ForgetSafe leaked nothing and never certified a deletion that was not clean
|
|
66
|
+
(0 false `VERIFIED` in 780 certificates). Its certificates are stricter than the benchmark's gold label (67% agreement): they flag retained
|
|
67
|
+
restatements and copies of forgotten wording that the gold label ignores. See [docs/benchmarks.md](docs/benchmarks.md) and
|
|
68
|
+
[KNOWN_LIMITATIONS.md](benchmarks/KNOWN_LIMITATIONS.md) for every failure, including the verifier bugs found and fixed along the way.
|
|
69
|
+
|
|
70
|
+
**With a real model.** One persona against a hosted model (`gpt-5.6-luna`) and the real MiniLM embedder: deleting only the raw turn leaked 100%;
|
|
71
|
+
ForgetSafe leaked 0% and left no trace in any store. Certificates: subject, natural language and accepted-candidates `VERIFIED`; item `INCOMPLETE`
|
|
72
|
+
(six retained items still hold the forgotten wording). The first real-model run found two bugs the fakes hid (an entity prompt without its JSON schema,
|
|
73
|
+
and a judge that flagged denials as leaks), both fixed and measured. This is one persona and one model, so it shows the pipeline works but gives no rates:
|
|
74
|
+
[details](docs/benchmarks.md#real-model-and-embedder).
|
|
75
|
+
|
|
76
|
+
Library delete API versus the same library wrapped by ForgetSafe:
|
|
77
|
+
|
|
78
|
+
| library | backend | arm | leak | trace exact | trace casefold | retention | certificate |
|
|
79
|
+
|---|---|---|---|---|---|---|---|
|
|
80
|
+
| mem0 2.2.1 | qdrant-sqlite | native | no | yes | yes | 1.00 | n/a |
|
|
81
|
+
| mem0 2.2.1 | qdrant-sqlite | wrapped | no | no | no | 1.00 | VERIFIED |
|
|
82
|
+
| langgraph 1.2.24 | sqlite | native | no | yes | yes | 1.00 | n/a |
|
|
83
|
+
| langgraph 1.2.24 | sqlite | wrapped | no | no | no | 1.00 | VERIFIED |
|
|
84
|
+
| langgraph 1.2.24 | memory | native | no | no | no | 1.00 | n/a |
|
|
85
|
+
| langgraph 1.2.24 | memory | wrapped | no | no | no | 1.00 | VERIFIED |
|
|
86
|
+
| letta 0.16.8 | postgres | native | no | yes | yes | 0.67 | n/a |
|
|
87
|
+
| letta 0.16.8 | postgres | wrapped | no | yes | yes | 0.67 | VERIFIED_WITH_PENDING |
|
|
88
|
+
|
|
89
|
+
Mem0's own `delete` leaves the deleted text in its history database; Letta's leaves block history and prompt copies, and PostgreSQL's write-ahead log
|
|
90
|
+
still holds the secret after either arm. Reproduce with `python -m benchmarks.run --quick` ([details](benchmarks/README.md)).
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
## How it works
|
|
94
|
+
|
|
95
|
+
1. **Lineage graph.** Every item, derivation and the context an operator saw is stored as ids and salted hashes, never content. Closure over 100k items takes about 0.3 s on SQLite.
|
|
96
|
+
2. **Context lineage.** A summary written while a profile was in its prompt can repeat that profile even though the profile was never a source. Deletion follows input and context edges.
|
|
97
|
+
3. **Rederivation.** Fully tainted items are deleted. Items that mixed forgotten and clean material are rebuilt from the clean inputs with the original operator.
|
|
98
|
+
4. **Verification.** Structural, content (exact, fuzzy, embedding) and behavioural checks, then an Ed25519-signed [certificate](docs/certificate.md) whose status is never better than what was proven.
|
|
99
|
+
|
|
100
|
+
Execution is write-ahead and idempotent, so an interrupted request resumes where it stopped; writers for that user wait, and derivations from forgotten items are rejected inside the database transaction.
|
|
101
|
+
|
|
102
|
+
## Use cases
|
|
103
|
+
|
|
104
|
+
Personal assistants, health apps (consent withdrawal), enterprise copilots, customer support, tutoring, poisoned-memory cleanup (remove a bad tool output and everything it influenced) and fact correction (`SupersedeScope`).
|
|
105
|
+
|
|
106
|
+
## Stores and integrations
|
|
107
|
+
|
|
108
|
+
SQLite, numpy, FAISS, Chroma, Qdrant and pgvector, each reporting honestly whether a delete is physical or pending compaction ([deletion guarantees](docs/stores.md)). Integrations for [Mem0](docs/integrations/mem0.md), [Letta](docs/integrations/letta.md) and [LangGraph](docs/integrations/langgraph.md) record lineage, delete through the library's API and through its underlying stores, and surface what the library's own delete leaves behind.
|
|
109
|
+
|
|
110
|
+
## Compliance notes
|
|
111
|
+
|
|
112
|
+
Certificates are engineering evidence that can support erasure requests under GDPR Art. 17 (right to erasure), the CCPA right to delete and India's DPDP Act. They record what was removed, from which stores, what could not be proven, and when backups expire. **This is engineering support, not legal advice.** A certificate does not cover backups, provider-side logs of hosted model APIs, or copies outside the system; consult counsel for what your obligations require.
|
|
113
|
+
|
|
114
|
+
## Related work
|
|
115
|
+
|
|
116
|
+
- *AfterDeleteBench* audits post-deletion information persistence in LLM agents with synthetic exact-string secrets ([arXiv 2610.31366](https://arxiv.org/pdf/2610.31366)).
|
|
117
|
+
- *Forgetting Residue Score* measures post-deletion leakage across memory tiers and reports that deleting raw chunks alone leaves secrets in derived summaries ([arXiv 2606.10062](https://arxiv.org/html/2606.10062)).
|
|
118
|
+
- *Can Agents Forget When Asked?* benchmarks whether memory systems act on natural-language deletion requests ([arXiv 2610.18052](https://arxiv.org/pdf/2610.18052)).
|
|
119
|
+
- *MemCut* ([arXiv 2610.21405](https://arxiv.org/pdf/2610.21405)) and *MemLeak* ([arXiv 2606.29788](https://arxiv.org/pdf/2606.29788)) study leaks through derived and linked data in agent memory.
|
|
120
|
+
|
|
121
|
+
These are measurement and diagnosis papers; the descriptions above come from their abstracts and were not independently reproduced. Memory systems such as Mem0, Letta and LangGraph store and update memory; ForgetSafe adds lineage and verified deletion on top of them rather than replacing them.
|
|
122
|
+
|
|
123
|
+
## Roadmap
|
|
124
|
+
|
|
125
|
+
**Tier 2 (planned, not implemented):** consolidating memory into sharded LoRA adapters with exact deletion by retraining only the affected shards.
|
|
126
|
+
|
|
127
|
+
## Installation
|
|
128
|
+
|
|
129
|
+
Python 3.10 or newer. Not on PyPI yet; install from the repository:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
pip install "forgetsafe[server] @ git+https://github.com/neuroxyz/forgetsafe"
|
|
133
|
+
python examples/standalone_demo.py # offline, no model or key needed
|
|
134
|
+
docker compose up --build -d # or run the API with PostgreSQL and Qdrant
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Extras, Docker, configuration variables and the secrets to set for production are in [docs/installation.md](docs/installation.md).
|
|
138
|
+
|
|
139
|
+
## Limitations
|
|
140
|
+
|
|
141
|
+
ForgetSafe cannot reach backups or provider-side logs of hosted model APIs, and integrations without context lineage fall back to input-only lineage. The benchmark's own failures are recorded in [KNOWN_LIMITATIONS.md](benchmarks/KNOWN_LIMITATIONS.md); the [threat model](docs/threat-model.md) lists what is out of scope.
|
|
142
|
+
|
|
143
|
+
## Development
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
pip install -e ".[dev]"
|
|
147
|
+
ruff check . && ruff format --check . && mypy && pytest
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). Report privacy bugs as described in [SECURITY.md](SECURITY.md). MIT licensed.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "forgetsafe"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Lineage-complete deletion for AI agent memory, with verifiable deletion certificates."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
dependencies = ["pydantic>=2", "numpy", "sqlalchemy>=2", "rapidfuzz>=3", "cryptography>=42"]
|
|
14
|
+
keywords = ["agents", "memory", "privacy", "gdpr", "right-to-erasure", "machine-unlearning", "llm", "lineage"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Topic :: Security",
|
|
24
|
+
"Topic :: Software Development :: Libraries",
|
|
25
|
+
"Typing :: Typed",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Homepage = "https://github.com/neuroxyz/forgetsafe"
|
|
30
|
+
Repository = "https://github.com/neuroxyz/forgetsafe"
|
|
31
|
+
Documentation = "https://github.com/neuroxyz/forgetsafe/tree/main/docs"
|
|
32
|
+
Changelog = "https://github.com/neuroxyz/forgetsafe/blob/main/CHANGELOG.md"
|
|
33
|
+
Issues = "https://github.com/neuroxyz/forgetsafe/issues"
|
|
34
|
+
|
|
35
|
+
[project.scripts]
|
|
36
|
+
forgetsafe = "forgetsafe.server.cli:app"
|
|
37
|
+
|
|
38
|
+
[project.optional-dependencies]
|
|
39
|
+
faiss = ["faiss-cpu"]
|
|
40
|
+
chroma = ["chromadb"]
|
|
41
|
+
qdrant = ["qdrant-client>=1.16,<1.19"]
|
|
42
|
+
pgvector = ["pgvector", "psycopg[binary]"]
|
|
43
|
+
st = ["sentence-transformers"]
|
|
44
|
+
server = ["fastapi", "uvicorn", "typer"]
|
|
45
|
+
mem0 = ["mem0ai"]
|
|
46
|
+
# The Python server package needs 3.11+; on 3.10 the name resolves to an unrelated binary.
|
|
47
|
+
letta = ["letta>=0.16,<0.17; python_version >= '3.11'", "asyncpg; python_version >= '3.11'", "pgvector; python_version >= '3.11'", "pg8000; python_version >= '3.11'", "psycopg2-binary; python_version >= '3.11'"]
|
|
48
|
+
langgraph = ["langgraph"]
|
|
49
|
+
all = ["forgetsafe[faiss,chroma,qdrant,pgvector,st,server,mem0,letta,langgraph]"]
|
|
50
|
+
bench = ["matplotlib"]
|
|
51
|
+
docs = ["mkdocs-material", "mkdocstrings[python]", "pymdown-extensions<12"]
|
|
52
|
+
dev = ["pytest", "pytest-asyncio", "hypothesis", "ruff", "mypy", "coverage", "httpx"]
|
|
53
|
+
|
|
54
|
+
[tool.hatch.build.targets.wheel]
|
|
55
|
+
packages = ["src/forgetsafe"]
|
|
56
|
+
|
|
57
|
+
[tool.pytest.ini_options]
|
|
58
|
+
testpaths = ["tests"]
|
|
59
|
+
pythonpath = [".", "tests"]
|
|
60
|
+
asyncio_mode = "auto"
|
|
61
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
62
|
+
|
|
63
|
+
[tool.ruff]
|
|
64
|
+
line-length = 100
|
|
65
|
+
target-version = "py310"
|
|
66
|
+
src = ["src", "tests"]
|
|
67
|
+
|
|
68
|
+
[tool.ruff.lint]
|
|
69
|
+
select = ["E", "F", "I", "UP", "B"]
|
|
70
|
+
# ruff format wraps code; long docstrings and message strings are left readable
|
|
71
|
+
ignore = ["E501"]
|
|
72
|
+
|
|
73
|
+
[tool.mypy]
|
|
74
|
+
strict = true
|
|
75
|
+
python_version = "3.10"
|
|
76
|
+
files = ["src", "tests"]
|
|
77
|
+
|
|
78
|
+
[[tool.mypy.overrides]]
|
|
79
|
+
module = ["fastapi", "fastapi.*", "uvicorn", "typer", "typer.*", "rapidfuzz", "rapidfuzz.*", "faiss", "chromadb", "chromadb.*", "qdrant_client", "qdrant_client.*", "pgvector", "pgvector.*", "psycopg", "psycopg.*", "sentence_transformers", "mem0", "mem0.*", "langgraph", "langgraph.*", "langchain_core", "langchain_core.*", "letta", "letta.*", "matplotlib", "matplotlib.*"]
|
|
80
|
+
ignore_missing_imports = true
|
|
81
|
+
|
|
82
|
+
# These modules wrap third-party libraries that may or may not be installed; with them
|
|
83
|
+
# absent, ignores written for the installed case would be reported as unused.
|
|
84
|
+
[[tool.mypy.overrides]]
|
|
85
|
+
module = ["forgetsafe.integrations.*", "test_integration_mem0", "test_integration_langgraph", "test_integration_letta"]
|
|
86
|
+
warn_unused_ignores = false
|
|
87
|
+
warn_return_any = false
|
|
88
|
+
disallow_subclassing_any = false
|
|
89
|
+
|
|
90
|
+
# FastAPI and Typer decorators are untyped when those extras are not installed
|
|
91
|
+
[[tool.mypy.overrides]]
|
|
92
|
+
module = ["forgetsafe.server.api", "forgetsafe.server.cli", "test_server_api", "test_server_cli", "test_server_logs"]
|
|
93
|
+
disallow_untyped_decorators = false
|
|
94
|
+
warn_unused_ignores = false
|
|
95
|
+
warn_return_any = false
|
|
96
|
+
disallow_subclassing_any = false
|
|
97
|
+
|
|
98
|
+
[tool.hatch.build.targets.sdist]
|
|
99
|
+
include = ["/src", "/tests", "/README.md", "/LICENSE", "/CHANGELOG.md", "/pyproject.toml"]
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""ForgetSafe: lineage-complete deletion for AI agent memory."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from forgetsafe._version import __version__
|
|
6
|
+
from forgetsafe.api import (
|
|
7
|
+
Backup,
|
|
8
|
+
DeletionCertificate,
|
|
9
|
+
ForgetRequest,
|
|
10
|
+
MemoryGraph,
|
|
11
|
+
confirm,
|
|
12
|
+
escalate,
|
|
13
|
+
forget,
|
|
14
|
+
list_backups,
|
|
15
|
+
recheck,
|
|
16
|
+
recheck_pending,
|
|
17
|
+
register_backup,
|
|
18
|
+
resume,
|
|
19
|
+
retire_backup,
|
|
20
|
+
verify,
|
|
21
|
+
verify_certificate,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"Backup",
|
|
26
|
+
"DeletionCertificate",
|
|
27
|
+
"ForgetRequest",
|
|
28
|
+
"MemoryGraph",
|
|
29
|
+
"__version__",
|
|
30
|
+
"confirm",
|
|
31
|
+
"escalate",
|
|
32
|
+
"forget",
|
|
33
|
+
"list_backups",
|
|
34
|
+
"recheck",
|
|
35
|
+
"recheck_pending",
|
|
36
|
+
"register_backup",
|
|
37
|
+
"resume",
|
|
38
|
+
"retire_backup",
|
|
39
|
+
"verify",
|
|
40
|
+
"verify_certificate",
|
|
41
|
+
]
|