Sunday, July 26, 2026

tools to optimize AI usage: rtk, CodeGraph

How I Stopped Running out of Tokens · Daniela Baron

After hitting her organization's monthly spend limit while using Claude Code for daily engineering work, Daniela Baron established a setup to track, optimize, and drastically reduce her token consumption without sacrificing code quality or speed.


1. Monitoring Token Usage

  • Claude Desktop Usage Meter: Built-in settings window to keep an eye on official account usage limits.

  • Claude Code Usage Monitor: A live CLI tool that sits alongside terminal sessions to estimate current burn rates, cost, and estimated time before limits are hit.


2. Optimization Tools

  • rtk (Rust Token Killer)Saves Input Tokens: Acts as a proxy for CLI commands (like git log), compressing raw terminal output before it gets sent as input context to the model.

  • Caveman — Saves Output Tokens: A Claude Code plugin that strips filler, pleasantries, and hedging from AI responses, enforcing concise fragments, bullet points, and front-loaded file/line references.

  • CodeGraph — Saves Both: Maps the codebase into a local SQLite graph database so Claude can query relationships directly instead of grepping and reading large files.


3. Key Habits & Settings

  • Default to Sonnet with Opus as Advisor: Uses Sonnet for standard tasks and configures the /advisor feature to automatically delegate complex edge cases to Opus only when needed.

  • Audit CLAUDE.md: Replaced broad, auto-loaded @ file imports in the project's config with conditional triggers (e.g., "When asked about X, load Y"), sharply reducing ambient context size across the team.

  • Clear Context Frequently (/clear): Resets stateless conversation history between tasks so long chat histories aren't repeatedly resent as costly input tokens on every turn.

  • Scope Prompts & Check /context: Inspects active context regularly and strictly limits prompts to only the files relevant to the immediate task.

rtk-ai/rtk: CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies @GitHub


colbymchenry/codegraph: Pre-indexed code knowledge graph, auto syncs on code changes, for Claude Code, Codex, Gemini, Cursor, OpenCode, AntiGravity, Kiro, and Hermes Agent — fewer tokens, fewer tool calls, 100% local @GitHub

The fastest complete code graph · surgical context · built for how agents actually work · 100% local
**Kernel powered by Rust**




CodeGraph is a local-first code-intelligence tool. It parses your codebase with tree-sitter, stores every symbol, edge, and file in a local SQLite database, and exposes the result as a queryable knowledge graph — over the Model Context Protocol (MCP), a CLI, and a TypeScript library.

A local-first code-intelligence tool that turns any codebase into a queryable knowledge graph for AI coding agents.

Introduction - Tree-sitter

Tree-sitter is a parser generator tool and an incremental parsing library. It can build a concrete syntax tree for a source file and efficiently update the syntax tree as the source file is edited. 






No comments: