PPM

@pixygon/knowledge-server

Storage + extraction + chunking + semantic search engine for any text knowledge. Used by @pixygon/chatbot-server for RAG; can also back a wiki/codex search layer.

Install

# .npmrc
@pixygon:registry=https://ppm.pixygon.io/

npm install @pixygon/knowledge-server@0.1.3

Versions

VersionPublishedIntegrity
0.1.3 latest2026-08-02sha512-Pkfag+5XD6dQCn2…
0.1.2 2026-06-17sha512-or1+yR9wiL3W90f…
0.1.1 2026-06-17sha512-V6DgqOC5Dl5TAFY…
0.1.0 2026-06-17sha512-Vp1tli6WbSuI6ff…

@pixygon/knowledge-server

Storage + extraction + chunking + semantic search for any text knowledge.

+--------------------+      +-------------------------+
|  Host Express app  |----->|     engine.router       |
|  (your auth here)  |      +-------------------------+
+--------------------+               |
                                     v
  KnowledgeDocument · KnowledgeChunk · extractors · embedder · search

Used by:


What it does


Install

npm install @pixygon/knowledge-server

Peer expectations:


Usage

import mongoose from "mongoose";
import { createKnowledge } from "@pixygon/knowledge-server";

// Any object matching { embed(text), chat?({ messages, system }) } works.
// `@pixygon/chatbot-server`'s `createAiClient` returns this shape.
const ai = {
  async embed(text: string) {
    const e = await myEmbeddingClient.embed(text);
    return { embedding: e.vector, tokens: e.tokens };
  },
  async chat({ messages, system }: any) {
    const r = await myChatClient.chat({ messages, system });
    return { content: r.text };
  },
};

const knowledge = createKnowledge({
  mongoose,
  ai,
  tenantField: "tenantId",
  tenantRefName: "Tenant",
  defaultNamespace: "default",
  plugins: [
    (schema, label) => schema.plugin(tenantScopedPlugin, { tenantField: "tenantId", label }),
    (schema, label) => schema.plugin(auditLogPlugin, { entityType: label }),
  ],
});

// Mount the default HTTP router under whatever path the host owns.
app.use("/v1/tenants/:tenantId", verifyToken, tenantAccess, knowledge.router);

// Programmatic search — used by RAG pipelines, codex search, etc.
const hits = await knowledge.search({
  tenantId, query: "fall protection rules", namespace: "chatbot", k: 5,
});

// Codex-style external sync. Idempotent — upsert by (namespace, externalRef).
await knowledge.upsertExternal({
  tenantId,
  namespace: "codex",
  externalModelName: "LoreEntity",
  externalId: loreEntity._id,
  title: loreEntity.name,
  content: loreEntity.description,
  source: `codex/${loreEntity.slug}`,
  tags: loreEntity.tags,
});

HTTP surface

Default router (engine.router):

GET    /knowledge                  ?namespace=&sourceType=
GET    /knowledge/search           ?q=&namespace=&k=
GET    /knowledge/:id
POST   /knowledge                  text       { title, content, source?, namespace?, tags? }
POST   /knowledge/upload           multipart  file, title?, namespace?, tags?
POST   /knowledge/from-url         json       { url, title?, namespace?, extractInstruction?, isLive?, liveDescription?, tags? }
PUT    /knowledge/:id              { title?, content?, source?, tags?, namespace? }
DELETE /knowledge/:id

Companion package

@pixygon/knowledge-react ships the operator UI (list, tabbed upload dialog, RTK Query hooks) — see its README for the React wire-up.

License

MIT.

All packages · packument JSON