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

@anshulluhsna/compaction-orchestrator

v0.1.0

Published

Control which compaction strategy your agent uses for each turn and context segment.

Downloads

19

Readme

@anshulluhsna/compaction-orchestrator

Control which compaction strategy your agent chooses for each turn and context segment.

This package is the SDK and CLI for Compaction Orchestrator. It is not just another summarizer. It gives agent builders a programmable compaction control layer: preserve instructions verbatim, extract active errors, externalize noisy tool output, summarize completed exploration, and return a compact runtime context for the next model call.

Install

npm install @anshulluhsna/compaction-orchestrator

SDK

import { compact } from "@anshulluhsna/compaction-orchestrator";

const result = compact({
  messages,
  objective: "Prepare context for the next agent turn.",
  desiredBudget: 1200,
  policy: {
    mode: "balanced",
    preserveUserMessagesVerbatim: true,
    allowExternalRetrieval: true
  }
});

console.log(result.contextView.content);
console.log(result.plan.segments.map((segment) => segment.operation));

Customer Support Package

import { compactCustomerSupport } from "@anshulluhsna/compaction-orchestrator";

const handoff = compactCustomerSupport({
  messages,
  objective: "Prepare a reliable support handoff.",
  useCase: "customer_support"
});

console.log(handoff.contextPackage.issue);
console.log(handoff.contextPackage.nextActions);

CLI

npx @anshulluhsna/compaction-orchestrator examples/coding-agent-session.json

You can also pipe JSON through stdin:

cat session.json | npx @anshulluhsna/compaction-orchestrator

Import Claude Code or Codex transcripts into UI-ready fixtures:

npx @anshulluhsna/compaction-orchestrator import claude ~/.claude/projects/<project>/<session>.jsonl \
  --out my-claude-session.json

npx @anshulluhsna/compaction-orchestrator import codex ~/.codex/sessions/YYYY/MM/DD/rollout-...jsonl \
  --out my-codex-session.json

Persistence

The package root is SDK-first. Persistence is available through an explicit subpath:

import { SqliteStore } from "@anshulluhsna/compaction-orchestrator/store";

SQLite is useful for local API/server workflows where you want durable sessions, compaction plans, context views, and externalized content.

Strategy Routing

Compaction Orchestrator supports different strategies per turn and per segment. A single agent turn can produce a mixed plan such as:

  • keep_verbatim for user constraints
  • extract_active_error for the current failure
  • externalize_for_retrieval for large logs
  • structured_summary for completed exploration

The result is smaller context with more control over what survives.