Skip to content

Agent UX: Confidence scores, delta output, and dependency graph between findings #5

@Wolfvin

Description

@Wolfvin

Summary

Feedback from testing CodeLens as an AI agent tool. These suggestions aim to make CodeLens more actionable and reliable for agent workflows.


1. Confidence Score per Finding

Some detections (especially dead code) can produce false positives. If each finding included a confidence field (e.g. confidence: 0.87), agents could filter actionable findings vs. ones that need human review — without discarding everything.

Suggested output shape:

{
  "file": "scripts/deadcode_engine.py",
  "line": 182,
  "type": "unreachable",
  "confidence": 0.91,
  "severity": "medium"
}

2. Delta Output (Diff-Aware Reporting)

Agents benefit more from what changed since last scan than a full dump every time. Something like:

"Compared to previous snapshot: 3 new dead code findings, 1 new secret, complexity increased in callgraph_engine.py"

The diff command seems to be heading this direction — but exposing it as a first-class --since-last flag on all commands would make it much more agent-friendly.


3. Dependency Graph Between Findings

Currently findings are reported in isolation. But an agent would prioritize much better if findings were linked:

function A → is complex (CC=86) + has dead code + is called from 12 places

A cross-finding correlation layer (even just as an optional --correlate flag) would let agents make smarter decisions about what to fix first.


4. Error Handling: Agent-Friendly Partial Failures

If a scan fails on 1 file, the agent needs structured feedback like:

{ "skipped": ["file_x.py"], "reason": "parse error", "rest": "ok" }

Rather than a silent fail or raw exception — both of which break agent pipelines.


5. Output Schema Versioning

For agents that consume JSON output downstream, breaking schema changes across versions are painful. Suggest adding a schema_version field to all JSON outputs from now, so consumers can handle migrations gracefully.

{ "schema_version": "8.1", "findings": [...] }

Context

Tested on CodeLens own repo (scan, complexity, secrets, dead-code). The core concept — pre-indexed codebase map before agent writes anything — is exactly right. These suggestions are to sharpen the agent-facing UX.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions