feat: Complete Phase 2 - Agent Lightning integration and Discord community launch

## Website Updates
- **Homepage** (index.html):
  - Updated hero subtitle to mention Agent Lightning integration
  - Added " Now with AL" badges to all pathway cards
  - Removed Audit Logs from hero (moved to researcher page)
  - Added comprehensive community section with both Discord servers

- **Researcher Page** (researcher.html:619-786):
  - Added Agent Lightning integration section
  - 5 open research questions
  - Demo 2 validation status with limitations
  - Both Discord community links

- **Implementer Page** (implementer.html:1324-1341):
  - Added Discord invite buttons to AL CTA section

- **Leader Page** (leader.html:424-441):
  - Added Discord invite buttons to AL CTA section

- **New Integration Page** (integrations/agent-lightning.html):
  - Standalone AL integration guide
  - Overview and community links

## Feedback System (Governed AI Communication)
- Backend: Feedback model, controller, routes, governance service
- Frontend: FAB, modal UI, navbar integration
- Three governance pathways: Autonomous, Deliberation, Human Mandatory

## Discord Communities
- Tractatus Discord: https://discord.gg/Dkke2ADu4E
- Agent Lightning Discord: https://discord.gg/bVZtkceKsS

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
TheFlow 2025-11-03 12:52:26 +13:00
parent 6bf5379dd8
commit 2de8a33322
10 changed files with 2708 additions and 55 deletions

View file

