Architecture of microsoft/tokeneconomizer
microsoft/tokeneconomizer is 216 source files holding 3,388 symbols across 6 modules, written mainly in Python, Shell, TypeScript. The largest module is experiments, with 69 files, and 2 files are entry points into the dependency graph.
How tokeneconomizer fits together
Input enters through the plugin's hooks, which the host coding agent fires during a session. The plugin/hooks/hooks.json file registers those hooks, and tokeneconomizer/plugin/cli.py provides the plugin's commands. The tokeneconomizer package holds the core logic: it decides when a coding agent has stopped making progress and prices what each run spends on tokens. The plugin calls into this package for each tool call. The scripts/build_plugin.py script turns the source tree into a folder that can be installed as a plugin, and the experiments directory runs coding agents on benchmarks to measure what each configuration costs.
Largest modules
- experiments: 69 files and 15,048 lines of code
- tokeneconomizer: 59 files and 13,145 lines of code
- tests: 35 files and 8,876 lines of code
- plugin: 4 files and 997 lines of code
- docs: 3 files and 1,100 lines of code
- scripts: 1 file and 61 lines of code
Languages
By file count: Python 163 files, Shell 5 files, TypeScript 2 files, JavaScript 1 file.
Documentation
Repowise documents tokeneconomizer in 226 pages generated from the source, 14 of them written explanations of the repository and its modules. Module guides include:
- tokeneconomizer/trace: Agent Trace Capture
- experiments/te_bench: Benchmark Arms and Facade
- experiments/te_bench/baselines: Benchmark Dataset Adapters
- experiments: Experiments
- experiments/te_harness: Harness Capture and Network Guards
More on tokeneconomizer: summary and FAQ, codebase overview, code health.