Files
waggle-os/packages/agent/src/recall-frame.ts
shumeiko.it 784ca770b1 refactor(memory): run agent recall, memory tools and the server on the memory contract (P1.5)
- Orchestrator, memory tools, context loader and pattern write-back use a
  MemoryStore and a workspace scope instead of MindDB layers; the knowledge
  graph tools, cognify, memory linker and feedback handler are gone (graph
  hidden in v1, ADR-0002).
- The server opens one mem0 store in <dataDir>/memory/, embedded by the
  in-process model on first use, and extracts facts about the user in the
  background with the model the user chose (memoryExtraction setting).
- Legacy .mind memories are copied into the store once, in the background;
  the legacy files are only read.
- Weaver consolidation, harvest, wiki, memory import, memory lanes, vector
  backfill and index reconciliation are removed; agent runs, loops, sub-agent
  results, connector fetch and the failed-turn capture write through the
  contract. Workspace sessions no longer hold a mind handle.
- FileIndexer and the install audit move to waggle.db; recall date helpers and
  the reranker are copied into core.
- The CLI REPL opens the same memory store.
2026-10-24 11:56:26 +02:00

33 lines
971 B
TypeScript

/**
* The shape recalled memory takes on its way into a prompt.
*
* Field names follow the old frame rows (`content`, `created_at`) because the
* prompt assembler and its tests render them that way; values come from a
* contract `MemoryRecord`.
*/
import type { MemoryImportance, MemoryKind, MemoryRecord, MemorySource } from '@waggle/memory-contract';
export interface RecallFrame {
readonly id: string;
readonly content: string;
readonly kind: MemoryKind;
readonly importance: MemoryImportance;
readonly source: MemorySource;
/** ISO 8601. */
readonly created_at: string;
/** Relevance within one result list; 1 for memories picked by a lane. */
readonly score: number;
}
export function toRecallFrame(record: MemoryRecord, score = 1): RecallFrame {
return {
id: record.id,
content: record.text,
kind: record.kind,
importance: record.importance,
source: record.source,
created_at: record.createdAt,
score,
};
}