mnemon-ai 1.0.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mahika jadhav
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,311 @@
1
+ Metadata-Version: 2.4
2
+ Name: mnemon-ai
3
+ Version: 1.0.0
4
+ Summary: The intelligence layer between your agents and oblivion
5
+ Home-page: https://github.com/smartass-4ever/Mnemon
6
+ Author: Mahika Jadhav
7
+ Author-email: mahikajadhav22@gmail.com
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: numpy>=1.24.0
19
+ Provides-Extra: full
20
+ Requires-Dist: sentence-transformers>=2.2.0; extra == "full"
21
+ Requires-Dist: redis>=5.0.0; extra == "full"
22
+ Requires-Dist: anthropic>=0.20.0; extra == "full"
23
+ Requires-Dist: openai>=1.0.0; extra == "full"
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
26
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
27
+ Requires-Dist: black>=23.0.0; extra == "dev"
28
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
29
+ Dynamic: author
30
+ Dynamic: author-email
31
+ Dynamic: classifier
32
+ Dynamic: description
33
+ Dynamic: description-content-type
34
+ Dynamic: home-page
35
+ Dynamic: license-file
36
+ Dynamic: provides-extra
37
+ Dynamic: requires-dist
38
+ Dynamic: requires-python
39
+ Dynamic: summary
40
+
41
+ # Mnemon
42
+
43
+ **The intelligence layer between your agents and oblivion.**
44
+
45
+ By Mahika Jadhav ([@smartass-4ever](https://github.com/smartass-4ever))
46
+
47
+ ---
48
+
49
+ ## The Problem
50
+
51
+ Every major agent framework — CrewAI, Letta, Dify, LangChain — treats agents as stateless by default. Every run starts from zero. Agents re-plan things they already planned. They repeat mistakes they already made. They forget what they learned last session. Parallel agents step on each other's state.
52
+
53
+ This isn't a small inconvenience. It's why production agent deployments are fragile, slow, and expensive at scale.
54
+
55
+ Mnemon fixes this. Drop it in and your agents stop being amnesiac.
56
+
57
+ > *Mnemon was Alexander the Great's personal historian — the one whose only job was to ensure nothing was ever forgotten, so every campaign built on the total accumulated knowledge of every campaign before it. Your agents have a Mnemon now.*
58
+
59
+ ---
60
+
61
+ ## Three Components
62
+
63
+ ### `mnemon.memory` — Cognitive Memory System
64
+ Five-layer stratified memory with protein bond activation retrieval and conditional intent drone curation.
65
+
66
+ - **Working** — ephemeral scratchpad, flushes at task end (no context bleed)
67
+ - **Episodic** — chronological experiences, importance-scored
68
+ - **Semantic** — stable facts, versioned key-value vault
69
+ - **Relationship** — per-user interaction patterns
70
+ - **Emotional** — emotional context, time-decayed
71
+
72
+ Retrieval: two-part — protein bond pattern assembly (zero LLM, ~15ms) followed by conditional intent drone (only above memory pool threshold).
73
+
74
+ ### `mnemon.cache` — Execution Memory Engine (EME)
75
+ Generalised execution template cache for any expensive recurring computation.
76
+
77
+ - **System 1** — exact fingerprint match → zero LLM, sub-millisecond
78
+ - **System 2** — partial segment match → gap fill with windowed context
79
+ - **Fragment library** — 49 pre-warmed proven segments, grows with use
80
+ - Works for agent plans, RAG pipelines, data pipelines, any structured workflow
81
+
82
+ ### `mnemon.bus` — Two-Tier Experience Bus
83
+ **Tier 1** — system learning loop, always on, no agents needed. Records outcomes, detects patterns, feeds EME and memory.
84
+
85
+ **Tier 2** — agent intelligence layer. PAD health monitoring (Pleasure/Arousal/Dominance), knowledge propagation (collective immunity), atomic belief registry (shared truth for swarms).
86
+
87
+ ---
88
+
89
+ ## Quick Start
90
+
91
+ ```bash
92
+ pip install mnemon-ai
93
+ ```
94
+
95
+ ```python
96
+ import asyncio
97
+ from mnemon import Mnemon
98
+
99
+ async def main():
100
+ async with Mnemon(tenant_id="my_company", agent_id="agent_01") as m:
101
+
102
+ # Remember something
103
+ await m.remember("Acme Corp prefers formal PDF reports")
104
+ await m.learn_fact("acme_contact", "Sarah K")
105
+
106
+ # Recall relevant memories
107
+ context = await m.recall("weekly security audit for Acme Corp")
108
+
109
+ # Run with full caching
110
+ result = await m.run(
111
+ goal="weekly security audit for Acme Corp",
112
+ inputs={"client": "Acme Corp", "week": "March 17-21"},
113
+ generation_fn=my_expensive_planning_function,
114
+ )
115
+
116
+ print(f"Cache level: {result['cache_level']}")
117
+ print(f"Tokens saved: {result['tokens_saved']}")
118
+ print(f"Latency: {result['latency_ms']:.0f}ms")
119
+
120
+ asyncio.run(main())
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Modular — Use Only What You Need
126
+
127
+ ```python
128
+ # Memory only
129
+ m = Mnemon(tenant_id="x", eme_enabled=False, bus_enabled=False)
130
+
131
+ # Execution cache only
132
+ m = Mnemon(tenant_id="x", memory_enabled=False, bus_enabled=False)
133
+
134
+ # Specific memory layers only
135
+ from mnemon.core.types import MemoryLayer
136
+ m = Mnemon(
137
+ tenant_id="x",
138
+ enabled_layers=[MemoryLayer.EPISODIC, MemoryLayer.SEMANTIC],
139
+ eme_enabled=False,
140
+ bus_enabled=False,
141
+ )
142
+ ```
143
+
144
+ ---
145
+
146
+ ## Connect Your LLM
147
+
148
+ ```python
149
+ from mnemon import Mnemon
150
+ from mnemon.llm.client import AnthropicClient
151
+
152
+ m = Mnemon(
153
+ tenant_id="my_company",
154
+ llm_client=AnthropicClient(api_key="sk-ant-..."),
155
+ )
156
+ ```
157
+
158
+ Without a real LLM, Mnemon runs in rule-based mode — fully functional, slightly less intelligent memory routing.
159
+
160
+ ---
161
+
162
+ ## Framework Adapters
163
+
164
+ ```python
165
+ from mnemon.adapters.crewai import CrewAIAdapter
166
+ from mnemon.adapters.letta import LettaAdapter
167
+
168
+ m = Mnemon(tenant_id="my_company", adapter=CrewAIAdapter())
169
+ ```
170
+
171
+ Write your own by subclassing `TemplateAdapter`:
172
+
173
+ ```python
174
+ from mnemon.core.eme import TemplateAdapter
175
+
176
+ class MyAdapter(TemplateAdapter):
177
+ def decompose(self, template): ...
178
+ def reconstruct(self, segments): ...
179
+ def extract_signature(self, template, goal): ...
180
+ ```
181
+
182
+ ---
183
+
184
+ ## Production Features
185
+
186
+ ```python
187
+ from mnemon import Mnemon
188
+ from mnemon.security.manager import TenantSecurityConfig
189
+
190
+ m = Mnemon(
191
+ tenant_id="my_company",
192
+ llm_client=AnthropicClient(api_key="..."),
193
+
194
+ # Security
195
+ security_config=TenantSecurityConfig(
196
+ tenant_id="my_company",
197
+ blocked_categories=["pii", "medical_records"],
198
+ encrypt_privileged=True,
199
+ ),
200
+
201
+ # Observability
202
+ enable_watchdog=True,
203
+ enable_telemetry=True,
204
+ watchdog_webhook="https://hooks.slack.com/...",
205
+
206
+ # Fragment pre-warming
207
+ prewarm_fragments=True,
208
+ )
209
+ ```
210
+
211
+ ---
212
+
213
+ ## Fail-Safe Design
214
+
215
+ Mnemon **never crashes the system it serves**.
216
+
217
+ - Memory retrieval fails → agent runs without context
218
+ - EME fails → `generation_fn` called directly
219
+ - Bus fails → agent continues unmonitored
220
+ - Database unavailable → in-memory fallback mode
221
+ - All failures logged, never raised
222
+
223
+ ---
224
+
225
+ ## CLI
226
+
227
+ ```bash
228
+ # Guided setup — detects your framework, loads fragments, runs benchmark
229
+ mnemon init
230
+
231
+ # Run eval suite
232
+ mnemon eval --suite standard
233
+
234
+ # Health check
235
+ mnemon health
236
+
237
+ # Telemetry report
238
+ mnemon stats
239
+ ```
240
+
241
+ ---
242
+
243
+ ## Architecture
244
+
245
+ ```
246
+ Any AI system
247
+ ↓ adapter translates
248
+ ┌──────────────────────────────────────────┐
249
+ │ EME Execution Memory Engine │ S1 → S2 → generation
250
+ │ Memory Five-layer cognitive memory │ protein bonds → intent drone
251
+ │ Bus Two-tier experience bus │ Tier 1 always / Tier 2 for agents
252
+ └──────────────────────────────────────────┘
253
+
254
+ SQLite (local) / Redis (scale)
255
+ ```
256
+
257
+ ---
258
+
259
+ ## Package Structure
260
+
261
+ ```
262
+ Mnemon/
263
+ ├── mnemon/
264
+ │ ├── __init__.py ← Mnemon class — the unified API
265
+ │ ├── core/
266
+ │ │ ├── types.py ← all shared dataclasses and enums
267
+ │ │ ├── persistence.py ← SQLite + inverted index + migrations
268
+ │ │ ├── memory.py ← five-layer memory + protein bonds + drone
269
+ │ │ ├── eme.py ← execution memory engine S1/S2
270
+ │ │ └── bus.py ← two-tier experience bus + PAD
271
+ │ ├── adapters/
272
+ │ │ ├── crewai.py ← CrewAI reference adapter
273
+ │ │ └── letta.py ← Letta/MemGPT adapter
274
+ │ ├── llm/
275
+ │ │ └── client.py ← Anthropic, OpenAI, Mock clients
276
+ │ ├── security/
277
+ │ │ └── manager.py ← content filtering, encryption, isolation
278
+ │ ├── observability/
279
+ │ │ ├── watchdog.py ← health checks, self-healing, alerts
280
+ │ │ └── telemetry.py ← structured metrics
281
+ │ ├── eval/
282
+ │ │ └── harness.py ← 14-scenario test suite with scoring
283
+ │ ├── fragments/
284
+ │ │ └── library.py ← 49 pre-warmed execution fragments
285
+ │ └── cli/
286
+ │ └── main.py ← mnemon init/eval/health/stats
287
+ ├── tests/
288
+ │ └── test_mnemon.py ← 29 tests, all passing
289
+ ├── example.py ← runnable full demo
290
+ ├── setup.py
291
+ ├── requirements.txt
292
+ └── README.md
293
+ ```
294
+
295
+ ---
296
+
297
+ ## Issues Filed — Problems Mnemon Solves
298
+
299
+ These are documented on the frameworks themselves:
300
+
301
+ - [CrewAI #4415](https://github.com/crewAIInc/crewAI/issues/4415) — context pollution and DB write contention
302
+ - [Dify #32306](https://github.com/langgenius/dify/issues/32306) — redundant reasoning tax in agent nodes
303
+ - [Kimi CLI #1058](https://github.com/MoonshotAI/kimi-cli/issues/1058) — context saturation in 100-agent swarms
304
+ - [E2B #1207](https://github.com/e2b-dev/E2B/issues/1207) — environmental amnesia in sandboxes
305
+ - [Letta RFC](https://github.com/letta-ai/letta) — heartbeat contention and sleep-time compute integration
306
+
307
+ ---
308
+
309
+ ## License
310
+
311
+ MIT — free to use, free to build on.
@@ -0,0 +1,271 @@
1
+ # Mnemon
2
+
3
+ **The intelligence layer between your agents and oblivion.**
4
+
5
+ By Mahika Jadhav ([@smartass-4ever](https://github.com/smartass-4ever))
6
+
7
+ ---
8
+
9
+ ## The Problem
10
+
11
+ Every major agent framework — CrewAI, Letta, Dify, LangChain — treats agents as stateless by default. Every run starts from zero. Agents re-plan things they already planned. They repeat mistakes they already made. They forget what they learned last session. Parallel agents step on each other's state.
12
+
13
+ This isn't a small inconvenience. It's why production agent deployments are fragile, slow, and expensive at scale.
14
+
15
+ Mnemon fixes this. Drop it in and your agents stop being amnesiac.
16
+
17
+ > *Mnemon was Alexander the Great's personal historian — the one whose only job was to ensure nothing was ever forgotten, so every campaign built on the total accumulated knowledge of every campaign before it. Your agents have a Mnemon now.*
18
+
19
+ ---
20
+
21
+ ## Three Components
22
+
23
+ ### `mnemon.memory` — Cognitive Memory System
24
+ Five-layer stratified memory with protein bond activation retrieval and conditional intent drone curation.
25
+
26
+ - **Working** — ephemeral scratchpad, flushes at task end (no context bleed)
27
+ - **Episodic** — chronological experiences, importance-scored
28
+ - **Semantic** — stable facts, versioned key-value vault
29
+ - **Relationship** — per-user interaction patterns
30
+ - **Emotional** — emotional context, time-decayed
31
+
32
+ Retrieval: two-part — protein bond pattern assembly (zero LLM, ~15ms) followed by conditional intent drone (only above memory pool threshold).
33
+
34
+ ### `mnemon.cache` — Execution Memory Engine (EME)
35
+ Generalised execution template cache for any expensive recurring computation.
36
+
37
+ - **System 1** — exact fingerprint match → zero LLM, sub-millisecond
38
+ - **System 2** — partial segment match → gap fill with windowed context
39
+ - **Fragment library** — 49 pre-warmed proven segments, grows with use
40
+ - Works for agent plans, RAG pipelines, data pipelines, any structured workflow
41
+
42
+ ### `mnemon.bus` — Two-Tier Experience Bus
43
+ **Tier 1** — system learning loop, always on, no agents needed. Records outcomes, detects patterns, feeds EME and memory.
44
+
45
+ **Tier 2** — agent intelligence layer. PAD health monitoring (Pleasure/Arousal/Dominance), knowledge propagation (collective immunity), atomic belief registry (shared truth for swarms).
46
+
47
+ ---
48
+
49
+ ## Quick Start
50
+
51
+ ```bash
52
+ pip install mnemon-ai
53
+ ```
54
+
55
+ ```python
56
+ import asyncio
57
+ from mnemon import Mnemon
58
+
59
+ async def main():
60
+ async with Mnemon(tenant_id="my_company", agent_id="agent_01") as m:
61
+
62
+ # Remember something
63
+ await m.remember("Acme Corp prefers formal PDF reports")
64
+ await m.learn_fact("acme_contact", "Sarah K")
65
+
66
+ # Recall relevant memories
67
+ context = await m.recall("weekly security audit for Acme Corp")
68
+
69
+ # Run with full caching
70
+ result = await m.run(
71
+ goal="weekly security audit for Acme Corp",
72
+ inputs={"client": "Acme Corp", "week": "March 17-21"},
73
+ generation_fn=my_expensive_planning_function,
74
+ )
75
+
76
+ print(f"Cache level: {result['cache_level']}")
77
+ print(f"Tokens saved: {result['tokens_saved']}")
78
+ print(f"Latency: {result['latency_ms']:.0f}ms")
79
+
80
+ asyncio.run(main())
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Modular — Use Only What You Need
86
+
87
+ ```python
88
+ # Memory only
89
+ m = Mnemon(tenant_id="x", eme_enabled=False, bus_enabled=False)
90
+
91
+ # Execution cache only
92
+ m = Mnemon(tenant_id="x", memory_enabled=False, bus_enabled=False)
93
+
94
+ # Specific memory layers only
95
+ from mnemon.core.types import MemoryLayer
96
+ m = Mnemon(
97
+ tenant_id="x",
98
+ enabled_layers=[MemoryLayer.EPISODIC, MemoryLayer.SEMANTIC],
99
+ eme_enabled=False,
100
+ bus_enabled=False,
101
+ )
102
+ ```
103
+
104
+ ---
105
+
106
+ ## Connect Your LLM
107
+
108
+ ```python
109
+ from mnemon import Mnemon
110
+ from mnemon.llm.client import AnthropicClient
111
+
112
+ m = Mnemon(
113
+ tenant_id="my_company",
114
+ llm_client=AnthropicClient(api_key="sk-ant-..."),
115
+ )
116
+ ```
117
+
118
+ Without a real LLM, Mnemon runs in rule-based mode — fully functional, slightly less intelligent memory routing.
119
+
120
+ ---
121
+
122
+ ## Framework Adapters
123
+
124
+ ```python
125
+ from mnemon.adapters.crewai import CrewAIAdapter
126
+ from mnemon.adapters.letta import LettaAdapter
127
+
128
+ m = Mnemon(tenant_id="my_company", adapter=CrewAIAdapter())
129
+ ```
130
+
131
+ Write your own by subclassing `TemplateAdapter`:
132
+
133
+ ```python
134
+ from mnemon.core.eme import TemplateAdapter
135
+
136
+ class MyAdapter(TemplateAdapter):
137
+ def decompose(self, template): ...
138
+ def reconstruct(self, segments): ...
139
+ def extract_signature(self, template, goal): ...
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Production Features
145
+
146
+ ```python
147
+ from mnemon import Mnemon
148
+ from mnemon.security.manager import TenantSecurityConfig
149
+
150
+ m = Mnemon(
151
+ tenant_id="my_company",
152
+ llm_client=AnthropicClient(api_key="..."),
153
+
154
+ # Security
155
+ security_config=TenantSecurityConfig(
156
+ tenant_id="my_company",
157
+ blocked_categories=["pii", "medical_records"],
158
+ encrypt_privileged=True,
159
+ ),
160
+
161
+ # Observability
162
+ enable_watchdog=True,
163
+ enable_telemetry=True,
164
+ watchdog_webhook="https://hooks.slack.com/...",
165
+
166
+ # Fragment pre-warming
167
+ prewarm_fragments=True,
168
+ )
169
+ ```
170
+
171
+ ---
172
+
173
+ ## Fail-Safe Design
174
+
175
+ Mnemon **never crashes the system it serves**.
176
+
177
+ - Memory retrieval fails → agent runs without context
178
+ - EME fails → `generation_fn` called directly
179
+ - Bus fails → agent continues unmonitored
180
+ - Database unavailable → in-memory fallback mode
181
+ - All failures logged, never raised
182
+
183
+ ---
184
+
185
+ ## CLI
186
+
187
+ ```bash
188
+ # Guided setup — detects your framework, loads fragments, runs benchmark
189
+ mnemon init
190
+
191
+ # Run eval suite
192
+ mnemon eval --suite standard
193
+
194
+ # Health check
195
+ mnemon health
196
+
197
+ # Telemetry report
198
+ mnemon stats
199
+ ```
200
+
201
+ ---
202
+
203
+ ## Architecture
204
+
205
+ ```
206
+ Any AI system
207
+ ↓ adapter translates
208
+ ┌──────────────────────────────────────────┐
209
+ │ EME Execution Memory Engine │ S1 → S2 → generation
210
+ │ Memory Five-layer cognitive memory │ protein bonds → intent drone
211
+ │ Bus Two-tier experience bus │ Tier 1 always / Tier 2 for agents
212
+ └──────────────────────────────────────────┘
213
+
214
+ SQLite (local) / Redis (scale)
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Package Structure
220
+
221
+ ```
222
+ Mnemon/
223
+ ├── mnemon/
224
+ │ ├── __init__.py ← Mnemon class — the unified API
225
+ │ ├── core/
226
+ │ │ ├── types.py ← all shared dataclasses and enums
227
+ │ │ ├── persistence.py ← SQLite + inverted index + migrations
228
+ │ │ ├── memory.py ← five-layer memory + protein bonds + drone
229
+ │ │ ├── eme.py ← execution memory engine S1/S2
230
+ │ │ └── bus.py ← two-tier experience bus + PAD
231
+ │ ├── adapters/
232
+ │ │ ├── crewai.py ← CrewAI reference adapter
233
+ │ │ └── letta.py ← Letta/MemGPT adapter
234
+ │ ├── llm/
235
+ │ │ └── client.py ← Anthropic, OpenAI, Mock clients
236
+ │ ├── security/
237
+ │ │ └── manager.py ← content filtering, encryption, isolation
238
+ │ ├── observability/
239
+ │ │ ├── watchdog.py ← health checks, self-healing, alerts
240
+ │ │ └── telemetry.py ← structured metrics
241
+ │ ├── eval/
242
+ │ │ └── harness.py ← 14-scenario test suite with scoring
243
+ │ ├── fragments/
244
+ │ │ └── library.py ← 49 pre-warmed execution fragments
245
+ │ └── cli/
246
+ │ └── main.py ← mnemon init/eval/health/stats
247
+ ├── tests/
248
+ │ └── test_mnemon.py ← 29 tests, all passing
249
+ ├── example.py ← runnable full demo
250
+ ├── setup.py
251
+ ├── requirements.txt
252
+ └── README.md
253
+ ```
254
+
255
+ ---
256
+
257
+ ## Issues Filed — Problems Mnemon Solves
258
+
259
+ These are documented on the frameworks themselves:
260
+
261
+ - [CrewAI #4415](https://github.com/crewAIInc/crewAI/issues/4415) — context pollution and DB write contention
262
+ - [Dify #32306](https://github.com/langgenius/dify/issues/32306) — redundant reasoning tax in agent nodes
263
+ - [Kimi CLI #1058](https://github.com/MoonshotAI/kimi-cli/issues/1058) — context saturation in 100-agent swarms
264
+ - [E2B #1207](https://github.com/e2b-dev/E2B/issues/1207) — environmental amnesia in sandboxes
265
+ - [Letta RFC](https://github.com/letta-ai/letta) — heartbeat contention and sleep-time compute integration
266
+
267
+ ---
268
+
269
+ ## License
270
+
271
+ MIT — free to use, free to build on.
@@ -0,0 +1,311 @@
1
+ Metadata-Version: 2.4
2
+ Name: mnemon-ai
3
+ Version: 1.0.0
4
+ Summary: The intelligence layer between your agents and oblivion
5
+ Home-page: https://github.com/smartass-4ever/Mnemon
6
+ Author: Mahika Jadhav
7
+ Author-email: mahikajadhav22@gmail.com
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: numpy>=1.24.0
19
+ Provides-Extra: full
20
+ Requires-Dist: sentence-transformers>=2.2.0; extra == "full"
21
+ Requires-Dist: redis>=5.0.0; extra == "full"
22
+ Requires-Dist: anthropic>=0.20.0; extra == "full"
23
+ Requires-Dist: openai>=1.0.0; extra == "full"
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
26
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
27
+ Requires-Dist: black>=23.0.0; extra == "dev"
28
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
29
+ Dynamic: author
30
+ Dynamic: author-email
31
+ Dynamic: classifier
32
+ Dynamic: description
33
+ Dynamic: description-content-type
34
+ Dynamic: home-page
35
+ Dynamic: license-file
36
+ Dynamic: provides-extra
37
+ Dynamic: requires-dist
38
+ Dynamic: requires-python
39
+ Dynamic: summary
40
+
41
+ # Mnemon
42
+
43
+ **The intelligence layer between your agents and oblivion.**
44
+
45
+ By Mahika Jadhav ([@smartass-4ever](https://github.com/smartass-4ever))
46
+
47
+ ---
48
+
49
+ ## The Problem
50
+
51
+ Every major agent framework — CrewAI, Letta, Dify, LangChain — treats agents as stateless by default. Every run starts from zero. Agents re-plan things they already planned. They repeat mistakes they already made. They forget what they learned last session. Parallel agents step on each other's state.
52
+
53
+ This isn't a small inconvenience. It's why production agent deployments are fragile, slow, and expensive at scale.
54
+
55
+ Mnemon fixes this. Drop it in and your agents stop being amnesiac.
56
+
57
+ > *Mnemon was Alexander the Great's personal historian — the one whose only job was to ensure nothing was ever forgotten, so every campaign built on the total accumulated knowledge of every campaign before it. Your agents have a Mnemon now.*
58
+
59
+ ---
60
+
61
+ ## Three Components
62
+
63
+ ### `mnemon.memory` — Cognitive Memory System
64
+ Five-layer stratified memory with protein bond activation retrieval and conditional intent drone curation.
65
+
66
+ - **Working** — ephemeral scratchpad, flushes at task end (no context bleed)
67
+ - **Episodic** — chronological experiences, importance-scored
68
+ - **Semantic** — stable facts, versioned key-value vault
69
+ - **Relationship** — per-user interaction patterns
70
+ - **Emotional** — emotional context, time-decayed
71
+
72
+ Retrieval: two-part — protein bond pattern assembly (zero LLM, ~15ms) followed by conditional intent drone (only above memory pool threshold).
73
+
74
+ ### `mnemon.cache` — Execution Memory Engine (EME)
75
+ Generalised execution template cache for any expensive recurring computation.
76
+
77
+ - **System 1** — exact fingerprint match → zero LLM, sub-millisecond
78
+ - **System 2** — partial segment match → gap fill with windowed context
79
+ - **Fragment library** — 49 pre-warmed proven segments, grows with use
80
+ - Works for agent plans, RAG pipelines, data pipelines, any structured workflow
81
+
82
+ ### `mnemon.bus` — Two-Tier Experience Bus
83
+ **Tier 1** — system learning loop, always on, no agents needed. Records outcomes, detects patterns, feeds EME and memory.
84
+
85
+ **Tier 2** — agent intelligence layer. PAD health monitoring (Pleasure/Arousal/Dominance), knowledge propagation (collective immunity), atomic belief registry (shared truth for swarms).
86
+
87
+ ---
88
+
89
+ ## Quick Start
90
+
91
+ ```bash
92
+ pip install mnemon-ai
93
+ ```
94
+
95
+ ```python
96
+ import asyncio
97
+ from mnemon import Mnemon
98
+
99
+ async def main():
100
+ async with Mnemon(tenant_id="my_company", agent_id="agent_01") as m:
101
+
102
+ # Remember something
103
+ await m.remember("Acme Corp prefers formal PDF reports")
104
+ await m.learn_fact("acme_contact", "Sarah K")
105
+
106
+ # Recall relevant memories
107
+ context = await m.recall("weekly security audit for Acme Corp")
108
+
109
+ # Run with full caching
110
+ result = await m.run(
111
+ goal="weekly security audit for Acme Corp",
112
+ inputs={"client": "Acme Corp", "week": "March 17-21"},
113
+ generation_fn=my_expensive_planning_function,
114
+ )
115
+
116
+ print(f"Cache level: {result['cache_level']}")
117
+ print(f"Tokens saved: {result['tokens_saved']}")
118
+ print(f"Latency: {result['latency_ms']:.0f}ms")
119
+
120
+ asyncio.run(main())
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Modular — Use Only What You Need
126
+
127
+ ```python
128
+ # Memory only
129
+ m = Mnemon(tenant_id="x", eme_enabled=False, bus_enabled=False)
130
+
131
+ # Execution cache only
132
+ m = Mnemon(tenant_id="x", memory_enabled=False, bus_enabled=False)
133
+
134
+ # Specific memory layers only
135
+ from mnemon.core.types import MemoryLayer
136
+ m = Mnemon(
137
+ tenant_id="x",
138
+ enabled_layers=[MemoryLayer.EPISODIC, MemoryLayer.SEMANTIC],
139
+ eme_enabled=False,
140
+ bus_enabled=False,
141
+ )
142
+ ```
143
+
144
+ ---
145
+
146
+ ## Connect Your LLM
147
+
148
+ ```python
149
+ from mnemon import Mnemon
150
+ from mnemon.llm.client import AnthropicClient
151
+
152
+ m = Mnemon(
153
+ tenant_id="my_company",
154
+ llm_client=AnthropicClient(api_key="sk-ant-..."),
155
+ )
156
+ ```
157
+
158
+ Without a real LLM, Mnemon runs in rule-based mode — fully functional, slightly less intelligent memory routing.
159
+
160
+ ---
161
+
162
+ ## Framework Adapters
163
+
164
+ ```python
165
+ from mnemon.adapters.crewai import CrewAIAdapter
166
+ from mnemon.adapters.letta import LettaAdapter
167
+
168
+ m = Mnemon(tenant_id="my_company", adapter=CrewAIAdapter())
169
+ ```
170
+
171
+ Write your own by subclassing `TemplateAdapter`:
172
+
173
+ ```python
174
+ from mnemon.core.eme import TemplateAdapter
175
+
176
+ class MyAdapter(TemplateAdapter):
177
+ def decompose(self, template): ...
178
+ def reconstruct(self, segments): ...
179
+ def extract_signature(self, template, goal): ...
180
+ ```
181
+
182
+ ---
183
+
184
+ ## Production Features
185
+
186
+ ```python
187
+ from mnemon import Mnemon
188
+ from mnemon.security.manager import TenantSecurityConfig
189
+
190
+ m = Mnemon(
191
+ tenant_id="my_company",
192
+ llm_client=AnthropicClient(api_key="..."),
193
+
194
+ # Security
195
+ security_config=TenantSecurityConfig(
196
+ tenant_id="my_company",
197
+ blocked_categories=["pii", "medical_records"],
198
+ encrypt_privileged=True,
199
+ ),
200
+
201
+ # Observability
202
+ enable_watchdog=True,
203
+ enable_telemetry=True,
204
+ watchdog_webhook="https://hooks.slack.com/...",
205
+
206
+ # Fragment pre-warming
207
+ prewarm_fragments=True,
208
+ )
209
+ ```
210
+
211
+ ---
212
+
213
+ ## Fail-Safe Design
214
+
215
+ Mnemon **never crashes the system it serves**.
216
+
217
+ - Memory retrieval fails → agent runs without context
218
+ - EME fails → `generation_fn` called directly
219
+ - Bus fails → agent continues unmonitored
220
+ - Database unavailable → in-memory fallback mode
221
+ - All failures logged, never raised
222
+
223
+ ---
224
+
225
+ ## CLI
226
+
227
+ ```bash
228
+ # Guided setup — detects your framework, loads fragments, runs benchmark
229
+ mnemon init
230
+
231
+ # Run eval suite
232
+ mnemon eval --suite standard
233
+
234
+ # Health check
235
+ mnemon health
236
+
237
+ # Telemetry report
238
+ mnemon stats
239
+ ```
240
+
241
+ ---
242
+
243
+ ## Architecture
244
+
245
+ ```
246
+ Any AI system
247
+ ↓ adapter translates
248
+ ┌──────────────────────────────────────────┐
249
+ │ EME Execution Memory Engine │ S1 → S2 → generation
250
+ │ Memory Five-layer cognitive memory │ protein bonds → intent drone
251
+ │ Bus Two-tier experience bus │ Tier 1 always / Tier 2 for agents
252
+ └──────────────────────────────────────────┘
253
+
254
+ SQLite (local) / Redis (scale)
255
+ ```
256
+
257
+ ---
258
+
259
+ ## Package Structure
260
+
261
+ ```
262
+ Mnemon/
263
+ ├── mnemon/
264
+ │ ├── __init__.py ← Mnemon class — the unified API
265
+ │ ├── core/
266
+ │ │ ├── types.py ← all shared dataclasses and enums
267
+ │ │ ├── persistence.py ← SQLite + inverted index + migrations
268
+ │ │ ├── memory.py ← five-layer memory + protein bonds + drone
269
+ │ │ ├── eme.py ← execution memory engine S1/S2
270
+ │ │ └── bus.py ← two-tier experience bus + PAD
271
+ │ ├── adapters/
272
+ │ │ ├── crewai.py ← CrewAI reference adapter
273
+ │ │ └── letta.py ← Letta/MemGPT adapter
274
+ │ ├── llm/
275
+ │ │ └── client.py ← Anthropic, OpenAI, Mock clients
276
+ │ ├── security/
277
+ │ │ └── manager.py ← content filtering, encryption, isolation
278
+ │ ├── observability/
279
+ │ │ ├── watchdog.py ← health checks, self-healing, alerts
280
+ │ │ └── telemetry.py ← structured metrics
281
+ │ ├── eval/
282
+ │ │ └── harness.py ← 14-scenario test suite with scoring
283
+ │ ├── fragments/
284
+ │ │ └── library.py ← 49 pre-warmed execution fragments
285
+ │ └── cli/
286
+ │ └── main.py ← mnemon init/eval/health/stats
287
+ ├── tests/
288
+ │ └── test_mnemon.py ← 29 tests, all passing
289
+ ├── example.py ← runnable full demo
290
+ ├── setup.py
291
+ ├── requirements.txt
292
+ └── README.md
293
+ ```
294
+
295
+ ---
296
+
297
+ ## Issues Filed — Problems Mnemon Solves
298
+
299
+ These are documented on the frameworks themselves:
300
+
301
+ - [CrewAI #4415](https://github.com/crewAIInc/crewAI/issues/4415) — context pollution and DB write contention
302
+ - [Dify #32306](https://github.com/langgenius/dify/issues/32306) — redundant reasoning tax in agent nodes
303
+ - [Kimi CLI #1058](https://github.com/MoonshotAI/kimi-cli/issues/1058) — context saturation in 100-agent swarms
304
+ - [E2B #1207](https://github.com/e2b-dev/E2B/issues/1207) — environmental amnesia in sandboxes
305
+ - [Letta RFC](https://github.com/letta-ai/letta) — heartbeat contention and sleep-time compute integration
306
+
307
+ ---
308
+
309
+ ## License
310
+
311
+ MIT — free to use, free to build on.
@@ -0,0 +1,9 @@
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ mnemon_ai.egg-info/PKG-INFO
5
+ mnemon_ai.egg-info/SOURCES.txt
6
+ mnemon_ai.egg-info/dependency_links.txt
7
+ mnemon_ai.egg-info/entry_points.txt
8
+ mnemon_ai.egg-info/requires.txt
9
+ mnemon_ai.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ mnemon = mnemon.cli.main:main
@@ -0,0 +1,13 @@
1
+ numpy>=1.24.0
2
+
3
+ [dev]
4
+ pytest>=7.0.0
5
+ pytest-asyncio>=0.21.0
6
+ black>=23.0.0
7
+ mypy>=1.0.0
8
+
9
+ [full]
10
+ sentence-transformers>=2.2.0
11
+ redis>=5.0.0
12
+ anthropic>=0.20.0
13
+ openai>=1.0.0
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,49 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ with open("README.md", "r", encoding="utf-8") as f:
4
+ long_description = f.read()
5
+
6
+ setup(
7
+ name="mnemon-ai",
8
+ version="1.0.0",
9
+ author="Mahika Jadhav",
10
+ author_email="mahikajadhav22@gmail.com",
11
+ description="The intelligence layer between your agents and oblivion",
12
+ long_description=long_description,
13
+ long_description_content_type="text/markdown",
14
+ url="https://github.com/smartass-4ever/Mnemon",
15
+ packages=find_packages(),
16
+ classifiers=[
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
24
+ ],
25
+ python_requires=">=3.10",
26
+ install_requires=[
27
+ "numpy>=1.24.0",
28
+
29
+ ],
30
+ extras_require={
31
+ "full": [
32
+ "sentence-transformers>=2.2.0",
33
+ "redis>=5.0.0",
34
+ "anthropic>=0.20.0",
35
+ "openai>=1.0.0",
36
+ ],
37
+ "dev": [
38
+ "pytest>=7.0.0",
39
+ "pytest-asyncio>=0.21.0",
40
+ "black>=23.0.0",
41
+ "mypy>=1.0.0",
42
+ ],
43
+ },
44
+ entry_points={
45
+ "console_scripts": [
46
+ "mnemon=mnemon.cli.main:main",
47
+ ],
48
+ },
49
+ )