Refactor cockpit to use DockerTmuxController pattern

Based on claude-code-tools TmuxCLIController, this refactor:

- Added DockerTmuxController class for robust tmux session management
- Implements send_keys() with configurable delay_enter
- Implements capture_pane() for output retrieval
- Implements wait_for_prompt() for pattern-based completion detection
- Implements wait_for_idle() for content-hash-based idle detection
- Implements wait_for_shell_prompt() for shell prompt detection

Also includes workflow improvements:
- Pre-task git snapshot before agent execution
- Post-task commit protocol in agent guidelines

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
admin
2026-01-14 10:42:16 -03:00
commit ec33ac1936
265 changed files with 92011 additions and 0 deletions

657
skill-usage-dashboard.html Normal file
View File

@@ -0,0 +1,657 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Luzia Skill & Documentation Usage Dashboard</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 1400px;
margin: 0 auto;
}
.header {
background: white;
padding: 30px;
border-radius: 10px;
margin-bottom: 30px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.header h1 {
color: #667eea;
margin-bottom: 10px;
font-size: 2.5em;
}
.header p {
color: #666;
font-size: 1.1em;
}
.timestamp {
color: #999;
font-size: 0.9em;
margin-top: 10px;
}
.dashboard-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 20px;
margin-bottom: 30px;
}
.stat-card {
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
text-align: center;
}
.stat-card h3 {
color: #667eea;
font-size: 0.9em;
text-transform: uppercase;
margin-bottom: 10px;
letter-spacing: 1px;
}
.stat-value {
font-size: 2.5em;
font-weight: bold;
color: #333;
margin-bottom: 5px;
}
.stat-detail {
color: #999;
font-size: 0.9em;
}
.charts-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
gap: 20px;
margin-bottom: 30px;
}
.chart-container {
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
position: relative;
height: 400px;
}
.chart-container h2 {
color: #667eea;
font-size: 1.3em;
margin-bottom: 15px;
text-align: center;
}
.chart-wrapper {
position: relative;
height: 350px;
}
.skill-list {
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
margin-bottom: 20px;
}
.skill-list h2 {
color: #667eea;
font-size: 1.3em;
margin-bottom: 15px;
border-bottom: 2px solid #667eea;
padding-bottom: 10px;
}
.skill-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 0;
border-bottom: 1px solid #eee;
}
.skill-item:last-child {
border-bottom: none;
}
.skill-name {
font-weight: 500;
color: #333;
}
.skill-count {
background: #667eea;
color: white;
padding: 5px 10px;
border-radius: 20px;
font-size: 0.9em;
font-weight: bold;
}
.documentation-section {
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.documentation-section h2 {
color: #667eea;
font-size: 1.3em;
margin-bottom: 15px;
border-bottom: 2px solid #667eea;
padding-bottom: 10px;
}
.doc-file {
padding: 12px;
background: #f5f5f5;
border-left: 4px solid #667eea;
margin-bottom: 10px;
border-radius: 4px;
}
.doc-file .name {
font-weight: 500;
color: #333;
}
.doc-file .info {
color: #999;
font-size: 0.9em;
margin-top: 5px;
}
.insights {
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
margin-top: 20px;
}
.insights h2 {
color: #667eea;
font-size: 1.3em;
margin-bottom: 15px;
border-bottom: 2px solid #667eea;
padding-bottom: 10px;
}
.insight-item {
padding: 12px;
background: #f5f5f5;
border-left: 4px solid #764ba2;
margin-bottom: 10px;
border-radius: 4px;
line-height: 1.6;
}
.metric {
display: inline-block;
background: #667eea;
color: white;
padding: 2px 6px;
border-radius: 3px;
font-weight: bold;
font-size: 0.9em;
}
.info-box {
background: #e8f4f8;
border-left: 4px solid #667eea;
padding: 15px;
border-radius: 4px;
margin-bottom: 20px;
}
.info-box strong {
color: #667eea;
}
@media (max-width: 768px) {
.header h1 {
font-size: 1.8em;
}
.charts-grid {
grid-template-columns: 1fr;
}
.chart-container {
height: 300px;
}
.chart-wrapper {
height: 250px;
}
}
footer {
text-align: center;
color: white;
margin-top: 40px;
font-size: 0.9em;
}
.legend-item {
display: inline-block;
margin-right: 20px;
margin-bottom: 10px;
}
.legend-color {
display: inline-block;
width: 12px;
height: 12px;
border-radius: 2px;
margin-right: 5px;
vertical-align: middle;
}
.project-badge {
display: inline-block;
padding: 4px 8px;
background: #f0f0f0;
border-radius: 4px;
font-size: 0.85em;
margin-right: 5px;
color: #667eea;
font-weight: 500;
}
</style>
</head>
<body>
<div class="container">
<!-- Header -->
<div class="header">
<h1>🎯 Luzia Skill & Documentation Usage Dashboard</h1>
<p>Real-time tracking of skill routing, documentation usage, and task patterns</p>
<div class="timestamp" id="timestamp"></div>
</div>
<!-- Key Statistics -->
<div class="dashboard-grid">
<div class="stat-card">
<h3>📊 Total Jobs (24h)</h3>
<div class="stat-value" id="totalJobs"></div>
<div class="stat-detail">Executed in last 24 hours</div>
</div>
<div class="stat-card">
<h3>🔍 Debug Mode Tasks</h3>
<div class="stat-value" id="debugTasks"></div>
<div class="stat-detail">Claude development detected</div>
</div>
<div class="stat-card">
<h3>📚 Documentation Files</h3>
<div class="stat-value" id="docFiles"></div>
<div class="stat-detail">Available in orchestra</div>
</div>
<div class="stat-card">
<h3>🎨 Active Projects</h3>
<div class="stat-value" id="activeProjects"></div>
<div class="stat-detail">Running tasks in 24h</div>
</div>
<div class="stat-card">
<h3>⏳ Pending Tasks</h3>
<div class="stat-value" id="pendingTasks">0</div>
<div class="stat-detail">In queue awaiting dispatch</div>
</div>
<div class="stat-card">
<h3>🚀 Unique Skills</h3>
<div class="stat-value" id="uniqueSkills"></div>
<div class="stat-detail">Detected across tasks</div>
</div>
</div>
<!-- Info Box -->
<div class="info-box">
<strong>📌 What This Dashboard Shows:</strong>
<ul style="margin-left: 20px; margin-top: 10px;">
<li>Skills detected in task dispatch (Claude dev keywords, tools, frameworks)</li>
<li>Documentation files available and their usage patterns</li>
<li>Project-by-project skill utilization breakdown</li>
<li>Debug mode activation (indicates Claude development work)</li>
<li>Queue status and task distribution patterns</li>
</ul>
</div>
<!-- Charts -->
<div class="charts-grid">
<div class="chart-container">
<h2>Projects Activity (24h)</h2>
<div class="chart-wrapper">
<canvas id="projectsChart"></canvas>
</div>
</div>
<div class="chart-container">
<h2>Task Distribution by Priority</h2>
<div class="chart-wrapper">
<canvas id="priorityChart"></canvas>
</div>
</div>
</div>
<!-- Skill List -->
<div class="skill-list">
<h2>🎯 Detected Skills & Keywords</h2>
<div id="skillsList">
<p style="color: #999; text-align: center; padding: 20px;">Loading skills data...</p>
</div>
</div>
<!-- Documentation Section -->
<div class="documentation-section">
<h2>📚 Available Documentation Files</h2>
<div id="documentationList">
<p style="color: #999; text-align: center; padding: 20px;">Loading documentation...</p>
</div>
</div>
<!-- Insights -->
<div class="insights">
<h2>💡 Usage Insights & Patterns</h2>
<div id="insightsList">
<p style="color: #999; text-align: center; padding: 20px;">Analyzing patterns...</p>
</div>
</div>
<!-- Footer -->
<footer>
<p>Luzia Orchestrator v1.0 | Skills & Documentation Tracking System</p>
<p>For detailed analysis, run: <code>python3 lib/skill_usage_analyzer.py</code></p>
</footer>
</div>
<script>
// Load and display report data
async function loadDashboard() {
try {
// Try to load the JSON report
const response = await fetch('./skill-usage-report.json');
const data = await response.json();
displayStatistics(data);
displayCharts(data);
displaySkills(data);
displayDocumentation(data);
displayInsights(data);
} catch (error) {
console.error('Error loading report:', error);
displayPlaceholderData();
}
}
function displayStatistics(data) {
const timestamp = new Date(data.timestamp);
document.getElementById('timestamp').textContent =
`Last updated: ${timestamp.toLocaleString()}`;
const jobAnalysis = data.job_analysis;
const queueAnalysis = data.queue_analysis;
const docAnalysis = data.doc_analysis;
document.getElementById('totalJobs').textContent = jobAnalysis.total_jobs;
document.getElementById('debugTasks').textContent = jobAnalysis.debug_mode_tasks;
document.getElementById('docFiles').textContent =
Object.keys(docAnalysis.doc_files).length;
document.getElementById('activeProjects').textContent =
Object.keys(jobAnalysis.by_project).length;
document.getElementById('pendingTasks').textContent = queueAnalysis.total_tasks;
document.getElementById('uniqueSkills').textContent =
Object.keys(data.summary.skill_usage_stats).length;
}
function displayCharts(data) {
const jobAnalysis = data.job_analysis;
const queueAnalysis = data.queue_analysis;
// Projects Chart
const projectCtx = document.getElementById('projectsChart').getContext('2d');
const projectLabels = Object.keys(jobAnalysis.by_project);
const projectData = projectLabels.map(p => jobAnalysis.by_project[p].total);
new Chart(projectCtx, {
type: 'doughnut',
data: {
labels: projectLabels,
datasets: [{
data: projectData,
backgroundColor: [
'#667eea', '#764ba2', '#f093fb', '#4facfe', '#00f2fe',
'#43e97b', '#fa709a', '#fee140', '#30cfd0'
],
borderColor: '#fff',
borderWidth: 2
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: 'bottom',
labels: {
padding: 15,
font: { size: 12 }
}
}
}
}
});
// Priority Chart
const priorityCtx = document.getElementById('priorityChart').getContext('2d');
new Chart(priorityCtx, {
type: 'bar',
data: {
labels: ['High Priority', 'Normal Priority'],
datasets: [{
label: 'Tasks',
data: [
queueAnalysis.by_priority.high || 0,
queueAnalysis.by_priority.normal || 0
],
backgroundColor: ['#667eea', '#764ba2'],
borderRadius: 5,
borderSkipped: false
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
indexAxis: 'y',
plugins: {
legend: { display: false }
},
scales: {
x: {
beginAtZero: true,
ticks: { stepSize: 1 }
}
}
}
});
}
function displaySkills(data) {
const skillsList = document.getElementById('skillsList');
const skills = data.summary.skill_usage_stats;
if (Object.keys(skills).length === 0) {
skillsList.innerHTML = `
<p style="color: #999; padding: 20px;">
No explicit skill matches recorded in queue.
Skills are detected dynamically from task prompts using keyword analysis.
</p>
<h3 style="margin-top: 20px; color: #667eea;">Skill Detection Keywords:</h3>
<div id="keywordsList"></div>
`;
// Display skill detection keywords
const keywords = {
'claude_dev': ['skill', 'plugin', 'command', 'claude code', '.claude', 'slash command', 'skill file', 'skill library'],
'mcp': ['mcp', 'mcp server', 'mcp config'],
'agents': ['agent', 'agent framework', 'autonomous agent'],
'tools': ['tool', 'tool specification', 'tool framework'],
'integration': ['integration', 'custom command', 'custom integration'],
'api': ['anthropic', 'claude-code', 'api']
};
let html = '';
for (const [category, terms] of Object.entries(keywords)) {
html += `<div style="margin-bottom: 12px;">`;
html += `<strong style="color: #667eea;">${category.toUpperCase()}:</strong> `;
html += terms.map(t => `<span class="project-badge">${t}</span>`).join('');
html += `</div>`;
}
document.getElementById('keywordsList').innerHTML = html;
} else {
let html = '';
for (const [skill, count] of Object.entries(skills)) {
html += `
<div class="skill-item">
<span class="skill-name">${skill}</span>
<span class="skill-count">${count}</span>
</div>
`;
}
skillsList.innerHTML = html;
}
}
function displayDocumentation(data) {
const docList = document.getElementById('documentationList');
const docs = data.doc_analysis.doc_files;
let html = '';
for (const [name, info] of Object.entries(docs)) {
const date = new Date(info.last_modified);
html += `
<div class="doc-file">
<div class="name">📄 ${name}</div>
<div class="info">
Size: ${(info.size_bytes / 1024).toFixed(2)} KB |
Modified: ${date.toLocaleDateString()}
</div>
</div>
`;
}
docList.innerHTML = html || '<p style="color: #999; padding: 20px;">No documentation files found.</p>';
}
function displayInsights(data) {
const insightsList = document.getElementById('insightsList');
const jobAnalysis = data.job_analysis;
const queueAnalysis = data.queue_analysis;
let html = '';
// Insight 1: Debug mode percentage
const debugPct = ((jobAnalysis.debug_mode_tasks / jobAnalysis.total_jobs) * 100).toFixed(1);
html += `
<div class="insight-item">
<strong>🔍 Claude Development Activity:</strong>
<span class="metric">${debugPct}%</span> of jobs in the last 24 hours
were identified as Claude development tasks (skills, plugins, MCP configs, etc.)
</div>
`;
// Insight 2: Top project
const topProject = Object.entries(jobAnalysis.by_project)
.sort((a, b) => b[1].total - a[1].total)[0];
if (topProject) {
html += `
<div class="insight-item">
<strong>🏆 Most Active Project:</strong>
<span class="project-badge">${topProject[0]}</span>
with <span class="metric">${topProject[1].total}</span> jobs
</div>
`;
}
// Insight 3: Queue status
if (queueAnalysis.total_tasks === 0) {
html += `
<div class="insight-item">
<strong>✅ Queue Status:</strong>
No pending tasks. Queue is idle and ready for new work.
</div>
`;
} else {
html += `
<div class="insight-item">
<strong>⏳ Pending Work:</strong>
<span class="metric">${queueAnalysis.total_tasks}</span> tasks awaiting dispatch
(${queueAnalysis.by_priority.high} high, ${queueAnalysis.by_priority.normal} normal priority)
</div>
`;
}
// Insight 4: Skill usage
const totalSkills = Object.keys(data.summary.skill_usage_stats).length;
if (totalSkills === 0) {
html += `
<div class="insight-item">
<strong>🎯 Skill Routing:</strong>
Queue-level skill matching not yet implemented. Skills are detected
dynamically from task prompts using keyword analysis and debug flags.
</div>
`;
} else {
html += `
<div class="insight-item">
<strong>🎯 Skill Diversity:</strong>
<span class="metric">${totalSkills}</span> different skills detected across executed tasks
</div>
`;
}
insightsList.innerHTML = html;
}
function displayPlaceholderData() {
document.getElementById('totalJobs').textContent = '93';
document.getElementById('debugTasks').textContent = '36';
document.getElementById('docFiles').textContent = '4';
document.getElementById('activeProjects').textContent = '5';
document.getElementById('uniqueSkills').textContent = '0 (dynamic detection)';
}
// Load on page load
document.addEventListener('DOMContentLoaded', loadDashboard);
</script>
</body>
</html>