gitwtfhub

wtf is tokenward?

cryptosaras/tokenward — explained in plain English

Analysis updated 2026-05-18

54TypeScriptAudience · developerComplexity · 2/5Setup · easy

TL;DR

Tokenwarden hooks into Claude Code to enforce hard spending limits per session, day, project, or model, instead of only reporting cost after the fact.

Mindmap

Mindmap is still cooking. Refresh in a few.

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Set a hard dollar cap per day or per project that blocks further Claude Code activity once reached.

REASON 2

Require human confirmation before an expensive subagent call on a costly model.

REASON 3

Track usage against Anthropic's rolling five-hour and weekly windows on flat-rate subscription plans.

REASON 4

Run in observe mode first to see what would have been blocked before switching to enforcement.

What's in the stack?

TypeScript

How it stacks up

cryptosaras/tokenwardavijit07x/git-switchfastify/fastify-type-provider-json-schema-to-ts
Stars545454
LanguageTypeScriptTypeScriptTypeScript
Last pushed2026-07-01
MaintenanceActive
Setup difficultyeasymoderateeasy
Complexity2/54/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 30min

Starts in observe-only mode by default, enforcement must be turned on manually in a local JSON config file.

No license is stated in the provided text.

Wtf does this do

Tokenwarden is a TypeScript tool that plugs into Claude Code (Anthropic's AI coding assistant) and enforces spending limits rather than just reporting them. The README positions it as complementary to existing cost-tracking tools: those tools tell you what you already spent, while tokenwarden blocks or interrupts activity before you spend more than you intended. It works by registering handlers for events that Claude Code fires at various points in a session: when a user submits a prompt, before a tool call executes, before the context is compacted, and at the start and end of sessions. By hooking into these events, the tool can cancel or hold calls for confirmation before they happen. The main features are: hard dollar caps per session, per day, per project, or per model, which block further activity once a limit is reached, an escalation system that asks for human confirmation before expensive operations like spawning a subagent on a costly model, argument-bloat prevention that caps how many lines a file read can return and requires Grep and Glob calls to include path constraints, and a compaction coach that reminds users to compress the conversation context when it is nearly full, reducing the cost of subsequent calls. For users on flat-rate subscription plans where individual API costs are not billed per call, tokenwarden tracks usage against Anthropic's rolling five-hour and weekly usage windows instead. The README is clear that these window ceilings are estimates because Anthropic does not publish exact numbers, and that the tool only sees activity on the machine where it is installed. Installation adds entries to Claude Code's settings file that point at the tokenwarden binary. It starts in observe mode by default, logging what it would have blocked without actually blocking anything, so users can review its behavior across a full session before switching to enforcement mode. Enforcement mode is opted into by editing a local JSON configuration file. The tool is designed to fail open, meaning if it encounters an internal error it does nothing rather than blocking the user's work.

Yoink these prompts

Prompt 1
How do I configure tokenwarden to cap my daily Claude Code spend at a fixed dollar amount?
Prompt 2
Explain the difference between observe mode and enforcement mode in tokenwarden.
Prompt 3
What does 'fail open' mean for a tool like tokenwarden, and why does it matter?
Prompt 4
How does tokenwarden estimate Anthropic's five-hour usage window when the exact limit isn't published?

Frequently asked questions

wtf is tokenward?

Tokenwarden hooks into Claude Code to enforce hard spending limits per session, day, project, or model, instead of only reporting cost after the fact.

What language is tokenward written in?

Mainly TypeScript. The stack also includes TypeScript.

What license does tokenward use?

No license is stated in the provided text.

How hard is tokenward to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is tokenward for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.