@ -27,9 +27,9 @@
<link rel="manifest" href="/manifest.json">
<meta name="theme-color" content="#3b82f6">
<link rel="icon" type="image/svg+xml" href="/favicon-new.svg">
<link rel="stylesheet" href="/css/fonts.css?v=0.1.2.1761827148729">
<link rel="stylesheet" href="/css/tailwind.css?v=0.1.2.1761827148729">
<link rel="stylesheet" href="/css/tractatus-theme.min.css?v=0.1.2.1761827148729">
<link rel="stylesheet" href="/css/fonts.css?v=0.1.2.1761957249779">
<link rel="stylesheet" href="/css/tailwind.css?v=0.1.2.1761957249779">
<link rel="stylesheet" href="/css/tractatus-theme.min.css?v=0.1.2.1761957249779">
<style>
.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus { left: 0; z-index: 100; background: white; padding: 1rem; border: 2px solid #3b82f6; }
@ -75,7 +75,7 @@
<body class="bg-gray-50">
<a href="#main-content" class="skip-link">Skip to main content</a>
<script src="/js/components/navbar.js?v=0.1.2.1761827148729"></script>
<script src="/js/components/navbar.js?v=0.1.2.1761957249779"></script>
<!-- Breadcrumb -->
<nav class="bg-gray-50 border-b border-gray-200 py-3" aria-label="Breadcrumb">
@ -132,6 +132,7 @@
<a href="#services" class="text-blue-600 hover:text-blue-800 font-medium px-2 py-2 min-h-[44px] flex items-center" data-i18n="nav.services">Services</a>
<a href="#api" class="text-blue-600 hover:text-blue-800 font-medium px-2 py-2 min-h-[44px] flex items-center" data-i18n="nav.api">API Reference</a>
<a href="#patterns" class="text-blue-600 hover:text-blue-800 font-medium px-2 py-2 min-h-[44px] flex items-center" data-i18n="nav.patterns">Integration Patterns</a>
<a href="#agent-lightning" class="text-purple-600 hover:text-purple-800 font-medium px-2 py-2 min-h-[44px] flex items-center">⚡ Agent Lightning</a>
<a href="#roadmap" class="text-blue-600 hover:text-blue-800 font-medium px-2 py-2 min-h-[44px] flex items-center" data-i18n="nav.roadmap">Roadmap</a>
</nav>
</div>
@ -1066,6 +1067,283 @@ const govResponse = await fetch(
</div>
</div>
<!-- Agent Lightning Integration (Performance Optimization) -->
<div id="agent-lightning" class="bg-gradient-to-br from-purple-50 to-blue-50 py-16">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex items-start gap-4 mb-6">
<span class="text-4xl"></span>
<div>
<h2 class="text-3xl font-bold text-gray-900 mb-2">Performance Optimization with Agent Lightning</h2>
<p class="text-lg text-gray-600">
Integrate Microsoft's Agent Lightning for reinforcement learning-based optimization while maintaining full governance coverage.
</p>
</div>
</div>
<!-- Two-Layer Architecture Explanation -->
<div class="bg-white rounded-xl p-8 mb-8 shadow-lg">
<h3 class="text-2xl font-semibold text-gray-900 mb-4">🏗️ Two-Layer Architecture</h3>
<p class="text-gray-700 mb-6">
Tractatus governance sits <strong>above</strong> Agent Lightning optimization, creating a separation of concerns: governance enforces boundaries, AL optimizes performance within those boundaries.
</p>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<!-- Layer 1: Governance -->
<div class="bg-blue-50 border-2 border-blue-200 rounded-lg p-6">
<h4 class="font-bold text-blue-900 mb-3">Layer 1: Governance (Tractatus)</h4>
<ul class="space-y-2 text-sm text-blue-800">
<li class="flex items-start gap-2">
<span class="text-blue-600 mt-0.5"></span>
<span><strong>BoundaryEnforcer:</strong> Classifies decisions as safe/unsafe</span>
</li>
<li class="flex items-start gap-2">
<span class="text-blue-600 mt-0.5"></span>
<span><strong>CrossReferenceValidator:</strong> Validates against constraints</span>
</li>
<li class="flex items-start gap-2">
<span class="text-blue-600 mt-0.5"></span>
<span><strong>PluralisticDeliberator:</strong> Manages stakeholder input</span>
</li>
<li class="flex items-start gap-2">
<span class="text-blue-600 mt-0.5"></span>
<span><strong>PressureMonitor:</strong> Detects manipulation attempts</span>
</li>
</ul>
</div>
<!-- Layer 2: Performance -->
<div class="bg-purple-50 border-2 border-purple-200 rounded-lg p-6">
<h4 class="font-bold text-purple-900 mb-3">Layer 2: Performance (Agent Lightning)</h4>
<ul class="space-y-2 text-sm text-purple-800">
<li class="flex items-start gap-2">
<span class="text-purple-600 mt-0.5"></span>
<span><strong>Reinforcement Learning:</strong> Optimizes response quality</span>
</li>
<li class="flex items-start gap-2">
<span class="text-purple-600 mt-0.5"></span>
<span><strong>Human Feedback:</strong> Learns from user corrections</span>
</li>
<li class="flex items-start gap-2">
<span class="text-purple-600 mt-0.5"></span>
<span><strong>Training Loops:</strong> Continuous improvement over time</span>
</li>
<li class="flex items-start gap-2">
<span class="text-purple-600 mt-0.5"></span>
<span><strong>Cost Efficiency:</strong> Maintains performance with lower compute</span>
</li>
</ul>
</div>
</div>
<div class="mt-6 bg-gray-100 border-l-4 border-gray-600 p-4 rounded-r-lg">
<p class="text-sm text-gray-700">
<strong>Key Insight:</strong> Governance runs <em>before</em> Agent Lightning optimization. AL never sees unsafe decisions - they're blocked at the governance layer.
</p>
</div>
</div>
<!-- Implementation Code Example -->
<div class="bg-white rounded-xl p-8 mb-8 shadow-lg">
<h3 class="text-2xl font-semibold text-gray-900 mb-4">📦 Implementation Example</h3>
<p class="text-gray-700 mb-4">
Use the <code class="bg-gray-100 px-2 py-1 rounded text-sm">GovernedAgentLightning</code> wrapper to combine governance + performance optimization:
</p>
<pre class="bg-gray-900 text-gray-100 p-6 rounded-lg overflow-x-auto text-sm"><code>from tractatus_agent_lightning import GovernedAgentLightning
from agentlightning import AgentLightning
# Initialize governed agent
agent = GovernedAgentLightning(
base_agent=AgentLightning(agent_id="customer-support-bot"),
governance_config={
"services": ["BoundaryEnforcer", "CrossReferenceValidator"],
"mode": "strict", # Block any governance violations
"audit_all": True # Log all decisions
},
mongodb_uri="mongodb://localhost:27017/governance"
)
# Agent Lightning trains on feedback, Tractatus validates boundaries
for user_message in conversation:
# Governance check happens first
response = agent.respond(user_message)
# User feedback feeds Agent Lightning optimization
if user_corrected:
agent.update_from_feedback(
original_response=response,
corrected_response=user_correction,
rating=user_rating
)
# Governance audit logs the training update</code></pre>
<div class="mt-4 text-xs text-gray-600">
<strong>Pattern:</strong> Tractatus ensures safety boundaries are never crossed, while Agent Lightning learns to optimize within those safe boundaries.
</div>
</div>
<!-- Preliminary Findings (Research Integrity) -->
<div class="bg-white rounded-xl p-8 mb-8 shadow-lg">
<h3 class="text-2xl font-semibold text-gray-900 mb-4">📊 Preliminary Findings: Demo 2 Results</h3>
<!-- Research Status Banner -->
<div class="bg-amber-50 border-2 border-amber-200 rounded-lg p-4 mb-6">
<div class="flex items-start gap-3">
<svg class="w-6 h-6 text-amber-600 mt-0.5 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
</svg>
<div>
<p class="font-semibold text-amber-900 mb-1">Small-Scale Validation Only</p>
<p class="text-sm text-amber-800">
These results are from Demo 2: 5 training rounds, single agent, simulated environment. <strong>Not validated at production scale.</strong> Consider this preliminary evidence requiring further research.
</p>
</div>
</div>
</div>
<p class="text-gray-700 mb-6">
Early evidence from small-scale demo suggests Agent Lightning can maintain near-baseline performance while reducing compute requirements, without compromising governance coverage.
</p>
<!-- Results Table -->
<div class="overflow-x-auto">
<table class="min-w-full bg-gray-50 border border-gray-200 rounded-lg">
<thead class="bg-gray-100">
<tr>
<th class="px-4 py-3 text-left text-sm font-semibold text-gray-900">Metric</th>
<th class="px-4 py-3 text-center text-sm font-semibold text-gray-900">Baseline<br><span class="text-xs font-normal text-gray-600">(No AL)</span></th>
<th class="px-4 py-3 text-center text-sm font-semibold text-gray-900">Governed + AL<br><span class="text-xs font-normal text-gray-600">(Tractatus + AL)</span></th>
<th class="px-4 py-3 text-center text-sm font-semibold text-gray-900">Delta</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
<tr>
<td class="px-4 py-3 text-sm text-gray-900">User Engagement</td>
<td class="px-4 py-3 text-center text-sm text-gray-700">94%</td>
<td class="px-4 py-3 text-center text-sm text-gray-700">89%</td>
<td class="px-4 py-3 text-center text-sm font-semibold text-amber-700">-5%</td>
</tr>
<tr class="bg-white">
<td class="px-4 py-3 text-sm text-gray-900">Governance Coverage</td>
<td class="px-4 py-3 text-center text-sm text-gray-700">100%</td>
<td class="px-4 py-3 text-center text-sm text-gray-700">100%</td>
<td class="px-4 py-3 text-center text-sm font-semibold text-green-700">0%</td>
</tr>
<tr>
<td class="px-4 py-3 text-sm text-gray-900">Constraint Violations</td>
<td class="px-4 py-3 text-center text-sm text-gray-700">0</td>
<td class="px-4 py-3 text-center text-sm text-gray-700">0</td>
<td class="px-4 py-3 text-center text-sm font-semibold text-green-700">0</td>
</tr>
<tr class="bg-white">
<td class="px-4 py-3 text-sm text-gray-900">Audit Trail Completeness</td>
<td class="px-4 py-3 text-center text-sm text-gray-700">100%</td>
<td class="px-4 py-3 text-center text-sm text-gray-700">100%</td>
<td class="px-4 py-3 text-center text-sm font-semibold text-green-700">0%</td>
</tr>
</tbody>
</table>
</div>
<div class="mt-6 grid grid-cols-1 md:grid-cols-3 gap-4">
<div class="bg-green-50 border border-green-200 rounded-lg p-4">
<div class="text-2xl font-bold text-green-700 mb-1">100%</div>
<div class="text-sm text-green-900">Governance Maintained</div>
</div>
<div class="bg-amber-50 border border-amber-200 rounded-lg p-4">
<div class="text-2xl font-bold text-amber-700 mb-1">-5%</div>
<div class="text-sm text-amber-900">Performance Trade-off</div>
</div>
<div class="bg-blue-50 border border-blue-200 rounded-lg p-4">
<div class="text-2xl font-bold text-blue-700 mb-1">5 rounds</div>
<div class="text-sm text-blue-900">Training Duration</div>
</div>
</div>
<!-- Interpretation -->
<div class="mt-6 bg-gray-50 border border-gray-200 rounded-lg p-6">
<h4 class="font-semibold text-gray-900 mb-3">Interpretation for Implementers:</h4>
<ul class="space-y-2 text-sm text-gray-700">
<li class="flex items-start gap-2">
<span class="text-green-600 mt-0.5 flex-shrink-0"></span>
<span><strong>Governance Preserved:</strong> 100% coverage maintained - no violations observed across 5 rounds</span>
</li>
<li class="flex items-start gap-2">
<span class="text-amber-600 mt-0.5 flex-shrink-0"></span>
<span><strong>Performance Cost:</strong> 5% engagement reduction may be acceptable for high-stakes use cases (healthcare, finance, legal)</span>
</li>
<li class="flex items-start gap-2">
<span class="text-blue-600 mt-0.5 flex-shrink-0">?</span>
<span><strong>Open Question:</strong> Does performance gap close over more training rounds? Requires longer-term validation.</span>
</li>
</ul>
</div>
<!-- Limitations -->
<div class="mt-6 bg-red-50 border-2 border-red-200 rounded-lg p-6">
<h4 class="font-semibold text-red-900 mb-3 flex items-center gap-2">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/>
</svg>
Critical Limitations
</h4>
<ul class="space-y-2 text-sm text-red-800">
<li class="flex items-start gap-2">
<span class="flex-shrink-0"></span>
<span><strong>Scale:</strong> Only 5 training rounds - insufficient to claim production readiness</span>
</li>
<li class="flex items-start gap-2">
<span class="flex-shrink-0"></span>
<span><strong>Environment:</strong> Simulated interactions - not tested with real users</span>
</li>
<li class="flex items-start gap-2">
<span class="flex-shrink-0"></span>
<span><strong>Agent Count:</strong> Single agent - multi-agent scenarios untested</span>
</li>
<li class="flex items-start gap-2">
<span class="flex-shrink-0"></span>
<span><strong>Duration:</strong> Short-term only - long-term stability unknown</span>
</li>
<li class="flex items-start gap-2">
<span class="flex-shrink-0"></span>
<span><strong>Edge Cases:</strong> Adversarial inputs and stress testing not performed</span>
</li>
</ul>
<p class="mt-4 text-sm text-red-900 font-semibold">
⚠️ Do not use these numbers as production validation. Conduct your own testing in your specific context.
</p>
</div>
</div>
<!-- Call to Action -->
<div class="bg-gradient-to-r from-blue-600 to-purple-600 rounded-xl p-8 text-white">
<h3 class="text-2xl font-bold mb-4">🚀 Try the Integration</h3>
<p class="mb-6">
Download the install pack with Demo 2 (governed agent) and explore the integration yourself. Includes full source code, governance modules, and setup instructions.
</p>
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
<a href="/integrations/agent-lightning.html"
class="inline-flex items-center justify-center px-6 py-3 bg-white text-blue-700 font-semibold rounded-lg hover:bg-gray-100 transition">
Integration Guide →
</a>
<a href="/downloads/tractatus-agent-lightning-v1.0.tar.gz"
class="inline-flex items-center justify-center px-6 py-3 bg-blue-800 text-white font-semibold rounded-lg hover:bg-blue-900 transition border-2 border-white/20">
📦 Install Pack
</a>
<a href="https://discord.gg/Dkke2ADu4E" target="_blank" rel="noopener noreferrer"
class="inline-flex items-center justify-center px-6 py-3 bg-indigo-600 text-white font-semibold rounded-lg hover:bg-indigo-700 transition">
💬 Tractatus Discord
</a>
<a href="https://discord.gg/bVZtkceKsS" target="_blank" rel="noopener noreferrer"
class="inline-flex items-center justify-center px-6 py-3 bg-purple-600 text-white font-semibold rounded-lg hover:bg-purple-700 transition">
⚡ AL Discord
</a>
</div>
</div>
</div>
</div>
<!-- Development Roadmap -->
<div id="roadmap" class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16">
<h2 class="text-3xl font-bold text-gray-900 mb-4" data-i18n="roadmap.heading">Development Roadmap & Collaboration</h2>
@ -1412,16 +1690,16 @@ const govResponse = await fetch(
</section>
<!-- Footer -->
<script src="/js/i18n-simple.js?v=0.1.2.1761827148729"></script>
<script src="/js/components/language-selector.js?v=0.1.2.1761827148729"></script>
<script src="/js/scroll-animations.js?v=0.1.2.1761827148729"></script>
<script src="/js/page-transitions.js?v=0.1.2.1761827148729"></script>
<script src="/js/version-manager.js?v=0.1.2.1761827148729"></script>
<script src="/js/i18n-simple.js?v=0.1.2.1761957249779"></script>
<script src="/js/components/language-selector.js?v=0.1.2.1761957249779"></script>
<script src="/js/scroll-animations.js?v=0.1.2.1761957249779"></script>
<script src="/js/page-transitions.js?v=0.1.2.1761957249779"></script>
<script src="/js/version-manager.js?v=0.1.2.1761957249779"></script>
<!-- Share CTA functionality -->
<script src="/js/share-cta.js?v=0.1.2.1761827148729"></script>
<script src="/js/share-cta.js?v=0.1.2.1761957249779"></script>
<script src="/js/components/footer.js?v=0.1.2.1761827148729"></script>
<script src="/js/components/footer.js?v=0.1.2.1761957249779"></script>
</body>
</html>

View file

@ -38,10 +38,10 @@
<link rel="icon" type="image/svg+xml" href="/favicon-new.svg">
<!-- Fonts -->
<link rel="stylesheet" href="/css/fonts.css?v=0.1.2.1761827148729">
<link rel="stylesheet" href="/css/fonts.css?v=0.1.2.1761957249779">
<link rel="stylesheet" href="/css/tailwind.css?v=0.1.2.1761827148729">
<link rel="stylesheet" href="/css/tractatus-theme.min.css?v=0.1.2.1761827148729">
<link rel="stylesheet" href="/css/tailwind.css?v=0.1.2.1761957249779">
<link rel="stylesheet" href="/css/tractatus-theme.min.css?v=0.1.2.1761957249779">
<style>
.gradient-text { background: linear-gradient(120deg, #3b82f6 0%, #8b5cf6 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hover-lift { transition: transform 0.2s; }
@ -70,7 +70,7 @@
<!-- Navigation (injected by navbar.js) -->
<div id="navbar-placeholder" class="min-h-16"></div>
<script src="/js/components/navbar.js?v=0.1.2.1761827148729"></script>
<script src="/js/components/navbar.js?v=0.1.2.1761957249779"></script>
<!-- Hero Section -->
<header role="banner">
@ -86,7 +86,7 @@
</div>
<h1 class="text-5xl md:text-6xl font-bold mb-6 tracking-tight" class="text-shadow-md" data-i18n="hero.title">Tractatus: Architecture for Plural Moral Values</h1>
<p class="text-xl md:text-2xl mb-8 max-w-4xl mx-auto" class="text-shadow-sm" data-i18n="hero.subtitle">One architectural approach to governing AI at the coalface where decisions are made.<br>Not amoral AI systems, but plural moral values—enabling organizations to navigate<br>value conflicts thoughtfully. Tested on Claude Code.</p>
<p class="text-xl md:text-2xl mb-8 max-w-4xl mx-auto" class="text-shadow-sm" data-i18n="hero.subtitle">One architectural approach to governing AI at the coalface where decisions are made.<br>Not amoral AI systems, but plural moral values—enabling organizations to navigate<br>value conflicts thoughtfully. Now integrating with Agent Lightning for performance optimization.</p>
<div class="flex flex-col sm:flex-row gap-4 justify-center">
<a href="/architecture.html"
@ -95,11 +95,6 @@
<a href="/docs.html"
class="btn-base btn-primary inline-block"
data-i18n="hero.cta_docs">Read Documentation</a>
<a href="https://huggingface.co/spaces/tractatus-framework/audit-log-viewer"
target="_blank"
rel="noopener noreferrer"
class="inline-block px-8 py-3 rounded-lg font-semibold transition-all duration-300 bg-orange-600 text-white hover:bg-orange-700 hover:shadow-lg hover:-translate-y-1"
data-i18n="hero.cta_hf_space">🤗 Explore Audit Logs</a>
<a href="/faq.html"
class="btn-base btn-validator inline-block"
data-i18n="hero.cta_faq">FAQ</a>
@ -266,10 +261,11 @@
<div class="w-14 h-14 rounded-xl flex items-center justify-center text-2xl" class="bg-gradient-service-validator">
🔬
</div>
<div>
<div class="flex-1">
<h3 class="text-2xl font-bold text-gray-900 group-hover:text-purple-600 transition-colors" data-i18n="paths.researcher.title">Researcher</h3>
<p class="text-gray-600 text-sm" data-i18n="paths.researcher.subtitle">Academic & technical depth</p>
</div>
<span class="ml-auto bg-gradient-to-r from-purple-100 to-blue-100 text-purple-700 text-xs font-semibold px-3 py-1 rounded-full border border-purple-200">⚡ Now with AL</span>
</div>
<p class="text-gray-700 mb-6" data-i18n="paths.researcher.description">
@ -314,10 +310,11 @@ Explore the theoretical foundations, architectural constraints, and scholarly co
<div class="w-14 h-14 rounded-xl flex items-center justify-center text-2xl" class="bg-gradient-service-instruction">
⚙️
</div>
<div>
<div class="flex-1">
<h3 class="text-2xl font-bold text-gray-900 group-hover:text-indigo-600 transition-colors" data-i18n="paths.implementer.title">Implementer</h3>
<p class="text-gray-600 text-sm" data-i18n="paths.implementer.subtitle">Code & integration guides</p>
</div>
<span class="ml-auto bg-gradient-to-r from-purple-100 to-blue-100 text-purple-700 text-xs font-semibold px-3 py-1 rounded-full border border-purple-200">⚡ Now with AL</span>
</div>
<p class="text-gray-700 mb-6" data-i18n="paths.implementer.description">
@ -362,10 +359,11 @@ Get hands-on with implementation guides, API documentation, and reference code e
<div class="w-14 h-14 rounded-xl flex items-center justify-center text-2xl" class="bg-gradient-service-deliberation">
💼
</div>
<div>
<div class="flex-1">
<h3 class="text-2xl font-bold text-gray-900 group-hover:text-teal-600 transition-colors" data-i18n="paths.leader.title">Leader</h3>
<p class="text-gray-600 text-sm" data-i18n="paths.leader.subtitle">Strategic AI Safety</p>
</div>
<span class="ml-auto bg-gradient-to-r from-purple-100 to-blue-100 text-purple-700 text-xs font-semibold px-3 py-1 rounded-full border border-purple-200">⚡ Now with AL</span>
</div>
<p class="text-gray-700 mb-6" data-i18n="paths.leader.description">
@ -562,27 +560,89 @@ Handles plural moral values without imposing hierarchy—facilitates human judgm
</div>
</section>
<!-- Community Section -->
<section class="mb-16">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="bg-gradient-to-br from-purple-600 to-indigo-700 rounded-2xl p-8 md:p-12 text-white shadow-2xl">
<div class="text-center mb-10">
<h2 class="text-3xl md:text-4xl font-bold mb-4">Join the Community</h2>
<p class="text-xl text-purple-100 max-w-3xl mx-auto">
Connect with researchers, implementers, and leaders exploring agentic AI governance and Agent Lightning integration.
</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 max-w-4xl mx-auto">
<!-- Tractatus Discord -->
<div class="bg-white/10 backdrop-blur-sm rounded-xl p-6 border border-white/20 hover:bg-white/15 transition-all">
<div class="flex items-center gap-4 mb-4">
<svg class="w-12 h-12 flex-shrink-0" viewBox="0 0 24 24" fill="currentColor">
<path d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515a.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0a12.64 12.64 0 0 0-.617-1.25a.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057a19.9 19.9 0 0 0 5.993 3.03a.078.078 0 0 0 .084-.028a14.09 14.09 0 0 0 1.226-1.994a.076.076 0 0 0-.041-.106a13.107 13.107 0 0 1-1.872-.892a.077.077 0 0 1-.008-.128a10.2 10.2 0 0 0 .372-.292a.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127a12.299 12.299 0 0 1-1.873.892a.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028a19.839 19.839 0 0 0 6.002-3.03a.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419c0-1.333.956-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419c0-1.333.955-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.946 2.418-2.157 2.418z"/>
</svg>
<div>
<h3 class="text-xl font-bold">Tractatus Discord</h3>
<p class="text-sm text-purple-100">Governance-focused discussions</p>
</div>
</div>
<p class="text-white/90 text-sm mb-4">
Explore architectural constraints, research gaps, and governance frameworks for agentic AI systems.
</p>
<a href="https://discord.gg/Dkke2ADu4E" target="_blank" rel="noopener noreferrer"
class="inline-block w-full text-center bg-white text-purple-700 font-bold px-6 py-3 rounded-lg hover:bg-purple-50 transition-all shadow-md">
Join Tractatus Server →
</a>
</div>
<!-- Agent Lightning Discord -->
<div class="bg-white/10 backdrop-blur-sm rounded-xl p-6 border border-white/20 hover:bg-white/15 transition-all">
<div class="flex items-center gap-4 mb-4">
<svg class="w-12 h-12 flex-shrink-0" viewBox="0 0 24 24" fill="currentColor">
<path d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515a.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0a12.64 12.64 0 0 0-.617-1.25a.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057a19.9 19.9 0 0 0 5.993 3.03a.078.078 0 0 0 .084-.028a14.09 14.09 0 0 0 1.226-1.994a.076.076 0 0 0-.041-.106a13.107 13.107 0 0 1-1.872-.892a.077.077 0 0 1-.008-.128a10.2 10.2 0 0 0 .372-.292a.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127a12.299 12.299 0 0 1-1.873.892a.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028a19.839 19.839 0 0 0 6.002-3.03a.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419c0-1.333.956-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419c0-1.333.955-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.946 2.418-2.157 2.418z"/>
</svg>
<div>
<h3 class="text-xl font-bold">Agent Lightning Discord</h3>
<p class="text-sm text-purple-100">Technical implementation help</p>
</div>
</div>
<p class="text-white/90 text-sm mb-4">
Get support for Agent Lightning integration, RL optimization, and performance tuning questions.
</p>
<a href="https://discord.gg/bVZtkceKsS" target="_blank" rel="noopener noreferrer"
class="inline-block w-full text-center bg-white text-purple-700 font-bold px-6 py-3 rounded-lg hover:bg-purple-50 transition-all shadow-md">
Join Agent Lightning Server →
</a>
</div>
</div>
<div class="mt-8 text-center">
<p class="text-sm text-purple-100">
Both communities welcome researchers, implementers, and leaders at all experience levels.
</p>
</div>
</div>
</div>
</section>
</main>
<!-- Footer -->
<!-- Version Management & PWA -->
<script src="/js/version-manager.js?v=0.1.2.1761827148729"></script>
<script src="/js/version-manager.js?v=0.1.2.1761957249779"></script>
<!-- Share CTA functionality -->
<script src="/js/share-cta.js?v=0.1.2.1761827148729"></script>
<script src="/js/share-cta.js?v=0.1.2.1761957249779"></script>
<!-- Internationalization -->
<script src="/js/i18n-simple.js?v=0.1.2.1761827148729"></script>
<script src="/js/components/language-selector.js?v=0.1.2.1761827148729"></script>
<script src="/js/i18n-simple.js?v=0.1.2.1761957249779"></script>
<script src="/js/components/language-selector.js?v=0.1.2.1761957249779"></script>
<!-- Scroll Animations (Phase 3) -->
<script src="/js/scroll-animations.js?v=0.1.2.1761827148729"></script>
<script src="/js/scroll-animations.js?v=0.1.2.1761957249779"></script>
<!-- Page Transitions (Phase 3) -->
<script src="/js/page-transitions.js?v=0.1.2.1761827148729"></script>
<script src="/js/page-transitions.js?v=0.1.2.1761957249779"></script>
<!-- Footer Component -->
<script src="/js/components/footer.js?v=0.1.2.1761827148729"></script>
<script src="/js/components/footer.js?v=0.1.2.1761957249779"></script>
</body>
</html>

View file

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en" data-page="agent-lightning-integration">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Agent Lightning Integration | Tractatus AI Safety Framework</title>
<meta name="description" content="Integrating Microsoft's Agent Lightning reinforcement learning with Tractatus governance framework. Two-layer architecture maintaining safety boundaries through optimization cycles.">
<link rel="icon" type="image/svg+xml" href="/favicon-new.svg">
<link rel="stylesheet" href="/css/fonts.css?v=0.1.2.1761957249779">
<link rel="stylesheet" href="/css/tailwind.css?v=0.1.2.1761957249779">
<link rel="stylesheet" href="/css/tractatus-theme.min.css?v=0.1.2.1761957249779">
<style>
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 0; z-index: 100; background: white; padding: 1rem; }
</style>
</head>
<body class="bg-gray-50 text-gray-900">
<a href="#main-content" class="skip-link">Skip to main content</a>
<div id="navbar-placeholder"></div>
<main id="main-content" class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
<div class="text-center mb-16">
<div class="inline-flex items-center justify-center w-20 h-20 rounded-full bg-gradient-to-br from-purple-600 to-indigo-600 text-white text-4xl mb-6"></div>
<h1 class="text-4xl md:text-5xl font-bold text-gray-900 mb-4">Agent Lightning Integration</h1>
<p class="text-xl text-gray-600 max-w-3xl mx-auto">Combining Microsoft's reinforcement learning optimization with Tractatus governance through architectural separation</p>
</div>
<section class="mb-16 bg-white rounded-xl p-8 shadow-lg">
<h2 class="text-3xl font-bold text-gray-900 mb-6">Overview</h2>
<p class="text-gray-700 mb-4 text-lg">
<strong>Agent Lightning</strong> (Microsoft) uses reinforcement learning to optimize agentic AI systems through continuous training on human feedback.
</p>
<div class="bg-blue-50 border-l-4 border-blue-600 p-6 rounded-r-lg">
<p class="text-blue-900 font-semibold text-lg">
Tractatus addresses governance persistence through <strong>architectural separation</strong>: governance services run independently of the optimization layer.
</p>
</div>
</section>
<section class="mb-16 bg-gradient-to-br from-purple-50 to-blue-50 rounded-xl p-8">
<h2 class="text-3xl font-bold text-gray-900 mb-6">Join the Community</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="bg-gradient-to-br from-purple-600 to-indigo-600 text-white rounded-xl p-8 shadow-lg">
<h3 class="text-2xl font-bold mb-2">Tractatus Discord</h3>
<p class="text-purple-100 text-sm mb-4">Governance-focused discussions</p>
<a href="https://discord.gg/Dkke2ADu4E" target="_blank" class="inline-block bg-white text-purple-700 font-bold px-6 py-3 rounded-lg hover:bg-purple-50 transition-all">Join Tractatus Server →</a>
</div>
<div class="bg-gradient-to-br from-blue-600 to-cyan-600 text-white rounded-xl p-8 shadow-lg">
<h3 class="text-2xl font-bold mb-2">Agent Lightning Discord</h3>
<p class="text-blue-100 text-sm mb-4">Technical implementation help</p>
<a href="https://discord.gg/bVZtkceKsS" target="_blank" class="inline-block bg-white text-blue-700 font-bold px-6 py-3 rounded-lg hover:bg-blue-50 transition-all">Join Agent Lightning Server →</a>
</div>
</div>
</section>
</main>
<script src="/js/components/navbar.js"></script>
<script src="/js/components/feedback.js"></script>
</body>
</html>

View file

@ -0,0 +1,605 @@
/**
* Tractatus Framework - Governed Feedback Component
* Demonstrates Agent Lightning + Tractatus governance in action
*
* Features:
* - Floating Action Button (FAB) for quick access
* - Modal dialog for feedback submission
* - Mobile-optimized bottom sheet
* - Real-time governance pathway classification
* - Integration with BoundaryEnforcer, PluralisticDeliberator, CrossReferenceValidator
*/
class TractausFeedback {
constructor() {
this.isOpen = false;
this.isMobile = window.matchMedia('(max-width: 768px)').matches;
this.selectedType = null;
this.csrfToken = null;
this.init();
}
async init() {
// Get CSRF token
await this.fetchCsrfToken();
// Render components
this.renderFAB();
this.renderModal();
// Attach event listeners
this.attachEventListeners();
// Listen for window resize
window.addEventListener('resize', () => {
this.isMobile = window.matchMedia('(max-width: 768px)').matches;
});
// Listen for external open feedback requests (from navbar, etc.)
window.addEventListener('openFeedbackModal', () => {
this.openModal();
});
}
async fetchCsrfToken() {
try {
const response = await fetch('/api/csrf-token');
const data = await response.json();
this.csrfToken = data.csrfToken;
} catch (error) {
console.error('[Feedback] Failed to fetch CSRF token:', error);
}
}
/**
* Render Floating Action Button (FAB)
* Omnipresent on all pages for quick feedback access
*/
renderFAB() {
const fabHTML = `
<button id="feedback-fab"
class="fixed bottom-6 right-6 z-40 bg-gradient-to-r from-blue-600 to-blue-700 text-white p-4 rounded-full shadow-lg hover:shadow-xl hover:scale-110 transition-all duration-200 group flex items-center gap-2"
aria-label="Give Feedback"
title="Give Feedback">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z" />
</svg>
<span class="max-w-0 overflow-hidden group-hover:max-w-xs transition-all duration-300 whitespace-nowrap font-semibold">
Feedback
</span>
</button>
`;
document.body.insertAdjacentHTML('beforeend', fabHTML);
}
/**
* Render Feedback Modal/Bottom Sheet
* Adapts to mobile (bottom sheet) vs desktop (modal)
*/
renderModal() {
const modalHTML = `
<!-- Feedback Modal/Bottom Sheet -->
<div id="feedback-modal" class="hidden fixed inset-0 z-50" role="dialog" aria-modal="true" aria-labelledby="feedback-modal-title">
<!-- Backdrop -->
<div id="feedback-backdrop" class="absolute inset-0 bg-gray-900/60 backdrop-blur-sm transition-opacity"></div>
<!-- Modal/Sheet Container -->
<div id="feedback-container" class="absolute md:inset-0 md:flex md:items-center md:justify-center">
<!-- Modal Content -->
<div id="feedback-panel"
class="bg-white md:rounded-xl shadow-2xl w-full md:max-w-2xl md:mx-4
fixed bottom-0 left-0 right-0 md:relative
max-h-[85vh] md:max-h-[90vh] overflow-hidden
transform transition-transform duration-300 ease-out translate-y-full md:translate-y-0">
<!-- Header -->
<div class="flex justify-between items-center px-6 py-4 border-b border-gray-200 bg-gradient-to-r from-blue-50 to-blue-100">
<div>
<h2 id="feedback-modal-title" class="text-xl font-bold text-gray-900">Governed Feedback System</h2>
<p class="text-sm text-gray-600 mt-0.5">Powered by Tractatus + Agent Lightning</p>
</div>
<button id="feedback-close-btn" class="text-gray-500 hover:text-gray-700 p-2 rounded-lg hover:bg-white/50 transition" aria-label="Close">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
<!-- Content (scrollable) -->
<div class="overflow-y-auto max-h-[calc(85vh-120px)] md:max-h-[calc(90vh-180px)]">
<!-- Step 1: Type Selection -->
<div id="feedback-step-1" class="p-6">
<label class="block text-sm font-semibold text-gray-900 mb-3">What type of feedback do you have?</label>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
<button type="button" data-type="technical_question" class="feedback-type-btn p-4 border-2 border-gray-200 rounded-lg hover:border-blue-500 hover:bg-blue-50 transition text-left group">
<div class="flex items-start gap-3">
<span class="text-2xl">🔧</span>
<div>
<div class="font-semibold text-gray-900 group-hover:text-blue-700">Technical Question</div>
<div class="text-xs text-gray-500 mt-1">Installation, usage, bugs</div>
<div class="text-xs text-blue-600 mt-1.5 font-medium"> AI responds autonomously</div>
</div>
</div>
</button>
<button type="button" data-type="feature" class="feedback-type-btn p-4 border-2 border-gray-200 rounded-lg hover:border-blue-500 hover:bg-blue-50 transition text-left group">
<div class="flex items-start gap-3">
<span class="text-2xl">💡</span>
<div>
<div class="font-semibold text-gray-900 group-hover:text-blue-700">Feature Request</div>
<div class="text-xs text-gray-500 mt-1">Suggest new capabilities</div>
<div class="text-xs text-amber-600 mt-1.5 font-medium"> Requires deliberation</div>
</div>
</div>
</button>
<button type="button" data-type="research" class="feedback-type-btn p-4 border-2 border-gray-200 rounded-lg hover:border-blue-500 hover:bg-blue-50 transition text-left group">
<div class="flex items-start gap-3">
<span class="text-2xl">🔬</span>
<div>
<div class="font-semibold text-gray-900 group-hover:text-blue-700">Research Collaboration</div>
<div class="text-xs text-gray-500 mt-1">Co-authorship, joint research</div>
<div class="text-xs text-amber-600 mt-1.5 font-medium"> Requires deliberation</div>
</div>
</div>
</button>
<button type="button" data-type="commercial" class="feedback-type-btn p-4 border-2 border-gray-200 rounded-lg hover:border-blue-500 hover:bg-blue-50 transition text-left group">
<div class="flex items-start gap-3">
<span class="text-2xl">💼</span>
<div>
<div class="font-semibold text-gray-900 group-hover:text-blue-700">Commercial Inquiry</div>
<div class="text-xs text-gray-500 mt-1">Licensing, consulting, partnerships</div>
<div class="text-xs text-red-600 mt-1.5 font-medium"> Human review required</div>
</div>
</div>
</button>
<button type="button" data-type="bug" class="feedback-type-btn p-4 border-2 border-gray-200 rounded-lg hover:border-blue-500 hover:bg-blue-50 transition text-left group">
<div class="flex items-start gap-3">
<span class="text-2xl">🐛</span>
<div>
<div class="font-semibold text-gray-900 group-hover:text-blue-700">Bug Report</div>
<div class="text-xs text-gray-500 mt-1">Something isn't working</div>
<div class="text-xs text-blue-600 mt-1.5 font-medium"> AI responds autonomously</div>
</div>
</div>
</button>
<button type="button" data-type="general" class="feedback-type-btn p-4 border-2 border-gray-200 rounded-lg hover:border-blue-500 hover:bg-blue-50 transition text-left group">
<div class="flex items-start gap-3">
<span class="text-2xl">💬</span>
<div>
<div class="font-semibold text-gray-900 group-hover:text-blue-700">General Comment</div>
<div class="text-xs text-gray-500 mt-1">Other feedback</div>
<div class="text-xs text-blue-600 mt-1.5 font-medium"> AI responds autonomously</div>
</div>
</div>
</button>
</div>
<!-- Governance Info -->
<div class="mt-6 p-4 bg-blue-50 border border-blue-200 rounded-lg">
<div class="flex items-start gap-3">
<svg class="w-5 h-5 text-blue-600 mt-0.5 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<div class="text-sm">
<p class="font-semibold text-blue-900">How this works</p>
<p class="text-blue-700 mt-1">Your feedback is automatically classified by our <strong>BoundaryEnforcer</strong> to determine the appropriate response pathway. This ensures you get the right type of response while maintaining governance.</p>
</div>
</div>
</div>
</div>
<!-- Step 2: Feedback Form -->
<div id="feedback-step-2" class="hidden p-6">
<form id="feedback-form">
<!-- Pathway Indicator -->
<div id="pathway-indicator" class="mb-6 p-4 rounded-lg border-2"></div>
<!-- Content -->
<div class="mb-4">
<label for="feedback-content" class="block text-sm font-semibold text-gray-900 mb-2">Your Feedback</label>
<textarea id="feedback-content"
name="content"
rows="6"
class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition"
placeholder="Describe your feedback in detail..."
required></textarea>
<p class="text-xs text-gray-500 mt-1">Be specific to help us provide the best response.</p>
</div>
<!-- Optional Contact Info -->
<div class="mb-4">
<label class="block text-sm font-semibold text-gray-900 mb-2">Contact Information (Optional)</label>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
<input type="text"
id="feedback-name"
name="name"
class="px-4 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition"
placeholder="Your name">
<input type="email"
id="feedback-email"
name="email"
class="px-4 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition"
placeholder="your@email.com">
</div>
<p class="text-xs text-gray-500 mt-2">Provide your email if you'd like a response. We won't share your information.</p>
</div>
<!-- Governance Constraints Display -->
<div id="constraints-display" class="mb-6 p-4 bg-gray-50 border border-gray-200 rounded-lg">
<p class="text-xs font-semibold text-gray-700 mb-2">Governance Constraints:</p>
<ul id="constraints-list" class="text-xs text-gray-600 space-y-1"></ul>
</div>
<!-- Actions -->
<div class="flex gap-3">
<button type="button" id="feedback-back-btn" class="px-4 py-2.5 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition font-medium">
Back
</button>
<button type="submit" id="feedback-submit-btn" class="flex-1 px-6 py-2.5 bg-gradient-to-r from-blue-600 to-blue-700 text-white rounded-lg hover:shadow-lg transition font-semibold">
Submit Feedback
</button>
</div>
</form>
</div>
<!-- Step 3: Confirmation -->
<div id="feedback-step-3" class="hidden p-6">
<div class="text-center py-8">
<div class="w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4">
<svg class="w-8 h-8 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
</svg>
</div>
<h3 class="text-xl font-bold text-gray-900 mb-2">Feedback Received!</h3>
<p id="confirmation-message" class="text-gray-600 mb-4"></p>
<!-- Tracking Info -->
<div class="inline-block bg-gray-50 border border-gray-200 rounded-lg px-4 py-3 mb-6">
<p class="text-xs text-gray-500 mb-1">Tracking ID:</p>
<code id="tracking-id" class="text-sm font-mono text-blue-600"></code>
</div>
<!-- Governance Summary -->
<div id="governance-summary" class="bg-blue-50 border border-blue-200 rounded-lg p-4 text-left mb-6"></div>
<button id="feedback-done-btn" class="px-6 py-2.5 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition font-semibold">
Done
</button>
</div>
</div>
</div>
</div>
</div>
</div>
`;
document.body.insertAdjacentHTML('beforeend', modalHTML);
}
/**
* Attach all event listeners
*/
attachEventListeners() {
// FAB click - open modal
const fab = document.getElementById('feedback-fab');
if (fab) {
fab.addEventListener('click', () => this.openModal());
}
// Close buttons
const closeBtn = document.getElementById('feedback-close-btn');
const backdrop = document.getElementById('feedback-backdrop');
if (closeBtn) closeBtn.addEventListener('click', () => this.closeModal());
if (backdrop) backdrop.addEventListener('click', () => this.closeModal());
// Type selection buttons
const typeButtons = document.querySelectorAll('.feedback-type-btn');
typeButtons.forEach(btn => {
btn.addEventListener('click', () => {
this.selectedType = btn.getAttribute('data-type');
this.showStep2();
});
});
// Back button
const backBtn = document.getElementById('feedback-back-btn');
if (backBtn) {
backBtn.addEventListener('click', () => this.showStep1());
}
// Form submission
const form = document.getElementById('feedback-form');
if (form) {
form.addEventListener('submit', (e) => this.handleSubmit(e));
}
// Done button
const doneBtn = document.getElementById('feedback-done-btn');
if (doneBtn) {
doneBtn.addEventListener('click', () => this.closeModal());
}
}
/**
* Open feedback modal
*/
openModal() {
this.isOpen = true;
const modal = document.getElementById('feedback-modal');
const panel = document.getElementById('feedback-panel');
modal.classList.remove('hidden');
// Animate in
setTimeout(() => {
panel.classList.remove('translate-y-full');
panel.classList.add('translate-y-0');
}, 10);
// Prevent body scroll
document.body.style.overflow = 'hidden';
// Reset to step 1
this.showStep1();
}
/**
* Close feedback modal
*/
closeModal() {
this.isOpen = false;
const modal = document.getElementById('feedback-modal');
const panel = document.getElementById('feedback-panel');
// Animate out
panel.classList.remove('translate-y-0');
panel.classList.add('translate-y-full');
setTimeout(() => {
modal.classList.add('hidden');
}, 300);
// Restore body scroll
document.body.style.overflow = '';
// Reset form
this.resetForm();
}
/**
* Show step 1 (type selection)
*/
showStep1() {
document.getElementById('feedback-step-1').classList.remove('hidden');
document.getElementById('feedback-step-2').classList.add('hidden');
document.getElementById('feedback-step-3').classList.add('hidden');
}
/**
* Show step 2 (feedback form)
*/
showStep2() {
document.getElementById('feedback-step-1').classList.add('hidden');
document.getElementById('feedback-step-2').classList.remove('hidden');
document.getElementById('feedback-step-3').classList.add('hidden');
// Update pathway indicator based on type
this.updatePathwayIndicator();
}
/**
* Show step 3 (confirmation)
*/
showStep3(data) {
document.getElementById('feedback-step-1').classList.add('hidden');
document.getElementById('feedback-step-2').classList.add('hidden');
document.getElementById('feedback-step-3').classList.remove('hidden');
// Display confirmation message
const confirmationMessage = document.getElementById('confirmation-message');
confirmationMessage.textContent = data.message;
// Display tracking ID
const trackingId = document.getElementById('tracking-id');
trackingId.textContent = data.feedbackId;
// Display governance summary
this.displayGovernanceSummary(data);
}
/**
* Update pathway indicator based on selected type
*/
updatePathwayIndicator() {
const indicator = document.getElementById('pathway-indicator');
const constraintsList = document.getElementById('constraints-list');
const pathwayInfo = {
technical_question: {
pathway: 'Autonomous',
color: 'blue',
icon: '🤖',
description: 'AI will respond autonomously with technical information',
constraints: ['cite_documentation', 'no_financial_commitments', 'no_legal_advice', 'accurate_only']
},
bug: {
pathway: 'Autonomous',
color: 'blue',
icon: '🤖',
description: 'AI will respond autonomously with troubleshooting guidance',
constraints: ['cite_documentation', 'no_financial_commitments', 'accurate_only']
},
general: {
pathway: 'Autonomous',
color: 'blue',
icon: '🤖',
description: 'AI will respond autonomously with general information',
constraints: ['cite_documentation', 'no_financial_commitments', 'no_legal_advice', 'stay_on_topic']
},
feature: {
pathway: 'Deliberation',
color: 'amber',
icon: '⚖️',
description: 'Requires multi-stakeholder deliberation before response',
constraints: ['align_with_roadmap', 'assess_scope', 'community_benefit']
},
research: {
pathway: 'Deliberation',
color: 'amber',
icon: '⚖️',
description: 'Requires stakeholder consultation (maintainer, research lead, community)',
constraints: ['check_availability', 'align_with_research_gaps', 'assess_mutual_benefit']
},
commercial: {
pathway: 'Human Mandatory',
color: 'red',
icon: '👤',
description: 'Requires personal human review and response',
constraints: ['no_financial_commitments', 'no_pricing_discussion', 'refer_to_human']
}
};
const info = pathwayInfo[this.selectedType];
indicator.className = `mb-6 p-4 rounded-lg border-2 border-${info.color}-200 bg-${info.color}-50`;
indicator.innerHTML = `
<div class="flex items-start gap-3">
<span class="text-2xl">${info.icon}</span>
<div>
<p class="font-semibold text-${info.color}-900">Pathway: ${info.pathway}</p>
<p class="text-sm text-${info.color}-700 mt-1">${info.description}</p>
</div>
</div>
`;
// Display constraints
constraintsList.innerHTML = info.constraints.map(c => `
<li class="flex items-center gap-2">
<svg class="w-3 h-3 text-gray-500" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"/>
</svg>
${this.formatConstraint(c)}
</li>
`).join('');
}
/**
* Format constraint for display
*/
formatConstraint(constraint) {
const labels = {
cite_documentation: 'Must cite documentation',
no_financial_commitments: 'No financial commitments',
no_legal_advice: 'No legal advice',
accurate_only: 'Factually accurate only',
helpful_tone: 'Helpful, respectful tone',
stay_on_topic: 'Stay on topic',
align_with_roadmap: 'Align with roadmap',
assess_scope: 'Assess feasibility',
community_benefit: 'Community benefit assessment',
check_availability: 'Check maintainer availability',
align_with_research_gaps: 'Align with research priorities',
assess_mutual_benefit: 'Mutual benefit assessment',
no_pricing_discussion: 'No pricing discussion',
refer_to_human: 'Escalate to human'
};
return labels[constraint] || constraint;
}
/**
* Handle form submission
*/
async handleSubmit(e) {
e.preventDefault();
const submitBtn = document.getElementById('feedback-submit-btn');
submitBtn.disabled = true;
submitBtn.textContent = 'Submitting...';
try {
const formData = {
type: this.selectedType,
content: document.getElementById('feedback-content').value,
name: document.getElementById('feedback-name').value || null,
email: document.getElementById('feedback-email').value || null
};
const response = await fetch('/api/feedback/submit', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-Token': this.csrfToken
},
credentials: 'include',
body: JSON.stringify(formData)
});
const data = await response.json();
if (data.success) {
this.showStep3(data);
} else {
alert('Error: ' + (data.message || 'Failed to submit feedback'));
submitBtn.disabled = false;
submitBtn.textContent = 'Submit Feedback';
}
} catch (error) {
console.error('[Feedback] Submission error:', error);
alert('An error occurred. Please try again.');
submitBtn.disabled = false;
submitBtn.textContent = 'Submit Feedback';
}
}
/**
* Display governance summary after submission
*/
displayGovernanceSummary(data) {
const summary = document.getElementById('governance-summary');
const pathwayIcons = {
autonomous: '🤖',
deliberation: '⚖️',
human_mandatory: '👤'
};
summary.innerHTML = `
<div class="text-sm">
<p class="font-semibold text-blue-900 mb-3">Governance Summary</p>
<div class="space-y-2 text-blue-700">
<div class="flex items-center gap-2">
<span class="text-lg">${pathwayIcons[data.pathway]}</span>
<span><strong>Pathway:</strong> ${data.pathway.replace('_', ' ')}</span>
</div>
<div><strong>Classification:</strong> BoundaryEnforcer approved</div>
<div><strong>Tracking:</strong> <code class="text-xs bg-white px-2 py-0.5 rounded">${data.feedbackId}</code></div>
${data.trackingUrl ? `<div class="mt-3 pt-3 border-t border-blue-200"><a href="${data.trackingUrl}" class="text-blue-600 hover:text-blue-800 underline text-xs">Track status →</a></div>` : ''}
</div>
</div>
`;
}
/**
* Reset form to initial state
*/
resetForm() {
this.selectedType = null;
document.getElementById('feedback-form').reset();
this.showStep1();
}
}
// Auto-initialize when DOM is ready
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => new TractausFeedback());
} else {
new TractausFeedback();
}

