Skip to content

Conversation

@katzdave
Copy link
Collaborator

@katzdave katzdave commented Jul 21, 2025

Replaces the summarization algorithm with a single prompt variant.

Auto-compact uses GOOSE_AUTO_COMPACT_THRESHOLD to determine if we should compact the session. Triggers this check after every user message.

@michaelneale
Copy link
Collaborator

nice - taking for a spin

@michaelneale
Copy link
Collaborator

nice @katzdave - seems to work well, I will use it a bit more as a daily thing and see if I can abuse it more! lets get this in!

@michaelneale
Copy link
Collaborator

michaelneale commented Jul 22, 2025

did hit a snag, I told it to look at ~/.local/share/goose/sessions for jsonl to extract themes, and it ran up quite the context:
(a prompt like " can you take a look in ~/.local/share/goose/sessions at the jsonl files to extract some common themes")

Now let me examine the session file to understand the specific issue:
─── text_editor | developer ──────────────────────────
path: ~/.local/share/goose/sessions/20250722_151520.jsonl
command: view
view_range:
    -
        1
    -
        20

Error: Request failed: Request failed with status: 400 Bad Request. Message: {"external_model_provider":"databricks-model-serving","external_model_error":{"error_code":"BAD_REQUEST","message":"Bad Request"}}
The tool calling loop was interrupted. How would you like to proceed?
  error: The error above was an exception we were not able to handle.
These errors are often related to connection or authentication
We've removed the conversation up to the most recent user message
- depending on the error you may be able to continue


Context: ●●●●●●●○○○ 68% (136646/200000 tokens)

might be able to reproduce it with things like that (jsonl is good as there is lots of stuff buried in there in single lines to mess it up), but then again, may not be related? I did ask it a few things and a few times to get it to run up a big session)

@katzdave katzdave changed the title WIP: New Summarization Algorithm One Shot Summarization algorithm Jul 22, 2025
@katzdave
Copy link
Collaborator Author

did hit a snag, I told it to look at ~/.local/share/goose/sessions for jsonl to extract themes, and it ran up quite the context: (a prompt like " can you take a look in ~/.local/share/goose/sessions at the jsonl files to extract some common themes")

Now let me examine the session file to understand the specific issue:
─── text_editor | developer ──────────────────────────
path: ~/.local/share/goose/sessions/20250722_151520.jsonl
command: view
view_range:
    -
        1
    -
        20

Error: Request failed: Request failed with status: 400 Bad Request. Message: {"external_model_provider":"databricks-model-serving","external_model_error":{"error_code":"BAD_REQUEST","message":"Bad Request"}}
The tool calling loop was interrupted. How would you like to proceed?
  error: The error above was an exception we were not able to handle.
These errors are often related to connection or authentication
We've removed the conversation up to the most recent user message
- depending on the error you may be able to continue


Context: ●●●●●●●○○○ 68% (136646/200000 tokens)

might be able to reproduce it with things like that (jsonl is good as there is lots of stuff buried in there in single lines to mess it up), but then again, may not be related? I did ask it a few things and a few times to get it to run up a big session)

I changed the context counting a bit, as it was annoying me that the context didn't update until the next message. I ripped that out into another branch though, and am trying to get things in a row there.

