mirror of
https://github.com/dtzp555-max/memory-continuity.git
synced 2026-07-19 09:42:42 +00:00
feat: add ignorePatterns to filter cron/subagent noise (v3.1)
This commit is contained in:
@@ -353,6 +353,19 @@ const plugin = {
|
|||||||
return cleaned.length > 10;
|
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 existing = readFile(statePath);
|
||||||
const newState = extractStateFromMessages(messages);
|
const newState = extractStateFromMessages(messages);
|
||||||
if (!newState) {
|
if (!newState) {
|
||||||
|
|||||||
@@ -27,6 +27,11 @@
|
|||||||
"type": "number",
|
"type": "number",
|
||||||
"default": 20,
|
"default": 20,
|
||||||
"description": "Maximum number of archive files to keep in session_archive/"
|
"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": {
|
"maxArchiveCount": {
|
||||||
"label": "Max archive files",
|
"label": "Max archive files",
|
||||||
"help": "Old archives are auto-deleted when this limit is reached"
|
"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)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user