Skip to content

gemini-compaction-feature

Generated from plugins/gemini-compaction-feature/README.md.

A Feature-level plugin that provides Gemini-style context compaction using the layered context approach.

Overview

This plugin implements the same compaction logic as GeminiCompactionAppPlugin but operates at the Feature plugin level, using the layered context to access LLM capabilities.

Key Differences from AppPlugin

Feature AppPlugin FeaturePlugin
Session persistence Built-in (via app.save_session) Returns session_metadata patch
Agent switching Full support via app.update_agent() Limited (requires app context)
Session locking Built-in (via app.acquire_session_lock) Not available
Operation level Application layer Core layer
Return value Mutations dict native_messages + session_metadata

When to Use

  • Use AppPlugin when: You need full session management, persistence, and UI integration
  • Use FeaturePlugin when: Operating at the native-message level, provider-specific optimizations, or core-level workflows

Configuration

compaction:
  enabled: true           # REQUIRED for plugin to be active
  type: gemini            # REQUIRED for this plugin
  agent_id: null          # Optional: dedicated summarizer agent
  prompt: null            # Optional: custom prompt override
  settings_overrides: {}  # Optional: model/params for compaction
  verification_pass: true # Optional: enable verification pass (default: true)

Layered Context

This plugin uses the layered context approach:

  • Layer 1 (Core): Uses context["core"] for session/message operations
  • Layer 2 (Application): Optionally uses context.get("app") for enhanced features like agent switching

Installation

pip install gemini-compaction-feature

Usage

Add to your configuration:

{
  "plugins": [
    "gemini_compaction_feature.GeminiCompactionFeaturePlugin"
  ]
}

Dependencies

This plugin depends on gemini-compaction-app for shared prompts and helpers.

License

Copyright 2026 Dynamic Programming Solutions Kft.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.