8cb4f09ded
Six independent fixes that make hook behaviour deterministic, debuggable, and free of silent footguns. Persist session_id in stored memories on_pre_compact.py now extracts session_id from the hook input and writes it under metadata.session_id, enabling search-by-session. Skip SessionStart bootstrap when MEM0_API_KEY is missing on_session_start.sh exits 0 early instead of emitting bootstrap text that instructs the agent to call mem0 MCP tools that would all fail without a key. Tighten block_memory_write.sh regex The old `*/memory/*.md` pattern blocked legitimate paths like docs/memory/architecture.md. New pattern blocks `*/MEMORY.md` and `*/.claude/memory/*` only -- the actual surfaces we want to protect. Opt-in debug logging via MEM0_DEBUG=1 Each hook (bash + python) redirects stderr / adds a FileHandler to ~/.mem0/hooks.log when MEM0_DEBUG is set. No helper module, no rotation -- KISS. Default behaviour is unchanged. Drop the duplicate PreCompact registration hooks.json and cursor-hooks.json had on_pre_compact.sh AND on_pre_compact.py registered on PreCompact, producing duplicate session-state writes. Drop the python entry. The python script stays alive -- on_stop.sh still spawns it as a session-end safety net. CI nudge Adds a single comment line to pyproject.toml because the repo's ci.yml path filters exclude mem0-plugin/-only PRs but the build_mem0/build_embedchain status checks are required by branch protection. Track the proper fix (path-conditional CI) as a follow-up.
158 lines
2.9 KiB
TOML
158 lines
2.9 KiB
TOML
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[project]
|
|
name = "mem0ai"
|
|
version = "2.0.1"
|
|
description = "Long-term memory for AI Agents"
|
|
authors = [
|
|
{ name = "Mem0", email = "support@mem0.ai" }
|
|
]
|
|
readme = "README.md"
|
|
license = "Apache-2.0"
|
|
license-files = ["LICENSE"]
|
|
requires-python = ">=3.10,<4.0"
|
|
dependencies = [
|
|
"qdrant-client>=1.12.0",
|
|
"pydantic>=2.7.3",
|
|
"openai>=1.90.0",
|
|
"posthog>=4.5.0",
|
|
"pytz>=2024.1",
|
|
"sqlalchemy>=2.0.31",
|
|
"protobuf>=5.29.6,<7.0.0",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
nlp = [
|
|
"spacy>=3.7.0",
|
|
]
|
|
vector_stores = [
|
|
"vecs>=0.4.0",
|
|
"chromadb>=0.4.24",
|
|
"cassandra-driver>=3.29.0",
|
|
"weaviate-client>=4.15.4,<5.0.0",
|
|
"pinecone<=7.3.0",
|
|
"pinecone-text>=0.10.0",
|
|
"faiss-cpu>=1.7.4",
|
|
"upstash-vector>=0.6.0",
|
|
"azure-search-documents>=11.4.0b8",
|
|
"psycopg>=3.2.8",
|
|
"psycopg-pool>=3.2.6,<4.0.0",
|
|
"pymongo>=4.13.2",
|
|
"pymochow>=2.2.9",
|
|
"pymysql>=1.1.0",
|
|
"dbutils>=3.0.3",
|
|
"valkey>=6.0.0",
|
|
"databricks-sdk>=0.63.0",
|
|
"azure-identity>=1.24.0",
|
|
"redis>=5.0.0,<6.0.0",
|
|
"redisvl>=0.1.0,<1.0.0",
|
|
"elasticsearch>=8.0.0,<9.0.0",
|
|
"pymilvus>=2.4.0,<2.6.0",
|
|
"langchain-aws>=0.2.23,<0.3.0",
|
|
]
|
|
llms = [
|
|
"groq>=0.3.0",
|
|
"together>=0.2.10",
|
|
"litellm>=1.83.7",
|
|
"openai>=1.90.0",
|
|
"ollama>=0.3.0",
|
|
"vertexai>=0.1.0",
|
|
"google-generativeai>=0.3.0",
|
|
"google-genai>=1.0.0",
|
|
]
|
|
extras = [
|
|
"boto3>=1.34.0",
|
|
"langchain>=0.3.0,<1.0.0",
|
|
"langchain-community>=0.3.0,<1.0.0",
|
|
"langchain-core>=0.3.81,<1.0.0",
|
|
"sentence-transformers>=5.0.0",
|
|
"elasticsearch>=8.0.0,<9.0.0",
|
|
"opensearch-py>=2.0.0",
|
|
"fastembed>=0.3.1",
|
|
]
|
|
test = [
|
|
"pytest>=8.2.2",
|
|
"pytest-mock>=3.14.0",
|
|
"pytest-asyncio>=0.23.7",
|
|
]
|
|
dev = [
|
|
"ruff>=0.6.5",
|
|
"isort>=5.13.2",
|
|
"pytest>=8.2.2",
|
|
]
|
|
|
|
[tool.pytest.ini_options]
|
|
pythonpath = ["."]
|
|
|
|
[tool.hatch.build]
|
|
include = [
|
|
"mem0/**/*.py",
|
|
]
|
|
exclude = [
|
|
"**/*",
|
|
"!mem0/**/*.py",
|
|
]
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["mem0"]
|
|
only-include = ["mem0"]
|
|
|
|
[tool.hatch.envs.dev_py_3_10]
|
|
python = "3.10"
|
|
features = [
|
|
"test",
|
|
"vector_stores",
|
|
"llms",
|
|
"extras",
|
|
]
|
|
|
|
[tool.hatch.envs.dev_py_3_11]
|
|
python = "3.11"
|
|
features = [
|
|
"test",
|
|
"vector_stores",
|
|
"llms",
|
|
"extras",
|
|
]
|
|
|
|
[tool.hatch.envs.dev_py_3_12]
|
|
python = "3.12"
|
|
features = [
|
|
"test",
|
|
"vector_stores",
|
|
"llms",
|
|
"extras",
|
|
]
|
|
|
|
[tool.hatch.envs.default.scripts]
|
|
format = [
|
|
"ruff format",
|
|
]
|
|
format-check = [
|
|
"ruff format --check",
|
|
]
|
|
lint = [
|
|
"ruff check",
|
|
]
|
|
lint-fix = [
|
|
"ruff check --fix",
|
|
]
|
|
test = [
|
|
"pytest tests/ {args}",
|
|
]
|
|
|
|
[tool.ruff]
|
|
line-length = 120
|
|
exclude = ["embedchain/", "openmemory/"]
|
|
|
|
[tool.ruff.lint.isort]
|
|
known-first-party = ["mem0", "mem0_cli"]
|
|
|
|
[tool.isort]
|
|
profile = "black"
|
|
known_first_party = ["mem0", "mem0_cli"]
|
|
# isort scope kept aligned with [tool.ruff.lint.isort] above.
|
|
# black-equivalent profile here matches the formatter behaviour ruff applies.
|