Skip to content

feat(agent): use main model for context compression when no override is set - #254

Closed
Sertug17 wants to merge 1 commit into
NousResearch:mainfrom
Sertug17:feat/use-main-model-for-compression
Closed

feat(agent): use main model for context compression when no override is set#254
Sertug17 wants to merge 1 commit into
NousResearch:mainfrom
Sertug17:feat/use-main-model-for-compression

Conversation

@Sertug17

@Sertug17 Sertug17 commented Mar 1, 2026

Copy link
Copy Markdown
Contributor

Problem

Fixes #130

Context compression currently uses a small/fast auxiliary model (google/gemini-3-flash-preview) by default. As noted in the issue, compression is a fundamentally different task from quick summarization — it requires deep understanding of a long conversation to distill it without losing important context.

Change

When CONTEXT_COMPRESSION_MODEL is not explicitly set, fall back to self.model (the main agent model) instead of the auxiliary client's default:

# Before
compression_summary_model = os.getenv("CONTEXT_COMPRESSION_MODEL") or None

# After  
compression_summary_model = os.getenv("CONTEXT_COMPRESSION_MODEL") or self.model

Behavior

  • If CONTEXT_COMPRESSION_MODEL is set → use that model (no change)
  • If not set → use the main agent model instead of defaulting to gemini-flash

This ensures the most capable available model handles compression by default, while still allowing users to override with a cheaper/faster model if they prefer.

@teknium1

teknium1 commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR, @Sertug17! The underlying concern from #130 has been addressed through a couple of recent changes:

  1. Configurable compression model (commit 6366177) — The compression model is now configurable via config.yaml (under the compression section) or the CONTEXT_COMPRESSION_MODEL env var, so users can easily set it to their main model if they want higher-quality summaries.

  2. Automatic fallback to main model (commit 3e2ed18) — When the auxiliary client fails (e.g. stale API key after switching providers), the compressor now automatically falls back to the user's active endpoint (OPENAI_BASE_URL + LLM_MODEL). On success, it caches the working client so the fallback cost is only paid once per session.

Together these mean: compression uses the fast/cheap model by default (keeping costs down), gracefully falls back to the main model if the auxiliary fails, and users can explicitly override to their main model anytime. We think this is a better default than always using the expensive main model for every compression, since compression happens fairly often in long sessions.

Issue #130 was already closed as well. Closing this PR, but appreciate the contribution — and your merged fix in #253 was great!

@teknium1 teknium1 closed this Mar 5, 2026
@Sertug17

Sertug17 commented Mar 5, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for the detailed explanation, @teknium1! The fallback with caching approach is indeed smarter than always using the main model keeps costs down while still ensuring quality when needed. Happy to have contributed with #253! .

teknium1 added a commit that referenced this pull request Aug 8, 2026
Prototype of the skill-set layering discussed with agentskills.io:

- AI Catalog (/.well-known/ai-catalog.json) entries typed
  application/agent-skills+json point at an agentskills PR #254
  discovery index and represent an installable skill set.
- The optional io.hermes.skill-set extension carries set-level usage
  intent: a suggested load-alias command and a shared instruction
  preamble. Clients that ignore the extension still install the
  correct set.
- tools/skill_set_catalog.py implements the client: $schema gating,
  required sha256 digest verification, skill-md + archive (.tar.gz/.zip)
  artifacts, and #254 archive-safety rules (traversal/absolute-path/
  link rejection, decompression caps).
- hermes skills install-set <url> installs every member through the
  existing quarantine -> scan -> install pipeline, then creates the
  /<name> skill bundle so the whole set loads in one turn.
- scripts/publish_skill_set.py is the publisher-side counterpart:
  builds the static .well-known tree (catalog + index + artifacts)
  from local skill directories with byte-stable archives.
teknium1 added a commit that referenced this pull request Aug 8, 2026
…ion, inline data

Follow-ups from jonathanhefner's review on the skill-set prototype:

- Relative member URLs now resolve per RFC 3986 against the URL the
  index/catalog was ACTUALLY retrieved from (post-redirect), so an
  index that redirects to a CDN resolves its members against the CDN
  location, not the original well-known path.
- Archive format detection checks the Content-Type header first
  (application/gzip, application/zip, + common aliases) and only falls
  back to the URL file extension when the header is absent or generic,
  per agentskills #254.
- AI Catalog entries carrying inline 'data' instead of 'url' are now
  supported for both skill-set entries and nested sub-catalogs; inline
  indexes get the same $schema gating, and their relative member URLs
  resolve against the catalog's retrieved location.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider using MOST capable model for context compression/summaries

2 participants