npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@q1k-oss/context-engine

v0.2.0

Published

AI-powered knowledge graph engine that extracts and structures domain knowledge from conversations

Readme

@q1k-oss/context-engine

AI-powered knowledge graph engine that extracts and structures domain knowledge from conversations. Uses Claude as the primary reasoning engine and Gemini for file extraction.

Install

npm install @q1k-oss/context-engine

Quick Start

import { initContextEngine, createApp } from '@q1k-oss/context-engine';

// Initialize with your config
initContextEngine({
  databaseUrl: process.env.DATABASE_URL!,
  anthropicApiKey: process.env.ANTHROPIC_API_KEY,
  googleAiApiKey: process.env.GOOGLE_AI_API_KEY,
});

// Create and start the Express server
const app = createApp({ corsOrigin: 'http://localhost:3000' });
app.listen(3001, () => console.log('Context Engine running on :3001'));

Configuration

| Option | Required | Description | |--------|----------|-------------| | databaseUrl | Yes | PostgreSQL connection string | | anthropicApiKey | No | Anthropic API key for Claude | | googleAiApiKey | No | Google AI API key for Gemini (file extraction) | | ageEnabled | No | Enable Apache AGE graph extensions (default: true) | | uploadDir | No | Directory for file uploads (default: ./uploads) |

Using Individual Services

You can use services directly without spinning up the full Express server:

import {
  initContextEngine,
  chatOrchestratorService,
  graphBuilderService,
  entityExtractorService,
} from '@q1k-oss/context-engine';

initContextEngine({ databaseUrl: '...' });

// Create a chat session
const session = await chatOrchestratorService.createSession('My Agent');

// Stream a message
for await (const event of chatOrchestratorService.processMessage(session.id, 'Build me a support agent')) {
  if (event.type === 'text_delta') process.stdout.write(event.data.delta);
}

// Get the knowledge graph
const graph = await graphBuilderService.getGraph(session.id);

Subpath Imports

Import only what you need:

import { createApp } from '@q1k-oss/context-engine/app';
import { getDb } from '@q1k-oss/context-engine/db';
import { sessions, knowledgeNodes } from '@q1k-oss/context-engine/db/schema';
import type { Session, KnowledgeNode } from '@q1k-oss/context-engine/types';

API Endpoints

When using createApp(), these routes are available:

Chat

  • POST /api/chat/sessions — Create a session
  • GET /api/chat/sessions — List sessions
  • GET /api/chat/sessions/:id — Get session with messages
  • DELETE /api/chat/sessions/:id — Delete session
  • POST /api/chat/sessions/:id/messages — Send message (SSE stream)

Files

  • POST /api/files/upload — Upload a file for processing
  • GET /api/files/:id — Get file metadata
  • GET /api/files/:id/content — Get extracted content
  • DELETE /api/files/:id — Delete file

Knowledge Graph

  • GET /api/graph/:sessionId — Get knowledge graph
  • GET /api/graph/:sessionId/versions — List graph versions
  • GET /api/graph/:sessionId/deltas — Get context evolution timeline
  • GET /api/graph/:sessionId/context — Get prioritized context
  • POST /api/graph/:sessionId/repair-orphans — Repair orphan nodes
  • POST /api/graph/domain/extract — Extract domain graph from documentation
  • POST /api/graph/domain/entities — Extract entities
  • POST /api/graph/domain/processes — Extract processes
  • POST /api/graph/domain/rules — Extract business rules

Database Setup

Requires PostgreSQL. Push the schema:

# Set DATABASE_URL in .env
npx drizzle-kit push

Architecture

  • Claude — Primary reasoning engine, receives full conversation history
  • Gemini — File extraction only (PDFs, images, documents)
  • Drizzle ORM — PostgreSQL schema and queries
  • Apache AGE — Optional Cypher graph queries
  • Express — HTTP API with SSE streaming

License

MIT