mnemo-engine 0.3.2__cp38-abi3-win_amd64.whl

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.
mnemo/__init__.py ADDED
@@ -0,0 +1,5 @@
1
+ from .mnemo import *
2
+
3
+ __doc__ = mnemo.__doc__
4
+ if hasattr(mnemo, "__all__"):
5
+ __all__ = mnemo.__all__
mnemo/mnemo.pyd ADDED
Binary file
@@ -0,0 +1,167 @@
1
+ Metadata-Version: 2.4
2
+ Name: mnemo-engine
3
+ Version: 0.3.2
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: Programming Language :: Python :: 3
6
+ Classifier: License :: OSI Approved :: Apache Software License
7
+ Summary: Encrypted, portable agent-memory engine — Python bindings
8
+ Home-Page: https://toarchkumar.github.io/mnemo/
9
+ License: Apache-2.0
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
12
+ Project-URL: Homepage, https://github.com/toarchkumar/mnemo
13
+ Project-URL: Repository, https://github.com/toarchkumar/mnemo
14
+
15
+ # Memory Nemo (MNemo) — Python bindings
16
+
17
+ Repository overview: [root README](../README.md) ·
18
+ landing page: [index.html](../index.html).
19
+
20
+ Python bindings for **Memory Nemo (MNemo)**, the encrypted single-file
21
+ agent-memory engine. The package is a thin [PyO3](https://pyo3.rs) wrapper
22
+ over the Rust core in the
23
+ sibling `mnemo/` crate — the storage engine, AES-256-GCM encryption, the
24
+ write-ahead log, the IVF+PQ index, snapshots, and the agent-memory model all
25
+ run as compiled Rust; Python only sees a small, ergonomic surface.
26
+
27
+ > Distribution name on PyPI: `mnemo-engine` (both `mnemo` and `mnemo-db`
28
+ > were already taken by unrelated projects). The import name stays
29
+ > `mnemo`, so `pip install mnemo-engine` then `import mnemo` is the
30
+ > full setup.
31
+
32
+ ## For AI agents
33
+
34
+ An agent that's been handed a `.mnemo` file and its passphrase can become
35
+ productive in two calls — no external documentation required:
36
+
37
+ ```python
38
+ import mnemo, os
39
+
40
+ db = mnemo.open("agent.mnemo", os.environ["MNEMO_PASSPHRASE"])
41
+
42
+ # The file introduces itself: returns memories tagged metadata.area="onboarding",
43
+ # manifest first. Each entry tells you the embedder, agent_id convention,
44
+ # project metadata, and any other context the file's author recorded.
45
+ for entry in db.about():
46
+ print(entry["content"])
47
+ ```
48
+
49
+ Creating a new database? It's self-describing from creation:
50
+
51
+ ```python
52
+ db = mnemo.open("new.mnemo", "passphrase", dimensions=384)
53
+ db.insert_default_manifest() # same scaffold that `mnemo init` adds
54
+ db.flush()
55
+ ```
56
+
57
+ The scaffold tells the next agent what to do: replace it with one that
58
+ records your real embedder and conventions. See the [main README](../mnemo/README.md#self-describing-databases)
59
+ for the full pattern.
60
+
61
+ ## Build & install
62
+
63
+ The bindings build with [maturin](https://www.maturin.rs):
64
+
65
+ ```bash
66
+ pip install maturin
67
+ cd mnemo-python
68
+ maturin build --release # produces a wheel in target/wheels/
69
+ pip install target/wheels/mnemo-*.whl
70
+ ```
71
+
72
+ `maturin develop` installs straight into the active virtualenv during
73
+ development. The extension is built against the stable ABI (`abi3-py38`), so a
74
+ single wheel works on CPython 3.8 and newer.
75
+
76
+ ## Usage
77
+
78
+ ```python
79
+ import mnemo
80
+
81
+ # Open an existing database, or create one (dimensions required to create).
82
+ db = mnemo.open("agent.mnemo", "passphrase", dimensions=4)
83
+
84
+ # Store typed memories. memory_type is one of:
85
+ # "episodic", "semantic", "procedural", "working".
86
+ db.remember(
87
+ "the user prefers concise answers",
88
+ "procedural",
89
+ [0.1, 0.2, 0.3, 0.4],
90
+ importance=0.8,
91
+ agent_id="assistant",
92
+ metadata={"source": "onboarding"},
93
+ )
94
+
95
+ # Multi-signal recall — similarity blended with recency, importance, frequency.
96
+ for hit in db.recall([0.1, 0.2, 0.3, 0.4], top_k=5):
97
+ print(hit["score"], hit["content"])
98
+
99
+ db.flush()
100
+ db.close()
101
+ ```
102
+
103
+ `mnemo.open` returns a `Mnemo` object that is also a context manager —
104
+ `with mnemo.open(...) as db:` flushes automatically on exit.
105
+
106
+ ### Sessions
107
+
108
+ A `Session` wraps the database for one conversation: it records each turn as
109
+ `working` memory and, when closed, consolidates those turns into durable
110
+ `episodic` memory.
111
+
112
+ ```python
113
+ db = mnemo.open("agent.mnemo", "passphrase", dimensions=4)
114
+
115
+ with db.session("assistant") as chat:
116
+ chat.add_turn(mnemo.Turn.user("my flight is Friday", [1.0, 0.0, 0.0, 0.0]))
117
+ chat.add_turn(mnemo.Turn.assistant("noted", [0.9, 0.1, 0.0, 0.0]))
118
+ context = chat.recall([1.0, 0.0, 0.0, 0.0], top_k=5)
119
+ # leaving the block consolidates the turns into episodic memory
120
+
121
+ # or, explicitly:
122
+ chat = db.session("assistant")
123
+ chat.add_turn(mnemo.Turn("system", "be concise", [0.0, 0.0, 0.0, 1.0]))
124
+ chat.close() # consolidate working -> episodic
125
+ # chat.discard() # alternative: throw the turns away
126
+ ```
127
+
128
+ `mnemo.Turn` has `Turn.user(...)`, `Turn.assistant(...)`, `Turn.system(...)`,
129
+ and `Turn(role, content, vector)`. A `Session`'s `recall` is always scoped to
130
+ its own agent.
131
+
132
+ ## API
133
+
134
+ `mnemo.open(path, passphrase, dimensions=None) -> Mnemo`
135
+
136
+ `Mnemo` methods:
137
+
138
+ | Method | Purpose |
139
+ |---|---|
140
+ | `remember(content, memory_type, vector, *, agent_id, importance, session_id, ttl_secs, shared, metadata)` | Store a memory; returns its id |
141
+ | `recall(query, top_k=10, memory_types=None, agent_id=None, track_access=True)` | Multi-signal ranked retrieval. `track_access=False` skips access-stat updates (fully read-only recall) |
142
+ | `search(query, top_k=10)` | Exact nearest-neighbour search |
143
+ | `get(id)` / `delete(id)` | Fetch / soft-delete by id |
144
+ | `about()` | Self-describing onboarding briefing — memories tagged `metadata.area="onboarding"`, manifest first |
145
+ | `insert_default_manifest()` | Insert the canonical scaffold manifest (same one `mnemo init` adds); returns its id |
146
+ | `session(agent_id)` | Begin a conversation `Session` |
147
+ | `flush()` / `close()` | Persist pending changes |
148
+ | `verify()` | Decrypt and re-validate every record |
149
+ | `build_index()` / `drop_index()` / `has_index()` | Approximate index control |
150
+ | `snapshots()` / `restore_to(txn_id)` / `restore_to_time(unix_secs)` | Point-in-time recovery |
151
+ | `set_cache_capacity(pages)` / `cache_stats()` | Page-cache tuning |
152
+ | `set_max_snapshots(max)` | Override the snapshot-manifest retention cap (default 256; `0` disables) |
153
+ | `stats()` | Summary statistics |
154
+ | `export_encrypted(dest)` | Copy the (already-encrypted) file elsewhere |
155
+ | `len(db)` | Live memory count |
156
+
157
+ `Session` methods: `add_turn(turn)`, `recall(query, top_k=10, memory_types=None)`,
158
+ `close()`, `discard()`, `id()`, `agent()`, `turn_ids()`, `turn_count()`; also a
159
+ context manager (exiting consolidates).
160
+
161
+ Memories and results are returned as plain dicts; `metadata` round-trips as a
162
+ nested dict.
163
+
164
+ ## License
165
+
166
+ Apache-2.0.
167
+
@@ -0,0 +1,6 @@
1
+ mnemo/__init__.py,sha256=yx0YhNWqBdHYpdGCJCYjy45XZgxrS0qICdZ0mQEGyVQ,103
2
+ mnemo/mnemo.pyd,sha256=W9CEWFq2N5_6AkrF-ms3HWXhGrTUt1Ae0pAGc0XKRbw,933888
3
+ mnemo_engine-0.3.2.dist-info/METADATA,sha256=XqtMyCjeUJqAaVg8sf8F3loFN0c6ARdzPevoYCBpwsg,6400
4
+ mnemo_engine-0.3.2.dist-info/WHEEL,sha256=RD58zsFMg5Xm6opfRt5qGok5PcA30CAhknyKFSihcu8,95
5
+ mnemo_engine-0.3.2.dist-info/sboms/mnemo-python.cyclonedx.json,sha256=OdGejzftA1omV5QfLAN3Ryjs15LGHigFHN8rH-isuO4,100144
6
+ mnemo_engine-0.3.2.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.14.1)
3
+ Root-Is-Purelib: false
4
+ Tag: cp38-abi3-win_amd64