SIMON Master Console Rebuild
True command center for SIMON + WEB360
This rebuild gives you a cleaner production spine: interactive tree, live viewer, guarded editor, dynamic graphics, architecture map, and note storage. It is designed to sit beside your existing
console.php
and become the stronger replacement path.
Dashboard
Tree
Viewer
System Map
File Registry
Notes
Files
15,325
Folders
408
Scanned Size
3.84 GB
PHP Files
885
Editable Text Files
12,586
File viewer
guarded to /htdocs
/SI/_core/knowledge.php
<?php declare(strict_types=1); require_once __DIR__ . '/common.php'; require_once __DIR__ . '/memory.php'; function si_knowledge_data(): array { static $data = null; if (is_array($data)) return $data; $candidates = [ si_core_private_root() . '/si_knowledge.php', dirname(si_core_private_root()) . '/private/si_knowledge.php', ]; foreach (array_unique($candidates) as $path) { if (is_file($path) && is_readable($path)) { $loaded = require $path; if (is_array($loaded)) { $data = $loaded; return $data; } } } $data = [ 'identity' => ['sitemap' => 'https://www.gaylordsinclair.com/sitemap.php'], 'topics' => [], ]; return $data; } function si_knowledge_normalize(string $text): string { $text = strtolower(trim($text)); return preg_replace('/[^a-z0-9\s\-\/\.]/', ' ', $text) ?: ''; } function si_knowledge_answer(string $question, string $contact = ''): string { $data = si_knowledge_data(); $question = si_knowledge_normalize($question); if ($contact !== '' && preg_match('/\b(hello|hi|hey|good morning|good afternoon|good evening)\b/', $question)) { $name = si_memory_name($contact); if ($name !== '') return 'Welcome back, ' . $name . '. I remember our earlier conversation. How may I help you today?'; } $best = null; $bestScore = 0; foreach ((array) ($data['topics'] ?? []) as $topic) { $score = 0; foreach ((array) ($topic['keywords'] ?? []) as $keyword) { $keyword = si_knowledge_normalize((string) $keyword); if ($keyword !== '' && strpos($question, $keyword) !== false) $score += substr_count($question, $keyword) + 2; } if ($score > $bestScore) { $bestScore = $score; $best = $topic; } } if (is_array($best) && !empty($best['answer'])) return (string) $best['answer']; $five = (array) ($data['five_w_one_h'] ?? []); foreach (['who','what','when','where','why','how'] as $word) { if (preg_match('/\b' . $word . '\b/', $question) && !empty($five[$word])) return (string) $five[$word]; } return 'I can explain Gaylord Sinclair LLC, SIMON Enterprise, publishing, books, Web360, Connlink, Guardian, SIMON BUG, creative worlds, sales and support. For the current directory, visit https://www.gaylordsinclair.com/sitemap.php. I can also take a message or connect you with Keith.'; } function si_knowledge_context(): string { $data = si_knowledge_data(); $parts = []; foreach (['identity','five_w_one_h','state_model','voice','topics','public_links'] as $key) { if (isset($data[$key])) $parts[] = strtoupper($key) . ': ' . json_encode($data[$key], JSON_UNESCAPED_SLASHES); } return implode("\n", $parts); } function si_knowledge_full_context(string $contact = ''): string { $context = si_knowledge_context(); if ($contact !== '') { $memory = si_memory_context($contact); if ($memory !== '') $context .= "\nRECENT PRIVATE CONVERSATION MEMORY:\n" . $memory; } return $context; }
Save file
Quick jump
open a path
Open