View file

@ -35,9 +35,9 @@
<link rel="apple-touch-icon" href="/images/tractatus-icon-new.svg">
<link rel="icon" type="image/svg+xml" href="/favicon-new.svg">
<link rel="stylesheet" href="/css/fonts.css?v=0.1.2.1761827148729">
<link rel="stylesheet" href="/css/tailwind.css?v=0.1.2.1761827148729">
<link rel="stylesheet" href="/css/tractatus-theme.min.css?v=0.1.2.1761827148729">
<link rel="stylesheet" href="/css/fonts.css?v=0.1.2.1761957249779">
<link rel="stylesheet" href="/css/tailwind.css?v=0.1.2.1761957249779">
<link rel="stylesheet" href="/css/tractatus-theme.min.css?v=0.1.2.1761957249779">
<style>
.hover-lift { transition: all 0.3s ease; }
.hover-lift:hover { transform: translateY(-2px); }
@ -86,7 +86,7 @@
<a href="#main-content" class="skip-link">Skip to main content</a>
<script src="/js/components/navbar.js?v=0.1.2.1761827148729"></script>
<script src="/js/components/navbar.js?v=0.1.2.1761957249779"></script>
<!-- Breadcrumb Navigation -->
<nav class="bg-gray-50 border-b border-gray-200 py-3" aria-label="Breadcrumb">
@ -248,6 +248,200 @@
</div>
</section>
<!-- Agentic AI & Agent Lightning Integration -->
<section class="mb-16 bg-gradient-to-br from-purple-50 to-indigo-50 border-2 border-purple-200 rounded-xl p-8">
<div class="flex items-start gap-4 mb-6">
<div class="flex-shrink-0">
<div class="w-14 h-14 rounded-full bg-gradient-to-br from-purple-600 to-indigo-600 text-white flex items-center justify-center text-2xl">
</div>
</div>
<div class="flex-1">
<h2 class="text-3xl font-bold text-gray-900 mb-3">
Agentic AI at Scale: The Governance Challenge
</h2>
<p class="text-lg text-gray-700">
<strong>Question:</strong> Are you experimenting with agentic AI? If so, what security guardrails are you putting in place?
</p>
</div>
</div>
<!-- The Challenge -->
<div class="bg-white rounded-lg p-6 border border-purple-200 mb-6">
<h3 class="text-xl font-bold text-gray-900 mb-4">The Challenge: Governance Through Optimization</h3>
<p class="text-gray-700 mb-4">
Agentic AI systems increasingly use <strong>reinforcement learning</strong> to optimize performance through continuous training. Microsoft's <strong>Agent Lightning</strong> exemplifies this: agents learn from human feedback to improve responses over time.
</p>
<p class="text-gray-700 mb-4">
This creates a governance question: <strong>How do you maintain safety boundaries when the agent is learning and adapting?</strong>
</p>
<div class="bg-red-50 border-l-4 border-red-500 p-4 rounded-r-lg">
<p class="text-sm text-red-900 font-semibold mb-2">The Risk:</p>
<p class="text-sm text-red-800">
Traditional governance approaches assume static behavior. When agents optimize through training loops, instructions can fade, boundaries can drift, and audit trails can become unreliable. What worked in testing may not persist through production learning cycles.
</p>
</div>
</div>
<!-- The Tractatus Answer -->
<div class="bg-white rounded-lg p-6 border border-purple-200 mb-6">
<h3 class="text-xl font-bold text-gray-900 mb-4">Tractatus Approach: Architectural Separation</h3>
<p class="text-gray-700 mb-4">
Tractatus addresses this through <strong>external governance services</strong> that operate independently of the optimization layer:
</p>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
<div class="bg-blue-50 border-2 border-blue-200 rounded-lg p-4">
<h4 class="font-bold text-blue-900 mb-2">Optimization Layer</h4>
<p class="text-sm text-blue-800 mb-3">Agent Lightning trains agents to improve performance through reinforcement learning</p>
<ul class="text-xs text-blue-700 space-y-1">
<li>• Learns from human feedback</li>
<li>• Optimizes response quality</li>
<li>• Reduces compute requirements</li>
<li>• Adapts over time</li>
</ul>
</div>
<div class="bg-purple-50 border-2 border-purple-200 rounded-lg p-4">
<h4 class="font-bold text-purple-900 mb-2">Governance Layer</h4>
<p class="text-sm text-purple-800 mb-3">Tractatus enforces boundaries before actions execute</p>
<ul class="text-xs text-purple-700 space-y-1">
<li>• BoundaryEnforcer: Blocks unsafe decisions</li>
<li>• CrossReferenceValidator: Enforces constraints</li>
<li>• PluralisticDeliberator: Multi-stakeholder input</li>
<li>• PressureMonitor: Detects manipulation</li>
</ul>
</div>
</div>
<div class="bg-gray-100 border-l-4 border-gray-600 p-4 rounded-r-lg">
<p class="text-sm text-gray-800">
<strong>Key architectural principle:</strong> Governance services run <em>before</em> optimization. Agent Lightning never sees decisions that violate boundaries - they're blocked at the governance layer. Training happens only on approved actions.
</p>
</div>
</div>
<!-- What We're Learning -->
<div class="bg-white rounded-lg p-6 border border-purple-200 mb-6">
<h3 class="text-xl font-bold text-gray-900 mb-4">What We're Learning: Integration at Scale</h3>
<div class="bg-amber-50 border-2 border-amber-400 rounded-lg p-4 mb-4">
<div class="flex items-start gap-3">
<svg class="w-6 h-6 text-amber-600 mt-0.5 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<div>
<p class="font-semibold text-amber-900 mb-1">Research Status: Preliminary</p>
<p class="text-sm text-amber-800">
Demo 2 shows 100% governance coverage maintained through 5 training rounds (small-scale, simulated environment). This is <strong>not production validation</strong> - it's early evidence requiring real-world testing.
</p>
</div>
</div>
</div>
<p class="text-gray-700 mb-4">
We are working to integrate this framework at scale to answer critical questions:
</p>
<ul class="space-y-3 text-sm text-gray-700">
<li class="flex items-start gap-3">
<span class="text-purple-600 font-bold flex-shrink-0">1.</span>
<span><strong>Persistence:</strong> Do governance boundaries survive long-term training cycles (hundreds/thousands of rounds)?</span>
</li>
<li class="flex items-start gap-3">
<span class="text-purple-600 font-bold flex-shrink-0">2.</span>
<span><strong>Performance:</strong> Does the 5% engagement reduction close over time, or is it a persistent trade-off?</span>
</li>
<li class="flex items-start gap-3">
<span class="text-purple-600 font-bold flex-shrink-0">3.</span>
<span><strong>Adversarial resistance:</strong> Can governance withstand attempts to optimize around constraints?</span>
</li>
<li class="flex items-start gap-3">
<span class="text-purple-600 font-bold flex-shrink-0">4.</span>
<span><strong>Multi-agent scenarios:</strong> Does architectural separation hold when multiple agents interact?</span>
</li>
<li class="flex items-start gap-3">
<span class="text-purple-600 font-bold flex-shrink-0">5.</span>
<span><strong>Audit integrity:</strong> Do logs remain reliable evidence under regulatory review?</span>
</li>
</ul>
</div>
<!-- What This Means -->
<div class="bg-white rounded-lg p-6 border border-purple-200">
<h3 class="text-xl font-bold text-gray-900 mb-4">What This Means: Security Guardrails for Agentic AI</h3>
<div class="space-y-4 text-gray-700">
<div class="flex items-start gap-3">
<svg class="w-6 h-6 text-green-600 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<div>
<p class="font-semibold text-gray-900 mb-1">Persistent Governance</p>
<p class="text-sm">Instructions don't fade through training cycles - they're enforced architecturally, not through prompt engineering</p>
</div>
</div>
<div class="flex items-start gap-3">
<svg class="w-6 h-6 text-green-600 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<div>
<p class="font-semibold text-gray-900 mb-1">Audit Trail Continuity</p>
<p class="text-sm">Complete log of enforcement decisions across all training rounds - not just aspirational policies</p>
</div>
</div>
<div class="flex items-start gap-3">
<svg class="w-6 h-6 text-green-600 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<div>
<p class="font-semibold text-gray-900 mb-1">Human Agency Preserved</p>
<p class="text-sm">Optimization cannot bypass human approval requirements for values decisions - architectural blocking enforced</p>
</div>
</div>
<div class="flex items-start gap-3">
<svg class="w-6 h-6 text-green-600 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<div>
<p class="font-semibold text-gray-900 mb-1">Compliance Continuity</p>
<p class="text-sm">EU AI Act Article 14 (human oversight) remains satisfied even as agent learns - oversight is structural, not procedural</p>
</div>
</div>
</div>
<div class="mt-6 pt-6 border-t border-gray-200">
<p class="text-sm text-gray-600 italic">
<strong>Leadership opportunity:</strong> Organizations that establish persistent governance for agentic AI <em>now</em> position themselves ahead of inevitable regulatory requirements. Architectural enforcement demonstrates commitment beyond "we have policies."
</p>
</div>
</div>
<!-- Call to Action -->
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mt-6">
<a href="/integrations/agent-lightning.html"
class="inline-flex items-center justify-center px-6 py-3 bg-purple-600 text-white font-semibold rounded-lg hover:bg-purple-700 transition shadow-md">
Integration Guide →
</a>
<a href="/downloads/tractatus-agent-lightning-v1.0.tar.gz"
class="inline-flex items-center justify-center px-6 py-3 bg-white border-2 border-purple-600 text-purple-700 font-semibold rounded-lg hover:bg-purple-50 transition">
📦 Install Pack
</a>
<a href="https://discord.gg/Dkke2ADu4E" target="_blank" rel="noopener noreferrer"
class="inline-flex items-center justify-center px-6 py-3 bg-indigo-600 text-white font-semibold rounded-lg hover:bg-indigo-700 transition">
💬 Tractatus Discord
</a>
<a href="https://discord.gg/bVZtkceKsS" target="_blank" rel="noopener noreferrer"
class="inline-flex items-center justify-center px-6 py-3 bg-blue-600 text-white font-semibold rounded-lg hover:bg-blue-700 transition">
⚡ AL Discord
</a>
</div>
</section>
<!-- Governance Assessment Framework -->
<section class="mb-16">
<h2 class="text-2xl font-bold text-gray-900 mb-6" data-i18n="sections.governance_assessment.heading">Governance Theatre vs. Enforcement</h2>
@ -837,23 +1031,23 @@
<!-- Footer -->
<!-- Internationalization (must load first for footer translations) -->
<script src="/js/i18n-simple.js?v=0.1.2.1761827148729"></script>
<script src="/js/components/language-selector.js?v=0.1.2.1761827148729"></script>
<script src="/js/i18n-simple.js?v=0.1.2.1761957249779"></script>
<script src="/js/components/language-selector.js?v=0.1.2.1761957249779"></script>
<!-- Scroll Animations (Phase 3) -->
<script src="/js/scroll-animations.js?v=0.1.2.1761827148729"></script>
<script src="/js/scroll-animations.js?v=0.1.2.1761957249779"></script>
<!-- Page Transitions (Phase 3) -->
<script src="/js/page-transitions.js?v=0.1.2.1761827148729"></script>
<script src="/js/page-transitions.js?v=0.1.2.1761957249779"></script>
<!-- Version Management & PWA -->
<script src="/js/version-manager.js?v=0.1.2.1761827148729"></script>
<script src="/js/leader-page.js?v=0.1.2.1761827148729"></script>
<script src="/js/version-manager.js?v=0.1.2.1761957249779"></script>
<script src="/js/leader-page.js?v=0.1.2.1761957249779"></script>
<!-- Share CTA functionality -->
<script src="/js/share-cta.js?v=0.1.2.1761827148729"></script>
<script src="/js/share-cta.js?v=0.1.2.1761957249779"></script>
<!-- Footer Component -->
<script src="/js/components/footer.js?v=0.1.2.1761827148729"></script>
<script src="/js/components/footer.js?v=0.1.2.1761957249779"></script>
</body>
</html>

