Now let me also update `loadDeepAnalysis()` in thread_view.php to show the playbook name when loading saved results.


3500:        async function loadDeepAnalysis() {


3500→        async function loadDeepAnalysis() {
  3501→            var daContainer = document.getElementById('deep-analysis-container');
  3502→            var daResults = document.getElementById('deep-analysis-results');
  3503→            var daProgress = document.getElementById('deep-analysis-progress');
  3504→
  3505→            daContainer.style.display = 'block';
  3506→            daResults.innerHTML = '
Loading deep analysis...
';
  3507→            daProgress.textContent = 'Loading...';
  3508→            daContainer.scrollIntoView({ behavior: 'smooth' });
  3509→
  3510→            try {
  3511→                var resp = await fetch('api.php?action=load_deep_analysis&thread_id=' + encodeURIComponent(currentThreadId));
  3512→                var data = await resp.json();
  3513→
  3514→                if (!data.success || !data.passes || data.passes.length === 0) {
  3515→                    daResults.innerHTML = '
No deep analysis found for this thread.
';
  3516→                    daProgress.textContent = '';
  3517→                    return;
  3518→                }
  3519→
  3520→                daResults.innerHTML = '';
  3521→                daProgress.textContent = data.passes.length + ' passes loaded';
  3522→
  3523→                data.passes.forEach(function(pass) {
  3524→                    var passAgent = AI_AGENTS[pass.agent] || { name: pass.agent, icon: '' };
  3525→
  3526→                    var passSection = document.createElement('div');
  3527→                    passSection.style.cssText = 'margin-bottom:20px;border:1px solid #e5e7eb;border-radius:8px;overflow:hidden;';
  3528→
  3529→                    var passHtml = '
' +
  3530→                        'Pass ' + pass.pass + ': ' + escapeHtml(pass.name) + '' +
  3531→                        'Agent: ' + escapeHtml(passAgent.icon + ' ' + passAgent.name) + '' +
  3532→                        '

';
  3533→
  3534→                    pass.responses.forEach(function(r) {
  3535→                        passHtml += '
';
  3536→                        passHtml += '
';
  3537→                        passHtml += '' + escapeHtml(r.provider) + '';
  3538→                        passHtml += '' + escapeHtml(r.model) + ' | ' + (r.request_time ? parseFloat(r.request_time).toFixed(1) + 's' : '') + ' | $' + (r.cost ? parseFloat(r.cost).toFixed(4) : '0') + '';
  3539→                        passHtml += '
';
  3540→                        passHtml += '
' + escapeHtml(r.response) + '
';
  3541→                        passHtml += '
';
  3542→                    });
  3543→
  3544→                    passHtml += '
';
  3545→                    passSection.innerHTML = passHtml;
  3546→                    daResults.appendChild(passSection);
  3547→                });
  3548→
  3549→                // Add info footer
  3550→                var footer = document.createElement('div');
  3551→                footer.style.cssText = 'margin-top:15px;padding:15px;background:linear-gradient(135deg,#f0fdf4,#ecfeff);border-radius:8px;border:1px solid #86efac;';
  3552→                footer.innerHTML = 'Deep Analysis Loaded
' +
  3553→                    '' + data.total_responses + ' saved responses across ' + data.passes.length + ' passes.';
  3554→                daResults.appendChild(footer);
  3555→
  3556→            } catch (err) {
  3557→                daResults.innerHTML = '
Error loading deep analysis: ' + escapeHtml(err.message) + '
';
  3558→                daProgress.textContent = 'Error';
  3559→            }
  3560→        }
  3561→
  3562→        // Submit to AI
  3563→        async function submitToAI() {
  3564→            var selectedProvidersList = getSelectedProviders();
  3565→
  3566→            if (selectedProvidersList.length === 0) {
  3567→                alert('Please select at least one AI provider');
  3568→                return;
  3569→            }

async function loadDeepAnalysis() {
            var daContainer = document.getElementById('deep-analysis-container');
            var daResults = document.getElementById('deep-analysis-results');
            var daProgress = document.getElementById('deep-analysis-progress');

            daContainer.style.display = 'block';
            daResults.innerHTML = '
Loading deep analysis...
';
            daProgress.textContent = 'Loading...';
            daContainer.scrollIntoView({ behavior: 'smooth' });

            try {
                var resp = await fetch('api.php?action=load_deep_analysis&thread_id=' + encodeURIComponent(currentThreadId));
                var data = await resp.json();

                if (!data.success || !data.passes || data.passes.length === 0) {
                    daResults.innerHTML = '
No deep analysis found for this thread.
';
                    daProgress.textContent = '';
                    return;
                }

                daResults.innerHTML = '';
                daProgress.textContent = data.passes.length + ' passes loaded';

                data.passes.forEach(function(pass) {
                    var passAgent = AI_AGENTS[pass.agent] || { name: pass.agent, icon: '' };

                    var passSection = document.createElement('div');
                    passSection.style.cssText = 'margin-bottom:20px;border:1px solid #e5e7eb;border-radius:8px;overflow:hidden;';

                    var passHtml = '
' +
                        'Pass ' + pass.pass + ': ' + escapeHtml(pass.name) + '' +
                        'Agent: ' + escapeHtml(passAgent.icon + ' ' + passAgent.name) + '' +
                        '

';

                    pass.responses.forEach(function(r) {
                        passHtml += '
';
                        passHtml += '
';
                        passHtml += '' + escapeHtml(r.provider) + '';
                        passHtml += '' + escapeHtml(r.model) + ' | ' + (r.request_time ? parseFloat(r.request_time).toFixed(1) + 's' : '') + ' | $' + (r.cost ? parseFloat(r.cost).toFixed(4) : '0') + '';
                        passHtml += '
';
                        passHtml += '
' + escapeHtml(r.response) + '
';
                        passHtml += '
';
                    });

                    passHtml += '
';
                    passSection.innerHTML = passHtml;
                    daResults.appendChild(passSection);
                });

                // Add info footer
                var footer = document.createElement('div');
                footer.style.cssText = 'margin-top:15px;padding:15px;background:linear-gradient(135deg,#f0fdf4,#ecfeff);border-radius:8px;border:1px solid #86efac;';
                footer.innerHTML = 'Deep Analysis Loaded
' +
                    '' + data.total_responses + ' saved responses across ' + data.passes.length + ' passes.';
                daResults.appendChild(footer);

            } catch (err) {
                daResults.innerHTML = '
Error loading deep analysis: ' + escapeHtml(err.message) + '
';
                daProgress.textContent = 'Error';
            }
        }

        // Submit to AI
        async function submitToAI() {
            var selectedProvidersList = getSelectedProviders();

            if (selectedProvidersList.length === 0) {
                alert('Please select at least one AI provider');
                return;
            }


Update `loadDeepAnalysis()` to show the playbook name in the header and footer.


Edit

                daResults.innerHTML = '';
                daProgress.textContent = data.passes.length + ' passes loaded';

                data.passes.forEach(function(pass) {

                daResults.innerHTML = '';
                var playbookName = '';
                if (data.playbook && DEEP_ANALYSIS_PLAYBOOKS[data.playbook]) {
                    playbookName = DEEP_ANALYSIS_PLAYBOOKS[data.playbook].name;
                    daProgress.textContent = playbookName + ' — ' + data.passes.length + ' passes loaded';
                } else {
                    daProgress.textContent = data.passes.length + ' passes loaded';
                }

                data.passes.forEach(function(pass) {