Skip to content

Commit 188a1de

Browse files
committed
feat(sdk): add longmemory-sdk Python HTTP client and openmemory-py bridge
- zero-dependency sync/async Python client for the self-hosted API - openmemory-py 2.0 forwards imports to longmemory-sdk - PyPI publish jobs via trusted publishing in publish-sdks workflow - changelog, migration, and readme updates for package rename
1 parent 80a8078 commit 188a1de

33 files changed

Lines changed: 1587 additions & 15 deletions

.github/banner.png

315 KB
Loading

.github/logo.png

147 KB
Loading

.github/longmemory.gif

418 KB
Loading

.github/longmemory.png

-25.7 KB
Binary file not shown.

.github/workflows/publish-sdks.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,60 @@ jobs:
5858
env:
5959
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6060

61+
npm-legacy-bridge:
62+
needs: [validate, npm]
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/checkout@v4
66+
- uses: actions/setup-node@v4
67+
with:
68+
node-version: 22
69+
registry-url: https://registry.npmjs.org
70+
- run: npm publish ./packages/openmemory-js --access public --provenance
71+
env:
72+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
73+
- run: npm deprecate "openmemory-js@<2.0.0" "Package renamed to longmemory. Install longmemory instead."
74+
env:
75+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
76+
77+
pypi-longmemory-sdk:
78+
needs: validate
79+
runs-on: ubuntu-latest
80+
environment:
81+
name: pypi-longmemory-sdk
82+
url: https://pypi.org/p/longmemory-sdk
83+
permissions:
84+
id-token: write
85+
steps:
86+
- uses: actions/checkout@v4
87+
- uses: actions/setup-python@v5
88+
with:
89+
python-version: '3.13'
90+
- run: python -m pip install build
91+
- run: python -m build packages/longmemory-py
92+
- uses: pypa/gh-action-pypi-publish@release/v1
93+
with:
94+
packages-dir: packages/longmemory-py/dist
95+
96+
pypi-legacy-bridge:
97+
needs: [validate, pypi-longmemory-sdk]
98+
runs-on: ubuntu-latest
99+
environment:
100+
name: pypi-openmemory-py
101+
url: https://pypi.org/p/openmemory-py
102+
permissions:
103+
id-token: write
104+
steps:
105+
- uses: actions/checkout@v4
106+
- uses: actions/setup-python@v5
107+
with:
108+
python-version: '3.13'
109+
- run: python -m pip install build
110+
- run: python -m build packages/openmemory-py
111+
- uses: pypa/gh-action-pypi-publish@release/v1
112+
with:
113+
packages-dir: packages/openmemory-py/dist
114+
61115
n8n:
62116
needs: validate
63117
runs-on: ubuntu-latest

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ node_modules/
1414
dist/
1515
__pycache__/
1616
*.py[cod]
17+
*.egg-info/
18+
*.egg-info
1719
.env
1820
*.log
1921
tmp

CHANGELOG.md

Lines changed: 493 additions & 12 deletions
Large diffs are not rendered by default.

MIGRATION.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,19 @@ The package, CLI, environment prefix, extension namespace, routes, and integrati
2424
- dashboard proxy: `/api/longmemory`
2525
- repository: `https://github.com/CaviraOSS/LongMemory`
2626

27-
Compatibility aliases for the previous product name are intentionally not shipped.
27+
Application identifiers do not retain runtime aliases; registry migration is handled by temporary compatibility packages.
28+
29+
Package registry migration uses temporary compatibility bridges:
30+
31+
```bash
32+
npm uninstall openmemory-js
33+
npm install longmemory
34+
35+
pip uninstall openmemory-py
36+
pip install longmemory-sdk
37+
```
38+
39+
The npm bridge re-exports `longmemory` and forwards the legacy CLI names. The PyPI bridge depends on `longmemory-sdk` and forwards the legacy Python import namespace. The unrelated `longmemory` distribution on PyPI is not part of CaviraOSS.
2840

2941
## Import legacy memory data
3042

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717
> **Durable, temporal, governed memory for AI agents. Not just RAG. Not just a vector database. Local-first and self-hosted.**
1818
1919
[![npm](https://img.shields.io/npm/v/longmemory.svg)](https://www.npmjs.com/package/longmemory)
20+
[![PyPI](https://img.shields.io/pypi/v/longmemory-sdk.svg)](https://pypi.org/project/longmemory-sdk/)
2021
[![VS Code](https://img.shields.io/badge/VS%20Code-LongMemory-007ACC?logo=visualstudiocode)](https://marketplace.visualstudio.com/items?itemName=CaviraOSS.longmemory-vscode)
2122
[![Container](https://img.shields.io/badge/GHCR-longmemory-2496ED?logo=docker)](https://github.com/CaviraOSS/LongMemory/pkgs/container/longmemory)
2223
[![License](https://img.shields.io/github/license/CaviraOSS/LongMemory)](LICENSE)
2324

24-
![LongMemory dashboard](.github/longmemory.png)
25+
![LongMemory dashboard](.github/longmemory.gif)
2526

2627
LongMemory is a cognitive memory engine for LLM applications and autonomous agents.
2728

@@ -86,6 +87,27 @@ longmemory init
8687
longmemory recall "current project priorities" --mode associative
8788
```
8889

90+
### Call a self-hosted server from Python
91+
92+
```bash
93+
pip install longmemory-sdk
94+
```
95+
96+
```python
97+
from longmemory import LongMemory
98+
99+
memory = LongMemory(
100+
"http://127.0.0.1:7331",
101+
api_key="change-me",
102+
user_id="alice",
103+
)
104+
105+
memory.ingest("I prefer TypeScript")
106+
result = memory.recall("What language do I prefer?", mode="strict")
107+
```
108+
109+
The Python package is a zero-dependency HTTP client. The Hydrograph engine remains in the self-hosted TypeScript service. See [docs/python-sdk.md](docs/python-sdk.md).
110+
89111
---
90112

91113
## 2. Run as a Service
@@ -375,6 +397,15 @@ longmemory port --from codex --to longmemory --all
375397

376398
See [MIGRATION.md](MIGRATION.md) and [docs/migration.md](docs/migration.md).
377399

400+
Legacy package migration:
401+
402+
```bash
403+
npm uninstall openmemory-js && npm install longmemory
404+
pip uninstall openmemory-py && pip install longmemory-sdk
405+
```
406+
407+
`openmemory-js@2` and `openmemory-py@2` are forwarding bridges for existing installations. New applications should use `longmemory` and `longmemory-sdk` directly. PyPI's unrelated `longmemory` name is owned by another project, so the official distribution is `longmemory-sdk` while the import remains `longmemory`.
408+
378409
---
379410

380411
## 14. Release and Operations

header.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* __ __ ___
3+
* / / ____ ____ ____ _/ |/ /__ ____ ___ ____ _______ __
4+
* / / / __ \/ __ \/ __ `/ /|_/ / _ \/ __ `__ \/ __ \/ ___/ / / /
5+
* / /___/ /_/ / / / / /_/ / / / / __/ / / / / / /_/ / / / /_/ /
6+
* /_____/\____/_/ /_/\__, /_/ /_/\___/_/ /_/ /_/\____/_/ \__, /
7+
/____/ /____/
8+
*
9+
* cavira oss (c) 2026 - nullure (c) 2026
10+
* ----------------------------------------------------------
11+
* file : {{file}}
12+
* usage : {{usage}}
13+
*/

0 commit comments

Comments
 (0)