feat: /context command + /compress focus — inspired by Claude Code#7459
Closed
teknium1 wants to merge 1 commit into
Closed
feat: /context command + /compress focus — inspired by Claude Code#7459teknium1 wants to merge 1 commit into
teknium1 wants to merge 1 commit into
Conversation
Two features inspired by Claude Code's recent releases (v2.1.89–v2.1.101): 1. /context command (alias: /ctx) Shows a live breakdown of context window usage by component: - System prompt (identity, memory, skills index, context files, guidance) - Tool schemas (count and token estimate) - Conversation messages (by role: user, assistant, tool results) - Compaction summaries - Auto-compress threshold and remaining tokens - Visual progress bar This gives users visibility into what is consuming their context window, matching Claude Code's /context feature. 2. /compress <focus> — guided compression The existing /compress command now accepts an optional focus topic: /compress database schema When provided, the summariser prioritises preserving information related to the focus topic (60-70% of summary budget) while being more aggressive about compressing everything else. Inspired by Claude Code's /compact <focus> feature. Implementation details: - /context: new _show_context_breakdown() method in cli.py - /compress focus: focus_topic flows through _manual_compress → _compress_context → ContextCompressor.compress → _generate_summary, where it's appended to the LLM summarisation prompt - 15 new tests covering both features - No changes to prompt caching, message flow, or system prompt assembly
teknium1
added a commit
that referenced
this pull request
Apr 12, 2026
Adds an optional focus topic to /compress: `/compress database schema` guides the summariser to preserve information related to the focus topic (60-70% of summary budget) while compressing everything else more aggressively. Inspired by Claude Code's /compact <focus>. Changes: - context_compressor.py: focus_topic parameter on _generate_summary() and compress(); appends FOCUS TOPIC guidance block to the LLM prompt - run_agent.py: focus_topic parameter on _compress_context(), passed through to the compressor - cli.py: _manual_compress() extracts focus topic from command string, preserves existing manual_compression_feedback integration (no regression) - gateway/run.py: _handle_compress_command() extracts focus from event args and passes through — full gateway parity - commands.py: args_hint="[focus topic]" on /compress CommandDef Salvaged from PR #7459 (CLI /compress focus only — /context command deferred). 15 new tests across CLI, compressor, and gateway.
teknium1
added a commit
that referenced
this pull request
Apr 12, 2026
Adds an optional focus topic to /compress: `/compress database schema` guides the summariser to preserve information related to the focus topic (60-70% of summary budget) while compressing everything else more aggressively. Inspired by Claude Code's /compact <focus>. Changes: - context_compressor.py: focus_topic parameter on _generate_summary() and compress(); appends FOCUS TOPIC guidance block to the LLM prompt - run_agent.py: focus_topic parameter on _compress_context(), passed through to the compressor - cli.py: _manual_compress() extracts focus topic from command string, preserves existing manual_compression_feedback integration (no regression) - gateway/run.py: _handle_compress_command() extracts focus from event args and passes through — full gateway parity - commands.py: args_hint="[focus topic]" on /compress CommandDef Salvaged from PR #7459 (CLI /compress focus only — /context command deferred). 15 new tests across CLI, compressor, and gateway.
Contributor
Author
|
The /compress feature from this PR was salvaged and merged via PR #8017 — rebased onto current main with no regressions (preserved manual_compression_feedback integration) and added full gateway parity. The /context command was deferred — context breakdown will be folded into /usage instead. |
Tommyeds
pushed a commit
to Tommyeds/hermes-agent
that referenced
this pull request
Apr 12, 2026
…search#8017) Adds an optional focus topic to /compress: `/compress database schema` guides the summariser to preserve information related to the focus topic (60-70% of summary budget) while compressing everything else more aggressively. Inspired by Claude Code's /compact <focus>. Changes: - context_compressor.py: focus_topic parameter on _generate_summary() and compress(); appends FOCUS TOPIC guidance block to the LLM prompt - run_agent.py: focus_topic parameter on _compress_context(), passed through to the compressor - cli.py: _manual_compress() extracts focus topic from command string, preserves existing manual_compression_feedback integration (no regression) - gateway/run.py: _handle_compress_command() extracts focus from event args and passes through — full gateway parity - commands.py: args_hint="[focus topic]" on /compress CommandDef Salvaged from PR NousResearch#7459 (CLI /compress focus only — /context command deferred). 15 new tests across CLI, compressor, and gateway.
ulasbilgen
pushed a commit
to ulasbilgen/hermes-adhd-agent
that referenced
this pull request
May 1, 2026
…search#8017) Adds an optional focus topic to /compress: `/compress database schema` guides the summariser to preserve information related to the focus topic (60-70% of summary budget) while compressing everything else more aggressively. Inspired by Claude Code's /compact <focus>. Changes: - context_compressor.py: focus_topic parameter on _generate_summary() and compress(); appends FOCUS TOPIC guidance block to the LLM prompt - run_agent.py: focus_topic parameter on _compress_context(), passed through to the compressor - cli.py: _manual_compress() extracts focus topic from command string, preserves existing manual_compression_feedback integration (no regression) - gateway/run.py: _handle_compress_command() extracts focus from event args and passes through — full gateway parity - commands.py: args_hint="[focus topic]" on /compress CommandDef Salvaged from PR NousResearch#7459 (CLI /compress focus only — /context command deferred). 15 new tests across CLI, compressor, and gateway.
aj-nt
pushed a commit
to aj-nt/hermes-agent
that referenced
this pull request
May 1, 2026
…search#8017) Adds an optional focus topic to /compress: `/compress database schema` guides the summariser to preserve information related to the focus topic (60-70% of summary budget) while compressing everything else more aggressively. Inspired by Claude Code's /compact <focus>. Changes: - context_compressor.py: focus_topic parameter on _generate_summary() and compress(); appends FOCUS TOPIC guidance block to the LLM prompt - run_agent.py: focus_topic parameter on _compress_context(), passed through to the compressor - cli.py: _manual_compress() extracts focus topic from command string, preserves existing manual_compression_feedback integration (no regression) - gateway/run.py: _handle_compress_command() extracts focus from event args and passes through — full gateway parity - commands.py: args_hint="[focus topic]" on /compress CommandDef Salvaged from PR NousResearch#7459 (CLI /compress focus only — /context command deferred). 15 new tests across CLI, compressor, and gateway.
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
…search#8017) Adds an optional focus topic to /compress: `/compress database schema` guides the summariser to preserve information related to the focus topic (60-70% of summary budget) while compressing everything else more aggressively. Inspired by Claude Code's /compact <focus>. Changes: - context_compressor.py: focus_topic parameter on _generate_summary() and compress(); appends FOCUS TOPIC guidance block to the LLM prompt - run_agent.py: focus_topic parameter on _compress_context(), passed through to the compressor - cli.py: _manual_compress() extracts focus topic from command string, preserves existing manual_compression_feedback integration (no regression) - gateway/run.py: _handle_compress_command() extracts focus from event args and passes through — full gateway parity - commands.py: args_hint="[focus topic]" on /compress CommandDef Salvaged from PR NousResearch#7459 (CLI /compress focus only — /context command deferred). 15 new tests across CLI, compressor, and gateway.
olympus-terminal
pushed a commit
to olympus-terminal/hermes-agent
that referenced
this pull request
May 16, 2026
…search#8017) Adds an optional focus topic to /compress: `/compress database schema` guides the summariser to preserve information related to the focus topic (60-70% of summary budget) while compressing everything else more aggressively. Inspired by Claude Code's /compact <focus>. Changes: - context_compressor.py: focus_topic parameter on _generate_summary() and compress(); appends FOCUS TOPIC guidance block to the LLM prompt - run_agent.py: focus_topic parameter on _compress_context(), passed through to the compressor - cli.py: _manual_compress() extracts focus topic from command string, preserves existing manual_compression_feedback integration (no regression) - gateway/run.py: _handle_compress_command() extracts focus from event args and passes through — full gateway parity - commands.py: args_hint="[focus topic]" on /compress CommandDef Salvaged from PR NousResearch#7459 (CLI /compress focus only — /context command deferred). 15 new tests across CLI, compressor, and gateway.
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
…search#8017) Adds an optional focus topic to /compress: `/compress database schema` guides the summariser to preserve information related to the focus topic (60-70% of summary budget) while compressing everything else more aggressively. Inspired by Claude Code's /compact <focus>. Changes: - context_compressor.py: focus_topic parameter on _generate_summary() and compress(); appends FOCUS TOPIC guidance block to the LLM prompt - run_agent.py: focus_topic parameter on _compress_context(), passed through to the compressor - cli.py: _manual_compress() extracts focus topic from command string, preserves existing manual_compression_feedback integration (no regression) - gateway/run.py: _handle_compress_command() extracts focus from event args and passes through — full gateway parity - commands.py: args_hint="[focus topic]" on /compress CommandDef Salvaged from PR NousResearch#7459 (CLI /compress focus only — /context command deferred). 15 new tests across CLI, compressor, and gateway.
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.
Summary
Two features inspired by Claude Code's recent releases (v2.1.89–v2.1.101):
1.
/contextcommand (alias:/ctx)Shows a live breakdown of context window usage by component, matching Claude Code's
/contextfeature:Source: Claude Code /context
2.
/compress <focus>— guided compressionThe existing
/compresscommand now accepts an optional focus topic:When provided, the summariser prioritises preserving information related to the focus topic (60-70% of summary budget) while being more aggressive about compressing everything else.
Source: Claude Code /compact
Implementation Details
/context: New_show_context_breakdown()method incli.pythat analyses the cached system prompt, conversation messages, and tool schemas/compress focus:focus_topicflows through_manual_compress→_compress_context→ContextCompressor.compress→_generate_summary, where it's appended to the LLM summarisation promptcommands.pywith aliasctxWhat's NOT changed
/compresscommand without arguments works exactly as beforeFiles changed
hermes_cli/commands.py— CommandDef for/context+ args_hint for/compresscli.py—_show_context_breakdown()+ enhanced_manual_compress()run_agent.py—focus_topicparameter on_compress_context()agent/context_compressor.py—focus_topicflows to_generate_summary()tests/cli/test_context_breakdown.py— 15 testsTest results