From 999770b75cc8076d131bfd9e42295fad54f1e21a Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 5 May 2026 18:22:52 +0000 Subject: [PATCH] docs: self-evolution section + feature comparison table --- README.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9a20b160..a50cdbc7 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,49 @@ User sends voice message - **Offline** β€” zero network calls, zero API costs - **Good enough** β€” ~95% accuracy for English speech +### 🧬 Self-Evolution + +zCode can **modify its own source code** β€” and survive the attempt. Every change goes through a safety chain that guarantees rollback on any failure. + +**Safety chain (8 steps):** +``` +AI requests patch + β”‚ + β–Ό +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ 1. Git stash β”‚ ← save uncommitted work +β”‚ 2. Git commit β”‚ ← checkpoint current state +β”‚ 3. File backup β”‚ ← copy original to .self-evolve-backups/ +β”‚ 4. Apply patch β”‚ ← string find/replace in target file +β”‚ 5. Syntax check β”‚ ← node --check / py_compile / JSON.parse +β”‚ 6. Git commit β”‚ ← commit the change +β”‚ 7. Push + restartβ”‚ ← deploy to production +β”‚ 8. Health + smokeβ”‚ ← verify bot is alive and responding +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ + β”‚ + β”Œβ”€β”€β”€β”΄β”€β”€β”€β” + β”‚ FAIL? │──── auto git reset + restart + restore from backup + β””β”€β”€β”€β”¬β”€β”€β”€β”˜ + β”‚ OK + β–Ό + βœ… Live +``` + +**Protected files** β€” the bot **cannot** modify these (would brick itself): +- `SelfEvolveTool.js` β€” the safety system itself +- `stt.py` β€” voice recognition bridge + +**Backup system:** +- Every `patch` auto-saves the original file to `.self-evolve-backups/` with a timestamp ID +- `backups` action lists all backups (file, size, timestamp) +- `restore` action copies any backup back to production (with its own safety checks) +- Backups survive git corruption β€” they're plain file copies, not git objects +- Restoring also creates a pre-restore backup (undo the undo) + +**Actions:** `read`, `patch`, `list_files`, `git_log`, `diff`, `backups`, `restore` + +**Rate limit:** 1 patch per 60 seconds (prevents runaway self-modification loops) + ### 🧠 Intelligence Routing The core of zCode CLI X's reliability. A unified agentic loop that handles both streaming and non-streaming through the same execution path β€” no more split paths that lose context or hang silently. @@ -517,11 +560,16 @@ Z.AI API (SSE) | Telegram integration | βœ… Native bot + webhook + streaming | βœ… 2-way Telegram bridge | ❌ None | | Discord | βœ… Native bot (discord.js) | βœ… Full Discord integration | ❌ None | | Multi-channel delivery | βœ… Delivery hub (TG + DC + WS + log) | βœ… Cronβ†’multi-platform | ❌ None | -| **Voice** | | | | -| Speech-to-Text | βœ… Vosk (offline, ~200ms, 68MB) | ⚠️ Whisper (needs GPU) | ❌ None | -| Text-to-Speech | βœ… Edge TTS (free, 100+ voices) | βœ… node-edge-tts | ❌ None | -| Voiceβ†’AI pipeline | βœ… Transcribe β†’ full agentic loop | ⚠️ Separate pipeline | ❌ None | -| **Infrastructure** | | | | +|| **Voice** | | | | +|| Speech-to-Text | βœ… Vosk (offline, ~200ms, 68MB) | ⚠️ Whisper (needs GPU) | ❌ None | +|| Text-to-Speech | βœ… Edge TTS (free, 100+ voices) | βœ… node-edge-tts | ❌ None | +|| Voiceβ†’AI pipeline | βœ… Transcribe β†’ full agentic loop | ⚠️ Separate pipeline | ❌ None | +|| **Self-Evolution** | | | | +|| Self-modifying code | βœ… Patch own source + auto-deploy | ❌ Not supported | ❌ None | +|| Auto-backup before change | βœ… File-level + git checkpoint | N/A | N/A | +|| Auto-rollback on failure | βœ… Syntax + health + smoke test | N/A | N/A | +|| Backup history + restore | βœ… Timestamped backups, 1-command restore | N/A | N/A | +|| **Infrastructure** | | | | | Model routing | βœ… Multi-provider | βœ… Multi-provider routing | ❌ Single model | | Context compression | βœ… Compact pipeline | βœ… lean-ctx MCP (90% savings) | ❌ None | | Auto-restart | βœ… Process supervisor | βœ… systemd managed | ❌ None |