memomate 0.4.6__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 (127) hide show
  1. memomate-0.4.6/LICENSE +21 -0
  2. memomate-0.4.6/PKG-INFO +183 -0
  3. memomate-0.4.6/README.md +153 -0
  4. memomate-0.4.6/pyproject.toml +68 -0
  5. memomate-0.4.6/setup.cfg +4 -0
  6. memomate-0.4.6/src/memomate.egg-info/PKG-INFO +183 -0
  7. memomate-0.4.6/src/memomate.egg-info/SOURCES.txt +125 -0
  8. memomate-0.4.6/src/memomate.egg-info/dependency_links.txt +1 -0
  9. memomate-0.4.6/src/memomate.egg-info/entry_points.txt +2 -0
  10. memomate-0.4.6/src/memomate.egg-info/requires.txt +11 -0
  11. memomate-0.4.6/src/memomate.egg-info/top_level.txt +1 -0
  12. memomate-0.4.6/src/memos/__init__.py +38 -0
  13. memomate-0.4.6/src/memos/_version.py +1 -0
  14. memomate-0.4.6/src/memos/cli/__init__.py +8 -0
  15. memomate-0.4.6/src/memos/cli/__main__.py +5 -0
  16. memomate-0.4.6/src/memos/cli/dispatch.py +1141 -0
  17. memomate-0.4.6/src/memos/config/__init__.py +99 -0
  18. memomate-0.4.6/src/memos/config/loader.py +397 -0
  19. memomate-0.4.6/src/memos/config/models.py +662 -0
  20. memomate-0.4.6/src/memos/config/prompts.py +562 -0
  21. memomate-0.4.6/src/memos/dashboard/__init__.py +4 -0
  22. memomate-0.4.6/src/memos/engine/__init__.py +35 -0
  23. memomate-0.4.6/src/memos/engine/extractor.py +872 -0
  24. memomate-0.4.6/src/memos/engine/memory.py +1111 -0
  25. memomate-0.4.6/src/memos/engine/review.py +809 -0
  26. memomate-0.4.6/src/memos/errors.py +141 -0
  27. memomate-0.4.6/src/memos/features/__init__.py +44 -0
  28. memomate-0.4.6/src/memos/features/backup.py +546 -0
  29. memomate-0.4.6/src/memos/features/notifications.py +212 -0
  30. memomate-0.4.6/src/memos/features/usage.py +232 -0
  31. memomate-0.4.6/src/memos/features/wizard.py +464 -0
  32. memomate-0.4.6/src/memos/hooks/__init__.py +5 -0
  33. memomate-0.4.6/src/memos/hooks/prompt.py +1235 -0
  34. memomate-0.4.6/src/memos/hooks/stop.py +132 -0
  35. memomate-0.4.6/src/memos/i18n.py +51 -0
  36. memomate-0.4.6/src/memos/server/__init__.py +8 -0
  37. memomate-0.4.6/src/memos/server/__main__.py +19 -0
  38. memomate-0.4.6/src/memos/server/mcp.py +553 -0
  39. memomate-0.4.6/src/memos/storage/__init__.py +28 -0
  40. memomate-0.4.6/src/memos/storage/base.py +31 -0
  41. memomate-0.4.6/src/memos/storage/chroma.py +234 -0
  42. memomate-0.4.6/src/memos/storage/embeddings.py +279 -0
  43. memomate-0.4.6/src/memos/web/__init__.py +8 -0
  44. memomate-0.4.6/src/memos/web/app.py +298 -0
  45. memomate-0.4.6/src/memos/web/auth.py +84 -0
  46. memomate-0.4.6/src/memos/web/models/__init__.py +61 -0
  47. memomate-0.4.6/src/memos/web/models/requests.py +314 -0
  48. memomate-0.4.6/src/memos/web/routes/__init__.py +18 -0
  49. memomate-0.4.6/src/memos/web/routes/auth.py +50 -0
  50. memomate-0.4.6/src/memos/web/routes/backups.py +116 -0
  51. memomate-0.4.6/src/memos/web/routes/config_routes.py +89 -0
  52. memomate-0.4.6/src/memos/web/routes/conversations.py +582 -0
  53. memomate-0.4.6/src/memos/web/routes/llm.py +126 -0
  54. memomate-0.4.6/src/memos/web/routes/memories.py +584 -0
  55. memomate-0.4.6/src/memos/web/routes/notifications.py +174 -0
  56. memomate-0.4.6/src/memos/web/routes/pages.py +63 -0
  57. memomate-0.4.6/src/memos/web/routes/prompts.py +379 -0
  58. memomate-0.4.6/src/memos/web/routes/search.py +55 -0
  59. memomate-0.4.6/src/memos/web/routes/suggestions.py +1225 -0
  60. memomate-0.4.6/src/memos/web/routes/system.py +532 -0
  61. memomate-0.4.6/src/memos/web/routes/todos.py +376 -0
  62. memomate-0.4.6/src/memos/web/services/__init__.py +0 -0
  63. memomate-0.4.6/src/memos/web/services/helpers.py +268 -0
  64. memomate-0.4.6/tests/test_active_memory_config.py +212 -0
  65. memomate-0.4.6/tests/test_auth.py +226 -0
  66. memomate-0.4.6/tests/test_backup.py +397 -0
  67. memomate-0.4.6/tests/test_benchmark.py +98 -0
  68. memomate-0.4.6/tests/test_bm25_incremental.py +161 -0
  69. memomate-0.4.6/tests/test_buffer.py +137 -0
  70. memomate-0.4.6/tests/test_cli.py +285 -0
  71. memomate-0.4.6/tests/test_cli_todo.py +48 -0
  72. memomate-0.4.6/tests/test_config_paths.py +158 -0
  73. memomate-0.4.6/tests/test_config_validate.py +479 -0
  74. memomate-0.4.6/tests/test_conflict_api.py +271 -0
  75. memomate-0.4.6/tests/test_conflict_detection.py +334 -0
  76. memomate-0.4.6/tests/test_conversation_search.py +124 -0
  77. memomate-0.4.6/tests/test_dashboard.py +318 -0
  78. memomate-0.4.6/tests/test_dashboard_daily_review.py +231 -0
  79. memomate-0.4.6/tests/test_dashboard_prompts_api.py +241 -0
  80. memomate-0.4.6/tests/test_dashboard_wizard.py +106 -0
  81. memomate-0.4.6/tests/test_endpoint_prompt_decoupling.py +205 -0
  82. memomate-0.4.6/tests/test_endpoint_test.py +86 -0
  83. memomate-0.4.6/tests/test_error_messages.py +143 -0
  84. memomate-0.4.6/tests/test_expiry.py +122 -0
  85. memomate-0.4.6/tests/test_export_import.py +311 -0
  86. memomate-0.4.6/tests/test_extract_mock.py +116 -0
  87. memomate-0.4.6/tests/test_extractor_retry.py +240 -0
  88. memomate-0.4.6/tests/test_extractor_unified.py +202 -0
  89. memomate-0.4.6/tests/test_hook_layered_context.py +415 -0
  90. memomate-0.4.6/tests/test_hook_prompt_integration.py +152 -0
  91. memomate-0.4.6/tests/test_hook_system_suggestions.py +378 -0
  92. memomate-0.4.6/tests/test_hooks.py +260 -0
  93. memomate-0.4.6/tests/test_hybrid_search.py +104 -0
  94. memomate-0.4.6/tests/test_init_wizard.py +271 -0
  95. memomate-0.4.6/tests/test_integration.py +50 -0
  96. memomate-0.4.6/tests/test_integration_all.py +842 -0
  97. memomate-0.4.6/tests/test_integration_v020.py +866 -0
  98. memomate-0.4.6/tests/test_integration_v030.py +891 -0
  99. memomate-0.4.6/tests/test_integration_v040.py +1039 -0
  100. memomate-0.4.6/tests/test_lazy_loading.py +177 -0
  101. memomate-0.4.6/tests/test_lightweight_model.py +107 -0
  102. memomate-0.4.6/tests/test_list_pagination.py +222 -0
  103. memomate-0.4.6/tests/test_manual_suggestion.py +187 -0
  104. memomate-0.4.6/tests/test_mcp_todos.py +127 -0
  105. memomate-0.4.6/tests/test_mcp_update_delete.py +120 -0
  106. memomate-0.4.6/tests/test_memory_crud.py +125 -0
  107. memomate-0.4.6/tests/test_memory_filter.py +378 -0
  108. memomate-0.4.6/tests/test_model_download.py +292 -0
  109. memomate-0.4.6/tests/test_notifications.py +249 -0
  110. memomate-0.4.6/tests/test_prompt_llm_binding.py +134 -0
  111. memomate-0.4.6/tests/test_prompt_manager.py +327 -0
  112. memomate-0.4.6/tests/test_prompt_models.py +191 -0
  113. memomate-0.4.6/tests/test_prompt_templates.py +292 -0
  114. memomate-0.4.6/tests/test_prompt_types.py +268 -0
  115. memomate-0.4.6/tests/test_quality_scoring.py +177 -0
  116. memomate-0.4.6/tests/test_reuse_boost.py +92 -0
  117. memomate-0.4.6/tests/test_review.py +566 -0
  118. memomate-0.4.6/tests/test_smoke_install.py +41 -0
  119. memomate-0.4.6/tests/test_store.py +80 -0
  120. memomate-0.4.6/tests/test_suggestion_dedup.py +91 -0
  121. memomate-0.4.6/tests/test_suggestion_settings_api.py +157 -0
  122. memomate-0.4.6/tests/test_suggestions_api.py +414 -0
  123. memomate-0.4.6/tests/test_time_decay.py +162 -0
  124. memomate-0.4.6/tests/test_todos_api.py +220 -0
  125. memomate-0.4.6/tests/test_tokens.py +22 -0
  126. memomate-0.4.6/tests/test_usage_stats.py +98 -0
  127. memomate-0.4.6/tests/test_vacuum.py +268 -0
