Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
TypeScript aiai-agentsai-memoryanthropicartificial-intelligencechromadbclaudeclaude-agent-sdkclaude-agentsclaude-codeclaude-code-pluginclaude-skillsembeddingslong-term-memorymem0memory-engineopenmemoryragsqlitesupermemory
/**
* The one JS definition of the mixed-unit epoch rule, the twin of the SQL `asMs()` fragment
* (services/telemetry/common.ts). It imports nothing, so the worker (root tsconfig) and the viewer (rootDir src/ui)
* both compile it, the way context-preview-note.ts is shared.
*
* The epoch columns on the local database hold mixed units historically: a few hundred legacy rows were written in
* seconds, everything since in milliseconds. A value read straight from such a column is normalized here before it
* reaches `new Date`, an ordering comparison or an aggregate. 10^12 ms ≈ 2001 and 10^12 s ≈ year 33658, so no
* plausible value is ambiguous.
*/
export function epochMs(value: number): number {
return value < 1_000_000_000_000 ? value * 1000 : value;
}