# Studio Plan A: Agent-Decided Evidence Grouping

## Summary

Make Key Evidence and Supporting Evidence explicit diagnosis conclusions written
by the agent after analysis. The UI must not infer Key Evidence from metric
category, severity, or evidence file type.

This plan only changes evidence grouping semantics. It does not change quick
links, Studio layout width, metric chart grouping, or Grafana link generation.

## Key Changes

- Extend the diagnosis report contract with agent-authored fields:
  - `analysis.key_evidence`
  - `analysis.supporting_evidence`
- Each evidence item should include stable reference fields:
  - `type`: `metric`, `query`, `log`, or `event`
  - `name` or `digest`
  - `instance` when applicable
  - `reason`
  - `link` when available
- Update the diagnosis skill instructions so the agent must choose Key Evidence
  only after completing diagnosis reasoning.
- Update `DiagnosisReport` to render Key Evidence and Supporting Evidence from
  the agent-authored fields.
- Preserve backward compatibility for old reports:
  - If `analysis.key_evidence` and `analysis.supporting_evidence` are absent,
    continue showing the existing metrics, queries, and logs tabs.
  - Do not auto-label any old evidence as Key Evidence.

## Test Plan

- Add a report fixture with `analysis.key_evidence` and
  `analysis.supporting_evidence`; verify the UI renders the two groups exactly
  as authored.
- Add a legacy report fixture without the new fields; verify the UI keeps the
  existing evidence tabs and does not show a Key Evidence group.
- Verify report hydration keeps agent-authored `analysis` fields and does not
  replace them with sidecar evidence.
- Manually inspect a diagnosis report where two metrics share the same category
  but only one is listed as Key Evidence.

## Assumptions

- Key Evidence is a diagnosis conclusion, not a property of collected data.
- Evidence collection scripts may provide candidate evidence and links, but they
  should not decide primary vs. supporting evidence.
