feat(opencode): context_edit toolName targeting, privileged agents, /btw command#4
Closed
feat(opencode): context_edit toolName targeting, privileged agents, /btw command#4
Conversation
…btw command - context_edit: resolve parts by toolName + nthFromEnd instead of requiring raw partID/messageID. Agent can say toolName:"read" to target the most recent read result. - Focus and compaction agents are privileged: can edit any message including user messages and other agents' output. - /btw command: side conversation that forks into a general subagent session without polluting the main thread. Returns session ID for continuation.
Owner
Author
|
Superseded by #5 which includes all these changes plus classifier, focus-rewrite-history, and query targeting. |
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.
Issue for this PR
Fixes usability issues found during manual testing of context editing tools.
Type of change
What does this PR do?
1. context_edit toolName targeting
The agent couldn't use
context_editbecause it doesn't know the internalpartID/messageIDof its own tool results. Now it can target parts by tool name:Parameters:
toolName(match most recent result from that tool),nthFromEnd(1=latest, 2=second latest). Combine for "the 2nd most recent grep result". Falls back to exactpartID/messageIDif provided.2. Privileged agents
Focus and compaction agents can now edit any message — user messages, other agents' output. Regular agents (build, plan) are still restricted to their own assistant messages only.
3. /btw command
Side conversation that doesn't pollute the main thread:
Forks into a
@generalsubagent session, answers the question, returns the session ID for continuation.How did you verify your code works?
Multi-turn CLI test (5 turns, same session):
readfile → 80 lines, 670 tokenscontext_edit(externalize, toolName: "read")→ content moved to CAS, summary inlinecontext_deref(hash)→ full original content retrievedthread_park→ side thread createdcontext_history(log)+thread_list→ edit chain and threads visibleAll 1313 unit tests pass.
Checklist