Skip to content

feat: add --explain-score flag to show score breakdown#96

Open
kai-agent-free wants to merge 3 commits into
guard0-ai:mainfrom
kai-agent-free:feat/explain-score
Open

feat: add --explain-score flag to show score breakdown#96
kai-agent-free wants to merge 3 commits into
guard0-ai:mainfrom
kai-agent-free:feat/explain-score

Conversation

@kai-agent-free
Copy link
Copy Markdown

Closes #86

Adds --explain-score flag to g0 scan that shows a detailed breakdown of how the security score is calculated.

Changes:

  • src/cli/commands/scan.ts: Added --explain-score option and explainScore to options type
  • src/reporters/terminal.ts: Added score breakdown table rendering with per-domain weights, scores, weighted contributions, and top improvement suggestions
  • tests/unit/explain-score.test.ts: 4 tests covering breakdown display, top improvements, and opt-in behavior

Example output:

Score Breakdown
──────────────────────────────────────────────────────────────────────────
Domain                  Weight   Score  Weighted
──────────────────────────────────────────────────────────────────────────
Goal Integrity             10%      90       9.2
Tool Safety                10%      60       6.1
...
──────────────────────────────────────────────────────────────────────────
Total                     100%                85

Top Improvements
──────────────────────────────────────────────────────────────────────────
1. Fix 3 finding(s) in Tool Safety → up to +4 points
2. Fix 2 finding(s) in Rogue Agent → up to +4 points
3. Fix 2 finding(s) in Inter-Agent → up to +2 points

- g0 rules list: table of all rules (ID, Domain, Severity, Title)
- g0 rules list --domain X --severity Y --search 'text': filtering
- g0 rules describe <id>: detailed view with standards, description
- Both commands support --json and --rules-dir options
- 10 unit tests

Closes guard0-ai#84
Adds a new --explain-score CLI flag that displays:
- Per-domain score breakdown table (score, weight, weighted contribution, %)
- Top 3 improvement suggestions based on lowest-scoring domains
- Potential overall score gain for each improvement

Closes guard0-ai#86
Adds a new --explain-score CLI flag that displays:
- Per-domain score breakdown table (score, weight, weighted contribution, %)
- Top 3 improvement suggestions based on lowest-scoring domains
- Potential overall score gain for each improvement

Closes guard0-ai#86
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.

Add --explain-score flag to show score breakdown

1 participant