Document Ingestion
Parse PDF, DOCX, Markdown, and other documents into chunked semantic memories with ingest().
What is it?
ingest() parses a document, chunks it, embeds each chunk, and stores memories in batch.
Why does it exist?
Agents need grounded knowledge from handbooks, tickets, and product docs — not only free-form remember() calls.
How does it work?
Pipeline: parse → OCR/vision (if configured) → chunk → embed (batch) → store (batch transaction).
Sources
source: { path: "./file.pdf" }
source: { buffer: buf, filename: "file.docx" }
source: { text: "# Markdown…" }Formats
| Family | Extensions | Peer required |
|---|---|---|
| Text | .txt .md .csv .json | None |
.pdf | pdf-parse@1.1.4 | |
| DOCX | .docx | mammoth |
| Images | .png .jpg .jpeg .webp | OCR and/or vision |
npm install pdf-parse@1.1.4 # required for .pdf
npm install mammoth # required for .docxPeers are not bundled with Wolbarg. Missing peers throw when that format is used.
Example
const result = await ctx.ingest({
agent: "docs",
source: { path: "./handbook.pdf" },
chunking: { strategy: "paragraph", chunkSize: 1000, overlap: 120 },
metadata: { collection: "handbook" },
});
console.log(result.chunkCount);When should it be used?
Knowledge bases, onboarding PDFs, and any offline corpus that should become recallable memory.