flockmem 0.2.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.
- flockmem-0.2.0/LICENSE +21 -0
- flockmem-0.2.0/PKG-INFO +350 -0
- flockmem-0.2.0/README.md +328 -0
- flockmem-0.2.0/pyproject.toml +48 -0
- flockmem-0.2.0/setup.cfg +4 -0
- flockmem-0.2.0/src/flockmem/__init__.py +5 -0
- flockmem-0.2.0/src/flockmem/__main__.py +7 -0
- flockmem-0.2.0/src/flockmem/api/redaction.py +58 -0
- flockmem-0.2.0/src/flockmem/api/routes/chat.py +363 -0
- flockmem-0.2.0/src/flockmem/api/routes/config_raw.py +78 -0
- flockmem-0.2.0/src/flockmem/api/routes/conversation_meta.py +30 -0
- flockmem-0.2.0/src/flockmem/api/routes/graph.py +58 -0
- flockmem-0.2.0/src/flockmem/api/routes/health.py +10 -0
- flockmem-0.2.0/src/flockmem/api/routes/ingest.py +239 -0
- flockmem-0.2.0/src/flockmem/api/routes/memory.py +492 -0
- flockmem-0.2.0/src/flockmem/api/routes/model_config.py +196 -0
- flockmem-0.2.0/src/flockmem/api/routes/policy.py +63 -0
- flockmem-0.2.0/src/flockmem/api/routes/status.py +19 -0
- flockmem-0.2.0/src/flockmem/api/routes/ui.py +34 -0
- flockmem-0.2.0/src/flockmem/api/security.py +50 -0
- flockmem-0.2.0/src/flockmem/bootstrap/app_factory.py +239 -0
- flockmem-0.2.0/src/flockmem/cli.py +83 -0
- flockmem-0.2.0/src/flockmem/config/config_json.py +464 -0
- flockmem-0.2.0/src/flockmem/config/openclaw_primary_sync.py +464 -0
- flockmem-0.2.0/src/flockmem/config/profiles.py +91 -0
- flockmem-0.2.0/src/flockmem/config/settings.py +395 -0
- flockmem-0.2.0/src/flockmem/domain/policy.py +63 -0
- flockmem-0.2.0/src/flockmem/domain/retrieval/__init__.py +41 -0
- flockmem-0.2.0/src/flockmem/domain/retrieval/fusion.py +40 -0
- flockmem-0.2.0/src/flockmem/infra/graph/kuzu_store.py +327 -0
- flockmem-0.2.0/src/flockmem/infra/runtime_policy/__init__.py +1 -0
- flockmem-0.2.0/src/flockmem/infra/runtime_policy/repository.py +57 -0
- flockmem-0.2.0/src/flockmem/infra/sqlite/app_config_repository.py +41 -0
- flockmem-0.2.0/src/flockmem/infra/sqlite/conversation_meta_repository.py +64 -0
- flockmem-0.2.0/src/flockmem/infra/sqlite/db.py +43 -0
- flockmem-0.2.0/src/flockmem/infra/sqlite/init_schema.py +522 -0
- flockmem-0.2.0/src/flockmem/infra/sqlite/memory_repository.py +1964 -0
- flockmem-0.2.0/src/flockmem/infra/sqlite/request_status_repository.py +79 -0
- flockmem-0.2.0/src/flockmem/infra/vector/lancedb_store.py +592 -0
- flockmem-0.2.0/src/flockmem/service/chat_model_rerank.py +137 -0
- flockmem-0.2.0/src/flockmem/service/chat_responder.py +226 -0
- flockmem-0.2.0/src/flockmem/service/embedding_factory.py +37 -0
- flockmem-0.2.0/src/flockmem/service/event_log_extractor.py +74 -0
- flockmem-0.2.0/src/flockmem/service/extractor.py +519 -0
- flockmem-0.2.0/src/flockmem/service/extractor_factory.py +91 -0
- flockmem-0.2.0/src/flockmem/service/foresight_extractor.py +251 -0
- flockmem-0.2.0/src/flockmem/service/formation_enhancer.py +246 -0
- flockmem-0.2.0/src/flockmem/service/graph_extractor.py +90 -0
- flockmem-0.2.0/src/flockmem/service/http_auth.py +34 -0
- flockmem-0.2.0/src/flockmem/service/local_embedding.py +65 -0
- flockmem-0.2.0/src/flockmem/service/local_rerank.py +61 -0
- flockmem-0.2.0/src/flockmem/service/memcell_extractor.py +98 -0
- flockmem-0.2.0/src/flockmem/service/memory_service.py +4125 -0
- flockmem-0.2.0/src/flockmem/service/openai_embedding.py +68 -0
- flockmem-0.2.0/src/flockmem/service/openai_rerank.py +95 -0
- flockmem-0.2.0/src/flockmem/service/policy_resolver.py +50 -0
- flockmem-0.2.0/src/flockmem/service/query_rewriter.py +307 -0
- flockmem-0.2.0/src/flockmem/service/rerank_factory.py +44 -0
- flockmem-0.2.0/src/flockmem/service/retrieval_mode_selector.py +190 -0
- flockmem-0.2.0/src/flockmem/service/retrieval_verifier.py +173 -0
- flockmem-0.2.0/src/flockmem/service/semantic_consolidator.py +578 -0
- flockmem-0.2.0/src/flockmem/testing/__init__.py +2 -0
- flockmem-0.2.0/src/flockmem/testing/writable_tempdir.py +29 -0
- flockmem-0.2.0/src/flockmem/ui/index.html +3250 -0
- flockmem-0.2.0/src/flockmem.egg-info/PKG-INFO +350 -0
- flockmem-0.2.0/src/flockmem.egg-info/SOURCES.txt +109 -0
- flockmem-0.2.0/src/flockmem.egg-info/dependency_links.txt +1 -0
- flockmem-0.2.0/src/flockmem.egg-info/entry_points.txt +3 -0
- flockmem-0.2.0/src/flockmem.egg-info/requires.txt +10 -0
- flockmem-0.2.0/src/flockmem.egg-info/top_level.txt +1 -0
- flockmem-0.2.0/tests/test_agentic_verifier.py +235 -0
- flockmem-0.2.0/tests/test_chat_model_rerank_provider.py +42 -0
- flockmem-0.2.0/tests/test_chat_responder.py +106 -0
- flockmem-0.2.0/tests/test_config_json_repository.py +273 -0
- flockmem-0.2.0/tests/test_config_raw_route.py +145 -0
- flockmem-0.2.0/tests/test_embedding_factory.py +104 -0
- flockmem-0.2.0/tests/test_event_log_retrieval_channels.py +176 -0
- flockmem-0.2.0/tests/test_event_log_vector_wiring.py +41 -0
- flockmem-0.2.0/tests/test_flockmem_mcp_server.py +265 -0
- flockmem-0.2.0/tests/test_foresight_interval.py +128 -0
- flockmem-0.2.0/tests/test_graph_recall_gate.py +330 -0
- flockmem-0.2.0/tests/test_graph_store.py +111 -0
- flockmem-0.2.0/tests/test_http_auth.py +33 -0
- flockmem-0.2.0/tests/test_ingest_skill_adapter_schema.py +116 -0
- flockmem-0.2.0/tests/test_keyword_search_repository.py +569 -0
- flockmem-0.2.0/tests/test_lancedb_store.py +211 -0
- flockmem-0.2.0/tests/test_memcell_eventlog_pipeline.py +198 -0
- flockmem-0.2.0/tests/test_memory_category_assignment.py +152 -0
- flockmem-0.2.0/tests/test_memory_route_payload.py +46 -0
- flockmem-0.2.0/tests/test_memory_route_policy.py +30 -0
- flockmem-0.2.0/tests/test_memory_service_alignment_guards.py +140 -0
- flockmem-0.2.0/tests/test_memory_service_memorize_encoding.py +124 -0
- flockmem-0.2.0/tests/test_memory_service_semantic_latency.py +565 -0
- flockmem-0.2.0/tests/test_minimal_integration.py +121 -0
- flockmem-0.2.0/tests/test_model_config_route.py +128 -0
- flockmem-0.2.0/tests/test_openai_embedding_provider.py +40 -0
- flockmem-0.2.0/tests/test_openai_rerank_provider.py +55 -0
- flockmem-0.2.0/tests/test_openclaw_primary_sync.py +375 -0
- flockmem-0.2.0/tests/test_phase1_formation.py +222 -0
- flockmem-0.2.0/tests/test_phase4_reasoning.py +337 -0
- flockmem-0.2.0/tests/test_rerank_factory.py +107 -0
- flockmem-0.2.0/tests/test_retrieval_extract_chain.py +135 -0
- flockmem-0.2.0/tests/test_retrieval_fusion_optimizations.py +170 -0
- flockmem-0.2.0/tests/test_retrieval_mode_selector.py +48 -0
- flockmem-0.2.0/tests/test_run_locomo_eval_consistency.py +51 -0
- flockmem-0.2.0/tests/test_semantic_consolidator_profile_evolution.py +182 -0
- flockmem-0.2.0/tests/test_semantic_consolidator_scene_integration.py +116 -0
- flockmem-0.2.0/tests/test_settings_paths.py +91 -0
- flockmem-0.2.0/tests/test_settings_recall_defaults.py +67 -0
- flockmem-0.2.0/tests/test_temporal_constraints.py +194 -0
- flockmem-0.2.0/tests/test_temporal_end_to_end_impact.py +169 -0
flockmem-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 FlockMem contributors
|
|
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.
|
flockmem-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flockmem
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Lightweight long-term memory system for local/edge AI agents
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/gengxy1216/FlockMem
|
|
7
|
+
Project-URL: Repository, https://github.com/gengxy1216/FlockMem
|
|
8
|
+
Project-URL: Issues, https://github.com/gengxy1216/FlockMem/issues
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: fastapi>=0.115.0
|
|
13
|
+
Requires-Dist: uvicorn>=0.30.0
|
|
14
|
+
Requires-Dist: pydantic>=2.8.0
|
|
15
|
+
Requires-Dist: anyio>=4.0.0
|
|
16
|
+
Requires-Dist: lancedb>=0.29.0
|
|
17
|
+
Provides-Extra: test
|
|
18
|
+
Requires-Dist: pytest>=8.0.0; extra == "test"
|
|
19
|
+
Requires-Dist: httpx>=0.27.0; extra == "test"
|
|
20
|
+
Requires-Dist: fastmcp>=2.0.0; extra == "test"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# <img src="docs/assets/flockmem-icon.svg" alt="FlockMem logo" width="52" /> FlockMem
|
|
24
|
+
|
|
25
|
+
> Lightweight local-first memory system for AI agents ✨
|
|
26
|
+
|
|
27
|
+
[](LICENSE)
|
|
28
|
+
[](pyproject.toml)
|
|
29
|
+
[](https://zread.ai/gengxy1216/FlockMem)
|
|
30
|
+
|
|
31
|
+
<p align="center">
|
|
32
|
+
<img src="docs/assets/flockmem-banner.svg" alt="FlockMem banner" />
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
English | [简体中文](README.zh-CN.md)
|
|
36
|
+
|
|
37
|
+
FlockMem is a lightweight, local-first long-term memory system designed for AI agents. It is also built as a memory infrastructure layer for multi-agent collaboration. With edge deployment in mind, it runs with a minimal memory footprint under 50MB, making it suitable for resource-constrained environments 🖥️
|
|
38
|
+
|
|
39
|
+
## Why FlockMem? 💡
|
|
40
|
+
|
|
41
|
+
- 🧱 **Multi-Agent Memory Infrastructure** - One shared memory substrate across agents, runtimes, and workflows
|
|
42
|
+
- 🔄 **Local-first** - No cloud dependencies, runs entirely on your device
|
|
43
|
+
- 🔍 **Hybrid Retrieval** - Text + Vector + Graph search with citation traces
|
|
44
|
+
- 🧠 **Structured + Episodic Memory** - Entities, relationships, and conversation memories in one system
|
|
45
|
+
- ⚡ **Lightweight** - Under 50MB memory usage, suitable for edge devices
|
|
46
|
+
- 🔌 **Integration-ready** - REST API + MCP bridge + OpenClaw plugin
|
|
47
|
+
- 🚀 **One-click Install** - Get started in seconds
|
|
48
|
+
|
|
49
|
+
## Key Positioning: Memory Infrastructure for Multi-Agent Collaboration
|
|
50
|
+
|
|
51
|
+
FlockMem is not just a memory store for a single assistant. It provides:
|
|
52
|
+
|
|
53
|
+
- Shared memory infrastructure for multiple agents via REST, MCP, and plugin bridges
|
|
54
|
+
- Controlled collaboration boundaries with role-based, shared-group, and per-user memory strategies
|
|
55
|
+
- Retrieval traces and citations for auditability and easier debugging
|
|
56
|
+
- Local-first deployment with predictable cost, data ownership, and operational simplicity
|
|
57
|
+
|
|
58
|
+
## Quick Start ⚡
|
|
59
|
+
|
|
60
|
+
### One-click Install
|
|
61
|
+
|
|
62
|
+
`pip`:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pip install flockmem
|
|
66
|
+
flockmem
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`npm`:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npm install openclaw-flockmem
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`openclaw plugin`:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
openclaw plugins install openclaw-flockmem
|
|
79
|
+
openclaw plugins enable flockmem-memory
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Local install (kept):
|
|
83
|
+
|
|
84
|
+
| Platform | Command |
|
|
85
|
+
|----------|---------|
|
|
86
|
+
| 🪟 **Windows** | `powershell -ExecutionPolicy Bypass -File scripts/install.ps1 -RunAfterInstall` |
|
|
87
|
+
| 🐧 **Linux** | `bash scripts/install.sh --run` |
|
|
88
|
+
| 🍎 **macOS** | `bash scripts/install.sh --run` |
|
|
89
|
+
|
|
90
|
+
Or use the launcher:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Windows
|
|
94
|
+
start_flockmem.bat
|
|
95
|
+
|
|
96
|
+
# Linux/macOS
|
|
97
|
+
bash scripts/start.sh
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Manual Install
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pip install -e .
|
|
104
|
+
flockmem
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Access the UI 🌐
|
|
108
|
+
|
|
109
|
+
Open your browser:
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
http://127.0.0.1:20195/ui
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
> 🔐 **Default Credentials**: `admin` / `admin123`
|
|
116
|
+
|
|
117
|
+
## Features 🎯
|
|
118
|
+
|
|
119
|
+
| Feature | Description |
|
|
120
|
+
|---------|-------------|
|
|
121
|
+
| 📝 **Memory Storage** | Store and manage conversation memories |
|
|
122
|
+
| 🔎 **Semantic Search** | Find relevant memories using vector similarity |
|
|
123
|
+
| 🕸️ **Graph Search** | Explore entity relationships in knowledge graph |
|
|
124
|
+
| 💬 **Chat with Memory** | Context-aware conversations with retrieval traces |
|
|
125
|
+
| ⚙️ **Runtime Config** | Change providers and settings on-the-fly |
|
|
126
|
+
|
|
127
|
+
## API Overview 📡
|
|
128
|
+
|
|
129
|
+
> For complete API documentation, see [API Reference](docs/api-reference.md)
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Health check
|
|
133
|
+
GET /health
|
|
134
|
+
|
|
135
|
+
# Store memory
|
|
136
|
+
POST /api/v1/memories
|
|
137
|
+
|
|
138
|
+
# Search memories
|
|
139
|
+
GET /api/v1/memories/search
|
|
140
|
+
|
|
141
|
+
# Chat with context
|
|
142
|
+
POST /api/v1/chat/simple
|
|
143
|
+
|
|
144
|
+
# Graph queries
|
|
145
|
+
GET /api/v1/graph/search
|
|
146
|
+
GET /api/v1/graph/neighbors
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## MCP Integration 🔌
|
|
150
|
+
|
|
151
|
+
FlockMem now includes a standalone MCP bridge server for cross-agent integration:
|
|
152
|
+
|
|
153
|
+
- Server path: `integrations/flockmem-mcp/server.py`
|
|
154
|
+
- Skill path: `skills/flockmem-mcp-integration`
|
|
155
|
+
|
|
156
|
+
Run the MCP bridge:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
python skills/flockmem-mcp-integration/scripts/run_flockmem_mcp.py
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Generate a client config snippet:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
python skills/flockmem-mcp-integration/scripts/generate_mcp_config.py
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Run MCP integration test:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
pytest -q tests/test_flockmem_mcp_server.py
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Package the MCP skill as a distributable artifact:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
python C:/Users/user/.agents/skills/skill-creator/scripts/package_skill.py skills/flockmem-mcp-integration dist
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Packaged artifact:
|
|
181
|
+
|
|
182
|
+
- `dist/flockmem-mcp-integration.skill`
|
|
183
|
+
|
|
184
|
+
Environment variables (optional):
|
|
185
|
+
|
|
186
|
+
- `MINIMEM_BASE_URL` (default: `http://127.0.0.1:20195`)
|
|
187
|
+
- `MINIMEM_USER_ID`
|
|
188
|
+
- `MINIMEM_GROUP_ID`
|
|
189
|
+
- `MINIMEM_BEARER_TOKEN` or `MINIMEM_BASIC_USER` + `MINIMEM_BASIC_PASSWORD`
|
|
190
|
+
|
|
191
|
+
## OpenClaw Plugin Integration
|
|
192
|
+
|
|
193
|
+
FlockMem also provides a lightweight OpenClaw plugin bridge:
|
|
194
|
+
|
|
195
|
+
- Plugin path: `integrations/openclaw-plugin`
|
|
196
|
+
- Plugin manifest: `integrations/openclaw-plugin/openclaw.plugin.json`
|
|
197
|
+
- Plugin doc: `integrations/openclaw-plugin/README.md`
|
|
198
|
+
- Policy template: `integrations/openclaw-plugin/examples/AGENTS.memory-policy.md`
|
|
199
|
+
|
|
200
|
+
Core capabilities:
|
|
201
|
+
|
|
202
|
+
- write dialogue / bot profile / context compression into FlockMem
|
|
203
|
+
- retrieve memory by strategy (`keyword`/`vector`/`hybrid`/`rrf`/`agentic`)
|
|
204
|
+
- return `context_for_agent` for prompt injection
|
|
205
|
+
- optional auto capture (`agent_end`) and auto inject (`before_agent_start`)
|
|
206
|
+
- role-based / shared / per-user group strategies
|
|
207
|
+
|
|
208
|
+
One-command install:
|
|
209
|
+
|
|
210
|
+
```powershell
|
|
211
|
+
powershell -ExecutionPolicy Bypass -File integrations/openclaw-plugin/install.ps1
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
bash integrations/openclaw-plugin/install.sh
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Or install distributed plugin package:
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
openclaw plugins install openclaw-flockmem
|
|
222
|
+
openclaw plugins enable flockmem-memory
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Advanced entry example:
|
|
226
|
+
|
|
227
|
+
```json
|
|
228
|
+
{
|
|
229
|
+
"path": "C:/path/to/flockmem/integrations/openclaw-plugin",
|
|
230
|
+
"enabled": true,
|
|
231
|
+
"config": {
|
|
232
|
+
"baseUrl": "http://127.0.0.1:20195",
|
|
233
|
+
"groupStrategy": "per_role",
|
|
234
|
+
"sharedGroupId": "shared:team",
|
|
235
|
+
"autoSenderFromAgent": true,
|
|
236
|
+
"autoInjectOnStart": true,
|
|
237
|
+
"autoCaptureOnEnd": true
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Architecture 🏗️
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
┌─────────────────────────────────────┐
|
|
246
|
+
│ FlockMem UI │
|
|
247
|
+
├─────────────────────────────────────┤
|
|
248
|
+
│ REST API │
|
|
249
|
+
├──────────────┬──────────────────────┤
|
|
250
|
+
│ Retrieval │ Extraction │
|
|
251
|
+
│ (Fusion) │ (Atomic Facts) │
|
|
252
|
+
├──────────────┼──────────────────────┤
|
|
253
|
+
│ Vector DB │ Graph Store │
|
|
254
|
+
│ (LanceDB) │ (Local Persistent) │
|
|
255
|
+
├──────────────┴──────────────────────┤
|
|
256
|
+
│ SQLite (Metadata) │
|
|
257
|
+
└─────────────────────────────────────┘
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Memory Tiering (L0 -> L2)
|
|
261
|
+
|
|
262
|
+
FlockMem uses progressive memory tiers to balance simplicity, recall quality, and retrieval performance:
|
|
263
|
+
|
|
264
|
+
| Tier | Name | Core Storage | Retrieval Role |
|
|
265
|
+
|------|------|--------------|----------------|
|
|
266
|
+
| `L0` | Plain Text | SQLite (`episodic_memory`) | Full-fidelity source of truth, keyword/metadata recall |
|
|
267
|
+
| `L0.5` | Vector-Text (Hot) | Local vector cache (`jsonl` + snapshot) | Fast local semantic recall and restart-safe warm cache |
|
|
268
|
+
| `L1` | Vector (Persistent) | LanceDB (`memory_vector_index`) | ANN-style semantic retrieval for higher-importance memories |
|
|
269
|
+
| `L2` | Graph | Local graph triples store | Structured relation recall and graph expansion |
|
|
270
|
+
|
|
271
|
+
### Retrieval Flow
|
|
272
|
+
|
|
273
|
+
1. Query enters policy/selector layer.
|
|
274
|
+
2. Keyword + vector recall run in hybrid mode (`L0` + `L0.5` + `L1`).
|
|
275
|
+
3. Graph evidence from `L2` is merged when enabled.
|
|
276
|
+
4. Final hits are reranked and rendered with query-aware citation snippets.
|
|
277
|
+
|
|
278
|
+
## Configuration ⚙️
|
|
279
|
+
|
|
280
|
+
Set environment variables to configure providers:
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
# Chat provider
|
|
284
|
+
LITE_CHAT_PROVIDER=openai
|
|
285
|
+
LITE_CHAT_MODEL=gpt-4o-mini
|
|
286
|
+
|
|
287
|
+
# Embedding provider
|
|
288
|
+
LITE_EMBEDDING_PROVIDER=openai
|
|
289
|
+
LITE_EMBEDDING_MODEL=text-embedding-3-small
|
|
290
|
+
|
|
291
|
+
# Graph module (optional)
|
|
292
|
+
LITE_GRAPH_ENABLED=true
|
|
293
|
+
|
|
294
|
+
# Retrieval profile
|
|
295
|
+
LITE_RETRIEVAL_PROFILE=agentic
|
|
296
|
+
|
|
297
|
+
# Hybrid vector persistence (partial to LanceDB)
|
|
298
|
+
LITE_VECTOR_LANCEDB_ENABLED=true
|
|
299
|
+
LITE_VECTOR_LANCEDB_MIN_IMPORTANCE=0.72
|
|
300
|
+
|
|
301
|
+
# Admin protection for sensitive config APIs
|
|
302
|
+
LITE_ADMIN_TOKEN=change-me
|
|
303
|
+
LITE_ADMIN_ALLOW_LOCALHOST=true
|
|
304
|
+
|
|
305
|
+
# Retrieval latency/recall tuning (edge-side)
|
|
306
|
+
LITE_SEARCH_BUDGET_FACTOR=4
|
|
307
|
+
LITE_SEARCH_MIN_PROBE_K=12
|
|
308
|
+
LITE_KEYWORD_CONFIDENT_BEST_SCORE=9.0
|
|
309
|
+
LITE_KEYWORD_CONFIDENT_KTH_SCORE=2.8
|
|
310
|
+
LITE_SEMANTIC_VECTOR_BUDGET_CAP=32
|
|
311
|
+
LITE_SEMANTIC_KEYWORD_BUDGET_CAP=16
|
|
312
|
+
LITE_QUERY_EMBED_CACHE_SIZE=256
|
|
313
|
+
LITE_QUERY_EMBED_CACHE_TTL_SEC=900
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
- Sensitive endpoints (`/api/v1/config/raw`, `/api/v1/model-config*`) accept
|
|
317
|
+
`Authorization: Bearer <LITE_ADMIN_TOKEN>` or `X-API-Key`.
|
|
318
|
+
- When `LITE_ADMIN_TOKEN` is empty, localhost access is allowed by default
|
|
319
|
+
(`LITE_ADMIN_ALLOW_LOCALHOST=true`).
|
|
320
|
+
|
|
321
|
+
Default local storage location (when `LITE_DATA_DIR` is not set):
|
|
322
|
+
|
|
323
|
+
- Windows: `%LOCALAPPDATA%\\MiniMem` (kept for backward compatibility)
|
|
324
|
+
- Linux/macOS: `$XDG_DATA_HOME/minimem` or `~/.local/share/minimem`
|
|
325
|
+
|
|
326
|
+
## Tech Stack 🛠️
|
|
327
|
+
|
|
328
|
+
- **FastAPI** - Modern async web framework
|
|
329
|
+
- **SQLite** - Local structured data
|
|
330
|
+
- **LanceDB** - High-performance vector database
|
|
331
|
+
- **Local Graph Store** - Persistent triple storage and graph retrieval
|
|
332
|
+
|
|
333
|
+
## Acknowledgments 🙏
|
|
334
|
+
|
|
335
|
+
FlockMem builds on the shoulders of giants ❤️
|
|
336
|
+
|
|
337
|
+
- **[EverMemOs](https://github.com/EverMind-AI/EverMemOS**)** - Original inspiration for agent memory systems
|
|
338
|
+
- **[LanceDB](https://lancedb.com/)** - Developer-friendly vector database
|
|
339
|
+
- **[SQLite](https://www.sqlite.org/)** - The most used database in the world
|
|
340
|
+
|
|
341
|
+
## License 📄
|
|
342
|
+
|
|
343
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
Made with ❤️ for AI agents everywhere 🤖
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
flockmem-0.2.0/README.md
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# <img src="docs/assets/flockmem-icon.svg" alt="FlockMem logo" width="52" /> FlockMem
|
|
2
|
+
|
|
3
|
+
> Lightweight local-first memory system for AI agents ✨
|
|
4
|
+
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](pyproject.toml)
|
|
7
|
+
[](https://zread.ai/gengxy1216/FlockMem)
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<img src="docs/assets/flockmem-banner.svg" alt="FlockMem banner" />
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
English | [简体中文](README.zh-CN.md)
|
|
14
|
+
|
|
15
|
+
FlockMem is a lightweight, local-first long-term memory system designed for AI agents. It is also built as a memory infrastructure layer for multi-agent collaboration. With edge deployment in mind, it runs with a minimal memory footprint under 50MB, making it suitable for resource-constrained environments 🖥️
|
|
16
|
+
|
|
17
|
+
## Why FlockMem? 💡
|
|
18
|
+
|
|
19
|
+
- 🧱 **Multi-Agent Memory Infrastructure** - One shared memory substrate across agents, runtimes, and workflows
|
|
20
|
+
- 🔄 **Local-first** - No cloud dependencies, runs entirely on your device
|
|
21
|
+
- 🔍 **Hybrid Retrieval** - Text + Vector + Graph search with citation traces
|
|
22
|
+
- 🧠 **Structured + Episodic Memory** - Entities, relationships, and conversation memories in one system
|
|
23
|
+
- ⚡ **Lightweight** - Under 50MB memory usage, suitable for edge devices
|
|
24
|
+
- 🔌 **Integration-ready** - REST API + MCP bridge + OpenClaw plugin
|
|
25
|
+
- 🚀 **One-click Install** - Get started in seconds
|
|
26
|
+
|
|
27
|
+
## Key Positioning: Memory Infrastructure for Multi-Agent Collaboration
|
|
28
|
+
|
|
29
|
+
FlockMem is not just a memory store for a single assistant. It provides:
|
|
30
|
+
|
|
31
|
+
- Shared memory infrastructure for multiple agents via REST, MCP, and plugin bridges
|
|
32
|
+
- Controlled collaboration boundaries with role-based, shared-group, and per-user memory strategies
|
|
33
|
+
- Retrieval traces and citations for auditability and easier debugging
|
|
34
|
+
- Local-first deployment with predictable cost, data ownership, and operational simplicity
|
|
35
|
+
|
|
36
|
+
## Quick Start ⚡
|
|
37
|
+
|
|
38
|
+
### One-click Install
|
|
39
|
+
|
|
40
|
+
`pip`:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install flockmem
|
|
44
|
+
flockmem
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`npm`:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install openclaw-flockmem
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`openclaw plugin`:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
openclaw plugins install openclaw-flockmem
|
|
57
|
+
openclaw plugins enable flockmem-memory
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Local install (kept):
|
|
61
|
+
|
|
62
|
+
| Platform | Command |
|
|
63
|
+
|----------|---------|
|
|
64
|
+
| 🪟 **Windows** | `powershell -ExecutionPolicy Bypass -File scripts/install.ps1 -RunAfterInstall` |
|
|
65
|
+
| 🐧 **Linux** | `bash scripts/install.sh --run` |
|
|
66
|
+
| 🍎 **macOS** | `bash scripts/install.sh --run` |
|
|
67
|
+
|
|
68
|
+
Or use the launcher:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Windows
|
|
72
|
+
start_flockmem.bat
|
|
73
|
+
|
|
74
|
+
# Linux/macOS
|
|
75
|
+
bash scripts/start.sh
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Manual Install
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install -e .
|
|
82
|
+
flockmem
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Access the UI 🌐
|
|
86
|
+
|
|
87
|
+
Open your browser:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
http://127.0.0.1:20195/ui
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
> 🔐 **Default Credentials**: `admin` / `admin123`
|
|
94
|
+
|
|
95
|
+
## Features 🎯
|
|
96
|
+
|
|
97
|
+
| Feature | Description |
|
|
98
|
+
|---------|-------------|
|
|
99
|
+
| 📝 **Memory Storage** | Store and manage conversation memories |
|
|
100
|
+
| 🔎 **Semantic Search** | Find relevant memories using vector similarity |
|
|
101
|
+
| 🕸️ **Graph Search** | Explore entity relationships in knowledge graph |
|
|
102
|
+
| 💬 **Chat with Memory** | Context-aware conversations with retrieval traces |
|
|
103
|
+
| ⚙️ **Runtime Config** | Change providers and settings on-the-fly |
|
|
104
|
+
|
|
105
|
+
## API Overview 📡
|
|
106
|
+
|
|
107
|
+
> For complete API documentation, see [API Reference](docs/api-reference.md)
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Health check
|
|
111
|
+
GET /health
|
|
112
|
+
|
|
113
|
+
# Store memory
|
|
114
|
+
POST /api/v1/memories
|
|
115
|
+
|
|
116
|
+
# Search memories
|
|
117
|
+
GET /api/v1/memories/search
|
|
118
|
+
|
|
119
|
+
# Chat with context
|
|
120
|
+
POST /api/v1/chat/simple
|
|
121
|
+
|
|
122
|
+
# Graph queries
|
|
123
|
+
GET /api/v1/graph/search
|
|
124
|
+
GET /api/v1/graph/neighbors
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## MCP Integration 🔌
|
|
128
|
+
|
|
129
|
+
FlockMem now includes a standalone MCP bridge server for cross-agent integration:
|
|
130
|
+
|
|
131
|
+
- Server path: `integrations/flockmem-mcp/server.py`
|
|
132
|
+
- Skill path: `skills/flockmem-mcp-integration`
|
|
133
|
+
|
|
134
|
+
Run the MCP bridge:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
python skills/flockmem-mcp-integration/scripts/run_flockmem_mcp.py
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Generate a client config snippet:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
python skills/flockmem-mcp-integration/scripts/generate_mcp_config.py
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Run MCP integration test:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
pytest -q tests/test_flockmem_mcp_server.py
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Package the MCP skill as a distributable artifact:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
python C:/Users/user/.agents/skills/skill-creator/scripts/package_skill.py skills/flockmem-mcp-integration dist
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Packaged artifact:
|
|
159
|
+
|
|
160
|
+
- `dist/flockmem-mcp-integration.skill`
|
|
161
|
+
|
|
162
|
+
Environment variables (optional):
|
|
163
|
+
|
|
164
|
+
- `MINIMEM_BASE_URL` (default: `http://127.0.0.1:20195`)
|
|
165
|
+
- `MINIMEM_USER_ID`
|
|
166
|
+
- `MINIMEM_GROUP_ID`
|
|
167
|
+
- `MINIMEM_BEARER_TOKEN` or `MINIMEM_BASIC_USER` + `MINIMEM_BASIC_PASSWORD`
|
|
168
|
+
|
|
169
|
+
## OpenClaw Plugin Integration
|
|
170
|
+
|
|
171
|
+
FlockMem also provides a lightweight OpenClaw plugin bridge:
|
|
172
|
+
|
|
173
|
+
- Plugin path: `integrations/openclaw-plugin`
|
|
174
|
+
- Plugin manifest: `integrations/openclaw-plugin/openclaw.plugin.json`
|
|
175
|
+
- Plugin doc: `integrations/openclaw-plugin/README.md`
|
|
176
|
+
- Policy template: `integrations/openclaw-plugin/examples/AGENTS.memory-policy.md`
|
|
177
|
+
|
|
178
|
+
Core capabilities:
|
|
179
|
+
|
|
180
|
+
- write dialogue / bot profile / context compression into FlockMem
|
|
181
|
+
- retrieve memory by strategy (`keyword`/`vector`/`hybrid`/`rrf`/`agentic`)
|
|
182
|
+
- return `context_for_agent` for prompt injection
|
|
183
|
+
- optional auto capture (`agent_end`) and auto inject (`before_agent_start`)
|
|
184
|
+
- role-based / shared / per-user group strategies
|
|
185
|
+
|
|
186
|
+
One-command install:
|
|
187
|
+
|
|
188
|
+
```powershell
|
|
189
|
+
powershell -ExecutionPolicy Bypass -File integrations/openclaw-plugin/install.ps1
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
bash integrations/openclaw-plugin/install.sh
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Or install distributed plugin package:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
openclaw plugins install openclaw-flockmem
|
|
200
|
+
openclaw plugins enable flockmem-memory
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Advanced entry example:
|
|
204
|
+
|
|
205
|
+
```json
|
|
206
|
+
{
|
|
207
|
+
"path": "C:/path/to/flockmem/integrations/openclaw-plugin",
|
|
208
|
+
"enabled": true,
|
|
209
|
+
"config": {
|
|
210
|
+
"baseUrl": "http://127.0.0.1:20195",
|
|
211
|
+
"groupStrategy": "per_role",
|
|
212
|
+
"sharedGroupId": "shared:team",
|
|
213
|
+
"autoSenderFromAgent": true,
|
|
214
|
+
"autoInjectOnStart": true,
|
|
215
|
+
"autoCaptureOnEnd": true
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Architecture 🏗️
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
┌─────────────────────────────────────┐
|
|
224
|
+
│ FlockMem UI │
|
|
225
|
+
├─────────────────────────────────────┤
|
|
226
|
+
│ REST API │
|
|
227
|
+
├──────────────┬──────────────────────┤
|
|
228
|
+
│ Retrieval │ Extraction │
|
|
229
|
+
│ (Fusion) │ (Atomic Facts) │
|
|
230
|
+
├──────────────┼──────────────────────┤
|
|
231
|
+
│ Vector DB │ Graph Store │
|
|
232
|
+
│ (LanceDB) │ (Local Persistent) │
|
|
233
|
+
├──────────────┴──────────────────────┤
|
|
234
|
+
│ SQLite (Metadata) │
|
|
235
|
+
└─────────────────────────────────────┘
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Memory Tiering (L0 -> L2)
|
|
239
|
+
|
|
240
|
+
FlockMem uses progressive memory tiers to balance simplicity, recall quality, and retrieval performance:
|
|
241
|
+
|
|
242
|
+
| Tier | Name | Core Storage | Retrieval Role |
|
|
243
|
+
|------|------|--------------|----------------|
|
|
244
|
+
| `L0` | Plain Text | SQLite (`episodic_memory`) | Full-fidelity source of truth, keyword/metadata recall |
|
|
245
|
+
| `L0.5` | Vector-Text (Hot) | Local vector cache (`jsonl` + snapshot) | Fast local semantic recall and restart-safe warm cache |
|
|
246
|
+
| `L1` | Vector (Persistent) | LanceDB (`memory_vector_index`) | ANN-style semantic retrieval for higher-importance memories |
|
|
247
|
+
| `L2` | Graph | Local graph triples store | Structured relation recall and graph expansion |
|
|
248
|
+
|
|
249
|
+
### Retrieval Flow
|
|
250
|
+
|
|
251
|
+
1. Query enters policy/selector layer.
|
|
252
|
+
2. Keyword + vector recall run in hybrid mode (`L0` + `L0.5` + `L1`).
|
|
253
|
+
3. Graph evidence from `L2` is merged when enabled.
|
|
254
|
+
4. Final hits are reranked and rendered with query-aware citation snippets.
|
|
255
|
+
|
|
256
|
+
## Configuration ⚙️
|
|
257
|
+
|
|
258
|
+
Set environment variables to configure providers:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
# Chat provider
|
|
262
|
+
LITE_CHAT_PROVIDER=openai
|
|
263
|
+
LITE_CHAT_MODEL=gpt-4o-mini
|
|
264
|
+
|
|
265
|
+
# Embedding provider
|
|
266
|
+
LITE_EMBEDDING_PROVIDER=openai
|
|
267
|
+
LITE_EMBEDDING_MODEL=text-embedding-3-small
|
|
268
|
+
|
|
269
|
+
# Graph module (optional)
|
|
270
|
+
LITE_GRAPH_ENABLED=true
|
|
271
|
+
|
|
272
|
+
# Retrieval profile
|
|
273
|
+
LITE_RETRIEVAL_PROFILE=agentic
|
|
274
|
+
|
|
275
|
+
# Hybrid vector persistence (partial to LanceDB)
|
|
276
|
+
LITE_VECTOR_LANCEDB_ENABLED=true
|
|
277
|
+
LITE_VECTOR_LANCEDB_MIN_IMPORTANCE=0.72
|
|
278
|
+
|
|
279
|
+
# Admin protection for sensitive config APIs
|
|
280
|
+
LITE_ADMIN_TOKEN=change-me
|
|
281
|
+
LITE_ADMIN_ALLOW_LOCALHOST=true
|
|
282
|
+
|
|
283
|
+
# Retrieval latency/recall tuning (edge-side)
|
|
284
|
+
LITE_SEARCH_BUDGET_FACTOR=4
|
|
285
|
+
LITE_SEARCH_MIN_PROBE_K=12
|
|
286
|
+
LITE_KEYWORD_CONFIDENT_BEST_SCORE=9.0
|
|
287
|
+
LITE_KEYWORD_CONFIDENT_KTH_SCORE=2.8
|
|
288
|
+
LITE_SEMANTIC_VECTOR_BUDGET_CAP=32
|
|
289
|
+
LITE_SEMANTIC_KEYWORD_BUDGET_CAP=16
|
|
290
|
+
LITE_QUERY_EMBED_CACHE_SIZE=256
|
|
291
|
+
LITE_QUERY_EMBED_CACHE_TTL_SEC=900
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
- Sensitive endpoints (`/api/v1/config/raw`, `/api/v1/model-config*`) accept
|
|
295
|
+
`Authorization: Bearer <LITE_ADMIN_TOKEN>` or `X-API-Key`.
|
|
296
|
+
- When `LITE_ADMIN_TOKEN` is empty, localhost access is allowed by default
|
|
297
|
+
(`LITE_ADMIN_ALLOW_LOCALHOST=true`).
|
|
298
|
+
|
|
299
|
+
Default local storage location (when `LITE_DATA_DIR` is not set):
|
|
300
|
+
|
|
301
|
+
- Windows: `%LOCALAPPDATA%\\MiniMem` (kept for backward compatibility)
|
|
302
|
+
- Linux/macOS: `$XDG_DATA_HOME/minimem` or `~/.local/share/minimem`
|
|
303
|
+
|
|
304
|
+
## Tech Stack 🛠️
|
|
305
|
+
|
|
306
|
+
- **FastAPI** - Modern async web framework
|
|
307
|
+
- **SQLite** - Local structured data
|
|
308
|
+
- **LanceDB** - High-performance vector database
|
|
309
|
+
- **Local Graph Store** - Persistent triple storage and graph retrieval
|
|
310
|
+
|
|
311
|
+
## Acknowledgments 🙏
|
|
312
|
+
|
|
313
|
+
FlockMem builds on the shoulders of giants ❤️
|
|
314
|
+
|
|
315
|
+
- **[EverMemOs](https://github.com/EverMind-AI/EverMemOS**)** - Original inspiration for agent memory systems
|
|
316
|
+
- **[LanceDB](https://lancedb.com/)** - Developer-friendly vector database
|
|
317
|
+
- **[SQLite](https://www.sqlite.org/)** - The most used database in the world
|
|
318
|
+
|
|
319
|
+
## License 📄
|
|
320
|
+
|
|
321
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
Made with ❤️ for AI agents everywhere 🤖
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|