Skip to content

Add compaction events display to CLI #8

@roeimichael

Description

@roeimichael

Problem

CAT has a full compaction_events table and a /api/compactions endpoint, but no CLI command to view compactions and no dashboard panel showing them. Compactions are critical events where the context window is reset — users need visibility into how often this happens and how many tokens are recovered.

What to do

Add a compactions CLI command to src/context_analyzer_tool/cli.py that:

  1. Hits the existing /api/compactions endpoint
  2. Renders a Rich table with columns: Time, Session, Trigger, Tokens Before, Tokens After, Tokens Saved

Files to look at

  • src/context_analyzer_tool/collector/routes.py — the /api/compactions endpoint already exists
  • src/context_analyzer_tool/cli.py — follow the pattern of anomalies command
  • src/context_analyzer_tool/db/compaction.py — DB layer (already done)

Why this is a good first issue

The backend is 100% done. This is purely a presentation task — call an existing API and format the response. Great for learning the CLI → API pattern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions