feat(tools): reposition as Do Better Legal two-track Norwegian-law MCP

De-family-ify shared JSON tools (persona-aware routing + neutral base
prompt), make the verification review pick its engine per track
(family/child-welfare -> dbn-legal-agent-v3, others -> gpt-4o interim),
and route product-name strings through dbnToolsProductName(). Rebrand the
MCP/tools surface (mcp.php + i18n mcp_* strings) to Do Better Legal.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-02 07:45:17 +02:00
parent d156f8cf6b
commit 7fcd317205
12 changed files with 158 additions and 72 deletions
+19 -5
View File
@@ -28,6 +28,8 @@ final class DbnLegalAnalysisAgent
/** Persona system prompt (from the resolved chat profile); null ⇒ use the built-in barnevern prompt. */
private ?string $personaPrompt = null;
/** Persona slug driving the per-track reviewer model; default = child-welfare (family track). */
private string $personaSlug = 'child-welfare';
public function withPersonaPrompt(?string $prompt): self
{
@@ -36,6 +38,15 @@ final class DbnLegalAnalysisAgent
return $this;
}
public function withPersonaSlug(?string $slug): self
{
$slug = is_string($slug) ? trim($slug) : '';
if ($slug !== '') {
$this->personaSlug = $slug;
}
return $this;
}
public function __construct()
{
// On Azure: gpt-4o-mini for extraction/synthesis. On Bedrock: factory picks Haiku/Sonnet.
@@ -408,11 +419,12 @@ PROMPT;
$userMsg .= "\n\n" . $ctxLabel . ': ' . $issue['brief_context'];
}
if ($corpusContext !== '') {
$product = dbnToolsProductName();
$srcLabel = match ($language) {
'no' => 'Relevante kilder fra Do Better Norge-korpuset',
'pl' => 'Istotne źródła z korpusu Do Better Norge',
'uk' => 'Релевантні джерела з корпусу Do Better Norge',
default => 'Relevant sources from the Do Better Norge corpus',
'no' => 'Relevante kilder fra ' . $product . '-korpuset',
'pl' => 'Istotne źródła z korpusu ' . $product,
'uk' => 'Релевантні джерела з корпусу ' . $product,
default => 'Relevant sources from the ' . $product . ' corpus',
};
$userMsg .= "\n\n" . $srcLabel . ":\n" . $corpusContext;
}
@@ -613,7 +625,9 @@ PROMPT;
try {
$legalCheck = dbnToolsRunLegalCheck(
mb_strimwidth($synth['overall_assessment'], 0, 800),
$docType
$docType,
$this->personaPrompt,
$this->personaSlug
);
} catch (Throwable) {}