{
"event": "PostToolUse",
"raw_data": {
"session_id": "18ef5bf3-e872-4052-897e-53d6dc45b0b9",
"transcript_path": "\/root\/.claude\/projects\/-var-www\/18ef5bf3-e872-4052-897e-53d6dc45b0b9.jsonl",
"cwd": "\/var\/www\/dev.campus.systemische-tools.de",
"permission_mode": "plan",
"hook_event_name": "PostToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/AI\/ContentQualityValidator.php",
"limit": 80
},
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/AI\/ContentQualityValidator.php",
"content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Infrastructure\\AI;\n\n\/\/ @responsibility: Validiert Content-Qualität mittels LLM\nfinal class ContentQualityValidator\n{\n private OllamaService $ollama;\n\n public function __construct(?OllamaService $ollama = null)\n {\n $this->ollama = $ollama ?? AIConfig::fromCredentialsFile()->createOllamaService();\n }\n\n \/**\n * Validate chat response quality.\n *\n * @param string $question Original question\n * @param string $answer LLM response\n * @param array<array{title: string, score: float}> $sources Used sources\n * @param string|null $structureName Applied structure (if any)\n *\n * @return array{passed: bool, score: float, issues: array<string>, details: string}\n *\/\n public function validate(\n string $question,\n string $answer,\n array $sources = [],\n ?string $structureName = null\n ): array {\n $prompt = $this->buildValidationPrompt($question, $answer, $sources, $structureName);\n\n try {\n $response = $this->ollama->generate($prompt, 'mistral', 0.1);\n $parsed = $this->parseResponse($response);\n\n return $parsed;\n } catch (\\Exception $e) {\n return [\n 'passed' => true,\n 'score' => 0.0,\n 'issues' => ['Validierung fehlgeschlagen: ' . $e->getMessage()],\n 'details' => 'Validierung konnte nicht durchgeführt werden.',\n ];\n }\n }\n\n \/**\n * Build validation prompt.\n *\/\n private function buildValidationPrompt(\n string $question,\n string $answer,\n array $sources,\n ?string $structureName\n ): string {\n $sourceList = '';\n if ($sources !== []) {\n $titles = array_map(fn ($s) => $s['title'] ?? 'Unbekannt', $sources);\n $sourceList = 'Verwendete Quellen: ' . implode(', ', $titles);\n }\n\n $structureInfo = $structureName !== null\n ? \"Erwartetes Format: {$structureName}\"\n : 'Kein spezifisches Format erwartet';\n\n return <<<PROMPT\nAnalysiere die folgende Antwort auf Qualität und Korrektheit.\n\nFRAGE:\n{$question}\n\nANTWORT:\n{$answer}\n\n{$sourceList}\n{$structureInfo}\n",
"numLines": 80,
"startLine": 1,
"totalLines": 125
}
},
"tool_use_id": "toolu_019erDjNeQisdRxaM2gbFhmp"
}
}