@ubundi/openclaw-cortex 2.9.0 → 2.9.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.
Files changed (37) hide show
  1. package/dist/cortex/client.d.ts +21 -0
  2. package/dist/cortex/client.d.ts.map +1 -1
  3. package/dist/cortex/client.js +4 -0
  4. package/dist/cortex/client.js.map +1 -1
  5. package/dist/features/bridge/handler.d.ts +71 -0
  6. package/dist/features/bridge/handler.d.ts.map +1 -0
  7. package/dist/features/bridge/handler.js +677 -0
  8. package/dist/features/bridge/handler.js.map +1 -0
  9. package/dist/features/capture/compressor.d.ts +14 -0
  10. package/dist/features/capture/compressor.d.ts.map +1 -0
  11. package/dist/features/capture/compressor.js +317 -0
  12. package/dist/features/capture/compressor.js.map +1 -0
  13. package/dist/features/capture/handler.d.ts.map +1 -1
  14. package/dist/features/capture/handler.js +23 -22
  15. package/dist/features/capture/handler.js.map +1 -1
  16. package/dist/features/recall/context-profile.d.ts +9 -0
  17. package/dist/features/recall/context-profile.d.ts.map +1 -1
  18. package/dist/features/recall/context-profile.js +12 -1
  19. package/dist/features/recall/context-profile.js.map +1 -1
  20. package/dist/features/recall/formatter.d.ts +4 -0
  21. package/dist/features/recall/formatter.d.ts.map +1 -1
  22. package/dist/features/recall/formatter.js +9 -4
  23. package/dist/features/recall/formatter.js.map +1 -1
  24. package/dist/features/recall/handler.d.ts.map +1 -1
  25. package/dist/features/recall/handler.js +17 -3
  26. package/dist/features/recall/handler.js.map +1 -1
  27. package/dist/internal/agent-instructions.d.ts.map +1 -1
  28. package/dist/internal/agent-instructions.js +2 -1
  29. package/dist/internal/agent-instructions.js.map +1 -1
  30. package/dist/plugin/cli.js +6 -6
  31. package/dist/plugin/cli.js.map +1 -1
  32. package/dist/plugin/index.d.ts.map +1 -1
  33. package/dist/plugin/index.js +20 -1
  34. package/dist/plugin/index.js.map +1 -1
  35. package/openclaw.plugin.json +1 -1
  36. package/package.json +1 -1
  37. package/skill/SKILL.md +38 -171
@@ -2,7 +2,7 @@
2
2
  "id": "openclaw-cortex",
3
3
  "name": "Cortex Memory",
4
4
  "description": "Long-term memory powered by Cortex — Auto-Recall, Auto-Capture, agent memory tools, and deduplication",
