feat: add ignorePatterns to filter cron/subagent noise (v3.1)

This commit is contained in:
2026-03-31 14:25:19 +10:00
parent cc0aad38cb
commit 8db3154cff
2 changed files with 22 additions and 0 deletions
+13
View File
@@ -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) {
+9
View File
@@ -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)"
}
}
}