Semantic Store

pi-cyberneticsourcetypescript
Path: pi-cybernetic/src/storage/semantic-store.tsRelative: src/storage/semantic-store.tsSubproject: pi-cyberneticCategory: cybernetic-core
Lines: 51Bytes: 1,626Imports: 2Exports: 1

Content Preview

  1. /** Semantic memory — compressed summaries + entity-relation tuples, with promotion. */
  2. import type { CompressedSummary, EntityRelation } from "../types/index.ts";
  3. import { nextId } from "../util.ts";
  4. export class SemanticStore {
  5. private summaries = new Map<string, CompressedSummary>();
  6. private relations: EntityRelation[] = [];
  7. constructor(private readonly promotionCount: number) {}
  8. /**
  9. * Record an observed pattern. Creates the summary on first sight, increments
  10. * occurrences a