MCPcopy Create free account
hub / github.com/cortexkit/magic-context / seedMemory

Function seedMemory

packages/e2e-tests/tests/long-running-session.test.ts:209–221  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

207}
208
209function seedMemory(content: string): void {
210 const projectIdentity = resolveProjectIdentity(realpathSync(pathResolve(h.opencode.env.workdir)));
211 writeDb((db) => {
212 const now = Date.now();
213 db.prepare(
214 `INSERT INTO memories (
215 project_path, category, content, normalized_hash,
216 source_session_id, source_type, seen_count, retrieval_count,
217 first_seen_at, created_at, updated_at, last_seen_at, status
218 ) VALUES (?, 'WORKFLOW_RULES', ?, ?, NULL, 'historian', 5, 0, ?, ?, ?, ?, 'active')`,
219 ).run(projectIdentity, content, computeNormalizedHash(content), now, now, now, now);
220 });
221}
222
223function normalizedTodos(todos: typeof ACTIVE_TODOS): string {
224 return JSON.stringify(todos.map(({ content, status, priority }) => ({ content, status, priority })));

Callers 1

Calls 5

resolveProjectIdentityFunction · 0.90
computeNormalizedHashFunction · 0.90
writeDbFunction · 0.70
runMethod · 0.65
prepareMethod · 0.45

Tested by

no test coverage detected