AI Optimizer is a cross-platform auditing and optimization tool for AI coding agents that helps developers track token usage, analyze costs, measure real savings, and improve code quality.
By combining real-time token and cost auditing with software engineering best practices (strict YAGNI, surgical diffs, stdlib-first solutions, and prompt-cache maximization), AI Optimizer helps coding agents generate cleaner, more maintainable, and more efficient code while slashing token waste and LLM API costs by 30% to 53%.
Optimize your AI workflows. Reduce unnecessary token consumption. Cut costs. Write better code.
π Official Website: optimizer.aimaxo.com
Important
π 100% Offline & Private by Design
AI Optimizer runs entirely on your local machine. Every token count, usage metric, and dollar estimate is read directly from your local filesystem logs (~/.gemini, ~/.codex, ~/.claude). Zero network calls, zero remote servers, zero external data tracking, and zero code or prompts ever leave your computer.
AI Optimizer aims to make AI-assisted software development not just more powerful, but also more economical, private, and engineering-focused β helping developers get better results from their AI coding assistants without wasting tokens or compromising code quality.
- π Token Usage Auditing β Track and analyze real token consumption (input, output, and cache reads) across supported AI coding agents.
- π° Real-Time Cost Analysis β Understand AI usage costs per model and identify opportunities to reduce spending.
- β‘ Savings Insights β Discover and verify token and cost savings achieved through context compression, prompt caching, and surgical diffs.
- π οΈ Code Quality Optimization β Encourage cleaner, more maintainable code using established software development best practices (stdlib-first, modular design, zero speculative abstractions).
- π Token-Efficient Code Generation β Cut conversational filler, duplication, and inefficient implementation patterns so coding agents achieve more with fewer tokens.
- π₯οΈ Native macOS Menu Bar Companion β Ultra-lightweight status bar monitor displaying live intensity (
lite,full,ultra), active agent status, and token velocity in a sleek Obsidian dark popover dashboard. - π‘οΈ Truth-First Deduplication β Canonical summary event parsing (
token_usage_record) with turn-by-turn fallback prevents artificial double-counting of prompt tokens. - π 100% Local & Private β Runs entirely offline on your local machine. Zero external network connections, zero cloud analytics, zero data leakage.
- β‘ Strict Low-Thermal & Zero-CPU Footprint β Maintains near-zero (< 0.1%) idle CPU utilization and sub-25ms response times with visibility-driven execution, preventing laptop battery drain or thermal fan spikes.
- π‘οΈ Enterprise Long-Horizon Harness β Autonomous execution in isolated Git sandbox bundles with pre-dispatch liability caps, fail-closed quality gates (automatic test & config tampering pruning), and two-phase candidate promotion.
- π Cryptographic Entitlements & Local Activation β Authentic Ed25519 signature verification ensures full enterprise capabilities and local activation privacy without external network phone-homes.
- π¦ Programmatic TypeScript SDK (@airshell/ai-optimizer) β Type-safe SDK contracts enabling developers to integrate context compression, token accounting, and supervised harnesses into custom agent workflows.
The Live Overview serves as your central command deck for real-time AI usage and optimization:
- Live Intensity Switcher: One-click toggles between
lite,full, andultraoptimization tiers to adapt token compression depth dynamically across your active projects. - Real-Time Savings Counters: High-visibility metrics track cumulative tokens saved, carbon emissions avoided (via EcoLogits models), and net dollar savings calculated against standard un-optimized baseline usage.
- Spend Summary: Transparent breakdown comparing actual net spend vs. calculated baseline spend across your models.
- Active Agent Monitor: Automatic filesystem discovery for installed tools (Google Antigravity, OpenAI Codex, Claude Code, RTK Proxy, and more) with per-agent toggle switches to activate or pause optimization on the fly.
- Instant Period Filtering: Switch effortlessly between
Today,This month, andAll timeto inspect short-term velocity or lifetime impact.
The Efficiency & Resource Analytics screen gives you deep, transparent visibility into your model usage and token economics:
- Daily Token Velocity Chart: Visual histogram of day-by-day output token volume over the selected billing cycle, helping you identify usage spikes and model workload trends.
- Per-Agent Breakdown Ledger: Multi-column accounting table showing exact session counts, output tokens, input prompt tokens, and cache-read tokens for each installed AI assistant.
- Prompt Cache Efficiency: Dedicated accounting for cache-read tokens, verifying cost reductions achieved through high cache-hit rates.
- Environmental & Financial ROI: Accurate carbon impact calculations and dollar savings per tool derived directly from official model rate cards.
- 100% Local Proof: Every figure is computed directly from your local filesystem logs (
~/.gemini,~/.codex,~/.claude) without sending data or prompts over the internet.
Install the native macOS Menu Bar app in one command using the official Airshell tap:
brew install --cask airshell/tap/ai-optimizerTo update to future releases:
brew upgrade --cask ai-optimizerRun the automated installer script to download the disk image and clear Gatekeeper:
curl -fsSL https://raw.githubusercontent.com/airshell/ai-optimizer/main/install.sh | bashDownload the disk image directly from our GitHub Releases:
π Download AI Optimizer for macOS (.dmg)
Drag AiOptimizer.app to your /Applications folder, then launch it from Spotlight.
macOS Note: If opening an ad-hoc signed release, run
xattr -cr /Applications/AiOptimizer.appto clear the Gatekeeper quarantine attribute.
AI Optimizer provides native, zero-mock filesystem and transcript parsers for:
- Google Antigravity (
agy& Antigravity IDE) - OpenAI Codex (CLI & IDE extension)
- Anthropic Claude Code
- RTK Proxy & Ponytail
- OpenCode, Gemini CLI, Cursor, Windsurf & Cline
The open-source optimization skill is located at skills/ai-optimizer/SKILL.md. It provides autonomous instructions that instruct coding assistants to produce minimal, high-leverage code and maximize prompt caching.
Symlink or copy the skill into your local agent skills directory:
mkdir -p ~/.gemini/config/skills
cp -R skills/ai-optimizer ~/.gemini/config/skills/mkdir -p ~/.claude/skills
cp -R skills/ai-optimizer ~/.claude/skills/Add a reference to skills/ai-optimizer/SKILL.md in your workspace rules (.cursorrules or AGENTS.md):
# AI Optimizer Rule
Adopt the AI Optimizer full tier: enforce YAGNI architecture, surgical diffs, stdlib-first solutions, and prompt-cache friendly turn handoffs.| Level | Token Reduction | Behavior |
|---|---|---|
lite |
~20% β 30% | Cuts conversational filler, pleasantries, and unsolicited summaries while keeping standard code structures. |
full (Default) |
~35% β 50% | Strict YAGNI, standard library first, surgical non-contiguous diffs, and compressed agent-to-agent context handoffs. |
ultra |
~50% β 65%+ | Maximum token compression: one-line explanations, pure code diffs, zero speculative abstractions, minimal AST expansion. |
To help you get the most out of AI Optimizer, we have curated and battle-tested the most impactful companion skills designed to eliminate token waste:
| Skill | Primary Benefit | Why It Saves Tokens & Money |
|---|---|---|
context-budget |
Context Window Auditor | Scans active rules, skills, MCP servers, and prompt files to identify context bloat and reclaim valuable token headroom. |
token-budget-advisor |
Upfront Depth Controller | Classifies request complexity and gives you control over response verbosity before the agent starts generating code. |
prompt-optimizer |
Prompt Compactor | Refines raw prompts into surgical, high-signal instructions that maximize prompt-cache hit rates (up to 90%+). |
regex-vs-llm |
Zero-Token Text Extractor | Uses fast, deterministic regular expressions for 95%+ of structured text tasks, saving LLM calls strictly for edge cases. |
cost-tracking |
Session Spend Breakdown | Provides granular per-session cost and model accounting from local session logs without external API dependencies. |
opt-review |
Diff & Bloat Pruner | Inspects code diffs specifically for what can be deleted (speculative code, single-caller abstractions, comment clutter) before merging. |
opt-compress |
Rule & Instruction Compactor | Rewrites project instructions and AGENTS.md files into high-signal declarative bullets, saving input tokens on every turn. |
opt-loop |
Loop & Cron Budget Control | Enforces prompt-cache pacing (<270s or β₯1200s, avoiding the 300s dead zone), event triggers, and hard exit stops for recurring tasks. |
opt-design |
Lean UI Engineering | Delivers pixel-perfect HTML/CSS with ~50% fewer code tokens via fluid units and modern CSS custom properties without div-soup bloat. |
opt-memory |
Committed Architecture Cache | Maintains a single version-controlled PROJECT.md caching architecture intent and build commands to eliminate cold-start rediscovery. |
opt-debt |
YAGNI Shortcut Ledger | Scans for deliberate YAGNI comments (shortcut:, opt:) and compiles an actionable debt ledger with revisit triggers. |
AI Optimizer includes a production-grade Long-Horizon Harness and programmatic TypeScript SDK designed for autonomous agent workflows:
- Pre-Dispatch Liability Caps: Intercepts model tool calls before transmission, enforcing strict hard budget ceilings so runaway agent loops can never overspend your budget.
- Transactional Git Sandboxes: Agent workers execute within isolated Git bundle mirrors. If a run fails or tests break, your working tree remains pristine.
- Fail-Closed Quality Gate: Automatically prunes unauthorized test modifications, dependency insertions, or configuration mutations created by errant agents.
- Two-Phase Candidate Promotion: Changes are only merged into your primary branch after all tests pass cleanly and human/CI approval gates clear.
- Durable CRC32 Framing Ledger: Every agent step, tool invocation, and token expenditure is recorded in an fsync-flushed binary ledger resilient to power cuts and process aborts.
- Programmatic TypeScript SDK: Full typings in
sdk/index.d.tsfor integrating agent supervision into your Node.js or TypeScript stacks.
This repository uses a Mixed Licensing Model (LICENSE):
- The agent skill definitions (
skills/) and installer scripts (install.sh) are licensed under the MIT License. - Free to use, adapt, and integrate into any personal or open-source workflow.
- The AI Optimizer Application, binary packages, desktop companions, and core optimization engine are licensed under the Business Source License 1.1 (BSL-1.1) (converting to GNU AGPLv3 after 4 years).
- Personal Use: Free for personal, non-commercial use, provided you do not use it to build, distribute, or operate a competing product or commercial hosted service.
- Commercial & Enterprise Use: Any commercial use by enterprises, companies, or organizations (including deployment across employee developer fleets or server-side CI/CD runners) requires a commercial license agreement from Licensor.
For enterprise licensing arrangements, custom use grants, or cloud integrations:
π§ Contact: info@aimaxo.com or visit optimizer.aimaxo.com.
Developed with precision by Airshell β’ Official Website: optimizer.aimaxo.com.