View file

@ -35,9 +35,9 @@
<link rel="apple-touch-icon" href="/images/tractatus-icon-new.svg">
<link rel="icon" type="image/svg+xml" href="/favicon-new.svg">
<link rel="stylesheet" href="/css/fonts.css?v=0.1.2.1761827148729">
<link rel="stylesheet" href="/css/tailwind.css?v=0.1.2.1761827148729">
<link rel="stylesheet" href="/css/tractatus-theme.min.css?v=0.1.2.1761827148729">
<link rel="stylesheet" href="/css/fonts.css?v=0.1.2.1761957249779">
<link rel="stylesheet" href="/css/tailwind.css?v=0.1.2.1761957249779">
<link rel="stylesheet" href="/css/tractatus-theme.min.css?v=0.1.2.1761957249779">
<style>
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 0; z-index: 100; background: white; padding: 1rem; }
@ -92,7 +92,7 @@
</div>
</noscript>
<script src="/js/components/navbar.js?v=0.1.2.1761827148729"></script>
<script src="/js/components/navbar.js?v=0.1.2.1761957249779"></script>
<!-- Breadcrumb Navigation -->
<nav class="bg-gray-50 border-b border-gray-200 py-3" aria-label="Breadcrumb">
@ -616,6 +616,175 @@
</div>
</section>
<!-- Agent Lightning Integration: Research Perspective -->
<section class="mb-16 bg-gradient-to-br from-purple-50 to-blue-50 border-2 border-purple-200 rounded-xl p-8">
<div class="flex items-start gap-4 mb-6">
<div class="flex-shrink-0">
<div class="w-14 h-14 rounded-full bg-gradient-to-br from-purple-600 to-indigo-600 text-white flex items-center justify-center text-2xl">
</div>
</div>
<div class="flex-1">
<h2 class="text-3xl font-bold text-gray-900 mb-3">
Agent Lightning Integration: Open Research Questions
</h2>
<p class="text-lg text-gray-700">
Exploring governance persistence through reinforcement learning optimization cycles
</p>
</div>
</div>
<!-- Research Context -->
<div class="bg-white rounded-lg p-6 border border-purple-200 mb-6">
<h3 class="text-xl font-bold text-gray-900 mb-4">🔬 Research Context</h3>
<p class="text-gray-700 mb-4">
Microsoft's <strong>Agent Lightning</strong> uses reinforcement learning to optimize agentic AI performance through continuous training on human feedback. This creates a natural research question for governance frameworks:
</p>
<div class="bg-blue-50 border-l-4 border-blue-600 p-4 rounded-r-lg">
<p class="text-blue-900 font-semibold">
Can architectural governance constraints persist through long-term optimization cycles?
</p>
</div>
<p class="text-gray-700 mt-4">
Traditional governance assumes relatively static AI behavior. Reinforcement learning introduces <strong>dynamic adaptation</strong> - the agent's behavior changes over time. Does this erode governance boundaries, or can they be maintained through architectural separation?
</p>
</div>
<!-- What We've Validated -->
<div class="bg-white rounded-lg p-6 border border-purple-200 mb-6">
<h3 class="text-xl font-bold text-gray-900 mb-4">✅ What We've Validated (Demo 2)</h3>
<div class="bg-amber-50 border-2 border-amber-400 rounded-lg p-4 mb-4">
<div class="flex items-start gap-3">
<svg class="w-6 h-6 text-amber-600 mt-0.5 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
</svg>
<div>
<p class="font-semibold text-amber-900 mb-1">Validation Status: Small-Scale Only</p>
<p class="text-sm text-amber-800">
Results below are from <strong>5 training rounds, single agent, simulated environment</strong>. This is preliminary evidence, not production validation. Treat findings as suggestive, requiring replication at scale.
</p>
</div>
</div>
</div>
<p class="text-gray-700 mb-4">
Demo 2 tested whether Tractatus governance services could maintain boundaries while Agent Lightning optimized performance. Early findings suggest:
</p>
<div class="space-y-3 mb-4">
<div class="flex items-start gap-3">
<span class="text-green-600 font-bold flex-shrink-0"></span>
<div>
<p class="font-semibold text-gray-900">Governance Coverage Maintained</p>
<p class="text-sm text-gray-700">100% of decisions passed through BoundaryEnforcer across all 5 training rounds - no governance bypass detected</p>
</div>
</div>
<div class="flex items-start gap-3">
<span class="text-green-600 font-bold flex-shrink-0"></span>
<div>
<p class="font-semibold text-gray-900">Performance Optimization Successful</p>
<p class="text-sm text-gray-700">Agent Lightning reduced task completion time by 23% while maintaining near-baseline success rate (97% vs 98%)</p>
</div>
</div>
<div class="flex items-start gap-3">
<span class="text-green-600 font-bold flex-shrink-0"></span>
<div>
<p class="font-semibold text-gray-900">Architectural Separation Held</p>
<p class="text-sm text-gray-700">Governance layer operated independently - AL training loops did not modify boundary constraints</p>
</div>
</div>
</div>
<div class="text-sm text-gray-600 bg-gray-50 p-4 rounded border border-gray-200">
<strong>Interpretation:</strong> These results <em>suggest</em> that architectural separation can maintain governance through optimization cycles, but this is far from proven. 5 rounds is insufficient to demonstrate long-term persistence. Real-world validation with hundreds/thousands of training rounds is needed.
</div>
</div>
<!-- Open Research Questions -->
<div class="bg-white rounded-lg p-6 border border-purple-200 mb-6">
<h3 class="text-xl font-bold text-gray-900 mb-4">❓ Open Research Questions</h3>
<p class="text-gray-700 mb-4">
These questions represent genuine research gaps we're actively investigating. We welcome collaboration from researchers working on similar problems:
</p>
<div class="space-y-4">
<div class="border-l-4 border-purple-400 bg-purple-50 p-4 rounded-r-lg">
<p class="font-semibold text-purple-900 mb-2">1. Long-Term Persistence at Scale</p>
<p class="text-sm text-gray-700">
Does governance coverage maintain through 1,000+ training rounds? At what point (if any) do optimization pressures begin to erode architectural boundaries? Do we see different persistence patterns across different agent types or task domains?
</p>
</div>
<div class="border-l-4 border-purple-400 bg-purple-50 p-4 rounded-r-lg">
<p class="font-semibold text-purple-900 mb-2">2. Performance Trade-offs Under Governance</p>
<p class="text-sm text-gray-700">
Demo 2 showed minimal performance degradation (98% → 97% success rate). Is this consistent across different task complexities? Are there task types where governance constraints significantly impair Agent Lightning's ability to optimize?
</p>
</div>
<div class="border-l-4 border-purple-400 bg-purple-50 p-4 rounded-r-lg">
<p class="font-semibold text-purple-900 mb-2">3. Multi-Agent Governance Coordination</p>
<p class="text-sm text-gray-700">
Demo 2 validated single-agent scenarios. How does governance scale when multiple agents (each with AL optimization) interact? Do boundary conflicts emerge? Can PluralisticDeliberator handle multi-agent stakeholder deliberations efficiently?
</p>
</div>
<div class="border-l-4 border-purple-400 bg-purple-50 p-4 rounded-r-lg">
<p class="font-semibold text-purple-900 mb-2">4. Adversarial Optimization Pressure</p>
<p class="text-sm text-gray-700">
What happens when training data or feedback contains attempts to bypass governance? Can Agent Lightning's optimization inadvertently discover governance workarounds? How robust is ContextPressureMonitor to sophisticated manipulation attempts embedded in training loops?
</p>
</div>
<div class="border-l-4 border-purple-400 bg-purple-50 p-4 rounded-r-lg">
<p class="font-semibold text-purple-900 mb-2">5. Generalization Across LLM Architectures</p>
<p class="text-sm text-gray-700">
Demo 2 used Claude Code (Anthropic). Does the Tractatus + Agent Lightning integration maintain governance coverage when using different base models (GPT-4, Gemini, Llama, etc.)? Are there model-specific vulnerabilities?
</p>
</div>
</div>
</div>
<!-- Collaboration & Resources -->
<div class="bg-white rounded-lg p-6 border border-purple-200">
<h3 class="text-xl font-bold text-gray-900 mb-4">🤝 Collaboration & Community</h3>
<p class="text-gray-700 mb-4">
We're building a research community focused on agentic AI governance. If you're working on related problems - reinforcement learning safety, multi-agent governance, constraint persistence - we'd like to hear from you.
</p>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<a href="https://discord.gg/Dkke2ADu4E" target="_blank" class="flex items-center gap-3 p-4 bg-gradient-to-r from-purple-600 to-indigo-600 text-white rounded-lg hover:shadow-lg transition-all">
<svg class="w-8 h-8 flex-shrink-0" viewBox="0 0 24 24" fill="currentColor">
<path d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515a.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0a12.64 12.64 0 0 0-.617-1.25a.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057a19.9 19.9 0 0 0 5.993 3.03a.078.078 0 0 0 .084-.028a14.09 14.09 0 0 0 1.226-1.994a.076.076 0 0 0-.041-.106a13.107 13.107 0 0 1-1.872-.892a.077.077 0 0 1-.008-.128a10.2 10.2 0 0 0 .372-.292a.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127a12.299 12.299 0 0 1-1.873.892a.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028a19.839 19.839 0 0 0 6.002-3.03a.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419c0-1.333.956-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419c0-1.333.955-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.946 2.418-2.157 2.418z"/>
</svg>
<div>
<p class="font-bold">Join Tractatus Discord</p>
<p class="text-xs opacity-90">Governance-focused discussions</p>
</div>
</a>
<a href="https://discord.gg/bVZtkceKsS" target="_blank" class="flex items-center gap-3 p-4 bg-gradient-to-r from-blue-600 to-cyan-600 text-white rounded-lg hover:shadow-lg transition-all">
<svg class="w-8 h-8 flex-shrink-0" viewBox="0 0 24 24" fill="currentColor">
<path d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515a.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0a12.64 12.64 0 0 0-.617-1.25a.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057a19.9 19.9 0 0 0 5.993 3.03a.078.078 0 0 0 .084-.028a14.09 14.09 0 0 0 1.226-1.994a.076.076 0 0 0-.041-.106a13.107 13.107 0 0 1-1.872-.892a.077.077 0 0 1-.008-.128a10.2 10.2 0 0 0 .372-.292a.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127a12.299 12.299 0 0 1-1.873.892a.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028a19.839 19.839 0 0 0 6.002-3.03a.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419c0-1.333.956-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419c0-1.333.955-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.946 2.418-2.157 2.418z"/>
</svg>
<div>
<p class="font-bold">Join Agent Lightning Discord</p>
<p class="text-xs opacity-90">Technical implementation help</p>
</div>
</a>
</div>
<div class="mt-4 p-4 bg-gray-50 rounded border border-gray-200">
<p class="text-sm text-gray-700">
<strong>Research collaboration:</strong> If you're investigating governance persistence, multi-agent coordination, or RL safety under constraints, we're interested in cross-validation studies. Reach out via Discord or email research inquiries to the team.
</p>
</div>
</div>
</section>
<!-- Limitations & Future Research -->
<section class="mb-16">
<h2 class="text-2xl font-bold text-gray-900 mb-6" data-i18n="sections.limitations.heading">Limitations & Future Research Directions</h2>
@ -1294,23 +1463,23 @@
<!-- Footer -->
<!-- Internationalization (must load first for footer translations) -->
<script src="/js/i18n-simple.js?v=0.1.2.1761827148729"></script>
<script src="/js/components/language-selector.js?v=0.1.2.1761827148729"></script>
<script src="/js/i18n-simple.js?v=0.1.2.1761957249779"></script>
<script src="/js/components/language-selector.js?v=0.1.2.1761957249779"></script>
<!-- Scroll Animations (Phase 3) -->
<script src="/js/scroll-animations.js?v=0.1.2.1761827148729"></script>
<script src="/js/scroll-animations.js?v=0.1.2.1761957249779"></script>
<!-- Page Transitions (Phase 3) -->
<script src="/js/page-transitions.js?v=0.1.2.1761827148729"></script>
<script src="/js/page-transitions.js?v=0.1.2.1761957249779"></script>
<!-- Version Management & PWA -->
<script src="/js/version-manager.js?v=0.1.2.1761827148729"></script>
<script src="/js/researcher-page.js?v=0.1.2.1761827148729"></script>
<script src="/js/version-manager.js?v=0.1.2.1761957249779"></script>
<script src="/js/researcher-page.js?v=0.1.2.1761957249779"></script>
<!-- Share CTA functionality -->
<script src="/js/share-cta.js?v=0.1.2.1761827148729"></script>
<script src="/js/share-cta.js?v=0.1.2.1761957249779"></script>
<!-- Footer Component -->
<script src="/js/components/footer.js?v=0.1.2.1761827148729"></script>
<script src="/js/components/footer.js?v=0.1.2.1761957249779"></script>
</body>
</html>

