hyphae-memory 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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 benolenick
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,34 @@
1
+ Metadata-Version: 2.4
2
+ Name: hyphae-memory
3
+ Version: 0.1.0
4
+ Summary: Self-organizing memory with gap-aware retrieval. Add facts, query gaps, the network grows itself.
5
+ Author: Ben Olenick
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/benolenick/hyphae
8
+ Project-URL: Repository, https://github.com/benolenick/hyphae
9
+ Keywords: memory,retrieval,manifold,geodesic,diffusion-maps,clustering,knowledge-base,rag,gap-detection
10
+ Classifier: Development Status :: 2 - Pre-Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
14
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Requires-Python: >=3.10
20
+ License-File: LICENSE
21
+ Requires-Dist: numpy>=1.24
22
+ Requires-Dist: scipy>=1.10
23
+ Requires-Dist: scikit-learn>=1.2
24
+ Requires-Dist: sentence-transformers>=2.2
25
+ Provides-Extra: faiss
26
+ Requires-Dist: faiss-cpu>=1.7; extra == "faiss"
27
+ Provides-Extra: server
28
+ Requires-Dist: fastapi>=0.100; extra == "server"
29
+ Requires-Dist: uvicorn>=0.20; extra == "server"
30
+ Provides-Extra: all
31
+ Requires-Dist: faiss-cpu>=1.7; extra == "all"
32
+ Requires-Dist: fastapi>=0.100; extra == "all"
33
+ Requires-Dist: uvicorn>=0.20; extra == "all"
34
+ Dynamic: license-file
@@ -0,0 +1,186 @@
1
+ # Hyphae
2
+
3
+ Self-organizing memory for AI agents. Add facts, query gaps, the network grows itself.
4
+
5
+ Hyphae is a long-term memory server that stores knowledge as facts, clusters them semantically, builds manifold geometry over the clusters, and retrieves along geodesic paths rather than flat cosine similarity. It's designed to be the memory layer for AI agents that need to remember decisions, discoveries, and context across sessions.
6
+
7
+ ## Features
8
+
9
+ - **Remember/Recall API** - Store facts with tags and source attribution, recall by semantic similarity
10
+ - **Auto-clustering** - Facts are automatically routed to semantic clusters with adaptive merge/split
11
+ - **Manifold re-ranking** - Clusters with 30+ facts get diffusion map manifolds built in the background; recall results are re-ranked by manifold distance for sharper relevance
12
+ - **Session scoping** - Scope recalls to a project so cross-project facts don't bleed
13
+ - **Gap detection** - Analyze observations against an objective to find knowledge gaps and retrieve facts to fill them
14
+ - **Briefing system** - Auto-distills recent facts into compressed session summaries
15
+ - **Ivory Towers** - Structured knowledge landmarks that organize facts into navigable multi-floor buildings
16
+ - **MCP server** - Claude Code integration via Model Context Protocol
17
+ - **Rivers & Stones** - Goal tracking with stepping-stone progression
18
+
19
+ ## Quick Start
20
+
21
+ ```bash
22
+ pip install hyphae[all]
23
+ hyphae
24
+ ```
25
+
26
+ This starts the server on `http://127.0.0.1:8100`. Facts are stored in `~/.hyphae/hyphae.db`.
27
+
28
+ ## API
29
+
30
+ ### Remember a fact
31
+ ```bash
32
+ curl -X POST http://127.0.0.1:8100/remember \
33
+ -H "Content-Type: application/json" \
34
+ -d '{"text": "Redis CONFIG SET can write to authorized_keys for SSH access", "source": "agent"}'
35
+ ```
36
+
37
+ ### Recall facts
38
+ ```bash
39
+ curl -X POST http://127.0.0.1:8100/recall \
40
+ -H "Content-Type: application/json" \
41
+ -d '{"query": "SSH key injection", "top_k": 5}'
42
+ ```
43
+
44
+ ### Scoped recall (project-specific)
45
+ ```bash
46
+ curl -X POST http://127.0.0.1:8100/recall \
47
+ -H "Content-Type: application/json" \
48
+ -d '{"query": "deployment config", "top_k": 5, "scope": {"project": "myapp"}}'
49
+ ```
50
+
51
+ ### Set session scope
52
+ ```bash
53
+ curl -X POST http://127.0.0.1:8100/session/set \
54
+ -H "Content-Type: application/json" \
55
+ -d '{"scope": {"project": "myapp"}}'
56
+ ```
57
+
58
+ ### Gap analysis
59
+ ```bash
60
+ curl -X POST http://127.0.0.1:8100/analyze \
61
+ -H "Content-Type: application/json" \
62
+ -d '{"observations": ["found open port 6379", "Redis no auth"], "objective": "get shell access"}'
63
+ ```
64
+
65
+ ### Health check
66
+ ```bash
67
+ curl http://127.0.0.1:8100/health
68
+ ```
69
+
70
+ ### Stats
71
+ ```bash
72
+ curl http://127.0.0.1:8100/stats
73
+ ```
74
+
75
+ ## Architecture
76
+
77
+ ```
78
+ Facts (text + embedding + tags)
79
+ -> Clusters (semantic grouping, adaptive merge/split)
80
+ -> Manifolds (diffusion maps per cluster, built in background)
81
+ -> Geodesic re-ranking (manifold distance blended with cosine)
82
+
83
+ Towers (structured knowledge buildings)
84
+ -> Floors (themed content synthesized from nearby facts)
85
+ -> Connections (typed links between towers)
86
+ ```
87
+
88
+ ### How manifold re-ranking works
89
+
90
+ When a cluster accumulates 30+ facts, Hyphae builds a diffusion map manifold over it:
91
+
92
+ 1. k-NN graph with locally-scaled Gaussian kernels
93
+ 2. Normalized graph Laplacian eigendecomposition
94
+ 3. 6-dimensional diffusion map embedding
95
+
96
+ At recall time, results from clusters with manifolds get re-ranked by blending cosine similarity (60%) with manifold proximity (40%). This finds facts that are *connected through chains* rather than just textually similar.
97
+
98
+ See the paper: [Geodesic Retrieval over Learned Manifolds](https://zenodo.org/records/18971939) (DOI: 10.5281/zenodo.18971939)
99
+
100
+ ## MCP Server (Claude Code integration)
101
+
102
+ Add to your Claude Code MCP config:
103
+
104
+ ```json
105
+ {
106
+ "mcpServers": {
107
+ "hyphae": {
108
+ "command": "python",
109
+ "args": ["-m", "hyphae.mcp_server"],
110
+ "env": {}
111
+ }
112
+ }
113
+ }
114
+ ```
115
+
116
+ This gives Claude Code tools: `recall_memory`, `remember_fact`, `recall_all_projects`, `memory_status`, `learn_topic`.
117
+
118
+ ## Configuration
119
+
120
+ Hyphae stores its database at `~/.hyphae/hyphae.db` by default. Override with:
121
+
122
+ ```python
123
+ from hyphae import Hyphae
124
+ h = Hyphae(db_path="/path/to/my.db")
125
+ ```
126
+
127
+ ### Embedding model
128
+
129
+ Default: `all-MiniLM-L6-v2` (384 dimensions, runs locally via sentence-transformers).
130
+
131
+ ```python
132
+ h = Hyphae(model="all-MiniLM-L6-v2")
133
+ ```
134
+
135
+ ### Remote shards
136
+
137
+ Connect to external knowledge stores (e.g., Memoria):
138
+
139
+ ```python
140
+ h = Hyphae(remote_shards=[
141
+ {"endpoint": "http://192.168.0.224:8000", "name": "memoria", "timeout": 15}
142
+ ])
143
+ ```
144
+
145
+ ## Python API
146
+
147
+ ```python
148
+ from hyphae import Hyphae
149
+
150
+ h = Hyphae()
151
+
152
+ # Remember
153
+ fact_id, cluster_id = h.remember("important discovery", tags={"project": "myapp"})
154
+
155
+ # Recall
156
+ facts = h.recall("what did I discover?", top_k=5)
157
+ for f in facts:
158
+ print(f"[{f.score:.2f}] {f.text}")
159
+
160
+ # Session scoping
161
+ h.set_session({"project": "myapp"}) # auto-scopes all recalls
162
+ facts = h.recall("deployment") # only returns myapp facts
163
+
164
+ # Gap analysis
165
+ analysis = h.analyze(
166
+ observations=["server returned 502", "nginx running"],
167
+ objective="fix the 502 error"
168
+ )
169
+
170
+ # Maintenance (runs automatically, or call manually)
171
+ report = h.maintain()
172
+
173
+ # Briefing
174
+ briefing = h.get_briefing("myapp")
175
+ print(briefing.text)
176
+ ```
177
+
178
+ ## Requirements
179
+
180
+ - Python 3.10+
181
+ - numpy, scipy, scikit-learn, sentence-transformers
182
+ - Optional: faiss-cpu (faster vector search), fastapi + uvicorn (HTTP server)
183
+
184
+ ## License
185
+
186
+ MIT
@@ -0,0 +1,56 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "hyphae-memory"
7
+ version = "0.1.0"
8
+ description = "Self-organizing memory with gap-aware retrieval. Add facts, query gaps, the network grows itself."
9
+ license = {text = "MIT"}
10
+ requires-python = ">=3.10"
11
+ authors = [
12
+ {name = "Ben Olenick"},
13
+ ]
14
+ keywords = [
15
+ "memory",
16
+ "retrieval",
17
+ "manifold",
18
+ "geodesic",
19
+ "diffusion-maps",
20
+ "clustering",
21
+ "knowledge-base",
22
+ "rag",
23
+ "gap-detection",
24
+ ]
25
+ classifiers = [
26
+ "Development Status :: 2 - Pre-Alpha",
27
+ "Intended Audience :: Developers",
28
+ "Intended Audience :: Science/Research",
29
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
30
+ "Topic :: Scientific/Engineering :: Information Analysis",
31
+ "Programming Language :: Python :: 3",
32
+ "Programming Language :: Python :: 3.10",
33
+ "Programming Language :: Python :: 3.11",
34
+ "Programming Language :: Python :: 3.12",
35
+ ]
36
+ dependencies = [
37
+ "numpy>=1.24",
38
+ "scipy>=1.10",
39
+ "scikit-learn>=1.2",
40
+ "sentence-transformers>=2.2",
41
+ ]
42
+
43
+ [project.optional-dependencies]
44
+ faiss = ["faiss-cpu>=1.7"]
45
+ server = ["fastapi>=0.100", "uvicorn>=0.20"]
46
+ all = ["faiss-cpu>=1.7", "fastapi>=0.100", "uvicorn>=0.20"]
47
+
48
+ [project.scripts]
49
+ hyphae = "hyphae.server:run"
50
+
51
+ [project.urls]
52
+ Homepage = "https://github.com/benolenick/hyphae"
53
+ Repository = "https://github.com/benolenick/hyphae"
54
+
55
+ [tool.setuptools.packages.find]
56
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+