From 8db3154cffc0924e60c3ff046ea33d21e367b785 Mon Sep 17 00:00:00 2001 From: dtzp555 Date: Tue, 31 Mar 2026 14:25:19 +1000 Subject: [PATCH] feat: add ignorePatterns to filter cron/subagent noise (v3.1) --- index.js | 13 +++++++++++++ openclaw.plugin.json | 9 +++++++++ 2 files changed, 22 insertions(+) diff --git a/index.js b/index.js index 0630157..e793402 100644 --- a/index.js +++ b/index.js @@ -353,6 +353,19 @@ const plugin = { return cleaned.length > 10; }); + // Check ignore patterns — skip sessions matching cron/subagent noise + const ignorePatterns = (config.ignorePatterns || []) + .map(p => { try { return new RegExp(p, "i"); } catch { return null; } }) + .filter(Boolean); + + if (ignorePatterns.length > 0 && realUserMsgs.length > 0) { + const firstMsg = realUserMsgs[0]; + if (ignorePatterns.some(re => re.test(firstMsg))) { + log.info?.("[memory-continuity] Session matches ignorePattern, skipping"); + return; + } + } + const existing = readFile(statePath); const newState = extractStateFromMessages(messages); if (!newState) { diff --git a/openclaw.plugin.json b/openclaw.plugin.json index 572c7eb..50688b2 100644 --- a/openclaw.plugin.json +++ b/openclaw.plugin.json @@ -27,6 +27,11 @@ "type": "number", "default": 20, "description": "Maximum number of archive files to keep in session_archive/" + }, + "ignorePatterns": { + "type": "array", + "default": [], + "description": "Regex patterns to ignore sessions (e.g. cron jobs, subagent noise). Matched against first user message." } } }, @@ -46,6 +51,10 @@ "maxArchiveCount": { "label": "Max archive files", "help": "Old archives are auto-deleted when this limit is reached" + }, + "ignorePatterns": { + "label": "Ignore patterns", + "help": "Skip state extraction for sessions matching these patterns (regex)" } } } \ No newline at end of file