NexG Autopilot — AI Office
NexG Autopilot LIVE
Meta API
Claude AI
Monday
0 accounts --:--:--
Loading...

Daily Pipeline

Account Health Overview

AccountHealthCPLTargetSpendRegsFreqPhase

Activity Feed

W
CEO Agent — Digital William
Yo bro. I'm your digital twin — I think like you, decide like you. Tell me what you need and I'll delegate to the right bot. Try: "what's going on with [client]?" or "new ads for [client] about [topic]"
Overview
Accounts
Events
Creatives
Structure
Memory
Profile
Assets
Ads
Changelog

January 2026

Mon
Tue
Wed
Thu
Fri
Sat
Sun

Upcoming Events

Legend

L1 Preview L2 Bootcamp L3 Mentorship

Scan Results

No scan data. Click "Run Full Scan" to start.
Run a scan first, then click "Generate Recommendations" to get CEO Agent + Ads Specialist analysis.

Generate Content

Scan history will appear here after your first scan.
Files
Linked
Terms
Intake
Folders
KNOWLEDGE GRAPH
KB SOPs Agents Clients Empact

Select a Node

Click on any node in the graph to see its details, connections, and content preview.

Files by Folder

API Configuration

Autopilot Controls

Control how Hermes agents operate autonomously. These settings sync to Firestore and are read by all agents.
AGM — Autopilot Mode
ON: Low-risk actions auto-approve. OFF: All actions queue for manual approval.
FAN — Full Agent Network
ON: Agents can search external web. OFF: Internal knowledge base only.
Daily Budget Cap
Max daily API spend (USD). Agents auto-pause when reached. $0.00 / $20.00
$
Agent Engine: Hermes v0.7.0
▶ Active

Bot Model Configuration

Assign AI models to each bot. Use premium models (Claude Sonnet) for quality-critical bots, cheap models (Gemini Flash) for routine tasks.

Cost Tracker

Token usage and cost per bot. Tracked from API calls in this session. Stored in localStorage.

User Info

