Verdict is a WPF application (.NET 9) designed for native Windows deployment. The architecture follows a strict MVVM pattern.
- Models/: Individual class files for all entities. Agent is now a composed model — see Agent Architecture below.
- Core models:
Agent.cs,CaseFile.cs,EvidenceDocument.cs,MemoryEntry.cs,CourtroomEvent.cs,AIModelConfiguration.cs,JuryInstructions.cs,VerdictForm.cs,ExtractedEntities.cs,AgentInteraction.cs,Charge.cs,CauseOfAction.cs,Element.cs,LegalStandard.cs,CaseMode.cs,JurisdictionType.cs,TrialPhase.cs,CourtPhase.cs,AgentRole.cs,ObservableObject.cs. - Factored Agent sub-models:
AgentDemographics.cs(age, gender, race, occupation, education, income, etc.),BiasDimensionWeights.cs(11 per-category bias weight overrides),AgentModelOverrides.cs(per-agent model, temperature, token limit),BiasFactor.cs,JurorOpinion.cs.
- Core models:
- ViewModels/: Contains
MainViewModel.cs,CaseSettingsViewModel.cs,ModelSettingsViewModel.cs, andViewModelBase.cs. - Views/: Contains XAML windows and user controls (
AgentProfileWindow.xaml,CaseSettingsWindow.xaml,ModelSettingsWindow.xaml,CounselDiscussionWindow.xaml,ClientConversationWindow.xaml,AddModelDialog.xaml,GoogleModelSelectionDialog.xaml,ModelDetailsDialog.xaml). - Services/: Contains 17 services for business logic. Key additions:
MemoryDecayService(progressive memory fuzzification extracted fromAgent.cs),BurdenOfProof(mode-aware conviction thresholds for criminal vs civil cases).
Agent uses composition with three sub-object models that each inherit ObservableObject:
Agent.Demographics(AgentDemographics): Gender, Age, Race, Occupation, EducationLevel, IncomeLevel, MediaConsumption, ConsumerSegment, MaritalStatus, ParentalStatus, Hobbies, ReligiousAffiliation, PoliticalAffiliation, ZipCode, ViewingCharacteristics, CurrentStatus, SpecializedKnowledge. HasCopyFrom(),ToProfileSummary().Agent.BiasWeights(BiasDimensionWeights): 11 nullabledouble?properties (AgeBiasWeight through CommunityTiesWeight). Null = inherit global default. HasCopyFrom(),ResetAll(),SetAll(double).Agent.ModelOverrides(AgentModelOverrides): SelectedModel, ModelTemperatureOverride (clamped 0.0–2.0), ModelMaxTokensOverride (min 64). HasCopyFrom(),HasOverrides.- 2026-05-15: Added
AgentChatWindowfor LLM-powered conversation with any agent via right-click "Chat", with memory persistence taggedSource = "Chat"and memory wipe button. AddedJurorReportWindowfor right-click sentiment/verdict lean/memory report on juror seats. AddedExhibitListWindowaccessible from Case menu (_Exhibit List) showing all evidence in aListView. Added photo evidence support by extending file dialog filters to include image formats (.jpg,.jpeg,.png,.gif,.bmp) with automaticMediaTypeclassification ("Image"vs"Document") inEvidenceDocument. AddedDetailedAnalysisfield toEvidenceDocumentfor full LLM analysis storage. AddedStagetop-level menu with trial phase (Discovery/Pretrial/Trial) and court phase submenus. Added dynamic title bar viaWindowTitleproperty onMainViewModelformatted as"VERDICT - Plaintiff v. Defendant - (CASE STAGE)". Increased bench spacing (Margin="12,0") on bench areaContentPresenteritems. Removed redundant "Case loaded." message boxes. Fixed double LLM call in evidence analysis pipeline. All original flat properties (e.g.,agent.Age,agent.SelectedModel) remain available for XAML binding backward compatibility — they delegate reads/writes to the sub-objects.CopyTouses each sub-object'sCopyFromfor bulk transfer.
Memory decay/fuzzification logic is extracted to MemoryDecayService (static methods: DecayMemories, FuzzifyContent, RecordTrialEvent, ReinforceMemory, ReinforceRelatedMemories, ApproximateNumber, RangeNumber, VagueNumber, RoundToSignificant, TryParseCleanNumber). Agent methods delegate to this service.
- 2026-05-27: Added
BurdenOfProofservice with mode-aware conviction thresholds. Criminal cases now require lean > 0.85 (beyond reasonable doubt) for a guilty vote; jurors at 0.50–0.85 have "reasonable doubt" and vote not guilty. Civil cases unchanged at > 0.50 preponderance standard. Updated all verdict counting, juror position labeling, deliberation completion logic, jury questionnaires, and reports. Fixed hung-jury detection: unanimous-side vote (all jurors on same outcome) now correctly returns a verdict regardless of lean spread. Fixed deliberation prompt to explicitly tell LLM which side the juror's lean value represents, preventing text/lean contradictions. - 2026-05-27 (evidence weighting): Added probative value and media-type-aware evidence weighting. Added
ProbativeValue,EvidenceCategory(Document/Image/Video/Audio/Physical/Testimony),WitnessCredibility,IsTestimonial, andReliabilityScorefields toEvidenceDocument. RefactoredEvidenceAnalysisService.AssessStrengthwith media-type impact multipliers (Video 1.6×, Physical 1.5×, Image 1.4×, Audio 1.3×, Document/Testimony 1.0×) and newAssessProbativeValuemethod accounting for reliability, direct/circumstantial classification, hearsay, and witness credibility. AddedCalculatePerJurorCredibilityandCalculateMediaTypeSensitivitytoJuryCalculationService— each juror now assesses witness credibility and responds to evidence media types through their own demographic biases (education, age, politics, race/gender, attentiveness). ExtendedMainViewModelfile type detection from Image/Document to full Video/Audio support. Updated file dialog filters inMainWindow.xaml.csto include video and audio formats. Updated all help documentation anddocs/math.mdwith mathematical formulas for probative weighting, credibility perception, and media sensitivity. - 2026-05-27 (service extraction): Extracted
EvidenceProbativeService(static, 117 lines) fromEvidenceAnalysisService(597→500 lines) containingGetMediaImpactMultiplier,DetermineEvidenceCategory, andAssessProbativeValue. ExtractedJurorCredibilityService(static, 150 lines) fromJuryCalculationService(376→237 lines) containingCalculatePerJurorCredibilityandCalculateMediaTypeSensitivity. Both new services are pure static utility classes with no dependencies, while the originals retain thin forwarding methods for backward compatibility. - 2026-05-27 (default weights fix): Fixed
ModelWeightsWindowto use research-backed defaults. Renamed "Reset All Weights" (set to 0) to "Research Defaults" (green button, sets research values fromdocs/JurorBiasResearch.md). Added separate "Zero All" button for the old behavior. Added missingCommunicationStyleWeightto all preset buttons (Balanced, Expert Focus, Diverse Perspective) and toSyncDefaultBiasFactors(). AddedProfessional Backgroundentry to research doc table (0.55 weight).DefaultBiasFactorscollection now stays in sync with slider values viaSyncDefaultBiasFactors(). - 2026-05-26: Factored
Agent.cs(~900 lines) into composable sub-objects. ExtractedAgentDemographics,BiasDimensionWeights, andAgentModelOverridesas separateObservableObjectmodels. Extracted memory decay/fuzzification logic intoMemoryDecayService(static service).Agent.CopyTosimplified usingCopyFromon each sub-object. All flat XAML-binding properties retained as delegation properties for backward compatibility. Added 4 new test suites inModelTests.cs:TestAgentDemographicsModel,TestBiasDimensionWeightsModel,TestAgentModelOverridesModel,TestMemoryDecayService. - 2026-05-01: Split
Models.csinto individual files in theModels/directory. MovedMainViewModel.csto theViewModels/directory and refactored to inherit fromViewModelBase. Extracted business logic fromMainViewModelintoCaseServiceandTranscriptServicein theServices/directory. IntroducedObservableObjectandViewModelBaseto standardizeINotifyPropertyChangedimplementation. RefactoredAgentandMemoryEntryto useSetPropertyfor cleaner property definitions. MainWindow.xaml: Dynamic abstracted overhead courtroom view usingItemsControlfor dynamic seating. - Post-2026-05-01: Added 12 additional services (
CourtroomManagerService,EvidenceAnalysisService,DebateService,JuryCalculationService,CaseEntityMapper,AgentAssignmentService,JuryDemographicsService,AgentInteractionService,LegalDatabaseService,ReportGenerationService,ProviderDiscoveryService,SettingsService). AddedCaseSettingsViewModelandModelSettingsViewModel. AddedDeepSeekProvider. AddedExtractedEntitiesmodel. AddedLegalDatabase.jsonresource. AddedLoggerservice. - 2026-05-15: Added
AgentChatWindowfor LLM-powered conversation with any agent via right-click "Chat", with memory persistence taggedSource = "Chat"and memory wipe button. AddedJurorReportWindowfor right-click sentiment/verdict lean/memory report on juror seats. AddedExhibitListWindowaccessible from Case menu (_Exhibit List) showing all evidence in aListView. Added photo evidence support by extending file dialog filters to include image formats (.jpg,.jpeg,.png,.gif,.bmp) with automaticMediaTypeclassification ("Image"vs"Document") inEvidenceDocument. AddedDetailedAnalysisfield toEvidenceDocumentfor full LLM analysis storage. AddedStagetop-level menu with trial phase (Discovery/Pretrial/Trial) and court phase submenus. Added dynamic title bar viaWindowTitleproperty onMainViewModelformatted as"VERDICT - Plaintiff v. Defendant - (CASE STAGE)". Increased bench spacing (Margin="12,0") on bench areaContentPresenteritems. Removed redundant "Case loaded." message boxes. Fixed double LLM call in evidence analysis pipeline. - 2026-05-09: Added
AgentChatWindowfor LLM-powered conversation with any agent, including memory persistence viaMemoryEntryobjects tagged withSource = "Chat". AddedJurorReportWindowfor viewing juror sentiment, verdict lean, and memory report from juror seat context menus. AddedExhibitListWindowaccessible from the Case menu (_Exhibit List) showing all evidence in aListView. Added_Stagemenu to the main menu bar with trial phase (Discovery/Pretrial/Trial) and court phase (Opening Statements, Witness Testimony, Cross Examination, Party Statements, Closing Arguments, Jury Deliberation) submenus. Increased bench spacing by settingMargin="12,0"on bench areaContentPresenteritems for better visual separation of Judge, Reporter, and Witness seats. Added photo evidence support by extending the evidence file dialog filter to include image formats (.jpg,.jpeg,.png,.gif,.bmp) with automatic media type classification ("Image"vs"Document") inEvidenceDocument. Added dynamic title bar viaWindowTitleproperty onMainViewModelthat formats as"VERDICT - Plaintiff v. Defendant - (CASE STAGE)"and updates on case load and phase changes.
- Preferred Shell: PowerShell
- Build:
dotnet build - Run:
dotnet run - Test:
dotnet run --project Tests/Tests.csproj - Clean:
dotnet clean- ViewModels: Courtroom initialization and transcript processing logic.
The project includes a custom test harness located in the Tests/ directory. This is a console application that performs integration and unit tests on core components.
- TestHarness.cs: Contains the test logic for Models, Services, Providers, and ViewModels.
- Coverage:
- Models: Sentiment analysis, verdict lean, and trial events.
- Services: Transcript parsing, case persistence (JSON), and character management.
- Providers: LLM provider discovery and configuration metadata.
- ViewModels: Courtroom initialization and transcript processing logic.
- Note: LLM response generation tests are skipped by default as they require live API keys.
- Character Profiles (.vcs): Verdict Character Settings. JSON files storing reusable agent profiles (prompts, memories, settings) in the
/Charactersrepository.
When adding new features, update TestHarness.cs with corresponding test methods:
- Create a new
Test[Feature]method. - Add it to the
RunTestsmethod. - Use
Console.WriteLinefor progress and throw anExceptionon failure.
- Simulations (.jur): JSON-based case files storing simulation state and agent configurations.
- Character Profiles (.vcs): Verdict Character Settings. JSON files storing reusable agent profiles (prompts, memories, settings) in the
/Charactersrepository. - Assets: Every simulation (
name.jur) creates a sibling directory (name_Assets/) to store evidence, documents, and agent artifacts.
- Jury Box: 12 primary seats + 2 alternate seats.
- Observer Box: Maximum 6 seats for gallery observation (4 observers + 2 client slots).
- Counsel Tables: Prosecution/Plaintiff (Right) and Defense (Left) tables.
- Bench Area: 1 Judge, 1 Reporter, 1 Witness Box. Bench seats have
Margin="12,0"spacing for better visual separation. - Interactive Points:
- Left-click "+" to add/activate agent (opens Agent Profile window).
- Right-click for context menu (Edit Profile, Generate Likely Juror, Chat, Juror Report, Save as Character .VCS, Save to Casefile, Delete).
- Right-click "Chat" opens
AgentChatWindowwith LLM-powered conversation and memory persistence (taggedSource = "Chat"). "Wipe Memories" button clears only chat memories. - Right-click "Juror Report" on juror/alternate seats opens
JurorReportWindowshowing sentiment, verdict lean, and memory report. - Central Podium button focuses the input prompt.
- Generate Jury button populates jury box with demographically-generated jurors.
- Admit Evidence button opens file dialog for document submission (supports PDF, TXT, DOCX, RTF, JPG, JPEG, PNG, GIF, BMP).
- Clerk seat (green) accepts document drops for evidence submission.
- Stage Menu: The
_Stagemenu in the main menu bar provides trial phase (Discovery/Pretrial/Trial) and court phase (Opening Statements, Witness Testimony, Cross Examination, Party Statements, Closing Arguments, Jury Deliberation) submenus to control the current case stage. - Exhibit List: Accessible from the
Casemenu via_Exhibit List, opensExhibitListWindowshowing all evidence in aListView. - Dynamic Title Bar: The window title updates dynamically to
"VERDICT - Plaintiff v. Defendant - (CASE STAGE)"based on case name and trial phase.
- Update
docs/JurorBiasResearch.mdif the change affects bias factor defaults or research citations.
- C# 12+ features (Global Usings, File-scoped Namespaces).
- XAML styles are defined in
Window.Resourcesfor consistency. - All UI-bound properties must trigger
OnPropertyChanged.
The juror opinion engine uses a sophisticated coherence + drift + conformity model with research-backed parameters. When modifying the math in ToyJurorLogicEngine.cs, JuryCalculationService.cs, or JuryDemographicsService.cs:
- Trait generation formulas from agent demographics
- Update
docs/math.mdwith any changes to formulas, coefficients, or pipeline stages.
- Trait generation formulas from agent demographics
-
Update
docs/JurorBiasResearch.mdif the change affects bias factor defaults or research citations.- Cross-factor interaction terms and their rationale -
Update the corresponding help page in
Help/if user-facing documentation is affected.- Coefficient tables with research sources
- Complete formulas for all three pipeline stages (static bias → evidence drift → deliberation)
The math document (
docs/math.md) contains: