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

@polypixel/memoir-sdk

v0.5.0

Published

Generated TypeScript SDK for Memoir's memoir-service (Connect-RPC client).

Downloads

285

Readme

@polypixel/memoir-sdk

Generated TypeScript SDK for Memoir's memoir-service. Use this package when a TypeScript / JavaScript runtime needs to talk to a running memoir-service over the network.

If you'd rather embed Memoir in-process — owning the Postgres connection, Qdrant client, and embedding model yourself — use the Rust library polypixel-memoir-core instead. The TS SDK and the Rust library are sibling surfaces of the same product; pick the one that matches your runtime and deployment shape.

Install

pnpm add @polypixel/memoir-sdk @connectrpc/connect-node

On the browser / edge, swap @connectrpc/connect-node for @connectrpc/connect-web and use createConnectTransport (memoir-service speaks both gRPC and Connect protocols).

Quick start

import { createClient } from '@connectrpc/connect';
import { createGrpcTransport } from '@connectrpc/connect-node';
import { MemoryService } from '@polypixel/memoir-sdk/memoir/v1/memory_pb';

const transport = createGrpcTransport({
	baseUrl: 'http://localhost:5153',
});

const memory = createClient(MemoryService, transport);

const response = await memory.search(
	{
		scope: {
			agentId: 'my-agent',
			orgId: 'my-org',
			userId: 'user-42',
		},
		query: 'coffee preference',
		limit: 5,
	},
	{
		headers: { authorization: 'Bearer <jwt>' },
	},
);

for (const hit of response.hits) {
	if (hit.memory) {
		console.log(hit.memory.content);
	}
}

memoir-service requires an Authorization: Bearer <jwt> or X-Api-Key: mk.<id>.<secret> header on every authenticated RPC. Attach it per call via the headers option (as above), or via a Connect-RPC interceptor.

Rendered prompt context

Every read RPC (search, recall, timeline, recallAsOf, query) always returns a rendered field: prompt-ready text — a system-prompt preamble followed by one bullet per memory — produced server-side by memoir-core's own rendering. The optional template on the request chooses the preamble: leave it unset to use memoir's default phrasing (you never copy the string), or set it to supply your own (the empty string renders a blank preamble line):

const response = await memory.query({
	scope: { agentId: 'my-agent', orgId: 'my-org', userId: 'user-42' },
	query: 'what does the user drink?',
	// template omitted → memoir's default preamble; set a string for your own
});

console.log(response.rendered);

Query's bullets are dated (- [YYYY-MM-DD, N units ago] content); the other reads render - content, mirroring the library.

What's in the package

  • Generated Connect-RPC service definitions: MemoryService, AdminService, AuthService under @polypixel/memoir-sdk/memoir/v1/{memory,admin,auth}_pb.
  • Message types and schemas for every proto in memoir.v1.
  • Pure ESM. Modern bundlers and Node ≥18 follow the exports map natively; no CommonJS shim is shipped.

The SDK is regenerated from .proto sources by the upstream repository's gen:protos Nx target; consumers do not need buf or protoc installed.

License

Dual-licensed under MIT or Apache-2.0, at your option.