shieldcortex 2.4.5 → 2.4.7
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
CHANGED
|
@@ -209,14 +209,47 @@ curl -X POST http://localhost:3001/api/v1/quarantine/1/reject
|
|
|
209
209
|
|
|
210
210
|
## OpenClaw Integration
|
|
211
211
|
|
|
212
|
+
**One command. Persistent memory for every OpenClaw session.**
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
sudo npx shieldcortex openclaw install
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
This installs the **cortex-memory** hook directly into OpenClaw's bundled hooks directory. No configuration needed.
|
|
219
|
+
|
|
220
|
+
### What It Does
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
Session Start During Session Session End (/new)
|
|
224
|
+
│ │ │
|
|
225
|
+
▼ ▼ ▼
|
|
226
|
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
227
|
+
│ Inject past │ │ "remember │ │ Auto-extract│
|
|
228
|
+
│ context │ │ this: ..." │ │ decisions, │
|
|
229
|
+
│ into agent │ │ → save │ │ fixes, etc. │
|
|
230
|
+
└─────────────┘ └─────────────┘ └─────────────┘
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
| Feature | What Happens |
|
|
234
|
+
|---------|--------------|
|
|
235
|
+
| **Context Injection** | On session start, relevant past memories are injected into the agent's bootstrap context |
|
|
236
|
+
| **Keyword Triggers** | Say "remember this:" or "don't forget:" followed by content to save it with critical importance |
|
|
237
|
+
| **Auto-Extraction** | On `/new`, the hook extracts architecture decisions, bug fixes, and learnings from the ending session |
|
|
238
|
+
| **Security** | All content passes through the 5-layer defence pipeline before storage |
|
|
239
|
+
|
|
240
|
+
### Shared Memory
|
|
241
|
+
|
|
242
|
+
The database (`~/.shieldcortex/memories.db`) is shared with Claude Code. Memories created in OpenClaw appear instantly in Claude Code sessions, and vice versa.
|
|
243
|
+
|
|
244
|
+
### Commands
|
|
245
|
+
|
|
212
246
|
```bash
|
|
213
|
-
npx shieldcortex openclaw install
|
|
247
|
+
sudo npx shieldcortex openclaw install # Install hook
|
|
248
|
+
sudo npx shieldcortex openclaw uninstall # Remove hook
|
|
249
|
+
npx shieldcortex openclaw status # Check status
|
|
214
250
|
```
|
|
215
251
|
|
|
216
|
-
|
|
217
|
-
- Auto-save on `/new` command
|
|
218
|
-
- Context injection on bootstrap
|
|
219
|
-
- Keyword triggers ("remember this...")
|
|
252
|
+
[Full documentation](docs/openclaw-integration.md)
|
|
220
253
|
|
|
221
254
|
---
|
|
222
255
|
|
|
@@ -7,7 +7,7 @@ metadata:
|
|
|
7
7
|
"openclaw":
|
|
8
8
|
{
|
|
9
9
|
"emoji": "🧠",
|
|
10
|
-
"events": ["command:new", "agent:bootstrap", "command"],
|
|
10
|
+
"events": ["command:new", "command:stop", "agent:bootstrap", "command"],
|
|
11
11
|
"requires": { "anyBins": ["npx"] },
|
|
12
12
|
"install": [{ "id": "community", "kind": "community", "label": "ShieldCortex" }],
|
|
13
13
|
},
|
|
@@ -25,6 +25,12 @@ Integrates [ShieldCortex](https://github.com/Drakon-Systems-Ltd/ShieldCortex) pe
|
|
|
25
25
|
2. Pattern-matches for decisions, bug fixes, learnings, architecture changes, and preferences
|
|
26
26
|
3. Saves up to 5 high-salience memories to ShieldCortex via mcporter
|
|
27
27
|
|
|
28
|
+
### On `/stop`, `/clear`, `/exit` (Session End)
|
|
29
|
+
1. Captures the current session transcript before it ends
|
|
30
|
+
2. Pattern-matches for important content (same patterns as `/new`)
|
|
31
|
+
3. Saves memories with a `session-stop` tag for tracking
|
|
32
|
+
4. **Ensures work is saved** even when explicitly ending a session
|
|
33
|
+
|
|
28
34
|
### On Session Start (Agent Bootstrap)
|
|
29
35
|
1. Calls Cortex `get_context` to retrieve relevant memories
|
|
30
36
|
2. Injects them into the agent's bootstrap context
|
|
@@ -187,6 +187,49 @@ async function onSessionEnd(event) {
|
|
|
187
187
|
console.log(`[cortex-memory] Saved ${saved}/${memories.length} memories from session`);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Handle command:stop — extract memories before session ends
|
|
192
|
+
* This fires when user explicitly calls /stop
|
|
193
|
+
*/
|
|
194
|
+
async function onSessionStop(event) {
|
|
195
|
+
const context = event.context || {};
|
|
196
|
+
const sessionEntry = context.sessionEntry || {};
|
|
197
|
+
const sessionFile = sessionEntry.sessionFile;
|
|
198
|
+
|
|
199
|
+
if (!sessionFile) {
|
|
200
|
+
console.log("[cortex-memory] No session file found for stop, skipping extraction");
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const messages = await getRecentMessages(sessionFile);
|
|
205
|
+
if (messages.length === 0) {
|
|
206
|
+
console.log("[cortex-memory] No messages to extract on stop");
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const memories = extractMemories(messages);
|
|
211
|
+
if (memories.length === 0) {
|
|
212
|
+
console.log("[cortex-memory] No high-salience content found on stop");
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
let saved = 0;
|
|
217
|
+
for (const mem of memories) {
|
|
218
|
+
const result = await callCortex("remember", {
|
|
219
|
+
title: mem.title,
|
|
220
|
+
content: mem.content,
|
|
221
|
+
category: mem.category,
|
|
222
|
+
project: "openclaw",
|
|
223
|
+
scope: "global",
|
|
224
|
+
importance: "high",
|
|
225
|
+
tags: "auto-extracted,openclaw-hook,session-stop",
|
|
226
|
+
});
|
|
227
|
+
if (result) saved++;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
console.log(`[cortex-memory] Saved ${saved}/${memories.length} memories on session stop`);
|
|
231
|
+
}
|
|
232
|
+
|
|
190
233
|
/**
|
|
191
234
|
* Handle agent:bootstrap — inject past context into agent
|
|
192
235
|
*/
|
|
@@ -216,7 +259,7 @@ async function onBootstrap(event) {
|
|
|
216
259
|
* Handle command events — check for keyword triggers
|
|
217
260
|
*/
|
|
218
261
|
async function onKeywordTrigger(event) {
|
|
219
|
-
if (event.action === "new" || event.action === "stop") return;
|
|
262
|
+
if (event.action === "new" || event.action === "stop" || event.action === "clear" || event.action === "exit") return;
|
|
220
263
|
|
|
221
264
|
const context = event.context || {};
|
|
222
265
|
const sessionEntry = context.sessionEntry || {};
|
|
@@ -263,6 +306,11 @@ const cortexMemoryHandler = async (event) => {
|
|
|
263
306
|
try {
|
|
264
307
|
if (event.type === "command" && event.action === "new") {
|
|
265
308
|
await onSessionEnd(event);
|
|
309
|
+
} else if (event.type === "command" && event.action === "stop") {
|
|
310
|
+
await onSessionStop(event);
|
|
311
|
+
} else if (event.type === "command" && (event.action === "clear" || event.action === "exit")) {
|
|
312
|
+
// Also save on clear/exit - these also end the session context
|
|
313
|
+
await onSessionStop(event);
|
|
266
314
|
} else if (event.type === "agent" && event.action === "bootstrap") {
|
|
267
315
|
await onBootstrap(event);
|
|
268
316
|
} else if (event.type === "command") {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shieldcortex",
|
|
3
|
-
"version": "2.4.
|
|
4
|
-
"description": "Complete memory system + security layer for AI agents. Persistent storage, semantic search, prompt injection firewall, credential protection, and audit trail. One package, full solution.",
|
|
3
|
+
"version": "2.4.7",
|
|
4
|
+
"description": "Complete memory system + security layer for AI agents. Native OpenClaw integration. Persistent storage, semantic search, prompt injection firewall, credential protection, and audit trail. One package, full solution.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -57,7 +57,11 @@
|
|
|
57
57
|
"ai-memory",
|
|
58
58
|
"credential-protection",
|
|
59
59
|
"audit-trail",
|
|
60
|
-
"trust-scoring"
|
|
60
|
+
"trust-scoring",
|
|
61
|
+
"openclaw",
|
|
62
|
+
"moltbot",
|
|
63
|
+
"clawdbot",
|
|
64
|
+
"coding-assistant"
|
|
61
65
|
],
|
|
62
66
|
"author": "Michael Kyriacou",
|
|
63
67
|
"license": "MIT",
|