Repository navigation
Enforce a configurable rolling image window before model requests - #1
Merged
Merged
Conversation
darkmatter2222
marked this pull request as ready for review
October 4, 2026 00:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Screenshot-heavy sessions accumulate raw images and can exceed a model's per-request image limit. This change defaults Master Goal to the newest image across each outgoing conversation, with native plugin configuration for other limits.
Configuration:
{"plugins":[{"package":"@darkmatter2222/opencode-mastergoal","options":{"imageWindow":1}}]}Keep the existing package path when editing an installed registration. Explicit options override MASTERGOAL_IMAGE_WINDOW, then default 1. Zero excludes all raw images. Invalid selected values reject startup. Installer upgrades preserve options.
The existing context/compaction callbacks filter request messages before goal injection; title/generate hooks cover auxiliary session requests. Filtering handles canonical Media.Asset image parts (bytes, base64, URL, provider reference) and image MIME files nested in tool-result content. It preserves text, non-image files, tool pairs and source history, with structural sharing and linear traversal. No lifecycle changes or dependency upgrades; @opencode/plugin stays at 2.0.22.
Validation:
Exact files changed:
Scope limits: OpenCode offers no final hook priority; another plugin inserting images after this filter can invalidate its ceiling. Opaque provider-managed history and calls outside session hooks are not inspected. Provider capture uses a local OpenAI-compatible fake, not live vLLM. Automatic compaction is disabled in the capture fixture; auxiliary filtering is tested at the official hook boundary. Full details and reproducible commands are in docs/validation.md.