memomate-0.4.6/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MEMOS Team
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,183 @@
1
+ Metadata-Version: 2.4
2
+ Name: memomate
3
+ Version: 0.4.6
4
+ Summary: 长时记忆系统(Long-Term Memory System)— 轻量级 RAG 引擎
5
+ Author: MEMOS Team
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/laofisher/memos
8
+ Project-URL: Documentation, https://github.com/laofisher/memos
9
+ Project-URL: Source, https://github.com/laofisher/memos
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
15
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
+ Requires-Python: >=3.12
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: chromadb>=0.4.22
20
+ Requires-Dist: sentence-transformers>=2.2.2
21
+ Requires-Dist: mcp>=1.27.0
22
+ Requires-Dist: rank-bm25>=0.2.2
23
+ Requires-Dist: fastapi>=0.110
24
+ Requires-Dist: uvicorn>=0.29
25
+ Requires-Dist: requests>=2.31
26
+ Requires-Dist: huggingface-hub>=0.20
27
+ Provides-Extra: test
28
+ Requires-Dist: pytest>=8.0; extra == "test"
29
+ Dynamic: license-file
30
+
31
+ # MEMOS — Active Memory System for AI Coding Assistants
32
+
33
+ [![Python](https://img.shields.io/badge/Python-3.12+-blue)](https://www.python.org)
34
+ [![License](https://img.shields.io/badge/License-MIT-green)](LICENSE)
35
+ [![Version](https://img.shields.io/badge/version-0.4.6-lightgrey)](https://pypi.org/project/memomate/)
36
+
37
+ > 📖 [中文文档](README.zh.md)
38
+
39
+ **MEMOS** is a lightweight RAG engine designed for AI coding assistants. It provides **cross-session memory** — remembering technical decisions, bug fixes, user preferences, and code conventions from past conversations. Built on ChromaDB + bge-large-zh-v1.5 with a built-in MCP server.
40
+
41
+ ## Features
42
+
43
+ - **🧠 Cross-Session Memory** — Captures knowledge from conversations, retrieves it across sessions
44
+ - **🔌 MCP Server** — 11 tools for AI assistant integration (Claude Code, etc.)
45
+ - **🔍 Hybrid Search** — Vector similarity (1024-dim) × BM25 keyword scoring, time-decay ranking
46
+ - **📊 Web Dashboard** — Browse, search, manage memories; visual configuration editor
47
+ - **🏗️ 4 Pipelines** — AI-suggested + direct-write + auto-harvest + manual curation
48
+ - **🗂️ Multi-Project** — Scoped by working directory, contexts stay separate
49
+ - **⚡ Lightweight** — Local-only, single process, no external services
50
+
51
+ ## Quick Start
52
+
53
+ ```bash
54
+ pip install memomate
55
+ memos init --force
56
+ memos dashboard
57
+ ```
58
+
59
+ Open http://127.0.0.1:8000
60
+
61
+ > **Windows**: If model download stalls, set `$env:HF_ENDPOINT = "https://hf-mirror.com"` before `memos init`.
62
+
63
+ ### Claude Code Integration
64
+
65
+ ```bash
66
+ memos hook install
67
+ ```
68
+
69
+ This registers MEMOS as an MCP server. Claude Code will automatically read and write memories during conversations.
70
+
71
+ ## Why MEMOS?
72
+
73
+ Existing memory solutions for AI coding assistants typically:
74
+
75
+ - ❌ Store flat text without semantic search
76
+ - ❌ Require external services (PostgreSQL, Redis, cloud APIs)
77
+ - ❌ Lack cross-project isolation
78
+ - ❌ Don't handle time-based memory decay
79
+
80
+ MEMOS addresses these with a self-contained, local-first architecture designed specifically for the AI-assisted coding workflow.
81
+
82
+ ## Architecture
83
+
84
+ ```mermaid
85
+ graph LR
86
+ subgraph AI Assistant
87
+ A[Claude Code]
88
+ end
89
+ subgraph MEMOS
90
+ B[MCP Server<br/>11 tools]
91
+ C[Engine<br/>Retrieval + Extraction]
92
+ D[Vector Store<br/>ChromaDB]
93
+ E[Embedding Model<br/>bge 1024-dim]
94
+ F[Web Dashboard<br/>FastAPI + Jinja2]
95
+ G[Hybrid Search<br/>BM25 + Vector]
96
+ end
97
+ A <-->|stdio JSON-RPC| B
98
+ B --> C
99
+ C --> D & E & G
100
+ F --> C
101
+ ```
102
+
103
+ ### Project Structure
104
+
105
+ ```
106
+ memos/
107
+ ├── src/memos/
108
+ │ ├── config/ Pydantic models, loading chain, prompts
109
+ │ ├── storage/ Vector store abstraction (ChromaDB)
110
+ │ ├── engine/ Core: memory CRUD, extraction, review, BM25
111
+ │ ├── server/ MCP server (11 tools, FastMCP stdio)
112
+ │ ├── web/ FastAPI + Jinja2 dashboard
113
+ │ ├── cli/ argparse CLI (15+ commands)
114
+ │ ├── features/ Backup, daily review, notifications, wizard
115
+ │ └── hooks/ Claude Code hook scripts (prompt/stop)
116
+ ├── memdb/ ChromaDB persistent data
117
+ ├── model/ Local embedding models (~1.3GB)
118
+ └── etc/ Configuration files + i18n locales
119
+ ```
120
+
121
+ ## MCP Tools (for AI Assistants)
122
+
123
+ | Tool | Pipeline | Description |
124
+ |------|----------|-------------|
125
+ | `remember(text, metadata)` | A | Buffer → LLM extraction |
126
+ | `save_knowledge(text, type)` | B | Direct write to store |
127
+ | `recall(query, top_k, ...)` | — | Semantic + hybrid search |
128
+ | `list_memories(type, limit)` | — | Paginate project memories |
129
+ | `list_todos(status, limit)` | — | List pending action items |
130
+ | `update_todo(id, status)` | — | Change todo status |
131
+ | `delete_memory(memory_id)` | — | Delete by ID |
132
+ | `update_memory(id, text, meta)` | — | Update content/metadata |
133
+ | `force_extract()` | A | Trigger immediate extraction |
134
+ | `set_project_id(pid)` | — | Switch project scope |
135
+ | `log_complete_turn(user, asst)` | A | Log a conversation round |
136
+
137
+ ## CLI Commands
138
+
139
+ | Command | Description |
140
+ |---------|-------------|
141
+ | `init` | First-time setup wizard |
142
+ | `dashboard` | Launch web UI |
143
+ | `server` | Start MCP server (stdio) |
144
+ | `status` | View system health |
145
+ | `doctor` | Diagnose and troubleshoot |
146
+ | `config show / set / validate` | Manage configuration |
147
+ | `export` | Export memories to JSONL |
148
+ | `import` | Import from JSONL |
149
+ | `backup / restore` | Full database backup |
150
+ | `hook install / uninstall / status` | Claude Code hook management |
151
+ | `auth regen` | Regenerate dashboard token |
152
+ | `vacuum` | Reclaim deleted document space |
153
+ | `reindex` | Rebuild BM25 index |
154
+
155
+ ## Configuration
156
+
157
+ All settings in `etc/config.json`. Key sections:
158
+
159
+ ```json
160
+ {
161
+ "llm": {
162
+ "endpoints": [
163
+ {"name": "default", "api_base": "http://localhost:11434/v1"}
164
+ ],
165
+ "active": "default"
166
+ },
167
+ "model": {"name": "bge-large-zh-v1.5", "vector_dim": 1024},
168
+ "memory": {"decay_lambda": 0.02, "default_top_k": 5},
169
+ "suggestion": {"active_suggestion_threshold": 0.65}
170
+ }
171
+ ```
172
+
173
+ Override any field via `MEMOS_{SECTION}_{FIELD}` environment variables.
174
+
175
+ ## Requirements
176
+
177
+ - Python 3.12+
178
+ - ~2GB disk (bge-large-zh-v1.5 model ~1.3GB)
179
+ - Windows / Linux / macOS
180
+
181
+ ## License
182
+
183
+ MIT
@@ -0,0 +1,153 @@
1
+ # MEMOS — Active Memory System for AI Coding Assistants
2
+
3
+ [![Python](https://img.shields.io/badge/Python-3.12+-blue)](https://www.python.org)
4
+ [![License](https://img.shields.io/badge/License-MIT-green)](LICENSE)
5
+ [![Version](https://img.shields.io/badge/version-0.4.6-lightgrey)](https://pypi.org/project/memomate/)
6
+
7
+ > 📖 [中文文档](README.zh.md)
8
+
9
+ **MEMOS** is a lightweight RAG engine designed for AI coding assistants. It provides **cross-session memory** — remembering technical decisions, bug fixes, user preferences, and code conventions from past conversations. Built on ChromaDB + bge-large-zh-v1.5 with a built-in MCP server.
10
+
11
+ ## Features
12
+
13
+ - **🧠 Cross-Session Memory** — Captures knowledge from conversations, retrieves it across sessions
14
+ - **🔌 MCP Server** — 11 tools for AI assistant integration (Claude Code, etc.)
15
+ - **🔍 Hybrid Search** — Vector similarity (1024-dim) × BM25 keyword scoring, time-decay ranking
16
+ - **📊 Web Dashboard** — Browse, search, manage memories; visual configuration editor
17
+ - **🏗️ 4 Pipelines** — AI-suggested + direct-write + auto-harvest + manual curation
18
+ - **🗂️ Multi-Project** — Scoped by working directory, contexts stay separate
19
+ - **⚡ Lightweight** — Local-only, single process, no external services
20
+
21
+ ## Quick Start
22
+
23
+ ```bash
24
+ pip install memomate
25
+ memos init --force
26
+ memos dashboard
27
+ ```
28
+
29
+ Open http://127.0.0.1:8000
30
+
31
+ > **Windows**: If model download stalls, set `$env:HF_ENDPOINT = "https://hf-mirror.com"` before `memos init`.
32
+
33
+ ### Claude Code Integration
34
+
35
+ ```bash
36
+ memos hook install
37
+ ```
38
+
39
+ This registers MEMOS as an MCP server. Claude Code will automatically read and write memories during conversations.
40
+
41
+ ## Why MEMOS?
42
+
43
+ Existing memory solutions for AI coding assistants typically:
44
+
45
+ - ❌ Store flat text without semantic search
46
+ - ❌ Require external services (PostgreSQL, Redis, cloud APIs)
47
+ - ❌ Lack cross-project isolation
48
+ - ❌ Don't handle time-based memory decay
49
+
50
+ MEMOS addresses these with a self-contained, local-first architecture designed specifically for the AI-assisted coding workflow.
51
+
52
+ ## Architecture
53
+
54
+ ```mermaid
55
+ graph LR
56
+ subgraph AI Assistant
57
+ A[Claude Code]
58
+ end
59
+ subgraph MEMOS
60
+ B[MCP Server<br/>11 tools]
61
+ C[Engine<br/>Retrieval + Extraction]
62
+ D[Vector Store<br/>ChromaDB]
63
+ E[Embedding Model<br/>bge 1024-dim]
64
+ F[Web Dashboard<br/>FastAPI + Jinja2]
65
+ G[Hybrid Search<br/>BM25 + Vector]
66
+ end
67
+ A <-->|stdio JSON-RPC| B
68
+ B --> C
69
+ C --> D & E & G
70
+ F --> C
71
+ ```
72
+
73
+ ### Project Structure
74
+
75
+ ```
76
+ memos/
77
+ ├── src/memos/
78
+ │ ├── config/ Pydantic models, loading chain, prompts
79
+ │ ├── storage/ Vector store abstraction (ChromaDB)
80
+ │ ├── engine/ Core: memory CRUD, extraction, review, BM25
81
+ │ ├── server/ MCP server (11 tools, FastMCP stdio)
82
+ │ ├── web/ FastAPI + Jinja2 dashboard
83
+ │ ├── cli/ argparse CLI (15+ commands)
84
+ │ ├── features/ Backup, daily review, notifications, wizard
85
+ │ └── hooks/ Claude Code hook scripts (prompt/stop)
86
+ ├── memdb/ ChromaDB persistent data
87
+ ├── model/ Local embedding models (~1.3GB)
88
+ └── etc/ Configuration files + i18n locales
89
+ ```
90
+
91
+ ## MCP Tools (for AI Assistants)
92
+
93
+ | Tool | Pipeline | Description |
94
+ |------|----------|-------------|
95
+ | `remember(text, metadata)` | A | Buffer → LLM extraction |
96
+ | `save_knowledge(text, type)` | B | Direct write to store |
97
+ | `recall(query, top_k, ...)` | — | Semantic + hybrid search |
98
+ | `list_memories(type, limit)` | — | Paginate project memories |
99
+ | `list_todos(status, limit)` | — | List pending action items |
100
+ | `update_todo(id, status)` | — | Change todo status |
101
+ | `delete_memory(memory_id)` | — | Delete by ID |
102
+ | `update_memory(id, text, meta)` | — | Update content/metadata |
103
+ | `force_extract()` | A | Trigger immediate extraction |
104
+ | `set_project_id(pid)` | — | Switch project scope |
105
+ | `log_complete_turn(user, asst)` | A | Log a conversation round |
106
+
107
+ ## CLI Commands
108
+
109
+ | Command | Description |
110
+ |---------|-------------|
111
+ | `init` | First-time setup wizard |
112
+ | `dashboard` | Launch web UI |
113
+ | `server` | Start MCP server (stdio) |
114
+ | `status` | View system health |
115
+ | `doctor` | Diagnose and troubleshoot |
116
+ | `config show / set / validate` | Manage configuration |
117
+ | `export` | Export memories to JSONL |
118
+ | `import` | Import from JSONL |
119
+ | `backup / restore` | Full database backup |
120
+ | `hook install / uninstall / status` | Claude Code hook management |
121
+ | `auth regen` | Regenerate dashboard token |
122
+ | `vacuum` | Reclaim deleted document space |
123
+ | `reindex` | Rebuild BM25 index |
124
+
125
+ ## Configuration
126
+
127
+ All settings in `etc/config.json`. Key sections:
128
+
129
+ ```json
130
+ {
131
+ "llm": {
132
+ "endpoints": [
133
+ {"name": "default", "api_base": "http://localhost:11434/v1"}
134
+ ],
135
+ "active": "default"
136
+ },
137
+ "model": {"name": "bge-large-zh-v1.5", "vector_dim": 1024},
138
+ "memory": {"decay_lambda": 0.02, "default_top_k": 5},
139
+ "suggestion": {"active_suggestion_threshold": 0.65}
140
+ }
141
+ ```
142
+
143
+ Override any field via `MEMOS_{SECTION}_{FIELD}` environment variables.
144
+
145
+ ## Requirements
146
+
147
+ - Python 3.12+
148
+ - ~2GB disk (bge-large-zh-v1.5 model ~1.3GB)
149
+ - Windows / Linux / macOS
150
+
151
+ ## License
152
+
153
+ MIT
@@ -0,0 +1,68 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "memomate"
7
+ version = "0.4.6"
8
+ description = "长时记忆系统(Long-Term Memory System)— 轻量级 RAG 引擎"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ requires-python = ">=3.12"
12
+ authors = [
13
+ {name = "MEMOS Team"},
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Topic :: Software Development :: Libraries :: Application Frameworks",
21
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
22
+ ]
23
+ dependencies = [
24
+ "chromadb>=0.4.22",
25
+ "sentence-transformers>=2.2.2",
26
+ "mcp>=1.27.0",
27
+ "rank-bm25>=0.2.2",
28
+ "fastapi>=0.110",
29
+ "uvicorn>=0.29",
30
+ "requests>=2.31",
31
+ "huggingface-hub>=0.20",
32
+ ]
33
+
34
+ [project.urls]
35
+ Homepage = "https://github.com/laofisher/memos"
36
+ Documentation = "https://github.com/laofisher/memos"
37
+ Source = "https://github.com/laofisher/memos"
38
+
39
+ [project.scripts]
40
+ memos = "memos.cli:main"
41
+
42
+ [project.optional-dependencies]
43
+ test = [
44
+ "pytest>=8.0",
45
+ ]
46
+
47
+ [tool.setuptools.packages.find]
48
+ where = ["src"]
49
+
50
+ [tool.setuptools.package-data]
51
+ memos = ["templates/*"]
52
+
53
+ [tool.pytest.ini_options]
54
+ testpaths = ["tests"]
55
+
56
+ [tool.ruff]
57
+ target-version = "py312"
58
+ line-length = 120
59
+
60
+ [tool.ruff.lint]
61
+ select = ["E", "F", "I", "N", "W"]
62
+ ignore = ["E501"] # 允许行超长
63
+
64
+ [tool.ruff.lint.per-file-ignores]
65
+ "tests/*" = ["N802", "N803", "N806"]
66
+
67
+ [tool.ruff.format]
68
+ quote-style = "double"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,183 @@
1
+ Metadata-Version: 2.4
2
+ Name: memomate
3
+ Version: 0.4.6
4
+ Summary: 长时记忆系统(Long-Term Memory System)— 轻量级 RAG 引擎
5
+ Author: MEMOS Team
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/laofisher/memos
8
+ Project-URL: Documentation, https://github.com/laofisher/memos
9
+ Project-URL: Source, https://github.com/laofisher/memos
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
15
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
+ Requires-Python: >=3.12
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: chromadb>=0.4.22
20
+ Requires-Dist: sentence-transformers>=2.2.2
21
+ Requires-Dist: mcp>=1.27.0
22
+ Requires-Dist: rank-bm25>=0.2.2
23
+ Requires-Dist: fastapi>=0.110
24
+ Requires-Dist: uvicorn>=0.29
25
+ Requires-Dist: requests>=2.31
26
+ Requires-Dist: huggingface-hub>=0.20
27
+ Provides-Extra: test
28
+ Requires-Dist: pytest>=8.0; extra == "test"
29
+ Dynamic: license-file
30
+
31
+ # MEMOS — Active Memory System for AI Coding Assistants
32
+
33
+ [![Python](https://img.shields.io/badge/Python-3.12+-blue)](https://www.python.org)
34
+ [![License](https://img.shields.io/badge/License-MIT-green)](LICENSE)
35
+ [![Version](https://img.shields.io/badge/version-0.4.6-lightgrey)](https://pypi.org/project/memomate/)
36
+
37
+ > 📖 [中文文档](README.zh.md)
38
+
39
+ **MEMOS** is a lightweight RAG engine designed for AI coding assistants. It provides **cross-session memory** — remembering technical decisions, bug fixes, user preferences, and code conventions from past conversations. Built on ChromaDB + bge-large-zh-v1.5 with a built-in MCP server.
40
+
41
+ ## Features
42
+
43
+ - **🧠 Cross-Session Memory** — Captures knowledge from conversations, retrieves it across sessions
44
+ - **🔌 MCP Server** — 11 tools for AI assistant integration (Claude Code, etc.)
45
+ - **🔍 Hybrid Search** — Vector similarity (1024-dim) × BM25 keyword scoring, time-decay ranking
46
+ - **📊 Web Dashboard** — Browse, search, manage memories; visual configuration editor
47
+ - **🏗️ 4 Pipelines** — AI-suggested + direct-write + auto-harvest + manual curation
48
+ - **🗂️ Multi-Project** — Scoped by working directory, contexts stay separate
49
+ - **⚡ Lightweight** — Local-only, single process, no external services
50
+
51
+ ## Quick Start
52
+
53
+ ```bash
54
+ pip install memomate
55
+ memos init --force
56
+ memos dashboard
57
+ ```
58
+
59
+ Open http://127.0.0.1:8000
60
+
61
+ > **Windows**: If model download stalls, set `$env:HF_ENDPOINT = "https://hf-mirror.com"` before `memos init`.
62
+
63
+ ### Claude Code Integration
64
+
65
+ ```bash
66
+ memos hook install
67
+ ```
68
+
69
+ This registers MEMOS as an MCP server. Claude Code will automatically read and write memories during conversations.
70
+
71
+ ## Why MEMOS?
72
+
73
+ Existing memory solutions for AI coding assistants typically:
74
+
75
+ - ❌ Store flat text without semantic search
76
+ - ❌ Require external services (PostgreSQL, Redis, cloud APIs)
77
+ - ❌ Lack cross-project isolation
78
+ - ❌ Don't handle time-based memory decay
79
+
80
+ MEMOS addresses these with a self-contained, local-first architecture designed specifically for the AI-assisted coding workflow.
81
+
82
+ ## Architecture
83
+
84
+ ```mermaid
85
+ graph LR
86
+ subgraph AI Assistant
87
+ A[Claude Code]
88
+ end
89
+ subgraph MEMOS
90
+ B[MCP Server<br/>11 tools]
91
+ C[Engine<br/>Retrieval + Extraction]
92
+ D[Vector Store<br/>ChromaDB]
93
+ E[Embedding Model<br/>bge 1024-dim]
94
+ F[Web Dashboard<br/>FastAPI + Jinja2]
95
+ G[Hybrid Search<br/>BM25 + Vector]
96
+ end
97
+ A <-->|stdio JSON-RPC| B
98
+ B --> C
99
+ C --> D & E & G
100
+ F --> C
101
+ ```
102
+
103
+ ### Project Structure
104
+
105
+ ```
106
+ memos/
107
+ ├── src/memos/
108
+ │ ├── config/ Pydantic models, loading chain, prompts
109
+ │ ├── storage/ Vector store abstraction (ChromaDB)
110
+ │ ├── engine/ Core: memory CRUD, extraction, review, BM25
111
+ │ ├── server/ MCP server (11 tools, FastMCP stdio)
112
+ │ ├── web/ FastAPI + Jinja2 dashboard
113
+ │ ├── cli/ argparse CLI (15+ commands)
114
+ │ ├── features/ Backup, daily review, notifications, wizard
115
+ │ └── hooks/ Claude Code hook scripts (prompt/stop)
116
+ ├── memdb/ ChromaDB persistent data
117
+ ├── model/ Local embedding models (~1.3GB)
118
+ └── etc/ Configuration files + i18n locales
119
+ ```
120
+
121
+ ## MCP Tools (for AI Assistants)
122
+
123
+ | Tool | Pipeline | Description |
124
+ |------|----------|-------------|
125
+ | `remember(text, metadata)` | A | Buffer → LLM extraction |
126
+ | `save_knowledge(text, type)` | B | Direct write to store |
127
+ | `recall(query, top_k, ...)` | — | Semantic + hybrid search |
128
+ | `list_memories(type, limit)` | — | Paginate project memories |
129
+ | `list_todos(status, limit)` | — | List pending action items |
130
+ | `update_todo(id, status)` | — | Change todo status |
131
+ | `delete_memory(memory_id)` | — | Delete by ID |
132
+ | `update_memory(id, text, meta)` | — | Update content/metadata |
133
+ | `force_extract()` | A | Trigger immediate extraction |
134
+ | `set_project_id(pid)` | — | Switch project scope |
135
+ | `log_complete_turn(user, asst)` | A | Log a conversation round |
136
+
137
+ ## CLI Commands
138
+
139
+ | Command | Description |
140
+ |---------|-------------|
141
+ | `init` | First-time setup wizard |
142
+ | `dashboard` | Launch web UI |
143
+ | `server` | Start MCP server (stdio) |
144
+ | `status` | View system health |
145
+ | `doctor` | Diagnose and troubleshoot |
146
+ | `config show / set / validate` | Manage configuration |
147
+ | `export` | Export memories to JSONL |
148
+ | `import` | Import from JSONL |
149
+ | `backup / restore` | Full database backup |
150
+ | `hook install / uninstall / status` | Claude Code hook management |
151
+ | `auth regen` | Regenerate dashboard token |
152
+ | `vacuum` | Reclaim deleted document space |
153
+ | `reindex` | Rebuild BM25 index |
154
+
155
+ ## Configuration
156
+
157
+ All settings in `etc/config.json`. Key sections:
158
+
159
+ ```json
160
+ {
161
+ "llm": {
162
+ "endpoints": [
163
+ {"name": "default", "api_base": "http://localhost:11434/v1"}
164
+ ],
165
+ "active": "default"
166
+ },
167
+ "model": {"name": "bge-large-zh-v1.5", "vector_dim": 1024},
168
+ "memory": {"decay_lambda": 0.02, "default_top_k": 5},
169
+ "suggestion": {"active_suggestion_threshold": 0.65}
170
+ }
171
+ ```
172
+
173
+ Override any field via `MEMOS_{SECTION}_{FIELD}` environment variables.
174
+
175
+ ## Requirements
176
+
177
+ - Python 3.12+
178
+ - ~2GB disk (bge-large-zh-v1.5 model ~1.3GB)
179
+ - Windows / Linux / macOS
180
+
181
+ ## License
182
+
183
+ MIT