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

@idmxgne/context-slim

v1.1.0

Published

Save 50%+ AI context tokens without losing critical code semantics. AST slimmer for Cursor, Claude, and other coding agents.

Downloads

45

Readme

ContextSlim

Save 50%+ AI context tokens without losing critical code semantics.

GitHub: lilite572-cyber/context-slim

Cursor, Claude, and other coding agents re-read whole files on every turn. Most of that budget is JSDoc, unused imports, and DTO mappers. ContextSlim parses JS/TS (Babel) and PHP (php-parser), hollows the noise, and keeps try/catch, auth methods, env() / process.env, and markers like FIXME / SECURITY / В ПРОД НЕ ГНАТЬ.

Before / after

Measured on the real-world billing controller in tests/fixtures/real_world_controller.ts (--signatures-only):

| | Tokens | What you keep | |---|---:|---| | Before | 3,522 | comments, mappers, unused imports, every method body | | After | 1,408 | signatures + critical bodies + protected comments | | Savings | 60% (10 labels kept) | try/catch, authorize / login, FIXME, В ПРОД НЕ ГНАТЬ |

CLI stats use gpt-tokenizer (o200k_base, GPT-4o / GPT-5 family) and print to stderr. Slim source goes to stdout.

npx @idmxgne/context-slim .
# Исходный размер: 3,522 токенов -> Сжатый: 1,408 токенов. Экономия: 60% ...

Quick start

npx @idmxgne/context-slim .
npx @idmxgne/context-slim ./src --signatures-only
npx @idmxgne/context-slim ./src --out slim.txt

From a clone:

npm i && npm run build
node dist/cli.js ./src

MCP server (Cursor, Windsurf, Claude Code)

Bin: context-slim-mcp → dist/mcp.js. Official @modelcontextprotocol/sdk Server + StdioServerTransport. Do not write logs to stdout.

Prompt use-slim-context:

Always prioritize using read_slim_file tool when reading source code files to optimize context window.

Tools:

| Tool | Args | Result | |---|---|---| | read_slim_file | path (string), signaturesOnly (boolean, default true) | compressed source | | get_slim_stats | none | last run: tokens before / after, % saved, protected label count |

Cursor

Merge into ~/.cursor/mcp.json (ready-made copy: examples/cursor-mcp.json):

{
  "mcpServers": {
    "context-slim": {
      "command": "node",
      "args": ["/ABSOLUTE/PATH/TO/context-slim/dist/mcp.js"]
    }
  }
}

After npm publish:

{
  "mcpServers": {
    "context-slim": {
      "command": "npx",
      "args": ["-y", "--package=@idmxgne/context-slim", "context-slim-mcp"]
    }
  }
}

Restart Cursor and ask the agent to read_slim_file on a fat controller.

Windsurf

Same mcpServers block in Windsurf's MCP config (~/.codeium/windsurf/mcp_config.json, or the MCP panel in settings). Point command at node + dist/mcp.js, or at npx as above.

Claude Code / Claude Desktop

Claude Desktop — merge examples/claude_desktop_config.json into claude_desktop_config.json:

{
  "mcpServers": {
    "context-slim": {
      "command": "node",
      "args": ["/ABSOLUTE/PATH/TO/context-slim/dist/mcp.js"]
    }
  }
}

Claude Code:

claude mcp add context-slim -- node /ABSOLUTE/PATH/TO/context-slim/dist/mcp.js

Safe labels (.contextslimrc + isCriticalNode)

A node is never hollowed when isCriticalNode says so:

  • comments matching CRITICAL, FIXME, TODO, SECURITY, DONT TOUCH, В ПРОД НЕ ГНАТЬ, @keep
  • try / catch
  • methods whose names look like auth (authorize, login, jwt, csrf, …)
  • env(), getenv(), process.env
  • PHP/Laravel: $this->hasMany / $this->belongsTo (and other Eloquent relations) and scope* methods

Repo: https://github.com/lilite572-cyber/context-slim

Put extra phrases in .contextslimrc at the project root:

{
  "keep_patterns": ["HACK", "LEGACY"]
}

entry_patterns (defaults: index / cli / main / app / server) keep ordinary function bodies even without --signatures-only. Dependency files are hollowed; pass --signatures-only (or MCP signaturesOnly: true) to hollow everything that is not critical.

Install / publish

npm i
npm test
npm run build

Bins: context-slim → dist/cli.js, context-slim-mcp → dist/mcp.js. npm: @idmxgne/context-slim. License: MIT.

License

MIT