<?xml version='1.0' encoding='utf-8'?>
<mxfile host="drawio" version="31.0.2">
  <diagram name="Exo 运行时自改进架构与源码映射">
    <mxGraphModel dx="1240" dy="1080" grid="1" gridSize="10" page="1" pageWidth="1240" pageHeight="1080" background="#ffffff">
      <root>
        <mxCell id="0" />
        <mxCell id="1" parent="0" />
        <mxCell id="title" value="Exo 运行时自编辑（Runtime Self-Editing）双层架构与源码闭环" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=middle;fontFamily=PingFang SC;fontSize=30;fontColor=#1f3448;fontStyle=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
          <mxGeometry x="50" y="25" width="1140" height="46" as="geometry" />
        </mxCell>
        <mxCell id="subtitle" value="可编辑策略层（Policy π_t）与受保护机制核（Mechanism K / Guardian G）的状态与替换契约" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=middle;fontFamily=PingFang SC;fontSize=20;fontColor=#42586e;fontStyle=0;strokeColor=none;fillColor=none;" vertex="1" parent="1">
          <mxGeometry x="50" y="74" width="1140" height="34" as="geometry" />
        </mxCell>

        <mxCell id="policy_box" value="&lt;b&gt;可编辑策略层（Editable Policy Layer π_t · TypeScript）&lt;/b&gt;&lt;div style=&quot;font-size:17px;margin-top:10px;line-height:1.55&quot;&gt;• 自省地图挂载：/workspace/exo 与 SELF.md、harness.ts、prompts/me.md&lt;br&gt;• 动态工具与技能：manage_tool（.exo/tool-sources/）与 install_skill&lt;br&gt;• 上下文与自改策略：Context Compaction、摘要窗口、何时触发自我改进&lt;/div&gt;" style="rounded=1;arcSize=8;whiteSpace=wrap;html=1;align=left;verticalAlign=middle;fontFamily=PingFang SC;fontSize=21;fontColor=#1f3448;fillColor=#fdf3e2;strokeColor=#c49346;strokeWidth=2;spacingLeft=24;spacingRight=20;spacingTop=12;spacingBottom=12;" vertex="1" parent="1">
          <mxGeometry x="50" y="130" width="640" height="190" as="geometry" />
        </mxCell>

        <mxCell id="mech_history" value="&lt;b&gt;受保护存储契约：H(d_t) ⪯ H(d_{t+1})（Mechanism K）&lt;/b&gt;&lt;div style=&quot;font-size:17px;margin-top:10px;line-height:1.55&quot;&gt;• 只追加事件日志：消息、工具回执、替换记录不可覆盖或删除&lt;br&gt;• 内部可读性：list_conversation_events 暴露 token、cache 与 cost_usd&lt;br&gt;• 版本化产物库：跨会话持久保存 Memory、Skills 与历史配置快照&lt;/div&gt;" style="rounded=1;arcSize=8;whiteSpace=wrap;html=1;align=left;verticalAlign=middle;fontFamily=PingFang SC;fontSize=21;fontColor=#1f3448;fillColor=#e8f1fb;strokeColor=#728fb0;strokeWidth=2;spacingLeft=24;spacingRight=20;spacingTop=12;spacingBottom=12;" vertex="1" parent="1">
          <mxGeometry x="50" y="400" width="640" height="190" as="geometry" />
        </mxCell>

        <mxCell id="mech_sandbox" value="&lt;b&gt;独立沙箱与回滚机制（e_t · Rust Executor &amp; Sandbox API）&lt;/b&gt;&lt;div style=&quot;font-size:17px;margin-top:10px;line-height:1.55&quot;&gt;• 快照与回滚：snapshot_sandbox（filesystem / full）与 rewind_sandbox&lt;br&gt;• 状态解耦：回滚策略 π_t 或沙箱 e_t 时，历史日志 d_t 完整保留失败证据&lt;/div&gt;" style="rounded=1;arcSize=8;whiteSpace=wrap;html=1;align=left;verticalAlign=middle;fontFamily=PingFang SC;fontSize=21;fontColor=#1f3448;fillColor=#f3eefc;strokeColor=#8c72b0;strokeWidth=2;spacingLeft=24;spacingRight=20;spacingTop=12;spacingBottom=12;" vertex="1" parent="1">
          <mxGeometry x="50" y="665" width="640" height="165" as="geometry" />
        </mxCell>

        <mxCell id="guardian_box" value="&lt;b&gt;独立守卫者（Guardian G）&lt;/b&gt;&lt;div style=&quot;font-size:17px;margin-top:12px;line-height:1.55&quot;&gt;1. 激活请求工具：&lt;br&gt;rebuild_and_restart_exo&lt;br&gt;&lt;br&gt;2. 原子状态登记：&lt;br&gt;.exo/guardian-updates/&lt;br&gt;&lt;br&gt;3. 延迟脱钩（2s Delay）：&lt;br&gt;deferred-rebuild-and-restart&lt;br&gt;等待当前轮次安全收尾&lt;br&gt;&lt;br&gt;4. 宿主机编译与切换：&lt;br&gt;exo-service-guardian build&lt;br&gt;• G = 1 → 切换 π_{t+1} = π&apos;&lt;br&gt;• G = 0 → 保留 π_{t+1} = π_t&lt;/div&gt;" style="rounded=1;arcSize=8;whiteSpace=wrap;html=1;align=left;verticalAlign=middle;fontFamily=PingFang SC;fontSize=21;fontColor=#1f3448;fillColor=#e4f2ea;strokeColor=#719a80;strokeWidth=2;spacingLeft=24;spacingRight=20;spacingTop=14;spacingBottom=14;" vertex="1" parent="1">
          <mxGeometry x="870" y="130" width="320" height="700" as="geometry" />
        </mxCell>

        <mxCell id="task_env" value="&lt;b&gt;持续运行中的真实任务环境（Open-World Game / AppWorld / SREGym / CLB）&lt;/b&gt;&lt;div style=&quot;font-size:17px;margin-top:8px;line-height:1.45&quot;&gt;无需离线 Benchmark 重跑，在单次长任务执行中边做边改、当场摊薄特化成本&lt;/div&gt;" style="rounded=1;arcSize=8;whiteSpace=wrap;html=1;align=center;verticalAlign=middle;fontFamily=PingFang SC;fontSize=21;fontColor=#1f3448;fillColor=#f5f8fc;strokeColor=#728fb0;strokeWidth=2;spacing=12;" vertex="1" parent="1">
          <mxGeometry x="50" y="880" width="1140" height="100" as="geometry" />
        </mxCell>

        <mxCell id="e1" value="只读检索历史与开销" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endFill=1;strokeColor=#728fb0;strokeWidth=2;fontFamily=PingFang SC;fontSize=16;fontColor=#1f3448;labelBackgroundColor=#ffffff;exitX=0.28;exitY=0;entryX=0.28;entryY=1;" edge="1" parent="1" source="mech_history" target="policy_box">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <mxCell id="e2" value="受控追加事件" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endFill=1;strokeColor=#c49346;strokeWidth=2;fontFamily=PingFang SC;fontSize=16;fontColor=#1f3448;labelBackgroundColor=#ffffff;exitX=0.72;exitY=1;entryX=0.72;entryY=0;" edge="1" parent="1" source="policy_box" target="mech_history">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <mxCell id="e3" value="快照与状态保护" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endFill=1;strokeColor=#8c72b0;strokeWidth=2;fontFamily=PingFang SC;fontSize=16;fontColor=#1f3448;labelBackgroundColor=#ffffff;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="mech_history" target="mech_sandbox">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <mxCell id="e4" value="提交候选 π'" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endFill=1;strokeColor=#719a80;strokeWidth=2;fontFamily=PingFang SC;fontSize=16;fontColor=#1f3448;labelBackgroundColor=#ffffff;exitX=1;exitY=0.32;entryX=0;entryY=0.12;" edge="1" parent="1" source="policy_box" target="guardian_box">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <mxCell id="e5" value="验证通过热替换" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endFill=1;strokeColor=#719a80;strokeWidth=2;dashed=1;dashPattern=6 5;fontFamily=PingFang SC;fontSize=16;fontColor=#1f3448;labelBackgroundColor=#ffffff;exitX=0;exitY=0.22;entryX=1;entryY=0.68;" edge="1" parent="1" source="guardian_box" target="policy_box">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <mxCell id="e6" value="写入替换收据" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endFill=1;strokeColor=#719a80;strokeWidth=2;fontFamily=PingFang SC;fontSize=16;fontColor=#1f3448;labelBackgroundColor=#ffffff;exitX=0;exitY=0.52;entryX=1;entryY=0.5;" edge="1" parent="1" source="guardian_box" target="mech_history">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <mxCell id="caption" value="橙色：可编辑策略层（Executor π_t）　蓝色/紫色：受保护持久状态与沙箱快照（K）　绿色：宿主机独立守卫者（Guardian G）" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=middle;fontFamily=PingFang SC;fontSize=18;fontColor=#42586e;fontStyle=0;strokeColor=none;fillColor=none;" vertex="1" parent="1">
          <mxGeometry x="50" y="1000" width="1140" height="36" as="geometry" />
        </mxCell>
      </root>
    </mxGraphModel>
  </diagram>
</mxfile>
