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

agent-trace-ops

v1.0.3

Published

Analyzes Claude Code conversation history to identify token optimization opportunities and generate helper scripts

Readme

Token optimization plugin for Claude Code

agent-trace-ops (ato) analyzes your conversation’s tool-call chains and auto-suggests refactors to reduce tokens and latency.

  1. Extracts and enriches tool call metadata with timing, token counts, and file ranges
  2. Compresses session data with RLE for efficient pattern detection
  3. Generates actionable optimization suggestions:
    • Quick Commands: One-liner chains for package.json/Makefile
    • Parameterized Scripts: Reusable workflows that handle different inputs
    • File Refactorings: Merge/split files accessed together to reduce token overhead

https://github.com/user-attachments/assets/cac017c2-0fe7-4a8e-841c-e431a9324769

Usage

Claude Code Plugin

/plugin marketplace add peerbot-ai/claude-code-optimizer
/plugin install agent-trace-ops

After installing the plugin, use the /plan command for on-demand analysis:

/agent-trace-ops:plan

CLI

npx agent-trace-ops

Install globally for repeated use:

npm install -g agent-trace-ops
ato --project-path=<path> --agent=claude

This will:

  1. Check for existing analysis reports
  2. Ask if you want to reuse or regenerate the report
  3. Let you select which optimization categories to analyze:
    • Quick Commands (one-liner chains for package.json/Makefile)
    • Parameterized Scripts (reusable workflows)
    • File Refactorings (merge/split frequently accessed files)
  4. Analyze patterns and generate optimization suggestions
  5. Show helpers with potential token savings calculations

How it works

Every conversation in Claude Code is saved as JSONL (JSON Lines) files in ~/.claude/projects/<hash>/. The tool analyzes these sessions and generates a report:

## Sessions

### Session agent-567356cb [2025-11-04 03:15:59] (29s)
1. Read: [3106b] .zshrc[L1-L64]
💭 [+3s in=89t out=8t]
2. Edit: [+9s 1048b] settings.json[L1-L4], statusline-command.sh[L1-L31]
3. Read: [+1s 9069b] count_tokens.js[L1-L245]
💭 [+2s in=156t out=12t]
4. Edit: [+6s 740b] settings.json[L1-L4]
⏹️ MessageEnd [+4s in=12t out=45t]

### Session 396d2518 [2025-11-04 01:42:53] (2m 10s)
1. Bash: [cmd=96b out=177b] node index.js --project-path=$(pwd) --list
💭 [+2s in=45t out=6t]
2. Bash: [+4s cmd=97b out=1396b] node index.js --project-path=$(pwd) --print
⏹️ MessageEnd [+3s in=18t out=234t]

Claude inspects the behavioral data from it's own agent and suggests different optimizations.

Example Optimizations

Quick Commands - Combine repeated bash sequences (package.json/Makefile):

# Detected pattern (found 23 times in sessions):
4. Bash: [+1s cmd=8b] make build-packages
5. Bash: [+8s cmd=16b] docker compose restart gateway
6. Bash: [+1s cmd=17b] sleep 5
7. Bash: [+6s cmd=23b] docker compose logs gateway --tail=50

# Suggested: Add to Makefile or package.json
make deploy-gateway  # Reduces 4 calls → 1 call

Parameterized Scripts - Reusable workflows with different parameters:

# Detected pattern (found 15 times with different worker IDs):
8. Bash: [+0s cmd=30b] docker ps --filter "name=worker-1762140643"
9. Bash: [+2s cmd=32b] docker logs worker-1762140643-abc --tail=50
10. Bash: [+1s cmd=33b] docker logs worker-1762140643-abc | grep "error"

# Suggested script: ./scripts/worker-logs.sh
./scripts/worker-logs.sh 1762140643 50 "error"  # Reduces 3 calls → 1 call

File Refactorings - Merge co-accessed files:

# Detected pattern (found 23 times):
1. Read: [+0s 6156b] src/interactions.ts[L1-L812]
2. Read: [+2s 4720b] src/types.ts[L1-L203]
3. Read: [+1s 2696b] src/custom-tools.ts[L1-L156]

# Suggested: Merge into src/core.ts (1171 lines)
1. Read: [+0s 13572b] src/core.ts[L1-L1171]  # Reduces 3 reads → 1 read

See instructions.md for detailed pattern examples and optimization strategies.