Commit 1ba339b
authored
Add Coach-inspired session quality scoring and insights (#645)
This PR adds session-quality measurement to `agentsview`. It turns archived sessions into inspectable quality signals: deterministic scoring for behavior that can be measured locally, plus opt-in generated recommendations that summarize those facts without becoming canonical score data.
The core goal is explainable review. Quality labels should be backed by stored signal counts, filtered evidence, score explanations, and session drilldowns so reviewers can decide whether the measurements are useful before treating them as calibrated defaults.
## Source Inspiration
This work was shaped by Microsoft's [AI Engineering Coach](https://github.com/microsoft/AI-Engineering-Coach), especially its [rule catalog](https://github.com/microsoft/AI-Engineering-Coach/tree/main/src/core/rules), [scoring detector](https://github.com/microsoft/AI-Engineering-Coach/blob/main/src/core/detectors/scoring.ts), [insights analyzer](https://github.com/microsoft/AI-Engineering-Coach/blob/main/src/core/analyzer-insights.ts), and [metric definitions](https://github.com/microsoft/AI-Engineering-Coach/tree/main/src/core/metrics).
The `agentsview` implementation adapts those ideas to a local, multi-agent session archive. Coach-inspired rules such as lazy prompting, missing file context, repeated prompts, missing spec structure, runaway loops, prompt maturity, premium-model waste, and sustainable-work-pattern signals were reviewed and then sorted into deterministic scoring, aggregate analytics, generated-insight inputs, already-covered behavior, or blocked future work depending on the data available in `agentsview`.
That distinction is intentional: this PR borrows the framing and rule inventory, but it does not make Copilot/VS Code-specific assumptions or use an LLM as the source of truth for score computation.
## What This Adds
- A documented mapping from Coach rules to `agentsview` signal families, including what is scoreable now, what belongs in analytics or generated insights, and what is blocked by missing metadata.
- Deterministic prompt/context/workflow heuristics for local session scoring, including short task starts, missing criteria, missing verification, repeated prompts, missing code context, and repeated failing tool cycles.
- Persisted quality signal counts across SQLite, PostgreSQL, DuckDB, service, sync, and generated frontend API surfaces without recreating the archive database.
- Analytics and Insights surfaces for quality pattern summaries, grade/calibration metadata, signal totals, filtered evidence drilldowns, and deep links back to affected sessions.
- An opt-in canned LLM insight path using fixed templates, deterministic aggregate payloads, validation, provenance, cache keys, and template versions. Generated prose stays separate from health scores and signal rows.
- Rollout documentation, golden score assertions, resync preservation checks, frontend coverage, and screenshots so reviewers can evaluate the model before final calibration.
## Important Boundaries
- LLMs do **not** perform canonical scoring. Session health remains deterministic and locally computable.
- Generated recommendations are opt-in, cached, provenance-bearing, and kept out of score/signal writes.
- Coach rules that require missing metadata, such as agent mode, plan mode, slash commands, approval mode, AI-generated LOC, review timing, or request cancellation, are documented but not scored.
- Timing and work-pattern ideas such as weekend or late-night activity remain analytics material, not session-quality penalties.
- Archive migrations remain additive. Existing session, orphaned, trashed, and saved insight data must be preserved.
## Screenshots



## Review Focus
- Whether the score-affecting heuristics are conservative enough and have acceptable false-positive behavior.
- Whether the scoring caps, grade deltas, and explanation fields are understandable enough for calibration.
- Whether the signal persistence/API contract is complete across SQLite, PostgreSQL, DuckDB, service, sync, and frontend clients.
- Whether the Insights page makes deterministic evidence easy to inspect before reading generated recommendation text.
- Whether generated insights are clearly bounded as optional summaries rather than a second source of scoring truth.
- Whether the rollout checklist is sufficient before enabling these semantics broadly on real archives.
## Remaining Rollout Work
Before treating this as final calibration, run a representative local archive pass and record score deltas, threshold crossings, false-positive themes, runtime impact, and source diversity. The added rollout document captures the expected report shape and the contract checklist for future signal/API changes.
Co-authored-by: Marius van Niekerk <mariusvniekerk@users.noreply.github.com>1 parent 8557423 commit 1ba339b
104 files changed
Lines changed: 11952 additions & 1456 deletions
File tree
- docs
- screenshots
- frontend
- e2e
- src/lib
- api
- generated
- models
- services
- types
- components
- analytics
- insights
- layout
- usage
- stores
- utils
- internal
- db
- duckdb
- insight
- postgres
- server
- service
- signals
- testdata
- sync
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Loading
Loading
Loading
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
0 commit comments