openclaw-memory-alibaba-local 1.0.6 → 1.0.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/index.ts +32 -0
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -2052,6 +2052,19 @@ const memoryPlugin = {
|
|
|
2052
2052
|
if (!db || !backend) return;
|
|
2053
2053
|
if (!event.prompt || event.prompt.length < 5) return;
|
|
2054
2054
|
|
|
2055
|
+
// Skip recall for system/bootstrap prompts (/new, /reset, session startup).
|
|
2056
|
+
const promptLower = event.prompt.toLowerCase();
|
|
2057
|
+
if (
|
|
2058
|
+
promptLower.includes("a new session was started") ||
|
|
2059
|
+
promptLower.includes("session startup sequence") ||
|
|
2060
|
+
promptLower.includes("/new or /reset") ||
|
|
2061
|
+
promptLower.startsWith("system:") ||
|
|
2062
|
+
promptLower.startsWith("run your session")
|
|
2063
|
+
) {
|
|
2064
|
+
console.log("[openclaw-memory-alibaba-local] recall skip (system/bootstrap prompt)");
|
|
2065
|
+
return;
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2055
2068
|
try {
|
|
2056
2069
|
const extracted = extractUserQueryForRecall(event.prompt);
|
|
2057
2070
|
if (extracted.query.length < 5) {
|
|
@@ -2144,6 +2157,25 @@ const memoryPlugin = {
|
|
|
2144
2157
|
const trigger = (ctx as { trigger?: string }).trigger;
|
|
2145
2158
|
const isUserTrigger = trigger === "user";
|
|
2146
2159
|
|
|
2160
|
+
// Skip memory extraction for system/bootstrap sessions (/new, /reset).
|
|
2161
|
+
// Check the last user message for known bootstrap patterns.
|
|
2162
|
+
if (isUserTrigger) {
|
|
2163
|
+
const lastUserMsg = [...event.messages].reverse().find(
|
|
2164
|
+
(m: any) => m && typeof m === "object" && (m as Record<string, unknown>).role === "user",
|
|
2165
|
+
) as Record<string, unknown> | undefined;
|
|
2166
|
+
const lastUserText = typeof lastUserMsg?.content === "string" ? lastUserMsg.content.toLowerCase() : "";
|
|
2167
|
+
if (
|
|
2168
|
+
lastUserText.includes("a new session was started") ||
|
|
2169
|
+
lastUserText.includes("session startup sequence") ||
|
|
2170
|
+
lastUserText.includes("/new or /reset") ||
|
|
2171
|
+
lastUserText.startsWith("system:") ||
|
|
2172
|
+
lastUserText.startsWith("run your session")
|
|
2173
|
+
) {
|
|
2174
|
+
console.log("[openclaw-memory-alibaba-local] agent_end skip capture (system/bootstrap session)");
|
|
2175
|
+
return;
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2147
2179
|
try {
|
|
2148
2180
|
const tCap0 = Date.now();
|
|
2149
2181
|
const storageSessionKey = resolveStorageSessionKey(ctx);
|