(
projectCwd: string,
opts: { content: string; tags: string[]; scope: 'always' | 'contextual'; source: 'user' | 'agent' }
)
| 38 | } |
| 39 | |
| 40 | export function addMemory( |
| 41 | projectCwd: string, |
| 42 | opts: { content: string; tags: string[]; scope: 'always' | 'contextual'; source: 'user' | 'agent' } |
| 43 | ): MemoryEntry { |
| 44 | const entries = readMemories(projectCwd); |
| 45 | const now = new Date().toISOString(); |
| 46 | const entry: MemoryEntry = { |
| 47 | id: randomUUID(), |
| 48 | content: opts.content, |
| 49 | tags: opts.tags, |
| 50 | scope: opts.scope, |
| 51 | source: opts.source, |
| 52 | createdAt: now, |
| 53 | usageCount: 0, |
| 54 | lastUsedAt: now, |
| 55 | }; |
| 56 | entries.push(entry); |
| 57 | writeMemories(projectCwd, entries); |
| 58 | return entry; |
| 59 | } |
| 60 | |
| 61 | export function deleteMemory(projectCwd: string, id: string): boolean { |
| 62 | const entries = readMemories(projectCwd); |
no test coverage detected