Token Optimizer is an open-source agent plugin and context optimization harness developed by Alex Greenshpun (alexgreensh). Designed to integrate directly with terminal-based coding agents such as Codex CLI and Claude CLI, the project provides lifecycle hooks and modular skills aimed at minimizing token consumption and preventing context window bloat during complex software engineering tasks. In daily use, Token Optimizer operates as an extension inside host agent runtimes. It attaches custom skills and hook scripts to the agent's command loop, allowing developers to filter unnecessary file content, optimize prompt sizes, and automate context-clearing routines without disrupting existing CLI workflows. It interfaces cleanly with agent marketplace manifests and local hook runtimes. What differentiates Token Optimizer from generic token counters or prompt wrappers is its architecture as a multi-runtime plugin harness. It natively supports both Codex CLI and Claude plugin structures, incorporating preflight verification, hook diagnostics (such as codex_doctor.py), and mirror synchronization to ensure consistent skill execution across developer environments. The project is available as open-source software on GitHub with public development and community funding via GitHub Sponsors and Ko-fi.
Tags: AI, cli, developer tools, OpenSource, productivity, prompts
codex-cli with standardized directory manifests. - Claude Plugin Compatibility — Provides structured .claude-plugin hooks and skills ready for terminal-based Claude agent environments. - Lifecycle Hook Runtime — Injects pre- and post-execution hooks into the agent pipeline to optimize context and clean prompt payloads. - Diagnostic and Doctor Tooling — Ships with utility scripts like codex_doctor.py and codex_install.py to verify hook resolution and dependency paths. - Skill Synchronization & Integrity — Includes automated scripts to prevent skill drift between root manifests and platform-specific plugin distributions.codex-cli install the harness via marketplace configurations to attach custom token-trimming skills and automated hooks into their standard terminal coding sessions.Token Optimizer is designed for software developers and AI engineers using terminal-based coding agents like Codex CLI or Claude CLI who want granular control over token usage and agent lifecycle hooks. It is not intended for non-technical users or developers looking for a standalone graphical IDE.
bash # Add the marketplace repository codex marketplace add https://github.com/alexgreensh/token-optimizer # Install the plugin codex plugin add token-optimizer Alternatively, clone the repository directly for manual development or custom hook integration: bash git clone https://github.com/alexgreensh/token-optimizer.git cd token-optimizerbash python3 scripts/codex_doctor.pybash codex plugin list Run your regular agent commands; Token Optimizer's hooks will automatically monitor and optimize context during multi-turn edits.Part of CLI Coding Agents
Categories: AI Coding Agents, Developer Tools, Productivity, Prompts