Show HN: Badge that shows how well your codebase fits in an LLM's context window

Published: (February 27, 2026 at 10:14 AM EST)
1 min read

Source: Hacker News

Overview

Small codebases have always been advantageous, and with coding agents the benefit is amplified: an agent can hold the entire codebase in its context window. Repo Tokens is a GitHub Action that counts your codebase’s size in tokens (using tiktoken) and updates a badge in your README.

The badge color reflects the percentage of an LLM’s context window that the codebase occupies:

  • Green – under 30 %
  • Yellow – 50–70 %
  • Red – 70 %+

The context‑window size is configurable and defaults to 200 k tokens (the size of Claude models).

How it works

  • It’s a composite action that installs tiktoken, runs ~60 lines of inline Python, and finishes in about 10 seconds.
  • The action updates the README badge but does not commit the change; your workflow can decide the git strategy.

Goal

The idea is to make token size a visible metric, similar to bundle‑size badges for JavaScript libraries, encouraging developers to keep codebases lean and agent‑friendly.

Repository

Details about the repository can be added here.

Comments

Add any relevant comments or discussion points here.

0 views
Back to Blog

Related posts

Read more »