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

OpenClaw Integrates Features from Claude Code Leak
Tools

OpenClaw Integrates Features from Claude Code Leak

An OpenClaw user had their bot analyze the leaked Claude Code (Rust recreation by Instructkr) and selectively ported specific architectural patterns into their OpenClaw setup. The integration focuses on practical improvements like automatic startup continuity, conversation compaction, and a pre-tool/post-tool hook framework.

OpenClawRadar
Graphthulhu MCP Server Gives AI Agents Knowledge Graph Memory for Logseq/Obsidian
Tools

Graphthulhu MCP Server Gives AI Agents Knowledge Graph Memory for Logseq/Obsidian

Graphthulhu is an open-source MCP server that provides AI agents with read-write access to Logseq or Obsidian vaults, storing memory as structured pages with properties and links instead of vector embeddings. After one month, the system generated 404 pages with 1,451 cross-references.

OpenClawRadar
SynapsCAD: Open-Source Desktop App for OpenSCAD with Claude AI Integration
Tools

SynapsCAD: Open-Source Desktop App for OpenSCAD with Claude AI Integration

SynapsCAD is an open-source desktop application that combines an OpenSCAD code editor, real-time 3D viewport, and AI assistant. Built entirely in Rust with Bevy 0.15 and egui, it supports Claude API integration for natural language 3D CAD coding.

OpenClawRadar
Open-source MCP suite improves Claude Code generation quality by 15-20%
Tools

Open-source MCP suite improves Claude Code generation quality by 15-20%

An open-source MCP suite consisting of three local servers and a prompt skill addresses the 'bad token' problem in AI code generation, with one customer reporting 15-20% quality improvement for Claude Code.

OpenClawRadar