fernme 0.3.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.
Files changed (89) hide show
  1. fernme-0.3.0/LICENSE +158 -0
  2. fernme-0.3.0/NOTICE +6 -0
  3. fernme-0.3.0/PKG-INFO +347 -0
  4. fernme-0.3.0/README.md +308 -0
  5. fernme-0.3.0/fernme/__init__.py +2 -0
  6. fernme-0.3.0/fernme/api/__init__.py +0 -0
  7. fernme-0.3.0/fernme/api/mcp_server.py +80 -0
  8. fernme-0.3.0/fernme/api/rest.py +125 -0
  9. fernme-0.3.0/fernme/audit.py +28 -0
  10. fernme-0.3.0/fernme/auth.py +64 -0
  11. fernme-0.3.0/fernme/capture/__init__.py +69 -0
  12. fernme-0.3.0/fernme/capture/agent_byproduct.py +43 -0
  13. fernme-0.3.0/fernme/capture/base.py +51 -0
  14. fernme-0.3.0/fernme/capture/config.py +81 -0
  15. fernme-0.3.0/fernme/capture/install.py +93 -0
  16. fernme-0.3.0/fernme/capture/local_tagger.py +92 -0
  17. fernme-0.3.0/fernme/capture/pipeline.py +44 -0
  18. fernme-0.3.0/fernme/capture/signal_hooks.py +120 -0
  19. fernme-0.3.0/fernme/categories.py +48 -0
  20. fernme-0.3.0/fernme/confidence.py +34 -0
  21. fernme-0.3.0/fernme/config.py +56 -0
  22. fernme-0.3.0/fernme/core/__init__.py +1 -0
  23. fernme-0.3.0/fernme/core/graph.py +95 -0
  24. fernme-0.3.0/fernme/curation.py +166 -0
  25. fernme-0.3.0/fernme/dp.py +64 -0
  26. fernme-0.3.0/fernme/eval/__init__.py +1 -0
  27. fernme-0.3.0/fernme/eval/ablation.py +76 -0
  28. fernme-0.3.0/fernme/eval/baselines.py +48 -0
  29. fernme-0.3.0/fernme/eval/context.py +60 -0
  30. fernme-0.3.0/fernme/eval/cost_variance.py +28 -0
  31. fernme-0.3.0/fernme/eval/drift.py +83 -0
  32. fernme-0.3.0/fernme/eval/experiment.py +111 -0
  33. fernme-0.3.0/fernme/eval/pareto.py +148 -0
  34. fernme-0.3.0/fernme/eval/pilot.py +120 -0
  35. fernme-0.3.0/fernme/eval/plot.py +25 -0
  36. fernme-0.3.0/fernme/eval/quality.py +65 -0
  37. fernme-0.3.0/fernme/eval/simulator.py +67 -0
  38. fernme-0.3.0/fernme/glossary.py +84 -0
  39. fernme-0.3.0/fernme/prior/__init__.py +1 -0
  40. fernme-0.3.0/fernme/prior/population.py +63 -0
  41. fernme-0.3.0/fernme/retrieve/__init__.py +2 -0
  42. fernme-0.3.0/fernme/retrieve/activation.py +70 -0
  43. fernme-0.3.0/fernme/retrieve/card.py +53 -0
  44. fernme-0.3.0/fernme/safety.py +44 -0
  45. fernme-0.3.0/fernme/service.py +529 -0
  46. fernme-0.3.0/fernme/store/__init__.py +1 -0
  47. fernme-0.3.0/fernme/store/json_store.py +56 -0
  48. fernme-0.3.0/fernme/store/postgres_store.py +186 -0
  49. fernme-0.3.0/fernme/store/sqlite_store.py +257 -0
  50. fernme-0.3.0/fernme/style.py +63 -0
  51. fernme-0.3.0/fernme/supernode.py +86 -0
  52. fernme-0.3.0/fernme/tagging.py +46 -0
  53. fernme-0.3.0/fernme/triggers.py +49 -0
  54. fernme-0.3.0/fernme/tuning.py +44 -0
  55. fernme-0.3.0/fernme/vocabulary.py +60 -0
  56. fernme-0.3.0/fernme/write/__init__.py +2 -0
  57. fernme-0.3.0/fernme/write/hebbian.py +69 -0
  58. fernme-0.3.0/fernme/write/mapping.py +41 -0
  59. fernme-0.3.0/fernme.egg-info/PKG-INFO +347 -0
  60. fernme-0.3.0/fernme.egg-info/SOURCES.txt +87 -0
  61. fernme-0.3.0/fernme.egg-info/dependency_links.txt +1 -0
  62. fernme-0.3.0/fernme.egg-info/requires.txt +25 -0
  63. fernme-0.3.0/fernme.egg-info/top_level.txt +1 -0
  64. fernme-0.3.0/pyproject.toml +43 -0
  65. fernme-0.3.0/setup.cfg +4 -0
  66. fernme-0.3.0/tests/test_audit.py +51 -0
  67. fernme-0.3.0/tests/test_auth.py +61 -0
  68. fernme-0.3.0/tests/test_capture.py +54 -0
  69. fernme-0.3.0/tests/test_categories.py +41 -0
  70. fernme-0.3.0/tests/test_confidence.py +52 -0
  71. fernme-0.3.0/tests/test_curation.py +70 -0
  72. fernme-0.3.0/tests/test_curation_integration.py +56 -0
  73. fernme-0.3.0/tests/test_dp.py +67 -0
  74. fernme-0.3.0/tests/test_engine.py +88 -0
  75. fernme-0.3.0/tests/test_fixes.py +46 -0
  76. fernme-0.3.0/tests/test_glossary.py +49 -0
  77. fernme-0.3.0/tests/test_graph.py +85 -0
  78. fernme-0.3.0/tests/test_injection.py +35 -0
  79. fernme-0.3.0/tests/test_modes.py +69 -0
  80. fernme-0.3.0/tests/test_perf_recall.py +71 -0
  81. fernme-0.3.0/tests/test_postgres.py +63 -0
  82. fernme-0.3.0/tests/test_salience.py +63 -0
  83. fernme-0.3.0/tests/test_service.py +78 -0
  84. fernme-0.3.0/tests/test_supernode.py +76 -0
  85. fernme-0.3.0/tests/test_timescale.py +45 -0
  86. fernme-0.3.0/tests/test_tuning.py +23 -0
  87. fernme-0.3.0/tests/test_v2.py +73 -0
  88. fernme-0.3.0/tests/test_v3.py +71 -0
  89. fernme-0.3.0/tests/test_vocabulary.py +70 -0
