Skip to content
Pilotoo
v0.1

@pilotoo/memory-server

@pilotoo/memory-server is the server side of Brain. It implements the ports of @pilotoo/memory-core on PostgreSQL and pgvector, serves the REST routes and a stateless MCP endpoint, and adapts embedding and language models. Use it to embed Brain in a NestJS host of your own, or to give kit agents a memory through BrainKnowledgeSource.

@pilotoo/memory-server is at version 0.1.0, is marked private and is not published to a registry. It is also not part of the tarballs that pnpm release:check packs, so today it is used from the kit workspace:

Terminal window
pnpm install
pnpm --filter @pilotoo/memory-server build

Inside the workspace, depend on it with "@pilotoo/memory-server": "workspace:^". Its build first builds the kit packages it depends on.

src/app.module.ts
import { brainControllers, brainProviders } from '@pilotoo/memory-server';
@Module({
controllers: brainControllers,
providers: brainProviders({ pool, schema: 'pilotoo_brain', embeddingDimensions: 1024, ports: { directory } }),
})
export class AppModule {}

Run ensureBrainSchema once at boot to create the tables and the vector extension. Embed it in a host walks through the schema, identity and the adapters.

Import Provides
@pilotoo/memory-server The only entry point.
Role Names
Module brainProviders, brainControllers, brainHttpProviders, BRAIN, BrainExceptionFilter.
Stores The PostgreSQL and pgvector stores and ensureBrainSchema.
Models createOpenAiEmbedder, createBedrockTitanEmbedder, createTextExtractor, createAnswerer, createPageCompiler, createFactReconciler, createLabelSuggester.
Agents BrainKnowledgeSource, authenticateAgent, AgentRoute.
Connectors ConnectorsService, ConnectorScheduler, CONNECT_LINKS.
Compile queue CompileWorkerLoop.

brainProviders starts the connector scheduler and the compile worker unless you pass scheduler: false.

@nestjs/common, @nestjs/core and @nestjs/platform-express (^11.2.3), reflect-metadata (^0.2.2) and rxjs (^7.8.2).

@pilotoo/memory-core, @pilotoo/memory-protocol, @pilotoo/workflow, @pilotoo/connections-core, @pilotoo/agent-runtime, @pilotoo/chat-protocol, @modelcontextprotocol/sdk, @langchain/core, @langchain/langgraph, @langchain/openai, pdfjs-dist, pg and zod.