hexus 0.9.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 (38) hide show
  1. hexus-0.9.0/LICENSE +29 -0
  2. hexus-0.9.0/PKG-INFO +167 -0
  3. hexus-0.9.0/README.md +126 -0
  4. hexus-0.9.0/hexus/__init__.py +1855 -0
  5. hexus-0.9.0/hexus/ccr/cache.py +34 -0
  6. hexus-0.9.0/hexus/embed.py +163 -0
  7. hexus-0.9.0/hexus/embedder.py +262 -0
  8. hexus-0.9.0/hexus/entity_extractor.py +60 -0
  9. hexus-0.9.0/hexus/migrations/001_schema.sql +112 -0
  10. hexus-0.9.0/hexus/migrations/002_observability.sql +37 -0
  11. hexus-0.9.0/hexus/migrations/003_entities.sql +10 -0
  12. hexus-0.9.0/hexus/migrations/004_enhancements.sql +13 -0
  13. hexus-0.9.0/hexus/pipeline/router.py +118 -0
  14. hexus-0.9.0/hexus/plugin.yaml +13 -0
  15. hexus-0.9.0/hexus/store.py +2349 -0
  16. hexus-0.9.0/hexus/webhook/dispatcher.py +114 -0
  17. hexus-0.9.0/hexus/writer.py +199 -0
  18. hexus-0.9.0/hexus.egg-info/PKG-INFO +167 -0
  19. hexus-0.9.0/hexus.egg-info/SOURCES.txt +36 -0
  20. hexus-0.9.0/hexus.egg-info/dependency_links.txt +1 -0
  21. hexus-0.9.0/hexus.egg-info/entry_points.txt +3 -0
  22. hexus-0.9.0/hexus.egg-info/requires.txt +12 -0
  23. hexus-0.9.0/hexus.egg-info/top_level.txt +2 -0
  24. hexus-0.9.0/mcp_server/__init__.py +22 -0
  25. hexus-0.9.0/mcp_server/cli.py +185 -0
  26. hexus-0.9.0/mcp_server/import_cli.py +318 -0
  27. hexus-0.9.0/mcp_server/server.py +1208 -0
  28. hexus-0.9.0/mcp_server/tools.py +979 -0
  29. hexus-0.9.0/pyproject.toml +96 -0
  30. hexus-0.9.0/setup.cfg +4 -0
  31. hexus-0.9.0/tests/test_conformance.py +66 -0
  32. hexus-0.9.0/tests/test_embedder.py +384 -0
  33. hexus-0.9.0/tests/test_import_cli.py +81 -0
  34. hexus-0.9.0/tests/test_mcp_server.py +1363 -0
  35. hexus-0.9.0/tests/test_migration.py +263 -0
  36. hexus-0.9.0/tests/test_quantization.py +110 -0
  37. hexus-0.9.0/tests/test_smoke.py +921 -0
  38. hexus-0.9.0/tests/test_webhooks.py +272 -0