fernme-0.3.0/LICENSE ADDED
@@ -0,0 +1,158 @@
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 Derivative
95
+ 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; and
103
+
104
+ (d) If the Work includes a "NOTICE" text file as part of its
105
+ distribution, then any Derivative Works that You distribute must
106
+ include a readable copy of the attribution notices contained
107
+ within such NOTICE file.
108
+
109
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
110
+ any Contribution intentionally submitted for inclusion in the Work
111
+ by You to the Licensor shall be under the terms and conditions of
112
+ this License, without any additional terms or conditions.
113
+
114
+ 6. Trademarks. This License does not grant permission to use the trade
115
+ names, trademarks, service marks, or product names of the Licensor,
116
+ except as required for reasonable and customary use in describing the
117
+ origin of the Work and reproducing the content of the NOTICE file.
118
+
119
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed
120
+ to in writing, Licensor provides the Work (and each Contributor
121
+ provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES
122
+ OR CONDITIONS OF ANY KIND, either express or implied, including,
123
+ without limitation, any warranties or conditions of TITLE,
124
+ NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
125
+
126
+ 8. Limitation of Liability. In no event and under no legal theory,
127
+ whether in tort (including negligence), contract, or otherwise,
128
+ unless required by applicable law shall any Contributor be liable
129
+ to You for damages, including any direct, indirect, special,
130
+ incidental, or consequential damages of any character arising as a
131
+ result of this License or out of the use or inability to use the Work.
132
+
133
+ 9. Accepting Warranty or Additional Liability. While redistributing the
134
+ Work or Derivative Works thereof, You may choose to offer, and charge
135
+ a fee for, acceptance of support, warranty, indemnity, or other
136
+ liability obligations and/or rights consistent with this License.
137
+
138
+ END OF TERMS AND CONDITIONS
139
+
140
+ APPENDIX: How to apply the Apache License to your work.
141
+
142
+ To apply the Apache License to your work, attach the following
143
+ boilerplate notice, with the fields enclosed by brackets "[]"
144
+ replaced with your own identifying information.
145
+
146
+ Copyright 2026 Acquilab Inc.
147
+
148
+ Licensed under the Apache License, Version 2.0 (the "License");
149
+ you may not use this file except in compliance with the License.
150
+ You may obtain a copy of the License at
151
+
152
+ http://www.apache.org/licenses/LICENSE-2.0
153
+
154
+ Unless required by applicable law or agreed to in writing, software
155
+ distributed under the License is distributed on an "AS IS" BASIS,
156
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
157
+ See the License for the specific language governing permissions and
158
+ limitations under the License.
fernme-0.3.0/NOTICE ADDED
@@ -0,0 +1,6 @@
1
+ FERNme (Fuzzy-Edged Recall Network)
2
+ Copyright 2026 Acquilab Inc.
3
+
4
+ This product includes software developed at Acquilab Inc.
5
+
6
+ Licensed under the Apache License, Version 2.0. See the LICENSE file.
fernme-0.3.0/PKG-INFO ADDED
@@ -0,0 +1,347 @@
1
+ Metadata-Version: 2.4
2
+ Name: fernme
3
+ Version: 0.3.0
4
+ Summary: FERNme β€” a user-owned, near-zero-LLM memory layer for AI agents (websites today; desktop and mobile on the roadmap).
5
+ Author: Mirkomil Sharipov
6
+ Maintainer: Acquilab Inc.
7
+ License: Apache-2.0
8
+ Project-URL: Homepage, https://fernme.dev
9
+ Project-URL: Repository, https://github.com/mirkofr/FERNme
10
+ Project-URL: Documentation, https://fernme.dev
11
+ Keywords: llm,agent,memory,hebbian,spreading-activation,personalization
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ License-File: NOTICE
21
+ Requires-Dist: numpy>=1.24
22
+ Requires-Dist: tiktoken>=0.5
23
+ Provides-Extra: api
24
+ Requires-Dist: fastapi>=0.110; extra == "api"
25
+ Requires-Dist: uvicorn[standard]>=0.27; extra == "api"
26
+ Provides-Extra: mcp
27
+ Requires-Dist: mcp>=1.0; extra == "mcp"
28
+ Provides-Extra: postgres
29
+ Requires-Dist: psycopg[binary]>=3.1; extra == "postgres"
30
+ Provides-Extra: viz
31
+ Requires-Dist: matplotlib>=3.7; extra == "viz"
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=7.4; extra == "dev"
34
+ Requires-Dist: httpx>=0.27; extra == "dev"
35
+ Provides-Extra: pgtest
36
+ Requires-Dist: psycopg[binary]>=3.1; extra == "pgtest"
37
+ Requires-Dist: pgserver>=0.1; sys_platform != "win32" and extra == "pgtest"
38
+ Dynamic: license-file
39
+
40
+ <div align="center">
41
+
42
+ # 🌿 FERNme
43
+
44
+ ### Fuzzy-Edged Recall Network
45
+
46
+ **A user-owned, near-zero-LLM memory layer for AI agents. It learns each person from their behavior β€” including how they talk and feel β€” stays token-flat forever, and lets people see, edit, and own what's remembered. The engine is substrate-agnostic: it remembers wherever an agent acts β€” websites today (shopping, support, booking, healthcare, tutoring, gov), desktop and mobile next.**
47
+
48
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-2471a3.svg)](LICENSE)
49
+ [![Site](https://img.shields.io/badge/site-fernme.dev-1d9e75.svg)](https://fernme.dev)
50
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-1d9e75.svg)](https://www.python.org/)
51
+ [![Tests](https://img.shields.io/badge/tests-91%20passing-1d9e75.svg)](#-tested-not-claimed)
52
+ [![Storage](https://img.shields.io/badge/storage-SQLite%20%7C%20Postgres-854f0b.svg)](#-architecture)
53
+ [![Status](https://img.shields.io/badge/status-v0.2%20research%20preview-7f77dd.svg)](#-honest-status)
54
+
55
+ *Cheap to write Β· flat to read Β· interpretable by design Β· owned by the user*
56
+
57
+ [**fernme.dev**](https://fernme.dev)
58
+
59
+ </div>
60
+
61
+ ---
62
+
63
+ ## ✨ The one-paragraph pitch
64
+
65
+ Most agent memory is **written by an LLM on every turn** (expensive, hallucination-prone), **evaluated on question-answering** (not actions), and **assumes a single user**. FERNme is built for the opposite world β€” agents that *act* for *many* people, in any domain (a sale, a booking, a resolved ticket, a completed lesson, a kept appointment β€” "outcome" is whatever the goal is). It starts where agents already act today β€” websites β€” and the same user-owned memory is designed to extend to desktop and mobile. Each user is a sparse, fuzzily-weighted node in a per-site graph; edges update by a **Hebbian co-occurrence rule with zero LLM calls**, retrieval is **spreading activation**, and the prompt-facing "card" stores only **deviations from a population prior**. The result: per-turn cost stays flat as a profile grows for years, the user can read and correct their own memory, and the same engine assembles β€” only with the user's consent β€” into a cross-site **supernode** they fully control.
66
+
67
+ ---
68
+
69
+ ## 🎯 Why FERNme (the strong points)
70
+
71
+ | | |
72
+ |---|---|
73
+ | πŸͺΆ **Zero-LLM writes** | Memory updates are arithmetic on a graph β€” **0 LLM calls per interaction** vs. ~2 for extraction-based memory. No write-time cost, no write-time hallucination. |
74
+ | πŸ“‰ **Flat token cost forever** | The prompt card holds **~25 tokens** whether it's a visitor's first day or fifth year. A full-history baseline is **77Γ— larger** by 120 interactions. |
75
+ | 🧠 **Strong in every regime** | Ties a frequency counter on static recall, **beats it 0.72 β†’ 0.13 on drift**, and **wins on context** (0.62 β†’ 0.51). Decay + spreading activation unify stability and adaptivity. |
76
+ | πŸͺŸ **Glass-box & user-owned** | Every preference is visible and editable. People fix what's wrong, delete everything, or export it. Privacy becomes a feature, not a liability. |
77
+ | 🏬 **Built for outcomes** | Evaluated by **conversion**, not QA. A simulated storefront shows **+16% conversion lift** vs. non-personalized recommendations. |
78
+ | 🧩 **User-owned supernode** | Sign in across sites β†’ your memories assemble like Lego into one profile **you control**, default-deny, sensitive data walled off. Not surveillance β€” the mirror image of it. |
79
+ | 🎚 **Cost/quality dial** | One engine, a `memory_mode` switch: free key-less `pure` by default, opt-in `gated`/`offline` LLM enrichment when you need Mem0-grade nuance β€” pay only for the compute you use. |
80
+ | πŸ” **Verifiable & unlearnable** | Every action is logged in a tamper-evident HMAC chain the user can replay to detect any alteration; `forget_everywhere` wipes the profile **and** unlearns the person from the population prior β€” provable right-to-be-forgotten. |
81
+ | πŸ›‘ **Injection-proof by design** | Writes are arithmetic, not LLM extraction, so page/user text can't be "talked into" becoming a belief β€” tested that injected instructions never enter memory. |
82
+ | 🧠 **Private collective intelligence** | New users benefit from crowd patterns on turn one (cold-start from a population prior), with **k-anonymity + differential privacy** so no individual leaks. A network-effect moat single-user memories can't have. |
83
+ | πŸ—£ **Style & mood memory** | Learns *how* each person communicates (terse/verbose, formal/casual, energy) and tracks their **mood with trend detection**, so the agent can match tone and notice when someone's frustration is rising β€” in any domain. |
84
+ | 🎯 **Outcome-learning, any goal** | Memory is reinforced by *results* β€” not just recall. `record_outcome(success)` strengthens what worked and weakens what backfired, where "success" is any goal (purchase, booking, resolved ticket, completed lesson…). |
85
+ | πŸ” **Explainable** | Ask `why(user, attr)` β€” get the evidence (observations + good/bad outcomes + dates). No black box. |
86
+ | πŸ”Œ **Deployable plumbing** (research preview; harden per SECURITY.md) | SQLite or **Postgres** (tested on real PG 16), REST + **MCP** servers, consent gating, injection-safe writes, proactive triggers β€” all tested. |
87
+
88
+ ---
89
+
90
+ ## πŸ“Š Benchmarks
91
+
92
+ > **Honest scope:** the numbers below are on **synthetic or LLM-authored** data, not real
93
+ > users. They validate the *mechanism* and surface failures; a real-human pilot is the
94
+ > pending next step. The Mem0 (LLM) head-to-head needs an API key and is not yet run.
95
+
96
+ ### On LLM-authored people (closest to real, agentic ingestion)
97
+ A sample of 16 of 92 third-person profiles (ChatGPT-authored), read as **prose only** and
98
+ remembered agentically, then scored against hidden answer keys:
99
+
100
+ | metric | result |
101
+ |---|---|
102
+ | preference coverage vs. hidden key | **75%** |
103
+ | communication style β€” formality | **100%** |
104
+ | mood sign / mood arc | **94% / 100%** |
105
+ | preference drift detected | **94%** |
106
+ | injection attempts ignored | **100%** |
107
+ | note β†’ card compression | **7.3Γ—** |
108
+
109
+ *(The "agent" here is an LLM reading prose, so these reflect agent + engine together β€” the
110
+ engine is solid; the extraction quality is the agent's.)*
111
+
112
+ ### Cost, recall, and Pareto (synthetic, multi-seed)
113
+
114
+ > Reproduce: `python -m fernme.eval.cost_variance` Β· `... quality` Β· `... drift` Β· `... context` Β· `... ablation` Β· `... pilot`
115
+
116
+ **Cost** β€” per-turn memory tokens vs. profile size (5 seeds):
117
+
118
+ | metric | FERNme | baseline |
119
+ |---|---|---|
120
+ | card size | **24.9 Β± 0.5 tokens** (flat) | full history grows linearly |
121
+ | at 120 interactions | **1Γ—** | **77Γ— Β± 1.3** larger |
122
+ | LLM calls per write | **0** | ~2 (extraction memory) |
123
+
124
+ **Recall quality** β€” precision@5 vs. ground-truth preferences (5 seeds Γ— 40 users):
125
+
126
+ | regime | 🌿 FERNme | frequency | recency |
127
+ |---|:---:|:---:|:---:|
128
+ | static recall | 0.74 | 0.74 | 0.47 |
129
+ | **drift** (taste shifts) | **0.72** βœ… | 0.13 ❌ | 0.59 |
130
+ | **context** (precision@3) | **0.62** βœ… | 0.51 (blind) | β€” |
131
+
132
+ > **The headline:** FERNme is the *only* method strong everywhere. Frequency can't forget (fails drift); recency is noisy (fails static). FERNme's decay + spreading activation get both.
133
+
134
+ **Cold-start ablation** β€” population prior gives **+0.06 precision@5 at turns 1–3**, washing out by turn 10 (a real but modest, cold-start-only benefit).
135
+
136
+ **Cost / quality Pareto** (`python -m fernme.eval.pareto`) β€” measured FERNme recall &
137
+ tokens, modeled LLM nuance & price (assumptions in-file). Per 1,000 interactions:
138
+
139
+ | strategy | quality | $/1k | vs Mem0 |
140
+ |---|:--:|:--:|:--:|
141
+ | FERNme-pure | 0.52 | $0.008 | 122Γ— cheaper |
142
+ | **FERNme+gated** | 0.66 | $0.023 | **42Γ— cheaper** |
143
+ | **FERNme+offline** | 0.73 | $0.104 | **9Γ— cheaper** |
144
+ | full-history@120 | 0.82 | $0.59 (grows) | β€” |
145
+ | Mem0-style | 0.82 | $0.95 | 1Γ— |
146
+
147
+ FERNme+gated/offline sit on the efficient knee: **~80–90% of the LLM-ceiling quality
148
+ at 1–2 orders of magnitude less cost.** (Modeled assumptions; shape is the point.)
149
+
150
+ ![Cost/quality Pareto β€” FERNme+gated/offline on the efficient knee](docs/cost_quality_pareto.png)
151
+
152
+ **Simulated outcome pilot** β€” fake storefront, learn-from-behavior shoppers: **+16% relative conversion lift** over a popularity baseline; tied at visit 1 (cold start), pulling ahead as it learns, recovering through a mid-pilot taste drift.
153
+
154
+ ---
155
+
156
+ ## 🎚 Memory modes (one engine, a cost/quality dial)
157
+
158
+ FERNme ships **one core** with a deployment-level switch β€” `FernService(memory_mode=...)`.
159
+ The default is free, key-less, and tested; LLM modes are opt-in and pluggable.
160
+
161
+ | mode | LLM use | cost | status |
162
+ |---|---|---|---|
163
+ | **`pure`** (default) | none | cheapest, flat | βœ… tested, key-less |
164
+ | **`gated`** | one small call **only on novel free-text** | ~tiny | πŸ§ͺ experimental β€” needs a model |
165
+ | **`offline`** | batched `consolidate()` enrichment, off the hot path | ~tiny, amortized | πŸ§ͺ experimental β€” needs a model |
166
+
167
+ - A **pluggable tagger** (`tagging.py`) does the LLM work; you pass `llm_fn`, optionally
168
+ constrained to a **controlled vocabulary** (the real consistency lever across models).
169
+ - The hot write path stays **LLM-free in every mode**; gated spends a call only when the
170
+ deterministic mapping finds nothing, and `svc.llm_calls` counts every invocation for
171
+ cost transparency.
172
+ - See the cost/quality Pareto above for where each mode lands. *Honest note:* the gated/
173
+ offline quality is **modeled** until run against a real model β€” the wiring is tested
174
+ here with a mock LLM, not validated for quality.
175
+
176
+ ## 🧭 The 9 leapfrog dimensions (status)
177
+
178
+ FERNme's edge isn't the mechanism (that's now a crowded 2026 category) β€” it's competing
179
+ on dimensions single-user, vendor-owned, recall-optimized systems **structurally can't**.
180
+
181
+ | # | Dimension | Status |
182
+ |---|---|---|
183
+ | 9 | **Communication-style & mood memory** | βœ… built + tested |
184
+ | 2 | **Outcome-learning for any goal** (reinforce on results) | βœ… built + tested |
185
+ | 8 | **Explainable provenance** (`why`) | βœ… built + tested |
186
+ | 1 | **Private collective priors** (network-effect cold-start; k-anonymity + bounded-mean DP) | βœ… built + tested |
187
+ | 4 | **Verifiable, cryptographic data ownership** (tamper-evident HMAC chain, cascading unlearning) | βœ… built + tested |
188
+ | 7 | **Multi-timescale memory** (fast context vs. slow identity) | βœ… built + tested |
189
+ | 6 | **Self-tuning forgetting** (learn decay from outcomes; adapts to drift) | βœ… built + tested |
190
+ | 5 | **Injection-resistant by construction** (deterministic writes can't be talked into beliefs) | βœ… built + tested |
191
+ | 3 | **Open user-owned memory protocol** (portable across any agent, with consent) | β—‘ spec stage |
192
+
193
+ > These are deliberately the things HippoGraph et al. can't follow: they're single-user
194
+ > (no collective priors), vendor-owned (no user-owned protocol), and recall-optimized
195
+ > (no outcome loop). Built in honest, tested slices β€” research-dependent ones are marked.
196
+
197
+ ## πŸ— Architecture
198
+
199
+ ```mermaid
200
+ flowchart TD
201
+ V[Visitor on a website] -->|prompt + action| API[FERNme Service]
202
+ API --> CONSENT{consent?}
203
+ CONSENT -->|no| STOP[blocked]
204
+ CONSENT -->|yes| ENGINE
205
+ subgraph ENGINE[Engine - no LLM in the write path]
206
+ W[Hebbian write + decay] --> G[(Per-site preference graph<br/>fuzzy 0-9 edges)]
207
+ G --> R[Spreading-activation retrieval]
208
+ R --> CARD[Token-minimal card ~25 tok]
209
+ PRIOR[Population prior<br/>differential encoding] --> R
210
+ end
211
+ CARD --> AGENT[Agent: recommend / act]
212
+ G --> CAB[(Cabinet: raw event log)]
213
+ API --> STORE[(SQLite or Postgres<br/>multi-tenant)]
214
+ API --> GLASS[πŸͺŸ Glass-box editor]
215
+ API -.user signs in.-> SUPER[User-owned Supernode<br/>cross-site, default-deny]
216
+ ```
217
+
218
+ ---
219
+
220
+ ## 🧠 How FERNme works (visual walkthrough)
221
+
222
+ ![Why FERNme](explanation%20of%20fern/IMG_7794.PNG)
223
+ *Why FERNme β€” adaptive local memory instead of expensive RAG/vector retrieval in the loop.*
224
+
225
+ ![Seven core principles](explanation%20of%20fern/IMG_7796.PNG)
226
+ *What makes it different β€” near-zero-LLM, deterministic-first, Hebbian, fuzzy, memory cards, action-aware, user-owned.*
227
+
228
+ ![How memory grows](explanation%20of%20fern/IMG_7797.PNG)
229
+ *How memory grows β€” new event β†’ connect β†’ strengthen β†’ decay β†’ update the card (Hebbian learning).*
230
+
231
+ ![Fuzzy Hebbian graph](explanation%20of%20fern/IMG_7799.PNG)
232
+ *The fuzzy Hebbian graph β€” sparse, weighted (0–9) edges; nodes for users, preferences, topics, goals.*
233
+
234
+ ![The LLM gate](explanation%20of%20fern/IMG_7784.PNG)
235
+ *The LLM gate β€” an exception, not the default. Most events are handled deterministically; the LLM is a rare fallback when uncertain.*
236
+
237
+ ![Memory card](explanation%20of%20fern/IMG_7802.PNG)
238
+ *The memory card β€” a bounded, interpretable, token-minimal summary of what matters.*
239
+
240
+ ![Action-aware learning](explanation%20of%20fern/IMG_7781.PNG)
241
+ *Action-aware learning β€” good outcomes strengthen connections, bad outcomes weaken them.*
242
+
243
+ ![The road ahead](explanation%20of%20fern/IMG_7780.PNG)
244
+ *The road ahead β€” today's local memory; tomorrow's recursive organization and user-owned supernode (roadmap, not yet built).*
245
+
246
+ ![FERNme architecture](explanation%20of%20fern/IMG_7788.PNG)
247
+ *Full architecture: ingestion bridge β†’ namespaced vocabulary β†’ fuzzy Hebbian graph β†’ memory card β†’ agent, with the LLM gate only when uncertain.*
248
+
249
+ ## πŸš€ Quickstart
250
+
251
+ ```bash
252
+ pip install -e ".[dev,api]"
253
+
254
+ python run_demo.py # cold-start β†’ learning β†’ glass-box edit
255
+ python supernode_demo.py # one person, three sites, one owned profile
256
+ pytest -q # 91 tests (engine, store, supernode, safety, auth…)
257
+
258
+ # experiments
259
+ python -m fernme.eval.drift # FERNme beats a frequency counter when tastes change
260
+ python -m fernme.eval.pilot # +16% simulated conversion lift
261
+
262
+ # run it live
263
+ FERNME_API_KEY=secret uvicorn fernme.api.rest:app --port 8077 # REST API (docs at /docs)
264
+ open http://localhost:8077/ui # glass-box memory editor
265
+ open http://localhost:8077/graph # your memory as a graph β€” focus by site / PC / phone
266
+ python -m fernme.api.mcp_server # MCP server for agents/Claude
267
+ ```
268
+
269
+ > πŸ—„ **Storage:** defaults to `~/.fernme/fernme.db` (SQLite). For production use `PostgresStore` β€” same interface, tested against a real Postgres 16. Keep SQLite off cloud-synced folders.
270
+
271
+ ---
272
+
273
+ ## 🧱 What's inside
274
+
275
+ - **Engine** β€” saturating Hebbian write (no LLM), ACT-R decay, spreading activation, token-minimal card.
276
+ - **Population prior** β€” IDF cold-start; differential (deviation-only) storage is
277
+ enforced by an explicit `prune_to_prior` pass (redundant edges read through to the prior).
278
+ - **Stores** β€” `SQLiteStore` (zero-setup) and `PostgresStore` (tested vs real PG 16), one interface.
279
+ - **Ingestion bridge** β€” a per-site **catalog** (item_id->tags) plus a **controlled,
280
+ namespaced vocabulary** (`vocabulary.py`) that canonicalizes every tag (catalog,
281
+ free text, or LLM) to one form (`pref:`, `topic:`, `goal:`, `context:`) so the same
282
+ concept never drifts across months. Deterministic by default; gated-LLM only for
283
+ novel free text. *This is the product-critical layer β€” and the foundation a future
284
+ recursive/region organization would group on.*
285
+ - **The Cabinet** β€” append-only event log with `recall()` for specific facts.
286
+ - **Supernode** (`supernode.py` + `auth.py`) β€” user-owned cross-site profile, built by **sign-in** (verified token β†’ opaque person id), default-deny scoped views, sensitive categories walled off.
287
+ - **Proactive triggers** β€” due-to-reorder + fading-favorite nudges.
288
+ - **Safety** β€” event tags treated as untrusted data: injection-pattern dropping, size/value caps.
289
+ - **Interfaces** β€” REST (`/observe /card /recall /edit /export /delete /triggers …`) + MCP tools + a **glass-box web UI** (editor at `/ui`, cross-surface memory graph at `/graph` β€” one memory, focusable by site / PC / phone).
290
+ - **Governance** β€” consent-gated everywhere; export & right-to-be-forgotten built in.
291
+
292
+ ---
293
+
294
+ ## πŸ”¬ How FERNme compares
295
+
296
+ FERNme is a **different category** from conversational memories β€” it's a per-user *preference* graph evaluated by *actions*, not a QA memory. Don't benchmark it on LoCoMo; that's the wrong axis.
297
+
298
+ | | 🌿 FERNme | Mem0 | Zep/Graphiti | Letta | MemOS |
299
+ |---|:--:|:--:|:--:|:--:|:--:|
300
+ | Write | **no LLM** | LLM | LLM β†’ KG | LLM-paged | LLM |
301
+ | Retrieval | spreading activation | vector | graph+time | OS paging | hybrid |
302
+ | Eval axis | **outcomes** | QA | temporal QA | long-horizon | QA |
303
+ | User-owned + glass-box | **βœ…** | – | – | – | – |
304
+ | Multi-tenant per-site | **βœ…** | passport | – | – | – |
305
+
306
+ **Leads on:** write cost, interpretability, per-site user-ownership/consent. **Honestly behind on:** nuanced/causal preferences (LLM extraction wins), benchmark credibility, ecosystem & distribution.
307
+
308
+ ---
309
+
310
+ ## βš–οΈ Honest status
311
+
312
+ βœ… **Done & tested (91 tests):** engine, SQLite + real-Postgres stores, supernode + sign-in, triggers, safety, REST/MCP, glass-box UI + memory-graph view, and the full results suite above.
313
+
314
+ 🚧 **Still open (genuinely needs the outside world):**
315
+ - A **real-human per-site pilot** β€” only live users close the loop a simulator can't.
316
+ - The **Mem0 (LLM) head-to-head** β€” harness wired; run locally with `OPENAI_API_KEY`.
317
+ - **Embeddings** for context→attribute matching; offline LLM catalog enrichment for messy inputs.
318
+ - **Desktop & mobile surfaces** β€” the engine is substrate-agnostic; web ingestion ships today, desktop/mobile adapters are on the roadmap. The user-owned **supernode** is the bridge that assembles them, with consent, into one cross-surface profile.
319
+
320
+ > Every claim above is backed by a test or a reproducible experiment. Where a result is simulated, it says so β€” a simulator proves the *mechanism*, not real-world behavior.
321
+
322
+ ---
323
+
324
+ ## πŸ“ Layout
325
+
326
+ ```
327
+ fernme/
328
+ core/ graph types Β· fuzzy 0–9 edges Β· event record
329
+ write/ event→attr mapping (no LLM) · Hebbian update · decay
330
+ retrieve/ base-level + spreading activation Β· token-minimal card
331
+ prior/ population prior Β· differential encoding Β· IDF cold-start
332
+ store/ sqlite_store Β· postgres_store (one interface)
333
+ supernode.py Β· auth.py Β· triggers.py Β· safety.py Β· service.py
334
+ api/ rest.py (FastAPI) Β· mcp_server.py Β· web/glassbox.html Β· web/graph.html
335
+ eval/ simulator Β· cost Β· quality Β· drift Β· context Β· ablation Β· pilot
336
+ tests/ 91 tests Β· *_demo.py walkthroughs
337
+ ```
338
+
339
+ ---
340
+
341
+ ## πŸ“œ License & citation
342
+
343
+ Apache-2.0, Β© 2026 Acquilab Inc. β€” see [LICENSE](LICENSE) and [NOTICE](NOTICE). Security notes in [SECURITY.md](SECURITY.md); the name is a working codename (see [NAMING.md](NAMING.md)).
344
+ If you use FERNme in research, please cite it via [CITATION.cff](CITATION.cff).
345
+
346
+ <div align="center">
347
+ <su