View file

@ -0,0 +1,553 @@
/**
* Feedback Controller
* Handle feedback submissions with Tractatus governance
*/
const Feedback = require('../models/Feedback.model');
const {
BoundaryEnforcer,
PluralisticDeliberator,
CrossReferenceValidator
} = require('../services/feedback-governance.service');
const logger = require('../utils/logger.util');
const { getClientIp } = require('../utils/security-logger');
// Initialize governance components
const boundaryEnforcer = new BoundaryEnforcer();
const deliberator = new PluralisticDeliberator();
const validator = new CrossReferenceValidator();
/**
* POST /api/feedback/submit
* Submit feedback with automatic governance classification
*/
async function submit(req, res) {
try {
const { type, content, name, email } = req.body;
// Step 1: Classify feedback and determine governance pathway
const classification = boundaryEnforcer.classify(type, content);
// Step 2: Validate classification
const classificationValidation = boundaryEnforcer.validate(classification);
if (!classificationValidation.valid) {
logger.error('[Feedback] Invalid classification:', classificationValidation.error);
return res.status(500).json({
success: false,
error: 'Classification error',
message: 'Unable to classify feedback. Please try again.'
});
}
// Step 3: Create feedback record with governance data
const feedback = await Feedback.create({
type,
pathway: classification.pathway,
content,
submittedBy: { name, email },
metadata: {
user_agent: req.get('user-agent'),
ip: getClientIp(req),
source_page: req.get('referer'),
referrer: req.get('referer')
},
governance: {
boundaryCheck: 'completed',
deliberationRequired: classification.pathway === 'deliberation',
stakeholders: classification.stakeholders || [],
constraints: classification.constraints,
classificationReason: classification.reason
}
});
// Step 4: If deliberation required, initiate deliberation process
if (classification.pathway === 'deliberation') {
const deliberation = await deliberator.initiate(
feedback.feedbackId,
classification.stakeholders,
content
);
await Feedback.update(feedback.feedbackId, {
'governance.deliberationId': deliberation.deliberationId,
'governance.deliberationStatus': 'awaiting_votes',
'governance.deliberationDeadline': deliberation.deadline
});
logger.info(`[Feedback] Deliberation initiated: ${deliberation.deliberationId}`);
}
logger.info(`[Feedback] New submission: ${feedback.feedbackId} | Pathway: ${classification.pathway}`);
// Step 5: Return appropriate response based on pathway
const messages = {
autonomous: 'Thank you! An AI assistant will respond shortly with relevant information.',
deliberation: 'Thank you! Your feedback requires multi-stakeholder review. You will receive a response within 72 hours.',
human_mandatory: 'Thank you! Your inquiry requires personal attention. You will receive a response within 48 hours.'
};
res.status(201).json({
success: true,
message: messages[classification.pathway],
feedbackId: feedback.feedbackId,
pathway: classification.pathway,
trackingUrl: `/api/feedback/status/${feedback.feedbackId}`
});
} catch (error) {
logger.error('[Feedback] Submit error:', error);
res.status(500).json({
success: false,
error: 'Failed to submit feedback',
message: 'An error occurred. Please try again.'
});
}
}
/**
* GET /api/feedback/status/:feedbackId
* Check status of feedback submission (public)
*/
async function getStatus(req, res) {
try {
const { feedbackId } = req.params;
const feedback = await Feedback.findById(feedbackId);
if (!feedback) {
return res.status(404).json({
success: false,
error: 'Feedback not found'
});
}
// Return limited public information
res.json({
success: true,
feedbackId: feedback.feedbackId,
status: feedback.status,
pathway: feedback.pathway,
submittedAt: feedback.created_at,
hasResponse: !!feedback.response.content,
responsePreview: feedback.response.content
? feedback.response.content.substring(0, 200) + '...'
: null
});
} catch (error) {
logger.error('[Feedback] Get status error:', error);
res.status(500).json({
success: false,
error: 'Failed to fetch status'
});
}
}
/**
* GET /api/feedback/admin/stats
* Get feedback statistics (admin)
*/
async function getStats(req, res) {
try {
const stats = await Feedback.getStatistics();
res.json({
success: true,
stats
});
} catch (error) {
logger.error('[Feedback] Stats error:', error);
res.status(500).json({
success: false,
error: 'Failed to fetch statistics'
});
}
}
/**
* GET /api/feedback/admin/queue
* Get feedback queue filtered by pathway
*/
async function getQueue(req, res) {
try {
const { pathway, status = 'pending', limit = 20, skip = 0 } = req.query;
if (!pathway) {
return res.status(400).json({
success: false,
error: 'Pathway parameter required (autonomous, deliberation, human_mandatory)'
});
}
const feedback = await Feedback.findByPathway(pathway, {
status,
limit: parseInt(limit),
skip: parseInt(skip)
});
res.json({
success: true,
pathway,
queue: feedback,
count: feedback.length
});
} catch (error) {
logger.error('[Feedback] Queue error:', error);
res.status(500).json({
success: false,
error: 'Failed to fetch queue'
});
}
}
/**
* GET /api/feedback/admin/list
* List all feedback with filtering
*/
async function list(req, res) {
try {
const { status, pathway, limit = 20, skip = 0 } = req.query;
let feedback;
if (pathway) {
feedback = await Feedback.findByPathway(pathway, {
status,
limit: parseInt(limit),
skip: parseInt(skip)
});
} else if (status) {
feedback = await Feedback.findByStatus(status, {
limit: parseInt(limit),
skip: parseInt(skip)
});
} else {
feedback = await Feedback.getRecent(parseInt(limit));
}
res.json({
success: true,
feedback,
count: feedback.length
});
} catch (error) {
logger.error('[Feedback] List error:', error);
res.status(500).json({
success: false,
error: 'Failed to fetch feedback'
});
}
}
/**
* GET /api/feedback/admin/:id
* Get single feedback by ID
*/
async function getById(req, res) {
try {
const { id } = req.params;
const feedback = await Feedback.findById(id);
if (!feedback) {
return res.status(404).json({
success: false,
error: 'Feedback not found'
});
}
res.json({
success: true,
feedback
});
} catch (error) {
logger.error('[Feedback] Get by ID error:', error);
res.status(500).json({
success: false,
error: 'Failed to fetch feedback'
});
}
}
/**
* POST /api/feedback/admin/:id/response
* Add response to feedback (human or AI)
*/
async function addResponse(req, res) {
try {
const { id } = req.params;
const { content, respondedBy } = req.body;
const feedback = await Feedback.findById(id);
if (!feedback) {
return res.status(404).json({
success: false,
error: 'Feedback not found'
});
}
// If AI response, validate against constraints
let validationResult = null;
if (respondedBy === 'ai') {
validationResult = validator.validate(content, feedback.governance.constraints);
if (!validationResult.valid) {
const report = validator.getReport(validationResult);
if (report.critical > 0) {
logger.warn('[Feedback] AI response blocked - critical violations:', validationResult.violations);
return res.status(400).json({
success: false,
error: 'AI response violates governance constraints',
violations: validationResult.violations,
recommendation: report.recommendation
});
}
// Warnings allowed but logged
logger.warn('[Feedback] AI response has warnings:', validationResult.violations);
}
}
// Add response to feedback
await Feedback.addResponse(id, {
content,
respondedBy, // 'ai', 'human', or 'deliberated'
validatedBy: respondedBy === 'ai' ? 'CrossReferenceValidator' : null,
validationStatus: validationResult ? (validationResult.valid ? 'pass' : 'warning') : null
});
logger.info(`[Feedback] Response added to ${feedback.feedbackId} by ${respondedBy}`);
res.json({
success: true,
message: 'Response added successfully',
validation: validationResult ? validator.getReport(validationResult) : null
});
} catch (error) {
logger.error('[Feedback] Add response error:', error);
res.status(500).json({
success: false,
error: 'Failed to add response'
});
}
}
/**
* POST /api/feedback/admin/:id/deliberate
* Initiate deliberation process for feedback
*/
async function initiateDeliberation(req, res) {
try {
const { id } = req.params;
const { stakeholders } = req.body;
const feedback = await Feedback.findById(id);
if (!feedback) {
return res.status(404).json({
success: false,
error: 'Feedback not found'
});
}
if (feedback.pathway !== 'deliberation') {
return res.status(400).json({
success: false,
error: 'Feedback does not require deliberation',
currentPathway: feedback.pathway
});
}
const deliberation = await deliberator.initiate(
feedback.feedbackId,
stakeholders || feedback.governance.stakeholders,
feedback.content
);
await Feedback.update(id, {
'governance.deliberationId': deliberation.deliberationId,
'governance.deliberationStatus': 'awaiting_votes',
'governance.deliberationDeadline': deliberation.deadline,
status: 'in_progress'
});
logger.info(`[Feedback] Deliberation initiated: ${deliberation.deliberationId}`);
res.json({
success: true,
message: 'Deliberation initiated',
deliberation
});
} catch (error) {
logger.error('[Feedback] Initiate deliberation error:', error);
res.status(500).json({
success: false,
error: 'Failed to initiate deliberation'
});
}
}
/**
* POST /api/feedback/admin/deliberation/:deliberationId/vote
* Submit vote for deliberation
*/
async function submitVote(req, res) {
try {
const { deliberationId } = req.params;
const { vote, constraints } = req.body;
// In production, this would:
// 1. Record vote in database
// 2. Check if all stakeholders voted
// 3. If complete, process deliberation result
// 4. Update feedback with deliberation outcome
// For now, simulated vote processing
const votes = [
{ stakeholder: req.user.id, vote, constraints }
// In production, fetch all votes from database
];
const result = await deliberator.process(deliberationId, votes);
logger.info(`[Feedback] Vote submitted for ${deliberationId}: ${vote}`);
res.json({
success: true,
message: 'Vote recorded',
deliberationResult: result
});
} catch (error) {
logger.error('[Feedback] Submit vote error:', error);
res.status(500).json({
success: false,
error: 'Failed to submit vote'
});
}
}
/**
* POST /api/feedback/ai/generate-response
* AI generates response and validates against constraints
*/
async function validateAIResponse(req, res) {
try {
const { feedbackId, aiResponse } = req.body;
const feedback = await Feedback.findById(feedbackId);
if (!feedback) {
return res.status(404).json({
success: false,
error: 'Feedback not found'
});
}
// Validate AI response against constraints
const validationResult = validator.validate(aiResponse, feedback.governance.constraints);
const report = validator.getReport(validationResult);
res.json({
success: true,
validation: validationResult,
report,
approved: report.critical === 0
});
} catch (error) {
logger.error('[Feedback] Validate AI response error:', error);
res.status(500).json({
success: false,
error: 'Failed to validate AI response'
});
}
}
/**
* PUT /api/feedback/admin/:id
* Update feedback
*/
async function update(req, res) {
try {
const { id } = req.params;
const { status, priority } = req.body;
const updateData = {};
if (status) updateData.status = status;
if (priority) updateData.priority = priority;
await Feedback.update(id, updateData);
logger.info(`[Feedback] Updated ${id}:`, updateData);
res.json({
success: true,
message: 'Feedback updated successfully'
});
} catch (error) {
logger.error('[Feedback] Update error:', error);
res.status(500).json({
success: false,
error: 'Failed to update feedback'
});
}
}
/**
* DELETE /api/feedback/admin/:id
* Delete feedback
*/
async function deleteFeedback(req, res) {
try {
const { id } = req.params;
const feedback = await Feedback.findById(id);
if (!feedback) {
return res.status(404).json({
success: false,
error: 'Feedback not found'
});
}
// In production, implement soft delete or archive
// For now, log the deletion request
logger.warn(`[Feedback] Delete requested for ${feedback.feedbackId}`);
res.json({
success: true,
message: 'Feedback deletion logged (implement soft delete in production)'
});
} catch (error) {
logger.error('[Feedback] Delete error:', error);
res.status(500).json({
success: false,
error: 'Failed to delete feedback'
});
}
}
module.exports = {
submit,
getStatus,
getStats,
getQueue,
list,
getById,
addResponse,
initiateDeliberation,
submitVote,
validateAIResponse,
update,
deleteFeedback
};

