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

baresexp

v1.0.0

Published

Minimal token S-expression format AI agent instruction language with full TypeScript support

Downloads

156

Readme

BareSexp

BareSexp is a minimal-token, lossless S-expression language plus a TypeScript toolchain for AI agent instructions.

Features

  • Fluent builder API for tasks, steps, and tools
  • Compiler that serializes typed objects into BareSexp text
  • Parser that turns BareSexp text back into structured objects
  • Validator for basic task, step, and tool structure checks
  • Minimal mode with aggressive token reduction and local metadata storage
  • Metadata-aware output results with original text and shortened variants

Getting started

npm install
npm run build
npm test

Basic example

import { builder, compileBareSexp } from './src/index.js';

const task = builder
  .task({ name: 'research-agent', description: 'Research and summarize' })
  .step({ name: 'collect-context', description: 'Gather sources' })
  .tool({ name: 'web-search', description: 'Search the web' })
  .build();

const result = compileBareSexp(task);
console.log(result.baresexp);

Minimal mode example

import { builder } from './src/index.js';

const result = builder
  .minimal()
  .task({
    name: 'research-agent',
    description: 'Research and summarize the latest news about AI agents and tools for this week',
  })
  .step({
    name: 'collect-context',
    description: 'Gather recent sources and extract user-relevant facts',
  })
  .compile({ mode: 'minimal' });

console.log(result.baresexp);
console.log(result.metadata);

Prompt comparison

A normal prompt is verbose and easy to read, while BareSexp is structured and compact. The condense option removes line breaks and extra whitespace so the same instruction can be emitted as a single compact token-efficient string.

Condense option

Use compile({ condense: true }) or the builder equivalent to remove line breaks from the generated output. This is useful when you want the smallest possible payload for an agent prompt while still keeping the original meaning intact in metadata.

const result = builder
  .task({
    name: 'florida-man-news-summarizer',
    description: 'Summarize recent Florida Man news stories into a concise briefing',
  })
  .compile({ mode: minimal,condense: true });

console.log(result.baresexp);

Example: condensed BareSexp vs full BareSexp

Raw prompt idea

You are a Florida Man news summarizer. Summarize recent Florida Man news stories into a concise briefing.

Condensed BareSexp

(task florida-man-news-summarizer(description summarize-florida-man-news-stories-conci)(steps(step collect-news(description gather-florida-man-headlines-source-link)(tools(tool web-search(description search-web-florida-man-news-stories))))(step summarize(description condense-stories-short-factual-summary)(tools(tool summary-writer(description write-concise-bulletin-key-events-tone))))))

Full BareSexp

(task florida-man-news-summarizer
 (description "Summarize recent Florida Man news stories into a concise briefing")
 (steps
    (step collect-news
      (description "Gather recent Florida Man headlines and source links")
      (tools
        (tool web-search
          (description "Search the web for recent Florida Man news stories")
        )
      )
    )
    (step summarize
      (description "Condense the stories into a short, factual summary")
      (tools
        (tool summary-writer
          (description "Write a concise bulletin with key events and tone")
        )
      )
    )
 )
)

Token comparison

  • Condensed BareSexp: about 14 tokens
  • Full BareSexp: about 84 tokens

This shows how the condense option can dramatically reduce payload size while remaining structurally clear for the agent.

Examples

Verification

The project has been verified with:

npm run build
node examples/minimal-research-agent.ts