cmp-standards 2.7.0 → 2.8.0
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/README.md +633 -633
- package/dist/cache/EmbeddingCache.d.ts +110 -0
- package/dist/cache/EmbeddingCache.d.ts.map +1 -0
- package/dist/cache/EmbeddingCache.js +239 -0
- package/dist/cache/EmbeddingCache.js.map +1 -0
- package/dist/cache/index.d.ts +6 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +6 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cli/index.js +0 -0
- package/dist/db/cloud.d.ts +1 -0
- package/dist/db/cloud.d.ts.map +1 -1
- package/dist/db/drizzle-client.d.ts +10 -1
- package/dist/db/drizzle-client.d.ts.map +1 -1
- package/dist/db/drizzle-client.js +57 -3
- package/dist/db/drizzle-client.js.map +1 -1
- package/dist/db/errors.d.ts +13 -1
- package/dist/db/errors.d.ts.map +1 -1
- package/dist/db/errors.js +49 -5
- package/dist/db/errors.js.map +1 -1
- package/dist/db/migrations.d.ts +42 -0
- package/dist/db/migrations.d.ts.map +1 -0
- package/dist/db/migrations.js +173 -0
- package/dist/db/migrations.js.map +1 -0
- package/dist/db/turso-client.d.ts +15 -3
- package/dist/db/turso-client.d.ts.map +1 -1
- package/dist/db/turso-client.js +50 -39
- package/dist/db/turso-client.js.map +1 -1
- package/dist/eslint/rules/no-async-useeffect.js +6 -6
- package/dist/events/EventBus.d.ts +97 -0
- package/dist/events/EventBus.d.ts.map +1 -0
- package/dist/events/EventBus.js +256 -0
- package/dist/events/EventBus.js.map +1 -0
- package/dist/events/index.d.ts +7 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +9 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/types.d.ts +989 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/events/types.js +136 -0
- package/dist/events/types.js.map +1 -0
- package/dist/experts/ConsensusEngine.d.ts +57 -0
- package/dist/experts/ConsensusEngine.d.ts.map +1 -0
- package/dist/experts/ConsensusEngine.js +146 -0
- package/dist/experts/ConsensusEngine.js.map +1 -0
- package/dist/experts/ExpertPanelService.d.ts +84 -0
- package/dist/experts/ExpertPanelService.d.ts.map +1 -0
- package/dist/experts/ExpertPanelService.js +204 -0
- package/dist/experts/ExpertPanelService.js.map +1 -0
- package/dist/experts/ExpertRouter.d.ts +68 -0
- package/dist/experts/ExpertRouter.d.ts.map +1 -0
- package/dist/experts/ExpertRouter.js +374 -0
- package/dist/experts/ExpertRouter.js.map +1 -0
- package/dist/experts/VoteCollector.d.ts +58 -0
- package/dist/experts/VoteCollector.d.ts.map +1 -0
- package/dist/experts/VoteCollector.js +146 -0
- package/dist/experts/VoteCollector.js.map +1 -0
- package/dist/experts/index.d.ts +9 -0
- package/dist/experts/index.d.ts.map +1 -0
- package/dist/experts/index.js +13 -0
- package/dist/experts/index.js.map +1 -0
- package/dist/hooks/cloud-pre-tool-use.js +20 -20
- package/dist/hooks/expert-review.d.ts +74 -0
- package/dist/hooks/expert-review.d.ts.map +1 -0
- package/dist/hooks/expert-review.js +220 -0
- package/dist/hooks/expert-review.js.map +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces/index.d.ts +450 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +50 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/mcp/schemas.d.ts +278 -0
- package/dist/mcp/schemas.d.ts.map +1 -0
- package/dist/mcp/schemas.js +166 -0
- package/dist/mcp/schemas.js.map +1 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +14 -3
- package/dist/mcp/server.js.map +1 -1
- package/dist/patterns/feedback-loop.d.ts +264 -0
- package/dist/patterns/feedback-loop.d.ts.map +1 -0
- package/dist/patterns/feedback-loop.js +329 -0
- package/dist/patterns/feedback-loop.js.map +1 -0
- package/dist/patterns/index.d.ts +9 -0
- package/dist/patterns/index.d.ts.map +1 -0
- package/dist/patterns/index.js +9 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/patterns/lifecycle.d.ts +88 -0
- package/dist/patterns/lifecycle.d.ts.map +1 -0
- package/dist/patterns/lifecycle.js +284 -0
- package/dist/patterns/lifecycle.js.map +1 -0
- package/dist/patterns/registry.d.ts +142 -0
- package/dist/patterns/registry.d.ts.map +1 -0
- package/dist/patterns/registry.js +442 -0
- package/dist/patterns/registry.js.map +1 -0
- package/dist/performance/Debouncer.d.ts +91 -0
- package/dist/performance/Debouncer.d.ts.map +1 -0
- package/dist/performance/Debouncer.js +198 -0
- package/dist/performance/Debouncer.js.map +1 -0
- package/dist/performance/MemoryDecay.d.ts +82 -0
- package/dist/performance/MemoryDecay.d.ts.map +1 -0
- package/dist/performance/MemoryDecay.js +153 -0
- package/dist/performance/MemoryDecay.js.map +1 -0
- package/dist/performance/index.d.ts +7 -0
- package/dist/performance/index.d.ts.map +1 -0
- package/dist/performance/index.js +9 -0
- package/dist/performance/index.js.map +1 -0
- package/dist/schema/expert-types.d.ts +395 -0
- package/dist/schema/expert-types.d.ts.map +1 -0
- package/dist/schema/expert-types.js +250 -0
- package/dist/schema/expert-types.js.map +1 -0
- package/dist/services/ContextGenerator.js +7 -7
- package/dist/services/PlanManager.d.ts +1 -1
- package/dist/services/PlanManager.d.ts.map +1 -1
- package/dist/services/PlanManager.js +26 -6
- package/dist/services/PlanManager.js.map +1 -1
- package/dist/services/ProjectScaffold.js +76 -76
- package/dist/services/memory-router.js +35 -35
- package/dist/services/pattern-tracker.js +90 -90
- package/dist/services/semantic-search.js +2 -2
- package/package.json +105 -104
- package/standards/README.md +50 -50
- package/standards/experts/expert-routing.md +215 -215
- package/standards/general/code-quality.md +86 -86
- package/standards/general/memory-usage.md +205 -205
- package/standards/general/sync-workflow.md +235 -235
- package/standards/general/workflow.md +82 -82
- package/standards/hooks/mandatory-tracking.md +446 -446
- package/standards/infrastructure/cloud-database.md +287 -287
- package/standards/mcp/server-design.md +243 -243
- package/standards/mcp/tool-patterns.md +354 -354
- package/standards/skills/skill-structure.md +286 -286
- package/standards/skills/workflow-design.md +323 -323
- package/standards/tools/tool-design.md +297 -297
- package/templates/agents/architecture-expert.md +61 -61
- package/templates/agents/database-expert.md +62 -62
- package/templates/agents/documentation-expert.md +57 -57
- package/templates/agents/memory-expert.md +88 -88
- package/templates/agents/performance-expert.md +61 -61
- package/templates/agents/security-expert.md +59 -59
- package/templates/agents/ux-expert.md +63 -63
- package/templates/agents/worker.md +75 -75
- package/templates/ai-skills/SKILL_TEMPLATE.md +55 -55
- package/templates/claude-settings.json +72 -72
- package/templates/commands/experts.md +138 -138
- package/templates/hooks/README.md +158 -158
- package/templates/hooks/project.config.json.template +77 -77
- package/templates/hooks/settings.local.json.template +57 -57
- package/templates/memory-config.json +56 -56
- package/templates/memory-config.schema.json +212 -212
- package/templates/settings.json +58 -58
- package/templates/skills/continue.md +205 -205
- package/templates/workflows/business-improvement.md +264 -264
- package/templates/workflows/expert-review.md +153 -153
- package/templates/workflows/internal-app.md +245 -245
- package/templates/workflows/sync-docs.md +187 -187
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Debouncer - Hook debouncing for performance optimization
|
|
3
|
+
* @description Prevents redundant operations by tracking recent calls
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - Time-based debouncing (skip if same operation within window)
|
|
7
|
+
* - Hash-based key generation
|
|
8
|
+
* - Auto-cleanup of expired entries
|
|
9
|
+
* - Statistics tracking
|
|
10
|
+
*/
|
|
11
|
+
import { createHash } from 'crypto';
|
|
12
|
+
const DEFAULT_CONFIG = {
|
|
13
|
+
windowMs: 5000, // 5 seconds
|
|
14
|
+
maxEntries: 500,
|
|
15
|
+
debug: false,
|
|
16
|
+
};
|
|
17
|
+
// =============================================================================
|
|
18
|
+
// Debouncer Implementation
|
|
19
|
+
// =============================================================================
|
|
20
|
+
export class Debouncer {
|
|
21
|
+
config;
|
|
22
|
+
entries = new Map();
|
|
23
|
+
stats = {
|
|
24
|
+
totalCalls: 0,
|
|
25
|
+
skipped: 0,
|
|
26
|
+
};
|
|
27
|
+
constructor(config = {}) {
|
|
28
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Check if operation should be skipped
|
|
32
|
+
* Returns true if same operation was called within debounce window
|
|
33
|
+
*/
|
|
34
|
+
shouldSkip(key) {
|
|
35
|
+
this.stats.totalCalls++;
|
|
36
|
+
const now = Date.now();
|
|
37
|
+
const entry = this.entries.get(key);
|
|
38
|
+
if (entry && now - entry.lastCall < this.config.windowMs) {
|
|
39
|
+
this.stats.skipped++;
|
|
40
|
+
entry.callCount++;
|
|
41
|
+
if (this.config.debug) {
|
|
42
|
+
console.log(`[Debouncer] Skipping (called ${entry.callCount}x in window)`);
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
// Update or create entry
|
|
47
|
+
this.entries.set(key, { lastCall: now, callCount: 1 });
|
|
48
|
+
// Cleanup if needed
|
|
49
|
+
if (this.entries.size > this.config.maxEntries) {
|
|
50
|
+
this.cleanup();
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Generate hash key from tool name and params
|
|
56
|
+
*/
|
|
57
|
+
createKey(toolName, params) {
|
|
58
|
+
const paramsStr = JSON.stringify(params, Object.keys(params).sort());
|
|
59
|
+
const content = `${toolName}:${paramsStr}`;
|
|
60
|
+
return createHash('md5').update(content).digest('hex');
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Check if tool call should skip embedding lookup
|
|
64
|
+
*/
|
|
65
|
+
shouldSkipEmbedding(toolName, params) {
|
|
66
|
+
const key = this.createKey(toolName, params);
|
|
67
|
+
return this.shouldSkip(`embed:${key}`);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Check if expert review should be skipped
|
|
71
|
+
*/
|
|
72
|
+
shouldSkipReview(files) {
|
|
73
|
+
const filesKey = files.sort().join('|');
|
|
74
|
+
const key = createHash('md5').update(filesKey).digest('hex');
|
|
75
|
+
return this.shouldSkip(`review:${key}`);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Mark operation as complete (update timestamp)
|
|
79
|
+
*/
|
|
80
|
+
markComplete(key) {
|
|
81
|
+
this.entries.set(key, { lastCall: Date.now(), callCount: 1 });
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Remove expired entries
|
|
85
|
+
*/
|
|
86
|
+
cleanup() {
|
|
87
|
+
const now = Date.now();
|
|
88
|
+
let removed = 0;
|
|
89
|
+
for (const [key, entry] of this.entries) {
|
|
90
|
+
if (now - entry.lastCall > this.config.windowMs) {
|
|
91
|
+
this.entries.delete(key);
|
|
92
|
+
removed++;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (this.config.debug && removed > 0) {
|
|
96
|
+
console.log(`[Debouncer] Cleaned up ${removed} expired entries`);
|
|
97
|
+
}
|
|
98
|
+
return removed;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Get statistics
|
|
102
|
+
*/
|
|
103
|
+
getStats() {
|
|
104
|
+
return {
|
|
105
|
+
totalCalls: this.stats.totalCalls,
|
|
106
|
+
skipped: this.stats.skipped,
|
|
107
|
+
executed: this.stats.totalCalls - this.stats.skipped,
|
|
108
|
+
skipRate: this.stats.totalCalls > 0
|
|
109
|
+
? this.stats.skipped / this.stats.totalCalls
|
|
110
|
+
: 0,
|
|
111
|
+
activeEntries: this.entries.size,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Reset all state
|
|
116
|
+
*/
|
|
117
|
+
reset() {
|
|
118
|
+
this.entries.clear();
|
|
119
|
+
this.stats = { totalCalls: 0, skipped: 0 };
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Get config
|
|
123
|
+
*/
|
|
124
|
+
getConfig() {
|
|
125
|
+
return { ...this.config };
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Update config
|
|
129
|
+
*/
|
|
130
|
+
setConfig(config) {
|
|
131
|
+
this.config = { ...this.config, ...config };
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// =============================================================================
|
|
135
|
+
// Specialized Debouncers
|
|
136
|
+
// =============================================================================
|
|
137
|
+
/**
|
|
138
|
+
* Debouncer for embedding lookups
|
|
139
|
+
*/
|
|
140
|
+
export class EmbeddingDebouncer extends Debouncer {
|
|
141
|
+
constructor(config = {}) {
|
|
142
|
+
super({
|
|
143
|
+
windowMs: 5000,
|
|
144
|
+
maxEntries: 200,
|
|
145
|
+
...config,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
shouldSkipLookup(text) {
|
|
149
|
+
const key = createHash('md5').update(text.toLowerCase().trim()).digest('hex');
|
|
150
|
+
return this.shouldSkip(`embed:${key}`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Debouncer for hook operations
|
|
155
|
+
*/
|
|
156
|
+
export class HookDebouncer extends Debouncer {
|
|
157
|
+
constructor(config = {}) {
|
|
158
|
+
super({
|
|
159
|
+
windowMs: 2000,
|
|
160
|
+
maxEntries: 100,
|
|
161
|
+
...config,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
shouldSkipHook(hookName, context) {
|
|
165
|
+
const key = this.createKey(hookName, context);
|
|
166
|
+
return this.shouldSkip(`hook:${key}`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// =============================================================================
|
|
170
|
+
// Singleton Instances
|
|
171
|
+
// =============================================================================
|
|
172
|
+
let globalDebouncer = null;
|
|
173
|
+
let globalEmbeddingDebouncer = null;
|
|
174
|
+
let globalHookDebouncer = null;
|
|
175
|
+
export function getDebouncer(config) {
|
|
176
|
+
if (!globalDebouncer) {
|
|
177
|
+
globalDebouncer = new Debouncer(config);
|
|
178
|
+
}
|
|
179
|
+
return globalDebouncer;
|
|
180
|
+
}
|
|
181
|
+
export function getEmbeddingDebouncer(config) {
|
|
182
|
+
if (!globalEmbeddingDebouncer) {
|
|
183
|
+
globalEmbeddingDebouncer = new EmbeddingDebouncer(config);
|
|
184
|
+
}
|
|
185
|
+
return globalEmbeddingDebouncer;
|
|
186
|
+
}
|
|
187
|
+
export function getHookDebouncer(config) {
|
|
188
|
+
if (!globalHookDebouncer) {
|
|
189
|
+
globalHookDebouncer = new HookDebouncer(config);
|
|
190
|
+
}
|
|
191
|
+
return globalHookDebouncer;
|
|
192
|
+
}
|
|
193
|
+
export function resetDebouncers() {
|
|
194
|
+
globalDebouncer = null;
|
|
195
|
+
globalEmbeddingDebouncer = null;
|
|
196
|
+
globalHookDebouncer = null;
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=Debouncer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Debouncer.js","sourceRoot":"","sources":["../../src/performance/Debouncer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AA4BnC,MAAM,cAAc,GAAoB;IACtC,QAAQ,EAAE,IAAI,EAAE,YAAY;IAC5B,UAAU,EAAE,GAAG;IACf,KAAK,EAAE,KAAK;CACb,CAAA;AAED,gFAAgF;AAChF,2BAA2B;AAC3B,gFAAgF;AAEhF,MAAM,OAAO,SAAS;IACZ,MAAM,CAAiB;IACvB,OAAO,GAAgC,IAAI,GAAG,EAAE,CAAA;IAChD,KAAK,GAAG;QACd,UAAU,EAAE,CAAC;QACb,OAAO,EAAE,CAAC;KACX,CAAA;IAED,YAAY,SAAmC,EAAE;QA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CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAAiC;IAChE,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,mBAAmB,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAA;IACjD,CAAC;IACD,OAAO,mBAAmB,CAAA;AAC5B,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,eAAe,GAAG,IAAI,CAAA;IACtB,wBAAwB,GAAG,IAAI,CAAA;IAC/B,mBAAmB,GAAG,IAAI,CAAA;AAC5B,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file MemoryDecay - Memory scoring with exponential decay
|
|
3
|
+
* @description Calculates relevance scores for memories based on age, usage, and feedback
|
|
4
|
+
*
|
|
5
|
+
* Formula:
|
|
6
|
+
* score = (feedbackScore * decayFactor) + usageBoost + pinBonus
|
|
7
|
+
*
|
|
8
|
+
* Where:
|
|
9
|
+
* - decayFactor = exp(-age / halfLife)
|
|
10
|
+
* - usageBoost = min(accessCount * 0.05, 0.3)
|
|
11
|
+
* - pinBonus = 0.5 if pinned
|
|
12
|
+
*/
|
|
13
|
+
export interface MemoryForScoring {
|
|
14
|
+
id: string;
|
|
15
|
+
createdAt: string | Date;
|
|
16
|
+
/** Base relevance score (0-1) */
|
|
17
|
+
feedbackScore?: number;
|
|
18
|
+
/** Number of times accessed */
|
|
19
|
+
accessCount?: number;
|
|
20
|
+
/** Is memory pinned (never decays) */
|
|
21
|
+
pinned?: boolean;
|
|
22
|
+
/** Last accessed timestamp */
|
|
23
|
+
lastAccessedAt?: string | Date;
|
|
24
|
+
}
|
|
25
|
+
export interface ScoredMemory extends MemoryForScoring {
|
|
26
|
+
calculatedScore: number;
|
|
27
|
+
ageInDays: number;
|
|
28
|
+
decayFactor: number;
|
|
29
|
+
}
|
|
30
|
+
export interface DecayConfig {
|
|
31
|
+
/** Half-life in days (default 90) */
|
|
32
|
+
halfLifeDays: number;
|
|
33
|
+
/** Maximum usage boost (default 0.3) */
|
|
34
|
+
maxUsageBoost: number;
|
|
35
|
+
/** Boost per access (default 0.05) */
|
|
36
|
+
perAccessBoost: number;
|
|
37
|
+
/** Bonus for pinned memories (default 0.5) */
|
|
38
|
+
pinBonus: number;
|
|
39
|
+
/** Recent access bonus (accessed in last 7 days) */
|
|
40
|
+
recentAccessBonus: number;
|
|
41
|
+
/** Days considered "recent" */
|
|
42
|
+
recentDays: number;
|
|
43
|
+
}
|
|
44
|
+
export declare class MemoryDecay {
|
|
45
|
+
private config;
|
|
46
|
+
constructor(config?: Partial<DecayConfig>);
|
|
47
|
+
/**
|
|
48
|
+
* Calculate score for a single memory
|
|
49
|
+
*/
|
|
50
|
+
calculateScore(memory: MemoryForScoring): ScoredMemory;
|
|
51
|
+
/**
|
|
52
|
+
* Score and sort memories by relevance
|
|
53
|
+
*/
|
|
54
|
+
rankMemories(memories: MemoryForScoring[]): ScoredMemory[];
|
|
55
|
+
/**
|
|
56
|
+
* Filter memories by minimum score
|
|
57
|
+
*/
|
|
58
|
+
filterByScore(memories: MemoryForScoring[], minScore?: number): ScoredMemory[];
|
|
59
|
+
/**
|
|
60
|
+
* Get stale memories (low scores)
|
|
61
|
+
*/
|
|
62
|
+
getStaleMemories(memories: MemoryForScoring[], threshold?: number): ScoredMemory[];
|
|
63
|
+
/**
|
|
64
|
+
* Calculate what score a memory will have at a future date
|
|
65
|
+
*/
|
|
66
|
+
projectScore(memory: MemoryForScoring, daysInFuture: number): number;
|
|
67
|
+
/**
|
|
68
|
+
* Estimate days until memory falls below threshold
|
|
69
|
+
*/
|
|
70
|
+
estimateDaysUntilStale(memory: MemoryForScoring, threshold?: number): number | null;
|
|
71
|
+
/**
|
|
72
|
+
* Get config
|
|
73
|
+
*/
|
|
74
|
+
getConfig(): DecayConfig;
|
|
75
|
+
/**
|
|
76
|
+
* Update config
|
|
77
|
+
*/
|
|
78
|
+
setConfig(config: Partial<DecayConfig>): void;
|
|
79
|
+
}
|
|
80
|
+
export declare function getMemoryDecay(config?: Partial<DecayConfig>): MemoryDecay;
|
|
81
|
+
export declare function resetMemoryDecay(): void;
|
|
82
|
+
//# sourceMappingURL=MemoryDecay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemoryDecay.d.ts","sourceRoot":"","sources":["../../src/performance/MemoryDecay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,iCAAiC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,sCAAsC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,8BAA8B;IAC9B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B;AAED,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD,eAAe,EAAE,MAAM,CAAA;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAA;IACpB,wCAAwC;IACxC,aAAa,EAAE,MAAM,CAAA;IACrB,sCAAsC;IACtC,cAAc,EAAE,MAAM,CAAA;IACtB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAA;IAChB,oDAAoD;IACpD,iBAAiB,EAAE,MAAM,CAAA;IACzB,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAA;CACnB;AAeD,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAa;gBAEf,MAAM,GAAE,OAAO,CAAC,WAAW,CAAM;IAI7C;;OAEG;IACH,cAAc,CAAC,MAAM,EAAE,gBAAgB,GAAG,YAAY;IA6CtD;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,YAAY,EAAE;IAM1D;;OAEG;IACH,aAAa,CACX,QAAQ,EAAE,gBAAgB,EAAE,EAC5B,QAAQ,GAAE,MAAY,GACrB,YAAY,EAAE;IAIjB;;OAEG;IACH,gBAAgB,CACd,QAAQ,EAAE,gBAAgB,EAAE,EAC5B,SAAS,GAAE,MAAY,GACtB,YAAY,EAAE;IAMjB;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM;IAmBpE;;OAEG;IACH,sBAAsB,CACpB,MAAM,EAAE,gBAAgB,EACxB,SAAS,GAAE,MAAY,GACtB,MAAM,GAAG,IAAI;IAwBhB;;OAEG;IACH,SAAS,IAAI,WAAW;IAIxB;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI;CAG9C;AAQD,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,CAKzE;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file MemoryDecay - Memory scoring with exponential decay
|
|
3
|
+
* @description Calculates relevance scores for memories based on age, usage, and feedback
|
|
4
|
+
*
|
|
5
|
+
* Formula:
|
|
6
|
+
* score = (feedbackScore * decayFactor) + usageBoost + pinBonus
|
|
7
|
+
*
|
|
8
|
+
* Where:
|
|
9
|
+
* - decayFactor = exp(-age / halfLife)
|
|
10
|
+
* - usageBoost = min(accessCount * 0.05, 0.3)
|
|
11
|
+
* - pinBonus = 0.5 if pinned
|
|
12
|
+
*/
|
|
13
|
+
const DEFAULT_CONFIG = {
|
|
14
|
+
halfLifeDays: 90,
|
|
15
|
+
maxUsageBoost: 0.3,
|
|
16
|
+
perAccessBoost: 0.05,
|
|
17
|
+
pinBonus: 0.5,
|
|
18
|
+
recentAccessBonus: 0.1,
|
|
19
|
+
recentDays: 7,
|
|
20
|
+
};
|
|
21
|
+
// =============================================================================
|
|
22
|
+
// MemoryDecay Implementation
|
|
23
|
+
// =============================================================================
|
|
24
|
+
export class MemoryDecay {
|
|
25
|
+
config;
|
|
26
|
+
constructor(config = {}) {
|
|
27
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Calculate score for a single memory
|
|
31
|
+
*/
|
|
32
|
+
calculateScore(memory) {
|
|
33
|
+
const now = Date.now();
|
|
34
|
+
const createdAt = new Date(memory.createdAt).getTime();
|
|
35
|
+
const ageInDays = (now - createdAt) / (1000 * 60 * 60 * 24);
|
|
36
|
+
// Base score from feedback (default 0.5)
|
|
37
|
+
const feedbackScore = memory.feedbackScore ?? 0.5;
|
|
38
|
+
// Decay factor (pinned = no decay)
|
|
39
|
+
const decayFactor = memory.pinned
|
|
40
|
+
? 1.0
|
|
41
|
+
: Math.exp(-ageInDays / this.config.halfLifeDays);
|
|
42
|
+
// Usage boost
|
|
43
|
+
const usageBoost = memory.accessCount
|
|
44
|
+
? Math.min(memory.accessCount * this.config.perAccessBoost, this.config.maxUsageBoost)
|
|
45
|
+
: 0;
|
|
46
|
+
// Recent access bonus
|
|
47
|
+
let recentBonus = 0;
|
|
48
|
+
if (memory.lastAccessedAt) {
|
|
49
|
+
const lastAccess = new Date(memory.lastAccessedAt).getTime();
|
|
50
|
+
const daysSinceAccess = (now - lastAccess) / (1000 * 60 * 60 * 24);
|
|
51
|
+
if (daysSinceAccess < this.config.recentDays) {
|
|
52
|
+
recentBonus = this.config.recentAccessBonus;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Pin bonus
|
|
56
|
+
const pinBonus = memory.pinned ? this.config.pinBonus : 0;
|
|
57
|
+
// Final score
|
|
58
|
+
const calculatedScore = Math.min((feedbackScore * decayFactor) + usageBoost + recentBonus + pinBonus, 1.0);
|
|
59
|
+
return {
|
|
60
|
+
...memory,
|
|
61
|
+
calculatedScore,
|
|
62
|
+
ageInDays,
|
|
63
|
+
decayFactor,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Score and sort memories by relevance
|
|
68
|
+
*/
|
|
69
|
+
rankMemories(memories) {
|
|
70
|
+
return memories
|
|
71
|
+
.map(m => this.calculateScore(m))
|
|
72
|
+
.sort((a, b) => b.calculatedScore - a.calculatedScore);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Filter memories by minimum score
|
|
76
|
+
*/
|
|
77
|
+
filterByScore(memories, minScore = 0.1) {
|
|
78
|
+
return this.rankMemories(memories).filter(m => m.calculatedScore >= minScore);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get stale memories (low scores)
|
|
82
|
+
*/
|
|
83
|
+
getStaleMemories(memories, threshold = 0.2) {
|
|
84
|
+
return this.rankMemories(memories).filter(m => m.calculatedScore < threshold && !m.pinned);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Calculate what score a memory will have at a future date
|
|
88
|
+
*/
|
|
89
|
+
projectScore(memory, daysInFuture) {
|
|
90
|
+
const scored = this.calculateScore(memory);
|
|
91
|
+
if (memory.pinned) {
|
|
92
|
+
return scored.calculatedScore;
|
|
93
|
+
}
|
|
94
|
+
// Project decay
|
|
95
|
+
const futureAge = scored.ageInDays + daysInFuture;
|
|
96
|
+
const futureDecay = Math.exp(-futureAge / this.config.halfLifeDays);
|
|
97
|
+
const feedbackScore = memory.feedbackScore ?? 0.5;
|
|
98
|
+
const usageBoost = memory.accessCount
|
|
99
|
+
? Math.min(memory.accessCount * this.config.perAccessBoost, this.config.maxUsageBoost)
|
|
100
|
+
: 0;
|
|
101
|
+
return Math.min((feedbackScore * futureDecay) + usageBoost, 1.0);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Estimate days until memory falls below threshold
|
|
105
|
+
*/
|
|
106
|
+
estimateDaysUntilStale(memory, threshold = 0.2) {
|
|
107
|
+
if (memory.pinned)
|
|
108
|
+
return null;
|
|
109
|
+
const currentScore = this.calculateScore(memory).calculatedScore;
|
|
110
|
+
if (currentScore < threshold)
|
|
111
|
+
return 0;
|
|
112
|
+
// Binary search for the day when score drops below threshold
|
|
113
|
+
let low = 0;
|
|
114
|
+
let high = 365 * 5; // 5 years max
|
|
115
|
+
while (high - low > 1) {
|
|
116
|
+
const mid = Math.floor((low + high) / 2);
|
|
117
|
+
const projectedScore = this.projectScore(memory, mid);
|
|
118
|
+
if (projectedScore >= threshold) {
|
|
119
|
+
low = mid;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
high = mid;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return high;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Get config
|
|
129
|
+
*/
|
|
130
|
+
getConfig() {
|
|
131
|
+
return { ...this.config };
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Update config
|
|
135
|
+
*/
|
|
136
|
+
setConfig(config) {
|
|
137
|
+
this.config = { ...this.config, ...config };
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// =============================================================================
|
|
141
|
+
// Singleton
|
|
142
|
+
// =============================================================================
|
|
143
|
+
let globalDecay = null;
|
|
144
|
+
export function getMemoryDecay(config) {
|
|
145
|
+
if (!globalDecay) {
|
|
146
|
+
globalDecay = new MemoryDecay(config);
|
|
147
|
+
}
|
|
148
|
+
return globalDecay;
|
|
149
|
+
}
|
|
150
|
+
export function resetMemoryDecay() {
|
|
151
|
+
globalDecay = null;
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=MemoryDecay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemoryDecay.js","sourceRoot":"","sources":["../../src/performance/MemoryDecay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAwCH,MAAM,cAAc,GAAgB;IAClC,YAAY,EAAE,EAAE;IAChB,aAAa,EAAE,GAA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,CAAA;QACX,IAAI,IAAI,GAAG,GAAG,GAAG,CAAC,CAAA,CAAC,cAAc;QAEjC,OAAO,IAAI,GAAG,GAAG,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACxC,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;YAErD,IAAI,cAAc,IAAI,SAAS,EAAE,CAAC;gBAChC,GAAG,GAAG,GAAG,CAAA;YACX,CAAC;iBAAM,CAAC;gBACN,IAAI,GAAG,GAAG,CAAA;YACZ,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA;IAC3B,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,MAA4B;QACpC,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAA;IAC7C,CAAC;CACF;AAED,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,IAAI,WAAW,GAAuB,IAAI,CAAA;AAE1C,MAAM,UAAU,cAAc,CAAC,MAA6B;IAC1D,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,WAAW,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAA;IACvC,CAAC;IACD,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,WAAW,GAAG,IAAI,CAAA;AACpB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Performance Module - cmp-standards v2.8
|
|
3
|
+
* @description Performance optimization utilities
|
|
4
|
+
*/
|
|
5
|
+
export { Debouncer, DebouncerConfig, DebouncerStats, EmbeddingDebouncer, HookDebouncer, getDebouncer, getEmbeddingDebouncer, getHookDebouncer, resetDebouncers, } from './Debouncer.js';
|
|
6
|
+
export { MemoryDecay, MemoryForScoring, ScoredMemory, DecayConfig, getMemoryDecay, resetMemoryDecay, } from './MemoryDecay.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/performance/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,SAAS,EACT,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,GAChB,MAAM,gBAAgB,CAAA;AAGvB,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,cAAc,EACd,gBAAgB,GACjB,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Performance Module - cmp-standards v2.8
|
|
3
|
+
* @description Performance optimization utilities
|
|
4
|
+
*/
|
|
5
|
+
// Debouncing
|
|
6
|
+
export { Debouncer, EmbeddingDebouncer, HookDebouncer, getDebouncer, getEmbeddingDebouncer, getHookDebouncer, resetDebouncers, } from './Debouncer.js';
|
|
7
|
+
// Memory Decay
|
|
8
|
+
export { MemoryDecay, getMemoryDecay, resetMemoryDecay, } from './MemoryDecay.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/performance/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,aAAa;AACb,OAAO,EACL,SAAS,EAGT,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,GAChB,MAAM,gBAAgB,CAAA;AAEvB,eAAe;AACf,OAAO,EACL,WAAW,EAIX,cAAc,EACd,gBAAgB,GACjB,MAAM,kBAAkB,CAAA"}
|