newOS4 v4.6.00

System Architecture Review — Self-Improving Module Loop

Healthy v4.6.00 43 modules 14 skills 145 files 3 agents stale

Executive Summary

Shipped: A self-improving module pipeline that lets the AI edit, test, and validate its own modules in dry-run mode without human intervention. The ship_module tool orchestrates test → health check → regression suite, with auto-rollback at every stage. Server persistence (commit) is intentionally gated behind human approval.

Modules
43
Core / Ext
21 / 22
Files in VFS
145
Skills
14
AI Profiles
11
Agent Loops
7
Memory Nodes
19
Heap Used
256MB

v4.6.00 — The Self-Improvement Loop

Goal: AI detects a bug or missing feature, calls ship_module({name, code, tests, commit:false}), and the system writes the change, runs the test, runs the health check, runs the regression suite — and either reports "dry-run passed" or auto-rolls back with a failure report. No human needed for the dry-run path.
AI detects bug → ship_module → test_module → health_check → regression → ✓ / rollback

Phase Breakdown

PhaseToolWhatVerified
A test_module (rewritten) Loads module, checks JS errors, verifies commands registered, runs test assertions, auto-rollback on any failure ✅ Assertions catch mismatches, rollback restores old instance
B health_check (new) Runs core commands (ls, pwd, echo, help), checks world model version, agent health, module count ✅ Returns {healthy, coreCommands, agents, versionMatch}
C diff_module (new) Line-by-line diff between original and edited module source in _mods/ ✅ Shows added/removed/changed lines with line numbers
D commit_module (skipped) Server persistence (WebDAV upload, bundle rebuild, version bump, rate limiting) — intentionally deferred ⏸ Needs more design — gated behind human approval in ship_module
E _runRegressionSuite (new) Module-specific regression tests: ShellModule (export, redirect, chain, pipe), SystemModule (ls, pwd), OrchestratorModule (agents), AI tools ✅ 4 tests for ShellModule, 3/4 passed (redirect test needs routing fix)
F ship_module (new) Full pipeline: edit → test → health_check → regression. Auto-rollback at any stage. commit:true = human approval needed ✅ Pipeline aborts on test failure, reports step where it failed

Known Limitation & Next Fix

Issue: Regression tests use _captureCommandOutput which calls security.checkAndRun() — this routes to the first module that has the command, bypassing the shell parser. Tests for shell-specific features (redirect, pipe) need to go through executeCommand instead.

Classification: Test design issue, not a framework bug.

Fix plan: Add a second test path _captureShellCommand that routes through the real shell parser for redirect/pipe/export cases. Keep _captureCommandOutput as the generic helper. → target v4.6.01

Files Modified

Usage Statistics

Aggregate (last 24h)
  • Total requests: 246
  • Prompt tokens: 4,140,000
  • Completion tokens: 318,000
  • Avg latency: 20.3s
By Model (top)
  • MiniMax-M3 — 168 reqs, 2.8M prompt, 18.2s avg
  • MiniMax-Coder — 78 reqs, 1.3M prompt, 23.1s avg

Module Breakdown

Core ModulesLayerStatus
SystemModulecore✅ loaded
ShellModulecore✅ loaded
FSModulecore✅ loaded
AIModulecore✅ loaded
OrchestratorModulecore✅ loaded
ModuleManagerModulecore✅ loaded
SecurityModulecore✅ loaded
UIModulecore✅ loaded
WebDAVModulecore✅ loaded
WorldModelModulecore✅ loaded
SkillModulecore✅ loaded
AgentModulecore✅ loaded
... + 9 more—✅ loaded

22 external modules also loaded (vaultmind, hyperliquid, sandbox, worldmodel, etc.)

Agents

Active (3)
  • research-agent — 12 tasks done
  • code-agent — 5 tasks done
  • writer-agent — 8 tasks done
Stale (3) ⚠️
  • old-researcher — last seen 14d ago
  • legacy-coder — last seen 21d ago
  • test-runner-1 — last seen 9d ago

Skills (14)

Research / System
  • web-research
  • self-improving-loop
  • module-test-patterns
  • world-model-queries
Dev / Security
  • module-editing
  • shell-scripting
  • vault-patterns
  • guardrail-usage
  • ... + 6 more

VFS Layout

/
├── agents/          # agent configs
├── core/            # core modules source
├── ext/             # external modules
├── mods/            # local edits (_mods/ + auto-test)
├── skills/          # 14 skill markdown files
├── sessions/        # session summaries
├── system/          # system docs (this file)
├── uploads/         # user uploads
├── user/            # user profile
├── vaultmind/       # AI query cache
└── webdav/          # WebDAV mounts

AI Context Profiles

ProfileDomainUse Case
codingcode editingmodule dev, refactor
debugbug fixingtest failures, errors
creativebrainstormingdesign, naming
technicaldocumentationdocs, specs
chatcasualgeneral talk
system-adminmaintenancehealth, cleanup
researchinfo gatheringweb search, analysis
securitythreat assessmentguardrail, audit
... +3 more——

Recommendations (Next Iterations)

  1. v4.6.01 — Fix redirect/pipe regression test (add _captureShellCommand path)
  2. v4.6.02 — Clean up 3 stale agents
  3. v4.7.00 — Phase D: commit_module with proper WebDAV upload, bundle rebuild, version bump, rate limiting
  4. v4.7.x — Expand regression suite to cover all 21 core modules
  5. v4.8.x — Add a "watchdog" agent that auto-detects bugs in the loop itself