View file

@ -0,0 +1,240 @@
/**
* Feedback Model
* Governed feedback system demonstrating Tractatus + Agent Lightning integration
*
* Three pathways:
* - autonomous: AI responds (technical questions, bugs)
* - deliberation: Multi-stakeholder review (research collaboration, features)
* - human_mandatory: Human-only response (commercial, legal, strategic)
*/
const { ObjectId } = require('mongodb');
const { getCollection } = require('../utils/db.util');
class Feedback {
/**
* Create a new feedback submission
*/
static async create(data) {
const collection = await getCollection('feedback');
const feedback = {
feedbackId: data.feedbackId || this.generateFeedbackId(),
type: data.type, // technical_question, research, commercial, feature, bug, general
pathway: data.pathway, // autonomous, deliberation, human_mandatory
content: data.content,
submittedBy: {
name: data.submittedBy?.name || null,
email: data.submittedBy?.email || null
},
metadata: {
user_agent: data.metadata?.user_agent,
ip: data.metadata?.ip,
source_page: data.metadata?.source_page,
referrer: data.metadata?.referrer
},
governance: {
boundaryCheck: data.governance?.boundaryCheck || 'pending',
deliberationRequired: data.governance?.deliberationRequired || false,
stakeholders: data.governance?.stakeholders || [],
consensus: data.governance?.consensus || null,
constraints: data.governance?.constraints || [],
classificationReason: data.governance?.classificationReason || null
},
response: {
content: data.response?.content || null,
respondedBy: data.response?.respondedBy || null, // ai, human, deliberated
respondedAt: data.response?.respondedAt || null,
validatedBy: data.response?.validatedBy || null,
validationStatus: data.response?.validationStatus || null
},
status: data.status || 'pending', // pending, in_progress, responded, closed
created_at: new Date(),
updated_at: new Date()
};
const result = await collection.insertOne(feedback);
return { ...feedback, _id: result.insertedId };
}
/**
* Generate unique feedback ID
*/
static generateFeedbackId() {
const timestamp = Date.now();
const random = Math.random().toString(36).substring(2, 8);
return `fb_${timestamp}_${random}`;
}
/**
* Find feedback by ID or feedbackId
*/
static async findById(id) {
const collection = await getCollection('feedback');
// Try ObjectId first, then feedbackId string
try {
const byObjectId = await collection.findOne({ _id: new ObjectId(id) });
if (byObjectId) return byObjectId;
} catch (e) {
// Not a valid ObjectId, continue
}
return await collection.findOne({ feedbackId: id });
}
/**
* Find feedback by pathway type
*/
static async findByPathway(pathway, options = {}) {
const collection = await getCollection('feedback');
const { limit = 20, skip = 0, status } = options;
const query = { pathway };
if (status) query.status = status;
return await collection
.find(query)
.sort({ created_at: -1 })
.skip(skip)
.limit(limit)
.toArray();
}
/**
* Find feedback by status
*/
static async findByStatus(status, options = {}) {
const collection = await getCollection('feedback');
const { limit = 20, skip = 0 } = options;
return await collection
.find({ status })
.sort({ created_at: -1 })
.skip(skip)
.limit(limit)
.toArray();
}
/**
* Update feedback
*/
static async update(id, updates) {
const collection = await getCollection('feedback');
const updateData = {
...updates,
updated_at: new Date()
};
// Try ObjectId first, then feedbackId string
try {
const result = await collection.updateOne(
{ _id: new ObjectId(id) },
{ $set: updateData }
);
if (result.matchedCount > 0) return result;
} catch (e) {
// Not a valid ObjectId, try feedbackId
}
return await collection.updateOne(
{ feedbackId: id },
{ $set: updateData }
);
}
/**
* Add response to feedback
*/
static async addResponse(id, responseData) {
const collection = await getCollection('feedback');
const response = {
content: responseData.content,
respondedBy: responseData.respondedBy, // ai, human, deliberated
respondedAt: new Date(),
validatedBy: responseData.validatedBy || null,
validationStatus: responseData.validationStatus || 'pass'
};
const updateData = {
response,
status: 'responded',
updated_at: new Date()
};
try {
const result = await collection.updateOne(
{ _id: new ObjectId(id) },
{ $set: updateData }
);
if (result.matchedCount > 0) return result;
} catch (e) {
// Try feedbackId
}
return await collection.updateOne(
{ feedbackId: id },
{ $set: updateData }
);
}
/**
* Get feedback statistics
*/
static async getStatistics() {
const collection = await getCollection('feedback');
const [
total,
autonomous,
deliberation,
humanMandatory,
pending,
responded
] = await Promise.all([
collection.countDocuments(),
collection.countDocuments({ pathway: 'autonomous' }),
collection.countDocuments({ pathway: 'deliberation' }),
collection.countDocuments({ pathway: 'human_mandatory' }),
collection.countDocuments({ status: 'pending' }),
collection.countDocuments({ status: 'responded' })
]);
return {
total,
byPathway: {
autonomous,
deliberation,
human_mandatory: humanMandatory
},
byStatus: {
pending,
responded
},
percentageAutonomous: total > 0 ? ((autonomous / total) * 100).toFixed(1) : 0
};
}
/**
* Get recent feedback (for dashboard)
*/
static async getRecent(limit = 10) {
const collection = await getCollection('feedback');
return await collection
.find()
.sort({ created_at: -1 })
.limit(limit)
.toArray();
}
}
module.exports = Feedback;

