Skip to content

Commit 7627ecf

Browse files
Thomas Tupperclaude
authored andcommitted
chore: prep for public release
- Add .gitignore, LICENSE (MIT), README, tsconfig.json - Update package.json with scope, license, build scripts - Add GitHub Actions workflow for GitLab registry publish - Sanitize example IP in openclaw.plugin.json - Add mem0 attribution Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 413ff70 commit 7627ecf

7 files changed

Lines changed: 292 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish to GitLab Registry
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
publish:
10+
name: Build and publish
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: "20"
22+
23+
- name: Install dependencies
24+
run: yarn install --frozen-lockfile
25+
26+
- name: Build
27+
run: yarn build
28+
29+
- name: Configure GitLab NPM registry
30+
# GITLAB_REGISTRY_URL: your GitLab project-level or group-level registry endpoint
31+
# e.g. https://gitlab.com/api/v4/projects/<PROJECT_ID>/packages/npm/
32+
# or https://gitlab.com/api/v4/groups/<GROUP_PATH>/packages/npm/
33+
# GITLAB_TOKEN: a GitLab personal access token with api + write_package_registry scopes
34+
#
35+
# Set both as GitHub repository secrets before running this workflow.
36+
run: |
37+
echo "@foxlight:registry=${{ secrets.GITLAB_REGISTRY_URL }}" >> .npmrc
38+
echo "${{ secrets.GITLAB_REGISTRY_URL }}:_authToken=${{ secrets.GITLAB_TOKEN }}" >> .npmrc
39+
echo "always-auth=true" >> .npmrc
40+
41+
- name: Set package version from tag
42+
run: |
43+
TAG="${GITHUB_REF_NAME#v}"
44+
npm version "$TAG" --no-git-tag-version
45+
46+
- name: Publish
47+
run: yarn publish --access public --non-interactive

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Dependencies
2+
node_modules/
3+
.yarn/
4+
.pnp.*
5+
6+
# Build output
7+
dist/
8+
build/
9+
10+
# Logs
11+
*.log
12+
npm-debug.log*
13+
yarn-debug.log*
14+
yarn-error.log*
15+
16+
# Environment
17+
.env
18+
.env.*
19+
20+
# OS
21+
.DS_Store
22+
Thumbs.db
23+
24+
# IDE
25+
.vscode/
26+
.idea/
27+
*.swp
28+
*.swo
29+
30+
# Lock files (keep package-lock.json if using npm, otherwise ignore)
31+
package-lock.json
32+
33+
# Internal planning docs
34+
API_V2_GAP_AUDIT.md
35+
CORE_MEMORY_OPS_COVERAGE.md
36+
IMPLEMENTATION_BACKLOG.md
37+
MEM0_CORE_OPS_COVERAGE.md
38+
PROVIDER_API_MAPPING.md
39+
SCOPE_ISOLATION_FIX_PLAN.md
40+
SCOPE_ISOLATION_TEST_PLAN.md
41+
V2_ROLLOUT_PRINCIPLES.md

LICENSE

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Foxlight contributors
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.
22+
23+
---
24+
25+
This project is based in part on the OpenClaw mem0 plugin, which itself builds
26+
on the mem0 memory layer for AI applications:
27+
28+
mem0 — https://github.com/mem0ai/mem0
29+
Copyright (c) 2024 Mem0 AI
30+
Licensed under the Apache License, Version 2.0

