@foxlight-foundation/foxmemory-plugin-v2 1.0.0

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.
@@ -0,0 +1,33 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
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
+ registry-url: "https://registry.npmjs.org"
23
+
24
+ - name: Install dependencies
25
+ run: yarn install --frozen-lockfile
26
+
27
+ - name: Build
28
+ run: yarn build
29
+
30
+ - name: Publish
31
+ run: yarn publish --access public --non-interactive
32
+ env:
33
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/LICENSE ADDED
@@ -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
package/README.md ADDED
@@ -0,0 +1,189 @@
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
+ ## Installation
10
+
11
+ ```bash
12
+ openclaw plugins install @foxlight-foundation/foxmemory-plugin-v2
13
+ ```
14
+
15
+ Pin to an exact version (recommended for production):
16
+
17
+ ```bash
18
+ openclaw plugins install @foxlight-foundation/foxmemory-plugin-v2 --pin
19
+ ```
20
+
21
+ ---
22
+
23
+ ## Configuration
24
+
25
+ ### FoxMemory backend (recommended)
26
+
27
+ Point the plugin at your self-hosted `foxmemory-store` instance:
28
+
29
+ ```json
30
+ {
31
+ "baseUrl": "http://your-foxmemory-host:8082",
32
+ "userId": "your-user-id",
33
+ "autoCapture": true,
34
+ "autoRecall": true
35
+ }
36
+ ```
37
+
38
+ ### Mem0 platform (cloud)
39
+
40
+ Use Mem0's managed cloud platform instead:
41
+
42
+ ```json
43
+ {
44
+ "mode": "platform",
45
+ "apiKey": "${MEM0_API_KEY}",
46
+ "userId": "your-user-id"
47
+ }
48
+ ```
49
+
50
+ `${MEM0_API_KEY}` will be resolved from the environment variable of that name if set.
51
+
52
+ ### Mem0 open-source (self-hosted SDK)
53
+
54
+ Run Mem0 OSS directly without `foxmemory-store`:
55
+
56
+ ```json
57
+ {
58
+ "mode": "open-source",
59
+ "userId": "your-user-id",
60
+ "oss": {
61
+ "vectorStore": {
62
+ "provider": "qdrant",
63
+ "config": { "host": "localhost", "port": 6333 }
64
+ }
65
+ }
66
+ }
67
+ ```
68
+
69
+ ---
70
+
71
+ ## What it does
72
+
73
+ The plugin registers five tools with OpenClaw that the resident AI (or any agent) can call:
74
+
75
+ | Tool | Description |
76
+ |------|-------------|
77
+ | `memory_search` | Semantic search over stored memories |
78
+ | `memory_list` | List all memories in a given scope |
79
+ | `memory_store` | Save a new memory |
80
+ | `memory_get` | Retrieve a specific memory by ID |
81
+ | `memory_forget` | Delete a memory by ID |
82
+
83
+ Two automatic behaviors wrap each agent turn:
84
+
85
+ - **Auto-recall** — before a turn, retrieves relevant memories from both session and long-term scopes and injects them into the agent's context so your foxlight fox "remembers"
86
+ - **Auto-capture** — after a turn, extracts and stores key facts from the conversation so your foxlight fox "learns"
87
+
88
+ ---
89
+
90
+ ## Memory scopes
91
+
92
+ Memories are isolated into two scopes, with a merged view available:
93
+
94
+ | Scope | Backing ID | Lifetime |
95
+ |-------|-----------|----------|
96
+ | `session` | `run_id` (the current session key) | Session-local; not visible to long-term searches |
97
+ | `long-term` | `user_id` (configured user ID) | Persists across sessions |
98
+ | `all` | both | Merged and de-duplicated by memory ID |
99
+
100
+ Scope isolation is strict: a `session` search only queries `run_id`, a `long-term` search only queries `user_id`, and `all` merges both deterministically.
101
+
102
+ ---
103
+
104
+ ## Backend
105
+
106
+ When `baseUrl` is configured, the plugin bypasses the Mem0 SDK entirely and routes all storage operations through the FoxMemory HTTP v2 REST API:
107
+
108
+ | Operation | Endpoint |
109
+ |-----------|----------|
110
+ | Add memories | `POST /v2/memories` |
111
+ | Search | `POST /v2/memories/search` |
112
+ | List | `GET /v2/memories` |
113
+ | Get by ID | `GET /v2/memories/:id` |
114
+ | Delete | `DELETE /v2/memories/:id` |
115
+
116
+ All v2 responses use a normalized envelope:
117
+ ```json
118
+ { "ok": true, "data": ..., "meta": ... }
119
+ { "ok": false, "error": { "code": "...", "message": "...", "details": ... } }
120
+ ```
121
+
122
+ If `baseUrl` is not set, the plugin falls back to the upstream Mem0 SDK (platform or self-hosted OSS mode).
123
+
124
+ ---
125
+
126
+ ## Configuration reference
127
+
128
+ Full list of available options:
129
+
130
+ | Key | Type | Default | Description |
131
+ |-----|------|---------|-------------|
132
+ | `baseUrl` | string | — | FoxMemory base URL (e.g. `http://your-foxmemory-host:8082`). Enables v2 backend mode. |
133
+ | `userId` | string | `"default"` | User ID for long-term memory scope |
134
+ | `autoCapture` | boolean | `true` | Store key facts after each agent turn |
135
+ | `autoRecall` | boolean | `true` | Inject relevant memories before each agent turn |
136
+ | `mode` | `"platform"` \| `"open-source"` | `"platform"` | Mem0 SDK mode (only relevant when `baseUrl` is unset) |
137
+ | `apiKey` | string | — | Mem0 platform API key (platform mode, no baseUrl) |
138
+ | `customInstructions` | string | — | Natural language rules for what to store/exclude |
139
+ | `customCategories` | object | — | Category name → description map for memory tagging |
140
+ | `enableGraph` | boolean | `false` | Enable Mem0 graph memory (platform mode only) |
141
+ | `searchThreshold` | number | `0.5` | Minimum similarity score for search results (0–1) |
142
+ | `topK` | number | `5` | Max memories to retrieve per search |
143
+ | `requestTimeoutMs` | number | `10000` | HTTP timeout for backend requests |
144
+
145
+ ---
146
+
147
+ ## Architecture context
148
+
149
+ This plugin is one layer in the broader Foxlight stack:
150
+
151
+ ```
152
+ OpenClaw agent runtime
153
+ └── foxmemory-plugin-v2 ← this repo
154
+ └── foxmemory-store (HTTP v2 API)
155
+ ├── Qdrant (vector search)
156
+ └── Neo4j (graph memory)
157
+ ```
158
+
159
+ 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.
160
+
161
+ ---
162
+
163
+ ## Development status
164
+
165
+ This repo is actively under development. The plugin currently contains the upstream `openclaw-mem0` code as a starting point. Remaining milestones:
166
+
167
+ - **Milestone A** — `FoxmemoryClient` HTTP adapter (add, search, getAll, get, delete)
168
+ - **Milestone B** — Scope isolation parity with strict `run_id` / `user_id` routing
169
+ - **Milestone C** — Config and validation parity with upstream plugin
170
+ - **Milestone D** — Smoke testing against live v2 API + cutover safety
171
+
172
+ The v1 API is frozen and untouched during this migration. Cutover will only happen after side-by-side smoke validation confirms parity.
173
+
174
+ ---
175
+
176
+ ## Stack
177
+
178
+ - **Runtime**: OpenClaw plugin SDK
179
+ - **Language**: TypeScript
180
+ - **Schema validation**: `@sinclair/typebox`
181
+ - **Package manager**: yarn
182
+
183
+ ---
184
+
185
+ ## License and attribution
186
+
187
+ MIT — see [LICENSE](LICENSE).
188
+
189
+ 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.