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

@kortexio/contextmemory

v0.0.1-beta.2

Published

Thin headers helper for the ContextMemory OpenAI-compatible gateway

Readme

@kortexio/contextmemory

What is ContextMemory?

ContextMemory is an agentic memory gateway. Your coding agent or chat app talks to a normal OpenAI-compatible URL (POST /v1/chat/completions), and the gateway keeps markdown memory you can open like a wiki — plus tools, sandbox, MCP, and human-in-the-loop when you need action.

It is not classic RAG (no “inject N chunks into the prompt”). Memory is retrieved on demand inside the agent loop (wiki_search and related tools). It is also not a vector black box: facts live as files you can read, edit, and version.

Use it when:

  • Cursor / Claude / your agent forgets staging names, decisions, and project context between sessions
  • You want auditable memory (markdown) instead of opaque embeddings
  • You want one /v1 URL for chat + memory + tools, self-hosted or on Kortexio Cloud

What is this package?

A thin header helper for TypeScript/JavaScript — not a full SDK.

ContextMemory needs a few HTTP headers on every call (Authorization, and usually X-App-Id / X-User-Id / X-Session-Id). This package builds those headers (and OpenAI client options) so you do not hand-roll them.

Beta (0.0.1-beta.x). APIs may still change.

Install

npm i @kortexio/contextmemory openai

Quick start (OpenAI JS client)

Point the client at your gateway /v1 base URL (self-host or Cloud):

import OpenAI from "openai";
import { openAIClientOptions } from "@kortexio/contextmemory";

const client = new OpenAI(
  openAIClientOptions({
    baseUrl: process.env.CONTEXTMEMORY_BASE_URL ?? "http://localhost:5100/v1",
    apiKey: process.env.CONTEXTMEMORY_API_KEY!, // cm_live_… or self-host key
    appId: "demo-dev",
    userId: "user-42",
    sessionId: "sess-abc", // same session → same wiki memory
  })
);

const completion = await client.chat.completions.create({
  model: "qwen3.5:9b",
  messages: [{ role: "user", content: "Remember that my staging DB is postgres-staging." }],
});

console.log(completion.choices[0]?.message?.content);

Reuse the same sessionId across turns so the gateway attaches the right session wiki.

Headers only (fetch, custom clients)

import { headers } from "@kortexio/contextmemory";

const res = await fetch("http://localhost:5100/v1/chat/completions", {
  method: "POST",
  headers: headers({
    apiKey: "cm_live_...",
    appId: "demo-dev",
    userId: "user-42",
    sessionId: "sess-abc",
  }),
  body: JSON.stringify({
    model: "qwen3.5:9b",
    messages: [{ role: "user", content: "Hello" }],
  }),
});

API

| Export | Purpose | | --- | --- | | openAIClientOptions(input) | { baseURL, apiKey, defaultHeaders } for openai | | headers(input) | Plain header map for any HTTP client |

Required: apiKey
Optional: appId, userId, sessionId, extra (merged into headers)
For OpenAI helper: also baseUrl (trailing slash is stripped)

Cloud vs self-host

| | Base URL | API key | | --- | --- | --- | | Self-host | http://localhost:5100/v1 (or your host) | App key from Admin / config | | Kortexio Cloud | Cloud API /v1 | cmk_live_… |

More: GitHub · why we are not RAG · MCP aha demo

License

AGPL-3.0-or-later — same as the ContextMemory core.