TDDAI & Claude Code Hooks - LLM Platform Integration
🎯 Overview
This document describes how TDDAI and Claude Code hooks integrate with the broader LLM Platform ecosystem, providing comprehensive development tooling, AI services, and infrastructure management for data-sovereign AI development.
🏗️ LLM Platform Architecture Integration
Core Platform Components
graph TB
subgraph "Development Tools"
A[TDDAI] --> B[Claude Code Hooks]
B --> C[Cursor Agent]
C --> D[VS Code Extension]
end
subgraph "AI Services Layer"
E[Ollama Cluster] --> F[Model Registry]
F --> G[Vector Database - Qdrant]
G --> H[LLMCli Operations]
end
subgraph "Platform Infrastructure"
I[Drupal CMS Platform] --> J[MCP Registry]
J --> K[API Normalizer]
K --> L[Government Compliance]
end
subgraph "Data Sovereignty"
M[Local AI Processing] --> N[Private Vector DB]
N --> O[Secure Project Framework]
O --> P[Enterprise Security]
end
A --> E
I --> A
M --> A
E --> I
Integration Points
1. AI Services Integration
- Ollama Cluster: Local AI model hosting for data sovereignty
- Qdrant Vector Database: Private pattern learning and code similarity
- MLflow Model Registry: Training pipeline and model versioning
- LLMCli: Command-line AI operations and ecosystem status
2. Drupal Platform Integration
- MCP Registry: Model Context Protocol server management
- API Normalizer: OpenAPI schema to Drupal entity conversion
- Government Compliance: NIST, FedRAMP, FISMA compliance frameworks
- Alternative Services: Docker/Kubernetes service discovery
3. Development Ecosystem
- TDDAI: AI-enhanced test-driven development
- Claude Code Hooks: Real-time workflow enforcement
- Cursor Agent: Data-sovereign IDE integration
- Quality Gates: Automated code quality and security validation
🔧 MCP (Model Context Protocol) Integration
Available MCP Tools
TDDAI integrates with the LLM Platform's MCP ecosystem through specialized tools:
Core Development Tools
// tddai_analysis - TDD compliance checks with platform integration
interface TDDAIAnalysisOptions {
action: 'analyze' | 'improve' | 'validate' | 'fix';
path?: string;
detailed?: boolean;
autoFix?: boolean;
generateTests?: boolean;
}
// quality_improvement - Comprehensive project improvement pipeline
interface QualityImprovementOptions {
phases: ('analysis' | 'auto-fix' | 'test-generation' | 're-analysis')[];
projects?: string[];
improvementMetrics?: boolean;
}
// platform_ecosystem_status - Infrastructure health monitoring
interface EcosystemStatusOptions {
components: ('helm-charts' | 'qdrant' | 'mlflow' | 'docker-intelligence')[];
healthCheck?: boolean;
performanceMetrics?: boolean;
}
Usage Examples
// Comprehensive project analysis
const analysis = await mcpClient.callTool('tddai_analysis', {
action: 'analyze',
path: './src',
detailed: true,
autoFix: true
});
// Platform health check
const ecosystemStatus = await mcpClient.callTool('platform_ecosystem_status', {
components: ['qdrant', 'ollama-cluster', 'mlflow'],
healthCheck: true,
performanceMetrics: true
});
// Quality improvement pipeline
const improvement = await mcpClient.callTool('quality_improvement', {
phases: ['analysis', 'auto-fix', 'test-generation', 're-analysis'],
projects: ['./src', './modules'],
improvementMetrics: true
});
MCP Server Configuration
Claude Desktop Integration
// ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"llm-platform": {
"command": "node",
"args": ["/Users/flux423/Sites/LLM/_CommonNPM/llm-mcp/mcp-assistant.js"]
}
}
}
Available MCP Commands
project_context
- Comprehensive project analysis with CLAUDE.md integrationai_services_status
- Ollama, Qdrant, and Drupal health monitoringtddai_analysis
- TDD compliance checks and improvementsllmcli_operations
- AI-powered development assistanceplatform_ecosystem_status
- Complete infrastructure health monitoring
🤖 AI Services Layer Integration
Ollama Cluster Integration
Production-Ready Cluster Service
# Kubernetes deployment via Helm Charts
apiVersion: apps/v1
kind: Deployment
metadata:
name: ollama-cluster
spec:
replicas: 3
selector:
matchLabels:
app: ollama-cluster
template:
spec:
containers:
- name: ollama-cluster
image: bluefly/ollama-cluster:latest
ports:
- containerPort: 3001
env:
- name: OLLAMA_HOST
value: "localhost:11434"
- name: LOAD_BALANCE_STRATEGY
value: "round-robin"
TDDAI Integration
// tddai.config.yml
ai:
enabled: true
provider: ollama # Uses platform Ollama cluster
model: llama3.2:7b # Default model for code analysis
clusterEndpoint: localhost:3001 # Ollama cluster service
temperature: 0.3
maxTokens: 2000
# Vector database integration
vectorDb:
enabled: true
provider: qdrant # Platform Qdrant instance
endpoint: localhost:6333
collection: tddai_patterns
embeddingModel: nomic-embed-text
Model Registry Integration
MLflow Integration
# AI model training pipeline integration
import mlflow
from tddai.training import CodePatternTrainer
# Train code pattern recognition models
trainer = CodePatternTrainer(
vector_db_url="http://localhost:6333",
mlflow_tracking_uri="http://localhost:5000"
)
# Register trained model
model_version = trainer.train_and_register(
training_data="tdd_patterns_dataset",
model_name="tdd_pattern_classifier",
stage="Production"
)
Model Versioning in TDDAI
// Automatic model version detection
function getActiveModel() {
const mlflowClient = new MLflowClient("http://localhost:5000");
const model = mlflowClient.getLatestVersions(
"tdd_pattern_classifier",
["Production"]
);
return {
name: model.name,
version: model.version,
runId: model.runId,
status: model.currentStage
};
}
🏢 Drupal Platform Integration
Government Compliance Module Integration
TDDAI → gov_compliance Module
<?php
// Drupal integration service
class TDDAIIntegrationService {
public function analyzeDrupalModule($modulePath) {
$command = sprintf(
'npx @bluefly/tddai drupal ultra-strict %s --json',
escapeshellarg($modulePath)
);
$result = shell_exec($command);
$analysis = json_decode($result, TRUE);
// Create Drupal compliance entities
$this->createComplianceReport($analysis);
return $analysis;
}
private function createComplianceReport($analysis) {
$report = ComplianceReport::create([
'title' => 'TDDAI Analysis: ' . $analysis['projectName'],
'framework' => 'tddai-drupal-ultra-strict',
'score' => $analysis['qualityScore'],
'findings' => json_encode($analysis['findings']),
'recommendations' => json_encode($analysis['recommendations']),
'created' => time(),
]);
$report->save();
}
}
Recipe Integration
# secure_drupal recipe integration
name: secure_drupal
description: Security-hardened Drupal with TDDAI integration
type: Site
install:
- gov_compliance
- mcp_registry
- api_normalizer
- alternative_services
config:
install:
gov_compliance.settings:
tddai_integration: true
auto_analysis: true
quality_threshold: 95
actions:
- id: setup_tddai
plugin: system_command
command: 'npx @bluefly/tddai setup-wizard --drupal'
MCP Registry Integration
Automatic TDDAI Registration
<?php
// Auto-register TDDAI as MCP server
$mcp_server = MCPServer::create([
'id' => 'tddai-server',
'name' => 'TDDAI Analysis Server',
'description' => 'AI-enhanced TDD analysis and quality improvement',
'transport' => [
'type' => 'stdio',
'command' => 'npx',
'args' => ['@bluefly/tddai', 'mcp-server']
],
'capabilities' => [
'project_analysis',
'quality_improvement',
'test_generation',
'compliance_validation'
],
'status' => 'active'
]);
$mcp_server->save();
🔒 Data Sovereignty Implementation
Local AI Processing Pipeline
Complete Local Stack
# docker-compose.yml for local AI stack
version: '3.8'
services:
ollama-cluster:
image: bluefly/ollama-cluster:latest
ports:
- "3001:3001"
environment:
- OLLAMA_HOST=ollama:11434
depends_on:
- ollama
ollama:
image: ollama/ollama:latest
ports:
- "11434:11434"
volumes:
- ollama-data:/root/.ollama
qdrant:
image: qdrant/qdrant:latest
ports:
- "6333:6333"
volumes:
- qdrant-data:/qdrant/storage
mlflow:
image: python:3.11
command: >
sh -c "pip install mlflow &&
mlflow server --host 0.0.0.0 --port 5000 --backend-store-uri sqlite:///mlflow.db"
ports:
- "5000:5000"
volumes:
- mlflow-data:/mlflow
volumes:
ollama-data:
qdrant-data:
mlflow-data:
TDDAI Configuration for Data Sovereignty
# tddai.config.yml - Data sovereignty mode
dataSovereignty:
enabled: true
mode: strict # strict, moderate, flexible
ai:
localOnly: true # No external AI calls
provider: ollama # Local Ollama only
fallbackDisabled: true # No OpenAI/Anthropic fallback
vectorDb:
localOnly: true # Local Qdrant only
encryption: true # Encrypt vector data
telemetry:
disabled: true # No usage analytics
localLogging: true # Local logs only
network:
blockExternalCalls: true # Block all external API calls
allowedHosts: [ # Whitelist for essential services
'localhost',
'127.0.0.1'
]
Private Vector Database Integration
Code Pattern Learning
// Private pattern learning with Qdrant
class PrivatePatternLearner {
constructor() {
this.qdrant = new QdrantClient({ url: 'http://localhost:6333' });
this.collection = 'private_tdd_patterns';
}
async learnFromCodebase(codebasePath) {
const codeFiles = await this.scanCodebase(codebasePath);
for (const file of codeFiles) {
const embedding = await this.generateEmbedding(file.content);
await this.qdrant.upsert(this.collection, {
points: [{
id: file.hash,
vector: embedding,
payload: {
filePath: file.path,
language: file.language,
testType: file.testType,
qualityScore: file.qualityScore,
patterns: file.patterns
}
}]
});
}
}
async findSimilarPatterns(code) {
const embedding = await this.generateEmbedding(code);
const results = await this.qdrant.search(this.collection, {
vector: embedding,
limit: 5,
scoreThreshold: 0.7
});
return results.map(result => ({
similarity: result.score,
filePath: result.payload.filePath,
patterns: result.payload.patterns,
suggestions: this.generateSuggestions(result.payload)
}));
}
private async generateEmbedding(text) {
// Use local embedding model (nomic-embed-text via Ollama)
const response = await fetch('http://localhost:11434/api/embeddings', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
model: 'nomic-embed-text',
prompt: text
})
});
const result = await response.json();
return result.embedding;
}
}
📊 Monitoring and Analytics Integration
Platform Health Monitoring
Integrated Health Checks
// Platform ecosystem health monitoring
class PlatformHealthMonitor {
async getEcosystemHealth() {
const components = await Promise.allSettled([
this.checkOllamaCluster(),
this.checkQdrantHealth(),
this.checkMLflowStatus(),
this.checkDrupalPlatform(),
this.checkTDDAIServices()
]);
return {
timestamp: new Date().toISOString(),
overallHealth: this.calculateOverallHealth(components),
components: {
ollamaCluster: components[0].value,
qdrant: components[1].value,
mlflow: components[2].value,
drupalPlatform: components[3].value,
tddaiServices: components[4].value
},
recommendations: this.generateRecommendations(components)
};
}
async checkTDDAIServices() {
try {
const result = execSync('npx @bluefly/tddai --version', {
timeout: 3000,
encoding: 'utf8'
});
const version = result.trim();
const expectedVersion = '2.2.3';
return {
status: 'healthy',
version,
upToDate: version === expectedVersion,
capabilities: await this.getTDDAICapabilities()
};
} catch (error) {
return {
status: 'unhealthy',
error: error.message
};
}
}
}
Quality Metrics Dashboard
Integrated Metrics Collection
// Metrics collection for platform dashboard
class IntegratedMetricsCollector {
async collectMetrics() {
return {
development: await this.collectDevelopmentMetrics(),
infrastructure: await this.collectInfrastructureMetrics(),
security: await this.collectSecurityMetrics(),
compliance: await this.collectComplianceMetrics()
};
}
async collectDevelopmentMetrics() {
const tddaiMetrics = await this.runTDDAIAnalysis();
const codeQuality = await this.getCodeQualityMetrics();
return {
projectCount: tddaiMetrics.projectCount,
averageQualityScore: tddaiMetrics.averageScore,
testCoverage: tddaiMetrics.averageCoverage,
tddCompliance: tddaiMetrics.complianceRate,
codeQuality: codeQuality.overallScore,
technicalDebt: codeQuality.technicalDebt
};
}
async collectInfrastructureMetrics() {
const ollamaHealth = await this.checkOllamaCluster();
const qdrantHealth = await this.checkQdrant();
return {
aiServicesHealth: ollamaHealth.status,
vectorDbHealth: qdrantHealth.status,
averageResponseTime: ollamaHealth.averageResponseTime,
vectorSearchLatency: qdrantHealth.searchLatency,
modelLoadTime: ollamaHealth.modelLoadTime
};
}
}
🚀 Deployment and CI/CD Integration
GitLab CI Integration
Complete Pipeline Integration
# .gitlab-ci.yml - Full platform integration
stages:
- setup
- analysis
- quality-check
- security-scan
- compliance-check
- deploy
variables:
TDDAI_VERSION: "2.2.3"
PLATFORM_ENV: "production"
setup-platform:
stage: setup
script:
- npm install -g @bluefly/tddai@$TDDAI_VERSION
- docker-compose up -d ollama qdrant mlflow
- npx @bluefly/tddai claude-setup --ci-mode
artifacts:
paths:
- .claude/
expire_in: 1 hour
tddai-analysis:
stage: analysis
script:
- npx @bluefly/tddai improve analyze --all --detailed --junit-output
artifacts:
reports:
junit: tddai-junit.xml
paths:
- tddai-report.json
dependencies:
- setup-platform
quality-gates:
stage: quality-check
script:
- npx @bluefly/tddai validate --strict --quality-gates
- npx @bluefly/llmcli test-gen analyze ./
only:
- merge_requests
- main
security-compliance:
stage: security-scan
script:
- npx @bluefly/secure-project validate --framework nist-csf-2.0
- npx @bluefly/secure-project gitlab:security-pipeline
artifacts:
reports:
security: security-report.json
platform-deployment:
stage: deploy
script:
- helm upgrade llm-platform ./Helm-Charts/llm-platform/
- kubectl rollout status deployment/ollama-cluster
- npx @bluefly/tddai report --dashboard --url $METRICS_DASHBOARD_URL
only:
- main
Kubernetes Deployment Integration
Helm Chart Integration
# Helm-Charts/tddai-platform/values.yaml
tddai:
enabled: true
version: "2.2.3"
config:
dataSovereignty: true
aiProvider: ollama
vectorDb: qdrant
ollamaCluster:
enabled: true
replicas: 3
image: bluefly/ollama-cluster:latest
service:
port: 3001
qdrant:
enabled: true
persistence:
enabled: true
size: 10Gi
mlflow:
enabled: true
service:
port: 5000
monitoring:
enabled: true
prometheus: true
grafana: true
alerting: true
🔮 Future Integration Roadmap
Phase 1: Enhanced Data Sovereignty (Q1 2025)
- Cursor Agent Integration: Complete data-sovereign IDE extension
- Multi-Provider Support: Configurable AI providers with privacy controls
- Enhanced Vector DB: Advanced pattern learning and code suggestions
- Enterprise Authentication: SSO and role-based access control
Phase 2: Advanced Analytics (Q2 2025)
- Team Collaboration Dashboard: Real-time metrics and collaboration
- Predictive Quality Analytics: AI-powered quality predictions
- Advanced Compliance Reporting: Automated government compliance reports
- Custom Rule Engine: Configurable quality and security rules
Phase 3: Enterprise Features (Q3 2025)
- Multi-Tenant Architecture: Organization and team isolation
- Advanced Security Integration: Hardware security module support
- Custom Training Pipelines: Organization-specific AI model training
- Advanced Audit Trails: Blockchain-based immutable audit logs
This comprehensive integration makes TDDAI and Claude Code hooks the cornerstone of the LLM Platform's data-sovereign AI development ecosystem, providing enterprise-grade development tooling with complete privacy and security control.