<?xml version='1.0' encoding='utf-8'?>
<mxfile host="Electron">
  <diagram id="main" name="Files and tables">
    <mxGraphModel page="0" background="#ffffff">
      <root>
        <mxCell id="0" />
        <mxCell id="1" parent="0" />
        <mxCell id="title" value="&lt;b&gt;Codex storage: which table belongs where&lt;/b&gt;" vertex="1" parent="1" style="whiteSpace=wrap;html=1;fontSize=16;fontColor=#172b4d;align=left;verticalAlign=top;spacing=14;fillColor=#ffffff;strokeColor=#9caec2;fillColor=none;strokeColor=none;fontSize=24;spacing=0;">
          <mxGeometry as="geometry" x="40" y="20" width="1030" height="45" />
        </mxCell>
        <mxCell id="state" value="&lt;b&gt;state_5.sqlite — chat inventory&lt;/b&gt;" vertex="1" parent="1" style="whiteSpace=wrap;html=1;fontSize=16;fontColor=#172b4d;align=left;verticalAlign=top;spacing=14;fillColor=#ffffff;strokeColor=#9caec2;swimlane;container=1;startSize=48;fillColor=#edf4ff;swimlaneFillColor=#edf4ff;">
          <mxGeometry as="geometry" x="40" y="90" width="470" height="500" />
        </mxCell>
        <mxCell id="threads" value="&lt;b&gt;threads&lt;/b&gt;&lt;hr&gt;id: stable chat ID&lt;br&gt;name / title, project folder, archived&lt;br&gt;rollout_path: selected history file&lt;br&gt;model, tokens, timestamps" vertex="1" parent="state" style="whiteSpace=wrap;html=1;fontSize=16;fontColor=#172b4d;align=left;verticalAlign=top;spacing=14;fillColor=#ffffff;strokeColor=#9caec2;">
          <mxGeometry as="geometry" x="20" y="65" width="430" height="170" />
        </mxCell>
        <mxCell id="children" value="&lt;b&gt;thread_spawn_edges&lt;/b&gt;&lt;hr&gt;parent_thread_id → child_thread_id&lt;br&gt;Chat IDs; used to hide subagents&lt;br&gt;and count direct children" vertex="1" parent="state" style="whiteSpace=wrap;html=1;fontSize=16;fontColor=#172b4d;align=left;verticalAlign=top;spacing=14;fillColor=#ffffff;strokeColor=#9caec2;">
          <mxGeometry as="geometry" x="20" y="265" width="430" height="140" />
        </mxCell>
        <mxCell id="history" value="&lt;b&gt;thread_history_1.sqlite — turns and messages&lt;/b&gt;" vertex="1" parent="1" style="whiteSpace=wrap;html=1;fontSize=16;fontColor=#172b4d;align=left;verticalAlign=top;spacing=14;fillColor=#ffffff;strokeColor=#9caec2;swimlane;container=1;startSize=48;fillColor=#edf9f4;swimlaneFillColor=#edf9f4;">
          <mxGeometry as="geometry" x="550" y="90" width="520" height="500" />
        </mxCell>
        <mxCell id="turns" value="&lt;b&gt;thread_turns&lt;/b&gt;&lt;hr&gt;thread_id: selected rollout ID&lt;br&gt;turn_id, status, start / end time&lt;br&gt;first_user_item_id, final_agent_item_id" vertex="1" parent="history" style="whiteSpace=wrap;html=1;fontSize=16;fontColor=#172b4d;align=left;verticalAlign=top;spacing=14;fillColor=#ffffff;strokeColor=#9caec2;">
          <mxGeometry as="geometry" x="20" y="60" width="480" height="140" />
        </mxCell>
        <mxCell id="items" value="&lt;b&gt;thread_items&lt;/b&gt;&lt;hr&gt;thread_id + turn_id + item_id&lt;br&gt;item_type, item_json: saved message or tool data" vertex="1" parent="history" style="whiteSpace=wrap;html=1;fontSize=16;fontColor=#172b4d;align=left;verticalAlign=top;spacing=14;fillColor=#ffffff;strokeColor=#9caec2;">
          <mxGeometry as="geometry" x="20" y="225" width="480" height="120" />
        </mxCell>
        <mxCell id="projection" value="&lt;b&gt;thread_history_projection_state&lt;/b&gt;&lt;hr&gt;Rollout ID, next byte offset and ordinal&lt;br&gt;Tracks history import; not queried by the board" vertex="1" parent="history" style="whiteSpace=wrap;html=1;fontSize=16;fontColor=#172b4d;align=left;verticalAlign=top;spacing=14;fillColor=#ffffff;strokeColor=#9caec2;">
          <mxGeometry as="geometry" x="20" y="365" width="480" height="110" />
        </mxCell>
        <mxCell id="jsonl" value="&lt;b&gt;Selected rollout .jsonl / .jsonl.zst file&lt;/b&gt;&lt;hr&gt;Ordered records: type, timestamp, payload&lt;br&gt;Examples: session_meta, event_msg, response_item&lt;br&gt;Saved history used to build the history database.&lt;br&gt;TaskChef reads logs only for optional selected-chat details." vertex="1" parent="1" style="whiteSpace=wrap;html=1;fontSize=16;fontColor=#172b4d;align=left;verticalAlign=top;spacing=14;fillColor=#ffffff;strokeColor=#9caec2;fillColor=#f4effa;">
          <mxGeometry as="geometry" x="40" y="620" width="680" height="155" />
        </mxCell>
        <mxCell id="scope" value="&lt;b&gt;Reading this diagram&lt;/b&gt;&lt;br&gt;&lt;br&gt;Boxes inside a database are tables.&lt;br&gt;The log is a separate file.&lt;br&gt;Selected fields only; full notes are in the storage guide." vertex="1" parent="1" style="whiteSpace=wrap;html=1;fontSize=16;fontColor=#172b4d;align=left;verticalAlign=top;spacing=14;fillColor=#ffffff;strokeColor=#9caec2;fillColor=none;strokeColor=none;">
          <mxGeometry as="geometry" x="750" y="620" width="320" height="155" />
        </mxCell>
      </root>
    </mxGraphModel>
  </diagram>
</mxfile>