<?php
require_once __DIR__."/havenstone_flow_verifier.php";
header('Content-Type: application/json');
$auth=$_GET['auth']??''; if($auth!=='121141'){http_response_code(403);exit('auth');}
$root=rtrim($_SERVER['DOCUMENT_ROOT'],'/');
$log="$root/COMMAND_CENTER/LOGS/malcolm_ops_".gmdate('Ymd_His').".json";
$data=[
  'ts'=>gmdate('c'),
  'scan'=>'malcolm intelligence',
  'status'=>'ok',
  'notes'=>'Analyzed trends and archive integrity'
];
file_put_contents($log,json_encode($data,JSON_PRETTY_PRINT));
echo json_encode($data);
?>