memomate 0.4.6__py3-none-any.whl

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 (58) hide show
  1. memomate-0.4.6.dist-info/METADATA +183 -0
  2. memomate-0.4.6.dist-info/RECORD +58 -0
  3. memomate-0.4.6.dist-info/WHEEL +5 -0
  4. memomate-0.4.6.dist-info/entry_points.txt +2 -0
  5. memomate-0.4.6.dist-info/licenses/LICENSE +21 -0
  6. memomate-0.4.6.dist-info/top_level.txt +1 -0
  7. memos/__init__.py +38 -0
  8. memos/_version.py +1 -0
  9. memos/cli/__init__.py +8 -0
  10. memos/cli/__main__.py +5 -0
  11. memos/cli/dispatch.py +1141 -0
  12. memos/config/__init__.py +99 -0
  13. memos/config/loader.py +397 -0
  14. memos/config/models.py +662 -0
  15. memos/config/prompts.py +562 -0
  16. memos/dashboard/__init__.py +4 -0
  17. memos/engine/__init__.py +35 -0
  18. memos/engine/extractor.py +872 -0
  19. memos/engine/memory.py +1111 -0
  20. memos/engine/review.py +809 -0
  21. memos/errors.py +141 -0
  22. memos/features/__init__.py +44 -0
  23. memos/features/backup.py +546 -0
  24. memos/features/notifications.py +212 -0
  25. memos/features/usage.py +232 -0
  26. memos/features/wizard.py +464 -0
  27. memos/hooks/__init__.py +5 -0
  28. memos/hooks/prompt.py +1235 -0
  29. memos/hooks/stop.py +132 -0
  30. memos/i18n.py +51 -0
  31. memos/server/__init__.py +8 -0
  32. memos/server/__main__.py +19 -0
  33. memos/server/mcp.py +553 -0
  34. memos/storage/__init__.py +28 -0
  35. memos/storage/base.py +31 -0
  36. memos/storage/chroma.py +234 -0
  37. memos/storage/embeddings.py +279 -0
  38. memos/web/__init__.py +8 -0
  39. memos/web/app.py +298 -0
  40. memos/web/auth.py +84 -0
  41. memos/web/models/__init__.py +61 -0
  42. memos/web/models/requests.py +314 -0
  43. memos/web/routes/__init__.py +18 -0
  44. memos/web/routes/auth.py +50 -0
  45. memos/web/routes/backups.py +116 -0
  46. memos/web/routes/config_routes.py +89 -0
  47. memos/web/routes/conversations.py +582 -0
  48. memos/web/routes/llm.py +126 -0
  49. memos/web/routes/memories.py +584 -0
  50. memos/web/routes/notifications.py +174 -0
  51. memos/web/routes/pages.py +63 -0
  52. memos/web/routes/prompts.py +379 -0
  53. memos/web/routes/search.py +55 -0
  54. memos/web/routes/suggestions.py +1225 -0
  55. memos/web/routes/system.py +532 -0
  56. memos/web/routes/todos.py +376 -0
  57. memos/web/services/__init__.py +0 -0
  58. memos/web/services/helpers.py +268 -0
