WOLBΛRG

Quick Start

Construct Wolbarg, remember facts, and recall them with semantic or hybrid search in minutes.

What is it?

A minimal path from zero to working semantic memory: construct, remember, recall, then optionally hybrid search and document ingest.

1. Construct

import {
  Wolbarg,
  sqlite,
  openaiEmbedding,
  openaiLlm,
  bm25,
} from "wolbarg";

const ctx = new Wolbarg({
  organization: "my-org",
  storage: sqlite("./memory.db"),
  embedding: openaiEmbedding({
    apiKey: process.env.OPENAI_API_KEY!,
    model: "text-embedding-3-small",
  }),
  // Optional — enables compress()
  llm: openaiLlm({
    apiKey: process.env.OPENAI_API_KEY!,
    model: "gpt-4.1-mini",
  }),
  // Optional — enables hybrid recall
  keywordSearch: bm25(),
});

2. Remember

await ctx.remember({
  agent: "research",
  content: { text: "Stripe supports recurring invoices." },
  metadata: { topic: "billing", source: "docs" },
});

3. Recall

const results = await ctx.recall({
  query: "How do recurring invoices work?",
  topK: 5,
  threshold: 0.3,
  filter: { agent: "research" },
});

console.log(results[0]?.content.text, results[0]?.similarity);

4. Hybrid + filters (optional)

import { meta } from "wolbarg";

const hits = await ctx.recall({
  query: "recurring invoices",
  topK: 5,
  hybrid: true,
  filter: {
    agent: "research",
    metadata: meta.eq("topic", "billing"),
  },
});

5. Ingest a document (optional)

Markdown / TXT ingest works out of the box. For PDF or DOCX install peers first (pdf-parse@1.1.4, mammoth). See Document Ingestion.

npm install pdf-parse@1.1.4   # required for .pdf ingest
npm install mammoth           # required for .docx ingest
const result = await ctx.ingest({
  agent: "docs",
  source: { path: "./guide.md" },
  chunking: { strategy: "markdown", chunkSize: 800, overlap: 100 },
});
console.log(result.chunkCount);

When should you use this pattern?

Start here for every new project. Add hybrid search, rerankers, and ingest only when you need them.