Status: done
Priority: medium
Complexity: medium
usage_backends.py and commands.py import from cli.py via lazy imports to work around a circular dependency:
# usage_backends.py:187, 221
from ai_agents_metrics import cli as cli_module
cli_module.resolve_claude_usage_window(...)
cli_module.resolve_codex_usage_window(...)
# commands.py:1012
from ai_agents_metrics.cli import PRICING_JSON_PATH, load_pricing
These symbols (resolve_claude_usage_window, resolve_codex_usage_window, PRICING_JSON_PATH, load_pricing) live in cli.py but semantically belong in usage_backends.py or a dedicated usage_resolution.py module. The lazy import is a workaround, not a design.
The circular dependency also prevents adding an import-linter contract that enforces usage_backends as a lower layer than cli.
cli.py into usage_backends.py or a new usage_resolution.py modulecli imports in usage_backends.py and commands.pyusage_backends must not import from clicli.py that usage_backends.py and commands.py callusage_backends.py (preferred, since they are backend-specific) or a new usage_resolution.pycli.py to call the moved functions insteadusage_backends.py and commands.py with normal top-level importsai_agents_metrics.usage_backends must not import ai_agents_metrics.clicli imports remain in usage_backends.py or commands.pymake verify passes without regressionsusage_backends must not import cliPRICING_JSON_PATH and load_pricing live outside cli.py (in usage_resolution.py)