Repository navigation
Conversation
… of compressed content Add two always-on tools that let the agent resolve questions about compressed/compacted sections without re-expanding them into the main context: - read_original(bN, maxTokens?) returns the raw slice of the original messages for a compression block. - investigate(bN, question) spawns a child session (parentID = current session), prompts it with the raw slice + question, and returns only the synthesized answer, then deletes the child session. Also adds /dcp read and /dcp investigate slash commands, a system-prompt awareness section, and a hint line in the xml compressed-block footer.
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.
Closes #690
Adds two tools that let the agent get at the content behind a compressed block without decompressing it.
read_original(bN, maxTokens?)returns the original messages for blockbN. IfmaxTokensis set, it keeps the most recent messages that fit and says the result was truncated.investigate(bN, question)opens a child session withparentIDset to the current session, prompts it with the original content and the question, returns only the answer, then deletes the child session.Also adds
/dcp readand/dcp investigate, a short system prompt section about the tools, and a hint line in the XML compressed block footer.Both tools are added to
primary_toolsand get anallowpermission unless the user already set one forread_original.Scope
OpenCode V1 only.
lib/v2/isn't touched, so V2 sessions don't get the tools yet. I'd rather add V2 here than ship half, if you'd like it in one PR. Let me know which you prefer.Questions for review
dcp.jsoncsetting?investigatesends the whole block to the child session with no token cap. Should it sharemaxTokenswithread_original?Testing
New tests in
tests/read-original.test.tsandtests/investigate.test.tscover block ID parsing, slice resolution, serialization, truncation, and the child session lifecycle (create, prompt, answer extraction with a fallback to reading messages, delete). Cleanup on a failed prompt is in afinallybut isn't covered by a test yet.On current master:
npm test(137 DCP tests and 8 logger tests pass),npm run typecheck,npm run check:package, and Prettier on the changed files all pass.🤖 Generated with Claude Code