🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix(memory): preserve frozen non-stateful invalidation patterns
Rudy Celekli681f0b488bfb
diff --git a/v3/@claude-flow/memory/src/cache-manager-invalidation-regression.test.ts b/v3/@claude-flow/memory/src/cache-manager-invalidation-regression.test.tsindex 93c2afce45..0b6125804d 100644--- a/v3/@claude-flow/memory/src/cache-manager-invalidation-regression.test.ts+++ b/v3/@claude-flow/memory/src/cache-manager-invalidation-regression.test.ts@@ -27,4 +27,12 @@ describe('stateful cache invalidation patterns', () => {expect(cache.invalidatePattern(pattern)).toBe(1);expect(pattern.lastIndex).toBe(4);});+ it('accepts a frozen non-global pattern without mutating its cursor', () => {+ const cache = new CacheManager<string>();+ caches.push(cache);+ cache.set('article-one', 'old');+ const pattern = Object.freeze(/article/);+ expect(cache.invalidatePattern(pattern)).toBe(1);+ expect(pattern.lastIndex).toBe(0);+ });});diff --git a/v3/@claude-flow/memory/src/cache-manager.ts b/v3/@claude-flow/memory/src/cache-manager.tsindex 191cf43417..0d1f64505d 100644--- a/v3/@claude-flow/memory/src/cache-manager.ts+++ b/v3/@claude-flow/memory/src/cache-manager.ts@@ -297,10 +297,11 @@ export class CacheManager<T = MemoryEntry> extends EventEmitter {for (const key of this.cache.keys()) {// RegExp cursors belong to a single input, not the whole key sequence.+ const stateful = regex.global || regex.sticky;const lastIndex = regex.lastIndex;- regex.lastIndex = 0;+ if (stateful) regex.lastIndex = 0;const matches = regex.test(key);- regex.lastIndex = lastIndex;+ if (stateful) regex.lastIndex = lastIndex;if (matches) {this.delete(key);invalidated++;