)]}'
{
  "log": [
    {
      "commit": "0df32aacd4c14c8db1ea2876378f4bc23a2744dc",
      "tree": "78ce84dde10be6569f74b43148440afc8eaf83cb",
      "parents": [
        "222bf413a2ab02a430d92961cb3eef05dcf5ff89"
      ],
      "author": {
        "name": "Philip Zeyliger",
        "email": "philip@bold.dev",
        "time": "Wed Jun 04 16:47:30 2025 +0000"
      },
      "committer": {
        "name": "Philip Zeyliger",
        "email": "philip@bold.dev",
        "time": "Wed Jun 04 09:49:24 2025 -0700"
      },
      "message": "loop: change state transition logging from INFO to DEBUG\n\nReduce verbosity of state transition logging by changing log level from\nslog.InfoContext to slog.DebugContext in StateMachine.TransitionWithEvent.\n\nThe state transition logs provide detailed internal state machine flow\ninformation that is primarily useful for debugging rather than general\noperation monitoring. Moving these to DEBUG level:\n\n- Reduces log noise during normal operations\n- Maintains debugging capability when DEBUG level is enabled\n- Preserves all existing log message content and structure\n- Only affects log level, no functional changes\n\nThis change specifically targets the log line:\n\u0027State transition from X to Y (event description) duration\u003dNs\u0027\n\nThe change applies to both regular transitions in TransitionWithEvent()\nwhile preserving the existing WARN level for forced transitions which\nremain important for operational visibility.\n\nCo-Authored-By: sketch \u003chello@sketch.dev\u003e\nChange-ID: s1079bacd87ecdb73k\n"
    },
    {
      "commit": "b8a8f35348326b8daf69e31efc77d37fac4bd276",
      "tree": "fa7a59c5951dbd3ecb5e6bf840ac7b45167a9e74",
      "parents": [
        "b5739403b1b6ec6fac909b258bd47ce5a338940e"
      ],
      "author": {
        "name": "Philip Zeyliger",
        "email": "philip@bold.dev",
        "time": "Mon Jun 02 07:39:37 2025 -0700"
      },
      "committer": {
        "name": "Philip Zeyliger",
        "email": "philip@bold.dev",
        "time": "Mon Jun 02 17:01:19 2025 -0700"
      },
      "message": "loop: implement comprehensive conversation compaction system\n\n\"comprehensive\" is over-stating it. Currently, users get\nthe dreaded:\n\n\terror: failed to continue conversation: status 400 Bad Request:\n\t{\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"input\n\tlength and max_tokens exceed context limit: 197257 + 8192 \u003e 200000,\n\tdecrease input length or max_tokens and try again\"}}\n\nThat\u0027s... annoying. Instead, let\u0027s compact automatically. I was going to\nstart with adding a /compact command or button, but it turns out that\nteasing that through the system is annoying, because the agent state\nmachine is intended to be somewhat single-threaded, and what do you do\nwhen a /compact comes in while other things are going on. It\u0027s possible,\nbut it was genuinely easier to prompt my way into doing it\nautomatically.\n\nI originally set the threshold to 75%, but given that 8192/200000 is 4%,\nI just changed it to 94%.\n\nWe\u0027ll see how well it works!\n\n~~~~\n\nImplement automatic conversation compaction to manage token limits and prevent\ncontext overflow, with enhanced UX feedback and accurate token tracking.\n\nProblem Analysis:\nLarge conversations could exceed model context limits, causing failures\nwhen total tokens approached or exceeded the maximum context window.\nWithout automatic management, users would experience unexpected errors\nand conversation interruptions in long sessions.\n\nImplementation:\n\n1. Automatic Compaction Infrastructure:\n   - Added ShouldCompact() method to detect when compaction is needed\n   - Configurable token thresholds for different compaction triggers\n   - Integration with existing loop state machine for seamless operation\n\n2. Accurate Token Counting:\n   - Enhanced context size estimation using actual token usage from LLM responses\n   - Track real token consumption rather than relying on estimates\n   - Account for tool calls, system prompts, and conversation history\n\n3. Compaction Logic and Timing:\n   - Triggered at 75% of context limit (configurable threshold)\n   - Preserves recent conversation context while compacting older messages\n   - Maintains conversation continuity and coherence\n\n4. Enhanced User Experience:\n   - Visual indicators in webui when compaction occurs\n   - Token count display showing current usage vs limits\n   - Clear messaging about compaction status and reasoning\n   - Timeline updates to reflect compacted conversation state\n\n5. UI Component Updates:\n   - sketch-timeline.ts: Added compaction status display\n   - sketch-timeline-message.ts: Enhanced message rendering for compacted state\n   - sketch-app-shell.ts: Token count integration and status updates\n\nTechnical Details:\n- Thread-safe implementation with proper mutex usage\n- Preserves conversation metadata and essential context\n- Configurable compaction strategies for different use cases\n- Comprehensive error handling and fallback behavior\n- Integration with existing LLM provider implementations (Claude, OpenAI, Gemini)\n\nTesting:\n- Added unit tests for ShouldCompact logic with various scenarios\n- Verified compaction triggers at correct token thresholds\n- Confirmed UI updates reflect compaction status accurately\n- All existing tests continue to pass without regression\n\nBenefits:\n- Prevents context overflow errors in long conversations\n- Maintains conversation quality while managing resource limits\n- Provides clear user feedback about system behavior\n- Enables unlimited conversation length with automatic management\n- Improves overall system reliability and user experience\n\nThis system ensures sketch can handle conversations of any length while\nmaintaining performance and providing transparent feedback to users about\ntoken usage and compaction activities.\n\nCo-Authored-By: sketch \u003chello@sketch.dev\u003e\nChange-ID: s28a53f4e442aa169k\n"
    },
    {
      "commit": "4d4e8075e4df5249537e3ec96fea72a8bcc2399d",
      "tree": "ee1a4ae9fbac1614aefe235a5ea96814969fc420",
      "parents": [
        "6f446faed9f79e08362d22dfc9c79b15cba5f55c"
      ],
      "author": {
        "name": "Josh Bleecher Snyder",
        "email": "josharian@gmail.com",
        "time": "Mon May 05 15:00:59 2025 -0700"
      },
      "committer": {
        "name": "Josh Bleecher Snyder",
        "email": "josharian@gmail.com",
        "time": "Mon May 05 15:17:27 2025 -0700"
      },
      "message": "loop: use stringer for State.String, use String in slogs\n\n"
    },
    {
      "commit": "96b60dd7e71c7db55dfe4cff86265eab02e54e9f",
      "tree": "3ee9ddbbe4b260b7000f194e369b527ce658cd66",
      "parents": [
        "bce3a13a7c16ffdb602b66550e6b3479d34fb9b0"
      ],
      "author": {
        "name": "Sean McCullough",
        "email": "banksean@gmail.com",
        "time": "Wed Apr 30 09:49:10 2025 -0700"
      },
      "committer": {
        "name": "Sean McCullough",
        "email": "banksean@gmail.com",
        "time": "Wed Apr 30 15:20:35 2025 -0700"
      },
      "message": "Add StateMachine tracking to Agent control flow\n\nThis commit integrates the existing StateMachine type with the Agent\nto provide state tracking and validation throughout the conversation\ncontrol flow. This allows for better monitoring and debugging of the\nAgent\u0027s behavior during execution.\n\nThis commit adds tests to verify the correct behavior of the state\nmachine integration with the Agent type:\n\n1. A test for basic state transitions\n2. A test for a complete processTurn flow with a simple response\n3. A test for a processTurn flow with tool use\n\nCo-Authored-By: sketch \u003chello@sketch.dev\u003e\n"
    }
  ]
}
