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

@x6txy/ctxscope

v0.6.0

Published

Set up and maintain correct instructions for AI coding agents

Readme

ctxscope

Keep AI coding agents in sync with your repository.

npm version Node >=20 License: MIT OpenCode Compatible Claude Code Compatible Codex Compatible Cursor Compatible

Your code changes. Agent instructions often do not.

ctxscope is a local, deterministic CLI for the context files used by Claude Code, Codex, Cursor, OpenCode, GitHub Copilot, Gemini CLI, and Windsurf. It generates, checks, fixes, scores, and compares agent instructions without AI-generated rewrites.

npx @x6txy/ctxscope diagnose
Agent Context Score  64/100

ERROR CTX101  AGENTS.md:18
  conflicting package managers: npm, pnpm
  Fix: Normalize package manager commands

ERROR CTX102  AGENTS.md:24
  references missing package script: test:e2e
  Recommendation: remove or replace with an existing package.json script

WARN CTX006  CLAUDE.md:42
  contains a repeated paragraph
  Fix: Remove repeated paragraph

Run ctxscope fix to apply 1 safe fix.

Why

Agent-heavy repositories accumulate instructions across multiple files:

AGENTS.md
CLAUDE.md
.cursor/rules/*
.github/copilot-instructions.md
.opencode/skills/*/SKILL.md

As the repository evolves, those files become stale, inconsistent, duplicated, and expensive. The result is context drift: agents receive outdated commands, broken paths, conflicting package-manager instructions, or too much low-value text.

ctxscope answers the practical questions:

  • Which agent context files exist?
  • Are their commands and file references still valid?
  • Do different files conflict?
  • How much context is loaded?
  • Which safe fixes can be previewed and applied?
  • What changed compared with main?

Workflow

Generate -> Diagnose -> Preview fixes -> Apply -> Compare.

1. Generate or discover context

npx @x6txy/ctxscope generate --agent claude

For an existing repository:

npx @x6txy/ctxscope diagnose

2. Diagnose with score details

npx @x6txy/ctxscope diagnose --verbose
Agent Context Score  64/100
  Correctness  56/100
    -22  CTX102  references missing package script: test:e2e
    -10  CTX103  Referenced path does not exist: apps/api
  Freshness    100/100
  Efficiency   76/100
    -10  CTX006  contains a repeated paragraph
    -8   duplication  repeated paragraph pressure
  Consistency  78/100
    -22  CTX101  conflicting package manager instructions
  Coverage     100/100

3. Preview safe fixes

npx @x6txy/ctxscope fix --dry-run
Diff  AGENTS.md
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1,4 +1,4 @@
 # Instructions

-Run npm install and npm run test.
+Run pnpm install and pnpm test.

4. Apply deterministic fixes

npx @x6txy/ctxscope fix
Target  /repo
Mode    write

Agent Context Score  64 -> 82
Applied 1 safe fix
Skipped 1 fix
Saved ~420 tokens per session

5. Compare context drift

npx @x6txy/ctxscope diagnose --diff main
Context Diff

Score: 87 -> 74 (-13)
Tokens: ~5,900 -> ~7,420 (+1,520)

New problems:
  ERROR CTX102 AGENTS.md:24
    references missing package script: test:e2e

Fixed problems:
  WARN CTX006 CLAUDE.md
    repeated paragraph removed

Commands

| Command | Description | |---|---| | scan [path] | Inventory discovered context files and hygiene warnings | | diagnose [path] | Validate context files and score repository health | | fix [path] | Preview or apply deterministic safe repairs | | generate [path] | Create context files based on repository facts | | init [path] | Create config file or agent context | | largest [path] | Find the largest context sources | | tokens [path] | Estimate context overhead per session | | explain <code> | Understand any diagnostic without leaving the terminal | | skills categories | Generate a skill category map | | skills optimize | Consolidate skills into lightweight pointers |

Useful options: --agent <agent>, --json, --verbose, --changed, --diff <ref>, --dry-run, --ci.

Run any command with --help for full options.


Supported Agents

| Agent | Status | Files Detected | |---|---|---| | Codex | Native | AGENTS.md, **/AGENTS.md | | OpenCode | Native | AGENTS.md, **/AGENTS.md, .opencode/**/*.md, .opencode/skills/**/SKILL.md | | Claude Code | Native | CLAUDE.md, **/CLAUDE.md, AGENTS.md | | Cursor | Pattern-based | .cursor/rules/** | | GitHub Copilot | Pattern-based | .github/copilot-instructions.md | | Gemini CLI | Pattern-based | GEMINI.md (generate only) | | Windsurf | Pattern-based | .windsurf/rules/ctxscope-generated.md (generate only) | | Generic | Pattern-based | AGENTS.md, CLAUDE.md, SKILL.md, **/SKILL.md, .cursor/rules/**, .github/copilot-instructions.md |

Pattern-based discovery is intentionally conservative. See agent support.


Safety Promise

  • No AI-generated edits.
  • fix only writes files when explicitly invoked.
  • fix --dry-run prints the diff before changing anything.
  • Missing scripts and missing paths are recommendations, not guessed rewrites.
  • Generated files are not overwritten without --force.
  • Git comparison commands do not mutate the working tree.

See safety for details.


Documentation


FAQ

Manually checking every agent instruction after repository changes is slow and easy to forget. ctxscope turns that review into one local command: it validates explicit commands and paths, detects conflicts and duplicates, estimates token overhead, and previews deterministic fixes.

Yes. ctxscope diagnose --ci exits with code 1 when configured errors are present. CI is supported, but the primary workflow is local: diagnose, preview, apply, and compare before changes surprise your agents.

Token counts use ceil(character_count / 4). They are useful for budgeting and comparison, not exact provider billing.


Created by tuple.

Telegram: @ncglx  ·  Email: [email protected]

MIT License