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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@dexploarer/plugin-toon

v0.1.0

Published

Drop-in replacement for @elizaos/plugin-bootstrap with TOON-encoded providers for token-efficient LLM context

Readme

@dexploarer/plugin-toon

TOON-encoded providers for token-efficient LLM context in ElizaOS.

What is TOON?

TOON (Token-Oriented Object Notation) is a compact serialization format designed to reduce token usage when passing structured data to LLMs. It achieves 30-60% token savings compared to JSON, especially for uniform arrays of objects.

// JSON (15 tokens)
{"items":[{"id":1,"name":"Ada"},{"id":2,"name":"Bob"}]}

// TOON (8 tokens)
items[2]{id,name}:
  1,Ada
  2,Bob

Installation

bun add @dexploarer/plugin-toon @toon-format/toon

Usage

As ElizaOS Plugin

import { bootstrapPlugin } from '@elizaos/plugin-bootstrap';
import { toonPlugin } from '@dexploarer/plugin-toon';
import { hyperscapePlugin } from '@hyperscape/plugin-hyperscape';

const agent = {
  plugins: [
    bootstrapPlugin,    // Core functionality
    toonPlugin,         // TOON providers (override bootstrap)
    hyperscapePlugin,   // Your game logic
  ],
};

Using Utilities Directly

import { encodeToon, formatForLLM, smartEncode } from '@dexploarer/plugin-toon';

// Encode data to TOON
const toon = encodeToon({
  users: [
    { id: 1, name: 'Alice', role: 'admin' },
    { id: 2, name: 'Bob', role: 'user' },
  ],
});
// Output:
// users[2]{id,name,role}:
//   1,Alice,admin
//   2,Bob,user

// Format for LLM context with header
const { text, itemCount } = formatForLLM('Active Users', users);
// Output:
// ## Active Users
// [2]{id,name,role}:
//   1,Alice,admin
//   2,Bob,user

// Smart encode - uses TOON for optimal cases, JSON otherwise
const encoded = smartEncode(data);

Providers

This plugin provides TOON-encoded versions of common bootstrap providers:

| Provider | Position | Replaces | |----------|----------|----------| | toonRecentMessagesProvider | 10 | recentMessagesProvider | | toonFactsProvider | 11 | factsProvider | | toonEntitiesProvider | 12 | entitiesProvider | | toonActionsProvider | 13 | actionsProvider |

Providers have higher position numbers, so they take precedence over bootstrap providers when both plugins are loaded.

Token Savings

Based on TOON benchmarks:

| Data Type | JSON Tokens | TOON Tokens | Savings | |-----------|-------------|-------------|---------| | 100 entities | ~15,000 | ~8,700 | 42% | | 180 day metrics | ~11,000 | ~4,500 | 59% | | Nested order | ~260 | ~170 | 35% |

API Reference

Functions

encodeToon(data, options?)

Encode any data to TOON format.

decodeToon(toonString)

Decode TOON string back to data.

formatForLLM(label, data, options?)

Format data for LLM context with a markdown header.

smartEncode(data, options?)

Automatically choose TOON or JSON based on data structure.

isToonOptimal(data)

Check if data is suitable for TOON's tabular format.

Options

interface ToonEncodeOptions {
  delimiter?: string;      // Default: ","
  lengthMarker?: string;   // Default: none
  maxArrayLength?: number; // Truncate long arrays
  maxStringLength?: number; // Truncate long strings
}

When to Use TOON

Good for:

  • Uniform arrays of objects (entity lists, inventory, logs)
  • Tabular data (DB results, API responses)
  • High-volume LLM interactions

Not ideal for:

  • Deeply nested structures
  • Non-uniform data
  • Single objects
  • Natural language text

License

MIT