Files
TORCH/perf/benchmark-pruner.mjs
T
Claude 639ad6877d chore: code quality, CI/CD, and DX improvements
Phase 3 — Code Quality:
- Deduplicate nowUnix() in lock-ops.mjs (import from utils.mjs)
- Promote ESLint no-unused-vars to error, fix all 46 violations
- Remove dead code: unused imports, variables, and catch bindings
- Add /* global marked */ for CDN-loaded library in dashboard

Phase 4 — CI/CD:
- Add Node.js version matrix (22, 23) to CI workflow
- Add npm audit security scan step to CI
- Add innerHTML usage check to CI pipeline
- Enable Dependabot for npm and GitHub Actions dependencies
- Create PR template

Phase 5 — Developer Experience:
- Create .env.example documenting all environment variables
- Expand CONTRIBUTING.md with commit conventions, agent/prompt
  creation guide, architecture overview, and test integrity
- Add system architecture diagram with Mermaid (docs/architecture/)

https://claude.ai/code/session_01GfwUNbgeMgXreFDbsNQMsS
2026-02-19 21:03:30 +00:00

45 lines
1.3 KiB
JavaScript

import { createLifecyclePlan } from '../src/services/memory/pruner.js';
const COUNT = 30000;
const DUPLICATE_WINDOW_MS = 1000 * 60 * 60; // 1 hour
function createMemory(i) {
return {
id: `mem-${i}`,
agent_id: 'agent-1',
session_id: 's1',
type: 'event',
content: `memory content ${i}`,
summary: `memory summary ${i}`,
tags: ['tag-a', 'tag-b'],
importance: 0.5,
embedding_id: null,
created_at: Date.now() - Math.floor(Math.random() * 10 * 24 * 60 * 60 * 1000), // Random time in last 10 days
last_seen: Date.now(),
source: 'ingest',
ttl_days: null,
merged_into: null,
pinned: false,
};
}
const memories = Array.from({ length: COUNT }, (_, i) => createMemory(i));
// Mock embedding function
const getEmbedding = (memory) => {
// Generate a pseudo-random embedding based on ID to be deterministic but varied
const val = parseInt(memory.id.split('-')[1]) % 100;
return [val, 100 - val];
};
console.time('createLifecyclePlan');
await createLifecyclePlan(memories, {
now: Date.now(),
retentionMs: 30 * 24 * 60 * 60 * 1000,
duplicateWindowMs: DUPLICATE_WINDOW_MS,
getEmbedding,
generateSummary: async () => JSON.stringify({ summary: 'merged', importance: 0.5 }),
});
console.timeEnd('createLifecyclePlan');