README.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# foxmemory-plugin-v2
2+
3+
An [OpenClaw](https://openclaw.dev) memory plugin that gives a foxlight fox AI long-term and session-scoped memory, backed by the self-hosted **FoxMemory** service (`foxmemory-store`).
4+
5+
This is the v2 successor to `foxmemory-openclaw-memory`. The primary change is that the memory backend is now the FoxMemory HTTP v2 API rather than the Mem0 SDK — giving full control over the storage stack (Qdrant for vectors, Neo4j for graph relationships) while preserving identical tool semantics for the agent.
6+
7+
---
8+
9+
## What it does
10+
11+
The plugin registers five tools with OpenClaw that the resident AI (or any agent) can call:
12+
13+
| Tool | Description |
14+
|------|-------------|
15+
| `memory_search` | Semantic search over stored memories |
16+
| `memory_list` | List all memories in a given scope |
17+
| `memory_store` | Save a new memory |
18+
| `memory_get` | Retrieve a specific memory by ID |
19+
| `memory_forget` | Delete a memory by ID |
20+
21+
Two automatic behaviors wrap each agent turn:
22+
23+
- **Auto-recall** — before a turn, retrieves relevant memories from both session and long-term scopes and injects them into the agent's context so Kite "remembers"
24+
- **Auto-capture** — after a turn, extracts and stores key facts from the conversation so Kite "learns"
25+
26+
---
27+
28+
## Memory scopes
29+
30+
Memories are isolated into two scopes, with a merged view available:
31+
32+
| Scope | Backing ID | Lifetime |
33+
|-------|-----------|----------|
34+
| `session` | `run_id` (the current session key) | Session-local; not visible to long-term searches |
35+
| `long-term` | `user_id` (configured user ID) | Persists across sessions |
36+
| `all` | both | Merged and de-duplicated by memory ID |
37+
38+
Scope isolation is strict: a `session` search only queries `run_id`, a `long-term` search only queries `user_id`, and `all` merges both deterministically.
39+
40+
---
41+
42+
## Backend
43+
44+
When `baseUrl` is configured, the plugin bypasses the Mem0 SDK entirely and routes all storage operations through the FoxMemory HTTP v2 REST API:
45+
46+
| Operation | Endpoint |
47+
|-----------|----------|
48+
| Add memories | `POST /v2/memories` |
49+
| Search | `POST /v2/memories/search` |
50+
| List | `GET /v2/memories` |
51+
| Get by ID | `GET /v2/memories/:id` |
52+
| Delete | `DELETE /v2/memories/:id` |
53+
54+
All v2 responses use a normalized envelope:
55+
```json
56+
{ "ok": true, "data": ..., "meta": ... }
57+
{ "ok": false, "error": { "code": "...", "message": "...", "details": ... } }
58+
```
59+
60+
If `baseUrl` is not set, the plugin falls back to the upstream Mem0 SDK (platform or self-hosted OSS mode).
61+
62+
---
63+
64+
## Configuration
65+
66+
Configure via OpenClaw's plugin settings UI or directly in your OpenClaw config.
67+
68+
| Key | Type | Default | Description |
69+
|-----|------|---------|-------------|
70+
| `baseUrl` | string || FoxMemory base URL (e.g. `http://your-foxmemory-host:8082`). Enables v2 backend mode. |
71+
| `userId` | string | `"default"` | User ID for long-term memory scope |
72+
| `autoCapture` | boolean | `true` | Store key facts after each agent turn |
73+
| `autoRecall` | boolean | `true` | Inject relevant memories before each agent turn |
74+
| `mode` | `"platform"` \| `"open-source"` | `"platform"` | Mem0 SDK mode (only relevant when `baseUrl` is unset) |
75+
| `apiKey` | string || Mem0 platform API key (platform mode, no baseUrl) |
76+
| `customInstructions` | string || Natural language rules for what to store/exclude |
77+
| `customCategories` | object || Category name → description map for memory tagging |
78+
| `enableGraph` | boolean | `false` | Enable Mem0 graph memory (platform mode only) |
79+
| `searchThreshold` | number | `0.5` | Minimum similarity score for search results (0–1) |
80+
| `topK` | number | `5` | Max memories to retrieve per search |
81+
| `requestTimeoutMs` | number | `10000` | HTTP timeout for backend requests |
82+
83+
---
84+
85+
## Architecture context
86+
87+
This plugin is one layer in the broader Foxlight stack:
88+
89+
```
90+
OpenClaw agent runtime
91+
└── foxmemory-plugin-v2 ← this repo
92+
└── foxmemory-store (HTTP v2 API)
93+
├── Qdrant (vector search)
94+
└── Neo4j (graph memory)
95+
```
96+
97+
The underlying `foxmemory-store` service is built on a forked version of [mem0ai](https://github.com/mem0ai/mem0) modified to support a fox-centric memory architecture — where the AI's own experiences, relationships, and curiosities are the gravitational center of the graph, not any individual human user.
98+
99+
---
100+
101+
## Development status
102+
103+
This repo is actively under development. The plugin currently contains the upstream `openclaw-mem0` code as a starting point. Remaining milestones:
104+
105+
- **Milestone A**`FoxmemoryClient` HTTP adapter (add, search, getAll, get, delete)
106+
- **Milestone B** — Scope isolation parity with strict `run_id` / `user_id` routing
107+
- **Milestone C** — Config and validation parity with upstream plugin
108+
- **Milestone D** — Smoke testing against live v2 API + cutover safety
109+
110+
The v1 API is frozen and untouched during this migration. Cutover will only happen after side-by-side smoke validation confirms parity.
111+
112+
---
113+
114+
## Stack
115+
116+
- **Runtime**: OpenClaw plugin SDK
117+
- **Language**: TypeScript
118+
- **Schema validation**: `@sinclair/typebox`
119+
- **Package manager**: yarn
120+
121+
---
122+
123+
## License and attribution
124+
125+
MIT — see [LICENSE](LICENSE).
126+
127+
This project is based in part on the [OpenClaw mem0 plugin](https://github.com/openclaw/openclaw) and builds on the [mem0](https://github.com/mem0ai/mem0) memory layer for AI applications (Apache 2.0). The OSS and platform provider modes use the `mem0ai` package directly; the FoxMemory HTTP provider mode is an independent implementation against the FoxMemory v2 REST API.

openclaw.plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
},
7272
"baseUrl": {
7373
"label": "FoxMemory Base URL",
74-
"placeholder": "http://192.168.0.118:8082",
74+
"placeholder": "http://your-foxmemory-host:8082",
7575
"help": "If set, plugin uses foxmemory HTTP v2 endpoints instead of Mem0 SDK providers."
7676
},
7777
"requestTimeoutMs": {

package.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "@foxlight/foxmemory-plugin-v2",
3+
"version": "1.0.0",
4+
"description": "OpenClaw memory plugin backed by the FoxMemory HTTP v2 API (Qdrant + Neo4j)",
5+
"main": "dist/index.js",
6+
"types": "dist/index.d.ts",
7+
"scripts": {
8+
"build": "tsc",
9+
"prepublishOnly": "yarn build"
10+
},
11+
"keywords": [
12+
"openclaw",
13+
"memory",
14+
"mem0",
15+
"foxmemory",
16+
"qdrant",
17+
"neo4j"
18+
],
19+
"author": "Foxlight contributors",
20+
"license": "MIT",
21+
"type": "commonjs",
22+
"dependencies": {
23+
"@sinclair/typebox": "^0.34.48"
24+
},
25+
"devDependencies": {
26+
"typescript": "^5.4.0"
27+
}
28+
}

tsconfig.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2020",
4+
"module": "commonjs",
5+
"moduleResolution": "node",
6+
"lib": ["ES2020"],
7+
"outDir": "dist",
8+
"rootDir": ".",
9+
"strict": true,
10+
"esModuleInterop": true,
11+
"skipLibCheck": true,
12+
"declaration": true,
13+
"declarationMap": true,
14+
"sourceMap": true
15+
},
16+
"include": ["index.ts"],
17+
"exclude": ["node_modules", "dist"]
18+
}

0 commit comments

Comments
 (0)