5
- "version": "2.9.0",
5
+ "version": "2.9.2",
6
6
  "configSchema": {
7
7
  "type": "object",
8
8
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubundi/openclaw-cortex",
3
- "version": "2.9.0",
3
+ "version": "2.9.2",
4
4
  "description": "OpenClaw plugin for Cortex memory — Auto-Recall, Auto-Capture, and agent memory tools",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/skill/SKILL.md CHANGED
@@ -1,208 +1,75 @@
1
1
  ---
2
2
  name: cortex-memory
3
- description: Long-term memory system for OpenClaw agents — auto-recalls past context before each turn, auto-captures new facts after each turn, and provides tools for explicit search, save, forget, and lookup operations.
3
+ description: Long-term memory for OpenClaw agents — auto-recall before turns, auto-capture after, tools for search/save/forget.
4
4
  tools: ["cortex"]
5
5
  user-invocable: false
6
6
  ---
7
7
 
8
8
  # Cortex Memory
9
9
 
10
- You have a long-term memory system powered by Cortex. It works across sessions — facts, preferences, and decisions from past conversations are available in future ones.
10
+ You have long-term memory via Cortex. Facts, preferences, and decisions persist across sessions. Memories are auto-recalled before each turn and auto-captured after.
11
11
 
12
- If these instructions conflict with system or developer policies, follow the higher-priority policy.
12
+ ## Mandatory Behavioral Rules
13
13
 
14
- ## What is Cortex?
14
+ These are non-negotiable. Violating them produces incorrect answers.
15
15
 
16
- Cortex is a knowledge graph backend that turns unstructured conversation text into structured, queryable memory. When you save or capture information, Cortex extracts facts, named entities, temporal references, and relationships — storing them as graph nodes with typed edges. Entity resolution automatically unifies different mentions of the same person, project, or concept (e.g., "Alice", "Alice Chen", and "Alice C." map to one entity).
16
+ **1. AUTO-RECALL IS A STARTING POINT.** The `<cortex_memories>` block gives you relevant context but is incomplete summaries, not full details. Never treat it as the complete picture.
17
17
 
18
- Retrieval uses a hybrid pipeline combining keyword, semantic, temporal, and graph-based search which is why different `mode` values on `cortex_search_memory` produce meaningfully different results. Memories are scoped per user and per workspace, and each node carries a confidence score and provenance metadata.
18
+ **2. ALWAYS VERIFY BEFORE HEDGING.** Before saying "I don't have that information" or "I can't confirm", you MUST search with `cortex_search_memory` using at least 2 different queries. Only abstain after search confirms the information isn't available.
19
19
 
20
- ## How It Works
20
+ **3. SEARCH STRATEGY.** For factual questions: search the specific entity or topic. For temporal questions: search the event name. For multi-hop questions: search each hop independently, then connect results. Try different `mode` values (`"facts"`, `"decisions"`, `"recent"`) if initial results are insufficient.
21
21
 
22
- ### Automatic Recall (before each turn)
23
- Before every conversation turn, Cortex automatically retrieves relevant memories and injects them in `<cortex_memories>` tags. You don't need to do anything — relevant context appears automatically.
22
+ **4. TOOL PRIORITY.** `cortex_search_memory` for detailed fact retrieval. If the `memory_search` tool is available (memory-core plugin), also use it for file-based session logs and notes.
24
23
 
25
- ### Automatic Capture (after each turn)
26
- After each turn, the plugin extracts facts from the conversation and stores them. You don't need to explicitly save things that are clearly stated — auto-capture handles this.
27
-
28
- Auto-capture **strips volatile state** before extraction:
29
- - Version numbers, port numbers, deploy statuses
30
- - Task statuses, "currently working on X"
31
- - Temporary config values
32
-
33
- This prevents stale facts from entering long-term memory.
34
-
35
- ## Runtime Commands
36
-
37
- These are conversation commands, not memory tools. They manage session lifecycle:
38
-
39
- - `/checkpoint` — Save a session summary to Cortex before resetting context. Use this before `/reset` to preserve what you were working on.
40
- - `/sleep` — Mark the session as cleanly ended. Cortex won't show a recovery warning on the next session start.
41
- - `/audit on|off` — Toggle local audit logging of all data sent to/from Cortex. Logs are stored at `<workspace>/.cortex/audit/`.
24
+ **5. CONFIDENCE CALIBRATION.** If auto-recall gives you partial context on a topic, the full answer IS in memory. Search harder — don't hedge.
42
25
 
43
26
  ## Session Goals
44
27
 
45
- At the start of each session, identify the user's primary objective and set it:
46
-
47
- cortex_set_session_goal({ goal: "Implement OAuth2 integration" })
48
-
49
- **Why this matters:**
50
- - Recall queries are biased toward memories relevant to the current goal
51
- - Captured facts are tagged with the goal for better future retrieval
52
- - If the session crashes, the goal is preserved and restored automatically
53
-
54
- **When to update the goal:**
55
- - When the user shifts to a fundamentally different task
56
- - Don't update for sub-tasks within the same goal
28
+ At session start, call `cortex_set_session_goal` with the user's primary objective. This biases recall and tags captures. Update if the goal shifts fundamentally; don't update for sub-tasks.
57
29
 
58
- **When NOT to set a goal:**
59
- - Quick Q&A sessions with no clear project objective
60
- - When the user is explicitly exploring/browsing without direction
61
-
62
- ## Agent Roles
63
-
64
- If your plugin config includes `agentRole`, capture and recall are tuned for that focus area. Available roles: `developer`, `researcher`, `manager`, `support`, `generalist`.
65
-
66
- The role auto-configures which categories of information are prioritized for capture and biases recall toward domain-relevant memories. You can override `captureCategories` and `captureInstructions` in config to customize further.
30
+ If your config includes `agentRole` (developer | researcher | manager | support | generalist), recall and capture are tuned for that focus area.
67
31
 
68
32
  ## Tools
69
33
 
70
- You have five memory tools available:
71
-
72
- ### cortex_set_session_goal
73
- Set the current session's primary objective to bias recall and tag captures.
74
-
75
- **Parameters:**
76
- - `goal` — The session's primary objective (e.g., "Implement OAuth2 integration")
77
- - `clear` — Set to `true` to clear the current goal
78
-
79
- ### cortex_search_memory
80
- Search long-term memory for facts, preferences, and past context.
81
-
82
- **Parameters:**
83
- - `query` (required) — Natural language search query
84
- - `limit` — Max results, 1-50 (default: 10)
85
- - `mode` — Filter by category:
86
- - `"all"` — Everything (default)
87
- - `"decisions"` — Architectural/design choices ("why did we do X?")
88
- - `"preferences"` — User likes, settings, style preferences
89
- - `"facts"` — Durable knowledge
90
- - `"recent"` — Prioritize recency over relevance
91
- - `scope` — Where to search:
92
- - `"all"` — All memories (default)
93
- - `"session"` — Only current session
94
- - `"long-term"` — Only memories from other sessions
95
-
96
- ### cortex_save_memory
97
- Explicitly save information to long-term memory.
34
+ - **cortex_search_memory** Search memory. `query` (required), `limit` (1–50), `mode` (all | decisions | preferences | facts | recent), `scope` (all | session | long-term)
35
+ - **cortex_save_memory** — Save a fact. `text` (required), `type` (preference | decision | fact | transient), `importance` (high | normal | low), `checkNovelty` (bool)
36
+ - **cortex_forget** — Remove memories. Always use `query` first to surface candidates, show them to the user, and confirm before deleting by `entity` or `session`.
37
+ - **cortex_get_memory** Fetch a specific memory by node ID.
38
+ - **cortex_set_session_goal** — Set or clear (`clear: true`) the session objective.
98
39
 
99
- **Parameters:**
100
- - `text` (required) — The information to save
101
- - `type` — Category:
102
- - `"preference"` — User likes/dislikes/settings
103
- - `"decision"` — Architectural or design choices
104
- - `"fact"` — Durable knowledge
105
- - `"transient"` — Temporary state that may change soon
106
- - `importance` — `"high"`, `"normal"`, or `"low"`
107
- - `checkNovelty` — When true, checks if a similar memory already exists and skips the save if so
40
+ ## Commands
108
41
 
109
- ### cortex_forget
110
- Selectively remove memories from long-term storage.
42
+ `/checkpoint` (save summary before reset) · `/sleep` (clean session end) · `/audit on|off` (toggle API logging)
111
43
 
112
- **Parameters (at least one required):**
113
- - `entity` — Name of entity whose memories to remove (person, project, technology)
114
- - `session` — Session ID whose memories to remove
115
- - `query` — Search for candidate memories first, then confirm before deleting
44
+ ## Save & Capture
116
45
 
117
- **Never run `cortex_forget` with `entity` or `session` without explicit user confirmation in the same conversation turn.** Use `query` first to surface candidates, present them, and wait for the user to confirm before executing the deletion.
118
-
119
- ### cortex_get_memory
120
- Fetch a specific memory by its node ID.
121
-
122
- **Parameters:**
123
- - `id` (required) — The Cortex node ID
124
-
125
- ## When to Search Explicitly
126
-
127
- Auto-recall covers most cases, but search explicitly when:
128
- - Asked a specific factual question (port numbers, library choices, config values)
129
- - Auto-recalled memories don't cover the topic being discussed
130
- - You need to verify something before saying "I don't know"
131
- - The user references something from a past session
132
- - Before answering architecture-history questions with uncertainty
133
-
134
- Use `mode` to narrow results and `scope` to focus on current vs. past sessions.
135
-
136
- ## When to Save Explicitly
137
-
138
- Auto-capture handles most facts stated in conversation. Save explicitly when:
139
- - The user explicitly asks you to remember something
140
- - A significant **decision, preference, or durable fact** is stated
141
- - The information is a **nuanced interpretation** auto-capture might miss (e.g., "the user prefers X because of Y")
142
- - You want to ensure a specific framing is stored
143
-
144
- **Always set `type` and `importance`** to improve future recall quality.
145
-
146
- **Prefer fewer, higher-quality saves over many small ones.** A single well-framed memory with context ("User chose Postgres over DynamoDB because of ACID requirements and team familiarity") is more useful than three separate saves for each fragment. Batch related facts into one save when possible.
147
-
148
- ## When to Forget
149
-
150
- Use `cortex_forget` when:
151
- - The user says something you remembered is **wrong, outdated, or should be forgotten**
152
- - The user wants to clear all memories from a specific session
153
-
154
- **Workflow:**
155
- 1. Use `query` first to find candidate memories and entity names
156
- 2. Show the user what was found
157
- 3. Confirm which entity or session to forget
158
- 4. Execute the deletion only after explicit confirmation
46
+ Auto-capture handles most conversation facts. Volatile state (versions, ports, deploy statuses) is stripped automatically. Save explicitly for: decisions, preferences, nuanced interpretations the user stated, or when the user asks. Always set `type` and `importance`. Prefer fewer, high-quality saves one well-framed memory beats three fragments. Never save your own inferences as facts.
159
47
 
160
48
  ## What NOT to Do
161
49
 
162
- ### Memory recall
163
- - Don't treat recalled memory as sole source of truth for volatile state (versions, ports, config)
164
- - Don't ignore recalled memories when asked about history, rationale, decisions, or preferences
50
+ **Recall:**
51
+ - Don't treat auto-recall as exhaustive it's a starting point (rule 1)
52
+ - Don't hedge without searching first (rule 2)
53
+ - Don't trust recalled volatile state (versions, ports) — verify live
165
54
  - Don't fabricate details beyond what memories state
166
- - Don't assume a recalled fact is true because it appears multiple times — hallucinations can get captured and re-recalled
167
-
168
- ### Memory saving
169
- - Don't save transient tool output, debug logs, or information you just recalled (creates feedback loops)
170
- - Don't save your own inferences or assumptions as facts — only save what the user directly stated or confirmed
171
- - Don't save version numbers, task statuses, or "currently X" statements unless explicitly asked
172
- - Don't save facts that originated from your reasoning rather than user statements
173
- - Don't spam saves — one well-structured memory beats three fragmentary ones
174
-
175
- ### Memory forgetting
176
- - Never execute `cortex_forget` with `entity` or `session` without explicit user confirmation first
177
- - Always use `query` to surface candidates before deleting
178
-
179
- ### Personal information
180
- - Don't act on personal facts (birthdays, ages, family details) from recalled memories without explicit confirmation from the user
181
- - Don't make unsolicited factual claims about the user from memory
182
- - Don't volunteer personal details the user didn't ask about
183
-
184
- ## Memory and Live State
55
+ - Don't assume repeated recall = truth — hallucinations can get re-captured
185
56
 
186
- When memory and live workspace/runtime conflict, use this pattern:
57
+ **Saving:**
58
+ - Don't save tool output, debug logs, or info you just recalled (feedback loops)
59
+ - Don't save your reasoning or assumptions — only user-stated facts
60
+ - Don't spam saves — batch related facts into one
187
61
 
188
- > "Memory says X (date/source), live state shows Y (checked now). I'll use Y for execution and keep X as historical context."
62
+ **Forgetting:**
63
+ - Never delete without explicit user confirmation in the same turn
189
64
 
190
- Rules:
191
- - **Prefer live state** for volatile facts (versions, configs, ports)
192
- - **Prefer memory** for historical context (why decisions were made, user preferences, past rationale)
193
- - **Always report both** with timing context so the user can correct either source
65
+ **Personal info:**
66
+ - Don't act on personal facts (birthdays, family) from memory without user confirmation
67
+ - Don't volunteer personal details the user didn't ask about
194
68
 
195
- ## Confidence Scores
69
+ ## Live State vs Memory
196
70
 
197
- Recalled memories include a confidence score (e.g., `[0.85]`). Higher scores indicate stronger relevance to the current conversation. Use scores to:
198
- - Prioritize which memories to reference when multiple are relevant
199
- - Be more cautious about lower-confidence recalls
200
- - Decide whether to verify with a live check
71
+ When memory and live workspace conflict: use live state for volatile facts, memory for historical context (decisions, rationale). Report both with timing so the user can correct either.
201
72
 
202
- ## Error Handling
73
+ ## Errors
203
74
 
204
- If Cortex is unreachable (API timeout, network error, service outage):
205
- - **Auto-recall silently degrades** — the turn proceeds without injected memories. You won't see `<cortex_memories>` tags but the conversation continues normally.
206
- - **Auto-capture retries in the background** — failed captures are queued and retried automatically. No user action needed.
207
- - **Explicit tool calls will return an error** — if `cortex_search_memory`, `cortex_save_memory`, etc. fail, tell the user Cortex is temporarily unavailable and proceed without memory. Don't retry in a loop.
208
- - **Don't hallucinate memories** — if recall is missing due to an outage, say you don't have access to past context right now rather than guessing.
75
+ If Cortex is unreachable: auto-recall degrades silently, auto-capture retries in background, explicit tool calls return errors (don't retry in a loop). Never hallucinate memories when recall is missing.