Rework evidence agent into structured assessor

Draft
SA
4mo ago
+1593-420

Replace the free-text evidence describer with an assessor that emits a structured assessment (status plus rationale) so downstream code can act on the verdict instead of parsing prose.

Rename the evidencedescriber package and worker to evidenceassessor and introduce a dedicated EvidenceAssessment coredata model backed by an assessment status enum. Split the schema changes into focused migrations and scope the FAILED transition to the status columns so unrelated evidence fields are left untouched.

Realign the surrounding configuration and wiring: rename the config to EvidenceAssessmentConfig, update probod aliases and builders, add a Thinking budget to the LLM agent config, and extract an OutputType.DecorateEnum helper. Bind jsonRawMessageOrNull through driver.Valuer so raw JSON assessments persist cleanly.


Summary by cubic

Replaces the free‑text evidence describer with a structured assessor that stores a JSON assessment (status + attempts) and exposes it across GraphQL, MCP, CLI, console, and packages/n8n-node. Drops the YAML/JSON dual-read fallback for the old key; configs must use evidence‑assessor, while env var fallbacks still work.

Coredata +497 -231

  • Added assessment JSONB, assessment_status enum, and assessment_attempts; renamed processing columns; switched to EvidenceFileID.
  • New helpers: SetAssessment/GetAssessment, MarkAssessmentProcessing, SetAssessmentCompleted, SetAssessmentOutcome; stale reset; updates scoped to assessment fields.
  • Implemented driver.Valuer for JSONB; focused migrations.

Service +467 -135

  • New pkg/evidenceassessor with validated JSON output; OutputType.DecorateEnum enforces confidence; derives Description from Summary.
  • Worker reworked to assessment with stale recovery and attempt‑budgeted retries; safe updates touch only assessment fields.
  • Bootstrap reads PROBOD_AGENT_EVIDENCE_ASSESSOR_* with legacy env fallbacks; added optional Thinking tokens; removed YAML/JSON dual‑read for legacy evidence-describer keys.
  • Anthropic provider omits temperature when Thinking is enabled; probod wires the new worker and services migrate to EvidenceFileID.

GraphQL API +76 -6

  • Added EvidenceAssessment type and EvidenceAssessmentStatus enum; exposed assessment and assessmentStatus on Evidence; resolver maps JSONB to typed fields.

MCP +127 -12

  • Added EvidenceAssessment schema and assessment_status; mapped assessment JSON to MCP types and listings.

prb (CLI) +102 -15

  • evidence list/view now fetch assessmentStatus and key assessment fields; render readability and confidence.

App: console +100 -4

  • Evidence list shows readable/confidence badges; preview displays system, setting, issues, and rejection reason; queries and locales updated.

Package: n8n-node +24 -0

  • get and getAll include assessmentStatus and assessment fields.

Tests +192 -14

  • Assessment JSON round‑trip and schema enum decoration tests; config defaults; worker validation.

Agents +1 -1

  • Updated naming doc to pkg/evidenceassessor/assessment.go.

Other +7 -2

  • .env.example: switched to PROBOD_AGENT_EVIDENCE_ASSESSOR_*, added worker knobs and THINKING.