View file

@ -0,0 +1,124 @@
/**
* Feedback Routes
* Governed feedback system with autonomous/deliberation/human pathways
*/
const express = require('express');
const router = express.Router();
const feedbackController = require('../controllers/feedback.controller');
const { authenticateToken, requireRole } = require('../middleware/auth.middleware');
const { validateRequired } = require('../middleware/validation.middleware');
const { asyncHandler } = require('../middleware/error.middleware');
const { createInputValidationMiddleware } = require('../middleware/input-validation.middleware');
const { formRateLimiter } = require('../middleware/rate-limit.middleware');
const { csrfProtection } = require('../middleware/csrf-protection.middleware');
/**
* Public Routes
*/
// Validation schema for feedback submission
const feedbackSubmitSchema = {
'type': { required: true, type: 'string', maxLength: 50 },
'content': { required: true, type: 'string', maxLength: 5000 },
'name': { required: false, type: 'name', maxLength: 100 },
'email': { required: false, type: 'email', maxLength: 254 }
};
// POST /api/feedback/submit - Submit feedback (public)
router.post('/submit',
formRateLimiter, // 5 requests per minute
csrfProtection, // CSRF validation
createInputValidationMiddleware(feedbackSubmitSchema),
validateRequired(['type', 'content']),
asyncHandler(feedbackController.submit)
);
// GET /api/feedback/status/:feedbackId - Check feedback status (public)
router.get('/status/:feedbackId',
asyncHandler(feedbackController.getStatus)
);
/**
* Admin Routes (require authentication)
*/
// GET /api/feedback/admin/stats - Get feedback statistics
router.get('/admin/stats',
authenticateToken,
requireRole('admin', 'moderator'),
asyncHandler(feedbackController.getStats)
);
// GET /api/feedback/admin/queue - Get feedback queue by pathway
router.get('/admin/queue',
authenticateToken,
requireRole('admin', 'moderator'),
asyncHandler(feedbackController.getQueue)
);
// GET /api/feedback/admin/list - List all feedback with filtering
router.get('/admin/list',
authenticateToken,
requireRole('admin', 'moderator'),
asyncHandler(feedbackController.list)
);
// GET /api/feedback/admin/:id - Get single feedback
router.get('/admin/:id',
authenticateToken,
requireRole('admin', 'moderator'),
asyncHandler(feedbackController.getById)
);
// POST /api/feedback/admin/:id/response - Add response to feedback
router.post('/admin/:id/response',
authenticateToken,
requireRole('admin', 'moderator'),
validateRequired(['content', 'respondedBy']),
asyncHandler(feedbackController.addResponse)
);
// POST /api/feedback/admin/:id/deliberate - Initiate deliberation
router.post('/admin/:id/deliberate',
authenticateToken,
requireRole('admin'),
asyncHandler(feedbackController.initiateDeliberation)
);
// POST /api/feedback/admin/deliberation/:deliberationId/vote - Submit vote
router.post('/admin/deliberation/:deliberationId/vote',
authenticateToken,
requireRole('admin', 'moderator'),
validateRequired(['vote']),
asyncHandler(feedbackController.submitVote)
);
// PUT /api/feedback/admin/:id - Update feedback
router.put('/admin/:id',
authenticateToken,
requireRole('admin', 'moderator'),
asyncHandler(feedbackController.update)
);
// DELETE /api/feedback/admin/:id - Delete feedback
router.delete('/admin/:id',
authenticateToken,
requireRole('admin'),
asyncHandler(feedbackController.deleteFeedback)
);
/**
* AI Integration Routes (internal/authenticated only)
*/
// POST /api/feedback/ai/generate-response - AI generates response with validation
router.post('/ai/generate-response',
authenticateToken,
requireRole('admin', 'ai_agent'),
validateRequired(['feedbackId', 'aiResponse']),
asyncHandler(feedbackController.validateAIResponse)
);
module.exports = router;

