Initial commit: LangMem fact-based AI memory system with docs and MCP integration

- Complete fact-based memory API with mem0-inspired approach
- Individual fact extraction and deduplication
- ADD/UPDATE/DELETE memory actions
- Precision search with 0.86+ similarity scores
- MCP server for Claude Code integration
- Neo4j graph relationships and PostgreSQL vector storage
- Comprehensive documentation with architecture and API docs
- Matrix communication integration
- Production-ready Docker setup with Ollama and Supabase

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Docker Config Backup
2025-07-17 13:16:19 +02:00
commit 46faa78237
43 changed files with 9086 additions and 0 deletions

384
docs/assets/css/style.css Normal file
View File

@@ -0,0 +1,384 @@
/* LangMem Documentation Styles */
:root {
--primary-color: #2563eb;
--secondary-color: #64748b;
--accent-color: #06b6d4;
--background-color: #f8fafc;
--text-primary: #1e293b;
--text-secondary: #64748b;
--border-color: #e2e8f0;
--code-bg: #f1f5f9;
--success-color: #22c55e;
--warning-color: #f59e0b;
--error-color: #ef4444;
--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
line-height: 1.6;
color: var(--text-primary);
background-color: var(--background-color);
font-size: 16px;
}
/* Header */
header {
background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
color: white;
padding: 1rem 0;
box-shadow: var(--shadow-md);
position: fixed;
top: 0;
width: 100%;
z-index: 1000;
}
nav {
max-width: 1200px;
margin: 0 auto;
padding: 0 2rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
font-size: 1.5rem;
font-weight: bold;
text-decoration: none;
color: white;
}
.nav-links {
display: flex;
list-style: none;
gap: 2rem;
}
.nav-links a {
color: white;
text-decoration: none;
padding: 0.5rem 1rem;
border-radius: 0.5rem;
transition: background-color 0.3s ease;
}
.nav-links a:hover {
background-color: rgba(255, 255, 255, 0.1);
}
/* Main Content */
main {
margin-top: 80px;
max-width: 1200px;
margin-left: auto;
margin-right: auto;
padding: 2rem;
}
/* Hero Section */
.hero {
text-align: center;
padding: 4rem 0;
background: linear-gradient(135deg, #f8fafc, #e2e8f0);
border-radius: 1rem;
margin-bottom: 3rem;
box-shadow: var(--shadow-sm);
}
.hero h1 {
font-size: 3rem;
margin-bottom: 1rem;
color: var(--primary-color);
}
.hero p {
font-size: 1.2rem;
color: var(--text-secondary);
max-width: 600px;
margin: 0 auto 2rem;
}
.cta-buttons {
display: flex;
gap: 1rem;
justify-content: center;
flex-wrap: wrap;
}
.btn {
padding: 0.75rem 1.5rem;
border: none;
border-radius: 0.5rem;
font-weight: 500;
text-decoration: none;
transition: all 0.3s ease;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 0.5rem;
}
.btn-primary {
background-color: var(--primary-color);
color: white;
}
.btn-primary:hover {
background-color: #1d4ed8;
transform: translateY(-2px);
box-shadow: var(--shadow-md);
}
.btn-secondary {
background-color: white;
color: var(--primary-color);
border: 2px solid var(--primary-color);
}
.btn-secondary:hover {
background-color: var(--primary-color);
color: white;
}
/* Grid Layout */
.grid {
display: grid;
gap: 2rem;
margin-bottom: 3rem;
}
.grid-2 {
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.grid-3 {
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}
/* Cards */
.card {
background: white;
border-radius: 1rem;
padding: 2rem;
box-shadow: var(--shadow-sm);
border: 1px solid var(--border-color);
transition: all 0.3s ease;
}
.card:hover {
transform: translateY(-5px);
box-shadow: var(--shadow-lg);
}
.card h3 {
color: var(--primary-color);
margin-bottom: 1rem;
font-size: 1.25rem;
}
.card-icon {
width: 48px;
height: 48px;
margin-bottom: 1rem;
color: var(--primary-color);
}
/* Architecture Diagrams */
.diagram-container {
background: white;
border-radius: 1rem;
padding: 2rem;
box-shadow: var(--shadow-sm);
border: 1px solid var(--border-color);
margin-bottom: 2rem;
}
.diagram-title {
color: var(--primary-color);
margin-bottom: 1rem;
font-size: 1.25rem;
text-align: center;
}
/* Code Blocks */
.code-block {
background: var(--code-bg);
border-radius: 0.5rem;
padding: 1rem;
overflow-x: auto;
font-family: 'Monaco', 'Menlo', monospace;
font-size: 0.9rem;
margin: 1rem 0;
border: 1px solid var(--border-color);
}
pre {
margin: 0;
white-space: pre-wrap;
}
/* Phase Cards */
.phase-card {
background: white;
border-radius: 1rem;
padding: 2rem;
box-shadow: var(--shadow-sm);
border: 1px solid var(--border-color);
margin-bottom: 2rem;
position: relative;
}
.phase-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4px;
background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
border-radius: 1rem 1rem 0 0;
}
.phase-number {
display: inline-block;
background: var(--primary-color);
color: white;
padding: 0.5rem 1rem;
border-radius: 50%;
font-weight: bold;
margin-bottom: 1rem;
}
.phase-title {
color: var(--primary-color);
margin-bottom: 1rem;
font-size: 1.5rem;
}
.phase-timeline {
color: var(--text-secondary);
font-size: 0.9rem;
margin-bottom: 1rem;
}
/* Status Indicators */
.status {
display: inline-block;
padding: 0.25rem 0.75rem;
border-radius: 1rem;
font-size: 0.8rem;
font-weight: 500;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.status-planning {
background: #fef3c7;
color: #92400e;
}
.status-in-progress {
background: #dbeafe;
color: #1e40af;
}
.status-completed {
background: #dcfce7;
color: #166534;
}
/* Tables */
.table-container {
background: white;
border-radius: 1rem;
overflow: hidden;
box-shadow: var(--shadow-sm);
border: 1px solid var(--border-color);
margin: 2rem 0;
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
padding: 1rem;
text-align: left;
border-bottom: 1px solid var(--border-color);
}
th {
background: var(--code-bg);
color: var(--text-primary);
font-weight: 600;
}
/* Responsive Design */
@media (max-width: 768px) {
.nav-links {
display: none;
}
.hero h1 {
font-size: 2rem;
}
.hero p {
font-size: 1rem;
}
.cta-buttons {
flex-direction: column;
align-items: center;
}
main {
padding: 1rem;
}
.grid-2, .grid-3 {
grid-template-columns: 1fr;
}
}
/* Animations */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.fade-in {
animation: fadeIn 0.6s ease-out;
}
/* Utilities */
.text-center {
text-align: center;
}
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

353
docs/assets/js/main.js Normal file
View File

@@ -0,0 +1,353 @@
// LangMem Documentation JavaScript
document.addEventListener('DOMContentLoaded', function() {
// Initialize all components
initializeNavigation();
initializeAnimations();
initializeDiagrams();
initializeCodeBlocks();
initializeSmoothScroll();
initializeProgressTracking();
});
// Navigation functionality
function initializeNavigation() {
const currentPath = window.location.pathname;
const navLinks = document.querySelectorAll('.nav-links a');
navLinks.forEach(link => {
if (link.getAttribute('href') === currentPath) {
link.classList.add('active');
}
});
}
// Fade-in animations for cards
function initializeAnimations() {
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -100px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('fade-in');
}
});
}, observerOptions);
document.querySelectorAll('.card, .phase-card, .diagram-container').forEach(el => {
observer.observe(el);
});
}
// Initialize Mermaid diagrams
function initializeDiagrams() {
if (typeof mermaid !== 'undefined') {
mermaid.initialize({
startOnLoad: true,
theme: 'default',
flowchart: {
useMaxWidth: true,
htmlLabels: true
},
securityLevel: 'loose'
});
}
}
// Code block enhancements
function initializeCodeBlocks() {
const codeBlocks = document.querySelectorAll('.code-block');
codeBlocks.forEach(block => {
// Add copy button
const copyBtn = document.createElement('button');
copyBtn.className = 'copy-btn';
copyBtn.innerHTML = '📋 Copy';
copyBtn.onclick = () => copyToClipboard(block.textContent, copyBtn);
const container = document.createElement('div');
container.className = 'code-container';
container.appendChild(copyBtn);
block.parentNode.insertBefore(container, block);
container.appendChild(block);
});
}
// Copy to clipboard functionality
function copyToClipboard(text, button) {
navigator.clipboard.writeText(text).then(() => {
const originalText = button.innerHTML;
button.innerHTML = '✅ Copied!';
setTimeout(() => {
button.innerHTML = originalText;
}, 2000);
});
}
// Smooth scrolling for anchor links
function initializeSmoothScroll() {
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
}
// Progress tracking for implementation phases
function initializeProgressTracking() {
const phaseCards = document.querySelectorAll('.phase-card');
const progressBar = document.querySelector('.progress-bar');
if (progressBar && phaseCards.length > 0) {
updateProgressBar();
}
}
function updateProgressBar() {
const totalPhases = document.querySelectorAll('.phase-card').length;
const completedPhases = document.querySelectorAll('.status-completed').length;
const progress = (completedPhases / totalPhases) * 100;
const progressBar = document.querySelector('.progress-fill');
if (progressBar) {
progressBar.style.width = `${progress}%`;
}
}
// Architecture diagram interactions
function showDiagramDetails(diagramId) {
const modal = document.getElementById('diagram-modal');
const content = document.getElementById('diagram-details');
const diagramDetails = {
'system-overview': {
title: 'System Architecture Overview',
description: 'This diagram shows the high-level architecture of the LangMem system, including the main components and their relationships.',
components: [
'LangMem SDK - Core memory management layer',
'Supabase - Vector storage with pgvector',
'Neo4j - Graph database for relationships',
'Ollama - Local LLM and embedding models',
'Docker Network - Container orchestration'
]
},
'data-flow': {
title: 'Data Flow Architecture',
description: 'Shows how data flows through the system during ingestion and retrieval operations.',
components: [
'Input Processing - Text chunking and preprocessing',
'Embedding Generation - Vector creation via Ollama',
'Storage Layer - Dual storage in Supabase and Neo4j',
'Retrieval Engine - Hybrid search capabilities',
'Context Assembly - Final context preparation'
]
}
};
const details = diagramDetails[diagramId];
if (details && modal && content) {
content.innerHTML = `
<h3>${details.title}</h3>
<p>${details.description}</p>
<ul>
${details.components.map(comp => `<li>${comp}</li>`).join('')}
</ul>
`;
modal.style.display = 'block';
}
}
function closeDiagramModal() {
const modal = document.getElementById('diagram-modal');
if (modal) {
modal.style.display = 'none';
}
}
// Search functionality
function initializeSearch() {
const searchInput = document.querySelector('.search-input');
const searchResults = document.querySelector('.search-results');
if (searchInput && searchResults) {
searchInput.addEventListener('input', debounce(performSearch, 300));
}
}
function performSearch(event) {
const query = event.target.value.toLowerCase();
const searchResults = document.querySelector('.search-results');
if (query.length < 2) {
searchResults.style.display = 'none';
return;
}
// Simple search implementation
const searchableElements = document.querySelectorAll('h1, h2, h3, p, li');
const results = [];
searchableElements.forEach(element => {
if (element.textContent.toLowerCase().includes(query)) {
results.push({
title: element.textContent,
url: `#${element.id || ''}`,
type: element.tagName.toLowerCase()
});
}
});
displaySearchResults(results);
}
function displaySearchResults(results) {
const searchResults = document.querySelector('.search-results');
if (results.length === 0) {
searchResults.innerHTML = '<p>No results found</p>';
} else {
searchResults.innerHTML = results.map(result => `
<div class="search-result">
<a href="${result.url}">${result.title}</a>
<span class="result-type">${result.type}</span>
</div>
`).join('');
}
searchResults.style.display = 'block';
}
// Utility functions
function debounce(func, wait) {
let timeout;
return function executedFunction(...args) {
const later = () => {
clearTimeout(timeout);
func(...args);
};
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
}
// Mobile menu toggle
function toggleMobileMenu() {
const navLinks = document.querySelector('.nav-links');
navLinks.classList.toggle('mobile-open');
}
// Theme toggle functionality
function toggleTheme() {
const body = document.body;
const currentTheme = body.getAttribute('data-theme');
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
body.setAttribute('data-theme', newTheme);
localStorage.setItem('theme', newTheme);
}
// Initialize theme from localStorage
function initializeTheme() {
const savedTheme = localStorage.getItem('theme') || 'light';
document.body.setAttribute('data-theme', savedTheme);
}
// Component status updates
function updateComponentStatus(componentId, status) {
const statusElement = document.querySelector(`[data-component="${componentId}"] .status`);
if (statusElement) {
statusElement.className = `status status-${status}`;
statusElement.textContent = status.replace('-', ' ').toUpperCase();
}
}
// Progress tracking for implementation
function trackImplementationProgress() {
const phases = {
'phase-1': 'in-progress',
'phase-2': 'planning',
'phase-3': 'planning',
'phase-4': 'planning'
};
Object.entries(phases).forEach(([phaseId, status]) => {
updateComponentStatus(phaseId, status);
});
}
// Add CSS for additional interactive elements
const additionalStyles = `
.copy-btn {
position: absolute;
top: 0.5rem;
right: 0.5rem;
background: var(--primary-color);
color: white;
border: none;
padding: 0.25rem 0.5rem;
border-radius: 0.25rem;
cursor: pointer;
font-size: 0.8rem;
}
.code-container {
position: relative;
}
.search-results {
position: absolute;
top: 100%;
left: 0;
right: 0;
background: white;
border: 1px solid var(--border-color);
border-radius: 0.5rem;
box-shadow: var(--shadow-md);
display: none;
max-height: 300px;
overflow-y: auto;
z-index: 1000;
}
.search-result {
padding: 1rem;
border-bottom: 1px solid var(--border-color);
cursor: pointer;
}
.search-result:hover {
background: var(--code-bg);
}
.mobile-open {
display: flex !important;
flex-direction: column;
position: absolute;
top: 100%;
left: 0;
right: 0;
background: var(--primary-color);
padding: 1rem;
}
@media (max-width: 768px) {
.nav-links {
display: none;
}
}
`;
// Inject additional styles
const styleSheet = document.createElement('style');
styleSheet.textContent = additionalStyles;
document.head.appendChild(styleSheet);