Reads from Firestore collections (already wired in parent page): nkn_staging, nkn_feedback, nkn_coach_stats, nkn_lessons, nkn_canary_runs, nkn_settings/global, nexg_kb_index/latest. Uses parent page globals: _fbDb, _fbAuth, esc, fmRM, fn, showPage, addActivity, STATE. ================================================================ */ (function () { 'use strict'; // Wait for parent app to finish auth + initial render function whenReady(cb) { if (window._fbDb && window.esc && document.querySelector('.sidebar')) return cb(); setTimeout(() => whenReady(cb), 200); } // --- Inject styles --- function injectStyles() { const css = ` .nkn-kpi{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:14px;text-align:center} .nkn-kpi .v{font-size:22px;font-weight:700;color:#fff;letter-spacing:-0.3px} .nkn-kpi .l{font-size:10px;color:var(--dim);text-transform:uppercase;letter-spacing:0.5px;margin-top:4px} .nkn-feed-card{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:14px 16px;margin-bottom:10px} .nkn-feed-card:hover{border-color:rgba(129,140,248,0.25)} .nkn-feed-head{display:flex;align-items:center;gap:10px;margin-bottom:8px} .nkn-source-chip{font-size:9px;padding:2px 7px;border-radius:4px;font-weight:700;letter-spacing:0.3px} .nkn-source-chip.youtube{background:rgba(248,113,113,0.15);color:#f87171} .nkn-source-chip.twitter{background:rgba(59,130,246,0.15);color:#60a5fa} .nkn-source-chip.substack{background:rgba(251,191,36,0.15);color:#fbbf24} .nkn-source-chip.article{background:rgba(167,139,250,0.15);color:#a78bfa} .nkn-status-pill{font-size:9px;padding:2px 8px;border-radius:99px;font-weight:600} .nkn-status-pill.live{background:rgba(52,211,153,0.15);color:#34d399} .nkn-status-pill.pending{background:rgba(251,191,36,0.15);color:#fbbf24} .nkn-status-pill.review{background:rgba(244,114,182,0.15);color:#f472b6} .nkn-status-pill.failed{background:rgba(248,113,113,0.15);color:#f87171} .nkn-depth-bar{display:inline-flex;gap:2px;vertical-align:middle} .nkn-depth-bar span{width:5px;height:8px;border-radius:1px;background:rgba(255,255,255,0.1)} .nkn-depth-bar span.on{background:#818cf8} .nkn-gate-card{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:14px 16px;margin-bottom:10px} .nkn-gate-actions{display:flex;gap:6px;margin-top:10px;flex-wrap:wrap} .nkn-coach-card{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:16px;text-align:center} .nkn-coach-name{font-size:14px;font-weight:700;color:#fff;margin-bottom:4px} .nkn-coach-niche{font-size:10px;color:var(--dim);margin-bottom:10px} .nkn-coach-stat-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin-top:10px} .nkn-coach-stat{background:var(--card2);border-radius:6px;padding:6px} .nkn-coach-stat .v{font-size:15px;font-weight:700;color:#fff} .nkn-coach-stat .l{font-size:8px;text-transform:uppercase;color:var(--dim)} .nkn-lesson-row{display:flex;align-items:center;gap:10px;padding:10px;background:var(--card);border:1px solid var(--border);border-radius:8px;margin-bottom:6px} .nkn-lesson-cat{font-size:9px;padding:2px 7px;border-radius:4px;background:rgba(129,140,248,0.15);color:var(--cyan);font-weight:600;text-transform:uppercase} .nkn-lesson-rule{flex:1;font-size:12px;color:var(--text)} .nkn-lesson-freq{font-size:10px;color:var(--dim);font-family:'Geist Mono',monospace} .nkn-pipeline-stage{display:flex;align-items:center;gap:8px;padding:12px 16px;background:var(--card);border:1px solid var(--border);border-radius:10px;margin-bottom:8px} .nkn-pipeline-stage-n{width:24px;height:24px;border-radius:50%;background:rgba(129,140,248,0.15);color:var(--cyan);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:11px} .nkn-pipeline-stage-info{flex:1} .nkn-pipeline-stage-name{font-size:12px;font-weight:600;color:#fff} .nkn-pipeline-stage-meta{font-size:10px;color:var(--dim2);margin-top:2px} .nkn-pipeline-stage-count{font-size:14px;font-weight:700;color:var(--cyan)} .nkn-filter-row{display:flex;gap:6px;margin-bottom:12px;flex-wrap:wrap} .nkn-filter-row .btn.active{background:rgba(129,140,248,0.2);border-color:rgba(129,140,248,0.4);color:#818cf8} .nkn-budget-gauge{width:100%;height:10px;background:var(--card2);border-radius:5px;overflow:hidden;margin:10px 0} .nkn-budget-gauge-fill{height:100%;transition:width 0.5s;background:linear-gradient(90deg,#34d399,#fbbf24,#f87171)} .nkn-canary-row{display:flex;align-items:center;gap:12px;padding:10px;background:var(--card2);border-radius:8px;margin-bottom:6px} .nkn-canary-icon{width:24px;text-align:center;font-size:16px} .nkn-swipe-card{background:var(--card);border:1px solid var(--border);border-radius:10px;padding:12px;margin-bottom:8px} .nkn-swipe-type{display:inline-block;font-size:8px;padding:2px 7px;border-radius:4px;background:rgba(251,191,36,0.15);color:#fbbf24;font-weight:700;text-transform:uppercase;margin-right:8px} .nkn-swipe-text{font-size:12px;color:var(--text);line-height:1.5;font-style:italic} .nkn-swipe-meta{font-size:10px;color:var(--dim);margin-top:6px} `; const style = document.createElement('style'); style.id = 'nkn-styles'; style.textContent = css; document.head.appendChild(style); } // --- Inject sidebar section + pages --- function injectSidebar() { const sidebar = document.querySelector('.sidebar'); if (!sidebar) return; if (document.getElementById('nkn-sec')) return; // already injected const block = document.createElement('div'); block.id = 'nkn-sec-wrap'; block.innerHTML = `
NKN
`; sidebar.appendChild(block); const main = document.querySelector('.main'); if (!main) return; const pagesHTML = `
`; main.insertAdjacentHTML('beforeend', pagesHTML); } // --- State + listeners --- const NKN_STATE = { staging: {}, feedback: {}, coachStats: {}, lessons: [], canaryRuns: [], settings: {}, feedFilter: 'all', unsubs: [], }; function startListeners() { const db = window._fbDb; if (!db) return; NKN_STATE.unsubs.forEach(u => { try { u(); } catch (e) {} }); NKN_STATE.unsubs = []; // Staging (pending gate review + recent feed) NKN_STATE.unsubs.push(db.collection('nkn_staging').orderBy('created_at', 'desc').limit(100) .onSnapshot(snap => { NKN_STATE.staging = {}; snap.forEach(doc => { NKN_STATE.staging[doc.id] = { _id: doc.id, ...doc.data() }; }); updateGateBadge(); if (document.getElementById('page-nkn-feed')?.classList.contains('active')) renderFeed(); if (document.getElementById('page-nkn-gate')?.classList.contains('active')) renderGate(); }, e => console.warn('nkn_staging listener', e.message))); // Coach stats (daily rollup) NKN_STATE.unsubs.push(db.collection('nkn_coach_stats').orderBy('date', 'desc').limit(30) .onSnapshot(snap => { NKN_STATE.coachStats = {}; snap.forEach(doc => { NKN_STATE.coachStats[doc.id] = doc.data(); }); if (document.getElementById('page-nkn-coaches')?.classList.contains('active')) renderCoaches(); }, e => console.warn('nkn_coach_stats listener', e.message))); // Lessons (top N post-mortem) NKN_STATE.unsubs.push(db.collection('nkn_lessons').orderBy('frequency', 'desc').limit(50) .onSnapshot(snap => { NKN_STATE.lessons = []; snap.forEach(doc => NKN_STATE.lessons.push({ _id: doc.id, ...doc.data() })); if (document.getElementById('page-nkn-lessons')?.classList.contains('active')) renderLessons(); }, e => console.warn('nkn_lessons listener', e.message))); // Canary runs (health page) NKN_STATE.unsubs.push(db.collection('nkn_canary_runs').orderBy('ts', 'desc').limit(20) .onSnapshot(snap => { NKN_STATE.canaryRuns = []; snap.forEach(doc => NKN_STATE.canaryRuns.push({ _id: doc.id, ...doc.data() })); if (document.getElementById('page-nkn-health')?.classList.contains('active')) renderHealth(); }, e => console.warn('nkn_canary_runs listener', e.message))); // Settings (budget gauge) NKN_STATE.unsubs.push(db.collection('nexg_settings').doc('global') .onSnapshot(doc => { if (doc.exists) NKN_STATE.settings = doc.data(); if (document.getElementById('page-nkn-budget')?.classList.contains('active')) renderBudget(); }, e => console.warn('nkn_settings listener', e.message))); } function updateGateBadge() { const pending = Object.values(NKN_STATE.staging).filter(s => ['gate-1-merge-suggested', 'gate-2-awaiting-human'].includes(s.status)); const badge = document.getElementById('nkn-gate-badge'); if (!badge) return; if (pending.length > 0) { badge.style.display = 'inline'; badge.textContent = pending.length; } else { badge.style.display = 'none'; } } // ================================================================= // PAGE RENDERERS // ================================================================= function renderFeed() { const el = document.getElementById('page-nkn-feed'); if (!el) return; const items = Object.values(NKN_STATE.staging); const filtered = NKN_STATE.feedFilter === 'all' ? items : items.filter(i => (i.source_type || '') === NKN_STATE.feedFilter); el.innerHTML = `
${items.length}
Total (7d)
${items.filter(i=>i.status==='kb-live').length}
Live
${items.filter(i=>['gate-2-awaiting-human','gate-1-merge-suggested'].includes(i.status)).length}
Awaiting
${items.filter(i=>String(i.status).startsWith('rejected')||i.status==='gate-0-failed').length}
Rejected
${items.filter(i=>i.status==='deepdive-complete').length}
Deepdived
${['all','youtube','twitter','substack','article'].map(f=>``).join('')}
${filtered.length===0 ? '
No entries yet. Forward a URL via Telegram /nkn <url> or click "Forward URL" above.
' : filtered.map(renderFeedCard).join('')}
`; } function renderFeedCard(item) { const src = item.source_type || 'article'; const status = item.status || 'pending'; const statusKey = status.includes('kb-live') || status==='deepdive-complete' ? 'live' : String(status).startsWith('rejected')||status==='gate-0-failed' ? 'failed' : String(status).includes('review')||String(status).includes('human')||String(status).includes('merge') ? 'review' : 'pending'; const depth = item.depth_score || 0; const depthBar = `${[1,2,3,4,5].map(n=>``).join('')}`; const tags = (item.empact_tags||item.tags||[]).map(t=>`${window.esc(t)}`).join(''); const title = item.title || item.summary?.substring(0,80) || item._id; return `
${src} ${status} ${depthBar} ${item.created_at?new Date(item.created_at._seconds?item.created_at._seconds*1000:item.created_at).toLocaleString('en-MY',{month:'short',day:'numeric',hour:'2-digit',minute:'2-digit'}):''}
${window.esc(title)}
${window.esc((item.summary||'').substring(0,200))}${(item.summary||'').length>200?'...':''}
${tags}
`; } function renderGate() { const el = document.getElementById('page-nkn-gate'); if (!el) return; const pending = Object.values(NKN_STATE.staging).filter(s => ['gate-1-merge-suggested', 'gate-2-awaiting-human'].includes(s.status)); el.innerHTML = ` ${pending.length===0 ? '
🎉 Gate queue clear.
' : pending.map(item => { const similar = item.similar_kb_ids || []; const isMerge = item.status === 'gate-1-merge-suggested'; return `
${item.source_type||'article'} ${item.status} ${window.esc(item.title||item._id)}
${window.esc((item.summary||'').substring(0,300))}
${isMerge && similar.length ? `
${similar.length} similar entries found
${similar.slice(0,3).map(s=>`
↳ ${window.esc(s.kb_path||s.file||'?')} (${(s.score||0).toFixed(2)})
`).join('')}
` : ''}
${isMerge ? similar.slice(0,2).map((s,i)=>``).join('') : ''}
`; }).join('')} `; } function renderSwipe() { const el = document.getElementById('page-nkn-swipe'); if (!el) return; // Collect swipe entries embedded in staging summaries const entries = []; Object.values(NKN_STATE.staging).forEach(s => { (s.swipe_entries||[]).forEach(e => entries.push({ ...e, kb_id: s._id, source_title: s.title })); }); const types = ['all','headline','cta','offer_stack','hook','email_subject']; const filter = NKN_STATE.swipeFilter || 'all'; const filtered = filter==='all' ? entries : entries.filter(e => e.type===filter); el.innerHTML = `
${types.map(t=>``).join('')}
${filtered.length===0 ? '
No swipe entries yet. Deepdives extract swipe candidates automatically.
' : filtered.map(e=>`
${e.type||'?'}from ${window.esc((e.source_title||'?').substring(0,50))}
"${window.esc(e.text||'')}"
📋 Copy
`).join('')} `; } function renderCoaches() { const el = document.getElementById('page-nkn-coaches'); if (!el) return; const coaches = [ { id:'hormozi', name:'Alex Hormozi', niche:'Offer, scaling, high-ticket' }, { id:'brunson', name:'Russell Brunson', niche:'Funnels, webinars, community' }, { id:'kennedy', name:'Dan Kennedy', niche:'Direct response, positioning' }, { id:'halbert', name:'Gary Halbert', niche:'Long-form copy, hooks' }, { id:'schwartz', name:'Eugene Schwartz', niche:'Awareness, market sophistication' }, ]; // Aggregate across all daily stats const totals = {}; Object.values(NKN_STATE.coachStats).forEach(day => { Object.entries(day).forEach(([cid, stats]) => { if (!totals[cid]) totals[cid] = { deepdives:0, thumbs_up:0, thumbs_down:0 }; totals[cid].deepdives += (stats.deepdives||0); totals[cid].thumbs_up += (stats.thumbs_up||0); totals[cid].thumbs_down += (stats.thumbs_down||0); }); }); el.innerHTML = `
70% of deepdives use a coach lens; 30% generic. Rotation tracks recent use to spread lenses across KB.
${coaches.map(c=>{ const t = totals[c.id] || {deepdives:0,thumbs_up:0,thumbs_down:0}; const totalFb = t.thumbs_up + t.thumbs_down; const rate = totalFb ? Math.round(t.thumbs_up/totalFb*100) : '–'; return `
${c.name}
${c.niche}
${t.deepdives}
Deepdives
${t.thumbs_up}
👍
${t.thumbs_down}
👎
Approval: ${rate}${rate==='–'?'':'%'}
`; }).join('')}
`; } function renderLessons() { const el = document.getElementById('page-nkn-lessons'); if (!el) return; el.innerHTML = `
Top 5 lessons are injected into future synthesis prompts. Toggle individual lessons to disable injection.
${NKN_STATE.lessons.length===0 ? '
No rejection lessons yet.
' : NKN_STATE.lessons.slice(0, 20).map(l=>`
${window.esc(l.category||'?')} ${window.esc(l.rule||'')} ${l.frequency||0}×
`).join('')} `; } function renderHealth() { const el = document.getElementById('page-nkn-health'); if (!el) return; const latest = NKN_STATE.canaryRuns[0]; const verdictColor = latest?.verdict==='pass'?'var(--green)':latest?.verdict==='warn'?'var(--amber)':'var(--red)'; el.innerHTML = `
${latest?latest.verdict.toUpperCase():'–'}
Last Canary
${latest?`${latest.passed}/${latest.total}`:'–'}
Pass Rate
${NKN_STATE.canaryRuns.length}
Runs (30d)
${latest?new Date(latest.ts).toLocaleDateString('en-MY'):'–'}
Last Run

Recent Canary Runs

${NKN_STATE.canaryRuns.slice(0,10).map(r=>{ const vc = r.verdict==='pass'?'#34d399':r.verdict==='warn'?'#fbbf24':'#f87171'; const ic = r.verdict==='pass'?'✅':r.verdict==='warn'?'⚠️':'🛑'; return `
${ic}
${new Date(r.ts).toLocaleString('en-MY')}
${r.passed}/${r.total} passed · rate ${(r.pass_rate*100).toFixed(0)}%
${r.verdict}
`; }).join('') || '
No canary runs recorded yet.
'}
`; } function renderBudget() { const el = document.getElementById('page-nkn-budget'); if (!el) return; const s = NKN_STATE.settings; const cap = s.daily_budget_cap || 20; const spent = s.daily_spend || 0; const pct = Math.min(100, (spent/cap)*100); el.innerHTML = `

Today's Spend

Reset at midnight GMT+8
$${spent.toFixed(2)}/ $${cap.toFixed(2)}
0%80%90%100%
${pct.toFixed(0)}%
Budget Used
${Object.values(NKN_STATE.staging).length}
Items Today
${spent>0 && Object.values(NKN_STATE.staging).length ? '$'+(spent/Math.max(1,Object.values(NKN_STATE.staging).length)).toFixed(3) : '–'}
Cost / Entry
`; } function renderPipeline() { const el = document.getElementById('page-nkn-pipeline'); if (!el) return; const items = Object.values(NKN_STATE.staging); const stages = [ { n:'0', name:'Gate 0 Intake', desc:'URL validity + dedup + pressure + budget', count:items.filter(i=>['intake-pending','gate-0-passed','gate-0-failed'].includes(i.status)).length }, { n:'1', name:'Synthesize L1', desc:'Sonnet — title + summary + tags + depth', count:items.filter(i=>['synthesizing-l1','stage-1-complete','rejected-stage-1'].includes(i.status)).length }, { n:'1g', name:'Gate 1 Quality + Dedup', desc:'Zero-LLM quality + vector semantic dedup', count:items.filter(i=>['gate-1-checking','gate-1-passed','gate-1-merge-suggested','rejected-gate-1'].includes(i.status)).length }, { n:'2', name:'Gate 2 Caroline + Joanne', desc:'Marketing fit (Opus) + Operational fit (Sonnet)', count:items.filter(i=>['gate-2-pending','gate-2-review','gate-2-awaiting-human','rejected-gate-2'].includes(i.status)).length }, { n:'K', name:'KB Write + Auto-index', desc:'Obsidian write + LanceDB vector index', count:items.filter(i=>['kb-ready','kb-live'].includes(i.status)).length }, { n:'2d', name:'Stage 2 Deepdive (Opus)', desc:'Coach lens + 7-tier validation', count:items.filter(i=>['stage-2-deepdive-pending','stage-2-deepdive-in-progress','deepdive-complete'].includes(i.status)).length }, ]; el.innerHTML = ` ${stages.map(s=>`
${s.n}
${s.name}
${s.desc}
${s.count}
`).join('')} `; } // ================================================================= // ACTIONS // ================================================================= function promptForwardUrl() { const url = prompt('Paste URL to forward into NKN:'); if (!url) return; window._fbDb.collection('nkn_staging').add({ source_url: url, status: 'intake-pending', source_type: 'pending_detection', created_at: firebase.firestore.FieldValue.serverTimestamp(), submitted_by: window.currentUser?.email || 'dashboard', }).then(() => window.addActivity?.('ceo', `Forwarded URL to NKN: ${url.substring(0, 60)}`)) .catch(e => alert('Error: ' + e.message)); } function gateAction(kbId, action, mergeIdx) { const update = { approved_by: window.currentUser?.email || 'dashboard', updated_at: firebase.firestore.FieldValue.serverTimestamp() }; if (action === 'approve') update.status = 'kb-live'; else if (action === 'reject') update.status = 'rejected-gate-2'; else if (action === 'merge') { update.status = 'merged'; update.merge_target_idx = mergeIdx; } window._fbDb.collection('nkn_staging').doc(kbId).update(update) .catch(e => alert('Gate action failed: ' + e.message)); } function toggleLesson(lessonId, active) { window._fbDb.collection('nkn_lessons').doc(lessonId).update({ active }) .catch(() => { /* silent */ }); } function runCanary() { alert('Canary runs via hermes backend — use /canary in Telegram, or wait for Friday 06:00 auto-run.'); } function setFeedFilter(f) { NKN_STATE.feedFilter = f; renderFeed(); } function setSwipeFilter(f) { NKN_STATE.swipeFilter = f; renderSwipe(); } function openItem(kbId) { const item = NKN_STATE.staging[kbId]; if (!item) return; alert(`${item.title || kbId}\n\nStatus: ${item.status}\nSource: ${item.source_url || '?'}\n\n${(item.summary || '').substring(0, 400)}`); } // ================================================================= // PUBLIC API // ================================================================= window.NKN = { renderFeed, renderGate, renderSwipe, renderCoaches, renderLessons, renderHealth, renderBudget, renderPipeline, promptForwardUrl, gateAction, toggleLesson, runCanary, setFeedFilter, setSwipeFilter, openItem, _state: NKN_STATE, }; // --- Bootstrap --- whenReady(() => { injectStyles(); injectSidebar(); startListeners(); console.log('[NKN] module loaded — 8 pages added to sidebar'); }); })();