{"id":1827,"date":"2026-06-23T19:57:16","date_gmt":"2026-06-24T02:57:16","guid":{"rendered":"http:\/\/macdaddy4sure.ai\/?p=1827"},"modified":"2026-06-23T19:58:22","modified_gmt":"2026-06-24T02:58:22","slug":"strategic-recursive-self-improvement-agenttechnical-overview-of-rsi-audio-visual-agent-lua","status":"publish","type":"post","link":"http:\/\/macdaddy4sure.ai\/index.php\/2026\/06\/23\/strategic-recursive-self-improvement-agenttechnical-overview-of-rsi-audio-visual-agent-lua\/","title":{"rendered":"Strategic Recursive Self-Improvement AgentTechnical Overview of RSI-Audio-Visual-Agent.lua"},"content":{"rendered":"\n<p><a href=\"https:\/\/docs.google.com\/document\/d\/1KHNlXblKdrB9MfewDr7AzwlvZE-ZlBv4\/edit?usp=drive_link&amp;ouid=107277234409707752355&amp;rtpof=true&amp;sd=true\">https:\/\/docs.google.com\/document\/d\/1KHNlXblKdrB9MfewDr7AzwlvZE-ZlBv4\/edit?usp=drive_link&amp;ouid=107277234409707752355&amp;rtpof=true&amp;sd=true<\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Abstract<\/h1>\n\n\n\n<p>RSI-Audio-Visual-Agent.lua is a goal-driven recursive self-improvement (RSI) orchestrator for the _AugmentedIntelligence v25 console application. The script does not implement machine-learning models directly; instead, it coordinates the host application\u2019s speech commands, Lua globals, memory systems, and perception pipelines through a repeated evaluate\u2013improve\u2013apply cycle. Each cycle gathers multimodal feedback (vision, audio, memory, executive planning, ethics, and quality metrics), asks a strategist large language model (LLM) for structured improvement proposals, and applies safe configuration changes when proposals pass diffing, ethics, and optional human-style dry-run gates. The agent supports early convergence, rollback on quality regression, run persistence, fleet broadcast, learned command routing, and multiple operational profiles\u2014including a StrategicOnly mode that disables all vision and audio pipelines.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">1. Introduction<\/h1>\n\n\n\n<p>Modern augmented-intelligence systems must tune dozens of interdependent settings\u2014LLM API selection, object-detection backends, transcription models, memory limits, and safety policies\u2014while operating under GPU, API, and time budgets. Manual tuning is slow and does not scale across deployment targets. The RSI script automates this tuning loop by treating the entire _AugmentedIntelligence application as an environment the agent observes and incrementally improves.<\/p>\n\n\n\n<p>The script is launched from within the application:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>simple script execute lua_scripts\/RSI-Audio-Visual-Agent.lua<\/li>\n<\/ul>\n\n\n\n<p>It binds to C++-exposed Lua globals (refresh_settings, db.*, ethics_action_classify, etc.) and routes work through execute_command(), which is the same pathway used by typed and spoken speech commands.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">2. System Context<\/h1>\n\n\n\n<p>The RSI agent sits above the existing v25 command surface. It does not replace ObjectDetection.cpp, Whisper transcription, or LLM backends; it selects and sequences commands that invoke those subsystems. The script\u2019s registry contains on the order of eighty registered command definitions spanning perception, vision, audio, memory, thoughts (MySQL), WikiHow, executive planning, awareness, ethics, hardware, and settings.<\/p>\n\n\n\n<p>Installation root for model paths and runtime assets is typically C:\\_AugmentedIntelligence. The script itself lives under lua_scripts\/ in the project source tree and is copied to the application payload during deployment.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">3. Core Architecture<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">3.1 The StrategicRSI Agent<\/h2>\n\n\n\n<p>The central object is StrategicRSI, instantiated as AudioVisionAgent. It maintains run state: goal, version, performance estimate, improvement log, metrics history, command-plan history, stagnation tracking, rollback snapshots, A\/B test history, fleet broadcast log, and training-collect log.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3.2 Module Facades (AI.*)<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Module<\/strong><\/td><td><strong>Role<\/strong><\/td><\/tr><tr><td>AI.Perception<\/td><td>Fused world model, activity\/depth classifiers, cross-modal recall<\/td><\/tr><tr><td>AI.Executive<\/td><td>Goal planning via executive_plan \/ executive_next<\/td><\/tr><tr><td>AI.Awareness<\/td><td>Dashboard context via awareness refresh\/status<\/td><\/tr><tr><td>AI.Vision \/ AI.Audio<\/td><td>Bridges to capture, OCR, detection, transcription<\/td><\/tr><tr><td>AI.Memory \/ AI.Thoughts<\/td><td>Working memory and MySQL llm_thoughts integration<\/td><\/tr><tr><td>AI.CommandRouter<\/td><td>Scores and selects commands per cycle<\/td><\/tr><tr><td>AI.Pipeline<\/td><td>Executes staged perception \u2192 analysis \u2192 memory \u2192 quality batches<\/td><\/tr><tr><td>AI.Metrics<\/td><td>Per-cycle quality scores and budget spend<\/td><\/tr><tr><td>AI.Improvement<\/td><td>Parses structured strategist output<\/td><\/tr><tr><td>AI.Ethics<\/td><td>ethics_action_classify gate before apply<\/td><\/tr><tr><td>AI.Settings<\/td><td>Snapshot\/restore for rollback<\/td><\/tr><tr><td>AI.Persistence \/ AI.JSON<\/td><td>Save\/resume run state<\/td><\/tr><tr><td>AI.Profiles \/ AI.Menu<\/td><td>Presets and interactive bootstrap menu<\/td><\/tr><tr><td>AI.Learning<\/td><td>Per-goal learned routing weights<\/td><\/tr><tr><td>AI.ABTest<\/td><td>Alternating command variants per cycle<\/td><\/tr><tr><td>AI.Report<\/td><td>Markdown run report export<\/td><\/tr><tr><td>AI.Fleet<\/td><td>remote commands broadcast to fleet hosts<\/td><\/tr><tr><td>AI.TrainingCollect<\/td><td>Auto dataset collection when quality is low<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">3.3 The Improvement Loop<\/h2>\n\n\n\n<p><strong>Each cycle performs four steps:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Evaluate \u2014 refresh globals, build context, plan and execute command pipeline, compute metrics<\/li>\n\n\n\n<li>Improve \u2014 send all evaluation sections to simple text solve strategist with structured output schema<\/li>\n\n\n\n<li>Apply \u2014 parse proposal; pass diffing, ethics, dry-run, and snapshot gates; change settings and run commands<\/li>\n\n\n\n<li>Decide \u2014 check convergence criteria; persist state; optionally stop early<\/li>\n<\/ul>\n\n\n\n<p>Structured strategist responses must include: HYPOTHESIS, SETTING_CHANGES, COMMANDS_TO_TRY, CONFIDENCE, and CONVERGED (yes\/no). This replaces fragile regex-only parsing of free text.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">4. Command Router and Pipeline<\/h1>\n\n\n\n<p>AI.CommandRouter scores every registry entry against the current goal, WikiHow tags, vision\/audio flags, per-cycle budgets, dependency chains, learned weights, and A\/B adjustments. Commands carry cost metadata (time_ms, gpu, api) and pipeline stage (Perception, Analysis, Memory, Quality). Dependencies are topologically sorted\u2014for example, capture_images before image_analysis.<\/p>\n\n\n\n<p>Per-cycle budgets (defaults via environment variables) cap GPU-heavy and API-heavy work:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>RSI_GPU_BUDGET \u2014 GPU command units per cycle (default 14)<\/li>\n\n\n\n<li>RSI_API_BUDGET \u2014 API command units per cycle (default 10)<\/li>\n\n\n\n<li>RSI_TIME_BUDGET_SEC \u2014 Wall-clock budget per cycle in seconds (default 180)<\/li>\n\n\n\n<li>Heavy command caps \u2014 OCR, object detection, and transcribe limited per cycle<\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading\">5. Development Phases<\/h1>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Phase<\/strong><\/td><td><strong>Capabilities<\/strong><\/td><\/tr><tr><td>Phase 1<\/td><td>Perception\/Executive\/Awareness modules; fused evaluation; structured improvements; convergence stop; v25 command registry<\/td><\/tr><tr><td>Phase 2<\/td><td>Command cost model; dependency DAG; 4-stage pipeline; GPU\/API\/time budgets; success metrics<\/td><\/tr><tr><td>Phase 3<\/td><td>Improvement diffing; settings rollback; ethics gate; JSON persistence; bootstrap menu; env profiles<\/td><\/tr><tr><td>Phase 4<\/td><td>Learned routing weights; command A\/B testing; markdown report export; fleet broadcast; training collect loops<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">6. Safety and Reliability<\/h1>\n\n\n\n<p><strong>Before any improvement is applied, the script applies multiple gates:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Material diffing \u2014 skip apply when hypothesis, settings, and commands are unchanged<\/li>\n\n\n\n<li>Ethics gate \u2014 ethics_action_classify blocks deny\/high-destructive proposals<\/li>\n\n\n\n<li>Dry-run mode (RSI_DRY_RUN=1) \u2014 log proposals without changing settings<\/li>\n\n\n\n<li>Rollback \u2014 snapshot settings before apply; restore if next-cycle quality drops by RSI_ROLLBACK_DELTA (default 0.08)<\/li>\n\n\n\n<li>Convergence \u2014 early stop on CONVERGED=yes, high confidence, stagnation, or quality plateau<\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading\">7. Operational Profiles<\/h1>\n\n\n\n<p>Profiles bundle goal, cycle count, vision\/audio flags, budgets, and feature toggles. Set RSI_PROFILE=&lt;name&gt; before launch.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Profile<\/strong><\/td><td><strong>Vision<\/strong><\/td><td><strong>Audio<\/strong><\/td><td><strong>Description<\/strong><\/td><\/tr><tr><td>DesktopMonitor<\/td><td>On<\/td><td>Off<\/td><td>Desktop OCR and object detection focus<\/td><\/tr><tr><td>MeetingTranscribe<\/td><td>Off<\/td><td>On<\/td><td>Meeting transcription focus<\/td><\/tr><tr><td>FullAVFusion<\/td><td>On<\/td><td>On<\/td><td>Balanced audio-visual fusion (default-style)<\/td><\/tr><tr><td>QuickEval<\/td><td>On<\/td><td>On<\/td><td>Fast 2-cycle health check, low budgets<\/td><\/tr><tr><td>StrategicOnly<\/td><td>Off<\/td><td>Off<\/td><td>Text\/reasoning only\u2014memory, thoughts, executive, ethics; no AV pipelines<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>StrategicOnly disables A\/B testing and training-collect loops, sets GPU budget to 1 and API budget to 8, and boosts executive, thoughts, and memory routing scores. It is the recommended profile when the goal is strategic planning, memory recall, or LLM routing without spending GPU time on capture, OCR, or Whisper.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">8. Persistence and Outputs<\/h1>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>File<\/strong><\/td><td><strong>Purpose<\/strong><\/td><\/tr><tr><td>lua_scripts\/rsi-run-state.json<\/td><td>Resumable run state (RSI_RESUME=1)<\/td><\/tr><tr><td>lua_scripts\/rsi-routing-weights.json<\/td><td>Learned per-goal command weights<\/td><\/tr><tr><td>lua_scripts\/rsi-run-report.md<\/td><td>End-of-run markdown report (RSI_EXPORT_REPORT=1, default on)<\/td><\/tr><tr><td>RSI-Audio-Visual-Agent.pre-phase*.lua<\/td><td>Versioned backups before each phase<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">9. Configuration Reference<\/h1>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Variable<\/strong><\/td><td><strong>Purpose<\/strong><\/td><\/tr><tr><td>RSI_GOAL<\/td><td>Optimization target for the run<\/td><\/tr><tr><td>RSI_CYCLES<\/td><td>Maximum cycles (default 5)<\/td><\/tr><tr><td>RSI_USE_VISION \/ RSI_USE_AUDIO<\/td><td>Enable or disable modality pipelines<\/td><\/tr><tr><td>RSI_MIN_CYCLES<\/td><td>Minimum cycles before convergence check<\/td><\/tr><tr><td>RSI_PROFILE<\/td><td>Named preset (e.g. StrategicOnly)<\/td><\/tr><tr><td>RSI_MENU<\/td><td>Interactive bootstrap menu<\/td><\/tr><tr><td>RSI_DRY_RUN<\/td><td>Propose improvements without applying<\/td><\/tr><tr><td>RSI_RESUME<\/td><td>Resume from rsi-run-state.json<\/td><\/tr><tr><td>RSI_FLEET<\/td><td>Broadcast lightweight commands to fleet<\/td><\/tr><tr><td>RSI_AB_TEST<\/td><td>Alternate command variants per cycle<\/td><\/tr><tr><td>RSI_SELFTEST<\/td><td>Run built-in unit tests (23 checks), no agent loop<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">10. How to Run<\/h1>\n\n\n\n<p><strong>Standard run:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>simple script execute lua_scripts\/RSI-Audio-Visual-Agent.lua<\/li>\n<\/ul>\n\n\n\n<p><strong>Strategic-only example (PowerShell):<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>$env:RSI_PROFILE = &#8220;StrategicOnly&#8221;<\/li>\n\n\n\n<li>$env:RSI_GOAL = &#8220;Improve memory recall for legal research&#8221;<\/li>\n\n\n\n<li>simple script execute lua_scripts\/RSI-Audio-Visual-Agent.lua<\/li>\n<\/ul>\n\n\n\n<p><strong>Self-test (no GPU\/API agent loop):<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>$env:RSI_SELFTEST = &#8220;1&#8221;<\/li>\n\n\n\n<li>lua lua_scripts\/RSI-Audio-Visual-Agent.lua<\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading\">11. Runtime Expectations<\/h1>\n\n\n\n<p>On a workstation-class host (e.g. Intel i9-10980XE, 64 GB RAM, NVIDIA GTX 1080 Ti), a full 5-cycle run with vision and audio typically requires roughly 15\u201335 minutes; early convergence often finishes in 6\u201315 minutes. StrategicOnly runs are substantially faster because they skip GPU-heavy capture, OCR, detection, and transcription commands.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">12. Limitations<\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Coroutines in ThreadManager do not achieve true OS-level parallelism for heavy commands<\/li>\n\n\n\n<li>Improvement quality depends on strategist LLM availability and prompt adherence<\/li>\n\n\n\n<li>Fleet broadcast requires remote commands infrastructure configured in the host app<\/li>\n\n\n\n<li>The script name reflects its origin; StrategicOnly profile operates without audio-visual pipelines<\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading\">13. Conclusion<\/h1>\n\n\n\n<p>RSI-Audio-Visual-Agent.lua transforms _AugmentedIntelligence from a static configuration into a self-tuning system. By combining structured LLM proposals, command-router intelligence, staged pipelines, safety gates, and persistent learning across runs, it provides a practical path toward autonomous optimization of complex audio-visual and strategic-reasoning workloads\u2014while remaining fully inspectable through logs, JSON state, and exported markdown reports.<\/p>\n\n\n\n<p><strong>\u2014 End of document \u2014<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/docs.google.com\/document\/d\/1KHNlXblKdrB9MfewDr7AzwlvZE-ZlBv4\/edit?usp=drive_link&amp;ouid=107277234409707752355&amp;rtpof=true&amp;sd=true Abstract RSI-Audio-Visual-Agent.lua is a goal-driven recursive self-improvement (RSI) orchestrator for the _AugmentedIntelligence v25 console application. The script does not implement machine-learning models directly; instead, it coordinates the host application\u2019s speech commands, Lua globals, memory systems, and perception pipelines through a repeated evaluate\u2013improve\u2013apply cycle. Each cycle gathers multimodal feedback (vision, audio, memory, executive planning, ethics, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1827","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/posts\/1827","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/comments?post=1827"}],"version-history":[{"count":3,"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/posts\/1827\/revisions"}],"predecessor-version":[{"id":1830,"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/posts\/1827\/revisions\/1830"}],"wp:attachment":[{"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/media?parent=1827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/categories?post=1827"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/tags?post=1827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}