Friction insights in HTML report: surface repeat-prompt patterns + suggest fixes #20
Labels
No labels
enhancement
observability
research
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jbr870/claude-permit#20
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Add a "friction insights" view to
claude-permit report --htmlthat surfaces patterns where the user keeps being asked to approve the same (or similar) tool calls — and flags candidates for promotion, denial, or system-bug investigation.Origin
This issue exists because of a real incident: a bug prevented
auto-rules.tomlfrom loading, which silently caused the user to re-approve the same kinds of permissions over and over. The bug was only caught because the friction became unbearable. A litmus test for this issue: would this report have surfaced that bug earlier? That's an acceptance criterion below, not a nice-to-have.The current report (#10) shows the rules and config that exist. It does not show which patterns the user actually struggles with. This issue closes that gap.
User Stories
Proposed v1 View
A new "Friction" section in the HTML report: one ranked, sortable table.
Columns:
Default sort: hits in 7d, descending.
Heuristic Flags (always on, no LLM)
These are deterministic and run on every report generation:
📈 promote candidate🛑 deny candidate⚠️ stuckauto-rules.tomlmatches🔁 over-askedaskruleThresholds (
N) configurable viaconfig.toml, with sensible defaults.LLM-Augmented Suggestions (optional, behind
--llmflag)When
claude-permit report --html --llmis used, the report additionally invokesclaude --print --model haikuonce with the friction list as context. The LLM produces, per flagged row:config.toml)The report falls back gracefully if the LLM call fails or
--llmisn't passed — heuristic flags still work.Pattern Grouping (v1)
(tool_name, exact tool_input string). Safest, slightly noisy.⚠️ stuckshould match by would-this-rule-have-fired logic againstauto-rules.toml, not by string equality, so cosmetic differences in inputs don't hide the bug.Acceptance Criteria
⚠️ stuckflag would have flagged the original auto-rules-loading bug (replay an audit log from that period; the bug-affected patterns must surface). If we can't replay, hand-construct an audit fixture that mimics the failure mode.--llm, at least one row gets a concrete TOML suggestion in the rendered output.--llm, the report renders fully and deterministically (snapshot-testable).config.toml; defaults documented.Out of Scope
Relationship to Other Issues
statssubcommand → folded into report): kept as a sibling, not superseded. #1 owns the pure descriptive stats (latency, hit counts, totals, trends) — neutral data. This issue owns the opinionated friction view (flags, candidates, suggestions). Both render into the same HTML report as separate sections.Open Questions
policy.mdso it doesn't propose rules that violate the safety policy?auto-rules.tomlcarrylast_matched_atmetadata so we can also flag dormant auto-rules in this same view? (Adjacent to #3 — "enrich auto-rules.toml with provenance metadata.")