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

ctxmap

v0.1.0

Published

Codebase context compiler for AI agents. Token-optimized maps + auto-generated instructions.

Readme

ctxmap

Codebase context compiler for AI agents. Token-optimized maps + auto-generated instructions.

Why ctxmap?

AI coding agents waste thousands of tokens exploring codebases file-by-file. ctxmap solves this by scanning your project into a compact .ctx format that gives agents instant understanding of your codebase structure, stack, conventions, and patterns.

Quick Start

# Scan your project
npx ctxmap scan

# Generate agent instruction files
npx ctxmap init

# Output to file
npx ctxmap scan --out

.ctx Format

ctxmap outputs a token-optimized format designed for LLM consumption:

@ctx v1
@project recipe-app
@stack next15+react19 mui6 prisma6 vitest3
@pkg lang:typescript pm:pnpm

## tree
src/
  app/
    page.tsx [page,20L] exp:HomePage dep:@mui/material
    layout.tsx [layout,19L] exp:metadata,RootLayout
    api/
      recipes/
        route.ts [api,16L] exp:GET,POST dep:next/server
  components/
    Hero.tsx [comp,17L] exp:Hero props:{title?:str,subtitle?:str}
  hooks/
    useRecipes.ts [hook,22L] exp:useRecipes dep:@tanstack/react-query
  lib/
    db.ts [lib,17L] exp:getRecipes,createRecipe dep:@prisma/client

## conventions
- functions: arrow
- exports: named
- no-html-elements: true
- tests: separate

## patterns
- routing: app-router
- styling: mui
- validation: zod
- orm: prisma

CLI Reference

ctxmap scan

Scan project and output .ctx format.

ctxmap scan                  # Output to stdout
ctxmap scan --out            # Write to .ctxmap/context.ctx
ctxmap scan --out my.ctx     # Write to custom path
ctxmap scan --deep           # Use tree-sitter for deeper analysis
ctxmap scan --lang ts        # Filter by language (ts or py)
ctxmap scan --ignore "*.md"  # Additional ignore patterns
ctxmap scan --no-cache       # Skip cache
ctxmap scan --verbose        # Verbose output

ctxmap init

Generate agent instruction files from your project.

ctxmap init                           # Generate all (CLAUDE.md, .cursorrules, copilot)
ctxmap init --target claude           # Generate only CLAUDE.md
ctxmap init --target cursor copilot   # Generate specific targets

ctxmap sync

Re-scan project using cache for unchanged files.

ctxmap sync            # Update .ctxmap/context.ctx
ctxmap sync --verbose  # Show cache hit/miss info

ctxmap convert

Convert between agent instruction formats.

ctxmap convert --from .ctxmap/context.ctx --to cursor
ctxmap convert --from .ctxmap/context.ctx --to copilot

ctxmap mcp

Start MCP server (stdio transport) for use with Claude Code, Cursor, etc.

ctxmap mcp

MCP Server Setup

Claude Code

Add to your Claude Code MCP config:

{
  "mcpServers": {
    "ctxmap": {
      "command": "npx",
      "args": ["ctxmap", "mcp"]
    }
  }
}

Available MCP Tools

| Tool | Description | Tokens | |------|-------------|--------| | ctxmap_overview | Project summary | ~30-50 | | ctxmap_tree | Full file tree with annotations | ~100-400 | | ctxmap_file | Single file detail | ~20-40 | | ctxmap_related | Imports/imported-by/siblings | ~30-80 | | ctxmap_query | Search by name/export/role | ~20-100 | | ctxmap_conventions | Conventions + patterns | ~20-40 |

Supported Languages

  • TypeScript/JavaScript (.ts, .tsx, .js, .jsx, .mts, .mjs)
  • Python (.py)

Deep Mode (tree-sitter)

For enhanced parsing with full type resolution, install tree-sitter:

pnpm add tree-sitter tree-sitter-typescript tree-sitter-python
ctxmap scan --deep

Configuration

ctxmap uses sensible defaults with zero configuration. It automatically:

  • Reads .gitignore for file exclusions
  • Detects your stack from package.json or pyproject.toml
  • Identifies conventions from code patterns
  • Caches results in .ctxmap/cache.msgpack

Add .ctxmap/ to your .gitignore.

Programmatic API

import { scan, formatCtx } from 'ctxmap';

const map = await scan('./my-project');
const ctx = formatCtx(map);
console.log(ctx);

Contributing

See CONTRIBUTING.md for development setup and guidelines.

License

MIT