Skip to content

Commit c514f60

Browse files
authored
Merge branch 'dev-20260302-v2.0.8' into fix/unicode-sanitization-embedders
2 parents 9d2f9be + fec9978 commit c514f60

File tree

115 files changed

+10600
-3489
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+10600
-3489
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,17 @@ Get Free API: [Try API](https://memos-dashboard.openmem.net/quickstart/?source=g
6464

6565
<br>
6666

67+
## 🦞 Enhanced OpenClaw with MemOS Plugin
68+
![](https://cdn.memtensor.com.cn/img/1770612303123_mnaisk_compressed.png)
69+
70+
- [**72% lower token usage**](https://x.com/MemOS_dev/status/2020854044583924111) – intelligent memory retrieval instead of loading full chat history
71+
- [**Multi-agent memory sharing**](https://x.com/MemOS_dev/status/2020538135487062094) – multi-instance agents share memory via same user_id. Automatic context handoff.
72+
73+
🦞 Your lobster now has a working memory system.
74+
75+
Get your API key: [MemOS Dashboard](https://memos-dashboard.openmem.net/cn/login/)
76+
Try it: Full tutorial → [MemOS-Cloud-OpenClaw-Plugin](https://github.com/MemTensor/MemOS-Cloud-OpenClaw-Plugin)
77+
6778
## 📌 MemOS: Memory Operating System for AI Agents
6879

6980
**MemOS** is a Memory Operating System for LLMs and AI agents that unifies **store / retrieve / manage** for long-term memory, enabling **context-aware and personalized** interactions with **KB**, **multi-modal**, **tool memory**, and **enterprise-grade** optimizations built in.

docker/Dockerfile.krolik

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# MemOS with Krolik Security Extensions
2+
#
3+
# This Dockerfile builds MemOS with authentication, rate limiting, and admin API.
4+
# It uses the overlay pattern to keep customizations separate from base code.
5+
6+
FROM python:3.11-slim
7+
8+
# Install system dependencies
9+
RUN apt-get update && apt-get install -y --no-install-recommends \
10+
gcc \
11+
g++ \
12+
build-essential \
13+
libffi-dev \
14+
python3-dev \
15+
curl \
16+
libpq-dev \
17+
&& rm -rf /var/lib/apt/lists/*
18+
19+
# Create non-root user
20+
RUN groupadd -r memos && useradd -r -g memos -u 1000 memos
21+
22+
WORKDIR /app
23+
24+
# Use official Hugging Face
25+
ENV HF_ENDPOINT=https://huggingface.co
26+
27+
# Copy base MemOS source
28+
COPY src/ ./src/
29+
COPY pyproject.toml ./
30+
31+
# Install base dependencies
32+
RUN pip install --upgrade pip && \
33+
pip install --no-cache-dir poetry && \
34+
poetry config virtualenvs.create false && \
35+
poetry install --no-dev --extras "tree-mem mem-scheduler"
36+
37+
# Install additional dependencies for Krolik
38+
RUN pip install --no-cache-dir \
39+
sentence-transformers \
40+
torch \
41+
transformers \
42+
psycopg2-binary \
43+
redis
44+
45+
# Apply Krolik overlay (AFTER base install to allow easy updates)
46+
COPY overlays/krolik/ ./src/memos/
47+
48+
# Create data directory
49+
RUN mkdir -p /data/memos && chown -R memos:memos /data/memos
50+
RUN chown -R memos:memos /app
51+
52+
# Set Python path
53+
ENV PYTHONPATH=/app/src
54+
55+
# Switch to non-root user
56+
USER memos
57+
58+
EXPOSE 8000
59+
60+
# Healthcheck
61+
HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=60s \
62+
CMD curl -f http://localhost:8000/health || exit 1
63+
64+
# Use extended entry point with security features
65+
CMD ["gunicorn", "memos.api.server_api_ext:app", "--preload", "-w", "2", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8000", "--timeout", "120"]

examples/mem_agent/deepsearch_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def factory_initialization() -> tuple[DeepSearchMemAgent, dict[str, Any]]:
179179

180180

181181
def main():
182-
agent_factory, components_factory = factory_initialization()
182+
agent_factory, _components_factory = factory_initialization()
183183
results = agent_factory.run(
184184
"Caroline met up with friends, family, and mentors in early July 2023.",
185185
user_id="locomo_exp_user_0_speaker_b_ct-1118",

examples/mem_scheduler/memos_w_scheduler.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ def init_task():
8484
return conversations, questions
8585

8686

87-
working_memories = []
87+
default_mem_update_handler = mem_scheduler.handlers.get(MEM_UPDATE_TASK_LABEL)
88+
if default_mem_update_handler is None:
89+
logger.warning("Default MEM_UPDATE handler not found; custom handler will be a no-op.")
8890

8991

9092
# Define custom query handler function
@@ -100,24 +102,11 @@ def custom_query_handler(messages: list[ScheduleMessageItem]):
100102

101103
# Define custom memory update handler function
102104
def custom_mem_update_handler(messages: list[ScheduleMessageItem]):
103-
global working_memories
104-
search_args = {}
105-
top_k = 2
106-
for msg in messages:
107-
# Search for memories relevant to the current content in text memory (return top_k=2)
108-
results = mem_scheduler.retriever.search(
109-
query=msg.content,
110-
user_id=msg.user_id,
111-
mem_cube_id=msg.mem_cube_id,
112-
mem_cube=mem_scheduler.current_mem_cube,
113-
top_k=top_k,
114-
method=mem_scheduler.search_method,
115-
search_args=search_args,
116-
)
117-
working_memories.extend(results)
118-
working_memories = working_memories[-5:]
119-
for mem in results:
120-
print(f"\n[scheduler] Retrieved memory: {mem.memory}")
105+
if default_mem_update_handler is None:
106+
logger.error("Default MEM_UPDATE handler missing; cannot process messages.")
107+
return
108+
# Delegate to the built-in handler to keep behavior aligned with scheduler refactor.
109+
default_mem_update_handler(messages)
121110

122111

123112
async def run_with_scheduler():

examples/mem_scheduler/try_schedule_modules.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ def add_msgs(
167167
label=MEM_UPDATE_TASK_LABEL,
168168
content=query,
169169
)
170-
# Run one session turn manually to get search candidates
171-
mem_scheduler._memory_update_consumer(
172-
messages=[message],
173-
)
170+
# Run one session turn manually via registered handler (public surface)
171+
handler = mem_scheduler.handlers.get(MEM_UPDATE_TASK_LABEL)
172+
if handler is None:
173+
raise RuntimeError("MEM_UPDATE handler not registered on mem_scheduler.")
174+
handler([message])

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
##############################################################################
55

66
name = "MemoryOS"
7-
version = "2.0.4"
7+
version = "2.0.6"
88
description = "Intelligence Begins with Memory"
99
license = {text = "Apache-2.0"}
1010
readme = "README.md"

src/__init__.py

Whitespace-only changes.

src/memos/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "2.0.4"
1+
__version__ = "2.0.6"
22

33
from memos.configs.mem_cube import GeneralMemCubeConfig
44
from memos.configs.mem_os import MOSConfig

src/memos/api/README_api.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# MemOS API
2+
3+
## Default entry and deployment
4+
5+
- Use **`server_api.py`** as the API service entry for **public open-source usage**.
6+
- You can deploy via **`docker/Dockerfile`**.
7+
8+
The above is the default, general way to run and deploy the API.
9+
10+
## Extensions and reference implementations
11+
12+
- **`server_api_ext.py`** and **`Dockerfile.krolik`** are one developer’s extended API and deployment setup, **for reference only**. They are not yet integrated with cloud services and are still in testing.
13+
- If you need extensions or custom behavior, you can refer to these and use or adapt them as you like.

src/memos/api/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)