@@ -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,58 @@
1
+ memomate-0.4.6.dist-info/licenses/LICENSE,sha256=WGUuJOcnKFZORM91S7avCpyVhWOapDbPyr4ggsSQDPI,1067
2
+ memos/__init__.py,sha256=f0pcH2jbdgHZQCbAPFZ6tr5lzks8KqUWXZXqQ7jD_zE,1069
3
+ memos/_version.py,sha256=QlYINYptvwKWC16uojxmWEY3Q-AWi0Lc26uPWkTxKyk,23
4
+ memos/errors.py,sha256=lL5LbuoEFCBpnfaTfVAJiRfVSfCdyUndZMU4PFkCD4U,4596
5
+ memos/i18n.py,sha256=56CUB9_YI6UQRsklmYYLzucOwK0wuIYNQKUdgOvo9i8,1719
6
+ memos/cli/__init__.py,sha256=b_x_eTWtcl8HvNVqBLX4cIYeWByVq2xpN7nOTQb9WNY,114
7
+ memos/cli/__main__.py,sha256=5Q3prNDw49vHg9OAfuxHvShkqD0csCQPnuqW6asy-S0,78
8
+ memos/cli/dispatch.py,sha256=PiAxP_LttO-AIJ831eA0C4hJTSg_Lu6hhrsh-4FnNpo,42926
9
+ memos/config/__init__.py,sha256=V-2T2YiEes81yGpEwZsQ81gVaQajdVGvrgiI1brPHF4,2316
10
+ memos/config/loader.py,sha256=r3yXuTgwCGxRQ9ojUt7ylq7Ys1Fw4jNtHMh-PY40XLs,15711
11
+ memos/config/models.py,sha256=4ZDIGCPX8h6o_SWcMnI1xjy2dZL3vuRNy4qgxasMrrU,27551
12
+ memos/config/prompts.py,sha256=4esul4d2m1ezEJE4pzagn9PcJnOrYRgSSvwF7j7R_x4,22120
13
+ memos/dashboard/__init__.py,sha256=9YRwrPwlchlGRqN5EjOQAAUGul4CPV43Lx1UVgIUJ7A,221
14
+ memos/engine/__init__.py,sha256=pGgTLbeIELi326kh5j-0SflzrW7NOpaJeleHt4IM-Y8,895
15
+ memos/engine/extractor.py,sha256=VMuPyYXanJNmXLFM9f819Mxmqgqx1nwkaMpXErfsE5s,36835
16
+ memos/engine/memory.py,sha256=ykHTKFRlzqpGM4UUKXXJJn6BKyA8fVqtay7IgiGac7M,44767
17
+ memos/engine/review.py,sha256=2tFyXZx_m4DxyiMSi2ze6nSsp_UkiiV1kE1f3SFsP1Y,31197
18
+ memos/features/__init__.py,sha256=JLRU44u7U1Zdwzry8MTHSjqTbHdQHu54Rm2KaR0iLcw,1189
19
+ memos/features/backup.py,sha256=UsbZJ_68c_yUsoN4DSXEb2krLQH0uobt9QubK_iuGgc,19018
20
+ memos/features/notifications.py,sha256=X80XuMl_Hcpeg_xqMYMhdJHwZZCLu6gwP_KHLP2aqPE,7272
21
+ memos/features/usage.py,sha256=4QDXF0C_Nc9JoPaXoVP2t048Nk24eMahnHeWAtn0SfY,9837
22
+ memos/features/wizard.py,sha256=2TI3K9X8_X_sScy4wJWMnv4Rj8vwvEfUaegRnkD6K6M,16841
23
+ memos/hooks/__init__.py,sha256=q0--LbIsrosI-AdLmyQZfHC6_2b7mq_6or5B_yTNF3U,249
24
+ memos/hooks/prompt.py,sha256=TMUDPt70woWhfLU1bF16g31E_9gKe4lKExiWcAwyIpk,46320
25
+ memos/hooks/stop.py,sha256=Ul2vDDqY9EwiKcJ3teM8VFj8z3IpMjA4gFHZPnuovsM,4203
26
+ memos/server/__init__.py,sha256=memUFE-2qn5Or-r5MR8xzxSoaG7HSZyCZVe3avJF8IM,194
27
+ memos/server/__main__.py,sha256=JgVIzb6A1oKF9EE1G-n1GeNTAsJSGyWmUnamj8qxe8o,490
28
+ memos/server/mcp.py,sha256=4CsMaQbitwhrLg8MFf9tAlbDme4X93dygreUPt4p_Wc,20534
29
+ memos/storage/__init__.py,sha256=HE4Xer73oR7StksvxPGDSmMwWhHgaA_Os8YhYAMdUHM,606
30
+ memos/storage/base.py,sha256=Blmngdo8n2-uklqRLjTVUVIAueeJYVnLj_XZJxhhWq4,935
31
+ memos/storage/chroma.py,sha256=WzEH-y8CVQGKBAiCT3ZmlHmTKvGoy-bYeCx6tKwJ80M,9417
32
+ memos/storage/embeddings.py,sha256=1gYsHC0N6orlxce_v-mW9HsOLARxt2ZKfiFi8ZZvb0c,10584
33
+ memos/web/__init__.py,sha256=VOkY7BA2Z0o0aZwalQtB2kqtGoKRhwJsw13CMiHDYP4,222
34
+ memos/web/app.py,sha256=XhrHHCEXKZKwXbmYVujcv8YFc_LXGiyo9PnVj62kWa8,10282
35
+ memos/web/auth.py,sha256=3dgjSdP-58V7P742hCV270qsev28g5LBg7mOLYJM00Q,2804
36
+ memos/web/models/__init__.py,sha256=nCgYC6HCGfF1vtQGqghjmvEDmuuKW6fnjJ7DDYClUys,1571
37
+ memos/web/models/requests.py,sha256=04-GW245ukwLG4nUkfe7akvYU1xJQjBub9msdQY_Fhw,8122
38
+ memos/web/routes/__init__.py,sha256=Hnztwc-npB0qiVmoZU_DrS2AM9wuErOVXPf9ySXWhrU,826
39
+ memos/web/routes/auth.py,sha256=obLcz9oYxhl4JW8fB8sDARZ7NXdtkYcU7GKTV51azv0,1553
40
+ memos/web/routes/backups.py,sha256=Cvg_v02D_Ut-5MhuQzbEfoDYRqh3A8LHEcNz1UKY_n8,3600
41
+ memos/web/routes/config_routes.py,sha256=8kg4HMwjuO5LMDoggwK_eC3LdIBH7I2td--fBm7Rd5g,3253
42
+ memos/web/routes/conversations.py,sha256=3kSeQIhvpDfsUzfwj0V-f6tU6VG53bQsoyIwGXlpZE0,21588
43
+ memos/web/routes/llm.py,sha256=4w8e-NydCi0uNXEkuwIoAWn4KwDZodCDk8FbU8TsKNI,4706
44
+ memos/web/routes/memories.py,sha256=4QrOTUq30kKw8c3nAl1Y2xbZxipCK3afUrZ4QwDwezQ,20563
45
+ memos/web/routes/notifications.py,sha256=Gc4LNUJpB1BaZncE7vMP7zFE1o8LYK5fTNIhKFheLuw,6029
46
+ memos/web/routes/pages.py,sha256=8vW4Yxb6rjTpBnwzMFc0cG7LndYihXo8STWWZcq4YRs,2257
47
+ memos/web/routes/prompts.py,sha256=0HY6mmYIkAmQ0sPTpGFbblMTVBb7R1dM-fKGkLyv5JA,13740
48
+ memos/web/routes/search.py,sha256=PNcTWX51hT7xEgh4yAqQ3HhsvM7UkDWVS_OeQxraFaA,1400
49
+ memos/web/routes/suggestions.py,sha256=6Ga185ZpH8o8Dpx_fQuo2JBm0FfGy9W1CC1Os1kEzzU,45487
50
+ memos/web/routes/system.py,sha256=2Kt3UqHv7WadyJfPDfu8YdMZLslDHxN4m8pngbkth2s,18452
51
+ memos/web/routes/todos.py,sha256=1dlVqkfE6pux-cPCfzEjIZRl5B7cp3-HKnCPG_vPQ38,13402
52
+ memos/web/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
+ memos/web/services/helpers.py,sha256=1lRoDuc8M8Qfu79hMXzK2S1F7odYAV5HHnO_6gycp1M,8675
54
+ memomate-0.4.6.dist-info/METADATA,sha256=rVt9jBv9Fqxr4XTJxNwSIRuZdwSvleYApvwyf4VIuwI,6590
55
+ memomate-0.4.6.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
56
+ memomate-0.4.6.dist-info/entry_points.txt,sha256=K3maUnEB_VGbbUoOK1JlG3PkgB7ImT6u0sVuGATdyZk,41
57
+ memomate-0.4.6.dist-info/top_level.txt,sha256=Zja3LUabhfiuQUP8L0kJQu9Ip5RjrOmHRp3dDoVvGd8,6
58
+ memomate-0.4.6.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ memos = memos.cli:main
@@ -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 @@
1
+ memos
memos/__init__.py ADDED
@@ -0,0 +1,38 @@
1
+ from memos._version import __version__
2
+ from memos.engine.extractor import MemoryExtractor, _estimate_tokens, format_conversation
3
+ from memos.engine.memory import DEFAULT_DECAY_LAMBDA, SIMILARITY_THRESHOLD, ContextMemory
4
+
5
+ # dashboard → web 迁移(向后兼容)
6
+ from memos.web import app, main
7
+
8
+
9
+ def __getattr__(name: str):
10
+ """惰性加载 server 模块,避免未安装 pywin32 时导入失败。"""
11
+ if name == "mcp":
12
+ from memos.server.mcp import mcp as _mcp
13
+
14
+ return _mcp
15
+ if name == "_detect_project_id":
16
+ from memos.server.mcp import _detect_project_id as _fn
17
+
18
+ return _fn
19
+ raise AttributeError(f"module 'memos' has no attribute {name!r}")
20
+
21
+
22
+ # 向后兼容别名(v0.4.2 改名,v0.5.0 移除)
23
+ LongTermMemory = ContextMemory
24
+
25
+ __all__ = [
26
+ "__version__",
27
+ "ContextMemory",
28
+ "LongTermMemory", # 向后兼容别名
29
+ "SIMILARITY_THRESHOLD",
30
+ "DEFAULT_DECAY_LAMBDA",
31
+ "MemoryExtractor",
32
+ "format_conversation",
33
+ "_estimate_tokens",
34
+ "mcp",
35
+ "_detect_project_id",
36
+ "app",
37
+ "main",
38
+ ]
memos/_version.py ADDED
@@ -0,0 +1 @@
1
+ __version__ = "0.4.6"
memos/cli/__init__.py ADDED
@@ -0,0 +1,8 @@
1
+ """MEMOS CLI 层。
2
+
3
+ v0.4.3 架构重整 Phase 10。
4
+ """
5
+
6
+ from memos.cli.dispatch import main
7
+
8
+ __all__ = ["main"]
memos/cli/__main__.py ADDED
@@ -0,0 +1,5 @@
1
+ """python -m memos.cli 入口"""
2
+
3
+ from memos.cli.dispatch import main
4
+
5
+ main()