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

drawex

v1.0.4

Published

Claude Code spending limits and hard enforcement for AI coding agents

Readme

drawex

Track your Claude Code spending. Get warned before you overspend. Get blocked when you do.

A lightweight CLI tool that wraps the claude command, logs every session's cost automatically, and enforces daily, weekly, or monthly spending limits — with hard blocks, not just suggestions.

  Claude Code Usage — Daily
  6/10/2026

  [████████████·············]  50.2%  ● OK

  Spent:       $0.2008
  Limit:       $0.40
  Remaining:   $0.1992

  Sessions: 3  |  Tokens in: 12,400  |  Tokens out: 4,200

Why

Claude Code doesn't expose per-session cost tracking or spending limits natively — especially relevant at enterprise scale where daily usage can compound quickly. drawex fills that gap with zero cloud dependency: everything lives in ~/.drawex/ on your machine.


Install

Requirements: Node.js 18+

Install globally directly from npm:

npm install -g drawex

Or install from source for development:

git clone https://github.com/RohithTiruvaipati/drawex
cd drawex
npm install -g .

Verify:

dx --help

Quick Start

# 1. Set a limit
dx set-limit --daily 0.40
dx set-limit --weekly 6.00
dx set-limit --monthly 30.00

# 2. Check your usage anytime
dx status

# 3. See session history
dx history

Usage (Auto-tracking)

To run Claude Code with spending limits and cost-tracking, run the dx-wrap command instead of claude:

dx-wrap

It supports all the standard Claude Code arguments and prompts (e.g., dx-wrap --model claude-3-5-sonnet or dx-wrap "explain this file").


Optional: Alias Interception

If you want to keep typing claude in your terminal out of muscle memory, you can alias the claude command to the tracker:

Step 1 — Add to your shell config (~/.zshrc or ~/.bashrc):

export DRAWEX_REAL_CLAUDE="$(which claude)"
alias claude="dx-wrap"

Step 2 — Reload your shell:

source ~/.zshrc

Once set up, typing claude will automatically route through dx-wrap for background limits and cost logging.


Limit Behavior

| Usage | What happens | |-------|-------------| | 0–50% | Silent — no interruption | | 75% | ⚡ Warning printed after the session | | 90% | ⚠️ Strong warning printed after the session | | 100% | 🚫 Hard block — claude won't run |

When blocked:

╔══════════════════════════════════════════╗
║  🚫  CLAUDE USAGE LIMIT REACHED          ║
╚══════════════════════════════════════════╝
   Spent $0.4231 / $0.40 today (105.8%)

   To override:  claude --force <your prompt>
   To reset:     dx reset
   Raise limit:  dx set-limit --daily <amount>

For urgent work, bypass the block with:

claude --force "fix this production bug"

Commands

dx status                         Usage bar + stats for your active window
dx set-limit --daily <$>          Set daily spending limit
dx set-limit --weekly <$>         Set weekly spending limit
dx set-limit --monthly <$>        Set monthly spending limit
dx history [--n 20]               Show recent sessions (default: 15)
dx log --cost 0.012               Manually log a session by cost
dx log --input 1000 --output 500  Manually log by token count
dx reset [--confirm]              Clear all usage history (keeps config)
dx config                         Show current limit settings
dx install-wrapper                Step-by-step wrapper setup guide
dx-wrap [args]                    Run Claude Code with automatic limits/tracking

Manual Logging

If you prefer not to use the wrapper, log sessions yourself after each claude run:

dx log --cost 0.0234
dx log --input 5000 --output 1200 --model claude-sonnet-4
dx log --cost 0.01 --note "refactored auth module"

How it Works & Global Usage

How Usage is Captured

Claude Code prints a cost/token summary at the end of each session:

Cost: $0.0123 (1,234 input, 567 output tokens)

The dx-wrap wrapper captures this line from Claude's output, parses it, and writes a session record to ~/.drawex/usage.json. Your conversation content is never read or stored — only the cost metadata.

Running Globally in Any Terminal / Folder

  • Yes, it works everywhere. Because the claude alias is defined in your shell config (~/.zshrc or ~/.bashrc), it will load in any terminal instance.
  • The config and usage database are stored in ~/.drawex/ (your home directory), so all terminals write to and read from the same central location.
  • Note: If you run Claude from an IDE terminal or a script that does not source your shell profile/aliases, it might bypass the alias and call the real claude binary directly. In this case, drawex won't capture the usage, and your status will remain unchanged (e.g. at 0.00). Make sure your execution environment loads your shell configuration.

Data & Privacy

  • All data is stored locally in ~/.drawex/
  • config.json — your limit settings
  • usage.json — session history (timestamps, token counts, costs)
  • No network requests, no telemetry, no accounts

Contributing

See CONTRIBUTING.md. The most impactful area right now is improving the output parser in lib/calc.js to handle more Claude Code output formats across versions.


License

MIT