@vainplex/openclaw-cortex 0.4.0 → 0.4.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 +108 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/src/trace-analyzer/nats-trace-source.d.ts.map +1 -1
- package/dist/src/trace-analyzer/nats-trace-source.js +62 -26
- package/dist/src/trace-analyzer/nats-trace-source.js.map +1 -1
- package/openclaw.plugin.json +184 -2
- package/package.json +13 -8
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @vainplex/openclaw-cortex
|
|
2
2
|
|
|
3
|
-
> Conversation intelligence layer for [OpenClaw](https://github.com/openclaw/openclaw) — automated thread tracking, decision extraction, boot context generation,
|
|
3
|
+
> Conversation intelligence layer for [OpenClaw](https://github.com/openclaw/openclaw) — automated thread tracking, decision extraction, boot context generation, pre-compaction snapshots, and trace analysis.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@vainplex/openclaw-cortex)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
- **🚀 Generates boot context** — assembles a dense `BOOTSTRAP.md` at session start so the agent has continuity
|
|
15
15
|
- **📸 Pre-compaction snapshots** — saves thread state + hot snapshot before memory compaction
|
|
16
16
|
- **📖 Structured narratives** — generates 24h activity summaries from threads + decisions
|
|
17
|
+
- **🔍 Trace Analyzer** — 3-stage pipeline that detects failure signals, classifies findings with LLM triage, and generates PII-redacted reports
|
|
17
18
|
|
|
18
19
|
Works **alongside** `memory-core` (OpenClaw's built-in memory) — doesn't replace it.
|
|
19
20
|
|
|
@@ -393,11 +394,112 @@ The LLM sees a conversation snippet (configurable batch size) and returns:
|
|
|
393
394
|
- Hook errors → caught and logged, never crashes the gateway
|
|
394
395
|
- LLM timeout/error → falls back to regex-only, no data loss
|
|
395
396
|
|
|
397
|
+
## Trace Analyzer (v0.4.0)
|
|
398
|
+
|
|
399
|
+
The Trace Analyzer is a **3-stage pipeline** that processes NATS event streams to detect failure patterns in AI agent conversations. It reconstructs conversation chains, runs signal detection, classifies findings with an optional LLM triage step, applies PII redaction, and generates structured reports.
|
|
400
|
+
|
|
401
|
+
### 3-Stage Pipeline
|
|
402
|
+
|
|
403
|
+
```
|
|
404
|
+
Stage 1: Ingest + Reconstruct
|
|
405
|
+
NATS events → normalize → chain reconstruction (gap-based splitting)
|
|
406
|
+
|
|
407
|
+
Stage 2: Signal Detection + Classification
|
|
408
|
+
chains → 7 signal detectors (multi-language) → LLM triage (optional) → classified findings
|
|
409
|
+
|
|
410
|
+
Stage 3: Redaction + Output
|
|
411
|
+
findings → PII redaction → report assembly → Markdown/JSON output
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### 7 Signal Detectors
|
|
415
|
+
|
|
416
|
+
| Signal ID | Detects | Default |
|
|
417
|
+
|-----------|---------|---------|
|
|
418
|
+
| `SIG-CORRECTION` | User correcting the agent after a wrong response | ✅ enabled |
|
|
419
|
+
| `SIG-TOOL-FAIL` | Tool/function call failures and error responses | ✅ enabled |
|
|
420
|
+
| `SIG-DOOM-LOOP` | Agent stuck in repetitive retry loops | ✅ enabled |
|
|
421
|
+
| `SIG-DISSATISFIED` | User expressing frustration or dissatisfaction | ✅ enabled |
|
|
422
|
+
| `SIG-REPEAT-FAIL` | Same failure pattern recurring across sessions | ✅ enabled |
|
|
423
|
+
| `SIG-HALLUCINATION` | Agent making claims contradicted by tool output | ✅ enabled |
|
|
424
|
+
| `SIG-UNVERIFIED-CLAIM` | Agent stating facts without tool verification | ❌ disabled |
|
|
425
|
+
|
|
426
|
+
Each detector supports **multi-language signal patterns** — the same 10 languages as the core pattern engine (EN, DE, FR, ES, PT, IT, ZH, JA, KO, RU).
|
|
427
|
+
|
|
428
|
+
### Configuration
|
|
429
|
+
|
|
430
|
+
Add a `traceAnalyzer` section to your external config (`~/.openclaw/plugins/openclaw-cortex/config.json`):
|
|
431
|
+
|
|
432
|
+
```json
|
|
433
|
+
{
|
|
434
|
+
"traceAnalyzer": {
|
|
435
|
+
"enabled": true,
|
|
436
|
+
"nats": {
|
|
437
|
+
"url": "nats://localhost:4222",
|
|
438
|
+
"stream": "openclaw-events",
|
|
439
|
+
"subjectPrefix": "openclaw.events",
|
|
440
|
+
"user": "your-nats-user",
|
|
441
|
+
"password": "your-nats-password"
|
|
442
|
+
},
|
|
443
|
+
"schedule": {
|
|
444
|
+
"enabled": true,
|
|
445
|
+
"intervalHours": 24
|
|
446
|
+
},
|
|
447
|
+
"signals": {
|
|
448
|
+
"SIG-UNVERIFIED-CLAIM": { "enabled": true, "severity": "medium" }
|
|
449
|
+
},
|
|
450
|
+
"llm": {
|
|
451
|
+
"enabled": true,
|
|
452
|
+
"endpoint": "http://localhost:11434/v1",
|
|
453
|
+
"model": "mistral:7b"
|
|
454
|
+
},
|
|
455
|
+
"output": {
|
|
456
|
+
"maxFindings": 200,
|
|
457
|
+
"reportPath": "./reports/trace-analysis.md"
|
|
458
|
+
},
|
|
459
|
+
"redactPatterns": ["\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b"]
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
| Setting | Default | Description |
|
|
465
|
+
|---------|---------|-------------|
|
|
466
|
+
| `enabled` | `false` | Master switch for trace analysis |
|
|
467
|
+
| `nats.url` | `nats://localhost:4222` | NATS server URL |
|
|
468
|
+
| `nats.stream` | `openclaw-events` | JetStream stream name |
|
|
469
|
+
| `nats.user` | — | NATS username (required if auth enabled) |
|
|
470
|
+
| `nats.password` | — | NATS password (required if auth enabled) |
|
|
471
|
+
| `schedule.enabled` | `false` | Enable scheduled analysis runs |
|
|
472
|
+
| `schedule.intervalHours` | `24` | Hours between runs |
|
|
473
|
+
| `chainGapMinutes` | `30` | Inactivity gap for chain boundary detection |
|
|
474
|
+
| `llm.enabled` | `false` | Enable LLM-powered finding classification |
|
|
475
|
+
| `llm.triage` | — | Optional fast/local model for pre-filtering |
|
|
476
|
+
| `output.maxFindings` | `200` | Maximum findings per report |
|
|
477
|
+
| `output.reportPath` | — | Custom report output path |
|
|
478
|
+
| `redactPatterns` | `[]` | Regex patterns for PII redaction |
|
|
479
|
+
|
|
480
|
+
### Programmatic API
|
|
481
|
+
|
|
482
|
+
The trace analyzer is fully exported for programmatic use:
|
|
483
|
+
|
|
484
|
+
```typescript
|
|
485
|
+
import {
|
|
486
|
+
TraceAnalyzer,
|
|
487
|
+
createNatsTraceSource,
|
|
488
|
+
reconstructChains,
|
|
489
|
+
detectAllSignals,
|
|
490
|
+
classifyFindings,
|
|
491
|
+
redactChain,
|
|
492
|
+
assembleReport,
|
|
493
|
+
generateOutputs,
|
|
494
|
+
resolveTraceAnalyzerConfig,
|
|
495
|
+
} from "@vainplex/openclaw-cortex";
|
|
496
|
+
```
|
|
497
|
+
|
|
396
498
|
## Development
|
|
397
499
|
|
|
398
500
|
```bash
|
|
399
501
|
npm install
|
|
400
|
-
npm test #
|
|
502
|
+
npm test # 850 tests
|
|
401
503
|
npm run typecheck # TypeScript strict mode
|
|
402
504
|
npm run build # Compile to dist/
|
|
403
505
|
```
|
|
@@ -409,7 +511,7 @@ npm run build # Compile to dist/
|
|
|
409
511
|
- LLM enhancement: async, batched, fire-and-forget (never blocks hooks)
|
|
410
512
|
- Atomic file writes via `.tmp` + rename
|
|
411
513
|
- Noise filter prevents garbage threads from polluting state
|
|
412
|
-
- Tested with
|
|
514
|
+
- Tested with 850 unit + integration tests
|
|
413
515
|
|
|
414
516
|
## Architecture
|
|
415
517
|
|
|
@@ -426,6 +528,6 @@ All plugins live in one monorepo: [alberthild/vainplex-openclaw](https://github.
|
|
|
426
528
|
| # | Plugin | Version | Description |
|
|
427
529
|
|---|--------|---------|-------------|
|
|
428
530
|
| 1 | [@vainplex/nats-eventstore](https://github.com/alberthild/vainplex-openclaw/tree/main/packages/openclaw-nats-eventstore) | 0.2.1 | NATS JetStream event persistence + audit trail |
|
|
429
|
-
| 2 | **@vainplex/openclaw-cortex** | **0.
|
|
430
|
-
| 3 | [@vainplex/openclaw-knowledge-engine](https://github.com/alberthild/vainplex-openclaw/tree/main/packages/openclaw-knowledge-engine) | 0.1.
|
|
431
|
-
| 4 | [@vainplex/openclaw-governance](https://github.com/alberthild/vainplex-openclaw/tree/main/packages/openclaw-governance) | 0.3.
|
|
531
|
+
| 2 | **@vainplex/openclaw-cortex** | **0.4.0** | Conversation intelligence — threads, decisions, boot context, trace analysis, 10 languages (this plugin) |
|
|
532
|
+
| 3 | [@vainplex/openclaw-knowledge-engine](https://github.com/alberthild/vainplex-openclaw/tree/main/packages/openclaw-knowledge-engine) | 0.1.4 | Real-time fact extraction from conversations |
|
|
533
|
+
| 4 | [@vainplex/openclaw-governance](https://github.com/alberthild/vainplex-openclaw/tree/main/packages/openclaw-governance) | 0.3.2 | Policy-as-code — trust scoring, audit trail, production safeguards |
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAe,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAe,MAAM,gBAAgB,CAAC;AAGrE,cAAc,+BAA+B,CAAC;AAE9C,QAAA,MAAM,MAAM;;;;;kBAOI,iBAAiB;CA8ChC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,8 @@ import { registerCortexHooks } from "./src/hooks.js";
|
|
|
2
2
|
import { resolveWorkspace } from "./src/config.js";
|
|
3
3
|
import { loadConfig } from "./src/config-loader.js";
|
|
4
4
|
import { loadJson, rebootDir } from "./src/storage.js";
|
|
5
|
+
// ---- Trace Analyzer public API re-export ----
|
|
6
|
+
export * from "./src/trace-analyzer/index.js";
|
|
5
7
|
const plugin = {
|
|
6
8
|
id: "openclaw-cortex",
|
|
7
9
|
name: "OpenClaw Cortex",
|
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,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,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QAE5D,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;YAChD,OAAO;QACT,CAAC;QAED,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;QAE3E,6BAA6B;QAC7B,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAEjC,iCAAiC;QACjC,GAAG,CAAC,eAAe,CAAC;YAClB,IAAI,EAAE,cAAc;YACpB,WAAW,EAAE,4DAA4D;YACzE,WAAW,EAAE,IAAI;YACjB,OAAO,EAAE,GAAG,EAAE;gBACZ,IAAI,CAAC;oBACH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AC,MAAM,CAAC;oBACtE,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,IAAI,SAAS,CAAC;oBAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC;oBAExC,OAAO;wBACL,IAAI,EAAE;4BACJ,mBAAmB;4BACnB,YAAY,SAAS,UAAU,WAAW,SAAS;4BACnD,SAAS,IAAI,EAAE;4BACf,YAAY,OAAO,EAAE;yBACtB,CAAC,IAAI,CAAC,IAAI,CAAC;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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nats-trace-source.d.ts","sourceRoot":"","sources":["../../../src/trace-analyzer/nats-trace-source.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAa,MAAM,mBAAmB,CAAC;AAEhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"nats-trace-source.d.ts","sourceRoot":"","sources":["../../../src/trace-analyzer/nats-trace-source.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAa,MAAM,mBAAmB,CAAC;AAEhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAuFvD;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,mBAAmB,CAAC,MAAM,CAAC,EACvC,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAI7B"}
|
|
@@ -93,39 +93,75 @@ class NatsTraceSourceImpl {
|
|
|
93
93
|
}
|
|
94
94
|
async *fetchByTimeRange(startMs, endMs, opts) {
|
|
95
95
|
const sc = this.natsModule.StringCodec();
|
|
96
|
-
const
|
|
96
|
+
const info = await this.jsm.streams.info(this.config.stream);
|
|
97
|
+
const firstSeq = info.state.first_seq;
|
|
98
|
+
const lastSeq = info.state.last_seq;
|
|
99
|
+
// Binary search for approximate start sequence to avoid scanning from seq 1.
|
|
100
|
+
const startSeq = await this.findStartSequence(sc, firstSeq, lastSeq, startMs);
|
|
101
|
+
this.logger.info(`[trace-analyzer] Scanning seq ${startSeq}–${lastSeq} (skipped ${startSeq - firstSeq} of ${lastSeq - firstSeq + 1} events)`);
|
|
97
102
|
let yieldedCount = 0;
|
|
98
|
-
let
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
let batchCount = 0;
|
|
103
|
-
let pastEnd = false;
|
|
103
|
+
let missCount = 0;
|
|
104
|
+
const maxConsecutiveMisses = 50;
|
|
105
|
+
for (let seq = startSeq; seq <= lastSeq; seq++) {
|
|
106
|
+
let raw;
|
|
104
107
|
try {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
msg.ack();
|
|
109
|
-
if (result === "skip")
|
|
110
|
-
continue;
|
|
111
|
-
if (result === "past-end") {
|
|
112
|
-
messages.stop();
|
|
113
|
-
pastEnd = true;
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
yieldedCount++;
|
|
117
|
-
yield result.event;
|
|
118
|
-
}
|
|
108
|
+
const stored = await this.jsm.streams.getMessage(this.config.stream, { seq });
|
|
109
|
+
raw = JSON.parse(sc.decode(stored.data));
|
|
110
|
+
missCount = 0;
|
|
119
111
|
}
|
|
120
|
-
catch
|
|
121
|
-
|
|
122
|
-
|
|
112
|
+
catch {
|
|
113
|
+
missCount++;
|
|
114
|
+
if (missCount > maxConsecutiveMisses)
|
|
115
|
+
break;
|
|
116
|
+
continue;
|
|
123
117
|
}
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
const event = normalizeEvent(raw, seq);
|
|
119
|
+
if (!event)
|
|
120
|
+
continue;
|
|
121
|
+
if (event.ts < startMs)
|
|
122
|
+
continue;
|
|
123
|
+
if (event.ts > endMs)
|
|
124
|
+
break;
|
|
125
|
+
if (opts?.eventTypes && !opts.eventTypes.includes(event.type))
|
|
126
|
+
continue;
|
|
127
|
+
if (opts?.agents && !opts.agents.includes(event.agent))
|
|
128
|
+
continue;
|
|
129
|
+
yieldedCount++;
|
|
130
|
+
yield event;
|
|
126
131
|
}
|
|
127
132
|
this.logger.info(`[trace-analyzer] Fetched ${yieldedCount} events in time range`);
|
|
128
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Binary search for the first sequence whose timestamp is >= targetMs.
|
|
136
|
+
* Falls back to firstSeq if all events are after targetMs.
|
|
137
|
+
*/
|
|
138
|
+
async findStartSequence(sc, firstSeq, lastSeq, targetMs) {
|
|
139
|
+
let lo = firstSeq;
|
|
140
|
+
let hi = lastSeq;
|
|
141
|
+
while (lo < hi) {
|
|
142
|
+
const mid = Math.floor((lo + hi) / 2);
|
|
143
|
+
const ts = await this.getEventTimestamp(sc, mid);
|
|
144
|
+
if (ts === null || ts < targetMs) {
|
|
145
|
+
lo = mid + 1;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
hi = mid;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return lo;
|
|
152
|
+
}
|
|
153
|
+
/** Read the timestamp of a single event by sequence, returning null on failure. */
|
|
154
|
+
async getEventTimestamp(sc, seq) {
|
|
155
|
+
try {
|
|
156
|
+
const stored = await this.jsm.streams.getMessage(this.config.stream, { seq });
|
|
157
|
+
const raw = JSON.parse(sc.decode(stored.data));
|
|
158
|
+
const ts = (raw.ts ?? raw.timestamp);
|
|
159
|
+
return typeof ts === "number" ? ts : null;
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
129
165
|
async *fetchByAgent(agent, startMs, endMs, opts) {
|
|
130
166
|
yield* this.fetchByTimeRange(startMs, endMs, {
|
|
131
167
|
...opts,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nats-trace-source.js","sourceRoot":"","sources":["../../../src/trace-analyzer/nats-trace-source.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,kDAAkD;AAClD,+DAA+D;AAC/D,EAAE;AACF,8DAA8D;AAC9D,gEAAgE;AAChE,+BAA+B;AAC/B,EAAE;AACF,iEAAiE;AACjE,2DAA2D;AAC3D,+DAA+D;AAM/D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"nats-trace-source.js","sourceRoot":"","sources":["../../../src/trace-analyzer/nats-trace-source.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,kDAAkD;AAClD,+DAA+D;AAC/D,EAAE;AACF,8DAA8D;AAC9D,gEAAgE;AAChE,+BAA+B;AAC/B,EAAE;AACF,iEAAiE;AACjE,2DAA2D;AAC3D,+DAA+D;AAM/D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAkD7C;;;GAGG;AACH,KAAK,UAAU,cAAc,CAAC,MAAoB;IAChD,IAAI,CAAC;QACH,iEAAiE;QACjE,OAAO,MAAO,IAAI,QAAQ,CAAC,WAAW,EAAE,0BAA0B,CAAC,CAAC,MAAM,CAAyB,CAAC;IACtG,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,CAAC,IAAI,CAAC,+EAA+E,CAAC,CAAC;QAC7F,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,wEAAwE;AACxE,KAAK,UAAU,WAAW,CACxB,IAAgB,EAChB,UAAuC,EACvC,MAAoB;IAEpB,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,MAAM,IA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IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACtC,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACxC,CAAC;CACF"}
|
package/openclaw.plugin.json
CHANGED
|
@@ -146,10 +146,11 @@
|
|
|
146
146
|
"enum": [
|
|
147
147
|
"en",
|
|
148
148
|
"de",
|
|
149
|
-
"both"
|
|
149
|
+
"both",
|
|
150
|
+
"all"
|
|
150
151
|
],
|
|
151
152
|
"default": "both",
|
|
152
|
-
"description": "Language for regex pattern matching: English, German, or
|
|
153
|
+
"description": "Language for regex pattern matching: English, German, both, or all 10 languages"
|
|
153
154
|
}
|
|
154
155
|
}
|
|
155
156
|
},
|
|
@@ -193,6 +194,187 @@
|
|
|
193
194
|
"description": "Number of messages to buffer before calling the LLM"
|
|
194
195
|
}
|
|
195
196
|
}
|
|
197
|
+
},
|
|
198
|
+
"traceAnalyzer": {
|
|
199
|
+
"type": "object",
|
|
200
|
+
"additionalProperties": false,
|
|
201
|
+
"description": "Trace Analyzer — 3-stage pipeline for detecting failure signals in NATS event streams",
|
|
202
|
+
"properties": {
|
|
203
|
+
"enabled": {
|
|
204
|
+
"type": "boolean",
|
|
205
|
+
"default": false,
|
|
206
|
+
"description": "Master switch for trace analysis"
|
|
207
|
+
},
|
|
208
|
+
"nats": {
|
|
209
|
+
"type": "object",
|
|
210
|
+
"additionalProperties": false,
|
|
211
|
+
"properties": {
|
|
212
|
+
"url": {
|
|
213
|
+
"type": "string",
|
|
214
|
+
"default": "nats://localhost:4222",
|
|
215
|
+
"description": "NATS server URL"
|
|
216
|
+
},
|
|
217
|
+
"stream": {
|
|
218
|
+
"type": "string",
|
|
219
|
+
"default": "openclaw-events",
|
|
220
|
+
"description": "JetStream stream name"
|
|
221
|
+
},
|
|
222
|
+
"subjectPrefix": {
|
|
223
|
+
"type": "string",
|
|
224
|
+
"default": "openclaw.events",
|
|
225
|
+
"description": "NATS subject prefix"
|
|
226
|
+
},
|
|
227
|
+
"credentials": {
|
|
228
|
+
"type": "string",
|
|
229
|
+
"description": "Optional NATS credentials file path"
|
|
230
|
+
},
|
|
231
|
+
"user": {
|
|
232
|
+
"type": "string",
|
|
233
|
+
"description": "Optional NATS user"
|
|
234
|
+
},
|
|
235
|
+
"password": {
|
|
236
|
+
"type": "string",
|
|
237
|
+
"description": "Optional NATS password"
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
"schedule": {
|
|
242
|
+
"type": "object",
|
|
243
|
+
"additionalProperties": false,
|
|
244
|
+
"properties": {
|
|
245
|
+
"enabled": {
|
|
246
|
+
"type": "boolean",
|
|
247
|
+
"default": false,
|
|
248
|
+
"description": "Enable scheduled analysis runs"
|
|
249
|
+
},
|
|
250
|
+
"intervalHours": {
|
|
251
|
+
"type": "integer",
|
|
252
|
+
"minimum": 1,
|
|
253
|
+
"maximum": 168,
|
|
254
|
+
"default": 24,
|
|
255
|
+
"description": "Hours between scheduled runs"
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
"chainGapMinutes": {
|
|
260
|
+
"type": "integer",
|
|
261
|
+
"minimum": 1,
|
|
262
|
+
"maximum": 120,
|
|
263
|
+
"default": 30,
|
|
264
|
+
"description": "Inactivity gap in minutes for chain boundary detection"
|
|
265
|
+
},
|
|
266
|
+
"signals": {
|
|
267
|
+
"type": "object",
|
|
268
|
+
"description": "Per-signal toggles and severity overrides",
|
|
269
|
+
"additionalProperties": {
|
|
270
|
+
"type": "object",
|
|
271
|
+
"properties": {
|
|
272
|
+
"enabled": {
|
|
273
|
+
"type": "boolean"
|
|
274
|
+
},
|
|
275
|
+
"severity": {
|
|
276
|
+
"type": "string",
|
|
277
|
+
"enum": ["low", "medium", "high", "critical"]
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
"llm": {
|
|
283
|
+
"type": "object",
|
|
284
|
+
"additionalProperties": false,
|
|
285
|
+
"description": "LLM config for trace analysis finding classification",
|
|
286
|
+
"properties": {
|
|
287
|
+
"enabled": {
|
|
288
|
+
"type": "boolean",
|
|
289
|
+
"default": false,
|
|
290
|
+
"description": "Enable LLM-powered finding classification"
|
|
291
|
+
},
|
|
292
|
+
"endpoint": {
|
|
293
|
+
"type": "string",
|
|
294
|
+
"description": "OpenAI-compatible API endpoint"
|
|
295
|
+
},
|
|
296
|
+
"model": {
|
|
297
|
+
"type": "string",
|
|
298
|
+
"description": "Model identifier"
|
|
299
|
+
},
|
|
300
|
+
"apiKey": {
|
|
301
|
+
"type": "string",
|
|
302
|
+
"description": "API key (optional)"
|
|
303
|
+
},
|
|
304
|
+
"timeoutMs": {
|
|
305
|
+
"type": "integer",
|
|
306
|
+
"minimum": 1000,
|
|
307
|
+
"maximum": 120000,
|
|
308
|
+
"description": "Timeout per LLM call in milliseconds"
|
|
309
|
+
},
|
|
310
|
+
"triage": {
|
|
311
|
+
"type": "object",
|
|
312
|
+
"additionalProperties": false,
|
|
313
|
+
"description": "Optional fast/local triage model for pre-filtering",
|
|
314
|
+
"properties": {
|
|
315
|
+
"endpoint": {
|
|
316
|
+
"type": "string"
|
|
317
|
+
},
|
|
318
|
+
"model": {
|
|
319
|
+
"type": "string"
|
|
320
|
+
},
|
|
321
|
+
"apiKey": {
|
|
322
|
+
"type": "string"
|
|
323
|
+
},
|
|
324
|
+
"timeoutMs": {
|
|
325
|
+
"type": "integer",
|
|
326
|
+
"minimum": 1000,
|
|
327
|
+
"maximum": 60000
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
"output": {
|
|
334
|
+
"type": "object",
|
|
335
|
+
"additionalProperties": false,
|
|
336
|
+
"properties": {
|
|
337
|
+
"maxFindings": {
|
|
338
|
+
"type": "integer",
|
|
339
|
+
"minimum": 1,
|
|
340
|
+
"maximum": 1000,
|
|
341
|
+
"default": 200,
|
|
342
|
+
"description": "Maximum findings in a single report"
|
|
343
|
+
},
|
|
344
|
+
"reportPath": {
|
|
345
|
+
"type": "string",
|
|
346
|
+
"description": "Custom report output path"
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
"redactPatterns": {
|
|
351
|
+
"type": "array",
|
|
352
|
+
"items": { "type": "string" },
|
|
353
|
+
"default": [],
|
|
354
|
+
"description": "Regex patterns for PII redaction before LLM/disk writes"
|
|
355
|
+
},
|
|
356
|
+
"incrementalContextWindow": {
|
|
357
|
+
"type": "integer",
|
|
358
|
+
"minimum": 50,
|
|
359
|
+
"maximum": 5000,
|
|
360
|
+
"default": 500,
|
|
361
|
+
"description": "Context window size for incremental processing"
|
|
362
|
+
},
|
|
363
|
+
"fetchBatchSize": {
|
|
364
|
+
"type": "integer",
|
|
365
|
+
"minimum": 10,
|
|
366
|
+
"maximum": 5000,
|
|
367
|
+
"default": 500,
|
|
368
|
+
"description": "NATS consumer batch size for fetching events"
|
|
369
|
+
},
|
|
370
|
+
"maxEventsPerRun": {
|
|
371
|
+
"type": "integer",
|
|
372
|
+
"minimum": 100,
|
|
373
|
+
"maximum": 1000000,
|
|
374
|
+
"default": 100000,
|
|
375
|
+
"description": "Maximum events to process per run"
|
|
376
|
+
}
|
|
377
|
+
}
|
|
196
378
|
}
|
|
197
379
|
}
|
|
198
380
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vainplex/openclaw-cortex",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "OpenClaw plugin: conversation intelligence — thread tracking, decision extraction, boot context, pre-compaction snapshots",
|
|
3
|
+
"version": "0.4.2",
|
|
4
|
+
"description": "OpenClaw plugin: conversation intelligence — thread tracking, decision extraction, boot context, pre-compaction snapshots, trace analysis",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -18,11 +18,10 @@
|
|
|
18
18
|
"test:watch": "vitest",
|
|
19
19
|
"typecheck": "tsc --noEmit"
|
|
20
20
|
},
|
|
21
|
-
"dependencies": {},
|
|
22
21
|
"devDependencies": {
|
|
23
|
-
"vitest": "^3.0.0",
|
|
24
22
|
"@types/node": "^22.0.0",
|
|
25
|
-
"typescript": "^5.7.0"
|
|
23
|
+
"typescript": "^5.7.0",
|
|
24
|
+
"vitest": "^3.0.0"
|
|
26
25
|
},
|
|
27
26
|
"openclaw": {
|
|
28
27
|
"extensions": [
|
|
@@ -37,7 +36,10 @@
|
|
|
37
36
|
"memory",
|
|
38
37
|
"thread-tracking",
|
|
39
38
|
"boot-context",
|
|
40
|
-
"conversation-intelligence"
|
|
39
|
+
"conversation-intelligence",
|
|
40
|
+
"trace-analyzer",
|
|
41
|
+
"signal-detection",
|
|
42
|
+
"conversation-analysis"
|
|
41
43
|
],
|
|
42
44
|
"license": "MIT",
|
|
43
45
|
"repository": {
|
|
@@ -45,6 +47,9 @@
|
|
|
45
47
|
"url": "https://github.com/alberthild/vainplex-openclaw.git",
|
|
46
48
|
"directory": "packages/openclaw-cortex"
|
|
47
49
|
},
|
|
48
|
-
"homepage": "https://github.com/alberthild/openclaw-cortex
|
|
49
|
-
"author": "Albert Hild <a.hild@vainplex.de>"
|
|
50
|
+
"homepage": "https://github.com/alberthild/vainplex-openclaw/tree/main/packages/openclaw-cortex",
|
|
51
|
+
"author": "Albert Hild <a.hild@vainplex.de>",
|
|
52
|
+
"optionalDependencies": {
|
|
53
|
+
"nats": "^2.29.3"
|
|
54
|
+
}
|
|
50
55
|
}
|