Skip to content

Commit 443b2aa

Browse files
committed
docs(memory): explain Brain factory naming asymmetry
1 parent 4c2ae83 commit 443b2aa

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/memory/retrieval/store/Brain.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,18 @@ export class Brain {
466466

467467
// ---------------------------------------------------------------------------
468468
// Async factories (three named entry points)
469+
//
470+
// Naming convention:
471+
// - openSqlite / openPostgres: factory by-DIALECT. The caller specifies
472+
// "I want a SQLite-backed brain at this file" or "I want a Postgres-
473+
// backed brain at this URL." The adapter is constructed internally.
474+
// - openWithAdapter: factory by-PRE-BUILT-ADAPTER. The caller has already
475+
// built the StorageAdapter (e.g., to share a connection pool with
476+
// another subsystem) and hands it to Brain to consume.
477+
//
478+
// The naming asymmetry is intentional: the first two are dialect-specific
479+
// entry points; the third is the escape hatch for advanced cases where the
480+
// adapter is owned outside the Brain.
469481
// ---------------------------------------------------------------------------
470482

471483
/**

0 commit comments

Comments
 (0)