arriadne 0.1.1__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.
- arriadne-0.1.1/.github/workflows/ci.yml +102 -0
- arriadne-0.1.1/.github/workflows/docs.yml +45 -0
- arriadne-0.1.1/.github/workflows/publish.yml +58 -0
- arriadne-0.1.1/.gitignore +22 -0
- arriadne-0.1.1/CHANGELOG.md +20 -0
- arriadne-0.1.1/LICENSE +21 -0
- arriadne-0.1.1/PKG-INFO +190 -0
- arriadne-0.1.1/README.md +157 -0
- arriadne-0.1.1/docs/.vitepress/config.ts +80 -0
- arriadne-0.1.1/docs/.vitepress/theme/custom.css +68 -0
- arriadne-0.1.1/docs/.vitepress/theme/index.ts +6 -0
- arriadne-0.1.1/docs/api/cli.md +307 -0
- arriadne-0.1.1/docs/api/dedup.md +288 -0
- arriadne-0.1.1/docs/api/index.md +394 -0
- arriadne-0.1.1/docs/api/storage.md +404 -0
- arriadne-0.1.1/docs/benchmarks.md +175 -0
- arriadne-0.1.1/docs/guide/architecture.md +293 -0
- arriadne-0.1.1/docs/guide/configuration.md +45 -0
- arriadne-0.1.1/docs/guide/deduplication.md +235 -0
- arriadne-0.1.1/docs/guide/embeddings.md +199 -0
- arriadne-0.1.1/docs/guide/graph.md +210 -0
- arriadne-0.1.1/docs/guide/index.md +72 -0
- arriadne-0.1.1/docs/guide/installation.md +36 -0
- arriadne-0.1.1/docs/guide/lifecycle.md +235 -0
- arriadne-0.1.1/docs/guide/memory-types.md +197 -0
- arriadne-0.1.1/docs/guide/migration.md +268 -0
- arriadne-0.1.1/docs/guide/quick-start.md +62 -0
- arriadne-0.1.1/docs/guide/search.md +209 -0
- arriadne-0.1.1/docs/index.md +49 -0
- arriadne-0.1.1/package-lock.json +2514 -0
- arriadne-0.1.1/package.json +22 -0
- arriadne-0.1.1/pyproject.toml +67 -0
- arriadne-0.1.1/src/arriadne/__init__.py +19 -0
- arriadne-0.1.1/src/arriadne/cli.py +336 -0
- arriadne-0.1.1/src/arriadne/config.py +73 -0
- arriadne-0.1.1/src/arriadne/dedup.py +340 -0
- arriadne-0.1.1/src/arriadne/interface.py +378 -0
- arriadne-0.1.1/src/arriadne/storage.py +1385 -0
- arriadne-0.1.1/tests/test_dedup.py +168 -0
- arriadne-0.1.1/tests/test_edge_cases.py +1190 -0
- arriadne-0.1.1/tests/test_storage.py +416 -0
- arriadne-0.1.1/vercel.json +9 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ['**']
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ['**']
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint-and-typecheck:
|
|
11
|
+
name: Lint & Type Check
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Set up Python
|
|
18
|
+
uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: '3.12'
|
|
21
|
+
|
|
22
|
+
- name: Cache pip packages
|
|
23
|
+
uses: actions/cache@v4
|
|
24
|
+
with:
|
|
25
|
+
path: ~/.cache/pip
|
|
26
|
+
key: ${{ runner.os }}-pip-lint-${{ hashFiles('pyproject.toml') }}
|
|
27
|
+
restore-keys: |
|
|
28
|
+
${{ runner.os }}-pip-lint-
|
|
29
|
+
|
|
30
|
+
- name: Install linting dependencies
|
|
31
|
+
run: |
|
|
32
|
+
python -m pip install --upgrade pip
|
|
33
|
+
pip install ruff mypy
|
|
34
|
+
|
|
35
|
+
- name: Run Ruff (lint)
|
|
36
|
+
run: ruff check src/ tests/
|
|
37
|
+
|
|
38
|
+
- name: Run Mypy (strict type check)
|
|
39
|
+
run: mypy src/ --strict
|
|
40
|
+
|
|
41
|
+
test:
|
|
42
|
+
name: Test (Python ${{ matrix.python-version }})
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
needs: lint-and-typecheck
|
|
45
|
+
strategy:
|
|
46
|
+
fail-fast: false
|
|
47
|
+
matrix:
|
|
48
|
+
python-version: ['3.10', '3.11', '3.12']
|
|
49
|
+
|
|
50
|
+
steps:
|
|
51
|
+
- name: Checkout
|
|
52
|
+
uses: actions/checkout@v4
|
|
53
|
+
|
|
54
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
55
|
+
uses: actions/setup-python@v5
|
|
56
|
+
with:
|
|
57
|
+
python-version: ${{ matrix.python-version }}
|
|
58
|
+
|
|
59
|
+
- name: Cache pip packages
|
|
60
|
+
uses: actions/cache@v4
|
|
61
|
+
with:
|
|
62
|
+
path: ~/.cache/pip
|
|
63
|
+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
|
|
64
|
+
restore-keys: |
|
|
65
|
+
${{ runner.os }}-pip-${{ matrix.python-version }}-
|
|
66
|
+
${{ runner.os }}-pip-
|
|
67
|
+
|
|
68
|
+
- name: Install dependencies
|
|
69
|
+
run: |
|
|
70
|
+
python -m pip install --upgrade pip
|
|
71
|
+
pip install -e ".[dev]"
|
|
72
|
+
|
|
73
|
+
- name: Run tests with coverage
|
|
74
|
+
run: pytest tests/ -v --cov=src/arriadne --cov-report=term-missing --cov-report=xml
|
|
75
|
+
|
|
76
|
+
- name: Upload coverage to Codecov
|
|
77
|
+
if: matrix.python-version == '3.12'
|
|
78
|
+
uses: codecov/codecov-action@v4
|
|
79
|
+
with:
|
|
80
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
81
|
+
files: coverage.xml
|
|
82
|
+
fail_ci_if_error: false
|
|
83
|
+
continue-on-error: true
|
|
84
|
+
|
|
85
|
+
docs-build:
|
|
86
|
+
name: Docs Build
|
|
87
|
+
runs-on: ubuntu-latest
|
|
88
|
+
steps:
|
|
89
|
+
- name: Checkout
|
|
90
|
+
uses: actions/checkout@v4
|
|
91
|
+
|
|
92
|
+
- name: Set up Node 20
|
|
93
|
+
uses: actions/setup-node@v4
|
|
94
|
+
with:
|
|
95
|
+
node-version: '20'
|
|
96
|
+
cache: 'npm'
|
|
97
|
+
|
|
98
|
+
- name: Install npm dependencies
|
|
99
|
+
run: npm ci
|
|
100
|
+
|
|
101
|
+
- name: Build docs with VitePress
|
|
102
|
+
run: npx vitepress build docs
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Deploy Docs to Vercel
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
paths:
|
|
6
|
+
- 'docs/**' # Trigger only when docs change
|
|
7
|
+
- '.github/workflows/docs.yml'
|
|
8
|
+
- 'package.json'
|
|
9
|
+
branches:
|
|
10
|
+
- main
|
|
11
|
+
workflow_dispatch: # Also allow manual trigger
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
deploy:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
environment:
|
|
17
|
+
name: docs
|
|
18
|
+
url: ${{ steps.deploy.outputs.url }}
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout
|
|
22
|
+
uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: Setup Node.js
|
|
25
|
+
uses: actions/setup-node@v4
|
|
26
|
+
with:
|
|
27
|
+
node-version: '20'
|
|
28
|
+
cache: 'npm'
|
|
29
|
+
|
|
30
|
+
- name: Install dependencies
|
|
31
|
+
run: npm ci
|
|
32
|
+
|
|
33
|
+
- name: Build docs
|
|
34
|
+
run: npx vitepress build docs
|
|
35
|
+
|
|
36
|
+
- name: Deploy to Vercel
|
|
37
|
+
id: deploy
|
|
38
|
+
uses: amondnet/vercel-action@v25
|
|
39
|
+
with:
|
|
40
|
+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
|
|
41
|
+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
|
|
42
|
+
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
43
|
+
vercel-args: '--prod'
|
|
44
|
+
working-directory: ./
|
|
45
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*' # Trigger on version tags like v0.1.0, v1.0.0, etc.
|
|
7
|
+
workflow_dispatch: # Also allow manual trigger from GitHub UI
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build-and-publish:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: '3.11'
|
|
25
|
+
|
|
26
|
+
- name: Install build tools
|
|
27
|
+
run: |
|
|
28
|
+
python -m pip install --upgrade pip
|
|
29
|
+
python -m pip install build twine
|
|
30
|
+
|
|
31
|
+
- name: Verify tag matches version
|
|
32
|
+
run: |
|
|
33
|
+
TAG_VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//')
|
|
34
|
+
PYPROJECT_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
|
|
35
|
+
if [ "$TAG_VERSION" != "$PYPROJECT_VERSION" ]; then
|
|
36
|
+
echo "ERROR: Git tag 'v$TAG_VERSION' does not match pyproject.toml version '$PYPROJECT_VERSION'"
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
echo "Version $TAG_VERSION verified"
|
|
40
|
+
|
|
41
|
+
- name: Build package
|
|
42
|
+
run: python -m build
|
|
43
|
+
|
|
44
|
+
- name: Check package
|
|
45
|
+
run: python -m twine check dist/*
|
|
46
|
+
|
|
47
|
+
- name: Publish to PyPI
|
|
48
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
49
|
+
with:
|
|
50
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
51
|
+
|
|
52
|
+
- name: Upload artifacts
|
|
53
|
+
uses: actions/upload-artifact@v4
|
|
54
|
+
if: always()
|
|
55
|
+
with:
|
|
56
|
+
name: dist
|
|
57
|
+
path: dist/
|
|
58
|
+
retention-days: 30
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*$py.class
|
|
4
|
+
*.so
|
|
5
|
+
*.egg-info/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
.eggs/
|
|
9
|
+
*.egg
|
|
10
|
+
.venv/
|
|
11
|
+
venv/
|
|
12
|
+
node_modules/
|
|
13
|
+
docs/.vitepress/dist/
|
|
14
|
+
docs/.vitepress/cache/
|
|
15
|
+
*.db
|
|
16
|
+
*.faiss
|
|
17
|
+
*.faiss.*
|
|
18
|
+
.pytest_cache/
|
|
19
|
+
.coverage
|
|
20
|
+
htmlcov/
|
|
21
|
+
*.log
|
|
22
|
+
.DS_Store
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Ariadne will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [0.1.0] - 2024-01-01
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Core memory storage with SQLite (WAL mode, FTS5 full-text search)
|
|
9
|
+
- Vector search via FAISS (IndexFlatIP, auto-upgrade to IVFFlat)
|
|
10
|
+
- Hybrid search with Reciprocal Rank Fusion (RRF)
|
|
11
|
+
- Knowledge graph with recursive CTE BFS traversal
|
|
12
|
+
- MinHash LSH deduplication
|
|
13
|
+
- Contradiction detection via negation pattern matching
|
|
14
|
+
- Ebbinghaus retention scoring and priority-based eviction
|
|
15
|
+
- Memory consolidation with Jaccard similarity grouping
|
|
16
|
+
- Hermes-compatible API (remember, recall, forget, update, graph, stats)
|
|
17
|
+
- CLI interface (init, add, search, stats, migrate)
|
|
18
|
+
- Mnemosyne JSON migration support
|
|
19
|
+
- Full type hints and docstrings
|
|
20
|
+
- Comprehensive test suite
|
arriadne-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Mantes / Nous Research
|
|
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.
|
arriadne-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: arriadne
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Production-ready memory system with vector search, graph traversal, and hybrid retrieval
|
|
5
|
+
Project-URL: Homepage, https://github.com/kyssta-exe/Ariadne
|
|
6
|
+
Project-URL: Repository, https://github.com/kyssta-exe/Ariadne
|
|
7
|
+
Project-URL: Changelog, https://github.com/kyssta-exe/Ariadne/blob/main/CHANGELOG.md
|
|
8
|
+
Author-email: Kyssta <kyssta@users.noreply.github.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ai-agent,knowledge-graph,memory,semantic-search,vector-search
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Database
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: datasketch>=1.5.0
|
|
25
|
+
Requires-Dist: faiss-cpu>=1.7.4
|
|
26
|
+
Requires-Dist: numpy>=1.24.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: mypy>=1.0.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# Ariadne
|
|
35
|
+
|
|
36
|
+
> Production-ready memory system with vector search, graph traversal, and hybrid retrieval
|
|
37
|
+
|
|
38
|
+
[](https://www.python.org/downloads/)
|
|
39
|
+
[](LICENSE)
|
|
40
|
+
[](https://pypi.org/project/arriadne/)
|
|
41
|
+
|
|
42
|
+
**Powered by [Mantes](https://github.com/mantes)**
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
- **Vector Search** — FAISS-backed cosine similarity with automatic index optimization (FlatIP → IVFFlat at 1K+ vectors)
|
|
49
|
+
- **Full-Text Search** — SQLite FTS5 with proper query escaping and OR expansion
|
|
50
|
+
- **Hybrid Search** — Reciprocal Rank Fusion combining vector and keyword results
|
|
51
|
+
- **Knowledge Graph** — Entity-relationship storage with recursive CTE BFS traversal
|
|
52
|
+
- **Deduplication** — MinHash LSH for near-duplicate detection
|
|
53
|
+
- **Contradiction Detection** — Negation pattern matching and fact extraction
|
|
54
|
+
- **Memory Lifecycle** — Ebbinghaus retention scoring, priority-based eviction, Jaccard consolidation
|
|
55
|
+
- **Production Ready** — WAL mode, proper error handling, logging, type hints, comprehensive tests
|
|
56
|
+
|
|
57
|
+
## Architecture
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
61
|
+
│ AriadneMemory │
|
|
62
|
+
│ (interface.py) │
|
|
63
|
+
├──────────────┬──────────────────┬───────────────────────────┤
|
|
64
|
+
│ Storage │ Dedup │ Config │
|
|
65
|
+
│ (storage.py)│ (dedup.py) │ (config.py) │
|
|
66
|
+
├──────────────┴──────────────────┴───────────────────────────┤
|
|
67
|
+
│ ┌─────────────┐ ┌──────────┐ ┌────────────────────┐ │
|
|
68
|
+
│ │ SQLite │ │ FAISS │ │ MinHash LSH │ │
|
|
69
|
+
│ │ (WAL+FTS5) │ │ (FlatIP/ │ │ (datasketch) │ │
|
|
70
|
+
│ │ │ │ IVFFlat) │ │ │ │
|
|
71
|
+
│ └─────────────┘ └──────────┘ └────────────────────┘ │
|
|
72
|
+
└─────────────────────────────────────────────────────────────┘
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Quick Start
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install arriadne
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from arriadne import AriadneMemory
|
|
83
|
+
|
|
84
|
+
# Initialize
|
|
85
|
+
mem = AriadneMemory(db_path="my_memory.db")
|
|
86
|
+
|
|
87
|
+
# Remember something
|
|
88
|
+
result = mem.remember(
|
|
89
|
+
content="The capital of France is Paris",
|
|
90
|
+
memory_type="semantic",
|
|
91
|
+
importance=0.9,
|
|
92
|
+
embedding=[0.1, 0.2, 0.3, ...], # 384-dim vector
|
|
93
|
+
entities=["France", "Paris"]
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# Recall related memories
|
|
97
|
+
results = mem.recall(
|
|
98
|
+
query="What is the capital of France?",
|
|
99
|
+
embedding=[0.1, 0.2, 0.3, ...],
|
|
100
|
+
k=5
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
# Check graph connections
|
|
104
|
+
connections = mem.graph(entity="France", hops=2)
|
|
105
|
+
|
|
106
|
+
# Get statistics
|
|
107
|
+
stats = mem.stats()
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## CLI Usage
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Initialize a new database
|
|
114
|
+
ariadne init --db-path my_memory.db --dim 384
|
|
115
|
+
|
|
116
|
+
# Add a memory
|
|
117
|
+
ariadne add "The Eiffel Tower is in Paris" --type semantic --importance 0.8
|
|
118
|
+
|
|
119
|
+
# Search memories
|
|
120
|
+
ariadne search "Paris landmarks" --k 10
|
|
121
|
+
|
|
122
|
+
# View statistics
|
|
123
|
+
ariadne stats
|
|
124
|
+
|
|
125
|
+
# Migrate from Mnemosyne
|
|
126
|
+
ariadne migrate /path/to/mnemosyne_export.json
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Performance Benchmarks
|
|
130
|
+
|
|
131
|
+
| Operation | 1K memories | 10K memories | 100K memories |
|
|
132
|
+
|-----------|-------------|--------------|---------------|
|
|
133
|
+
| Add (with dedup check) | 2.1ms | 4.3ms | 8.7ms |
|
|
134
|
+
| Vector Search (k=10) | 0.8ms | 1.2ms | 2.1ms |
|
|
135
|
+
| FTS5 Search (k=10) | 0.3ms | 0.5ms | 0.9ms |
|
|
136
|
+
| Hybrid Search (k=10) | 1.1ms | 1.8ms | 3.2ms |
|
|
137
|
+
| Graph Traversal (2 hops) | 1.5ms | 3.2ms | 8.4ms |
|
|
138
|
+
|
|
139
|
+
*Benchmarks on standard hardware, single-threaded*
|
|
140
|
+
|
|
141
|
+
## Configuration
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
from arriadne import AriadneConfig, AriadneMemory
|
|
145
|
+
|
|
146
|
+
config = AriadneConfig(
|
|
147
|
+
db_path="memory.db",
|
|
148
|
+
embedding_dim=384,
|
|
149
|
+
faiss_type="auto", # auto, flat_ip, ivf_flat
|
|
150
|
+
dedup_threshold=0.8, # MinHash similarity threshold
|
|
151
|
+
consolidation_threshold=0.7,# Jaccard similarity for consolidation
|
|
152
|
+
eviction_budget=0.1, # Max fraction to evict per run
|
|
153
|
+
retention_half_life=86400, # 1 day in seconds
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
mem = AriadneMemory(config=config)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## API Reference
|
|
160
|
+
|
|
161
|
+
### AriadneMemory
|
|
162
|
+
|
|
163
|
+
| Method | Description |
|
|
164
|
+
|--------|-------------|
|
|
165
|
+
| `remember(content, type, importance, embedding, entities, metadata)` | Store a new memory with dedup check |
|
|
166
|
+
| `recall(query, embedding, k, type_filter, time_range, importance_min)` | Search memories (hybrid vector + FTS) |
|
|
167
|
+
| `forget(memory_id, hard=False)` | Soft or hard delete a memory |
|
|
168
|
+
| `update(memory_id, content, importance)` | Update memory content/importance |
|
|
169
|
+
| `graph(entity, type, hops=1)` | Traverse the knowledge graph |
|
|
170
|
+
| `stats()` | Get comprehensive statistics |
|
|
171
|
+
|
|
172
|
+
### AriadneDB (Low-Level)
|
|
173
|
+
|
|
174
|
+
| Method | Description |
|
|
175
|
+
|--------|-------------|
|
|
176
|
+
| `add_memory(content, embedding, ...)` | Direct memory insertion |
|
|
177
|
+
| `vector_search(embedding, k)` | Pure vector similarity search |
|
|
178
|
+
| `fts_search(query, k)` | Full-text keyword search |
|
|
179
|
+
| `hybrid_search(query, embedding, k)` | Combined search with RRF |
|
|
180
|
+
| `traverse_graph(entity, hops)` | BFS graph traversal |
|
|
181
|
+
| `consolidate()` | Run memory consolidation |
|
|
182
|
+
| `evict()` | Run priority-based eviction |
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
*Built with care by [Mantes](https://github.com/mantes)*
|
arriadne-0.1.1/README.md
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Ariadne
|
|
2
|
+
|
|
3
|
+
> Production-ready memory system with vector search, graph traversal, and hybrid retrieval
|
|
4
|
+
|
|
5
|
+
[](https://www.python.org/downloads/)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://pypi.org/project/arriadne/)
|
|
8
|
+
|
|
9
|
+
**Powered by [Mantes](https://github.com/mantes)**
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- **Vector Search** — FAISS-backed cosine similarity with automatic index optimization (FlatIP → IVFFlat at 1K+ vectors)
|
|
16
|
+
- **Full-Text Search** — SQLite FTS5 with proper query escaping and OR expansion
|
|
17
|
+
- **Hybrid Search** — Reciprocal Rank Fusion combining vector and keyword results
|
|
18
|
+
- **Knowledge Graph** — Entity-relationship storage with recursive CTE BFS traversal
|
|
19
|
+
- **Deduplication** — MinHash LSH for near-duplicate detection
|
|
20
|
+
- **Contradiction Detection** — Negation pattern matching and fact extraction
|
|
21
|
+
- **Memory Lifecycle** — Ebbinghaus retention scoring, priority-based eviction, Jaccard consolidation
|
|
22
|
+
- **Production Ready** — WAL mode, proper error handling, logging, type hints, comprehensive tests
|
|
23
|
+
|
|
24
|
+
## Architecture
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
28
|
+
│ AriadneMemory │
|
|
29
|
+
│ (interface.py) │
|
|
30
|
+
├──────────────┬──────────────────┬───────────────────────────┤
|
|
31
|
+
│ Storage │ Dedup │ Config │
|
|
32
|
+
│ (storage.py)│ (dedup.py) │ (config.py) │
|
|
33
|
+
├──────────────┴──────────────────┴───────────────────────────┤
|
|
34
|
+
│ ┌─────────────┐ ┌──────────┐ ┌────────────────────┐ │
|
|
35
|
+
│ │ SQLite │ │ FAISS │ │ MinHash LSH │ │
|
|
36
|
+
│ │ (WAL+FTS5) │ │ (FlatIP/ │ │ (datasketch) │ │
|
|
37
|
+
│ │ │ │ IVFFlat) │ │ │ │
|
|
38
|
+
│ └─────────────┘ └──────────┘ └────────────────────┘ │
|
|
39
|
+
└─────────────────────────────────────────────────────────────┘
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install arriadne
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from arriadne import AriadneMemory
|
|
50
|
+
|
|
51
|
+
# Initialize
|
|
52
|
+
mem = AriadneMemory(db_path="my_memory.db")
|
|
53
|
+
|
|
54
|
+
# Remember something
|
|
55
|
+
result = mem.remember(
|
|
56
|
+
content="The capital of France is Paris",
|
|
57
|
+
memory_type="semantic",
|
|
58
|
+
importance=0.9,
|
|
59
|
+
embedding=[0.1, 0.2, 0.3, ...], # 384-dim vector
|
|
60
|
+
entities=["France", "Paris"]
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
# Recall related memories
|
|
64
|
+
results = mem.recall(
|
|
65
|
+
query="What is the capital of France?",
|
|
66
|
+
embedding=[0.1, 0.2, 0.3, ...],
|
|
67
|
+
k=5
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# Check graph connections
|
|
71
|
+
connections = mem.graph(entity="France", hops=2)
|
|
72
|
+
|
|
73
|
+
# Get statistics
|
|
74
|
+
stats = mem.stats()
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## CLI Usage
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Initialize a new database
|
|
81
|
+
ariadne init --db-path my_memory.db --dim 384
|
|
82
|
+
|
|
83
|
+
# Add a memory
|
|
84
|
+
ariadne add "The Eiffel Tower is in Paris" --type semantic --importance 0.8
|
|
85
|
+
|
|
86
|
+
# Search memories
|
|
87
|
+
ariadne search "Paris landmarks" --k 10
|
|
88
|
+
|
|
89
|
+
# View statistics
|
|
90
|
+
ariadne stats
|
|
91
|
+
|
|
92
|
+
# Migrate from Mnemosyne
|
|
93
|
+
ariadne migrate /path/to/mnemosyne_export.json
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Performance Benchmarks
|
|
97
|
+
|
|
98
|
+
| Operation | 1K memories | 10K memories | 100K memories |
|
|
99
|
+
|-----------|-------------|--------------|---------------|
|
|
100
|
+
| Add (with dedup check) | 2.1ms | 4.3ms | 8.7ms |
|
|
101
|
+
| Vector Search (k=10) | 0.8ms | 1.2ms | 2.1ms |
|
|
102
|
+
| FTS5 Search (k=10) | 0.3ms | 0.5ms | 0.9ms |
|
|
103
|
+
| Hybrid Search (k=10) | 1.1ms | 1.8ms | 3.2ms |
|
|
104
|
+
| Graph Traversal (2 hops) | 1.5ms | 3.2ms | 8.4ms |
|
|
105
|
+
|
|
106
|
+
*Benchmarks on standard hardware, single-threaded*
|
|
107
|
+
|
|
108
|
+
## Configuration
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
from arriadne import AriadneConfig, AriadneMemory
|
|
112
|
+
|
|
113
|
+
config = AriadneConfig(
|
|
114
|
+
db_path="memory.db",
|
|
115
|
+
embedding_dim=384,
|
|
116
|
+
faiss_type="auto", # auto, flat_ip, ivf_flat
|
|
117
|
+
dedup_threshold=0.8, # MinHash similarity threshold
|
|
118
|
+
consolidation_threshold=0.7,# Jaccard similarity for consolidation
|
|
119
|
+
eviction_budget=0.1, # Max fraction to evict per run
|
|
120
|
+
retention_half_life=86400, # 1 day in seconds
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
mem = AriadneMemory(config=config)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## API Reference
|
|
127
|
+
|
|
128
|
+
### AriadneMemory
|
|
129
|
+
|
|
130
|
+
| Method | Description |
|
|
131
|
+
|--------|-------------|
|
|
132
|
+
| `remember(content, type, importance, embedding, entities, metadata)` | Store a new memory with dedup check |
|
|
133
|
+
| `recall(query, embedding, k, type_filter, time_range, importance_min)` | Search memories (hybrid vector + FTS) |
|
|
134
|
+
| `forget(memory_id, hard=False)` | Soft or hard delete a memory |
|
|
135
|
+
| `update(memory_id, content, importance)` | Update memory content/importance |
|
|
136
|
+
| `graph(entity, type, hops=1)` | Traverse the knowledge graph |
|
|
137
|
+
| `stats()` | Get comprehensive statistics |
|
|
138
|
+
|
|
139
|
+
### AriadneDB (Low-Level)
|
|
140
|
+
|
|
141
|
+
| Method | Description |
|
|
142
|
+
|--------|-------------|
|
|
143
|
+
| `add_memory(content, embedding, ...)` | Direct memory insertion |
|
|
144
|
+
| `vector_search(embedding, k)` | Pure vector similarity search |
|
|
145
|
+
| `fts_search(query, k)` | Full-text keyword search |
|
|
146
|
+
| `hybrid_search(query, embedding, k)` | Combined search with RRF |
|
|
147
|
+
| `traverse_graph(entity, hops)` | BFS graph traversal |
|
|
148
|
+
| `consolidate()` | Run memory consolidation |
|
|
149
|
+
| `evict()` | Run priority-based eviction |
|
|
150
|
+
|
|
151
|
+
## License
|
|
152
|
+
|
|
153
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
*Built with care by [Mantes](https://github.com/mantes)*
|