Add stats subcommand #1

Open
opened 2026-04-09 13:37:48 +00:00 by jbr870 · 2 comments
Owner

Summary

Adds an audit-log-driven Stats section to the claude-permit report --html subcommand. Turns audit.jsonl into aggregates — session scorecards, trends, hit counts, LLM latency — rendered alongside the rules inventory built in #10.

Note: originally filed as claude-permit stats. Renamed to report --html so a single subcommand can host multiple sections (inventory, stats, future additions) without a later command rename.

Precursor

#10 — establishes the claude-permit report --html subcommand and the v1 HTML shell (header strip + rules tables, no audit data). This issue is the follow-up that layers audit-log-driven sections on top of that shell.

User Stories Served

  • US-1: Session scorecard (how many prompts saved)
  • US-2: Session summary (total calls, auto-approved, prompted, denied)
  • US-3: Trends over time (are prompts decreasing as auto-rules accumulate?)
  • US-8: LLM latency percentiles
  • US-9: Passthrough ratio (are rules stale?)
  • US-10: Rule hit counts (which rules do heavy lifting?) — needs #2 for stable rule identity
  • US-13: Tool type breakdown
  • US-14: Most frequent commands/paths
  • US-15: Session comparison

Suggested Capabilities

Rendered as sections within the HTML report from #10:

  • Overall summary (all time or last N days)
  • Per-session scorecards
  • Time-windowed aggregation (e.g. last 7 days)
  • Hit counts per rule (depends on #2)
  • Tool and command frequency tables
  • LLM latency percentiles

CLI flags to filter what the report includes:

  • --since 7d — time window
  • --session <id> — single-session focus
  • --json — machine-readable alternative to HTML (optional)

Context

See wiki: Data Capture Analysis — "Structural Issues §3: No aggregation layer"

The raw data in audit.jsonl is comprehensive. The gap is purely in consumption — no code reads the log today except the /audit skill doing manual jq-style filtering.

## Summary Adds an audit-log-driven **Stats section** to the `claude-permit report --html` subcommand. Turns `audit.jsonl` into aggregates — session scorecards, trends, hit counts, LLM latency — rendered alongside the rules inventory built in #10. > **Note:** originally filed as `claude-permit stats`. Renamed to `report --html` so a single subcommand can host multiple sections (inventory, stats, future additions) without a later command rename. ## Precursor **#10** — establishes the `claude-permit report --html` subcommand and the v1 HTML shell (header strip + rules tables, no audit data). This issue is the follow-up that layers audit-log-driven sections on top of that shell. ## User Stories Served - **US-1:** Session scorecard (how many prompts saved) - **US-2:** Session summary (total calls, auto-approved, prompted, denied) - **US-3:** Trends over time (are prompts decreasing as auto-rules accumulate?) - **US-8:** LLM latency percentiles - **US-9:** Passthrough ratio (are rules stale?) - **US-10:** Rule hit counts (which rules do heavy lifting?) — needs #2 for stable rule identity - **US-13:** Tool type breakdown - **US-14:** Most frequent commands/paths - **US-15:** Session comparison ## Suggested Capabilities Rendered as sections within the HTML report from #10: - Overall summary (all time or last N days) - Per-session scorecards - Time-windowed aggregation (e.g. last 7 days) - Hit counts per rule (depends on #2) - Tool and command frequency tables - LLM latency percentiles CLI flags to filter what the report includes: - `--since 7d` — time window - `--session <id>` — single-session focus - `--json` — machine-readable alternative to HTML (optional) ## Context See wiki: [Data Capture Analysis](https://git.wihslon.com/jbr870/claude-permit/wiki/product%2Fdata-capture-analysis) — "Structural Issues §3: No aggregation layer" The raw data in `audit.jsonl` is comprehensive. The gap is purely in consumption — no code reads the log today except the `/audit` skill doing manual jq-style filtering.
Author
Owner

Related: #9audit subcommand for rule review-and-promote workflow. Overlaps on the audit-log parsing layer; if this ships first, #9 can build on the shared parsing code rather than duplicating it.

Related: #9 — `audit` subcommand for rule review-and-promote workflow. Overlaps on the audit-log parsing layer; if this ships first, #9 can build on the shared parsing code rather than duplicating it.
Author
Owner

Sibling issue filed: #20 (friction insights). Split: this issue (#1) owns the pure descriptive stats (latency, hit counts, totals, trends — neutral data); #20 owns the opinionated friction view (promote/deny/stuck flags, suggestions). Both render as separate sections in the same HTML report.

Sibling issue filed: #20 (friction insights). Split: this issue (#1) owns the *pure descriptive* stats (latency, hit counts, totals, trends — neutral data); #20 owns the *opinionated* friction view (promote/deny/stuck flags, suggestions). Both render as separate sections in the same HTML report.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jbr870/claude-permit#1
No description provided.