System Architecture Review — Self-Improving Module Loop
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.
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.
| Phase | Tool | What | Verified |
|---|---|---|---|
| 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 |
_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.
_captureShellCommand that routes through the real shell parser for redirect/pipe/export cases. Keep _captureCommandOutput as the generic helper. → target v4.6.01
_captureCommandOutput + _runRegressionSuite helpersMiniMax-M3 — 168 reqs, 2.8M prompt, 18.2s avgMiniMax-Coder — 78 reqs, 1.3M prompt, 23.1s avg| Core Modules | Layer | Status |
|---|---|---|
| SystemModule | core | ✅ loaded |
| ShellModule | core | ✅ loaded |
| FSModule | core | ✅ loaded |
| AIModule | core | ✅ loaded |
| OrchestratorModule | core | ✅ loaded |
| ModuleManagerModule | core | ✅ loaded |
| SecurityModule | core | ✅ loaded |
| UIModule | core | ✅ loaded |
| WebDAVModule | core | ✅ loaded |
| WorldModelModule | core | ✅ loaded |
| SkillModule | core | ✅ loaded |
| AgentModule | core | ✅ loaded |
| ... + 9 more | — | ✅ loaded |
22 external modules also loaded (vaultmind, hyperliquid, sandbox, worldmodel, etc.)
research-agent — 12 tasks donecode-agent — 5 tasks donewriter-agent — 8 tasks doneold-researcher — last seen 14d agolegacy-coder — last seen 21d agotest-runner-1 — last seen 9d ago/
├── 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
| Profile | Domain | Use Case |
|---|---|---|
coding | code editing | module dev, refactor |
debug | bug fixing | test failures, errors |
creative | brainstorming | design, naming |
technical | documentation | docs, specs |
chat | casual | general talk |
system-admin | maintenance | health, cleanup |
research | info gathering | web search, analysis |
security | threat assessment | guardrail, audit |
| ... +3 more | — | — |
_captureShellCommand path)commit_module with proper WebDAV upload, bundle rebuild, version bump, rate limiting