Skip to content

Is there any way to debug compaction/token usage/prompts? #4113

Closed

Description

@oafx

Question

I feel like compaction is not working correctly currently.. i have 'limited' token budget (~130k) for my models and compaction runs like, every second message, even if it's just "wait a sec" and the agent returns "yeah sure" i see increases of token budgets by like 40k tokens.. then we'll spiral in auto compaction which only reduces the token usage down to like 90k.. and of course, if this wasn't strange enough, the compaction leads to pretty annoying memory loss/shift of objectives, which i can understand but it just feels off if it happens every few messages..

any hints on how to deliver more useful insights/bug reports to you guys? thanks!

Activity

  1. Aureatus commented on Nov 9, 2025

    @Aureatus

    In ~/.local/share/opencode/log you can find the opencode logs - by default the compaction logs don't have much info - just stuff like: INFO 2025-11-04T20:38:02 +0ms service=session.compaction pruning but per the docs - if you ran opencode with debug logging (opencode --log-level DEBUG) you might see more interesting info in there.

    Other than that - can you share the opencode config you're using? (your repo level opencode.json and your global config at ~/.config/opencode/opencode.json

  2. oafx commented on Nov 9, 2025

    @oafx
    Author

    thanks! will give this a try. currently it looks like there haven't been any logs written for 2 days. in regards to your request, sure but it's pretty much standard, just tested the openai oauth codex plugin.. but i'm using primarily github copilot as agents

    /* cat ~/.config/opencode/opencode.json */
    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": [
        "opencode-openai-codex-auth"
      ],
      "provider": {
        "openai": {
          "options": {
            "reasoningEffort": "medium",
            "reasoningSummary": "auto",
            "textVerbosity": "medium",
            "include": [
              "reasoning.encrypted_content"
            ],
            "store": false
          },
          "models": {
            "gpt-5-codex-low": {
              "name": "GPT 5 Codex Low (OAuth)",
              "options": {
                "reasoningEffort": "low",
                "reasoningSummary": "auto",
                "textVerbosity": "medium",
                "include": [
                  "reasoning.encrypted_content"
                ],
                "store": false
              }
            },
            "gpt-5-codex-medium": {
              "name": "GPT 5 Codex Medium (OAuth)",
              "options": {
                "reasoningEffort": "medium",
                "reasoningSummary": "auto",
                "textVerbosity": "medium",
                "include": [
                  "reasoning.encrypted_content"
                ],
                "store": false
              }
            },
            "gpt-5-codex-high": {
              "name": "GPT 5 Codex High (OAuth)",
              "options": {
                "reasoningEffort": "high",
                "reasoningSummary": "detailed",
                "textVerbosity": "medium",
                "include": [
                  "reasoning.encrypted_content"
                ],
                "store": false
              }
            },
            "gpt-5-minimal": {
              "name": "GPT 5 Minimal (OAuth)",
              "options": {
                "reasoningEffort": "minimal",
                "reasoningSummary": "auto",
                "textVerbosity": "low",
                "include": [
                  "reasoning.encrypted_content"
                ],
                "store": false
              }
            },
            "gpt-5-low": {
              "name": "GPT 5 Low (OAuth)",
              "options": {
                "reasoningEffort": "low",
                "reasoningSummary": "auto",
                "textVerbosity": "low",
                "include": [
                  "reasoning.encrypted_content"
                ],
                "store": false
              }
            },
            "gpt-5-medium": {
              "name": "GPT 5 Medium (OAuth)",
              "options": {
                "reasoningEffort": "medium",
                "reasoningSummary": "auto",
                "textVerbosity": "medium",
                "include": [
                  "reasoning.encrypted_content"
                ],
                "store": false
              }
            },
            "gpt-5-high": {
              "name": "GPT 5 High (OAuth)",
              "options": {
                "reasoningEffort": "high",
                "reasoningSummary": "detailed",
                "textVerbosity": "high",
                "include": [
                  "reasoning.encrypted_content"
                ],
                "store": false
              }
            },
            "gpt-5-mini": {
              "name": "GPT 5 Mini (OAuth)",
              "options": {
                "reasoningEffort": "low",
                "reasoningSummary": "auto",
                "textVerbosity": "low",
                "include": [
                  "reasoning.encrypted_content"
                ],
                "store": false
              }
            },
            "gpt-5-nano": {
              "name": "GPT 5 Nano (OAuth)",
              "options": {
                "reasoningEffort": "minimal",
                "reasoningSummary": "auto",
                "textVerbosity": "low",
                "include": [
                  "reasoning.encrypted_content"
                ],
                "store": false
              }
            }
          }
        }
      }
    }

    and no project specific opencode.json

  3. rekram1-node commented on Nov 9, 2025

    @rekram1-node
    Collaborator

    @oafx u can export any session to json:

    opencode export > out.json (if u dont redirect then it goes to stdout)

    It will open a list to select a session from

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions