Skip to content

Feature release candidate v0.5.6#54

Closed
fajarhide wants to merge 4 commits intomainfrom
feat/ver0.5.6
Closed

Feature release candidate v0.5.6#54
fajarhide wants to merge 4 commits intomainfrom
feat/ver0.5.6

Conversation

@fajarhide
Copy link
Copy Markdown
Owner

@fajarhide fajarhide commented Apr 10, 2026

PR Auto Describe

Summary

This PR adds Claude Code spending analytics, filter coverage tracking, and CLI refinements for OMNI. It introduces new commands to view filter health, calculate AI savings, and refactors the learn CLI for better usability.


Key Changes

  • ccusage-based analytics stack with 15-minute disk caching and graceful degradation
  • New omni learn coverage command for filter performance reporting
  • omni stats --economics flag for cross-period cost/savings analysis
  • Refactored omni learn to use standardized subcommands
  • SQLite-backed filter coverage querying and test suite

Detailed Breakdown

  1. Analytics Core:
    Added src/analytics/ccusage.rs: wraps the ccusage npm CLI, caches results at ~/.omni/ccusage_cache.json, supports fallback pricing for missing/uninitialized ccusage. Defines typed metrics (CcusageMetrics) and period economics (PeriodEconomics), plus weighted cost-per-token calculation helpers, with full test coverage.
  2. CLI Updates:
    New src/cli/coverage.rs implements omni learn coverage with human/JSON output, categorizing commands into filter coverage tiers. Refactored src/cli/learn.rs to use subcommands (coverage, discover, apply, verify) instead of legacy flags, updated help text. Expanded src/cli/stats.rs with --economics flag to show cross-period savings, AI spending, and ROI. Registered the coverage CLI module in src/cli/mod.rs.
  3. Data Layer:
    Added CoverageRecord type and coverage_analysis() SQL query to src/store/sqlite.rs to aggregate filter performance across sessions, plus a dedicated test suite for coverage logic.
  4. Supporting Code:
    Exposed the analytics module in src/lib.rs and src/main.rs, plus added a format_token_count helper in src/cli/stats.rs for readable token formatting.

Notes

  • Requires global ccusage npm package for full dollar cost reporting; falls back to OMNI-only savings data when missing
  • 15-minute cache TTL to avoid excessive subprocess calls to ccusage
  • Filter categorization thresholds: >70% token reduction = Excellent, ≤70% with ≥3 calls = Poor, Unknown content type with ≥2 calls = highest priority for new filters

Breaking Changes

  • omni learn now uses subcommands instead of legacy flags:
    • --statusomni learn discover
    • --applyomni learn apply
    • --verifyomni learn verify
    • Legacy flag-based invocations will no longer function correctly.

Last updated: 2026-04-12 00:26:11

@fajarhide fajarhide closed this Apr 12, 2026
@fajarhide fajarhide deleted the feat/ver0.5.6 branch May 5, 2026 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant