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

@getmikk/ai-context

v2.1.5

Published

> Token-budgeted AI context builder and `claude.md` / `AGENTS.md` generator.

Readme

@getmikk/ai-context

Token-budgeted AI context builder and claude.md / AGENTS.md generator.

npm License: Apache-2.0

Two things: a graph-traced context builder that packs the most relevant functions into a token budget for any given task, and a generator that produces always-accurate claude.md and AGENTS.md files from the lock file.

Part of Mikk — live architectural context for your AI agent.


Context Builder

Given a task description, BFS-traces the dependency graph from matched seed functions and returns the most relevant context within a configurable token budget.

import { ContextBuilder, getProvider } from '@getmikk/ai-context'

const builder = new ContextBuilder(contract, lock, projectRoot)

const ctx = builder.build({
  task: 'Add rate limiting to all API routes',
  maxHops: 4,
  tokenBudget: 6000,
  focusModules: ['api'],
  includeCallGraph: true,
  includeBodies: true,
})

const formatter = getProvider('claude')    // XML tags for Claude
// const formatter = getProvider('generic')   // plain text
// const formatter = getProvider('compact')   // minimal tokens

const output = formatter.formatContext(ctx)

How it works

  1. Seed — task keywords matched against function names, module descriptions, and file paths using BM25 + fuzzy matching
  2. Walk — BFS from seed nodes, following call graph edges outward up to maxHops (default 4, max 12)
  3. Score — each function scored by: graph proximity, keyword match, entry-point bonus, module relevance
  4. Budget — greedy knapsack: highest-scoring functions packed until token budget is consumed
  5. Format — serialized with function bodies, params, return types, call graph edges, and file locations

Strict mode

Pass relevanceMode: 'strict' to restrict results to exact keyword matches only. Set autoFallback: true (default) to retry balanced mode when strict returns nothing.


claude.md / AGENTS.md Generator

Generates tiered AI context files from the lock file. Every piece of content is derived from parsed source — never hand-authored, never stale.

import { ClaudeMdGenerator } from '@getmikk/ai-context'

const generator = new ClaudeMdGenerator(
  contract,
  lock,
  12000,        // token budget
  packageJson,  // from package.json scripts/dependencies
  projectRoot
)

const content = generator.generate()
// Write to claude.md and AGENTS.md

Tiered output

Content is added in priority order until the token budget is consumed:

| Tier | Content | Always included? | |------|---------|-----------------| | 1 | Project summary — name, description, module list, stats, constraints | Yes | | — | Tech stack — detected frameworks, runtime, build tool | If detectable | | — | Build/test commands — from package.json scripts | If present | | 2 | Per-module detail — exported API, key functions, internal call summary | Until budget | | — | Context files — discovered schemas, configs, data models | If budget allows | | — | Import graph — cross-file relationships per module | If budget allows | | — | HTTP routes — detected routes with method, path, handler | If budget allows | | 3 | Constraints — all declared rules | If budget allows | | — | ADR decisions — architectural decisions with reasons | If budget allows |

Modules with zero functions are skipped. Token estimation uses ~4 chars/token.


Semantic Search

Local vector embeddings for natural-language function search. Runs entirely on-device.

Default provider: Xenova/all-MiniLM-L6-v2 via @xenova/transformers (~22MB, downloads once to ~/.cache/huggingface).

import { SemanticSearcher } from '@getmikk/intent-engine'

const available = await SemanticSearcher.isAvailable()
// true only if @xenova/transformers is installed

const searcher = new SemanticSearcher(projectRoot)
await searcher.index(lock)

const results = await searcher.search('validate a JWT token', lock, 10)

No API key or internet connection required after the initial model download. Embeddings are cached to .mikk/embeddings.json and only recomputed when the lock changes.


Direct Search

O(1) lookups against a prebuilt name/signature/location index:

import { DirectSearchEngine } from '@getmikk/core'

const engine = new DirectSearchEngine(lock)

engine.getExactMatch('parseToken')           // exact name
engine.findBySignature('login(email: string): User')  // full signature
engine.findByLocation('src/auth/login.ts', 42)         // file + line
engine.findSimilar({ name: 'verifyToken' }, 5)         // fuzzy, top 5

License

Apache-2.0