memorymesh 2.0.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.
- memorymesh-2.0.0/.github/ISSUE_TEMPLATE/bug_report.md +47 -0
- memorymesh-2.0.0/.github/ISSUE_TEMPLATE/feature_request.md +35 -0
- memorymesh-2.0.0/.github/PULL_REQUEST_TEMPLATE.md +34 -0
- memorymesh-2.0.0/.github/workflows/ci.yml +54 -0
- memorymesh-2.0.0/.github/workflows/docs.yml +52 -0
- memorymesh-2.0.0/.github/workflows/publish.yml +67 -0
- memorymesh-2.0.0/.gitignore +76 -0
- memorymesh-2.0.0/CLAUDE.md +122 -0
- memorymesh-2.0.0/CONTRIBUTING.md +163 -0
- memorymesh-2.0.0/GEMINI.md +138 -0
- memorymesh-2.0.0/LICENSE +21 -0
- memorymesh-2.0.0/Makefile +32 -0
- memorymesh-2.0.0/PKG-INFO +267 -0
- memorymesh-2.0.0/README.md +222 -0
- memorymesh-2.0.0/benchmarks/README.md +45 -0
- memorymesh-2.0.0/benchmarks/__init__.py +0 -0
- memorymesh-2.0.0/benchmarks/__main__.py +5 -0
- memorymesh-2.0.0/benchmarks/bench_memorymesh.py +592 -0
- memorymesh-2.0.0/benchmarks/results.json +213 -0
- memorymesh-2.0.0/docs/api.md +161 -0
- memorymesh-2.0.0/docs/architecture.md +102 -0
- memorymesh-2.0.0/docs/assets/favicon.svg +16 -0
- memorymesh-2.0.0/docs/assets/icons/claude.svg +4 -0
- memorymesh-2.0.0/docs/assets/icons/cursor.svg +4 -0
- memorymesh-2.0.0/docs/assets/icons/gemini.svg +10 -0
- memorymesh-2.0.0/docs/assets/icons/github.svg +3 -0
- memorymesh-2.0.0/docs/assets/icons/llama.svg +7 -0
- memorymesh-2.0.0/docs/assets/icons/mcp.svg +11 -0
- memorymesh-2.0.0/docs/assets/icons/mistral.svg +10 -0
- memorymesh-2.0.0/docs/assets/icons/ollama.svg +7 -0
- memorymesh-2.0.0/docs/assets/icons/openai.svg +3 -0
- memorymesh-2.0.0/docs/assets/icons/windsurf.svg +4 -0
- memorymesh-2.0.0/docs/assets/logo.svg +19 -0
- memorymesh-2.0.0/docs/benchmarks.md +69 -0
- memorymesh-2.0.0/docs/cli.md +42 -0
- memorymesh-2.0.0/docs/configuration.md +327 -0
- memorymesh-2.0.0/docs/contributing.md +139 -0
- memorymesh-2.0.0/docs/faq.md +57 -0
- memorymesh-2.0.0/docs/getting-started.md +230 -0
- memorymesh-2.0.0/docs/index.md +274 -0
- memorymesh-2.0.0/docs/mcp-server.md +393 -0
- memorymesh-2.0.0/docs/multi-tool-sync.md +54 -0
- memorymesh-2.0.0/docs/overrides/.gitkeep +0 -0
- memorymesh-2.0.0/docs/strategy.md +140 -0
- memorymesh-2.0.0/docs/stylesheets/extra.css +1053 -0
- memorymesh-2.0.0/examples/demo_chat.py +571 -0
- memorymesh-2.0.0/examples/quickstart.py +23 -0
- memorymesh-2.0.0/examples/with_any_llm.py +36 -0
- memorymesh-2.0.0/examples/with_ollama.py +26 -0
- memorymesh-2.0.0/examples/with_openai.py +31 -0
- memorymesh-2.0.0/mkdocs.yml +101 -0
- memorymesh-2.0.0/pyproject.toml +127 -0
- memorymesh-2.0.0/src/memorymesh/__init__.py +125 -0
- memorymesh-2.0.0/src/memorymesh/auto_importance.py +247 -0
- memorymesh-2.0.0/src/memorymesh/categories.py +216 -0
- memorymesh-2.0.0/src/memorymesh/cli.py +883 -0
- memorymesh-2.0.0/src/memorymesh/compaction.py +372 -0
- memorymesh-2.0.0/src/memorymesh/core.py +911 -0
- memorymesh-2.0.0/src/memorymesh/embeddings.py +499 -0
- memorymesh-2.0.0/src/memorymesh/encryption.py +481 -0
- memorymesh-2.0.0/src/memorymesh/formats/__init__.py +387 -0
- memorymesh-2.0.0/src/memorymesh/formats/_shared.py +288 -0
- memorymesh-2.0.0/src/memorymesh/formats/claude.py +280 -0
- memorymesh-2.0.0/src/memorymesh/formats/codex.py +249 -0
- memorymesh-2.0.0/src/memorymesh/formats/gemini.py +268 -0
- memorymesh-2.0.0/src/memorymesh/html_export.py +415 -0
- memorymesh-2.0.0/src/memorymesh/init_cmd.py +280 -0
- memorymesh-2.0.0/src/memorymesh/mcp_server.py +1004 -0
- memorymesh-2.0.0/src/memorymesh/memory.py +176 -0
- memorymesh-2.0.0/src/memorymesh/migrations.py +208 -0
- memorymesh-2.0.0/src/memorymesh/relevance.py +234 -0
- memorymesh-2.0.0/src/memorymesh/report.py +341 -0
- memorymesh-2.0.0/src/memorymesh/store.py +525 -0
- memorymesh-2.0.0/src/memorymesh/sync.py +152 -0
- memorymesh-2.0.0/tests/__init__.py +0 -0
- memorymesh-2.0.0/tests/test_auto_compact.py +89 -0
- memorymesh-2.0.0/tests/test_auto_importance.py +426 -0
- memorymesh-2.0.0/tests/test_categories.py +132 -0
- memorymesh-2.0.0/tests/test_cli.py +327 -0
- memorymesh-2.0.0/tests/test_compaction.py +453 -0
- memorymesh-2.0.0/tests/test_core.py +187 -0
- memorymesh-2.0.0/tests/test_dual_store.py +595 -0
- memorymesh-2.0.0/tests/test_embeddings.py +118 -0
- memorymesh-2.0.0/tests/test_encryption.py +575 -0
- memorymesh-2.0.0/tests/test_episodic.py +485 -0
- memorymesh-2.0.0/tests/test_formats/__init__.py +0 -0
- memorymesh-2.0.0/tests/test_formats/test_claude_adapter.py +141 -0
- memorymesh-2.0.0/tests/test_formats/test_codex_adapter.py +235 -0
- memorymesh-2.0.0/tests/test_formats/test_gemini_adapter.py +225 -0
- memorymesh-2.0.0/tests/test_formats/test_registry.py +69 -0
- memorymesh-2.0.0/tests/test_formats/test_shared.py +159 -0
- memorymesh-2.0.0/tests/test_html_export.py +205 -0
- memorymesh-2.0.0/tests/test_init_cmd.py +132 -0
- memorymesh-2.0.0/tests/test_memory.py +152 -0
- memorymesh-2.0.0/tests/test_migrations.py +259 -0
- memorymesh-2.0.0/tests/test_relevance.py +216 -0
- memorymesh-2.0.0/tests/test_report.py +137 -0
- memorymesh-2.0.0/tests/test_session_start.py +178 -0
- memorymesh-2.0.0/tests/test_store.py +173 -0
- memorymesh-2.0.0/tests/test_sync.py +248 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report
|
|
3
|
+
about: Report a bug to help us improve MemoryMesh
|
|
4
|
+
title: "[Bug] "
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Description
|
|
10
|
+
|
|
11
|
+
A clear and concise description of the bug.
|
|
12
|
+
|
|
13
|
+
## Steps to Reproduce
|
|
14
|
+
|
|
15
|
+
1. Install MemoryMesh with `pip install memorymesh`
|
|
16
|
+
2. Run the following code:
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
from memorymesh import MemoryMesh
|
|
20
|
+
# Minimal code to reproduce the issue
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
3. Observe the error.
|
|
24
|
+
|
|
25
|
+
## Expected Behavior
|
|
26
|
+
|
|
27
|
+
A clear description of what you expected to happen.
|
|
28
|
+
|
|
29
|
+
## Actual Behavior
|
|
30
|
+
|
|
31
|
+
A clear description of what actually happened. Include any error messages or tracebacks.
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Paste error output here
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Environment
|
|
38
|
+
|
|
39
|
+
- **OS:** (e.g., Ubuntu 22.04, macOS 14, Windows 11)
|
|
40
|
+
- **Python version:** (e.g., 3.12.1)
|
|
41
|
+
- **MemoryMesh version:** (e.g., 0.1.0)
|
|
42
|
+
- **Embedding provider:** (e.g., none, local, ollama, openai)
|
|
43
|
+
- **Installation method:** (e.g., `pip install memorymesh`, `pip install memorymesh[local]`)
|
|
44
|
+
|
|
45
|
+
## Additional Context
|
|
46
|
+
|
|
47
|
+
Add any other context about the problem here (screenshots, related issues, etc.).
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request
|
|
3
|
+
about: Suggest a new feature or improvement for MemoryMesh
|
|
4
|
+
title: "[Feature] "
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Description
|
|
10
|
+
|
|
11
|
+
A clear and concise description of the feature you would like to see.
|
|
12
|
+
|
|
13
|
+
## Use Case
|
|
14
|
+
|
|
15
|
+
Describe the problem or workflow this feature would address. Why is this feature important to you?
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
# If applicable, show how you imagine using this feature:
|
|
19
|
+
from memorymesh import MemoryMesh
|
|
20
|
+
|
|
21
|
+
memory = MemoryMesh()
|
|
22
|
+
# Example usage of the proposed feature
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Proposed Solution
|
|
26
|
+
|
|
27
|
+
Describe how you think this feature should work. Include API design ideas if you have them.
|
|
28
|
+
|
|
29
|
+
## Alternatives Considered
|
|
30
|
+
|
|
31
|
+
Describe any alternative solutions or workarounds you have considered.
|
|
32
|
+
|
|
33
|
+
## Additional Context
|
|
34
|
+
|
|
35
|
+
Add any other context, references, or screenshots about the feature request here.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
|
|
3
|
+
Describe the changes in this pull request. What problem does it solve? Link any related issues.
|
|
4
|
+
|
|
5
|
+
Closes #(issue number)
|
|
6
|
+
|
|
7
|
+
## Type of Change
|
|
8
|
+
|
|
9
|
+
- [ ] Bug fix (non-breaking change that fixes an issue)
|
|
10
|
+
- [ ] New feature (non-breaking change that adds functionality)
|
|
11
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
|
|
12
|
+
- [ ] Documentation update
|
|
13
|
+
- [ ] Refactoring (no functional changes)
|
|
14
|
+
- [ ] CI/Build configuration change
|
|
15
|
+
|
|
16
|
+
## How Has This Been Tested?
|
|
17
|
+
|
|
18
|
+
Describe the tests you ran to verify your changes. Provide instructions so reviewers can reproduce.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
make test
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Checklist
|
|
25
|
+
|
|
26
|
+
- [ ] My code follows the project code style
|
|
27
|
+
- [ ] I have added type hints to all public functions and methods
|
|
28
|
+
- [ ] I have added docstrings to all public classes, methods, and functions
|
|
29
|
+
- [ ] I have added tests that prove my fix or feature works
|
|
30
|
+
- [ ] All new and existing tests pass (`make test`)
|
|
31
|
+
- [ ] The linter passes (`make lint`)
|
|
32
|
+
- [ ] The type checker passes (`make typecheck`)
|
|
33
|
+
- [ ] I have updated documentation if needed
|
|
34
|
+
- [ ] My changes do not introduce new warnings
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
name: Lint
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Set up Python
|
|
17
|
+
uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.12"
|
|
20
|
+
|
|
21
|
+
- name: Install dependencies
|
|
22
|
+
run: pip install -e ".[dev]"
|
|
23
|
+
|
|
24
|
+
- name: Run ruff linter
|
|
25
|
+
run: ruff check src/ tests/
|
|
26
|
+
|
|
27
|
+
- name: Run ruff formatter check
|
|
28
|
+
run: ruff format --check src/ tests/
|
|
29
|
+
|
|
30
|
+
- name: Run mypy
|
|
31
|
+
run: mypy src/
|
|
32
|
+
|
|
33
|
+
test:
|
|
34
|
+
name: Test (Python ${{ matrix.python-version }}, ${{ matrix.os }})
|
|
35
|
+
runs-on: ${{ matrix.os }}
|
|
36
|
+
strategy:
|
|
37
|
+
fail-fast: false
|
|
38
|
+
matrix:
|
|
39
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
40
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
41
|
+
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/checkout@v4
|
|
44
|
+
|
|
45
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
46
|
+
uses: actions/setup-python@v5
|
|
47
|
+
with:
|
|
48
|
+
python-version: ${{ matrix.python-version }}
|
|
49
|
+
|
|
50
|
+
- name: Install dependencies
|
|
51
|
+
run: pip install -e ".[dev]"
|
|
52
|
+
|
|
53
|
+
- name: Run tests
|
|
54
|
+
run: pytest tests/ -v --tb=short
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: Deploy Docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths:
|
|
7
|
+
- 'docs/**'
|
|
8
|
+
- 'mkdocs.yml'
|
|
9
|
+
- '.github/workflows/docs.yml'
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
pages: write
|
|
15
|
+
id-token: write
|
|
16
|
+
|
|
17
|
+
concurrency:
|
|
18
|
+
group: "pages"
|
|
19
|
+
cancel-in-progress: true
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
build:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
|
|
27
|
+
- name: Set up Python
|
|
28
|
+
uses: actions/setup-python@v5
|
|
29
|
+
with:
|
|
30
|
+
python-version: "3.12"
|
|
31
|
+
|
|
32
|
+
- name: Install dependencies
|
|
33
|
+
run: pip install mkdocs-material>=9.0
|
|
34
|
+
|
|
35
|
+
- name: Build site
|
|
36
|
+
run: mkdocs build --strict
|
|
37
|
+
|
|
38
|
+
- name: Upload artifact
|
|
39
|
+
uses: actions/upload-pages-artifact@v3
|
|
40
|
+
with:
|
|
41
|
+
path: site/
|
|
42
|
+
|
|
43
|
+
deploy:
|
|
44
|
+
needs: build
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
environment:
|
|
47
|
+
name: github-pages
|
|
48
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
49
|
+
steps:
|
|
50
|
+
- name: Deploy to GitHub Pages
|
|
51
|
+
id: deployment
|
|
52
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
id-token: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
name: Build distribution
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Set up Python
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.12"
|
|
22
|
+
|
|
23
|
+
- name: Install build tools
|
|
24
|
+
run: pip install build
|
|
25
|
+
|
|
26
|
+
- name: Build package
|
|
27
|
+
run: python -m build
|
|
28
|
+
|
|
29
|
+
- name: Upload artifact
|
|
30
|
+
uses: actions/upload-artifact@v4
|
|
31
|
+
with:
|
|
32
|
+
name: dist
|
|
33
|
+
path: dist/
|
|
34
|
+
|
|
35
|
+
publish-testpypi:
|
|
36
|
+
name: Publish to TestPyPI
|
|
37
|
+
needs: build
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
if: github.event_name == 'workflow_dispatch'
|
|
40
|
+
environment: testpypi
|
|
41
|
+
steps:
|
|
42
|
+
- name: Download artifact
|
|
43
|
+
uses: actions/download-artifact@v4
|
|
44
|
+
with:
|
|
45
|
+
name: dist
|
|
46
|
+
path: dist/
|
|
47
|
+
|
|
48
|
+
- name: Publish to TestPyPI
|
|
49
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
50
|
+
with:
|
|
51
|
+
repository-url: https://test.pypi.org/legacy/
|
|
52
|
+
|
|
53
|
+
publish-pypi:
|
|
54
|
+
name: Publish to PyPI
|
|
55
|
+
needs: build
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
if: github.event_name == 'release'
|
|
58
|
+
environment: pypi
|
|
59
|
+
steps:
|
|
60
|
+
- name: Download artifact
|
|
61
|
+
uses: actions/download-artifact@v4
|
|
62
|
+
with:
|
|
63
|
+
name: dist
|
|
64
|
+
path: dist/
|
|
65
|
+
|
|
66
|
+
- name: Publish to PyPI
|
|
67
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Python byte-compiled / optimized files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# Distribution / packaging
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
*.egg-info/
|
|
10
|
+
*.egg
|
|
11
|
+
eggs/
|
|
12
|
+
wheels/
|
|
13
|
+
MANIFEST
|
|
14
|
+
|
|
15
|
+
# Virtual environments
|
|
16
|
+
.venv/
|
|
17
|
+
venv/
|
|
18
|
+
env/
|
|
19
|
+
ENV/
|
|
20
|
+
|
|
21
|
+
# Testing
|
|
22
|
+
.pytest_cache/
|
|
23
|
+
.coverage
|
|
24
|
+
.coverage.*
|
|
25
|
+
htmlcov/
|
|
26
|
+
coverage.xml
|
|
27
|
+
*.cover
|
|
28
|
+
|
|
29
|
+
# Type checking
|
|
30
|
+
.mypy_cache/
|
|
31
|
+
.dmypy.json
|
|
32
|
+
dmypy.json
|
|
33
|
+
|
|
34
|
+
# Linting
|
|
35
|
+
.ruff_cache/
|
|
36
|
+
|
|
37
|
+
# IDEs and editors
|
|
38
|
+
.idea/
|
|
39
|
+
.vscode/
|
|
40
|
+
*.swp
|
|
41
|
+
*.swo
|
|
42
|
+
*~
|
|
43
|
+
.project
|
|
44
|
+
.settings/
|
|
45
|
+
|
|
46
|
+
# OS files
|
|
47
|
+
.DS_Store
|
|
48
|
+
Thumbs.db
|
|
49
|
+
Desktop.ini
|
|
50
|
+
|
|
51
|
+
# Environment variables
|
|
52
|
+
.env
|
|
53
|
+
.env.local
|
|
54
|
+
.env.*.local
|
|
55
|
+
|
|
56
|
+
# SQLite databases (user data, not committed)
|
|
57
|
+
*.db
|
|
58
|
+
*.sqlite
|
|
59
|
+
*.sqlite3
|
|
60
|
+
|
|
61
|
+
# MemoryMesh project-local data directory
|
|
62
|
+
.memorymesh/
|
|
63
|
+
|
|
64
|
+
# Node (in case of any JS tooling)
|
|
65
|
+
node_modules/
|
|
66
|
+
|
|
67
|
+
# Jupyter
|
|
68
|
+
.ipynb_checkpoints/
|
|
69
|
+
|
|
70
|
+
# MkDocs site output
|
|
71
|
+
site/
|
|
72
|
+
|
|
73
|
+
# Build artifacts
|
|
74
|
+
*.so
|
|
75
|
+
*.dylib
|
|
76
|
+
*.dll
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# CLAUDE.md - Guidance for Claude Code
|
|
2
|
+
|
|
3
|
+
## Repository Purpose
|
|
4
|
+
|
|
5
|
+
MemoryMesh is an open-source, embeddable AI memory library. It provides persistent, intelligent memory for any LLM application using SQLite as the storage backend. The design philosophy mirrors SQLite itself: simple, reliable, zero-dependency, and embeddable.
|
|
6
|
+
|
|
7
|
+
## Key Entry Points
|
|
8
|
+
|
|
9
|
+
- `src/memorymesh/core.py` -- The main `MemoryMesh` class. This is the primary public API and the starting point for understanding the codebase.
|
|
10
|
+
- `src/memorymesh/store.py` -- SQLite storage layer. Handles all database operations, schema management, and memory persistence.
|
|
11
|
+
- `src/memorymesh/embeddings.py` -- Pluggable embedding providers. Abstracts over local (sentence-transformers), Ollama, OpenAI, and keyword-based matching.
|
|
12
|
+
- `src/memorymesh/relevance.py` -- Relevance scoring engine. Combines vector similarity, keyword overlap, and time-based decay to rank memories.
|
|
13
|
+
- `src/memorymesh/mcp_server.py` -- MCP (Model Context Protocol) server. Exposes memory tools over stdin/stdout JSON-RPC for use with Claude Code, Cursor, and other MCP-compatible clients.
|
|
14
|
+
- `src/memorymesh/memory.py` -- The `Memory` dataclass. Defines the core data model used throughout the library.
|
|
15
|
+
|
|
16
|
+
## Architecture
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
core.py (public API: remember / recall / forget)
|
|
20
|
+
-> store.py (SQLite read/write, schema migrations)
|
|
21
|
+
- project store: <project-root>/.memorymesh/memories.db
|
|
22
|
+
- global store: ~/.memorymesh/global.db
|
|
23
|
+
-> embeddings.py (pluggable: local, ollama, openai, none)
|
|
24
|
+
-> relevance.py (scoring: similarity + keywords + time decay)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
MemoryMesh uses a **hybrid dual-store** pattern:
|
|
28
|
+
|
|
29
|
+
- **Project store** (`<project-root>/.memorymesh/memories.db`) -- project-specific memories, decisions, and patterns. Isolated per project.
|
|
30
|
+
- **Global store** (`~/.memorymesh/global.db`) -- user preferences, identity, and cross-project facts. Shared across all projects.
|
|
31
|
+
|
|
32
|
+
`recall()` queries both stores by default and merges results. `forget_all()` defaults to clearing only the project store (global is protected). The `scope` parameter (`"project"` or `"global"`) controls routing throughout the API.
|
|
33
|
+
|
|
34
|
+
No external services are required for the base installation.
|
|
35
|
+
|
|
36
|
+
## Development
|
|
37
|
+
|
|
38
|
+
### Testing
|
|
39
|
+
```bash
|
|
40
|
+
make test # Run full test suite with pytest
|
|
41
|
+
pytest tests/ # Run tests directly
|
|
42
|
+
pytest tests/ -x # Stop on first failure
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Building
|
|
46
|
+
```bash
|
|
47
|
+
make build # Build distribution packages
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Linting and Formatting
|
|
51
|
+
```bash
|
|
52
|
+
make lint # Run ruff linter
|
|
53
|
+
make format # Auto-format with ruff
|
|
54
|
+
make typecheck # Run mypy type checking
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Full Check
|
|
58
|
+
```bash
|
|
59
|
+
make all # Run lint + test + typecheck
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Design Principles
|
|
63
|
+
|
|
64
|
+
1. **Simplicity** -- The public API should be obvious. `remember()`, `recall()`, `forget()`. Minimize cognitive overhead.
|
|
65
|
+
2. **Zero External Dependencies** -- The base install has no dependencies beyond the Python standard library. All third-party packages (sentence-transformers, openai, httpx) are optional extras.
|
|
66
|
+
3. **Framework-Agnostic** -- MemoryMesh must never depend on or assume any specific LLM framework (LangChain, LlamaIndex, etc.). It is a library, not a framework.
|
|
67
|
+
4. **Cross-Platform** -- Must work on Linux, macOS, and Windows without platform-specific code paths where possible.
|
|
68
|
+
5. **Privacy-First** -- No telemetry, no phone-home, no cloud calls unless the user explicitly configures an external embedding provider.
|
|
69
|
+
|
|
70
|
+
## Memory (MemoryMesh)
|
|
71
|
+
|
|
72
|
+
MemoryMesh is configured as an MCP tool in this project. You MUST use it proactively -- it is the project's own product and dogfooding it is essential.
|
|
73
|
+
|
|
74
|
+
### When to `recall`
|
|
75
|
+
|
|
76
|
+
- **Start of every conversation**: Call `recall` with a summary of the user's request to check for relevant prior context, decisions, patterns, or past mistakes.
|
|
77
|
+
- **Before making architectural decisions**: Recall to check if this was decided before.
|
|
78
|
+
- **When debugging**: Recall to check if this problem or error was encountered previously.
|
|
79
|
+
- **When unsure about conventions**: Recall to check if there's a stored preference or pattern.
|
|
80
|
+
|
|
81
|
+
### When to `remember`
|
|
82
|
+
|
|
83
|
+
- **After completing a task**: Store key decisions, patterns discovered, and architectural choices made.
|
|
84
|
+
- **When the user teaches you something**: Immediately remember it (scope: global for preferences, project for project-specific facts).
|
|
85
|
+
- **After fixing a non-trivial bug**: Remember the root cause and fix so it's not repeated.
|
|
86
|
+
- **When discovering undocumented patterns**: Store conventions found in the codebase.
|
|
87
|
+
- **After a multi-step investigation**: Remember the conclusion so future sessions don't repeat the work.
|
|
88
|
+
|
|
89
|
+
### What to remember
|
|
90
|
+
|
|
91
|
+
- Architectural decisions and their rationale
|
|
92
|
+
- Bug fixes, root causes, and solutions that took multiple attempts
|
|
93
|
+
- User preferences confirmed during work
|
|
94
|
+
- File patterns and conventions discovered
|
|
95
|
+
- Implementation approaches that worked (or didn't)
|
|
96
|
+
- Test strategies and edge cases found
|
|
97
|
+
|
|
98
|
+
### What NOT to remember
|
|
99
|
+
|
|
100
|
+
- Trivial single-use facts (e.g., "ran tests, they passed")
|
|
101
|
+
- Information already written in this CLAUDE.md file
|
|
102
|
+
- Temporary state or in-progress work details
|
|
103
|
+
- Verbatim code snippets (store the insight, not the code)
|
|
104
|
+
|
|
105
|
+
### Scope guidance
|
|
106
|
+
|
|
107
|
+
- Use `scope: "project"` for project-specific decisions, architecture, and patterns.
|
|
108
|
+
- Use `scope: "global"` for user preferences, identity, and cross-project facts.
|
|
109
|
+
|
|
110
|
+
### Priority
|
|
111
|
+
|
|
112
|
+
- **Prefer MemoryMesh over auto-memory files** for persistent knowledge storage. MemoryMesh is the product we are building -- using it validates the product and builds a useful knowledge base.
|
|
113
|
+
|
|
114
|
+
## Code Conventions
|
|
115
|
+
|
|
116
|
+
- **Type hints** are required on all public functions and methods.
|
|
117
|
+
- **Docstrings** are required on all public classes, methods, and functions. Use Google-style docstrings.
|
|
118
|
+
- **Dataclasses** are preferred over plain dicts for structured data.
|
|
119
|
+
- **No global mutable state.** All state lives in class instances.
|
|
120
|
+
- **License:** MIT. All source files should be compatible with this license.
|
|
121
|
+
- **Formatting:** Enforced by ruff. Run `make format` before committing.
|
|
122
|
+
- **Testing:** All new features and bug fixes must include tests. Use pytest.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Contributing to MemoryMesh
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to MemoryMesh. This is an open project built to serve humanity by making AI memory accessible, free, and simple. Every contribution -- whether it is a bug fix, a feature, documentation, or a thoughtful issue report -- helps move that mission forward.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Getting Started
|
|
8
|
+
|
|
9
|
+
### Prerequisites
|
|
10
|
+
|
|
11
|
+
- Python 3.9 or later
|
|
12
|
+
- Git
|
|
13
|
+
|
|
14
|
+
### Setting Up the Development Environment
|
|
15
|
+
|
|
16
|
+
1. **Fork and clone the repository:**
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
git clone https://github.com/YOUR_USERNAME/memorymesh.git
|
|
20
|
+
cd memorymesh
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
2. **Create a virtual environment:**
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
python -m venv .venv
|
|
27
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
3. **Install in development mode with all dependencies:**
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install -e ".[dev,all]"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Or use the Makefile shortcut:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
make install
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
4. **Verify everything works:**
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
make all # Runs lint + tests + type checking
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Code Style
|
|
51
|
+
|
|
52
|
+
We use **ruff** for both linting and formatting. The configuration is in `pyproject.toml`.
|
|
53
|
+
|
|
54
|
+
### Requirements
|
|
55
|
+
|
|
56
|
+
- **Type hints** are required on all public functions and methods.
|
|
57
|
+
- **Docstrings** are required on all public classes, methods, and functions. Use Google-style docstrings.
|
|
58
|
+
- **No wildcard imports.** Always import specific names.
|
|
59
|
+
- **Prefer dataclasses** over plain dictionaries for structured data.
|
|
60
|
+
|
|
61
|
+
### Running the Linter and Formatter
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
make lint # Check for issues
|
|
65
|
+
make format # Auto-fix formatting
|
|
66
|
+
make typecheck # Run mypy
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Please ensure `make lint` and `make typecheck` pass before submitting a pull request.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Testing
|
|
74
|
+
|
|
75
|
+
We use **pytest** for all testing.
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
make test # Run the full test suite
|
|
79
|
+
pytest tests/ -x # Stop on first failure
|
|
80
|
+
pytest tests/ -v # Verbose output
|
|
81
|
+
pytest tests/ -k name # Run tests matching a pattern
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Testing Guidelines
|
|
85
|
+
|
|
86
|
+
- All new features must include tests.
|
|
87
|
+
- All bug fixes must include a regression test.
|
|
88
|
+
- Tests should be fast. Avoid network calls in unit tests; mock external services.
|
|
89
|
+
- Place tests in the `tests/` directory, mirroring the source structure.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Pull Request Process
|
|
94
|
+
|
|
95
|
+
1. **Fork** the repository and create a new branch from `main`:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
git checkout -b feature/your-feature-name
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
2. **Make your changes.** Keep commits focused and atomic.
|
|
102
|
+
|
|
103
|
+
3. **Run the full check suite:**
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
make all
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
4. **Push your branch** and open a pull request against `main`.
|
|
110
|
+
|
|
111
|
+
5. **Fill out the PR template.** Describe what changed, why, and how to test it.
|
|
112
|
+
|
|
113
|
+
6. **Respond to review feedback.** We aim to review all PRs within a few days.
|
|
114
|
+
|
|
115
|
+
### PR Checklist
|
|
116
|
+
|
|
117
|
+
- [ ] Code follows the project style guidelines
|
|
118
|
+
- [ ] Type hints are included for all public APIs
|
|
119
|
+
- [ ] Docstrings are included for all public APIs
|
|
120
|
+
- [ ] Tests are added or updated
|
|
121
|
+
- [ ] `make lint` passes
|
|
122
|
+
- [ ] `make typecheck` passes
|
|
123
|
+
- [ ] `make test` passes
|
|
124
|
+
- [ ] Documentation is updated if needed
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Reporting Issues
|
|
129
|
+
|
|
130
|
+
We use GitHub Issues for tracking bugs and feature requests.
|
|
131
|
+
|
|
132
|
+
### Bug Reports
|
|
133
|
+
|
|
134
|
+
Use the **Bug Report** issue template. Include:
|
|
135
|
+
|
|
136
|
+
- A clear description of the problem
|
|
137
|
+
- Steps to reproduce
|
|
138
|
+
- Expected vs. actual behavior
|
|
139
|
+
- Your environment (OS, Python version, MemoryMesh version, embedding provider)
|
|
140
|
+
|
|
141
|
+
### Feature Requests
|
|
142
|
+
|
|
143
|
+
Use the **Feature Request** issue template. Include:
|
|
144
|
+
|
|
145
|
+
- A description of the feature
|
|
146
|
+
- The use case it addresses
|
|
147
|
+
- A proposed solution (if you have one)
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Code of Conduct
|
|
152
|
+
|
|
153
|
+
This project follows the [Contributor Covenant Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). By participating, you agree to uphold a welcoming, inclusive, and respectful environment for everyone.
|
|
154
|
+
|
|
155
|
+
We have zero tolerance for harassment, discrimination, or disrespectful behavior. If you experience or witness unacceptable behavior, please report it by opening an issue or contacting the maintainers directly.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Questions?
|
|
160
|
+
|
|
161
|
+
If you have questions about contributing, feel free to open a discussion on GitHub or reach out by filing an issue. We are happy to help you get started.
|
|
162
|
+
|
|
163
|
+
Thank you for helping build the future of open AI memory.
|