{
  "commit": "c16ad0ce179d46c0ae335e6547e81d1cc3522fda",
  "platform": "win32",
  "osRelease": "10.0.26100",
  "arch": "x64",
  "node": "v26.13.1",
  "sqlite": "3.54.1",
  "items": 30000,
  "runs": 6,
  "seed": [
    {
      "type": "assistant_message",
      "status": "completed",
      "count": 15000
    },
    {
      "type": "user_message",
      "status": "completed",
      "count": 15000
    }
  ],
  "warmups": 5,
  "measuredRuns": 9,
  "summary": [
    {
      "scenario": "no compaction",
      "actionMs": [
        6.560600000000704,
        5.866300000001502,
        5.821400000000722,
        6.024100000002363,
        6.380000000001019,
        5.903300000001764,
        5.64980000000287,
        5.642499999998108,
        5.533800000001065
      ],
      "returnedMessages": [
        [
          "message:1",
          "message:2",
          "message:3",
          "message:4",
          "message:5",
          "message:6"
        ],
        [
          "message:1",
          "message:2",
          "message:3",
          "message:4",
          "message:5",
          "message:6"
        ],
        [
          "message:1",
          "message:2",
          "message:3",
          "message:4",
          "message:5",
          "message:6"
        ],
        [
          "message:1",
          "message:2",
          "message:3",
          "message:4",
          "message:5",
          "message:6"
        ],
        [
          "message:1",
          "message:2",
          "message:3",
          "message:4",
          "message:5",
          "message:6"
        ],
        [
          "message:1",
          "message:2",
          "message:3",
          "message:4",
          "message:5",
          "message:6"
        ],
        [
          "message:1",
          "message:2",
          "message:3",
          "message:4",
          "message:5",
          "message:6"
        ],
        [
          "message:1",
          "message:2",
          "message:3",
          "message:4",
          "message:5",
          "message:6"
        ],
        [
          "message:1",
          "message:2",
          "message:3",
          "message:4",
          "message:5",
          "message:6"
        ]
      ],
      "sqlMs": [
        2.0159999999996217,
        2.136800000000221,
        2.144899999999325,
        2.4144999999989523,
        2.296699999998964,
        2.100699999999051,
        2.0584000000017113,
        2.034700000000157,
        2.0904000000009546
      ],
      "medianSqlMs": 2.100699999999051,
      "spreadSqlMs": 0.3984999999993306,
      "medianActionMs": 5.866300000001502,
      "samples": [
        {
          "scenario": "no compaction",
          "ms": 2.0159999999996217,
          "vmSteps": 150083,
          "runIds": [],
          "plan": [
            "MERGE (UNION)",
            "LEFT",
            "MATERIALIZE compaction",
            "SEARCH item USING INDEX orchestration_v2_projection_turn_items_conversation_idx (thread_id=?)",
            "SEARCH run USING INDEX sqlite_autoindex_orchestration_v2_projection_runs_1 (run_id=?)",
            "SCAN compaction",
            "SEARCH run USING INDEX orchestration_v2_projection_runs_thread_ordinal_idx (thread_id=?)",
            "USE TEMP B-TREE FOR ORDER BY",
            "RIGHT",
            "SEARCH message USING INDEX sqlite_autoindex_orchestration_v2_projection_messages_1 (message_id=?)",
            "SCAN compaction"
          ],
          "sql": "\n          WITH compaction AS (\n            SELECT run.ordinal, run.requested_at\n            FROM orchestration_v2_projection_turn_items AS item\n              INDEXED BY orchestration_v2_projection_turn_items_conversation_idx\n            INNER JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id\n            WHERE item.thread_id = ?\n              AND item.type = 'compaction' AND item.status = 'completed'\n              AND item.type NOT IN ('command_execution', 'reasoning', 'file_change', 'file_search', 'web_search', 'dynamic_tool')\n              AND run.status <> 'rolled_back'\n            ORDER BY item.ordinal DESC\n            LIMIT 1\n          )\n          SELECT run.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_runs AS run ON run.thread_id = ?\n          WHERE run.ordinal >= compaction.ordinal\n            OR run.completed_at IS NULL\n            OR run.completed_at >= compaction.requested_at\n            OR run.status IN ('queued', 'preparing', 'starting', 'running', 'waiting')\n          UNION\n          SELECT message.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_messages AS message\n            ON message.message_id = ?\n          WHERE message.thread_id = ? AND message.run_id IS NOT NULL\n        ",
          "params": [
            "thread:proof",
            "thread:proof",
            "message:1",
            "thread:proof"
          ]
        },
        {
          "scenario": "no compaction",
          "ms": 2.136800000000221,
          "vmSteps": 150083,
          "runIds": [],
          "plan": [
            "MERGE (UNION)",
            "LEFT",
            "MATERIALIZE compaction",
            "SEARCH item USING INDEX orchestration_v2_projection_turn_items_conversation_idx (thread_id=?)",
            "SEARCH run USING INDEX sqlite_autoindex_orchestration_v2_projection_runs_1 (run_id=?)",
            "SCAN compaction",
            "SEARCH run USING INDEX orchestration_v2_projection_runs_thread_ordinal_idx (thread_id=?)",
            "USE TEMP B-TREE FOR ORDER BY",
            "RIGHT",
            "SEARCH message USING INDEX sqlite_autoindex_orchestration_v2_projection_messages_1 (message_id=?)",
            "SCAN compaction"
          ],
          "sql": "\n          WITH compaction AS (\n            SELECT run.ordinal, run.requested_at\n            FROM orchestration_v2_projection_turn_items AS item\n              INDEXED BY orchestration_v2_projection_turn_items_conversation_idx\n            INNER JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id\n            WHERE item.thread_id = ?\n              AND item.type = 'compaction' AND item.status = 'completed'\n              AND item.type NOT IN ('command_execution', 'reasoning', 'file_change', 'file_search', 'web_search', 'dynamic_tool')\n              AND run.status <> 'rolled_back'\n            ORDER BY item.ordinal DESC\n            LIMIT 1\n          )\n          SELECT run.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_runs AS run ON run.thread_id = ?\n          WHERE run.ordinal >= compaction.ordinal\n            OR run.completed_at IS NULL\n            OR run.completed_at >= compaction.requested_at\n            OR run.status IN ('queued', 'preparing', 'starting', 'running', 'waiting')\n          UNION\n          SELECT message.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_messages AS message\n            ON message.message_id = ?\n          WHERE message.thread_id = ? AND message.run_id IS NOT NULL\n        ",
          "params": [
            "thread:proof",
            "thread:proof",
            "message:1",
            "thread:proof"
          ]
        },
        {
          "scenario": "no compaction",
          "ms": 2.144899999999325,
          "vmSteps": 150083,
          "runIds": [],
          "plan": [
            "MERGE (UNION)",
            "LEFT",
            "MATERIALIZE compaction",
            "SEARCH item USING INDEX orchestration_v2_projection_turn_items_conversation_idx (thread_id=?)",
            "SEARCH run USING INDEX sqlite_autoindex_orchestration_v2_projection_runs_1 (run_id=?)",
            "SCAN compaction",
            "SEARCH run USING INDEX orchestration_v2_projection_runs_thread_ordinal_idx (thread_id=?)",
            "USE TEMP B-TREE FOR ORDER BY",
            "RIGHT",
            "SEARCH message USING INDEX sqlite_autoindex_orchestration_v2_projection_messages_1 (message_id=?)",
            "SCAN compaction"
          ],
          "sql": "\n          WITH compaction AS (\n            SELECT run.ordinal, run.requested_at\n            FROM orchestration_v2_projection_turn_items AS item\n              INDEXED BY orchestration_v2_projection_turn_items_conversation_idx\n            INNER JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id\n            WHERE item.thread_id = ?\n              AND item.type = 'compaction' AND item.status = 'completed'\n              AND item.type NOT IN ('command_execution', 'reasoning', 'file_change', 'file_search', 'web_search', 'dynamic_tool')\n              AND run.status <> 'rolled_back'\n            ORDER BY item.ordinal DESC\n            LIMIT 1\n          )\n          SELECT run.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_runs AS run ON run.thread_id = ?\n          WHERE run.ordinal >= compaction.ordinal\n            OR run.completed_at IS NULL\n            OR run.completed_at >= compaction.requested_at\n            OR run.status IN ('queued', 'preparing', 'starting', 'running', 'waiting')\n          UNION\n          SELECT message.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_messages AS message\n            ON message.message_id = ?\n          WHERE message.thread_id = ? AND message.run_id IS NOT NULL\n        ",
          "params": [
            "thread:proof",
            "thread:proof",
            "message:1",
            "thread:proof"
          ]
        },
        {
          "scenario": "no compaction",
          "ms": 2.4144999999989523,
          "vmSteps": 150083,
          "runIds": [],
          "plan": [
            "MERGE (UNION)",
            "LEFT",
            "MATERIALIZE compaction",
            "SEARCH item USING INDEX orchestration_v2_projection_turn_items_conversation_idx (thread_id=?)",
            "SEARCH run USING INDEX sqlite_autoindex_orchestration_v2_projection_runs_1 (run_id=?)",
            "SCAN compaction",
            "SEARCH run USING INDEX orchestration_v2_projection_runs_thread_ordinal_idx (thread_id=?)",
            "USE TEMP B-TREE FOR ORDER BY",
            "RIGHT",
            "SEARCH message USING INDEX sqlite_autoindex_orchestration_v2_projection_messages_1 (message_id=?)",
            "SCAN compaction"
          ],
          "sql": "\n          WITH compaction AS (\n            SELECT run.ordinal, run.requested_at\n            FROM orchestration_v2_projection_turn_items AS item\n              INDEXED BY orchestration_v2_projection_turn_items_conversation_idx\n            INNER JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id\n            WHERE item.thread_id = ?\n              AND item.type = 'compaction' AND item.status = 'completed'\n              AND item.type NOT IN ('command_execution', 'reasoning', 'file_change', 'file_search', 'web_search', 'dynamic_tool')\n              AND run.status <> 'rolled_back'\n            ORDER BY item.ordinal DESC\n            LIMIT 1\n          )\n          SELECT run.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_runs AS run ON run.thread_id = ?\n          WHERE run.ordinal >= compaction.ordinal\n            OR run.completed_at IS NULL\n            OR run.completed_at >= compaction.requested_at\n            OR run.status IN ('queued', 'preparing', 'starting', 'running', 'waiting')\n          UNION\n          SELECT message.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_messages AS message\n            ON message.message_id = ?\n          WHERE message.thread_id = ? AND message.run_id IS NOT NULL\n        ",
          "params": [
            "thread:proof",
            "thread:proof",
            "message:1",
            "thread:proof"
          ]
        },
        {
          "scenario": "no compaction",
          "ms": 2.296699999998964,
          "vmSteps": 150083,
          "runIds": [],
          "plan": [
            "MERGE (UNION)",
            "LEFT",
            "MATERIALIZE compaction",
            "SEARCH item USING INDEX orchestration_v2_projection_turn_items_conversation_idx (thread_id=?)",
            "SEARCH run USING INDEX sqlite_autoindex_orchestration_v2_projection_runs_1 (run_id=?)",
            "SCAN compaction",
            "SEARCH run USING INDEX orchestration_v2_projection_runs_thread_ordinal_idx (thread_id=?)",
            "USE TEMP B-TREE FOR ORDER BY",
            "RIGHT",
            "SEARCH message USING INDEX sqlite_autoindex_orchestration_v2_projection_messages_1 (message_id=?)",
            "SCAN compaction"
          ],
          "sql": "\n          WITH compaction AS (\n            SELECT run.ordinal, run.requested_at\n            FROM orchestration_v2_projection_turn_items AS item\n              INDEXED BY orchestration_v2_projection_turn_items_conversation_idx\n            INNER JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id\n            WHERE item.thread_id = ?\n              AND item.type = 'compaction' AND item.status = 'completed'\n              AND item.type NOT IN ('command_execution', 'reasoning', 'file_change', 'file_search', 'web_search', 'dynamic_tool')\n              AND run.status <> 'rolled_back'\n            ORDER BY item.ordinal DESC\n            LIMIT 1\n          )\n          SELECT run.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_runs AS run ON run.thread_id = ?\n          WHERE run.ordinal >= compaction.ordinal\n            OR run.completed_at IS NULL\n            OR run.completed_at >= compaction.requested_at\n            OR run.status IN ('queued', 'preparing', 'starting', 'running', 'waiting')\n          UNION\n          SELECT message.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_messages AS message\n            ON message.message_id = ?\n          WHERE message.thread_id = ? AND message.run_id IS NOT NULL\n        ",
          "params": [
            "thread:proof",
            "thread:proof",
            "message:1",
            "thread:proof"
          ]
        },
        {
          "scenario": "no compaction",
          "ms": 2.100699999999051,
          "vmSteps": 150083,
          "runIds": [],
          "plan": [
            "MERGE (UNION)",
            "LEFT",
            "MATERIALIZE compaction",
            "SEARCH item USING INDEX orchestration_v2_projection_turn_items_conversation_idx (thread_id=?)",
            "SEARCH run USING INDEX sqlite_autoindex_orchestration_v2_projection_runs_1 (run_id=?)",
            "SCAN compaction",
            "SEARCH run USING INDEX orchestration_v2_projection_runs_thread_ordinal_idx (thread_id=?)",
            "USE TEMP B-TREE FOR ORDER BY",
            "RIGHT",
            "SEARCH message USING INDEX sqlite_autoindex_orchestration_v2_projection_messages_1 (message_id=?)",
            "SCAN compaction"
          ],
          "sql": "\n          WITH compaction AS (\n            SELECT run.ordinal, run.requested_at\n            FROM orchestration_v2_projection_turn_items AS item\n              INDEXED BY orchestration_v2_projection_turn_items_conversation_idx\n            INNER JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id\n            WHERE item.thread_id = ?\n              AND item.type = 'compaction' AND item.status = 'completed'\n              AND item.type NOT IN ('command_execution', 'reasoning', 'file_change', 'file_search', 'web_search', 'dynamic_tool')\n              AND run.status <> 'rolled_back'\n            ORDER BY item.ordinal DESC\n            LIMIT 1\n          )\n          SELECT run.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_runs AS run ON run.thread_id = ?\n          WHERE run.ordinal >= compaction.ordinal\n            OR run.completed_at IS NULL\n            OR run.completed_at >= compaction.requested_at\n            OR run.status IN ('queued', 'preparing', 'starting', 'running', 'waiting')\n          UNION\n          SELECT message.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_messages AS message\n            ON message.message_id = ?\n          WHERE message.thread_id = ? AND message.run_id IS NOT NULL\n        ",
          "params": [
            "thread:proof",
            "thread:proof",
            "message:1",
            "thread:proof"
          ]
        },
        {
          "scenario": "no compaction",
          "ms": 2.0584000000017113,
          "vmSteps": 150083,
          "runIds": [],
          "plan": [
            "MERGE (UNION)",
            "LEFT",
            "MATERIALIZE compaction",
            "SEARCH item USING INDEX orchestration_v2_projection_turn_items_conversation_idx (thread_id=?)",
            "SEARCH run USING INDEX sqlite_autoindex_orchestration_v2_projection_runs_1 (run_id=?)",
            "SCAN compaction",
            "SEARCH run USING INDEX orchestration_v2_projection_runs_thread_ordinal_idx (thread_id=?)",
            "USE TEMP B-TREE FOR ORDER BY",
            "RIGHT",
            "SEARCH message USING INDEX sqlite_autoindex_orchestration_v2_projection_messages_1 (message_id=?)",
            "SCAN compaction"
          ],
          "sql": "\n          WITH compaction AS (\n            SELECT run.ordinal, run.requested_at\n            FROM orchestration_v2_projection_turn_items AS item\n              INDEXED BY orchestration_v2_projection_turn_items_conversation_idx\n            INNER JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id\n            WHERE item.thread_id = ?\n              AND item.type = 'compaction' AND item.status = 'completed'\n              AND item.type NOT IN ('command_execution', 'reasoning', 'file_change', 'file_search', 'web_search', 'dynamic_tool')\n              AND run.status <> 'rolled_back'\n            ORDER BY item.ordinal DESC\n            LIMIT 1\n          )\n          SELECT run.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_runs AS run ON run.thread_id = ?\n          WHERE run.ordinal >= compaction.ordinal\n            OR run.completed_at IS NULL\n            OR run.completed_at >= compaction.requested_at\n            OR run.status IN ('queued', 'preparing', 'starting', 'running', 'waiting')\n          UNION\n          SELECT message.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_messages AS message\n            ON message.message_id = ?\n          WHERE message.thread_id = ? AND message.run_id IS NOT NULL\n        ",
          "params": [
            "thread:proof",
            "thread:proof",
            "message:1",
            "thread:proof"
          ]
        },
        {
          "scenario": "no compaction",
          "ms": 2.034700000000157,
          "vmSteps": 150083,
          "runIds": [],
          "plan": [
            "MERGE (UNION)",
            "LEFT",
            "MATERIALIZE compaction",
            "SEARCH item USING INDEX orchestration_v2_projection_turn_items_conversation_idx (thread_id=?)",
            "SEARCH run USING INDEX sqlite_autoindex_orchestration_v2_projection_runs_1 (run_id=?)",
            "SCAN compaction",
            "SEARCH run USING INDEX orchestration_v2_projection_runs_thread_ordinal_idx (thread_id=?)",
            "USE TEMP B-TREE FOR ORDER BY",
            "RIGHT",
            "SEARCH message USING INDEX sqlite_autoindex_orchestration_v2_projection_messages_1 (message_id=?)",
            "SCAN compaction"
          ],
          "sql": "\n          WITH compaction AS (\n            SELECT run.ordinal, run.requested_at\n            FROM orchestration_v2_projection_turn_items AS item\n              INDEXED BY orchestration_v2_projection_turn_items_conversation_idx\n            INNER JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id\n            WHERE item.thread_id = ?\n              AND item.type = 'compaction' AND item.status = 'completed'\n              AND item.type NOT IN ('command_execution', 'reasoning', 'file_change', 'file_search', 'web_search', 'dynamic_tool')\n              AND run.status <> 'rolled_back'\n            ORDER BY item.ordinal DESC\n            LIMIT 1\n          )\n          SELECT run.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_runs AS run ON run.thread_id = ?\n          WHERE run.ordinal >= compaction.ordinal\n            OR run.completed_at IS NULL\n            OR run.completed_at >= compaction.requested_at\n            OR run.status IN ('queued', 'preparing', 'starting', 'running', 'waiting')\n          UNION\n          SELECT message.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_messages AS message\n            ON message.message_id = ?\n          WHERE message.thread_id = ? AND message.run_id IS NOT NULL\n        ",
          "params": [
            "thread:proof",
            "thread:proof",
            "message:1",
            "thread:proof"
          ]
        },
        {
          "scenario": "no compaction",
          "ms": 2.0904000000009546,
          "vmSteps": 150083,
          "runIds": [],
          "plan": [
            "MERGE (UNION)",
            "LEFT",
            "MATERIALIZE compaction",
            "SEARCH item USING INDEX orchestration_v2_projection_turn_items_conversation_idx (thread_id=?)",
            "SEARCH run USING INDEX sqlite_autoindex_orchestration_v2_projection_runs_1 (run_id=?)",
            "SCAN compaction",
            "SEARCH run USING INDEX orchestration_v2_projection_runs_thread_ordinal_idx (thread_id=?)",
            "USE TEMP B-TREE FOR ORDER BY",
            "RIGHT",
            "SEARCH message USING INDEX sqlite_autoindex_orchestration_v2_projection_messages_1 (message_id=?)",
            "SCAN compaction"
          ],
          "sql": "\n          WITH compaction AS (\n            SELECT run.ordinal, run.requested_at\n            FROM orchestration_v2_projection_turn_items AS item\n              INDEXED BY orchestration_v2_projection_turn_items_conversation_idx\n            INNER JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id\n            WHERE item.thread_id = ?\n              AND item.type = 'compaction' AND item.status = 'completed'\n              AND item.type NOT IN ('command_execution', 'reasoning', 'file_change', 'file_search', 'web_search', 'dynamic_tool')\n              AND run.status <> 'rolled_back'\n            ORDER BY item.ordinal DESC\n            LIMIT 1\n          )\n          SELECT run.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_runs AS run ON run.thread_id = ?\n          WHERE run.ordinal >= compaction.ordinal\n            OR run.completed_at IS NULL\n            OR run.completed_at >= compaction.requested_at\n            OR run.status IN ('queued', 'preparing', 'starting', 'running', 'waiting')\n          UNION\n          SELECT message.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_messages AS message\n            ON message.message_id = ?\n          WHERE message.thread_id = ? AND message.run_id IS NOT NULL\n        ",
          "params": [
            "thread:proof",
            "thread:proof",
            "message:1",
            "thread:proof"
          ]
        }
      ]
    },
    {
      "scenario": "early compaction plus later rolled-back compaction",
      "actionMs": [
        5.730999999999767,
        5.798299999998562,
        5.878700000001118,
        5.787700000000768,
        5.476500000000669,
        5.824899999999616,
        5.585100000000239,
        5.887000000002445,
        5.928299999999581
      ],
      "returnedMessages": [
        [
          "message:1",
          "message:2",
          "message:3",
          "message:4",
          "message:5",
          "message:6"
        ],
        [
          "message:1",
          "message:2",
          "message:3",
          "message:4",
          "message:5",
          "message:6"
        ],
        [
          "message:1",
          "message:2",
          "message:3",
          "message:4",
          "message:5",
          "message:6"
        ],
        [
          "message:1",
          "message:2",
          "message:3",
          "message:4",
          "message:5",
          "message:6"
        ],
        [
          "message:1",
          "message:2",
          "message:3",
          "message:4",
          "message:5",
          "message:6"
        ],
        [
          "message:1",
          "message:2",
          "message:3",
          "message:4",
          "message:5",
          "message:6"
        ],
        [
          "message:1",
          "message:2",
          "message:3",
          "message:4",
          "message:5",
          "message:6"
        ],
        [
          "message:1",
          "message:2",
          "message:3",
          "message:4",
          "message:5",
          "message:6"
        ],
        [
          "message:1",
          "message:2",
          "message:3",
          "message:4",
          "message:5",
          "message:6"
        ]
      ],
      "sqlMs": [
        2.115699999998469,
        1.9681000000018685,
        2.1120999999984633,
        2.084999999999127,
        2.0718999999990046,
        2.153600000001461,
        1.9330000000009022,
        2.1574000000000524,
        2.1045999999987544
      ],
      "medianSqlMs": 2.1045999999987544,
      "spreadSqlMs": 0.22439999999915017,
      "medianActionMs": 5.798299999998562,
      "samples": [
        {
          "scenario": "early compaction plus later rolled-back compaction",
          "ms": 2.115699999998469,
          "vmSteps": 150227,
          "runIds": [
            "run:1",
            "run:2",
            "run:3",
            "run:4",
            "run:5",
            "run:6"
          ],
          "plan": [
            "MERGE (UNION)",
            "LEFT",
            "MATERIALIZE compaction",
            "SEARCH item USING INDEX orchestration_v2_projection_turn_items_conversation_idx (thread_id=?)",
            "SEARCH run USING INDEX sqlite_autoindex_orchestration_v2_projection_runs_1 (run_id=?)",
            "SCAN compaction",
            "SEARCH run USING INDEX orchestration_v2_projection_runs_thread_ordinal_idx (thread_id=?)",
            "USE TEMP B-TREE FOR ORDER BY",
            "RIGHT",
            "SEARCH message USING INDEX sqlite_autoindex_orchestration_v2_projection_messages_1 (message_id=?)",
            "SCAN compaction"
          ],
          "sql": "\n          WITH compaction AS (\n            SELECT run.ordinal, run.requested_at\n            FROM orchestration_v2_projection_turn_items AS item\n              INDEXED BY orchestration_v2_projection_turn_items_conversation_idx\n            INNER JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id\n            WHERE item.thread_id = ?\n              AND item.type = 'compaction' AND item.status = 'completed'\n              AND item.type NOT IN ('command_execution', 'reasoning', 'file_change', 'file_search', 'web_search', 'dynamic_tool')\n              AND run.status <> 'rolled_back'\n            ORDER BY item.ordinal DESC\n            LIMIT 1\n          )\n          SELECT run.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_runs AS run ON run.thread_id = ?\n          WHERE run.ordinal >= compaction.ordinal\n            OR run.completed_at IS NULL\n            OR run.completed_at >= compaction.requested_at\n            OR run.status IN ('queued', 'preparing', 'starting', 'running', 'waiting')\n          UNION\n          SELECT message.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_messages AS message\n            ON message.message_id = ?\n          WHERE message.thread_id = ? AND message.run_id IS NOT NULL\n        ",
          "params": [
            "thread:proof",
            "thread:proof",
            "message:1",
            "thread:proof"
          ]
        },
        {
          "scenario": "early compaction plus later rolled-back compaction",
          "ms": 1.9681000000018685,
          "vmSteps": 150227,
          "runIds": [
            "run:1",
            "run:2",
            "run:3",
            "run:4",
            "run:5",
            "run:6"
          ],
          "plan": [
            "MERGE (UNION)",
            "LEFT",
            "MATERIALIZE compaction",
            "SEARCH item USING INDEX orchestration_v2_projection_turn_items_conversation_idx (thread_id=?)",
            "SEARCH run USING INDEX sqlite_autoindex_orchestration_v2_projection_runs_1 (run_id=?)",
            "SCAN compaction",
            "SEARCH run USING INDEX orchestration_v2_projection_runs_thread_ordinal_idx (thread_id=?)",
            "USE TEMP B-TREE FOR ORDER BY",
            "RIGHT",
            "SEARCH message USING INDEX sqlite_autoindex_orchestration_v2_projection_messages_1 (message_id=?)",
            "SCAN compaction"
          ],
          "sql": "\n          WITH compaction AS (\n            SELECT run.ordinal, run.requested_at\n            FROM orchestration_v2_projection_turn_items AS item\n              INDEXED BY orchestration_v2_projection_turn_items_conversation_idx\n            INNER JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id\n            WHERE item.thread_id = ?\n              AND item.type = 'compaction' AND item.status = 'completed'\n              AND item.type NOT IN ('command_execution', 'reasoning', 'file_change', 'file_search', 'web_search', 'dynamic_tool')\n              AND run.status <> 'rolled_back'\n            ORDER BY item.ordinal DESC\n            LIMIT 1\n          )\n          SELECT run.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_runs AS run ON run.thread_id = ?\n          WHERE run.ordinal >= compaction.ordinal\n            OR run.completed_at IS NULL\n            OR run.completed_at >= compaction.requested_at\n            OR run.status IN ('queued', 'preparing', 'starting', 'running', 'waiting')\n          UNION\n          SELECT message.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_messages AS message\n            ON message.message_id = ?\n          WHERE message.thread_id = ? AND message.run_id IS NOT NULL\n        ",
          "params": [
            "thread:proof",
            "thread:proof",
            "message:1",
            "thread:proof"
          ]
        },
        {
          "scenario": "early compaction plus later rolled-back compaction",
          "ms": 2.1120999999984633,
          "vmSteps": 150227,
          "runIds": [
            "run:1",
            "run:2",
            "run:3",
            "run:4",
            "run:5",
            "run:6"
          ],
          "plan": [
            "MERGE (UNION)",
            "LEFT",
            "MATERIALIZE compaction",
            "SEARCH item USING INDEX orchestration_v2_projection_turn_items_conversation_idx (thread_id=?)",
            "SEARCH run USING INDEX sqlite_autoindex_orchestration_v2_projection_runs_1 (run_id=?)",
            "SCAN compaction",
            "SEARCH run USING INDEX orchestration_v2_projection_runs_thread_ordinal_idx (thread_id=?)",
            "USE TEMP B-TREE FOR ORDER BY",
            "RIGHT",
            "SEARCH message USING INDEX sqlite_autoindex_orchestration_v2_projection_messages_1 (message_id=?)",
            "SCAN compaction"
          ],
          "sql": "\n          WITH compaction AS (\n            SELECT run.ordinal, run.requested_at\n            FROM orchestration_v2_projection_turn_items AS item\n              INDEXED BY orchestration_v2_projection_turn_items_conversation_idx\n            INNER JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id\n            WHERE item.thread_id = ?\n              AND item.type = 'compaction' AND item.status = 'completed'\n              AND item.type NOT IN ('command_execution', 'reasoning', 'file_change', 'file_search', 'web_search', 'dynamic_tool')\n              AND run.status <> 'rolled_back'\n            ORDER BY item.ordinal DESC\n            LIMIT 1\n          )\n          SELECT run.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_runs AS run ON run.thread_id = ?\n          WHERE run.ordinal >= compaction.ordinal\n            OR run.completed_at IS NULL\n            OR run.completed_at >= compaction.requested_at\n            OR run.status IN ('queued', 'preparing', 'starting', 'running', 'waiting')\n          UNION\n          SELECT message.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_messages AS message\n            ON message.message_id = ?\n          WHERE message.thread_id = ? AND message.run_id IS NOT NULL\n        ",
          "params": [
            "thread:proof",
            "thread:proof",
            "message:1",
            "thread:proof"
          ]
        },
        {
          "scenario": "early compaction plus later rolled-back compaction",
          "ms": 2.084999999999127,
          "vmSteps": 150227,
          "runIds": [
            "run:1",
            "run:2",
            "run:3",
            "run:4",
            "run:5",
            "run:6"
          ],
          "plan": [
            "MERGE (UNION)",
            "LEFT",
            "MATERIALIZE compaction",
            "SEARCH item USING INDEX orchestration_v2_projection_turn_items_conversation_idx (thread_id=?)",
            "SEARCH run USING INDEX sqlite_autoindex_orchestration_v2_projection_runs_1 (run_id=?)",
            "SCAN compaction",
            "SEARCH run USING INDEX orchestration_v2_projection_runs_thread_ordinal_idx (thread_id=?)",
            "USE TEMP B-TREE FOR ORDER BY",
            "RIGHT",
            "SEARCH message USING INDEX sqlite_autoindex_orchestration_v2_projection_messages_1 (message_id=?)",
            "SCAN compaction"
          ],
          "sql": "\n          WITH compaction AS (\n            SELECT run.ordinal, run.requested_at\n            FROM orchestration_v2_projection_turn_items AS item\n              INDEXED BY orchestration_v2_projection_turn_items_conversation_idx\n            INNER JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id\n            WHERE item.thread_id = ?\n              AND item.type = 'compaction' AND item.status = 'completed'\n              AND item.type NOT IN ('command_execution', 'reasoning', 'file_change', 'file_search', 'web_search', 'dynamic_tool')\n              AND run.status <> 'rolled_back'\n            ORDER BY item.ordinal DESC\n            LIMIT 1\n          )\n          SELECT run.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_runs AS run ON run.thread_id = ?\n          WHERE run.ordinal >= compaction.ordinal\n            OR run.completed_at IS NULL\n            OR run.completed_at >= compaction.requested_at\n            OR run.status IN ('queued', 'preparing', 'starting', 'running', 'waiting')\n          UNION\n          SELECT message.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_messages AS message\n            ON message.message_id = ?\n          WHERE message.thread_id = ? AND message.run_id IS NOT NULL\n        ",
          "params": [
            "thread:proof",
            "thread:proof",
            "message:1",
            "thread:proof"
          ]
        },
        {
          "scenario": "early compaction plus later rolled-back compaction",
          "ms": 2.0718999999990046,
          "vmSteps": 150227,
          "runIds": [
            "run:1",
            "run:2",
            "run:3",
            "run:4",
            "run:5",
            "run:6"
          ],
          "plan": [
            "MERGE (UNION)",
            "LEFT",
            "MATERIALIZE compaction",
            "SEARCH item USING INDEX orchestration_v2_projection_turn_items_conversation_idx (thread_id=?)",
            "SEARCH run USING INDEX sqlite_autoindex_orchestration_v2_projection_runs_1 (run_id=?)",
            "SCAN compaction",
            "SEARCH run USING INDEX orchestration_v2_projection_runs_thread_ordinal_idx (thread_id=?)",
            "USE TEMP B-TREE FOR ORDER BY",
            "RIGHT",
            "SEARCH message USING INDEX sqlite_autoindex_orchestration_v2_projection_messages_1 (message_id=?)",
            "SCAN compaction"
          ],
          "sql": "\n          WITH compaction AS (\n            SELECT run.ordinal, run.requested_at\n            FROM orchestration_v2_projection_turn_items AS item\n              INDEXED BY orchestration_v2_projection_turn_items_conversation_idx\n            INNER JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id\n            WHERE item.thread_id = ?\n              AND item.type = 'compaction' AND item.status = 'completed'\n              AND item.type NOT IN ('command_execution', 'reasoning', 'file_change', 'file_search', 'web_search', 'dynamic_tool')\n              AND run.status <> 'rolled_back'\n            ORDER BY item.ordinal DESC\n            LIMIT 1\n          )\n          SELECT run.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_runs AS run ON run.thread_id = ?\n          WHERE run.ordinal >= compaction.ordinal\n            OR run.completed_at IS NULL\n            OR run.completed_at >= compaction.requested_at\n            OR run.status IN ('queued', 'preparing', 'starting', 'running', 'waiting')\n          UNION\n          SELECT message.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_messages AS message\n            ON message.message_id = ?\n          WHERE message.thread_id = ? AND message.run_id IS NOT NULL\n        ",
          "params": [
            "thread:proof",
            "thread:proof",
            "message:1",
            "thread:proof"
          ]
        },
        {
          "scenario": "early compaction plus later rolled-back compaction",
          "ms": 2.153600000001461,
          "vmSteps": 150227,
          "runIds": [
            "run:1",
            "run:2",
            "run:3",
            "run:4",
            "run:5",
            "run:6"
          ],
          "plan": [
            "MERGE (UNION)",
            "LEFT",
            "MATERIALIZE compaction",
            "SEARCH item USING INDEX orchestration_v2_projection_turn_items_conversation_idx (thread_id=?)",
            "SEARCH run USING INDEX sqlite_autoindex_orchestration_v2_projection_runs_1 (run_id=?)",
            "SCAN compaction",
            "SEARCH run USING INDEX orchestration_v2_projection_runs_thread_ordinal_idx (thread_id=?)",
            "USE TEMP B-TREE FOR ORDER BY",
            "RIGHT",
            "SEARCH message USING INDEX sqlite_autoindex_orchestration_v2_projection_messages_1 (message_id=?)",
            "SCAN compaction"
          ],
          "sql": "\n          WITH compaction AS (\n            SELECT run.ordinal, run.requested_at\n            FROM orchestration_v2_projection_turn_items AS item\n              INDEXED BY orchestration_v2_projection_turn_items_conversation_idx\n            INNER JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id\n            WHERE item.thread_id = ?\n              AND item.type = 'compaction' AND item.status = 'completed'\n              AND item.type NOT IN ('command_execution', 'reasoning', 'file_change', 'file_search', 'web_search', 'dynamic_tool')\n              AND run.status <> 'rolled_back'\n            ORDER BY item.ordinal DESC\n            LIMIT 1\n          )\n          SELECT run.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_runs AS run ON run.thread_id = ?\n          WHERE run.ordinal >= compaction.ordinal\n            OR run.completed_at IS NULL\n            OR run.completed_at >= compaction.requested_at\n            OR run.status IN ('queued', 'preparing', 'starting', 'running', 'waiting')\n          UNION\n          SELECT message.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_messages AS message\n            ON message.message_id = ?\n          WHERE message.thread_id = ? AND message.run_id IS NOT NULL\n        ",
          "params": [
            "thread:proof",
            "thread:proof",
            "message:1",
            "thread:proof"
          ]
        },
        {
          "scenario": "early compaction plus later rolled-back compaction",
          "ms": 1.9330000000009022,
          "vmSteps": 150227,
          "runIds": [
            "run:1",
            "run:2",
            "run:3",
            "run:4",
            "run:5",
            "run:6"
          ],
          "plan": [
            "MERGE (UNION)",
            "LEFT",
            "MATERIALIZE compaction",
            "SEARCH item USING INDEX orchestration_v2_projection_turn_items_conversation_idx (thread_id=?)",
            "SEARCH run USING INDEX sqlite_autoindex_orchestration_v2_projection_runs_1 (run_id=?)",
            "SCAN compaction",
            "SEARCH run USING INDEX orchestration_v2_projection_runs_thread_ordinal_idx (thread_id=?)",
            "USE TEMP B-TREE FOR ORDER BY",
            "RIGHT",
            "SEARCH message USING INDEX sqlite_autoindex_orchestration_v2_projection_messages_1 (message_id=?)",
            "SCAN compaction"
          ],
          "sql": "\n          WITH compaction AS (\n            SELECT run.ordinal, run.requested_at\n            FROM orchestration_v2_projection_turn_items AS item\n              INDEXED BY orchestration_v2_projection_turn_items_conversation_idx\n            INNER JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id\n            WHERE item.thread_id = ?\n              AND item.type = 'compaction' AND item.status = 'completed'\n              AND item.type NOT IN ('command_execution', 'reasoning', 'file_change', 'file_search', 'web_search', 'dynamic_tool')\n              AND run.status <> 'rolled_back'\n            ORDER BY item.ordinal DESC\n            LIMIT 1\n          )\n          SELECT run.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_runs AS run ON run.thread_id = ?\n          WHERE run.ordinal >= compaction.ordinal\n            OR run.completed_at IS NULL\n            OR run.completed_at >= compaction.requested_at\n            OR run.status IN ('queued', 'preparing', 'starting', 'running', 'waiting')\n          UNION\n          SELECT message.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_messages AS message\n            ON message.message_id = ?\n          WHERE message.thread_id = ? AND message.run_id IS NOT NULL\n        ",
          "params": [
            "thread:proof",
            "thread:proof",
            "message:1",
            "thread:proof"
          ]
        },
        {
          "scenario": "early compaction plus later rolled-back compaction",
          "ms": 2.1574000000000524,
          "vmSteps": 150227,
          "runIds": [
            "run:1",
            "run:2",
            "run:3",
            "run:4",
            "run:5",
            "run:6"
          ],
          "plan": [
            "MERGE (UNION)",
            "LEFT",
            "MATERIALIZE compaction",
            "SEARCH item USING INDEX orchestration_v2_projection_turn_items_conversation_idx (thread_id=?)",
            "SEARCH run USING INDEX sqlite_autoindex_orchestration_v2_projection_runs_1 (run_id=?)",
            "SCAN compaction",
            "SEARCH run USING INDEX orchestration_v2_projection_runs_thread_ordinal_idx (thread_id=?)",
            "USE TEMP B-TREE FOR ORDER BY",
            "RIGHT",
            "SEARCH message USING INDEX sqlite_autoindex_orchestration_v2_projection_messages_1 (message_id=?)",
            "SCAN compaction"
          ],
          "sql": "\n          WITH compaction AS (\n            SELECT run.ordinal, run.requested_at\n            FROM orchestration_v2_projection_turn_items AS item\n              INDEXED BY orchestration_v2_projection_turn_items_conversation_idx\n            INNER JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id\n            WHERE item.thread_id = ?\n              AND item.type = 'compaction' AND item.status = 'completed'\n              AND item.type NOT IN ('command_execution', 'reasoning', 'file_change', 'file_search', 'web_search', 'dynamic_tool')\n              AND run.status <> 'rolled_back'\n            ORDER BY item.ordinal DESC\n            LIMIT 1\n          )\n          SELECT run.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_runs AS run ON run.thread_id = ?\n          WHERE run.ordinal >= compaction.ordinal\n            OR run.completed_at IS NULL\n            OR run.completed_at >= compaction.requested_at\n            OR run.status IN ('queued', 'preparing', 'starting', 'running', 'waiting')\n          UNION\n          SELECT message.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_messages AS message\n            ON message.message_id = ?\n          WHERE message.thread_id = ? AND message.run_id IS NOT NULL\n        ",
          "params": [
            "thread:proof",
            "thread:proof",
            "message:1",
            "thread:proof"
          ]
        },
        {
          "scenario": "early compaction plus later rolled-back compaction",
          "ms": 2.1045999999987544,
          "vmSteps": 150227,
          "runIds": [
            "run:1",
            "run:2",
            "run:3",
            "run:4",
            "run:5",
            "run:6"
          ],
          "plan": [
            "MERGE (UNION)",
            "LEFT",
            "MATERIALIZE compaction",
            "SEARCH item USING INDEX orchestration_v2_projection_turn_items_conversation_idx (thread_id=?)",
            "SEARCH run USING INDEX sqlite_autoindex_orchestration_v2_projection_runs_1 (run_id=?)",
            "SCAN compaction",
            "SEARCH run USING INDEX orchestration_v2_projection_runs_thread_ordinal_idx (thread_id=?)",
            "USE TEMP B-TREE FOR ORDER BY",
            "RIGHT",
            "SEARCH message USING INDEX sqlite_autoindex_orchestration_v2_projection_messages_1 (message_id=?)",
            "SCAN compaction"
          ],
          "sql": "\n          WITH compaction AS (\n            SELECT run.ordinal, run.requested_at\n            FROM orchestration_v2_projection_turn_items AS item\n              INDEXED BY orchestration_v2_projection_turn_items_conversation_idx\n            INNER JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id\n            WHERE item.thread_id = ?\n              AND item.type = 'compaction' AND item.status = 'completed'\n              AND item.type NOT IN ('command_execution', 'reasoning', 'file_change', 'file_search', 'web_search', 'dynamic_tool')\n              AND run.status <> 'rolled_back'\n            ORDER BY item.ordinal DESC\n            LIMIT 1\n          )\n          SELECT run.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_runs AS run ON run.thread_id = ?\n          WHERE run.ordinal >= compaction.ordinal\n            OR run.completed_at IS NULL\n            OR run.completed_at >= compaction.requested_at\n            OR run.status IN ('queued', 'preparing', 'starting', 'running', 'waiting')\n          UNION\n          SELECT message.run_id\n          FROM compaction\n          INNER JOIN orchestration_v2_projection_messages AS message\n            ON message.message_id = ?\n          WHERE message.thread_id = ? AND message.run_id IS NOT NULL\n        ",
          "params": [
            "thread:proof",
            "thread:proof",
            "message:1",
            "thread:proof"
          ]
        }
      ]
    }
  ]
}