Knock Tool Cuts Claude Code Token Burn in Large Codebases

A new open-source tool called Knock launched today to address one of the most expensive problems facing developers using Claude Code: excessive token consumption during codebase exploration. Created by developer Hasan Gilani and released on GitHub, Knock optimizes how Claude Code navigates large repositories, preventing the AI assistant from burning through API credits on redundant file reads and context-building operations.
The Token Burn Problem
Claude Code's intelligent exploration capabilities come with a hidden cost. When analyzing large codebases, the assistant often reads multiple files, traces dependencies, and builds extensive context windows to understand project structure. For enterprise repositories with thousands of files, this exploratory behavior can consume 50,000 to 200,000 tokens in a single session, translating to significant API charges for teams running dozens of queries daily.
Knock intercepts these operations and applies smart filtering logic. The tool maintains a cached understanding of repository structure, feeds Claude Code only relevant file segments, and skips redundant reads. Early testing shows token reductions of 40-70% on typical navigation tasks without sacrificing code comprehension quality.
How Knock Works
The tool operates as a middleware layer between developers and Claude Code. When a user initiates a codebase query, Knock analyzes the intent, identifies the minimal file set needed to answer the question, and constructs an optimized context payload. Key features include:
- Intelligent file filtering based on query semantics and dependency graphs
- Incremental context loading that adds files only when Claude explicitly requests them
- Session-level caching that prevents re-reading unchanged files across multiple interactions
- Customizable exploration budgets that cap token usage per query
The system is designed to be transparent. Developers see real-time token savings metrics and can adjust aggressiveness levels based on their accuracy versus cost tradeoffs.
Release Date and Availability
Knock officially launched on November 2, 2026, and is available now as an open-source project on GitHub. The initial release supports Python, JavaScript, TypeScript, and Go codebases, with planned expansions to Rust and Java repositories in Q1 2027. Installation requires Node.js 18 or higher and works with both the official Claude Code API and self-hosted instances.
The project has already attracted attention on Hacker News, where developers shared early success stories of cutting monthly API bills by 30-50% on teams heavily reliant on Claude Code for legacy codebase maintenance.
Integration and Setup
Getting started with Knock takes under five minutes. Developers clone the repository, configure their Claude API credentials, and point the tool at their target codebase. The system automatically builds an initial index, which typically completes in 2-10 minutes depending on repository size. From there, Knock runs as a local proxy server that developers query instead of hitting Claude Code directly.
Advanced users can customize filtering rules using a YAML configuration file. Options include whitelisting critical directories, blacklisting test fixtures and generated code, and setting per-file token budgets for especially large modules.
What This Means
Knock addresses a growing pain point as AI coding assistants move from novelty to mission-critical infrastructure. For teams spending $500-$2,000 monthly on Claude Code API usage, a 50% token reduction translates to meaningful budget relief. More importantly, the tool enables developers to use Claude Code more freely on large codebases without anxiety about runaway costs. The open-source release also signals a maturing ecosystem around AI coding tools, where third-party optimization layers become essential infrastructure for cost-effective deployment at scale.
on Emergent today





