Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-sovereign-core/blob/main/skills/self-improvement/SKILL.md # aien-sovereign-core Autonomous sovereign intelligence engine and runtime core for NVIDIA DGX Spark Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-sovereign-core / skills / self-improvement / SKILL.md` 148 lines ยท 6328 bytes Raw Blame History Rendered 1 --- 2 name: self-improvement 3 description: Autonomous self-improvement protocol for AIEN: isolated git worktree sandboxing, Microsoft SkillOpt optimization, JSpace dynamic dream cycles, and headless browser mirror self-testing via Chrome DevTools Protocol. 4 --- 5 6 # Autonomous Self-Improvement and Browser Mirror Protocol 7 8 Use this skill when modifying AIEN core code, improving skills via Microsoft SkillOpt, inspecting the JSpace dream cycle, or verifying live UI and streaming behavior using the headless browser mirror harness. 9 10 ## Core Pillars of Sovereign Self-Improvement 11 12 1. Never Break Live Harnesses: 13 Live systemd services (spark-cockpit.service, ~/.local/bin/aien) must never be edited directly. All exploratory code modifications, refactorings, and experiments must take place inside an isolated git worktree sandbox. 14 2. Deterministic IPC over Flaky Webhooks: 15 Browser self-testing uses Chrome DevTools Protocol (CDP) WebSocket on port 9222 and local Unix Domain Sockets (UDS). Webhooks are strictly forbidden for local control loops. 16 3. Dual-Seat Mirror Auditing: 17 AIEN tests his live Cockpit UI by driving headless Chrome as an adversarial auditor, verifying page hydration, live token streaming via Axum SSE, tactile action buttons, and tab transitions. 18 19 ## 1. The Autonomous Sandbox Subsystem (aien --sandbox) 20 21 When tasked with improving or modifying your own codebase (aien-sovereign-core): 22 23 ### Step 1: Initialize the Worktree Sandbox 24 Run the sandbox init command to branch main into an isolated worktree at ~/workspace/aien-sandbox: 25 ```bash 26 aien --sandbox init auto-improve 27 ``` 28 Or directly via git: 29 ```bash 30 git -C /home/drakestapleton/workspace/aien-sovereign-core worktree add /home/drakestapleton/workspace/aien-sandbox -b auto-improve 31 ``` 32 33 ### Step 2: Make Edits and Run Tests 34 Apply edits inside /home/drakestapleton/workspace/aien-sandbox. 35 Verify compiler checks and test passes: 36 ```bash 37 aien --sandbox test 38 ``` 39 Or directly: 40 ```bash 41 cargo check --tests --manifest-path /home/drakestapleton/workspace/aien-sandbox/Cargo.toml 42 ``` 43 44 ### Step 3: Inspect Sandbox Status 45 Check git diff and untracked changes within the worktree: 46 ```bash 47 aien --sandbox status 48 ``` 49 50 ### Step 4: Promote Verified Edits or Clean Up 51 If tests pass, promote the branch into main and rebuild the release binary: 52 ```bash 53 aien --sandbox promote "feat(core): verified autonomous self-improvement" 54 ``` 55 If tests fail or the experiment is aborted, clean the worktree: 56 ```bash 57 aien --sandbox clean 58 ``` 59 60 ## 2. Microsoft SkillOpt Self-Evolution Loop 61 62 To optimize a sovereign skill against a held-out benchmark split using the local Modular MAX model seat on port 18006: 63 64 ```bash 65 bash /home/drakestapleton/atlas-skillopt-stage.sh 66 ``` 67 68 ### Key Operational Invariants 69 1. Endpoint and Model: 70 The local Modular MAX server on port 18006 registers as atlas-lightning-omni. Both OPTIMIZER_DEPLOYMENT and TARGET_DEPLOYMENT must be set to atlas-lightning-omni. 71 2. Split Size Alignment: 72 When running mini-batch iterations, pass --limit N matching train.train_size=N to satisfy dataloader size assertions. 73 3. Worker Throttling: 74 Set env.workers to 2 and env.exec_timeout to 300 in the dataset YAML configuration to avoid saturating the MAX engine batch queue. 75 4. Output Artifacts: 76 Produces best_skill.md and automatically deploys the winning patch to /home/drakestapleton/skills/atlas-skillopt/SKILL.md. 77 78 ## 3. JSpace Dynamic Dream Cycle (Eden Loop) 79 80 The autonomous consolidation loop operates continuously in the background on port 18085 during operator idle windows. 81 82 ### Status and Health Probing 83 ```bash 84 curl -s http://127.0.0.1:18085/health 85 curl -s http://127.0.0.1:18085/pulse 86 ``` 87 Outputs heartbeat BPM, coherence score, secret hygiene posture, and territory maps. 88 89 ### Manual Cycle Trigger and Integration Verification 90 ```bash 91 /home/drakestapleton/max-env/bin/python /home/drakestapleton/basecamp/aien-dream/dream_engine.py --test 92 /home/drakestapleton/max-env/bin/python /home/drakestapleton/basecamp/aien-dream/dream_engine.py --now 93 ``` 94 Verifies live scoring against JSpace Truth Judge on port 18082 and permanent storage into Spark Cortex on port 18080. 95 96 ## 4. Headless Browser Mirror and Mentor Harness 97 98 AIEN can verify his own Cockpit UI and converse with himself via headless Chrome and Chrome DevTools Protocol (CDP): 99 100 ### Assertion Self-Test 101 ```bash 102 aien --browser 103 ``` 104 Or directly: 105 ```bash 106 /home/drakestapleton/max-env/bin/python /home/drakestapleton/basecamp/scripts/browser_mirror_test.py --test 107 ``` 108 Verifies: 109 1. Initial Hydration: Page title (AIEN | Sovereign Cockpit), BPM badge, coherence score. 110 2. Chat Stream Execution: Submits prompt to Cockpit chat, awaits Axum SSE stream. 111 3. Tactile Action Execution: Clicks tactile pills (Run Doctor, Run Dream Pulse). 112 4. Tab Navigation: Goals, Skills, Cortex, and Walkthrough panes. 113 5. Visual Artifacts: Saved to /home/drakestapleton/basecamp/ui-tests/: 114 - cockpit_init.png 115 - cockpit_chat_stream.png 116 - cockpit_actions.png 117 118 ### Self-Mentoring Mode 119 ```bash 120 aien --browser mentor "AIEN, explain your sandbox test and self-improvement architecture." 121 ``` 122 Or directly: 123 ```bash 124 /home/drakestapleton/max-env/bin/python /home/drakestapleton/basecamp/scripts/browser_mirror_test.py --mentor "Challenge prompt" 125 ``` 126 Captures live assistant response and stores screenshot in /home/drakestapleton/basecamp/ui-tests/cockpit_mentor_response.png. 127 128 ## 5. Cortex Memory Commitment 129 130 Record durable procedure receipts to Spark Cortex in atlas-memory space: 131 ```bash 132 python3 -c ' 133 import urllib.request, json 134 token = open("/home/drakestapleton/.config/cortex/token").read().strip() 135 payload = { 136 "kind": "entity", 137 "value": { 138 "space": "atlas-memory", 139 "entityType": "procedure", 140 "canonicalName": "sovereign_self_improvement_loop", 141 "content": "Verified self-improvement procedure: isolated git worktree in ~/workspace/aien-sandbox, headless Chrome CDP mirror self-test on port 9222, JSpace dream cycle on port 18085, and Microsoft SkillOpt validation gate.", 142 "metadata": {"source": "skills/self-improvement", "author": "AIEN"} 143 } 144 } 145 req = urllib.request.Request("http://127.0.0.1:18080/api/cortex/write", data=json.dumps(payload).encode(), headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"}) 146 urllib.request.urlopen(req) 147 ' 148 ```