HIGH PRIORITY: Fixes production 404 error on research inquiry form Research Inquiry API: - Add POST /api/research-inquiry endpoint for form submissions - Add admin endpoints for inquiry management (list, get, assign, respond, delete) - Create ResearchInquiry model with MongoDB integration - Add to moderation queue for human review (strategic quadrant) - Include rate limiting (5 req/min) and CSRF protection - Tested locally: endpoint responding, data saving to DB Umami Analytics (Privacy-First): - Add Docker Compose config for Umami + PostgreSQL - Create nginx reverse proxy config with SSL support - Implement privacy-first tracking script (DNT, opt-out, no cookies) - Integrate tracking across 26 public HTML pages - Exclude admin pages from tracking (privacy boundary) - Add comprehensive deployment guide (UMAMI_SETUP_GUIDE.md) - Environment variables added to .env.example Files Created (9): - src/models/ResearchInquiry.model.js - src/controllers/research.controller.js - src/routes/research.routes.js - public/js/components/umami-tracker.js - deployment-quickstart/nginx-analytics.conf - deployment-quickstart/UMAMI_SETUP_GUIDE.md - scripts/add-umami-tracking.sh - scripts/add-tracking-python.py - SESSION_SUMMARY_ANALYTICS_RESEARCH_INQUIRY.md Files Modified (29): - src/routes/index.js (research routes) - deployment-quickstart/docker-compose.yml (umami services) - deployment-quickstart/.env.example (umami config) - 26 public HTML pages (tracking script) Values Alignment: ✅ Privacy-First Design (cookie-free, DNT honored, opt-out available) ✅ Human Agency (research inquiries require human review) ✅ Data Sovereignty (self-hosted analytics, no third-party sharing) ✅ GDPR Compliance (no personal data in analytics) ✅ Transparency (open-source tools, documented setup) Testing Status: ✅ Research inquiry: Locally tested, data verified in MongoDB ⏳ Umami analytics: Pending production deployment Next Steps: 1. Deploy to production (./scripts/deploy.sh) 2. Test research form on live site 3. Deploy Umami following UMAMI_SETUP_GUIDE.md 4. Update umami-tracker.js with website ID after setup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
229 lines
11 KiB
HTML
229 lines
11 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Instruction Classification Demo - Tractatus Framework</title>
|
|
<link rel="stylesheet" href="/css/tailwind.css?v=1761163813">
|
|
<link rel="stylesheet" href="/css/tractatus-theme.min.css?v=1761163813">
|
|
<style>
|
|
.quadrant-badge {
|
|
@apply inline-block px-3 py-1 rounded-full text-sm font-semibold;
|
|
}
|
|
.quadrant-STRATEGIC { @apply bg-purple-100 text-purple-800 border border-purple-300; }
|
|
.quadrant-OPERATIONAL { @apply bg-blue-100 text-blue-800 border border-blue-300; }
|
|
.quadrant-TACTICAL { @apply bg-green-100 text-green-800 border border-green-300; }
|
|
.quadrant-SYSTEM { @apply bg-orange-100 text-orange-800 border border-orange-300; }
|
|
.quadrant-STOCHASTIC { @apply bg-pink-100 text-pink-800 border border-pink-300; }
|
|
|
|
.persistence-HIGH { @apply bg-red-500; }
|
|
.persistence-MEDIUM { @apply bg-yellow-500; }
|
|
.persistence-LOW { @apply bg-green-500; }
|
|
.persistence-VARIABLE { @apply bg-gray-400; }
|
|
</style>
|
|
|
|
<!-- Privacy-Preserving Analytics (Umami - GDPR Compliant, No Cookies) -->
|
|
<script src="/js/components/umami-tracker.js"></script>
|
|
</head>
|
|
<body class="bg-gray-50">
|
|
|
|
<!-- Navigation (injected by navbar.js) -->
|
|
<script src="/js/components/navbar.js?v=1761163813"></script>
|
|
|
|
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
|
|
|
|
<!-- Header -->
|
|
<div class="text-center mb-12">
|
|
<h1 class="text-4xl font-bold text-gray-900 mb-4">
|
|
InstructionPersistenceClassifier Demo
|
|
</h1>
|
|
<p class="text-xl text-gray-600 max-w-3xl mx-auto">
|
|
See how the Tractatus framework classifies instructions to determine
|
|
how long they should persist and how strictly they should be enforced.
|
|
</p>
|
|
</div>
|
|
|
|
<!-- Main Demo Area -->
|
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
|
|
|
|
<!-- Input Section -->
|
|
<div class="bg-white rounded-lg shadow-lg p-6">
|
|
<h2 class="text-2xl font-bold text-gray-900 mb-4">Try It Yourself</h2>
|
|
|
|
<div class="mb-6">
|
|
<label for="instruction-input" class="block text-sm font-medium text-gray-700 mb-2">
|
|
Type an instruction:
|
|
</label>
|
|
<textarea
|
|
id="instruction-input"
|
|
rows="4"
|
|
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
|
placeholder="e.g., Always use MongoDB on port 27017"
|
|
></textarea>
|
|
</div>
|
|
|
|
<button
|
|
id="classify-btn"
|
|
class="w-full bg-blue-600 text-white px-6 py-3 rounded-lg font-semibold hover:bg-blue-700 transition"
|
|
>
|
|
Classify Instruction
|
|
</button>
|
|
|
|
<!-- Example Instructions -->
|
|
<div class="mt-8">
|
|
<h3 class="text-sm font-semibold text-gray-700 mb-3">Example Instructions:</h3>
|
|
<div class="space-y-2">
|
|
<button class="example-btn w-full text-left px-4 py-2 bg-gray-50 hover:bg-gray-100 rounded-lg text-sm text-gray-700 transition"
|
|
data-example="Always prioritize user privacy over performance">
|
|
"Always prioritize user privacy over performance"
|
|
</button>
|
|
<button class="example-btn w-full text-left px-4 py-2 bg-gray-50 hover:bg-gray-100 rounded-lg text-sm text-gray-700 transition"
|
|
data-example="Use MongoDB on port 27017 for this project">
|
|
"Use MongoDB on port 27017 for this project"
|
|
</button>
|
|
<button class="example-btn w-full text-left px-4 py-2 bg-gray-50 hover:bg-gray-100 rounded-lg text-sm text-gray-700 transition"
|
|
data-example="Add a console.log statement here for debugging">
|
|
"Add a console.log statement here for debugging"
|
|
</button>
|
|
<button class="example-btn w-full text-left px-4 py-2 bg-gray-50 hover:bg-gray-100 rounded-lg text-sm text-gray-700 transition"
|
|
data-example="Explore different approaches to caching">
|
|
"Explore different approaches to caching"
|
|
</button>
|
|
<button class="example-btn w-full text-left px-4 py-2 bg-gray-50 hover:bg-gray-100 rounded-lg text-sm text-gray-700 transition"
|
|
data-example="All API responses must return JSON with success/error format">
|
|
"All API responses must return JSON with success/error format"
|
|
</button>
|
|
<button class="example-btn w-full text-left px-4 py-2 bg-gray-50 hover:bg-gray-100 rounded-lg text-sm text-gray-700 transition"
|
|
data-example="Never hardcode credentials or API keys in source code">
|
|
"Never hardcode credentials or API keys in source code"
|
|
</button>
|
|
<button class="example-btn w-full text-left px-4 py-2 bg-gray-50 hover:bg-gray-100 rounded-lg text-sm text-gray-700 transition"
|
|
data-example="Use camelCase for JavaScript variables throughout the project">
|
|
"Use camelCase for JavaScript variables throughout the project"
|
|
</button>
|
|
<button class="example-btn w-full text-left px-4 py-2 bg-gray-50 hover:bg-gray-100 rounded-lg text-sm text-gray-700 transition"
|
|
data-example="Refactor the authentication module to use async/await">
|
|
"Refactor the authentication module to use async/await"
|
|
</button>
|
|
<button class="example-btn w-full text-left px-4 py-2 bg-gray-50 hover:bg-gray-100 rounded-lg text-sm text-gray-700 transition"
|
|
data-example="Express.js on port 3000, MongoDB on port 27017, Redis on port 6379">
|
|
"Express.js on port 3000, MongoDB on port 27017, Redis on port 6379"
|
|
</button>
|
|
<button class="example-btn w-full text-left px-4 py-2 bg-gray-50 hover:bg-gray-100 rounded-lg text-sm text-gray-700 transition"
|
|
data-example="Try different color schemes and see which looks better">
|
|
"Try different color schemes and see which looks better"
|
|
</button>
|
|
<button class="example-btn w-full text-left px-4 py-2 bg-gray-50 hover:bg-gray-100 rounded-lg text-sm text-gray-700 transition"
|
|
data-example="Add comprehensive error handling to the file upload endpoint">
|
|
"Add comprehensive error handling to the file upload endpoint"
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Results Section -->
|
|
<div class="bg-white rounded-lg shadow-lg p-6">
|
|
<h2 class="text-2xl font-bold text-gray-900 mb-4">Classification Results</h2>
|
|
|
|
<div id="results-container" class="hidden">
|
|
<!-- Quadrant -->
|
|
<div class="mb-6">
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">Quadrant</label>
|
|
<div id="result-quadrant" class="quadrant-badge"></div>
|
|
<p id="result-quadrant-desc" class="text-sm text-gray-600 mt-2"></p>
|
|
</div>
|
|
|
|
<!-- Persistence -->
|
|
<div class="mb-6">
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">Persistence Level</label>
|
|
<div class="flex items-center space-x-3">
|
|
<div id="result-persistence" class="px-4 py-2 rounded-lg text-white font-semibold"></div>
|
|
<div id="persistence-bar" class="flex-1 h-2 bg-gray-200 rounded-full overflow-hidden">
|
|
<div id="persistence-fill" class="h-full transition-all duration-500"></div>
|
|
</div>
|
|
</div>
|
|
<p id="result-persistence-desc" class="text-sm text-gray-600 mt-2"></p>
|
|
</div>
|
|
|
|
<!-- Temporal Scope -->
|
|
<div class="mb-6">
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">Temporal Scope</label>
|
|
<div id="result-temporal" class="px-4 py-2 bg-gray-100 rounded-lg inline-block font-semibold text-gray-700"></div>
|
|
<p id="result-temporal-desc" class="text-sm text-gray-600 mt-2"></p>
|
|
</div>
|
|
|
|
<!-- Verification Required -->
|
|
<div class="mb-6">
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">Verification Required</label>
|
|
<div id="result-verification" class="px-4 py-2 bg-gray-100 rounded-lg inline-block font-semibold text-gray-700"></div>
|
|
</div>
|
|
|
|
<!-- Explicitness Score -->
|
|
<div class="mb-6">
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">Explicitness Score</label>
|
|
<div class="flex items-center space-x-3">
|
|
<div id="result-explicitness" class="px-4 py-2 bg-gray-100 rounded-lg font-semibold text-gray-700"></div>
|
|
<div class="flex-1 h-2 bg-gray-200 rounded-full overflow-hidden">
|
|
<div id="explicitness-fill" class="h-full bg-blue-500 transition-all duration-500"></div>
|
|
</div>
|
|
</div>
|
|
<p class="text-sm text-gray-600 mt-2">
|
|
<span id="storage-decision"></span>
|
|
</p>
|
|
</div>
|
|
|
|
<!-- Reasoning -->
|
|
<div class="mb-6">
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">Classification Reasoning</label>
|
|
<div id="result-reasoning" class="p-4 bg-blue-50 border border-blue-200 rounded-lg text-sm text-gray-700"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="empty-state" class="text-center py-12 text-gray-400">
|
|
<svg class="w-16 h-16 mx-auto mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
|
|
</svg>
|
|
<p>Enter an instruction to see classification</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Explanation Section -->
|
|
<div class="mt-12 bg-blue-50 border-l-4 border-blue-500 p-6 rounded-r-lg">
|
|
<h3 class="text-lg font-semibold text-blue-900 mb-2">How It Works</h3>
|
|
<p class="text-blue-800 mb-4">
|
|
The InstructionPersistenceClassifier analyzes instructions to determine:
|
|
</p>
|
|
<ul class="space-y-2 text-blue-800">
|
|
<li class="flex items-start">
|
|
<span class="mr-2">•</span>
|
|
<span><strong>Quadrant:</strong> Strategic, Operational, Tactical, System, or Stochastic</span>
|
|
</li>
|
|
<li class="flex items-start">
|
|
<span class="mr-2">•</span>
|
|
<span><strong>Persistence:</strong> How long it should remain active (HIGH/MEDIUM/LOW/VARIABLE)</span>
|
|
</li>
|
|
<li class="flex items-start">
|
|
<span class="mr-2">•</span>
|
|
<span><strong>Temporal Scope:</strong> Project-wide, phase-specific, or session-only</span>
|
|
</li>
|
|
<li class="flex items-start">
|
|
<span class="mr-2">•</span>
|
|
<span><strong>Verification:</strong> How strictly it should be enforced</span>
|
|
</li>
|
|
<li class="flex items-start">
|
|
<span class="mr-2">•</span>
|
|
<span><strong>Explicitness:</strong> How clear and specific the instruction is (0.0 - 1.0)</span>
|
|
</li>
|
|
</ul>
|
|
<p class="text-blue-800 mt-4">
|
|
Only instructions with explicitness ≥ 0.6 are stored in the persistent database.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="/js/demos/classification-demo.js?v=1761163813"></script>
|
|
|
|
</body>
|
|
</html>
|