memra-local 0.2.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.
- memra_local-0.2.0/LICENSE +57 -0
- memra_local-0.2.0/MANIFEST.in +10 -0
- memra_local-0.2.0/PKG-INFO +98 -0
- memra_local-0.2.0/README.md +73 -0
- memra_local-0.2.0/memra_local/__init__.py +3 -0
- memra_local-0.2.0/memra_local/__main__.py +6 -0
- memra_local-0.2.0/memra_local/app.py +65 -0
- memra_local-0.2.0/memra_local/cli.py +862 -0
- memra_local-0.2.0/memra_local/config.py +87 -0
- memra_local-0.2.0/memra_local/exceptions.py +14 -0
- memra_local-0.2.0/memra_local/hooks/__init__.py +1 -0
- memra_local-0.2.0/memra_local/hooks/extractor.py +93 -0
- memra_local-0.2.0/memra_local/hooks/installer.py +102 -0
- memra_local-0.2.0/memra_local/mcp_server.py +497 -0
- memra_local-0.2.0/memra_local/models.py +236 -0
- memra_local-0.2.0/memra_local/routes/__init__.py +0 -0
- memra_local-0.2.0/memra_local/routes/bootstrap.py +21 -0
- memra_local-0.2.0/memra_local/routes/memories.py +151 -0
- memra_local-0.2.0/memra_local/routes/search.py +40 -0
- memra_local-0.2.0/memra_local/services/__init__.py +0 -0
- memra_local-0.2.0/memra_local/services/embedding_service.py +61 -0
- memra_local-0.2.0/memra_local/services/factory.py +57 -0
- memra_local-0.2.0/memra_local/services/memory_service.py +703 -0
- memra_local-0.2.0/memra_local/services/migration_service.py +158 -0
- memra_local-0.2.0/memra_local/services/pii_client.py +43 -0
- memra_local-0.2.0/memra_local/services/sync_service.py +594 -0
- memra_local-0.2.0/memra_local/storage/__init__.py +0 -0
- memra_local-0.2.0/memra_local/storage/flat_file.py +107 -0
- memra_local-0.2.0/memra_local/storage/sqlite_index.py +607 -0
- memra_local-0.2.0/memra_local.egg-info/PKG-INFO +98 -0
- memra_local-0.2.0/memra_local.egg-info/SOURCES.txt +35 -0
- memra_local-0.2.0/memra_local.egg-info/dependency_links.txt +1 -0
- memra_local-0.2.0/memra_local.egg-info/entry_points.txt +2 -0
- memra_local-0.2.0/memra_local.egg-info/requires.txt +16 -0
- memra_local-0.2.0/memra_local.egg-info/top_level.txt +1 -0
- memra_local-0.2.0/pyproject.toml +45 -0
- memra_local-0.2.0/setup.cfg +4 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
Parameters
|
|
4
|
+
|
|
5
|
+
Licensor: Ali Von Sensey
|
|
6
|
+
Licensed Work: memra-local 0.1.0
|
|
7
|
+
Copyright (c) 2026 Ali Von Sensey. All rights reserved.
|
|
8
|
+
Additional Use Grant: None
|
|
9
|
+
Change Date: 2030-04-17
|
|
10
|
+
Change License: Apache License, Version 2.0
|
|
11
|
+
|
|
12
|
+
-----------------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
Notice
|
|
15
|
+
|
|
16
|
+
Business Source License 1.1
|
|
17
|
+
|
|
18
|
+
Terms
|
|
19
|
+
|
|
20
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
21
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
22
|
+
Licensor may make an Additional Use Grant, above, permitting limited production use.
|
|
23
|
+
|
|
24
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
25
|
+
available distribution of a specific version of the Licensed Work under this
|
|
26
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
27
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
28
|
+
above terminate.
|
|
29
|
+
|
|
30
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
31
|
+
currently in effect as described in this License, you must purchase a
|
|
32
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
33
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
34
|
+
|
|
35
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
36
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
37
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
38
|
+
for each version of the Licensed Work released by Licensor.
|
|
39
|
+
|
|
40
|
+
You must conspicuously display this License on each original or modified copy
|
|
41
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
42
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
43
|
+
License apply to your use of that work.
|
|
44
|
+
|
|
45
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
46
|
+
terminate your rights under this License for the current and all other
|
|
47
|
+
versions of the Licensed Work.
|
|
48
|
+
|
|
49
|
+
This License does not grant you any right in any trademark or logo of
|
|
50
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
51
|
+
Licensor as expressly required by this License).
|
|
52
|
+
|
|
53
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
54
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
55
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
56
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
57
|
+
TITLE.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: memra-local
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Local memory server for AI agents — offline, private, fast
|
|
5
|
+
License: BUSL-1.1
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: fastapi>=0.100.0
|
|
10
|
+
Requires-Dist: uvicorn[standard]>=0.20.0
|
|
11
|
+
Requires-Dist: pydantic>=2.0
|
|
12
|
+
Requires-Dist: pyyaml>=6.0
|
|
13
|
+
Requires-Dist: python-ulid>=2.0.0
|
|
14
|
+
Requires-Dist: click>=8.0
|
|
15
|
+
Requires-Dist: sentence-transformers>=5.0.0
|
|
16
|
+
Requires-Dist: numpy>=1.24.0
|
|
17
|
+
Requires-Dist: mcp[cli]>=1.27.0
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest; extra == "dev"
|
|
20
|
+
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
21
|
+
Requires-Dist: httpx; extra == "dev"
|
|
22
|
+
Requires-Dist: mypy; extra == "dev"
|
|
23
|
+
Requires-Dist: ruff; extra == "dev"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# memra-local
|
|
27
|
+
|
|
28
|
+
Local-first memory server for AI agents. Offline, private, fast.
|
|
29
|
+
|
|
30
|
+
`memra-local` gives your coding agent persistent memory that lives entirely on your machine — no account, no network, no data leaves the laptop. Works with Claude Code, Cursor, Zed, Droid, Hermes Agent, OpenClaw, and any MCP-compatible client.
|
|
31
|
+
|
|
32
|
+
When you're ready to sync across devices or share with a team, a single command pushes your local namespace to [Memra Cloud](https://usememra.com). Same tools, same API, your choice.
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install memra-local
|
|
38
|
+
memra mcp # start the MCP server
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Requires Python 3.10+.
|
|
42
|
+
|
|
43
|
+
## Wire it into your editor
|
|
44
|
+
|
|
45
|
+
### Claude Code / Cursor
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"mcpServers": {
|
|
50
|
+
"memra": {
|
|
51
|
+
"command": "memra",
|
|
52
|
+
"args": ["mcp"]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Zed
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"context_servers": {
|
|
63
|
+
"memra": {
|
|
64
|
+
"command": { "path": "memra", "args": ["mcp"] }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Droid (Factory.ai) / Hermes Agent / OpenClaw
|
|
71
|
+
|
|
72
|
+
See [usememra.com/install](https://usememra.com/install) for client-specific snippets.
|
|
73
|
+
|
|
74
|
+
## What you get
|
|
75
|
+
|
|
76
|
+
- **Flat-file memory** in `~/.memra/` — plain YAML, inspectable, greppable, diff-able
|
|
77
|
+
- **MCP server** exposing `memra_add`, `memra_recall`, `memra_get`, `memra_list`, `memra_supersede`, `memra_history`, and more
|
|
78
|
+
- **Local embeddings** via `sentence-transformers` — no OpenAI key required
|
|
79
|
+
- **Sync to cloud** optional: `memra sync enable <namespace> --api-key memra_live_...`
|
|
80
|
+
|
|
81
|
+
## Commands
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
memra mcp # MCP server over stdio
|
|
85
|
+
memra status # verify server + list namespaces
|
|
86
|
+
memra hooks install # optional — auto-capture decisions/patterns as you work
|
|
87
|
+
memra --help # full CLI reference
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Docs + source
|
|
91
|
+
|
|
92
|
+
- Install snippets and client configs: https://usememra.com/install
|
|
93
|
+
- Memra Cloud (hosted EU): https://usememra.com
|
|
94
|
+
- Source: https://github.com/vonsensey/memra (directory `memra-local/`)
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
[BUSL-1.1](./LICENSE). Change Date 2030-04-17 — on that date the license auto-converts to Apache-2.0. Until then, personal and non-production use are unrestricted; commercial production use requires a separate license.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# memra-local
|
|
2
|
+
|
|
3
|
+
Local-first memory server for AI agents. Offline, private, fast.
|
|
4
|
+
|
|
5
|
+
`memra-local` gives your coding agent persistent memory that lives entirely on your machine — no account, no network, no data leaves the laptop. Works with Claude Code, Cursor, Zed, Droid, Hermes Agent, OpenClaw, and any MCP-compatible client.
|
|
6
|
+
|
|
7
|
+
When you're ready to sync across devices or share with a team, a single command pushes your local namespace to [Memra Cloud](https://usememra.com). Same tools, same API, your choice.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install memra-local
|
|
13
|
+
memra mcp # start the MCP server
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Requires Python 3.10+.
|
|
17
|
+
|
|
18
|
+
## Wire it into your editor
|
|
19
|
+
|
|
20
|
+
### Claude Code / Cursor
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"mcpServers": {
|
|
25
|
+
"memra": {
|
|
26
|
+
"command": "memra",
|
|
27
|
+
"args": ["mcp"]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Zed
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"context_servers": {
|
|
38
|
+
"memra": {
|
|
39
|
+
"command": { "path": "memra", "args": ["mcp"] }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Droid (Factory.ai) / Hermes Agent / OpenClaw
|
|
46
|
+
|
|
47
|
+
See [usememra.com/install](https://usememra.com/install) for client-specific snippets.
|
|
48
|
+
|
|
49
|
+
## What you get
|
|
50
|
+
|
|
51
|
+
- **Flat-file memory** in `~/.memra/` — plain YAML, inspectable, greppable, diff-able
|
|
52
|
+
- **MCP server** exposing `memra_add`, `memra_recall`, `memra_get`, `memra_list`, `memra_supersede`, `memra_history`, and more
|
|
53
|
+
- **Local embeddings** via `sentence-transformers` — no OpenAI key required
|
|
54
|
+
- **Sync to cloud** optional: `memra sync enable <namespace> --api-key memra_live_...`
|
|
55
|
+
|
|
56
|
+
## Commands
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
memra mcp # MCP server over stdio
|
|
60
|
+
memra status # verify server + list namespaces
|
|
61
|
+
memra hooks install # optional — auto-capture decisions/patterns as you work
|
|
62
|
+
memra --help # full CLI reference
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Docs + source
|
|
66
|
+
|
|
67
|
+
- Install snippets and client configs: https://usememra.com/install
|
|
68
|
+
- Memra Cloud (hosted EU): https://usememra.com
|
|
69
|
+
- Source: https://github.com/vonsensey/memra (directory `memra-local/`)
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
[BUSL-1.1](./LICENSE). Change Date 2030-04-17 — on that date the license auto-converts to Apache-2.0. Until then, personal and non-production use are unrestricted; commercial production use requires a separate license.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"""FastAPI application factory with lifespan for memra-local."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from contextlib import asynccontextmanager
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import AsyncIterator
|
|
8
|
+
|
|
9
|
+
from fastapi import FastAPI
|
|
10
|
+
|
|
11
|
+
from memra_local import __version__
|
|
12
|
+
from memra_local.config import resolve_scope
|
|
13
|
+
from memra_local.routes import bootstrap, memories, search
|
|
14
|
+
from memra_local.services.factory import create_service
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def create_app(
|
|
18
|
+
scope: str = "auto",
|
|
19
|
+
storage_dir: Path | None = None,
|
|
20
|
+
) -> FastAPI:
|
|
21
|
+
"""Create and configure the FastAPI application.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
scope: Storage scope -- "global", "project", or "auto".
|
|
25
|
+
storage_dir: Override storage directory (used by tests).
|
|
26
|
+
|
|
27
|
+
Returns:
|
|
28
|
+
Configured FastAPI app with service on app.state.service.
|
|
29
|
+
"""
|
|
30
|
+
resolved_scope = resolve_scope(scope) if storage_dir is None else scope
|
|
31
|
+
|
|
32
|
+
# Use shared factory for service creation (same as MCP server)
|
|
33
|
+
service = create_service(scope=scope, storage_dir=storage_dir)
|
|
34
|
+
|
|
35
|
+
@asynccontextmanager
|
|
36
|
+
async def lifespan(app: FastAPI) -> AsyncIterator[None]:
|
|
37
|
+
"""Index is already initialized by factory; just handle shutdown."""
|
|
38
|
+
yield
|
|
39
|
+
service.index.close()
|
|
40
|
+
|
|
41
|
+
app = FastAPI(
|
|
42
|
+
title="Memra Local",
|
|
43
|
+
version=__version__,
|
|
44
|
+
description="Local memory server for AI agents",
|
|
45
|
+
lifespan=lifespan,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
# Store service on app state for route access
|
|
49
|
+
app.state.service = service
|
|
50
|
+
|
|
51
|
+
# Include routers with /v1 prefix
|
|
52
|
+
app.include_router(memories.router, prefix="/v1")
|
|
53
|
+
app.include_router(search.router, prefix="/v1")
|
|
54
|
+
app.include_router(bootstrap.router, prefix="/v1")
|
|
55
|
+
|
|
56
|
+
# Health endpoint (no prefix)
|
|
57
|
+
@app.get("/health")
|
|
58
|
+
def health():
|
|
59
|
+
return {
|
|
60
|
+
"status": "healthy",
|
|
61
|
+
"version": __version__,
|
|
62
|
+
"scope": resolved_scope,
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return app
|