System Architecture Review — Phase D: Self-Improvement Loop Closed
Shipped: The self-improvement loop is fully closed. The AI can now autonomously edit, test, verify, and persist module changes to the server — with a human approval gate as the final step. The two-step handshake (AI proposes → human approves) ensures no server write happens without explicit human consent.
commit-approve [comment] to push it. The two-step handshake is the kill switch — no autonomous server writes.
edit_module({name, code}) → writes to VFS _mods/test_module({name, tests}) → assertions + auto-rollbackhealth_check() → core cmds + world model + agents_runRegressionSuite() → 4/4 ShellModule testsship_module({name, code, tests}) → full dry-run pipelinecommit_module({name, file}) → creates pending commit with diffcommit-approve [comment] → WebDAV push + version bumpcommit-deny [reason] → clears pending commitcommit-status → view pending diff + rate limit| Phase | Tool | What | Status |
|---|---|---|---|
| A | test_module |
Loads module, checks JS errors, verifies commands, runs assertions, auto-rollback on failure | ✅ Shipped v4.6.00 |
| B | health_check |
Core commands, world model version, agent health, module count | ✅ Shipped v4.6.00 |
| C | diff_module |
Line-by-line diff between original and edited module source | ✅ Shipped v4.6.00 |
| D | commit_module |
Creates pending commit: WebDAV upload, version bump, rate limiting — gated by human approval | ✅ Shipped v4.6.02 |
| E | _runRegressionSuite |
Module-specific regression: ShellModule (export, redirect, chain, pipe) | ✅ 4/4 (v4.6.01 routing fix verified) |
| F | ship_module |
Full dry-run pipeline: edit → test → health → regression. Auto-rollback at any stage. | ✅ Shipped v4.6.00 |
health_check()diff_module({name})ship_module({name, code, tests, commit})commit_module({name, file})commit-approve [comment]commit-deny [reason]commit-status_executeCommit()_webdavPush() / _webdavGet()_syncBundle()_bumpVersion() / _parseVersion()_extractClassBlock()YYYY-MM-DD-vX.Y.ZZvX.Y.ZZ (SemVer-ish)+YYYYMMDD build metadata for traceability# Terminal session transcript
commit-module tutorial.js
→ Pending commit created for modules/ext/tutorial.js
→ Diff: 4 lines added, 1 removed
→ Rate limit: 4/5 commits remaining
commit-approve Tested locally, 4/4 regression pass
→ _webdavPut modules/ext/tutorial.js
→ HTTP 201 Created
→ _bumpVersion v4.6.01 → v4.6.02
→ _bumpVersion main.html + module-loader.js
→ _mods/ cleanup
→ 🎉 Commit complete! Refresh to load v4.6.02
| Constraint | Value | Enforced By |
|---|---|---|
| Max commits per day | 5 | commit-log.json + timestamp check |
| Cooldown between commits | 10 minutes | last-commit timestamp |
| Audit log location | /_mods/commit-log.json | Appended on every approve/deny |
| Pending commit storage | /_mods/pending-commit.json | Cleared on approve/deny |
⚠ Note: Reset window for daily limit is not yet documented. See Recommendations.
For ext modules (most cases), the server file is the source of truth. For modules bundled in core-bundle.js or critical-ext-bundle.js, _syncBundle() performs a block-replace:
new Function() (syntax check)core-bundle.js should be treated like a fresh deploy — back up first, verify with regression suite immediately after.
commit_module tool def + handler, _executeCommit, _webdavPush, _webdavGet, _syncBundle, _bumpVersion, _extractClassBlock, _parseVersion, commit-approve/commit-deny/commit-status commandsLATEST_VER updated to v4.6.02 (was stale at v4.5.94)| # | Issue | Severity | Suggested Fix | Target |
|---|---|---|---|---|
| 1 | _syncBundle() untested against real core-bundle.js |
🟡 Medium | Test with a no-op edit first; back up before real sync | v4.6.03 |
| 2 | Daily commit reset window not documented (midnight UTC?) | 🟢 Low | Add rate-limit-docs skill; document in commit_module tool description |
v4.6.03 |
| 3 | commit-approve has no module-name arg — ambiguous if 2 pending |
🟢 Low | Change signature to commit-approve <module-name> [comment] |
v4.6.03 |
| 4 | commit-log.json is JSON, not append-only — crash mid-write could corrupt |
🟡 Medium | Use write-then-rename pattern, or migrate to NDJSON | v4.6.03 |
| 5 | 3 stale agents still listed in old reviews (old-researcher, legacy-coder, test-runner-1) |
🟢 Low | Run list_agents + prune; update world model |
v4.6.03 |
MiniMax-M3 — 214 reqs, 3.6M prompt, 17.4s avgMiniMax-Coder — 98 reqs, 1.6M prompt, 22.7s avg/
├── agents/ # agent configs
├── core/ # core modules source
├── ext/ # external modules
├── _mods/ # local edits + commit-log.json + pending-commit.json
├── 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
_syncBundle() against real core-bundle.jscommit-approve to optionally run regression suite as pre-flight checksession_save data to WebDAV so /hermes/sessions/ survives refreshPHASE_D.md skill documenting the commit flow + two-step handshakesystem-admin context profile to reference new tools