@polydeukes/memory
v0.20.1
Published
Polydeukes memory — a derived SQLite index over a project's markdown documents.
Readme
@polydeukes/memory
English · 한국어
This package keeps a SQLite index of a project's markdown documents so their sections can be
searched and shown, and keeps the links between them. Each document becomes one row, and each
H2 section one row keyed <document id>#<anchor>. The documents stay the record: the index can
be deleted and rebuilt from them at any time.
It is an optional companion to polydeukes, whose pdks memory command loads it. Install it
next to the umbrella:
pnpm add -D @polydeukes/memoryIt needs Node.js 24.15 or later, where node:sqlite is stable.
Overview
Public contract symbols include:
openMemoryDb·OpenMemoryDbSpecingestMemory·IngestMemorySpecsearchMemory·SearchMemorySpec·MemorySearchResultshowMemory·ShowMemorySpec·MemoryDocument·MemorySection·MemoryShownSection·MemoryLinklintMemory·LintMemorySpec·MemoryLintResult·MemoryViolationlistObligations·ListObligationsSpec·MemoryObligationlistSupersession·ListSupersessionSpec·MemorySupersessiondescribeMemoryIndex·DescribeMemoryIndexSpec·MemoryIndexStatesummarizeMemoryUsage·SummarizeMemoryUsageSpec·MemoryLogEntry·MemoryUsageMemoryConfig
Examples
import { describeMemoryIndex, ingestMemory, openMemoryDb, searchMemory } from '@polydeukes/memory';
const config = { include: ['docs/**/*.md'] };
const db = openMemoryDb({ path: '.polydeukes/memory.db' });
// One write transaction: adds, replaces, and deletes documents to match the files.
ingestMemory({ db, root: process.cwd(), config });
const { documents, ingestedAt } = describeMemoryIndex({ db });
const results = await searchMemory({ db, query: 'release notes', config });
db.close();The command line form of the same calls is pdks memory ingest, pdks memory search,
pdks memory show, pdks memory lint, pdks memory obligations, pdks memory supersession,
and pdks memory stats.
