Make dbn-legal-agent-v3 checker context-aware; wire into LegalAnalysisAgent
Three fixes: 1. bootstrap.php dbnToolsRunLegalCheck(): prepend first 350 chars of synthesis text to the v3 user message so it validates actual content, not just general law. 2. BvjAnalyzerAgent: fix engine guard — was skipping check for claude_sonnet/haiku; now skips only when dbn_legal_v3 is the synthesis model (it already IS the check). 3. LegalAnalysisAgent: add post-synthesis dbnToolsRunLegalCheck() call after Pass 3; add 'legal_check' key to runFullAnalysis() return. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -362,6 +362,15 @@ PROMPT;
|
||||
$emit('progress', ['step' => 'synthesising', 'detail' => 'Synthesising overall assessment…']);
|
||||
$synth = $this->synthesise($answered, $language, $docType);
|
||||
|
||||
// Post-synthesis legal check — dbn-legal-agent-v3 validates the overall assessment
|
||||
$legalCheck = [];
|
||||
try {
|
||||
$legalCheck = dbnToolsRunLegalCheck(
|
||||
mb_strimwidth($synth['overall_assessment'], 0, 800),
|
||||
$docType
|
||||
);
|
||||
} catch (Throwable) {}
|
||||
|
||||
return [
|
||||
'ok' => true,
|
||||
'issues' => $answered,
|
||||
@@ -370,6 +379,7 @@ PROMPT;
|
||||
'disclaimer' => $synth['disclaimer'],
|
||||
'doc_type' => $docType,
|
||||
'model' => self::LEGAL_MODEL,
|
||||
'legal_check' => $legalCheck,
|
||||
'latency_ms' => (int)round(microtime(true) * 1000) - $startMs,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user