hexus-0.9.0/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, Andrea Borghi
4
+ Copyright (c) 2026, Hexus Contributors
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
hexus-0.9.0/PKG-INFO ADDED
@@ -0,0 +1,167 @@
1
+ Metadata-Version: 2.4
2
+ Name: hexus
3
+ Version: 0.9.0
4
+ Summary: Hexus: Postgres + hexus memory provider plugin for hermes-agent AND a standalone MCP server. Local BERT (MiniLM-L6-v2) embeddings replace the upstream HTTP embedder; multi-agent storage with per-minion themes, async writer, no LLM in the memory hot path.
5
+ Author: Andrea Borghi
6
+ Author-email: Toby <codenamekt@gmail.com>
7
+ License: BSD-3-Clause
8
+ Project-URL: Homepage, https://github.com/codenamekt/hexus
9
+ Project-URL: Source, https://github.com/codenamekt/hexus
10
+ Project-URL: Upstream, https://github.com/andreab67/hermes-hexus
11
+ Project-URL: Issues, https://github.com/codenamekt/hexus/issues
12
+ Project-URL: Roadmap, https://github.com/codenamekt/hexus/blob/main/PLAN.md
13
+ Keywords: hermes-agent,memory-provider,hexus,postgres,multi-agent,llm-memory,semantic-search,bert,sentence-transformers,local-embeddings,mcp,model-context-protocol,hexus
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: System Administrators
17
+ Classifier: License :: OSI Approved :: BSD License
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Database
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Topic :: System :: Distributed Computing
26
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
27
+ Requires-Python: >=3.11
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ Requires-Dist: psycopg[binary]<4,>=3.3.4
31
+ Requires-Dist: psycopg-pool<4,>=3.3.1
32
+ Requires-Dist: PyYAML<7,>=6.0
33
+ Requires-Dist: sentence-transformers<4,>=2.7.0
34
+ Requires-Dist: numpy<3,>=1.24
35
+ Provides-Extra: test
36
+ Requires-Dist: pytest<9,>=7.4; extra == "test"
37
+ Requires-Dist: pytest-asyncio<2,>=0.23; extra == "test"
38
+ Provides-Extra: mcp
39
+ Requires-Dist: mcp[cli]<2,>=1.0; extra == "mcp"
40
+ Dynamic: license-file
41
+
42
+ # Hexus 🧠
43
+ [![Tests](https://github.com/codenamekt/hexus/actions/workflows/ci.yml/badge.svg)](https://github.com/codenamekt/hexus/actions/workflows/ci.yml) [![PyPI version](https://badge.fury.io/py/hexus.svg)](https://badge.fury.io/py/hexus)
44
+ ### Postgres-Powered Vector Memory for the Agentic Age
45
+
46
+ **Postgres + hexus memory substrate for [hermes-agent](https://github.com/NousResearch/hermes-agent) AND a standalone Model Context Protocol (MCP) server for any client (Claude Desktop, Cursor, fleet agents, etc.).**
47
+
48
+ ```mermaid
49
+ graph TD
50
+ classDef default fill:#1f2937,stroke:#374151,stroke-width:1px,color:#f3f4f6;
51
+ classDef highlight fill:#3b82f6,stroke:#1d4ed8,stroke-width:2px,color:#ffffff;
52
+ classDef db fill:#059669,stroke:#047857,stroke-width:2px,color:#ffffff;
53
+
54
+ subgraph Clients ["Integration Clients"]
55
+ Minions["Hermes Agent Minions<br/>(Header: X-Hermes-Session-Key)"]
56
+ Claude["Claude Desktop<br/>(stdio MCP)"]
57
+ Cursor["Cursor Editor<br/>(stdio MCP)"]
58
+ Custom["Custom Agents<br/>(HTTP MCP)"]
59
+ end
60
+
61
+ subgraph Hexus ["Hexus (Single Process, Shared Embedder)"]
62
+ Plugin["Hermes Plugin<br/>(hexus/__init__.py)"]
63
+ Server["MCP Server<br/>(mcp_server)"]
64
+ Embedder["LocalBertEmbedder<br/>(MiniLM-L6-v2)"]:::highlight
65
+ Store["MemoryStore<br/>(psycopg pool)"]
66
+ end
67
+
68
+ DB[("PostgreSQL 16 + pgvector<br/>(memory_entries & conversations)")]:::db
69
+
70
+ %% Connections
71
+ Minions -->|X-Hermes-Session-Key| Plugin
72
+ Claude -->|stdio| Server
73
+ Cursor -->|stdio| Server
74
+ Custom -->|HTTP| Server
75
+
76
+ Plugin --> Embedder
77
+ Server --> Embedder
78
+ Plugin --> Store
79
+ Server --> Store
80
+
81
+ Store --> DB
82
+ ```
83
+
84
+ ---
85
+
86
+ ## 🚨 The "Memory Crisis" (And Why Hexus Rocks 🎸)
87
+
88
+ If you've ever tried running a team of cooperating agents, you've probably hit one of these roadblocks. Here's why Hexus exists and how it changes the game:
89
+
90
+ * **The Stomping Minions 🐘**: Say goodbye to local markdown files that get overwritten when you run multiple agents. Hexus gives every minion a clean, scoped memory space ("themes"). Your marketing agent's notes won't contaminate your trading agent's data!
91
+ * **Pure Vector Speed (No LLM in the Hot Path!) ⚑**: Embedding search should be pure vector math! We use a purely local BERT model. Zero cloud calls, zero LLMs in the hot path, absolute privacy, and *way* faster performance.
92
+ * **Ditch the Cloud Monoliths ☁️**: Other memory providers require paid cloud services and route every read/write through an LLM. Not us. Hexus uses your existing Postgres + `pgvector`. Keep it simple, keep it fast!
93
+ * **Storage Layer AND Memory Model πŸ“¦**: Hexus acts as a rock-solid storage backbone *and* an intelligent memory model for a fleet of cooperating agents, keeping everything centralized, searchable, and clean.
94
+ * **Standalone Plugin Power 🧩**: Why a standalone plugin? So you can just drop it in and go! No waiting for upstream PRs in the main repositories.
95
+
96
+ ## πŸŒͺ️ Getting Started (Installation is a breeze!)
97
+
98
+ Ready to try it out? You can get up and running in a snap.
99
+
100
+ ### Option 1: Hermes Plugin (via pip)
101
+ If you're integrating directly into a Hermes agent, you can grab it from pip:
102
+
103
+ ```bash
104
+ pip install hexus
105
+ ```
106
+ *Note: Once installed, just point Hermes to it! You can also just drop the `hexus` module files straight into your `~/.hermes/plugins/hexus/` directory. Hermes's discovery system will automatically pick it up and initialize it on startup!*
107
+
108
+ ### Option 2: Docker & MCP Server (Claude, Cursor, etc.)
109
+ The easiest way to run the standalone MCP server is via Docker (GHCR).
110
+
111
+ > **Note:** The Docker MCP server requires a running PostgreSQL database with `pgvector` enabled. You can reference or use our provided `docker/compose.yml` file as a quick example to spin one up!
112
+
113
+ ```bash
114
+ # Run the MCP server via HTTP streamable transport on port 8000
115
+ docker run -d --name hexus -p 8000:8000 ghcr.io/codenamekt/hexus:latest
116
+ ```
117
+
118
+ **Using it with Claude Code / Claude Desktop:**
119
+ If you want to plug Hexus straight into your Claude `claude_desktop_config.json` via standard `stdio`, you can add this block to seamlessly run the Docker image in the background:
120
+
121
+ ```jsonc
122
+ {
123
+ "mcpServers": {
124
+ "hexus": {
125
+ "command": "docker",
126
+ "args": [
127
+ "run",
128
+ "-i",
129
+ "--rm",
130
+ "-e",
131
+ "HEXUS_DSN=dbname=hermes_memory user=postgres host=host.docker.internal",
132
+ "ghcr.io/codenamekt/hexus:latest",
133
+ "hexus-mcp",
134
+ "serve",
135
+ "--transport",
136
+ "stdio"
137
+ ]
138
+ }
139
+ }
140
+ }
141
+ ```
142
+
143
+ ## 🏎️ Look at This! Ridiculously Fast Benchmarks
144
+ We believe in speed. Check out these actual benchmarks running on a basic CPU (no GPU needed!):
145
+
146
+ * **Single Embed Latency**: `7.4 ms`
147
+ * **Batch Embed Throughput**: `1,486 items/sec` (batch size 32)
148
+ * **Recall Latency (Top 5)**: `2.0 ms`
149
+
150
+ Wanna run these yourself? Check out the full [BENCHMARK.md](docs/BENCHMARK.md) to see how!
151
+
152
+ ## ✨ Wait... There's More! (Features)
153
+
154
+ * **Two Integration Paths, One Shared Store**: Use it as a Hermes plugin, OR run it as a standalone Model Context Protocol (MCP) server for Claude Desktop, Cursor, and custom agents.
155
+ * **Built-in Power-Ups**: Hybrid search (BM25 + vector), temporal decay, TTL/memory forgetfulness, entity tagging, and conversation summaries.
156
+ * **Potato-Friendly**: Runs entirely local on a CPU (e.g. an old Intel NUC or mini PC).
157
+
158
+ ## πŸ•³οΈ Digging Deeper
159
+
160
+ Looking for the nitty-gritty details? We moved the heavy technical stuff into their own docs so you can get straight to the code:
161
+
162
+ * πŸ“– [Technical Details & Configuration](docs/TECHNICAL_DETAILS.md) - Admin DB commands, schemas, hooks, and MCP configuration.
163
+ * πŸ—ΊοΈ [Roadmap](docs/ROADMAP.md) - See where we've been and what wild features are coming next.
164
+ * πŸ”™ [Rollback Guide](docs/ROLLBACK.md) - In case you change your mind (but you won't!).
165
+
166
+ ---
167
+ *License: [BSD 3-Clause](LICENSE)*
hexus-0.9.0/README.md ADDED
@@ -0,0 +1,126 @@
1
+ # Hexus 🧠
2
+ [![Tests](https://github.com/codenamekt/hexus/actions/workflows/ci.yml/badge.svg)](https://github.com/codenamekt/hexus/actions/workflows/ci.yml) [![PyPI version](https://badge.fury.io/py/hexus.svg)](https://badge.fury.io/py/hexus)
3
+ ### Postgres-Powered Vector Memory for the Agentic Age
4
+
5
+ **Postgres + hexus memory substrate for [hermes-agent](https://github.com/NousResearch/hermes-agent) AND a standalone Model Context Protocol (MCP) server for any client (Claude Desktop, Cursor, fleet agents, etc.).**
6
+
7
+ ```mermaid
8
+ graph TD
9
+ classDef default fill:#1f2937,stroke:#374151,stroke-width:1px,color:#f3f4f6;
10
+ classDef highlight fill:#3b82f6,stroke:#1d4ed8,stroke-width:2px,color:#ffffff;
11
+ classDef db fill:#059669,stroke:#047857,stroke-width:2px,color:#ffffff;
12
+
13
+ subgraph Clients ["Integration Clients"]
14
+ Minions["Hermes Agent Minions<br/>(Header: X-Hermes-Session-Key)"]
15
+ Claude["Claude Desktop<br/>(stdio MCP)"]
16
+ Cursor["Cursor Editor<br/>(stdio MCP)"]
17
+ Custom["Custom Agents<br/>(HTTP MCP)"]
18
+ end
19
+
20
+ subgraph Hexus ["Hexus (Single Process, Shared Embedder)"]
21
+ Plugin["Hermes Plugin<br/>(hexus/__init__.py)"]
22
+ Server["MCP Server<br/>(mcp_server)"]
23
+ Embedder["LocalBertEmbedder<br/>(MiniLM-L6-v2)"]:::highlight
24
+ Store["MemoryStore<br/>(psycopg pool)"]
25
+ end
26
+
27
+ DB[("PostgreSQL 16 + pgvector<br/>(memory_entries & conversations)")]:::db
28
+
29
+ %% Connections
30
+ Minions -->|X-Hermes-Session-Key| Plugin
31
+ Claude -->|stdio| Server
32
+ Cursor -->|stdio| Server
33
+ Custom -->|HTTP| Server
34
+
35
+ Plugin --> Embedder
36
+ Server --> Embedder
37
+ Plugin --> Store
38
+ Server --> Store
39
+
40
+ Store --> DB
41
+ ```
42
+
43
+ ---
44
+
45
+ ## 🚨 The "Memory Crisis" (And Why Hexus Rocks 🎸)
46
+
47
+ If you've ever tried running a team of cooperating agents, you've probably hit one of these roadblocks. Here's why Hexus exists and how it changes the game:
48
+
49
+ * **The Stomping Minions 🐘**: Say goodbye to local markdown files that get overwritten when you run multiple agents. Hexus gives every minion a clean, scoped memory space ("themes"). Your marketing agent's notes won't contaminate your trading agent's data!
50
+ * **Pure Vector Speed (No LLM in the Hot Path!) ⚑**: Embedding search should be pure vector math! We use a purely local BERT model. Zero cloud calls, zero LLMs in the hot path, absolute privacy, and *way* faster performance.
51
+ * **Ditch the Cloud Monoliths ☁️**: Other memory providers require paid cloud services and route every read/write through an LLM. Not us. Hexus uses your existing Postgres + `pgvector`. Keep it simple, keep it fast!
52
+ * **Storage Layer AND Memory Model πŸ“¦**: Hexus acts as a rock-solid storage backbone *and* an intelligent memory model for a fleet of cooperating agents, keeping everything centralized, searchable, and clean.
53
+ * **Standalone Plugin Power 🧩**: Why a standalone plugin? So you can just drop it in and go! No waiting for upstream PRs in the main repositories.
54
+
55
+ ## πŸŒͺ️ Getting Started (Installation is a breeze!)
56
+
57
+ Ready to try it out? You can get up and running in a snap.
58
+
59
+ ### Option 1: Hermes Plugin (via pip)
60
+ If you're integrating directly into a Hermes agent, you can grab it from pip:
61
+
62
+ ```bash
63
+ pip install hexus
64
+ ```
65
+ *Note: Once installed, just point Hermes to it! You can also just drop the `hexus` module files straight into your `~/.hermes/plugins/hexus/` directory. Hermes's discovery system will automatically pick it up and initialize it on startup!*
66
+
67
+ ### Option 2: Docker & MCP Server (Claude, Cursor, etc.)
68
+ The easiest way to run the standalone MCP server is via Docker (GHCR).
69
+
70
+ > **Note:** The Docker MCP server requires a running PostgreSQL database with `pgvector` enabled. You can reference or use our provided `docker/compose.yml` file as a quick example to spin one up!
71
+
72
+ ```bash
73
+ # Run the MCP server via HTTP streamable transport on port 8000
74
+ docker run -d --name hexus -p 8000:8000 ghcr.io/codenamekt/hexus:latest
75
+ ```
76
+
77
+ **Using it with Claude Code / Claude Desktop:**
78
+ If you want to plug Hexus straight into your Claude `claude_desktop_config.json` via standard `stdio`, you can add this block to seamlessly run the Docker image in the background:
79
+
80
+ ```jsonc
81
+ {
82
+ "mcpServers": {
83
+ "hexus": {
84
+ "command": "docker",
85
+ "args": [
86
+ "run",
87
+ "-i",
88
+ "--rm",
89
+ "-e",
90
+ "HEXUS_DSN=dbname=hermes_memory user=postgres host=host.docker.internal",
91
+ "ghcr.io/codenamekt/hexus:latest",
92
+ "hexus-mcp",
93
+ "serve",
94
+ "--transport",
95
+ "stdio"
96
+ ]
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
102
+ ## 🏎️ Look at This! Ridiculously Fast Benchmarks
103
+ We believe in speed. Check out these actual benchmarks running on a basic CPU (no GPU needed!):
104
+
105
+ * **Single Embed Latency**: `7.4 ms`
106
+ * **Batch Embed Throughput**: `1,486 items/sec` (batch size 32)
107
+ * **Recall Latency (Top 5)**: `2.0 ms`
108
+
109
+ Wanna run these yourself? Check out the full [BENCHMARK.md](docs/BENCHMARK.md) to see how!
110
+
111
+ ## ✨ Wait... There's More! (Features)
112
+
113
+ * **Two Integration Paths, One Shared Store**: Use it as a Hermes plugin, OR run it as a standalone Model Context Protocol (MCP) server for Claude Desktop, Cursor, and custom agents.
114
+ * **Built-in Power-Ups**: Hybrid search (BM25 + vector), temporal decay, TTL/memory forgetfulness, entity tagging, and conversation summaries.
115
+ * **Potato-Friendly**: Runs entirely local on a CPU (e.g. an old Intel NUC or mini PC).
116
+
117
+ ## πŸ•³οΈ Digging Deeper
118
+
119
+ Looking for the nitty-gritty details? We moved the heavy technical stuff into their own docs so you can get straight to the code:
120
+
121
+ * πŸ“– [Technical Details & Configuration](docs/TECHNICAL_DETAILS.md) - Admin DB commands, schemas, hooks, and MCP configuration.
122
+ * πŸ—ΊοΈ [Roadmap](docs/ROADMAP.md) - See where we've been and what wild features are coming next.
123
+ * πŸ”™ [Rollback Guide](docs/ROLLBACK.md) - In case you change your mind (but you won't!).
124
+
125
+ ---
126
+ *License: [BSD 3-Clause](LICENSE)*