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

@loredotlink/sdk

v0.1.39

Published

Lore SDK — upload agent sessions to Lore from your own apps and plugins

Readme

@loredotlink/sdk

Upload agent sessions to Lore from your own apps, plugins, and tools.

If you build on top of coding agents — a Claude Code plugin, an internal dev tool, a product that embeds an agent — this SDK lets you capture the resulting sessions in your Lore workspace, tagged with your own metadata (customer id, deployment, device, …) so you can debug and filter them later.

Installation

npm install @loredotlink/sdk

Requires Node.js 20 or later. The SDK reads session transcripts from the local machine, so it must run where the agent ran (for Claude Code: wherever ~/.claude/projects lives) — for example inside a Claude Code hook.

Authentication

The SDK authenticates with an Upload API key (lore_uak_...). Create one in Lore under Account Settings → Upload API keys. Keys are scoped to your workspace: sessions uploaded with your key are attributed to you and visible to your workspace, regardless of which machine or end user ran the upload.

Treat the raw key as a secret — inject it via an environment variable or your own config; don't hard-code it in distributed source.

Usage

import Lore from '@loredotlink/sdk';

const uploadClient = new Lore.Upload(process.env.LORE_UPLOAD_API_KEY, {
  // Optional; defaults to api.lore.link. Accepts a bare hostname (https
  // assumed) or a full origin such as http://127.0.0.1:4000 for local testing.
  apiHostname: 'api.lore.link',
});

const result = await uploadClient.uploadSessionSnapshot(
  'claude_code',          // harness — only 'claude_code' is implemented today
  sessionId,              // the Claude Code session id
  {
    metadata: {
      customer_id: 'cus_123',
      deployment: 'prod-eu',
    },
  },
);

console.log(result.threadId); // Lore thread id, e.g. th_...
console.log(result.reused);   // true if Lore already had this exact snapshot

uploadSessionSnapshot resolves the session's transcript on disk, snapshots it, uploads it to Lore, and waits until Lore has finished parsing it into a thread. When the returned promise resolves, the thread is ready.

Example: upload from a Claude Code Stop hook

A common integration is a plugin that uploads a session when it ends:

// stopHook.ts — runs on Claude Code's Stop hook
import Lore from '@loredotlink/sdk';

const input = JSON.parse(await readStdin()); // Claude Code passes { session_id, ... }

const uploadClient = new Lore.Upload(process.env.LORE_UPLOAD_API_KEY);
await uploadClient.uploadSessionSnapshot('claude_code', input.session_id, {
  metadata: { customer_id: getCustomerId() },
});

API

new Lore.Upload(uploadApiKey, options?)

| Parameter | Type | Description | | --- | --- | --- | | uploadApiKey | string | Your Upload API key (lore_uak_...). Required. | | options.apiHostname | string | Lore API hostname or origin. Defaults to api.lore.link. |

upload.uploadSessionSnapshot(harness, sessionID, options?)

| Parameter | Type | Description | | --- | --- | --- | | harness | 'claude_code' \| 'codex' \| 'cursor' | Which agent produced the session. Only claude_code is implemented; the others reject with a not-implemented error. | | sessionID | string | The harness's session id. For Claude Code this is the id your hook receives as session_id. | | options.metadata | Record<string, string> | Caller-owned key/value tags stored on the uploaded session and resulting thread. Up to 20 keys; keys are 1–64 chars of letters, digits, _ . : -; values up to 512 chars; 4 KB total. |

Returns Promise<{ threadId: string; reused: boolean }>. reused is true when Lore deduplicated the upload against an identical existing snapshot.

Throws if the session can't be found on disk, the API key is invalid or revoked, the upload fails, or parsing fails.

What gets uploaded

  • The SDK includes a client-side scrubber: transcripts are scanned locally before upload, detected secrets are redacted, and a transcript the scrubber can't safely release is held on the local machine and not uploaded (the call rejects with a quarantine error).
  • Uploads are snapshots — re-uploading the same session after it grows creates/updates the same Lore thread (deduplicated by content and session id).
  • Threads uploaded with an Upload API key use the key's workspace visibility and carry the key's attribution, so the key owner can filter threads by key and by metadata.