export interface MemoryPort { store(input: { text: string; scope: string; metadata?: Record }): Promise; recall(input: { query: string; scope: string; limit?: number }): Promise; } export class ScopeMemory { constructor(private readonly memory: MemoryPort) {} async put(scopeId: string, text: string, metadata?: Record): Promise { return this.memory.store({ text, scope: scopeId, metadata }); } async search(scopeId: string, query: string, limit = 5): Promise { return this.memory.recall({ query, scope: scopeId, limit }); } }