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

@q1k-oss/mint-format

v1.0.2

Published

🌿 MINT Format encoder/decoder - Minimal Inference Notation for Tokens

Downloads

290

Readme

MINT Format

Minimal Inference Notation for Tokens

A fresh, human-readable, token-efficient data format for LLM prompts. Combines YAML simplicity with Markdown table clarity.

CI npm version License: MIT

Live Playground | Full Specification | GitHub


Why MINT?

Modern LLMs are powerful but tokens cost money. Existing formats force a tradeoff:

| Format | Problem | |--------|---------| | JSON | Verbose β€” ~40% overhead from braces, quotes, repeated keys | | YAML | Better β€” but arrays of objects still repeat every key | | TOON | Efficient β€” but cryptic syntax, hard to read | | CSV | Compact β€” but no structure, can't nest |

MINT gives you the best of all worlds β€” 47% smaller than JSON with zero learning curve.


Key Features

  • Fresh & Clean β€” Instantly readable, no learning curve
  • 47% Fewer Tokens β€” Significant cost savings on LLM APIs
  • Crystal Clear β€” Visible | boundaries, Markdown tables
  • Edit-Friendly β€” No invisible tabs, no alignment headaches
  • Lossless β€” Perfect JSON round-trip (encode β†’ decode returns identical data)
  • Fast β€” Simple parsing, zero dependencies
  • Tiny β€” ~5KB minified

Installation

# npm
npm install @q1k-oss/mint-format

# pnpm
pnpm add @q1k-oss/mint-format

# yarn
yarn add @q1k-oss/mint-format

Quick Start

Encode (JSON β†’ MINT)

import { encode } from '@q1k-oss/mint-format';

const data = {
  users: [
    { id: 1, name: 'Alice', role: 'admin' },
    { id: 2, name: 'Bob', role: 'user' },
    { id: 3, name: 'Charlie', role: 'user' }
  ]
};

console.log(encode(data));

Output:

users:
  | id | name    | role  |
  | 1  | Alice   | admin |
  | 2  | Bob     | user  |
  | 3  | Charlie | user  |

Decode (MINT β†’ JSON)

import { decode } from '@q1k-oss/mint-format';

const mint = `
users:
  | id | name  | role  |
  | 1  | Alice | admin |
  | 2  | Bob   | user  |
`;

const data = decode(mint);
console.log(JSON.stringify(data, null, 2));
// {
//   "users": [
//     { "id": 1, "name": "Alice", "role": "admin" },
//     { "id": 2, "name": "Bob", "role": "user" }
//   ]
// }

Format Overview

Objects β€” YAML Style

user:
  id: 123
  name: Alice
  email: [email protected]
  active: true

Nested Objects

config:
  database:
    host: localhost
    port: 5432
  cache:
    enabled: true
    ttl: 3600

Arrays of Objects β€” Markdown Tables

This is where MINT shines:

employees:
  | id | name    | department  | salary |
  | 1  | Alice   | Engineering | 95000  |
  | 2  | Bob     | Marketing   | 75000  |
  | 3  | Charlie | Sales       | 80000  |

Simple Arrays β€” Inline

tags: typescript, javascript, nodejs
numbers: 1, 2, 3, 4, 5

Null Values

Use - in tables:

results:
  | id | name  | score |
  | 1  | Alice | 95    |
  | 2  | Bob   | -     |

Compact Mode (Optional)

Enable symbols for extra compression:

# Standard          # Compact (opt-in)
| status    |       | st |
| completed |       | βœ“  |
| pending   |       | ⏳ |
| failed    |       | βœ—  |

Real-World Example

workflow:
  id: wf_7x9k2m
  name: Invoice Reconciliation
  status: awaiting_review

steps:
  | id | tool            | status    | duration | output          |
  | 1  | gmail_search    | completed | 7s       | Found 23 emails |
  | 2  | document_parser | completed | 32s      | Parsed 21 docs  |
  | 3  | sheets_lookup   | completed | 16s      | Matched 18 POs  |
  | 4  | slack_notify    | pending   | -        | -               |

messages:
  | role      | content                              |
  | user      | Run invoice reconciliation           |
  | assistant | Starting reconciliation...           |
  | assistant | Found 3 discrepancies. Please review.|

API Reference

encode(value, options?): string

Converts JavaScript values to MINT format.

import { encode } from '@q1k-oss/mint-format';

const mint = encode(data, {
  indent: 2,        // Spaces per level (default: 2)
  compact: false,   // Use symbols (default: false)
  sortKeys: false,  // Sort object keys (default: false)
});

decode(input, options?): unknown

Parses MINT string back to JavaScript values.

import { decode } from '@q1k-oss/mint-format';

const data = decode(mintString, {
  strict: true,     // Throw on invalid syntax (default: true)
});

validate(input): ValidationResult

Validates MINT syntax without full parsing.

import { validate } from '@q1k-oss/mint-format';

const result = validate(mintString);
if (!result.valid) {
  console.error(result.errors);
  // errors include line/column information
}

estimateTokens(data): TokenEstimate

Estimates token counts for JSON vs MINT.

import { estimateTokens } from '@q1k-oss/mint-format';

const estimate = estimateTokens(data);
console.log(estimate);
// {
//   json: 3245,
//   mint: 1756,
//   savings: 1489,
//   savingsPercent: 45.9
// }

CLI

A companion CLI tool is available as a separate package:

# No install needed
npx @q1k-oss/mint-format-cli input.json -o output.mint

# Or install globally
npm install -g @q1k-oss/mint-format-cli

| Option | Description | |--------|-------------| | -o, --output <file> | Output file path | | -e, --encode | Force JSON β†’ MINT | | -d, --decode | Force MINT β†’ JSON | | --compact | Enable symbol compression | | --stats | Show token count & savings | | --indent <n> | Indentation spaces (default: 2) | | --validate | Validate input without conversion |


Benchmarks

| Dataset | JSON Tokens | MINT Tokens | Savings | |---------|-------------|-------------|---------| | User records (100 rows) | 3,245 | 1,756 | 46% | | API responses (50 items) | 2,891 | 1,534 | 47% | | Workflow states (25 steps) | 1,567 | 892 | 43% | | Nested configs | 892 | 523 | 41% | | Average | - | - | ~45% |


Comparison

vs JSON

{
  "users": [
    { "id": 1, "name": "Alice" },
    { "id": 2, "name": "Bob" }
  ]
}
users:
  | id | name  |
  | 1  | Alice |
  | 2  | Bob   |

MINT: 47% smaller, equally readable.

vs YAML

users:
  - id: 1
    name: Alice
  - id: 2
    name: Bob

MINT: 35% smaller for arrays of objects.


When to Use MINT

Perfect For:

  • Sending structured data to LLMs
  • Reducing token costs (API billing)
  • Human-readable LLM prompts
  • Arrays of similar objects
  • Agentic AI workflows
  • Version-controlled data (clean diffs)

Consider Alternatives For:

  • Maximum compression needed β†’ TOON
  • API interoperability β†’ JSON
  • Binary data β†’ MessagePack

Try It Online

Visit mint.q1k.ai to try MINT in your browser β€” encode, decode, and see token savings in real time.


Contributing

We welcome contributions! See CONTRIBUTING.md.

git clone https://github.com/q1k-oss/mint.git
cd mint
pnpm install
pnpm test
pnpm build

License

MIT


MINT Format β€” Fresh data for LLMs. Keep it minimal.