Request for Feature Enhancement: Expose “Condense Context” as a Tool for Modes #4445
OleynikAleksandr
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Rationale
• Roo Coder already uses an internal “Condense Context” agent that intelligently shrinks the active chat history when triggered via the UI button.
• Specialist modes, however, have no programmatic access to this capability. When their session log or interaction grows near the token limit, they must either:
– manually ask the coordinator to press the button, or
– perform a costly session-rollover procedure that fragments history and adds coordination overhead.
Proposal
Expose the same functionality as a standard XML tool, e.g.
<condense_context>
session|chat|file
<target_path>optional/file/or/dir.md</target_path>
</condense_context>
Behavior
• When invoked with scope="chat" (default) it applies the existing algorithm to the active conversation history and returns the token reduction achieved.
• With scope="file" it runs the Context Condenser logic on a specified Markdown or plain-text file, producing an in-place condensed version or writing to a new file with a *.condensed.md suffix.
• The tool returns a JSON payload:
{
"tokens_before": 118734,
"tokens_after": 42305,
"bytes_saved": 215218,
"output_path": ".ruru/sessions/.../artifacts/..."
}
Benefits
• Autonomous modes can keep their own context under control without coordinator intervention, reducing unnecessary MDTM rollovers.
• Less fragmentation: a long-running task can stay in one logical session, preserving audit trails.
• Unified mechanism—same agent, same quality of condensation—now usable in automated workflows (e.g. pre-commit hooks, nightly maintenance).
Security & Safeguards
• Apply the existing permission system: modes must have write access to the target file/directory.
• Add a hard cap (e.g. may only be invoked once every N minutes per session) to avoid runaway loops.
• Log each invocation to the session log with before/after token counts for audit.
Deliverables
• Tool schema definition and integration in the global tool registry.
• Updated documentation and example usage.
• Optional VS Code command palette entry that simply issues the XML tool call, unifying GUI and API.
─────────────────────────────────────────────────────────────────────────────
Providing this tool will empower modes to manage their own footprint, improve efficiency, and keep conversations coherent without manual UI intervention.
Beta Was this translation helpful? Give feedback.
All reactions