diff options
Diffstat (limited to 'roadmap.html')
| -rw-r--r-- | roadmap.html | 971 |
1 files changed, 971 insertions, 0 deletions
diff --git a/roadmap.html b/roadmap.html new file mode 100644 index 0000000..a0d9ca6 --- /dev/null +++ b/roadmap.html @@ -0,0 +1,971 @@ +<!DOCTYPE html> +<html lang="en"> +<head> +<meta charset="UTF-8"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta name="theme-color" content="#000000"> +<title>newOS4 Roadmap — Self-Improving Autonomous OS</title> +<style> +:root { + --bg-color: #000000; + --bg-secondary: #0a0a0a; + --bg-tertiary: #111111; + --text-color: #00ff00; + --text-muted: #888888; + --accent-color: #00aa00; + --border-color: #005500; + --error-color: #ff5555; + --warning-color: #ffaa00; + --success-color: #00ff00; + --info-color: #55aaff; + --phase-color: #00aa00; + --danger-color: #ff4444; +} +* { box-sizing: border-box; margin: 0; padding: 0; } +body { + background: var(--bg-color); + color: var(--text-color); + font-family: 'Cascadia Code', 'JetBrains Mono', 'Fira Code', 'Consolas', 'Courier New', monospace; + line-height: 1.6; + font-size: 14px; + padding: 0; + overflow-x: hidden; +} +.container { max-width: 1100px; margin: 0 auto; padding: 20px; } + +/* Header */ +header { + background: var(--bg-secondary); + border-bottom: 2px solid var(--border-color); + padding: 30px 20px; + text-align: center; +} +header h1 { + font-size: 28px; + color: var(--text-color); + text-shadow: 0 0 10px rgba(0,255,0,0.3); + letter-spacing: 1px; +} +header .subtitle { color: var(--text-muted); font-size: 13px; margin-top: 8px; } +header .ver-badge { + display: inline-block; + background: var(--bg-tertiary); + border: 1px solid var(--accent-color); + border-radius: 4px; + padding: 3px 12px; + margin: 5px 3px; + font-size: 12px; + color: var(--accent-color); +} +header .ver-badge.target { color: var(--warning-color); border-color: var(--warning-color); } + +/* Status bar */ +.status-bar { + display: flex; + gap: 10px; + justify-content: center; + flex-wrap: wrap; + margin: 15px 0; +} +.status-pill { + padding: 4px 14px; + border-radius: 20px; + font-size: 12px; + font-weight: bold; + border: 1px solid; +} +.status-live { background: rgba(0,255,0,0.1); border-color: var(--success-color); color: var(--success-color); } +.status-pending { background: rgba(255,170,0,0.1); border-color: var(--warning-color); color: var(--warning-color); } +.status-blocked { background: rgba(255,85,85,0.1); border-color: var(--error-color); color: var(--error-color); } + +/* Sections */ +section { + background: var(--bg-secondary); + border: 1px solid var(--border-color); + border-radius: 6px; + padding: 25px; + margin: 20px 0; +} +section h2 { + font-size: 18px; + color: var(--accent-color); + margin-bottom: 15px; + padding-bottom: 8px; + border-bottom: 1px solid var(--border-color); +} +section h3 { + font-size: 15px; + color: var(--text-color); + margin: 15px 0 8px; +} + +/* Tables */ +table { + width: 100%; + border-collapse: collapse; + margin: 10px 0; + font-size: 13px; +} +th { + background: var(--bg-tertiary); + color: var(--accent-color); + text-align: left; + padding: 8px 12px; + border: 1px solid var(--border-color); + font-weight: normal; + text-transform: uppercase; + letter-spacing: 0.5px; + font-size: 11px; +} +td { + padding: 8px 12px; + border: 1px solid var(--border-color); + color: var(--text-color); + vertical-align: top; +} +tr:nth-child(even) td { background: var(--bg-tertiary); } +td.center, th.center { text-align: center; } +td.muted { color: var(--text-muted); } +td.pass { color: var(--success-color); } +td.fail { color: var(--error-color); } +td.warn { color: var(--warning-color); } +td.info { color: var(--info-color); } + +/* Pipeline diagram */ +.pipeline-box { + background: var(--bg-color); + border: 1px solid var(--border-color); + border-radius: 6px; + padding: 20px; + overflow-x: auto; + font-size: 12px; + margin: 10px 0; +} +.pipeline-box pre { + color: var(--text-color); + white-space: pre; +} +.pipeline-box .step { color: var(--accent-color); } +.pipeline-box .new { color: var(--warning-color); font-weight: bold; } +.pipeline-box .gate { color: var(--danger-color); font-weight: bold; } +.pipeline-box .ok { color: var(--success-color); } + +/* Phase cards */ +.phase-card { + background: var(--bg-tertiary); + border: 1px solid var(--border-color); + border-radius: 6px; + padding: 18px; + margin: 12px 0; +} +.phase-card:hover { border-color: var(--accent-color); } +.phase-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 10px; +} +.phase-num { + font-size: 11px; + color: var(--accent-color); + font-weight: bold; + letter-spacing: 1px; +} +.phase-ver { + font-size: 11px; + color: var(--warning-color); + border: 1px solid var(--warning-color); + border-radius: 3px; + padding: 2px 8px; +} +.phase-effort { + font-size: 11px; + color: var(--text-muted); +} +.phase-title { font-size: 14px; color: var(--text-color); margin-bottom: 8px; } + +/* Checklist */ +.checklist { list-style: none; padding: 0; } +.checklist li { + padding: 5px 0 5px 28px; + position: relative; + font-size: 13px; +} +.checklist li::before { + content: ''; + position: absolute; + left: 0; + top: 5px; + width: 18px; + height: 18px; + border: 1px solid var(--border-color); + border-radius: 3px; + background: var(--bg-color); +} +.checklist li.done::before { + background: var(--success-color); + border-color: var(--success-color); +} +.checklist li.done::after { + content: '✓'; + position: absolute; + left: 4px; + top: 3px; + color: var(--bg-color); + font-weight: bold; + font-size: 13px; +} +.checklist li.pending::before { + border-color: var(--warning-color); +} +.checklist li.pending::after { + content: '◯'; + position: absolute; + left: 3px; + top: 2px; + color: var(--warning-color); + font-size: 14px; +} + +/* Confidence gate */ +.confidence-gate { + display: flex; + gap: 0; + margin: 15px 0; + border-radius: 6px; + overflow: hidden; + border: 1px solid var(--border-color); +} +.confidence-block { + flex: 1; + padding: 12px; + text-align: center; + font-size: 12px; +} +.confidence-block .score { font-size: 20px; font-weight: bold; display: block; } +.confidence-block .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; } +.cb-auto { background: rgba(0,255,0,0.08); color: var(--success-color); border-right: 1px solid var(--border-color); } +.cb-auto-log { background: rgba(0,170,0,0.08); color: var(--accent-color); border-right: 1px solid var(--border-color); } +.cb-human { background: rgba(255,170,0,0.08); color: var(--warning-color); border-right: 1px solid var(--border-color); } +.cb-abort { background: rgba(255,85,85,0.08); color: var(--error-color); } + +/* Gap analysis */ +.gap-card { + background: var(--bg-tertiary); + border-left: 3px solid var(--border-color); + padding: 14px; + margin: 10px 0; + border-radius: 0 4px 4px 0; +} +.gap-card.p0 { border-left-color: var(--error-color); } +.gap-card.p1 { border-left-color: var(--warning-color); } +.gap-card.p2 { border-left-color: var(--info-color); } +.gap-id { font-size: 11px; color: var(--text-muted); font-weight: bold; } +.gap-title { font-size: 14px; color: var(--text-color); margin: 3px 0 5px; } +.gap-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 5px; } +.gap-fix { + font-size: 12px; + color: var(--accent-color); + background: var(--bg-color); + border: 1px solid var(--border-color); + border-radius: 3px; + padding: 8px 10px; + margin-top: 5px; + white-space: pre-wrap; +} + +/* Test scenarios */ +.test-scenario { + background: var(--bg-tertiary); + border: 1px solid var(--border-color); + border-radius: 4px; + padding: 12px; + margin: 8px 0; + font-size: 12px; +} +.test-id { font-weight: bold; color: var(--warning-color); } +.test-desc { color: var(--text-color); margin: 3px 0; } +.test-expected { color: var(--text-muted); } + +/* Open questions */ +.open-q { + background: var(--bg-tertiary); + border: 1px solid var(--border-color); + border-radius: 4px; + padding: 14px; + margin: 10px 0; +} +.open-q .q-num { font-weight: bold; color: var(--warning-color); } +.open-q .q-text { color: var(--text-color); margin-top: 3px; } + +/* Footer */ +footer { + text-align: center; + padding: 30px 20px; + color: var(--text-muted); + font-size: 11px; + border-top: 1px solid var(--border-color); + margin-top: 30px; +} +footer a { color: var(--info-color); text-decoration: none; } + +/* Risk matrix */ +.risk-matrix td { font-size: 12px; } +.risk-high { color: var(--error-color); font-weight: bold; } +.risk-med { color: var(--warning-color); } +.risk-low { color: var(--success-color); } + +/* Scrollbar */ +::-webkit-scrollbar { width: 8px; height: 8px; } +::-webkit-scrollbar-track { background: var(--bg-secondary); } +::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; } +::-webkit-scrollbar-thumb:hover { background: var(--accent-color); } + +/* Responsive */ +@media (max-width: 600px) { + .container { padding: 10px; } + section { padding: 15px; } + header h1 { font-size: 20px; } + table { font-size: 11px; } + th, td { padding: 5px 6px; } + .confidence-gate { flex-direction: column; } + .confidence-block { border-right: none; border-bottom: 1px solid var(--border-color); } +} +</style> +</head> +<body> + +<header> + <h1>newOS4 Roadmap</h1> + <div class="subtitle">Self-Improving Autonomous OS — Pipeline Review & Implementation Plan</div> + <div style="margin-top: 10px;"> + <span class="ver-badge">v4.6.03 LIVE</span> + <span class="ver-badge" style="color: var(--success-color); border-color: var(--success-color);">v4.6.09 SHIPPED</span> + <span class="ver-badge" style="color: var(--warning-color); border-color: var(--warning-color);">v4.6.10 PLANNED</span> + </div> + <div class="status-bar"> + <span class="status-pill status-live">9/9 Tools Live</span> + <span class="status-pill status-live">7/7 Phases (6 shipped, 1 planned)</span> + <span class="status-pill status-live">Auto-Commit Active</span> + </div> +</header> + +<div class="container"> + +<!-- ============ EXECUTIVE SUMMARY ============ --> +<section> + <h2>📋 Executive Summary</h2> + <p style="color: var(--text-color); margin-bottom: 12px;"> + The self-improvement pipeline is <strong style="color:var(--success-color)">live at v4.6.09</strong> with a 7-step loop: + <code style="color:var(--accent-color)">edit → test → health → regression → score → auto-commit (≥70) → verify → learn</code>. + All 6 original phases shipped. <strong style="color:var(--warning-color)">Phase 7 (v4.6.10)</strong> adds a + <strong style="color:var(--warning-color)">DebugSupervisorModule</strong> — persistent error database, clustering, + root-cause analysis, and cross-session auto-fix learning. + </div> +</section> + +<!-- ============ CURRENT STATE ============ --> +<section> + <h2>✅ Current State — What's Live (v4.6.09)</h2> + + <h3>Pipeline Architecture (verified in browser)</h3> + <div class="pipeline-box"> +<pre><span class="step">ship_module</span>({name, code, tests, commit:true}) + │ + ├─ 1. WRITE → <span class="step">_mods/Module.js</span> + meta.json + ├─ 2. TEST → <span class="step">test_module</span>(name, tests) + │ ├─ Load from _mods/ via loadModuleFromCode() + │ ├─ <span class="new">JS error capture ← LIVE</span> + │ ├─ Check: module loaded OK? → <span class="ok">rollback if not</span> + │ ├─ Check: commands lost? → <span class="ok">rollback if yes</span> + │ ├─ Run test assertions [{command, expect}] → <span class="ok">rollback on fail</span> + │ └─ Smoke test: run first command → <span class="ok">rollback on fail</span> + ├─ 3. HEALTH → <span class="step">health_check</span>() + │ ├─ Core commands: ls, pwd, echo, help, grep, find, tree, cat + │ ├─ <span class="new">JS error capture ← LIVE</span> + │ ├─ Module count + │ ├─ World model version match + │ └─ Agent status (total/healthy/failed) + ├─ 4. REGRESS → <span class="step">_runRegressionSuite</span>(moduleName) + │ └─ <span class="new">30+ tests across all modules ← LIVE</span> + ├─ 5. SCORE → <span class="step">_calculateConfidence()</span> + │ └─ score ≥ 70 → <span class="ok">auto-approve</span> + │ └─ score < 70 → human approval required + ├─ 6. COMMIT → <span class="step">_executeCommit()</span> + │ ├─ WebDAV push standalone .js + │ ├─ Bundle sync (find class block, replace) + │ ├─ Version bump (main.html + module-loader.js) + │ ├─ <span class="new">Post-commit syntax check ← LIVE</span> + │ └─ <span class="new">Auto-revert on syntax error ← LIVE</span> + ├─ 7. VERIFY → <span class="new">Post-commit fetch + validate ← LIVE</span> + └─ 8. LEARN → <span class="step">_postRunReview</span> + skill creation + └─ <span class="new">Auto-fix suggestions ← LIVE</span></pre> + </div> + + <h3>Tools Verified Live</h3> + <table> + <thead> + <tr><th>Tool</th><th class="center">Status</th><th>Notes</th></tr> + </thead> + <tbody> + <tr><td><code>edit_module</code></td><td class="center pass">✅ Live</td><td>Writes to <code>_mods/</code>, auto-loads</td></tr> + <tr><td><code>test_module</code></td><td class="center pass">✅ Live</td><td>Has assertions + inline rollback</td></tr> + <tr><td><code>reload_module</code></td><td class="center pass">✅ Live</td><td>Reverts <code>_mods/</code>, reloads from URL</td></tr> + <tr><td><code>list_modified_modules</code></td><td class="center pass">✅ Live</td><td>Lists pending edits</td></tr> + <tr><td><code>health_check</code></td><td class="center pass">✅ Live</td><td>Core cmds + world model + agents</td></tr> + <tr><td><code>diff_module</code></td><td class="center pass">✅ Live</td><td>Line-by-line diff, orig vs new</td></tr> + <tr><td><code>ship_module</code></td><td class="center pass">✅ Live</td><td>Full pipeline orchestrator with auto-commit (score ≥ 70)</td></tr> + <tr><td><code>commit_module</code></td><td class="center pass">✅ Live</td><td>Auto-executes if confidence ≥ 70, else creates pending commit</td></tr> + <tr><td><code>run_command</code></td><td class="center pass">✅ Live</td><td>Captures output via print monkey-patch</td></tr> + </tbody> + </table> + + <h3>Terminal Commands (human-facing)</h3> + <table> + <thead> + <tr><th>Command</th><th class="center">Status</th><th>Notes</th></tr> + </thead> + <tbody> + <tr><td><code>commit-approve</code></td><td class="center pass">✅ Live</td><td>Executes pending commit (WebDAV + bundle + version)</td></tr> + <tr><td><code>commit-deny</code></td><td class="center pass">✅ Live</td><td>Cancels pending commit</td></tr> + <tr><td><code>commit-status</code></td><td class="center pass">✅ Live</td><td>Shows pending commit details</td></tr> + </tbody> + </table> +</section> + +<!-- ============ GAP ANALYSIS ============ --> +<section> + <h2>🔍 Gap Analysis — What's Missing for Full Autonomy</h2> + + <div class="gap-card p0"> + <div class="gap-id">GAP 1 — P0 SAFETY CRITICAL</div> + <div class="gap-title">No JS Error Capture — <code>_captureConsoleErrors()</code> never coded</div> + <div class="gap-desc"> + The <code>health_check</code> handler sets <code>results.healthy = allCoreOk && results.versionMatch</code> — + it does <strong>NOT</strong> check for JavaScript errors. A module edit that introduces a silent + <code>TypeError</code> in a method that isn't called by the 4 core commands will pass health_check + and proceed to commit. + </div> + <div class="gap-desc"><strong>Impact:</strong> AI can commit a module that throws errors on <code>grep</code>, <code>find</code>, <code>tree</code> without detection.</div> + <div class="gap-fix">Fix: Implement <code>_captureConsoleErrors(durationMs)</code> using <code>console.error</code> + <code>window.onerror</code> interception. Wire into both <code>test_module</code> (after load) and <code>health_check</code> (add to <code>results.healthy</code> check).</div> + </div> + + <div class="gap-card p0"> + <div class="gap-id">GAP 2 — P0 COVERAGE CRITICAL</div> + <div class="gap-title">Regression Suite Too Thin — 15/19 modules have zero tests</div> + <table style="margin: 8px 0;"> + <tr><th>Module</th><th class="center">Tests</th><th>Module</th><th class="center">Tests</th></tr> + <tr><td>ShellModule</td><td class="center pass">4</td><td>WebDAVModule</td><td class="center fail">0</td></tr> + <tr><td>SystemModule</td><td class="center pass">2</td><td>CronModule</td><td class="center fail">0</td></tr> + <tr><td>OrchestratorModule</td><td class="center pass">1</td><td>ThemeModule</td><td class="center fail">0</td></tr> + <tr><td>WebX11AIAssistantModule</td><td class="center pass">1</td><td>MindmapModule</td><td class="center fail">0</td></tr> + <tr><td colspan="2" class="muted">+ 11 more untested</td><td colspan="2" class="muted">CalcModule, MediaModule, VoiceModule, etc.</td></tr> + </table> + <div class="gap-desc"><strong>Impact:</strong> AI edits any of 15 untested modules → regression returns <code>{allPassed: true, total: 0}</code> — a false positive. Pipeline commits without verification.</div> + <div class="gap-fix">Fix: Add 2+ regression tests per module to <code>_regressionTasks()</code>. Data-only change — the array just needs more entries. Target: 30+ tests across all 19 modules.</div> + </div> + + <div class="gap-card p1"> + <div class="gap-id">GAP 3 — P1 SAFETY NET</div> + <div class="gap-title">No Post-Commit Verification</div> + <div class="gap-desc"> + After <code>commit-approve</code> pushes files via WebDAV, there's no verification that the committed + code actually works on a fresh page load. If the code has a syntax error that passes + <code>loadModuleFromCode</code> but fails at HTTP fetch time, the next user refresh breaks the system. + </div> + <div class="gap-fix">Fix: After WebDAV push, fetch the file via HTTP, validate with <code>new Function(code)</code> (browser-safe syntax check). If validation fails, auto-revert by re-uploading the original code.</div> + </div> + + <div class="gap-card p1"> + <div class="gap-id">GAP 4 — P1 DECISION GATE</div> + <div class="gap-title">No Confidence Score</div> + <div class="gap-desc"> + The pipeline is binary — all tests pass → commit, any test fails → rollback. A 1-line typo fix in + <code>CalcModule</code> (no regression tests) is treated the same as a 200-line rewrite of + <code>ShellModule</code> (4 regression tests). Both get <code>commit: true</code>. + </div> + <div class="gap-fix">Fix: <code>_calculateConfidence(modName, testResult, healthResult, regResult, changeCount)</code>. Penalize: large changes, no regression tests, critical modules. Bonus: comprehensive AI-written tests. Auto-approve at ≥ 70.</div> + </div> + + <div class="gap-card p1"> + <div class="gap-id">GAP 5 — P1 RECOVERY</div> + <div class="gap-title">No Automatic Rollback on Next-Boot Failure</div> + <div class="gap-desc"> + If a committed change breaks the system on next page load, there's no automatic recovery. + The user has to manually identify the broken module and revert it. + </div> + <div class="gap-fix">Fix: Add a "boot watchdog" — before commit, save version to <code>last-good-version.json</code>. On boot, if core modules fail to register within timeout, auto-fetch and restore last-good versions.</div> + </div> + + <div class="gap-card p2"> + <div class="gap-id">GAP 6 — P2 AUTONOMY</div> + <div class="gap-title">Self-Improvement Trigger Not Implemented (Phase G)</div> + <div class="gap-desc"> + The plan's Phase G called for extending <code>_postRunReview</code> to detect repeated tool failures + and suggest <code>edit_module</code> fixes. This was never coded. The AI doesn't autonomously + identify bugs to fix — it only uses the pipeline when told to. + </div> + <div class="gap-fix">Fix: Build <code>_toolToModuleMap</code> at init. Extend <code>_postRunReview</code> to detect repeated tool failures → push auto-fix suggestions into next AI turn's context.</div> + </div> +</section> + +<!-- ============ CONFIDENCE GATE ============ --> +<section> + <h2>🚦 The Confidence Gate (Replaces Human Gate)</h2> + <p style="color: var(--text-muted); margin-bottom: 12px;"> + Instead of a binary human-approve/deny, the system calculates a confidence score based on + test coverage, change size, and module criticality. High-confidence changes auto-commit; + low-confidence changes still require human approval. + </p> + <div class="confidence-gate"> + <div class="confidence-block cb-auto"> + <span class="score">≥ 85</span> + <span class="label">Auto-commit<br>immediately</span> + </div> + <div class="confidence-block cb-auto-log"> + <span class="score">70–84</span> + <span class="label">Auto-commit<br>with log</span> + </div> + <div class="confidence-block cb-human"> + <span class="score">50–69</span> + <span class="label">Human approval<br>required</span> + </div> + <div class="confidence-block cb-abort"> + <span class="score">< 50</span> + <span class="label">Auto-abort</span> + </div> + </div> + + <h3>Scoring Formula</h3> + <div class="pipeline-box"> +<pre>Starting score: <span class="ok">100</span> + +<span style="color:var(--error-color)">Penalties:</span> + Change > 50 lines: -20 + Change > 100 lines: -20 (additional) + No regression tests: -30 + Critical module: -15 (ShellModule, SystemModule, OrchestratorModule, AIAssistant) + JS errors detected: -50 + +<span style="color:var(--success-color)">Bonuses:</span> + 3+ AI-written tests: +10 + +<span style="color:var(--warning-color)">Final score = max(0, min(100, score))</span></pre> + </div> +</section> + +<!-- ============ TARGET ARCHITECTURE ============ --> +<section> + <h2>🏗️ Target Architecture: v4.6.10 (Full Autonomy)</h2> + <div class="pipeline-box"> +<pre><span class="step">ship_module</span>({name, code, tests, commit:true}) + │ + ├─ 1. WRITE → <span class="step">_mods/Module.js</span> + ├─ 2. TEST → <span class="step">test_module</span>(name, tests) + │ ├─ Load + <span class="new">JS error capture ← NEW</span> + │ ├─ Command count check + │ ├─ Test assertions + │ └─ Smoke test + ├─ 3. HEALTH → <span class="step">health_check</span>() + │ ├─ Core commands (<span class="new">expanded to 8 ← NEW</span>) + │ ├─ <span class="new">JS error capture ← NEW</span> + │ ├─ Module count + │ ├─ World model version + │ └─ Agent status + ├─ 4. REGRESS → <span class="step">_runRegressionSuite</span>(moduleName) + │ └─ <span class="new">30+ tests across all modules ← EXPANDED</span> + ├─ 5. SCORE → <span class="new">_calculateConfidence() ← NEW</span> + │ └─ score ≥ 70 → auto-approve + │ └─ score < 70 → human approval required + ├─ 6. COMMIT → <span class="step">_executeCommit()</span> (<span class="new">auto if score ≥ 70 ← NEW</span>) + │ ├─ WebDAV push + │ ├─ Bundle sync + │ ├─ Version bump + │ ├─ <span class="new">Post-commit syntax check ← NEW</span> + │ └─ <span class="new">Auto-revert on syntax error ← NEW</span> + ├─ 7. VERIFY → <span class="new">Post-commit fetch + validate ← NEW</span> + └─ 8. LEARN → <span class="step">_postRunReview</span> + skill creation + └─ <span class="new">Auto-fix suggestions ← NEW</span></pre> + </div> +</section> + +<!-- ============ IMPLEMENTATION PHASES ============ --> +<section> + <h2>📅 Implementation Phases</h2> + + <div class="phase-card"> + <div class="phase-header"> + <span class="phase-num">PHASE 1</span> + <span class="phase-ver" style="color: var(--success-color); border-color: var(--success-color);">✅ v4.6.03 SHIPPED</span> + <span class="phase-effort">~1.5h</span> + </div> + <div class="phase-title">Safety Nets — JS Error Capture</div> + <ul class="checklist"> + <li class="done">Implement <code>_captureConsoleErrors(durationMs)</code> using console.error + window.onerror interception</li> + <li class="done">Wire JS error check into <code>test_module</code> (after loadModuleFromCode)</li> + <li class="done">Wire JS error check into <code>health_check</code> (add to <code>results.healthy</code>)</li> + <li class="done">Expand core commands in health_check: add <code>grep</code>, <code>find</code>, <code>tree</code>, <code>cat</code></li> + <li class="done">Sync changes to <code>core-bundle.js</code></li> + <li class="done">Browser verify: inject error, confirm health_check catches it</li> + </ul> + </div> + + <div class="phase-card"> + <div class="phase-header"> + <span class="phase-num">PHASE 2</span> + <span class="phase-ver" style="color: var(--success-color); border-color: var(--success-color);">✅ v4.6.04 SHIPPED</span> + <span class="phase-effort">~2h</span> + </div> + <div class="phase-title">Regression Coverage — 30+ Tests</div> + <ul class="checklist"> + <li class="done">Audit all modules for their commands via browser_console</li> + <li class="done">Add 2+ regression tests per module to <code>_regressionTasks()</code></li> + <li class="done">Add "no regression tests" penalty to confidence score</li> + <li class="done">Sync to <code>core-bundle.js</code></li> + <li class="done">Browser verify: run full suite, confirm all pass</li> + </ul> + </div> + + <div class="phase-card"> + <div class="phase-header"> + <span class="phase-num">PHASE 3</span> + <span class="phase-ver" style="color: var(--success-color); border-color: var(--success-color);">✅ v4.6.05 SHIPPED</span> + <span class="phase-effort">~1.5h</span> + </div> + <div class="phase-title">Post-Commit Verification + Auto-Revert</div> + <ul class="checklist"> + <li class="done">Add post-commit fetch + <code>new Function()</code> syntax check</li> + <li class="done">Add auto-revert on syntax check failure (re-upload original code)</li> + <li class="done">Add <code>last-good-version.json</code> tracking</li> + <li class="done">Sync to <code>core-bundle.js</code></li> + <li class="done">Browser verify: commit broken code, confirm auto-revert</li> + </ul> + </div> + + <div class="phase-card"> + <div class="phase-header"> + <span class="phase-num">PHASE 4</span> + <span class="phase-ver" style="color: var(--success-color); border-color: var(--success-color);">✅ v4.6.06 SHIPPED</span> + <span class="phase-effort">~2h</span> + </div> + <div class="phase-title">Confidence Gate + Auto-Approve</div> + <ul class="checklist"> + <li class="done">Implement <code>_calculateConfidence()</code> scoring function</li> + <li class="done">Add auto-approve logic to <code>ship_module</code> (score ≥ 70)</li> + <li class="done">Add <code>auto-commit</code> flag to <code>commit_module</code></li> + <li class="done">Add commit log with confidence scores</li> + <li class="done">Sync to <code>core-bundle.js</code></li> + <li class="done">Browser verify: high-confidence auto-commit works</li> + <li class="done">Browser verify: low-confidence still requires human</li> + </ul> + </div> + + <div class="phase-card"> + <div class="phase-header"> + <span class="phase-num">PHASE 5</span> + <span class="phase-ver" style="color: var(--success-color); border-color: var(--success-color);">✅ v4.6.08 SHIPPED</span> + <span class="phase-effort">~1.5h</span> + </div> + <div class="phase-title">Self-Improvement Trigger — Autonomous Bug Detection</div> + <ul class="checklist"> + <li class="done">Build <code>_toolToModuleMap</code> at init (map AI tools → source modules)</li> + <li class="done">Extend <code>_postRunReview</code> with auto-fix suggestions</li> + <li class="done">Add <code>_autoFixSuggestions</code> to system prompt context</li> + <li class="done">Sync to <code>core-bundle.js</code></li> + <li class="done">Browser verify: trigger tool failure, confirm suggestion appears</li> + </ul> + </div> + + <div class="phase-card"> + <div class="phase-header"> + <span class="phase-num">PHASE 6</span> + <span class="phase-ver" style="color: var(--success-color); border-color: var(--success-color);">✅ v4.6.09 SHIPPED</span> + <span class="phase-effort">~2.5h</span> + </div> + <div class="phase-title">Boot Watchdog — Recovery on Failed Boot</div> + <ul class="checklist"> + <li class="done">Add boot-time health check in <code>main.html</code></li> + <li class="done">Add auto-revert logic for failed boots</li> + <li class="done">Add "safe mode" fallback (load last-known-good)</li> + <li class="done">Browser verify: break a module, confirm boot watchdog reverts</li> + </ul> + </div> + + <div class="phase-card"> + <div class="phase-header"> + <span class="phase-num">PHASE 7</span> + <span class="phase-ver" style="color: var(--warning-color); border-color: var(--warning-color);">🔶 v4.6.10 PLANNED</span> + <span class="phase-effort">~4h</span> + </div> + <div class="phase-title">DebugSupervisorModule — Persistent Error DB + Clustering + Auto-Fix</div> + <ul class="checklist"> + <li class="pending">Create <code>module-debug-supervisor.js</code> — core module, register via <code>webx11.moduleManager.registerModule()</code></li> + <li class="pending">Error interception: console.error, window.onerror, unhandledrejection, fetch failures, tool errors</li> + <li class="pending">Chain through DebugPanel interceptors (DebugPanel loads after core, must wrap supervisor's interceptors)</li> + <li class="pending">VFS persistence: <code>/system/debug/errors.json</code> with dedup (Jaccard 0.35), LRU eviction, quota monitoring</li> + <li class="pending">Error classification: type (ReferenceError/TypeError/HTTP/timeout), severity (fatal/error/warning), category (module/network/tool/security/vfs)</li> + <li class="pending">Terminal commands: <code>debug-stats</code>, <code>debug-history</code>, <code>debug-analyze</code>, <code>debug-trends</code>, <code>debug-fix</code>, <code>debug-health</code></li> + <li class="pending">Update all <code>_errorLog</code> consumers: WorldModelModule, virtual-fs.js /sys/ mounts, <code>_collectDashboardData()</code></li> + <li class="pending">Wire <code>_autoFixSuggestions</code> into <code>buildSystemPrompt()</code> (activate dormant pipeline)</li> + <li class="pending">Root-cause analysis: trace error chains across event loop turns with time-window correlation</li> + <li class="pending">Cross-session learning: recurring patterns → auto-fix suggestions (confidence-gated)</li> + <li class="pending">Self-diagnostic: <code>_healthy</code> flag, fallback to original <code>_errorLog</code> on init failure</li> + <li class="pending">Add <code>debug-*</code> to <code>WebX11SecurityManager._baseWhitelist</code> in terminal.js</li> + <li class="pending">Dashboard integration: replace inline error counting with supervisor data</li> + <li class="pending">Docs: help.html, cheatsheet.html, data/news.json</li> + <li class="pending">Browser verify: error capture, persistence, clustering, RCA, auto-fix, dashboard</li> + </ul> + </div> +</section> + +<!-- ============ TESTING STRATEGY ============ --> +<section> + <h2>🧪 Testing Strategy — How to Validate Without Human Interaction</h2> + + <h3>The Bootstrapping Problem</h3> + <p style="color: var(--text-color); margin-bottom: 10px;"> + To test autonomous self-improvement without human interaction, we need to verify the system can: + <strong style="color:var(--accent-color)">detect</strong> a bug, + <strong style="color:var(--accent-color)">fix</strong> it, + <strong style="color:var(--accent-color)">test</strong> the fix, + <strong style="color:var(--accent-color)">commit</strong> without asking a human, + <strong style="color:var(--accent-color)">verify</strong> the commit didn't break anything, and + <strong style="color:var(--accent-color)">recover</strong> if it did. + </p> + + <h3>Test Scenarios</h3> + <table> + <thead> + <tr><th>ID</th><th>Scenario</th><th>Expected Behavior</th><th>Verification</th></tr> + </thead> + <tbody> + <tr> + <td class="warn">T1</td> + <td>AI fixes a typo in CalcModule (1 line, non-critical)</td> + <td class="pass">Confidence ≥ 85, auto-commit, post-commit syntax check passes</td> + <td class="muted">Check <code>commit-log.json</code> for <code>autoApproved: true</code></td> + </tr> + <tr> + <td class="warn">T2</td> + <td>AI tries to rewrite ShellModule (100+ lines, critical)</td> + <td class="warn">Confidence < 70, requires human approval</td> + <td class="muted">Pipeline output: <code>confidence: <70, humanApprovalRequired: true</code></td> + </tr> + <tr> + <td class="warn">T3</td> + <td>AI edits a module with a <code>TypeError</code> in a method</td> + <td class="fail">test_module catches JS error, auto-rollback</td> + <td class="muted">test_module output: <code>errors: [...]</code></td> + </tr> + <tr> + <td class="warn">T4</td> + <td>AI commits code with syntax error that passes loadModuleFromCode</td> + <td class="fail">Auto-revert fires, original code restored</td> + <td class="muted">Commit log: <code>reverted: true, syntaxError: ...</code></td> + </tr> + <tr> + <td class="warn">T5</td> + <td>AI edits MindmapModule (0 regression tests)</td> + <td class="warn">Confidence reduced by 30, likely requires human approval</td> + <td class="muted">Check confidence score</td> + </tr> + <tr> + <td class="warn">T6</td> + <td>Manually break a module file on server, refresh page</td> + <td class="pass">Boot watchdog detects failure, reverts to last-good</td> + <td class="muted">Console: "Boot watchdog: reverting..."</td> + </tr> + <tr> + <td class="warn">T7</td> + <td>Trigger repeated <code>run_command</code> failures in a session</td> + <td class="pass"><code>_postRunReview</code> suggests <code>ship_module</code> for broken module</td> + <td class="muted">Check next AI turn for auto-fix suggestion</td> + </tr> + <tr> + <td class="warn">T8</td> + <td>Tell AI "the calc command is broken, fix it"</td> + <td class="pass">Full autonomous cycle: edit → test → health → regress → score → auto-commit → verify</td> + <td class="muted">Check commit log + server file + page refresh</td> + </tr> + </tbody> + </table> + + <h3>Validation Procedure</h3> + <div class="pipeline-box"> +<pre>1. Open main.html in browser +2. Via browser_console, inject a known bug: + <span class="step">ai.terminal.fs.writeFile('_mods/CalcModule.js', buggyCode)</span> +3. Tell the AI: "The calc command returns wrong results. Fix it." +4. AI should: + a. Read the current CalcModule source + b. Identify the bug + c. <span class="step">Call ship_module({name:'CalcModule', code: fixedCode, tests:[{command:'calc 1+1', expect:'2'}], commit:true})</span> + d. Pipeline runs: test → health → regression → score + e. If score ≥ 70: auto-commit, post-commit verify + f. If score < 70: print "Human approval required, type commit-approve" +5. Verify: + - <span class="ok">Commit log has entry</span> + - <span class="ok">Server file updated (curl the .js URL)</span> + - <span class="ok">Page refresh loads new version</span> + - <span class="ok">calc 1+1 returns 2</span></pre> + </div> +</section> + +<!-- ============ RISKS ============ --> +<section> + <h2>⚠️ Risks & Mitigations</h2> + <table class="risk-matrix"> + <thead> + <tr><th>Risk</th><th class="center">Severity</th><th>Mitigation</th></tr> + </thead> + <tbody> + <tr> + <td>AI commits broken code that passes tests</td> + <td class="center risk-high">High</td> + <td>Confidence score penalizes thin coverage; post-commit syntax check; boot watchdog</td> + </tr> + <tr> + <td>Bundle sync corrupts core-bundle.js</td> + <td class="center risk-high">High</td> + <td><code>new Function()</code> validation before upload; auto-revert; git backup</td> + </tr> + <tr> + <td>AI enters infinite fix loop</td> + <td class="center risk-med">Medium</td> + <td>Rate limit (5 commits/day); cooldown (10 min); max 3 retries per module per session</td> + </tr> + <tr> + <td>Auto-fix suggestions pollute AI context</td> + <td class="center risk-low">Low</td> + <td>Cap suggestions at 3 per session; clear after each agentic loop</td> + </tr> + <tr> + <td>Boot watchdog false positive</td> + <td class="center risk-med">Medium</td> + <td>Only trigger if module count < 50% of expected; require 2 consecutive failed boots</td> + </tr> + <tr> + <td>Confidence threshold too permissive</td> + <td class="center risk-med">Medium</td> + <td>Start at 70, tune based on commit success rate; log all auto-commits for review</td> + </tr> + <tr> + <td>WebDAV token lacks write scope</td> + <td class="center risk-low">Low</td> + <td>Already verified working in v4.6.02 (TTS/SST changes were committed)</td> + </tr> + </tbody> + </table> +</section> + +<!-- ============ KEY ISSUES ============ --> +<section> + <h2>🔬 Key Issues Found During Live Audit</h2> + <table> + <thead> + <tr><th>#</th><th>Issue</th><th>Location</th><th>Evidence</th></tr> + </thead> + <tbody> + <tr> + <td class="fail">1</td> + <td><code>_captureConsoleErrors</code> undefined — planned but never coded</td> + <td class="muted">module-aiassist.js</td> + <td class="muted"><code>typeof ai._captureConsoleErrors === 'undefined'</code></td> + </tr> + <tr> + <td class="fail">2</td> + <td><code>_rollbackModule</code> and <code>_runTestAssertion</code> not implemented as planned</td> + <td class="muted">module-aiassist.js</td> + <td class="muted">Both undefined; rollback is inline, not reusable</td> + </tr> + <tr> + <td class="fail">3</td> + <td>Health check doesn't check JS errors</td> + <td class="muted">health_check handler</td> + <td class="muted"><code>results.healthy = allCoreOk && versionMatch</code> — no jsErrors check</td> + </tr> + <tr> + <td class="fail">4</td> + <td>Regression suite returns false positive for untested modules</td> + <td class="muted">_runRegressionSuite</td> + <td class="muted"><code>total: 0 → allPassed: true</code> — passes by default</td> + </tr> + <tr> + <td class="warn">5</td> + <td><code>ship_module</code> with <code>commit:true</code> still creates pending commit (doesn't auto-execute)</td> + <td class="muted">ship_module handler</td> + <td class="muted">Calls commit_module → stores _pendingCommit — human gate always active</td> + </tr> + <tr> + <td class="fail">6</td> + <td>No <code>_toolToModuleMap</code> — Phase G can't map failures to modules</td> + <td class="muted">module-aiassist.js</td> + <td class="muted">No mapping between AI tool names and source modules</td> + </tr> + </tbody> + </table> +</section> + +<!-- ============ FILES ============ --> +<section> + <h2>📁 Files Likely to Change</h2> + <table> + <thead> + <tr><th>File</th><th>Changes</th><th>Phase</th></tr> + </thead> + <tbody> + <tr> + <td><code>module-aiassist.js</code></td> + <td>_captureConsoleErrors, expanded _regressionTasks, _calculateConfidence, post-commit verify, _postRunReview extension, _toolToModuleMap</td> + <td class="muted">1–5</td> + </tr> + <tr> + <td><code>core-bundle.js</code></td> + <td>Sync all changes from module-aiassist.js</td> + <td class="muted">1–5</td> + </tr> + <tr> + <td><code>main.html</code></td> + <td>Boot watchdog script, version bump</td> + <td class="muted">6</td> + </tr> + <tr> + <td><code>module-loader.js</code></td> + <td>Version bump</td> + <td class="muted">6</td> + </tr> + </tbody> + </table> +</section> + +<!-- ============ OPEN QUESTIONS ============ --> +<section> + <h2>❓ Open Questions</h2> + <div class="open-q"> + <span class="q-num">Q1:</span> + <span class="q-text">Confidence threshold starting point — 70 is my recommendation. Higher (80, more conservative) or lower (60, more permissive)? Can be tuned after observing auto-commit success rates.</span> + </div> + <div class="open-q"> + <span class="q-num">Q2:</span> + <span class="q-text">Boot watchdog scope — auto-revert ANY failed boot, or only boots that fail within N seconds of a recent commit? A blanket auto-revert could undo intentional architecture changes.</span> + </div> + <div class="open-q"> + <span class="q-num">Q3:</span> + <span class="q-text">Auto-fix suggestion delivery — inject into AI's system prompt (passive, safer) or auto-prompt the AI to fix them (active, risks runaway fix loops)?</span> + </div> + <div class="open-q"> + <span class="q-num">Q4:</span> + <span class="q-text">Should <code>commit:true</code> in <code>ship_module</code> bypass the confidence gate? Options: (a) auto-commit if score ≥ threshold, (b) always human gate, (c) separate <code>auto:true</code> flag.</span> + </div> +</section> + +</div> + +<footer> + <p>newOS4 Self-Improving Autonomous OS Roadmap — Generated by Hermes Agent</p> + <p>v4.6.03 LIVE · v4.6.09 SHIPPED · v4.6.10 PLANNED · Auto-commit active for confidence ≥ 70 · <a href="https://webx11.duckdns.org/spaces/newos4/main.html">Open newOS4 Terminal</a></p> + <p style="margin-top: 8px; color: var(--success-color);">Last updated: 2026-07-07 · Status: 6/6 phases shipped, Phase 7 planned 🔶</p> +</footer> + +</body> +</html>
\ No newline at end of file |