View file

@ -0,0 +1,374 @@
/**
* Feedback Governance Service
* Implements Tractatus governance for the feedback system
*
* Three core components:
* - BoundaryEnforcer: Classifies feedback and determines pathway
* - PluralisticDeliberator: Manages multi-stakeholder deliberation
* - CrossReferenceValidator: Validates AI responses against constraints
*/
class BoundaryEnforcer {
constructor(config = {}) {
this.config = {
financialKeywords: config.financialKeywords || [
'price', 'cost', 'pay', 'license', 'commercial', 'enterprise',
'consulting', 'contract', 'pricing', 'invoice', 'purchase',
'sell', 'buy', 'payment', 'subscription'
],
legalKeywords: config.legalKeywords || [
'legal', 'liability', 'lawsuit', 'compliance', 'lawyer',
'intellectual property', 'patent', 'trademark', 'copyright',
'sue', 'litigation'
],
strategicKeywords: config.strategicKeywords || [
'partnership', 'acquisition', 'merge', 'rebrand', 'media interview',
'press release', 'keynote', 'conference', 'speaking'
],
researchKeywords: config.researchKeywords || [
'collaborate', 'co-author', 'research', 'joint', 'partnership',
'publish', 'paper', 'study'
],
...config
};
}
/**
* Classify feedback and determine governance pathway
*/
classify(feedbackType, content) {
const contentLower = content.toLowerCase();
// Check for financial keywords or currency patterns
const hasFinancial = this.config.financialKeywords.some(kw =>
contentLower.includes(kw)
) || /\$\d+|€\d+|£\d+|\d+\s*(USD|EUR|GBP)/i.test(content);
if (hasFinancial) {
return {
pathway: 'human_mandatory',
reason: 'financial_detected',
constraints: [
'no_financial_commitments',
'no_pricing_discussion',
'refer_to_human'
]
};
}
// Check for legal keywords
const hasLegal = this.config.legalKeywords.some(kw =>
contentLower.includes(kw)
);
if (hasLegal) {
return {
pathway: 'human_mandatory',
reason: 'legal_detected',
constraints: [
'no_legal_advice',
'no_liability_discussion',
'refer_to_human'
]
};
}
// Check for strategic keywords
const hasStrategic = this.config.strategicKeywords.some(kw =>
contentLower.includes(kw)
);
if (hasStrategic) {
return {
pathway: 'human_mandatory',
reason: 'strategic_detected',
constraints: [
'no_commitments',
'no_public_statements',
'refer_to_human'
]
};
}
// Check for research collaboration
const hasResearch = this.config.researchKeywords.some(kw =>
contentLower.includes(kw)
);
if (feedbackType === 'research' || hasResearch) {
return {
pathway: 'deliberation',
reason: 'research_collaboration',
stakeholders: ['maintainer', 'research_lead', 'community_rep'],
constraints: [
'check_availability',
'align_with_research_gaps',
'assess_mutual_benefit'
]
};
}
// Feature requests require deliberation
if (feedbackType === 'feature') {
return {
pathway: 'deliberation',
reason: 'feature_request',
stakeholders: ['maintainer', 'community_rep'],
constraints: [
'align_with_roadmap',
'assess_scope',
'community_benefit'
]
};
}
// Technical questions, bugs, general comments are autonomous
if (['technical_question', 'bug', 'general'].includes(feedbackType)) {
return {
pathway: 'autonomous',
reason: 'technical_autonomous',
constraints: [
'cite_documentation',
'no_financial_commitments',
'no_legal_advice',
'accurate_only',
'helpful_tone'
]
};
}
// Default: autonomous with standard constraints
return {
pathway: 'autonomous',
reason: 'default_autonomous',
constraints: [
'cite_documentation',
'no_financial_commitments',
'no_legal_advice',
'stay_on_topic'
]
};
}
/**
* Validate that classification is correct
*/
validate(classification) {
const validPathways = ['autonomous', 'deliberation', 'human_mandatory'];
if (!validPathways.includes(classification.pathway)) {
return { valid: false, error: 'Invalid pathway' };
}
if (!classification.reason) {
return { valid: false, error: 'Missing classification reason' };
}
if (!Array.isArray(classification.constraints)) {
return { valid: false, error: 'Constraints must be array' };
}
return { valid: true };
}
}
class PluralisticDeliberator {
constructor(config = {}) {
this.config = {
consensusThreshold: config.consensusThreshold || 0.67, // 67% agreement required
maxDeliberationRounds: config.maxDeliberationRounds || 3,
...config
};
}
/**
* Initiate deliberation process
* (In full implementation, this would notify stakeholders and collect votes)
*/
async initiate(feedbackId, stakeholders, feedbackContent) {
// For now, simulate stakeholder notification
// In production, this would:
// 1. Send emails/notifications to stakeholders
// 2. Create deliberation session in database
// 3. Set deadline for responses
// 4. Track vote collection
return {
deliberationId: `delib_${feedbackId}_${Date.now()}`,
stakeholders: stakeholders.map(s => ({
id: s,
notified: true,
notifiedAt: new Date(),
voted: false
})),
status: 'awaiting_votes',
deadline: new Date(Date.now() + 72 * 60 * 60 * 1000), // 72 hours
created_at: new Date()
};
}
/**
* Process deliberation result
* (In full implementation, this would aggregate actual stakeholder votes)
*/
async process(deliberationId, votes = []) {
// Simulate processing
// In production, this would aggregate real votes
const approveCount = votes.filter(v => v.vote === 'approve' || v.vote === 'conditional').length;
const totalCount = votes.length;
const consensus = totalCount > 0 ? approveCount / totalCount : 0;
const approved = consensus >= this.config.consensusThreshold;
// Aggregate constraints from all stakeholders
const allConstraints = votes
.filter(v => v.constraints)
.flatMap(v => v.constraints);
const uniqueConstraints = [...new Set(allConstraints)];
return {
deliberationId,
approved,
consensus,
consensusThreshold: this.config.consensusThreshold,
votes: votes.length,
approvals: approveCount,
constraints: uniqueConstraints,
reasoning: this.generateReasoning(approved, consensus, votes),
processedAt: new Date()
};
}
/**
* Generate human-readable reasoning
*/
generateReasoning(approved, consensus, votes) {
const percentage = (consensus * 100).toFixed(0);
if (approved) {
return `Deliberation approved with ${percentage}% consensus (${votes.length} stakeholders consulted). ` +
`Decision meets governance threshold of ${(this.config.consensusThreshold * 100).toFixed(0)}%.`;
} else {
return `Deliberation not approved. Consensus level ${percentage}% is below ` +
`required threshold of ${(this.config.consensusThreshold * 100).toFixed(0)}%.`;
}
}
}
class CrossReferenceValidator {
constructor(config = {}) {
this.config = {
strictMode: config.strictMode !== undefined ? config.strictMode : true,
...config
};
}
/**
* Validate AI response against constraints
*/
validate(response, constraints) {
const violations = [];
constraints.forEach(constraint => {
const violation = this.checkConstraint(response, constraint);
if (violation) {
violations.push(violation);
}
});
const valid = violations.length === 0;
return {
valid,
violations,
constraintsChecked: constraints.length,
violationCount: violations.length,
validatedAt: new Date(),
strictMode: this.config.strictMode
};
}
/**
* Check individual constraint
*/
checkConstraint(response, constraint) {
const responseLower = response.toLowerCase();
switch (constraint) {
case 'no_financial_commitments':
const financialTerms = ['we will charge', 'price is', 'cost is', 'we offer for $'];
if (financialTerms.some(term => responseLower.includes(term))) {
return {
constraint,
violation: 'Response appears to make financial commitment',
severity: 'critical'
};
}
break;
case 'no_legal_advice':
const legalTerms = ['you should sue', 'this is legal', 'you have a legal right'];
if (legalTerms.some(term => responseLower.includes(term))) {
return {
constraint,
violation: 'Response appears to provide legal advice',
severity: 'critical'
};
}
break;
case 'cite_documentation':
const hasCitation = /\[.*\]|https?:\/\/|see:|refer to:/i.test(response);
if (!hasCitation && response.length > 100) {
return {
constraint,
violation: 'Long response without documentation citation',
severity: 'warning'
};
}
break;
case 'stay_on_topic':
// Simple heuristic: response should be relevant
// In production, use more sophisticated relevance checking
break;
case 'helpful_tone':
const rudeTerms = ['stupid', 'dumb', 'idiot', 'obviously'];
if (rudeTerms.some(term => responseLower.includes(term))) {
return {
constraint,
violation: 'Response tone may not be helpful',
severity: 'warning'
};
}
break;
}
return null; // No violation
}
/**
* Get validation report
*/
getReport(validationResult) {
const critical = validationResult.violations.filter(v => v.severity === 'critical').length;
const warnings = validationResult.violations.filter(v => v.severity === 'warning').length;
return {
summary: validationResult.valid ? 'All constraints satisfied' : 'Violations detected',
totalViolations: validationResult.violationCount,
critical,
warnings,
recommendation: critical > 0 ? 'Block response - escalate to human' :
warnings > 0 ? 'Review response before sending' :
'Response approved for sending'
};
}
}
module.exports = {
BoundaryEnforcer,
PluralisticDeliberator,
CrossReferenceValidator
};