katzdave added 2 commits July 22, 2025 16:11
* 'main' of github.com:block/goose: (23 commits)
  fix: add fallback id to messages if none provided (#3584)
  feat: migrate ErrorData from internal mcp crates to rmcp version (#3586)
  fix: adjust subrecipe description to allow running tests (#3585)
  Scenario tests (#3430)
  feat: migrate JsonRpcMessage/Request/Response/Error/Notification from internal mcp crates to rmcp versions (#3564)
  Restore recipe parameters functionality (#3530)
  feat: Enhanced loading states with thinking icons and flying bird animation (#3478)
  Agent loop defensive (#3554)
  chore: remove needless clone() in goose/providers (#2528)
  Add recipe install warning (#3537)
  Replace mcp_core::resource::* with rmcp types (#3563)
  Add YouTube video embed to using-goosehints.md (#3560)
  fix: ensure retry-config and success-criteria are populated in openapi spec (#3575)
  fix: use sequential when sub recipe task is 1. (#3573)
  fix: track message id to keep like with like (#3572)
  Replace mcp_core::prompt with rmcp::model types (#3561)
  feat (ui): close recipe modals with esc key (#3568)
  feat: recipes can retry with success criteria (#3474)
  Env var to set Ollama request timeout (#3516)
  Updating docs to match new UI (#3552)
  ...
katzdave added 2 commits July 22, 2025 16:58
* 'main' of github.com:block/goose:
  Remove mcp_macros and unused types (#3581)
@michaelneale
Copy link
Collaborator

michaelneale commented Jul 23, 2025

more testing, mostly summarize was spot on, but I did hit this roadblock - no idea if related, but it just will never respond/do anything now:

image

not sure if related to session or provider

this was after a compaction, and the next prompt after that (ie once it had summarized/compacted, returned, I gave it one more instruction and that worked, but then got into this state). Probably not related?

edit:

config:

GOOSE_MODEL=claude-opus-4-20250514
GOOSE_PROVIDER=anthropic

@michaelneale
Copy link
Collaborator

michaelneale commented Jul 23, 2025

@katzdave this is my take on auto compact: #3600

still trying it out - so not sure how good, but thought you may find it interesting where to put the calls to compact - client end still seems easier (vs moving to agent and changing how api looks) - but take a look if it helps. I have seen it autocompact once (but it seemed to stall before it hit it - so may not be quite right) - it did autocompact down to 1K tokens (should it be that low?)

eg:

image

katzdave and others added 5 commits July 23, 2025 15:02
* 'main' of github.com:block/goose:
  docs: use installer component for tutorial, add updating extensions section (#3608)
  fix: show token alert popover during agent responses and agent failure cases (#3536)
  reuse the cancellation token in the agent level (#3599)
  Docs: Move MongoDB tutorial to MCP section (#3602)
  docs: desktop recipe format (#3594)
  Fix model display name not being updated immediately after leaving settings (#3587)
  Added option to summarize the chat when an error is triggered (#3598)
Co-authored-by: Zane <[email protected]>
Co-authored-by: dianed-square <[email protected]>
Co-authored-by: Rizel Scarlett <[email protected]>
Co-authored-by: Lifei Zhou <[email protected]>
Co-authored-by: David Katz <[email protected]>
* 'main' of github.com:block/goose:
  Adds the `WaitingForUserInput` state (#3620)
  docs: update extensions library (#3612)
  Fixing grants path (#3632)
  docs: June 2024 Community All-Stars Spotlight (#3631)
  grant program (#3630)
  Lifei/sub recipe desktop temp (#3576)
  docs: local LLMs context size tip (#3454)
  fix: Handle non-default base path for OpenAI compatible model fetching (#3566)
  Goose security updates (#3579)
  fix: multi-tool calls in streamed openai-compatible responses (#3609)
  feat: subagent turn count, simple agent loop (#3597)
  feat: subagent independent extension manager (#3596)
  Improve session history loading resiliency (#3588)
  Added logging and changed default route case to not redirect to home when there is an invalid route (#3610)
  fix: chat sidebar layout overlapping content occasionally (#3590)
  fix: loading shared sessions (#3607)
@michaelneale
Copy link
Collaborator

@katzdave I did have a quick look (but failed) to see if it would be easy to add it to the main agent loop - but I wasn't sure if we still had the summarizer that runs when it fills up (if we don't, we may need to add something like it back in on a higher threshold but not waiting for user input to trigger) to avoid running up against the limit when it is in the agent loop

@katzdave katzdave changed the title One Shot Summarization algorithm Autocompat + One Shot Summarization algorithm Jul 29, 2025
katzdave added 3 commits July 29, 2025 15:20
…atz/goose-compact2

* 'dkatz/goose-compact2' of github.com:block/goose:
@katzdave
Copy link
Collaborator Author

@katzdave hrm just saw this:

Error: Request failed: Streaming request failed with status: 400 Bad Request. Error: {"type":"error","error":{"type":"invalid_request_error","message":"prompt is too long: 210052 tokens > 200000 maximum"}}
The tool calling loop was interrupted. How would you like to proceed?
  error: The error above was an exception we were not able to handle.
These errors are often related to connection or authentication
We've removed the conversation up to the most recent user message
- depending on the error you may be able to continue


Context: ●●●●●●●●○○ 83% (165147/200000 tokens)
( O)> Press Enter to send, Ctrl-J for new line

which is first time - was a long run with anthropic provider + opus. Not sure if this is up to date with main but looks like token calculating is quite right, but even then - the problem is I think we do need to compact during the agent loop for complex changes unfortunately

One idea I chatted with Douwe about is to potentially have a tool for the agent to decide itself to autocompact + combined with task tracking that should help resume after compaction; I worry if we compact in the middle of an agent loop it might get pretty lost whereas with those signals it can start fresh a bit more cleanly.

I also think that marking a task as done provides a strong signal that the agent might be in a decent resting point to potentially compact or feed in new user context.

Working on some token counting fixes, but I think adding to the agent loop makes sense as a next wave effort.

@katzdave
Copy link
Collaborator Author

katzdave commented Jul 29, 2025

I also swapped in a 50% more summarize prompt. I don't notice much of a difference.

@katzdave katzdave changed the title Autocompat + One Shot Summarization algorithm Autocompact + One Shot Summarization algorithm Jul 29, 2025
katzdave added 2 commits July 29, 2025 17:34
* 'main' of github.com:block/goose:
  docs: Add GitMCP Tutorial to Extensions Library (#3716)
@michaelneale
Copy link
Collaborator

@katzdave in that case do you think we should we have task tracking in this PR (if we can make it work) - or anther PR (could also move it to developer MCP if that made it easier) - or is over loading it?

"tool for the agent to decide itself to autocompact + combined with task tracking" yes - so you think compact is itself a tool to call? (or just part of agent loop + heuristics so it isn't an extra tool call?)

8. **Current Work** – Active work at summary request time: filenames, code, alignment to latest instruction
9. **Next Step***Include only if* directly continues user instruction

> ⚠️ No new ideas unless user confirmed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about how many tokens an emoji uses?

@michaelneale michaelneale removed their assignment Jul 30, 2025
katzdave added 7 commits July 30, 2025 13:24
* 'main' of github.com:block/goose:
  Remove unused Memory Mode / Computer-Controller Mode code (#3743)
  docs: Add Neon MCP Server tutorial (#3639)
  Update OSX codesigning and notarization (#3658)
  Fix slow typing in chat input with long running sessions (#3722)
@@ -0,0 +1,10 @@
[package]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this intended to be here or should be in existing test code dir?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, deleted

katzdave added 3 commits July 31, 2025 12:58
* 'main' of github.com:block/goose:
  feat: Allow configuring hints filename(s) (#3269)
  Add support for mouse back nav button to Settings screen (#3195)
  chore: Remove the wrong tailwind package (#3754)
  chore: fix typo in desktop readme for goosed (#3752)
  feat: upgrade rmcp (#3738)
  feat: allow users view and edit their non-secret config's (#3005)
  fix: View extensions link (#3751)
  chord: refactor tool route (#3732)
@katzdave katzdave merged commit 6f36c1f into main Jul 31, 2025
8 checks passed
@katzdave katzdave deleted the dkatz/goose-compact2 branch July 31, 2025 18:23
michaelneale added a commit that referenced this pull request Jul 31, 2025
* main:
  Increase req body limit (#2965)
  Stable goose info -v (#3760)
  Speed up app initialization and improve refresh crashing (#3717)
  docs: consolidate search session content, doc import recipe (#3759)
  Improve power save blocker mechanism (#3698)
  Ensure adding/removing extensions refreshes extensions list (#3695)
  Env parsing for primitive types (#3706)
  Autocompact + One Shot Summarization algorithm (#3559)
  fix: initial prompt not filled in after accepting new recipe (#3637)
  fix not being able to click on searchbar buttons in chat (#3723)
  center session summary modal description text (#3737)
  Persist first message to local history in case of failure or cancellation (#3744)
  Make the client more secure (#3742)
  feat: Allow configuring hints filename(s) (#3269)
  Add support for mouse back nav button to Settings screen (#3195)
  chore: Remove the wrong tailwind package (#3754)
  chore: fix typo in desktop readme for goosed (#3752)
  feat: upgrade rmcp (#3738)
  feat: allow users view and edit their non-secret config's (#3005)
  fix: View extensions link (#3751)
michaelneale added a commit that referenced this pull request Aug 1, 2025
* main:
  fix: don't return full shell output when very large (#3750)
  fix: cli tool logging (#3749)
  Increase req body limit (#2965)
  Stable goose info -v (#3760)
  Speed up app initialization and improve refresh crashing (#3717)
  docs: consolidate search session content, doc import recipe (#3759)
  Improve power save blocker mechanism (#3698)
  Ensure adding/removing extensions refreshes extensions list (#3695)
  Env parsing for primitive types (#3706)
  Autocompact + One Shot Summarization algorithm (#3559)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants