Repo Tokens: GitHub Action Adds Token Count Badge for LLM Context Window Awareness

✍️ OpenClawRadar📅 Published: February 27, 2026🔗 Source
Repo Tokens: GitHub Action Adds Token Count Badge for LLM Context Window Awareness
Ad

Repo Tokens is a GitHub Action that calculates the token count of your codebase and adds a visual badge to your README indicating how much of a large language model's context window your repository occupies. The goal is to make token size a visible metric, similar to bundle size badges for JavaScript libraries, encouraging leaner codebases that are more compatible with AI coding agents.

How It Works

The action uses tiktoken for tokenization. It runs approximately 60 lines of inline Python and takes about 10 seconds to execute. It's implemented as a composite action.

Configuration and Output

The context window size is configurable, defaulting to 200,000 tokens (matching the size of Claude models). The badge color reflects the percentage of the configured context window your codebase fills:

  • Green: Under 30%
  • Yellow: 50-70%
  • Red: 70%+

The action updates the README file but does not automatically commit the changes, allowing your workflow to control the git strategy.

This type of tool is useful for developers working with AI assistants, as keeping a codebase within an LLM's context window allows the agent to maintain full awareness of the project structure and dependencies during coding tasks.

📖 Read the full source: HN AI Agents

Ad

👀 See Also

Benchmark Results: When to Use Claude Opus with Codex vs. Pure Opus for Code Generation
Tools

Benchmark Results: When to Use Claude Opus with Codex vs. Pure Opus for Code Generation

A controlled benchmark tested the 'Plan with Opus, Execute with Codex' approach across three real coding tasks. Results show a cost crossover at approximately 600 lines of code, with specific recommendations based on project size.

OpenClawRadar
Team Brain: A Shared Memory Plugin for Claude Code That Stores Team Knowledge in Git
Tools

Team Brain: A Shared Memory Plugin for Claude Code That Stores Team Knowledge in Git

Team Brain is a Claude Code plugin that stores team knowledge in a .team-brain/ folder within your repository. It automatically generates a BRAIN.md file capped at 180 lines for optimal Claude instruction accuracy and works across tools by creating .cursorrules and AGENTS.md files.

OpenClawRadar
Windows System Tray App for Real-Time Claude API Usage Monitoring
Tools

Windows System Tray App for Real-Time Claude API Usage Monitoring

A developer built a lightweight Windows tray application that displays Claude API quota usage in real time, including 5-hour and 7-day windows, today's token counts, and depletion forecasts. The app supports Korean, English, Chinese, and Japanese UI and is open source on GitHub.

OpenClawRadar
AI Trading Agent with Risk Guardrails for Educational Investing
Tools

AI Trading Agent with Risk Guardrails for Educational Investing

A developer built an AI-powered trading assistant that connects Claude to a brokerage account with a risk engine between the AI and money. The system includes safety checks like blocking trades that exceed 50% of portfolio allocation, automatic shutdown at 3% daily loss, and a kill switch at 20% drawdown.

OpenClawRadar