@usecortex_ai/openclaw-cortex-ai 0.1.2 → 0.1.4
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.
- package/README.md +87 -25
- package/commands/onboarding.ts +21 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,16 +10,65 @@ openclaw plugins install @usecortex_ai/openclaw-cortex-ai
|
|
|
10
10
|
|
|
11
11
|
Restart OpenClaw after installing.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
If you run OpenClaw via the local gateway, restart it too:
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
```bash
|
|
16
|
+
openclaw gateway restart
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Get Your Credentials
|
|
20
|
+
1. Get your Cortex API Key from [Cortex AI](https://app.usecortex.ai)
|
|
21
|
+
2. Get your Tenant ID from the Cortex dashboard
|
|
22
|
+
|
|
23
|
+
## Interactive Onboarding
|
|
24
|
+
|
|
25
|
+
Run the interactive CLI wizard (recommended):
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Basic onboarding (API key, tenant ID, sub-tenant, ignore term)
|
|
29
|
+
openclaw cortex onboard
|
|
30
|
+
|
|
31
|
+
# Advanced onboarding (all options including recall mode, graph context, etc.)
|
|
32
|
+
openclaw cortex onboard --advanced
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The wizard guides you through configuration with colored prompts and **writes your config to** `plugins.entries.openclaw-cortex-ai.config` inside OpenClaw's settings file.
|
|
36
|
+
|
|
37
|
+
The path is resolved in the same order OpenClaw itself uses:
|
|
38
|
+
|
|
39
|
+
1. `$OPENCLAW_CONFIG_PATH` — if set, used directly
|
|
40
|
+
2. `$OPENCLAW_STATE_DIR/openclaw.json` — if `OPENCLAW_STATE_DIR` is set
|
|
41
|
+
3. `$OPENCLAW_HOME/.openclaw/openclaw.json` — if `OPENCLAW_HOME` is set
|
|
42
|
+
4. Default: `~/.openclaw/openclaw.json` (macOS/Linux) or `%USERPROFILE%\.openclaw\openclaw.json` (Windows)
|
|
43
|
+
|
|
44
|
+
No manual adjustment needed — the wizard auto-detects the correct path.
|
|
45
|
+
|
|
46
|
+
After onboarding, restart the gateway:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
openclaw gateway restart
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Manual Configuration
|
|
53
|
+
|
|
54
|
+
If you prefer, you can configure credentials manually.
|
|
55
|
+
|
|
56
|
+
Two required values:
|
|
57
|
+
|
|
58
|
+
- **API key**
|
|
59
|
+
- **Tenant ID**
|
|
60
|
+
|
|
61
|
+
Environment variables (recommended for secrets):
|
|
16
62
|
|
|
17
63
|
```bash
|
|
18
64
|
export CORTEX_OPENCLAW_API_KEY="your-api-key"
|
|
19
65
|
export CORTEX_OPENCLAW_TENANT_ID="your-tenant-id"
|
|
20
66
|
```
|
|
21
67
|
|
|
22
|
-
Or configure directly in
|
|
68
|
+
Or configure directly in OpenClaw's settings file:
|
|
69
|
+
|
|
70
|
+
- **macOS / Linux:** `~/.openclaw/openclaw.json`
|
|
71
|
+
- **Windows:** `%USERPROFILE%\.openclaw\openclaw.json`
|
|
23
72
|
|
|
24
73
|
```json5
|
|
25
74
|
{
|
|
@@ -37,11 +86,17 @@ Or configure directly in `openclaw.json`:
|
|
|
37
86
|
}
|
|
38
87
|
```
|
|
39
88
|
|
|
89
|
+
After changing config, restart the gateway so the plugin reloads:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
openclaw gateway restart
|
|
93
|
+
```
|
|
94
|
+
|
|
40
95
|
### Options
|
|
41
96
|
|
|
42
97
|
| Key | Type | Default | Description |
|
|
43
98
|
| -------------------- | ----------- | --------------------- | ------------------------------------------------------------------------------ |
|
|
44
|
-
| `subTenantId` | `string` | `"cortex-openclaw"` | Sub-tenant for data partitioning within your tenant
|
|
99
|
+
| `subTenantId` | `string` | `"cortex-openclaw-plugin"` | Sub-tenant for data partitioning within your tenant |
|
|
45
100
|
| `autoRecall` | `boolean` | `true` | Inject relevant memories before every AI turn |
|
|
46
101
|
| `autoCapture` | `boolean` | `true` | Store conversation exchanges after every AI turn |
|
|
47
102
|
| `maxRecallResults` | `number` | `10` | Max memory chunks injected into context per turn |
|
|
@@ -55,23 +110,6 @@ Or configure directly in `openclaw.json`:
|
|
|
55
110
|
- **Auto-Recall** — Before every AI turn, queries Cortex (`/recall/recall_preferences`) for relevant memories and injects graph-enriched context (entity paths, chunk relations, extra context).
|
|
56
111
|
- **Auto-Capture** — After every AI turn, the last user/assistant exchange is sent to Cortex (`/memories/add_memory`) as conversation pairs with `infer: true` and `upsert: true`. The session ID is used as `source_id` so Cortex groups exchanges per session and builds a knowledge graph automatically.
|
|
57
112
|
|
|
58
|
-
## Interactive Onboarding
|
|
59
|
-
|
|
60
|
-
Run the interactive CLI wizard to configure Cortex AI:
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
# Basic onboarding (API key, tenant ID, sub-tenant, ignore term)
|
|
64
|
-
openclaw cortex onboard
|
|
65
|
-
|
|
66
|
-
# Advanced onboarding (all options including recall mode, graph context, etc.)
|
|
67
|
-
openclaw cortex onboard --advanced
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
The wizard guides you through configuration with colored prompts, validates inputs, and outputs:
|
|
71
|
-
- `.env` file lines for credentials
|
|
72
|
-
- Plugin config JSON for non-default settings
|
|
73
|
-
- A summary table with masked sensitive values
|
|
74
|
-
|
|
75
113
|
## Slash Commands
|
|
76
114
|
|
|
77
115
|
| Command | Description |
|
|
@@ -85,10 +123,13 @@ The wizard guides you through configuration with colored prompts, validates inpu
|
|
|
85
123
|
|
|
86
124
|
## AI Tools
|
|
87
125
|
|
|
88
|
-
| Tool
|
|
89
|
-
|
|
|
90
|
-
| `cortex_store`
|
|
91
|
-
| `cortex_search`
|
|
126
|
+
| Tool | Description |
|
|
127
|
+
| ---------------------- | ----------- |
|
|
128
|
+
| `cortex_store` | Save the recent conversation history to Cortex as memory |
|
|
129
|
+
| `cortex_search` | Search Cortex memories (returns graph-enriched context) |
|
|
130
|
+
| `cortex_list_memories` | List all stored user memories (IDs + summaries) |
|
|
131
|
+
| `cortex_get_content` | Fetch full content for a specific `source_id` |
|
|
132
|
+
| `cortex_delete_memory` | Delete a memory by `memory_id` (use only when user explicitly asks) |
|
|
92
133
|
|
|
93
134
|
## CLI
|
|
94
135
|
|
|
@@ -102,6 +143,27 @@ openclaw cortex get <source_id> # Fetch source content
|
|
|
102
143
|
openclaw cortex status # Show plugin configuration
|
|
103
144
|
```
|
|
104
145
|
|
|
146
|
+
## Troubleshooting
|
|
147
|
+
|
|
148
|
+
### `Not configured. Run openclaw cortex onboard`
|
|
149
|
+
|
|
150
|
+
This means the plugin is enabled, but credentials are missing.
|
|
151
|
+
|
|
152
|
+
Run:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
openclaw cortex onboard
|
|
156
|
+
openclaw gateway restart
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### CLI says a command is unknown
|
|
160
|
+
|
|
161
|
+
Update/restart the gateway so it reloads the plugin:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
openclaw gateway restart
|
|
165
|
+
```
|
|
166
|
+
|
|
105
167
|
## Context Injection
|
|
106
168
|
|
|
107
169
|
Recalled context is injected inside `<cortex-context>` tags containing:
|
package/commands/onboarding.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as fs from "node:fs"
|
|
2
|
+
import * as os from "node:os"
|
|
2
3
|
import * as path from "node:path"
|
|
3
4
|
import * as readline from "node:readline"
|
|
4
5
|
import type { OpenClawPluginApi } from "openclaw/plugin-sdk"
|
|
@@ -209,13 +210,27 @@ function buildConfigObj(result: WizardResult): Record<string, unknown> {
|
|
|
209
210
|
return obj
|
|
210
211
|
}
|
|
211
212
|
|
|
212
|
-
// ── Persist to
|
|
213
|
+
// ── Persist to openclaw.json ──
|
|
214
|
+
// Mirrors openclaw's own path resolution (src/config/paths.ts):
|
|
215
|
+
// 1. $OPENCLAW_CONFIG_PATH (explicit override)
|
|
216
|
+
// 2. $OPENCLAW_STATE_DIR/openclaw.json
|
|
217
|
+
// 3. $OPENCLAW_HOME/.openclaw/openclaw.json
|
|
218
|
+
// 4. os.homedir()/.openclaw/openclaw.json (default)
|
|
213
219
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
)
|
|
220
|
+
function resolveOpenClawConfigPath(): string {
|
|
221
|
+
if (process.env.OPENCLAW_CONFIG_PATH) {
|
|
222
|
+
return process.env.OPENCLAW_CONFIG_PATH
|
|
223
|
+
}
|
|
224
|
+
if (process.env.OPENCLAW_STATE_DIR) {
|
|
225
|
+
return path.join(process.env.OPENCLAW_STATE_DIR, "openclaw.json")
|
|
226
|
+
}
|
|
227
|
+
if (process.env.OPENCLAW_HOME) {
|
|
228
|
+
return path.join(process.env.OPENCLAW_HOME, ".openclaw", "openclaw.json")
|
|
229
|
+
}
|
|
230
|
+
return path.join(os.homedir(), ".openclaw", "openclaw.json")
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const OPENCLAW_CONFIG_PATH = resolveOpenClawConfigPath()
|
|
219
234
|
|
|
220
235
|
function persistConfig(configObj: Record<string, unknown>): boolean {
|
|
221
236
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usecortex_ai/openclaw-cortex-ai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenClaw plugin for Cortex AI — the State-of-the-art agentic memory system with auto-capture, recall, and knowledge graph context for open-claw",
|
|
6
6
|
"license": "MIT",
|