@vainplex/openclaw-cortex 0.2.0 → 0.2.2
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 +94 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/src/config-loader.d.ts +23 -0
- package/dist/src/config-loader.d.ts.map +1 -0
- package/dist/src/config-loader.js +105 -0
- package/dist/src/config-loader.js.map +1 -0
- package/openclaw.plugin.json +47 -2
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -17,6 +17,16 @@
|
|
|
17
17
|
|
|
18
18
|
Works **alongside** `memory-core` (OpenClaw's built-in memory) — doesn't replace it.
|
|
19
19
|
|
|
20
|
+
### Regex + LLM Hybrid (v0.2.0)
|
|
21
|
+
|
|
22
|
+
By default, Cortex uses fast regex patterns (zero cost, instant). Optionally, you can plug in **any OpenAI-compatible LLM** for deeper analysis:
|
|
23
|
+
|
|
24
|
+
- **Ollama** (local, free): `mistral:7b`, `qwen2.5:7b`, `llama3.1:8b`
|
|
25
|
+
- **OpenAI**: `gpt-4o-mini`, `gpt-4o`
|
|
26
|
+
- **OpenRouter / vLLM / any OpenAI-compatible API**
|
|
27
|
+
|
|
28
|
+
The LLM runs **on top of regex** — it enhances, never replaces. If the LLM is down, Cortex falls back silently to regex-only.
|
|
29
|
+
|
|
20
30
|
## 🎬 Demo
|
|
21
31
|
|
|
22
32
|
Try the interactive demo — it simulates a real bilingual dev conversation and shows every Cortex feature in action:
|
|
@@ -236,6 +246,52 @@ Add to your OpenClaw config:
|
|
|
236
246
|
}
|
|
237
247
|
```
|
|
238
248
|
|
|
249
|
+
### LLM Enhancement (optional)
|
|
250
|
+
|
|
251
|
+
Add an `llm` section to enable AI-powered analysis on top of regex:
|
|
252
|
+
|
|
253
|
+
```json
|
|
254
|
+
{
|
|
255
|
+
"plugins": {
|
|
256
|
+
"openclaw-cortex": {
|
|
257
|
+
"enabled": true,
|
|
258
|
+
"llm": {
|
|
259
|
+
"enabled": true,
|
|
260
|
+
"endpoint": "http://localhost:11434/v1",
|
|
261
|
+
"model": "mistral:7b",
|
|
262
|
+
"apiKey": "",
|
|
263
|
+
"timeoutMs": 15000,
|
|
264
|
+
"batchSize": 3
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
| Setting | Default | Description |
|
|
272
|
+
|---------|---------|-------------|
|
|
273
|
+
| `enabled` | `false` | Enable LLM enhancement |
|
|
274
|
+
| `endpoint` | `http://localhost:11434/v1` | Any OpenAI-compatible API endpoint |
|
|
275
|
+
| `model` | `mistral:7b` | Model identifier |
|
|
276
|
+
| `apiKey` | `""` | API key (optional, for cloud providers) |
|
|
277
|
+
| `timeoutMs` | `15000` | Timeout per LLM call |
|
|
278
|
+
| `batchSize` | `3` | Messages to buffer before calling the LLM |
|
|
279
|
+
|
|
280
|
+
**Examples:**
|
|
281
|
+
|
|
282
|
+
```jsonc
|
|
283
|
+
// Ollama (local, free)
|
|
284
|
+
{ "endpoint": "http://localhost:11434/v1", "model": "mistral:7b" }
|
|
285
|
+
|
|
286
|
+
// OpenAI
|
|
287
|
+
{ "endpoint": "https://api.openai.com/v1", "model": "gpt-4o-mini", "apiKey": "sk-..." }
|
|
288
|
+
|
|
289
|
+
// OpenRouter
|
|
290
|
+
{ "endpoint": "https://openrouter.ai/api/v1", "model": "meta-llama/llama-3.1-8b-instruct", "apiKey": "sk-or-..." }
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
The LLM receives batches of messages and returns structured JSON: detected threads, decisions, closures, and mood. Results are merged with regex findings — the LLM can catch things regex misses (nuance, implicit decisions, context-dependent closures).
|
|
294
|
+
|
|
239
295
|
Restart OpenClaw after configuring.
|
|
240
296
|
|
|
241
297
|
## How It Works
|
|
@@ -273,28 +329,49 @@ Thread and decision detection supports English, German, or both:
|
|
|
273
329
|
- **Topic patterns**: "back to", "now about", "jetzt zu", "bzgl."
|
|
274
330
|
- **Mood detection**: frustrated, excited, tense, productive, exploratory
|
|
275
331
|
|
|
332
|
+
### LLM Enhancement Flow
|
|
333
|
+
|
|
334
|
+
When `llm.enabled: true`:
|
|
335
|
+
|
|
336
|
+
```
|
|
337
|
+
message_received → regex analysis (instant, always)
|
|
338
|
+
→ buffer message
|
|
339
|
+
→ batch full? → LLM call (async, fire-and-forget)
|
|
340
|
+
→ merge LLM results into threads + decisions
|
|
341
|
+
→ LLM down? → silent fallback to regex-only
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
The LLM sees a conversation snippet (configurable batch size) and returns:
|
|
345
|
+
- **Threads**: title, status (open/closed), summary
|
|
346
|
+
- **Decisions**: what was decided, who, impact level
|
|
347
|
+
- **Closures**: which threads were resolved
|
|
348
|
+
- **Mood**: overall conversation mood
|
|
349
|
+
|
|
276
350
|
### Graceful Degradation
|
|
277
351
|
|
|
278
352
|
- Read-only workspace → runs in-memory, skips writes
|
|
279
353
|
- Corrupt JSON → starts fresh, next write recovers
|
|
280
354
|
- Missing directories → creates them automatically
|
|
281
355
|
- Hook errors → caught and logged, never crashes the gateway
|
|
356
|
+
- LLM timeout/error → falls back to regex-only, no data loss
|
|
282
357
|
|
|
283
358
|
## Development
|
|
284
359
|
|
|
285
360
|
```bash
|
|
286
361
|
npm install
|
|
287
|
-
npm test #
|
|
362
|
+
npm test # 288 tests
|
|
288
363
|
npm run typecheck # TypeScript strict mode
|
|
289
364
|
npm run build # Compile to dist/
|
|
290
365
|
```
|
|
291
366
|
|
|
292
367
|
## Performance
|
|
293
368
|
|
|
294
|
-
- Zero runtime dependencies (Node built-ins only)
|
|
295
|
-
-
|
|
369
|
+
- Zero runtime dependencies (Node built-ins only — even LLM calls use `node:http`)
|
|
370
|
+
- Regex analysis: instant, runs on every message
|
|
371
|
+
- LLM enhancement: async, batched, fire-and-forget (never blocks hooks)
|
|
296
372
|
- Atomic file writes via `.tmp` + rename
|
|
297
|
-
-
|
|
373
|
+
- Noise filter prevents garbage threads from polluting state
|
|
374
|
+
- Tested with 288 unit + integration tests
|
|
298
375
|
|
|
299
376
|
## Architecture
|
|
300
377
|
|
|
@@ -304,7 +381,17 @@ See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for the full design document in
|
|
|
304
381
|
|
|
305
382
|
MIT — see [LICENSE](LICENSE)
|
|
306
383
|
|
|
307
|
-
##
|
|
384
|
+
## Part of the Vainplex Plugin Suite
|
|
308
385
|
|
|
309
|
-
|
|
310
|
-
|
|
386
|
+
| # | Plugin | Status | Description |
|
|
387
|
+
|---|--------|--------|-------------|
|
|
388
|
+
| 1 | [@vainplex/nats-eventstore](https://github.com/alberthild/openclaw-nats-eventstore) | ✅ Published | NATS JetStream event persistence |
|
|
389
|
+
| 2 | **@vainplex/openclaw-cortex** | ✅ Published | Conversation intelligence — threads, decisions, boot context (this plugin) |
|
|
390
|
+
| 3 | [@vainplex/openclaw-knowledge-engine](https://github.com/alberthild/openclaw-knowledge-engine) | ✅ Published | Real-time knowledge extraction |
|
|
391
|
+
| 4 | @vainplex/openclaw-governance | 📋 Planned | Policy enforcement + guardrails |
|
|
392
|
+
| 5 | @vainplex/openclaw-memory-engine | 📋 Planned | Unified memory layer |
|
|
393
|
+
| 6 | @vainplex/openclaw-health-monitor | 📋 Planned | System health + auto-healing |
|
|
394
|
+
|
|
395
|
+
## License
|
|
396
|
+
|
|
397
|
+
MIT — see [LICENSE](LICENSE)
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAe,MAAM,gBAAgB,CAAC;AAErE,QAAA,MAAM,MAAM;;;;;kBAOI,iBAAiB;CA8ChC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { registerCortexHooks } from "./src/hooks.js";
|
|
2
|
-
import {
|
|
2
|
+
import { resolveWorkspace } from "./src/config.js";
|
|
3
|
+
import { loadConfig } from "./src/config-loader.js";
|
|
3
4
|
import { loadJson, rebootDir } from "./src/storage.js";
|
|
4
5
|
const plugin = {
|
|
5
6
|
id: "openclaw-cortex",
|
|
@@ -7,7 +8,7 @@ const plugin = {
|
|
|
7
8
|
description: "Conversation intelligence — thread tracking, decision extraction, boot context, pre-compaction snapshots",
|
|
8
9
|
version: "0.1.0",
|
|
9
10
|
register(api) {
|
|
10
|
-
const config =
|
|
11
|
+
const { config } = loadConfig(api.pluginConfig, api.logger);
|
|
11
12
|
if (!config.enabled) {
|
|
12
13
|
api.logger.info("[cortex] Disabled via config");
|
|
13
14
|
return;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGvD,MAAM,MAAM,GAAG;IACb,EAAE,EAAE,iBAAiB;IACrB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EACT,0GAA0G;IAC5G,OAAO,EAAE,OAAO;IAEhB,QAAQ,CAAC,GAAsB;QAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC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qBACb,CAAC;gBACJ,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,EAAE,IAAI,EAAE,4CAA4C,EAAE,CAAC;gBAChE,CAAC;YACH,CAAC;SACF,CAAC,CAAC;QAEH,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACpC,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CortexConfig, PluginLogger } from "./types.js";
|
|
2
|
+
/** Minimal inline config that lives in openclaw.json */
|
|
3
|
+
export interface InlineConfig {
|
|
4
|
+
readonly enabled?: boolean;
|
|
5
|
+
/** Override path to external config file */
|
|
6
|
+
readonly configPath?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ConfigLoadResult {
|
|
9
|
+
readonly config: CortexConfig;
|
|
10
|
+
readonly source: "inline" | "file" | "defaults";
|
|
11
|
+
readonly filePath?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Load cortex config with the following priority:
|
|
15
|
+
*
|
|
16
|
+
* 1. Legacy inline config (full config in openclaw.json) → use it directly
|
|
17
|
+
* 2. External file (configPath or default location) → read + resolve
|
|
18
|
+
* 3. Graceful defaults → everything enabled, fail-open
|
|
19
|
+
*
|
|
20
|
+
* NEVER throws. Worst case: returns defaults with a warning.
|
|
21
|
+
*/
|
|
22
|
+
export declare function loadConfig(pluginConfig: Record<string, unknown> | undefined, logger: PluginLogger): ConfigLoadResult;
|
|
23
|
+
//# sourceMappingURL=config-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/config-loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG7D,wDAAwD;AACxD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,4CAA4C;IAC5C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAsFD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;IAChD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EACjD,MAAM,EAAE,YAAY,GACnB,gBAAgB,CAkClB"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { readFileSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join, dirname } from "node:path";
|
|
3
|
+
import { resolveConfig, DEFAULTS } from "./config.js";
|
|
4
|
+
const DEFAULT_CONFIG_DIR = join(process.env["HOME"] ?? "/tmp", ".openclaw", "plugins", "openclaw-cortex");
|
|
5
|
+
const DEFAULT_CONFIG_FILENAME = "config.json";
|
|
6
|
+
function isRecord(v) {
|
|
7
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Determine whether pluginConfig is a full (legacy) inline config
|
|
11
|
+
* or just the minimal inline pointer.
|
|
12
|
+
*
|
|
13
|
+
* Heuristic: if it has keys beyond `enabled` and `configPath`,
|
|
14
|
+
* treat it as legacy inline config.
|
|
15
|
+
*/
|
|
16
|
+
function isLegacyInlineConfig(raw) {
|
|
17
|
+
const inlineOnlyKeys = new Set(["enabled", "configPath"]);
|
|
18
|
+
return Object.keys(raw).some((k) => !inlineOnlyKeys.has(k));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Read and parse a JSON file. Returns null on any error.
|
|
22
|
+
*/
|
|
23
|
+
function readJsonFile(path, logger) {
|
|
24
|
+
try {
|
|
25
|
+
if (!existsSync(path))
|
|
26
|
+
return null;
|
|
27
|
+
const raw = readFileSync(path, "utf-8");
|
|
28
|
+
const parsed = JSON.parse(raw);
|
|
29
|
+
if (!isRecord(parsed)) {
|
|
30
|
+
logger.warn(`[cortex] Config file is not an object: ${path}`);
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return parsed;
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
logger.warn(`[cortex] Failed to read config file ${path}: ${e instanceof Error ? e.message : String(e)}`);
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Apply inline `enabled` override to a file-loaded config (immutably).
|
|
42
|
+
*/
|
|
43
|
+
function applyInlineOverrides(fileConfig, inline) {
|
|
44
|
+
if (typeof inline["enabled"] === "boolean") {
|
|
45
|
+
return { ...fileConfig, enabled: inline["enabled"] };
|
|
46
|
+
}
|
|
47
|
+
return fileConfig;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Bootstrap a default config file and return its contents.
|
|
51
|
+
* Returns null if writing or reading back fails.
|
|
52
|
+
*/
|
|
53
|
+
function bootstrapConfig(path, logger) {
|
|
54
|
+
try {
|
|
55
|
+
const dir = dirname(path);
|
|
56
|
+
if (!existsSync(dir))
|
|
57
|
+
mkdirSync(dir, { recursive: true });
|
|
58
|
+
writeFileSync(path, JSON.stringify(DEFAULTS, null, 2) + "\n", "utf-8");
|
|
59
|
+
logger.info(`[cortex] Created default config at ${path}`);
|
|
60
|
+
return readJsonFile(path, logger);
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
logger.warn(`[cortex] Failed to write default config: ${e instanceof Error ? e.message : String(e)}`);
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Load cortex config with the following priority:
|
|
69
|
+
*
|
|
70
|
+
* 1. Legacy inline config (full config in openclaw.json) → use it directly
|
|
71
|
+
* 2. External file (configPath or default location) → read + resolve
|
|
72
|
+
* 3. Graceful defaults → everything enabled, fail-open
|
|
73
|
+
*
|
|
74
|
+
* NEVER throws. Worst case: returns defaults with a warning.
|
|
75
|
+
*/
|
|
76
|
+
export function loadConfig(pluginConfig, logger) {
|
|
77
|
+
const raw = pluginConfig ?? {};
|
|
78
|
+
// Priority 1: Legacy inline config (backward compatible)
|
|
79
|
+
if (isLegacyInlineConfig(raw)) {
|
|
80
|
+
logger.info("[cortex] Using inline config from openclaw.json");
|
|
81
|
+
return { config: resolveConfig(raw), source: "inline" };
|
|
82
|
+
}
|
|
83
|
+
// Priority 2: External config file
|
|
84
|
+
const configPath = typeof raw["configPath"] === "string"
|
|
85
|
+
? raw["configPath"]
|
|
86
|
+
: join(DEFAULT_CONFIG_DIR, DEFAULT_CONFIG_FILENAME);
|
|
87
|
+
const fileConfig = readJsonFile(configPath, logger);
|
|
88
|
+
if (fileConfig !== null) {
|
|
89
|
+
const merged = applyInlineOverrides(fileConfig, raw);
|
|
90
|
+
logger.info(`[cortex] Loaded config from ${configPath}`);
|
|
91
|
+
return { config: resolveConfig(merged), source: "file", filePath: configPath };
|
|
92
|
+
}
|
|
93
|
+
// File missing → bootstrap with defaults
|
|
94
|
+
if (!existsSync(configPath)) {
|
|
95
|
+
const bootstrapped = bootstrapConfig(configPath, logger);
|
|
96
|
+
if (bootstrapped !== null) {
|
|
97
|
+
const merged = applyInlineOverrides(bootstrapped, raw);
|
|
98
|
+
return { config: resolveConfig(merged), source: "file", filePath: configPath };
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// Priority 3: Graceful defaults (file broken or unwritable)
|
|
102
|
+
logger.warn("[cortex] Falling back to default config");
|
|
103
|
+
return { config: resolveConfig(undefined), source: "defaults" };
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=config-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-loader.js","sourceRoot":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C,CAAC;YACvD,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;QACjF,CAAC;IACH,CAAC;IAED,4DAA4D;IAC5D,MAAM,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;IACvD,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AAClE,CAAC"}
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "openclaw-cortex",
|
|
3
3
|
"configSchema": {
|
|
4
4
|
"type": "object",
|
|
5
|
-
"additionalProperties":
|
|
5
|
+
"additionalProperties": true,
|
|
6
6
|
"properties": {
|
|
7
7
|
"enabled": {
|
|
8
8
|
"type": "boolean",
|
|
@@ -143,11 +143,56 @@
|
|
|
143
143
|
"properties": {
|
|
144
144
|
"language": {
|
|
145
145
|
"type": "string",
|
|
146
|
-
"enum": [
|
|
146
|
+
"enum": [
|
|
147
|
+
"en",
|
|
148
|
+
"de",
|
|
149
|
+
"both"
|
|
150
|
+
],
|
|
147
151
|
"default": "both",
|
|
148
152
|
"description": "Language for regex pattern matching: English, German, or both"
|
|
149
153
|
}
|
|
150
154
|
}
|
|
155
|
+
},
|
|
156
|
+
"llm": {
|
|
157
|
+
"type": "object",
|
|
158
|
+
"additionalProperties": false,
|
|
159
|
+
"description": "Optional LLM enhancement — any OpenAI-compatible API (Ollama, OpenAI, OpenRouter, vLLM, etc.)",
|
|
160
|
+
"properties": {
|
|
161
|
+
"enabled": {
|
|
162
|
+
"type": "boolean",
|
|
163
|
+
"default": false,
|
|
164
|
+
"description": "Enable LLM-powered analysis on top of regex patterns"
|
|
165
|
+
},
|
|
166
|
+
"endpoint": {
|
|
167
|
+
"type": "string",
|
|
168
|
+
"default": "http://localhost:11434/v1",
|
|
169
|
+
"description": "OpenAI-compatible API endpoint"
|
|
170
|
+
},
|
|
171
|
+
"model": {
|
|
172
|
+
"type": "string",
|
|
173
|
+
"default": "mistral:7b",
|
|
174
|
+
"description": "Model identifier (e.g. mistral:7b, gpt-4o-mini)"
|
|
175
|
+
},
|
|
176
|
+
"apiKey": {
|
|
177
|
+
"type": "string",
|
|
178
|
+
"default": "",
|
|
179
|
+
"description": "API key (optional, for cloud providers)"
|
|
180
|
+
},
|
|
181
|
+
"timeoutMs": {
|
|
182
|
+
"type": "integer",
|
|
183
|
+
"minimum": 1000,
|
|
184
|
+
"maximum": 60000,
|
|
185
|
+
"default": 15000,
|
|
186
|
+
"description": "Timeout per LLM call in milliseconds"
|
|
187
|
+
},
|
|
188
|
+
"batchSize": {
|
|
189
|
+
"type": "integer",
|
|
190
|
+
"minimum": 1,
|
|
191
|
+
"maximum": 20,
|
|
192
|
+
"default": 3,
|
|
193
|
+
"description": "Number of messages to buffer before calling the LLM"
|
|
194
|
+
}
|
|
195
|
+
}
|
|
151
196
|
}
|
|
152
197
|
}
|
|
153
198
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vainplex/openclaw-cortex",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "OpenClaw plugin: conversation intelligence — thread tracking, decision extraction, boot context, pre-compaction snapshots",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -42,8 +42,9 @@
|
|
|
42
42
|
"license": "MIT",
|
|
43
43
|
"repository": {
|
|
44
44
|
"type": "git",
|
|
45
|
-
"url": "
|
|
45
|
+
"url": "https://github.com/alberthild/vainplex-openclaw.git",
|
|
46
|
+
"directory": "packages/openclaw-cortex"
|
|
46
47
|
},
|
|
47
48
|
"homepage": "https://github.com/alberthild/openclaw-cortex#readme",
|
|
48
|
-
"author": "
|
|
49
|
+
"author": "Albert Hild <a.hild@vainplex.de>"
|
|
49
50
|
}
|