Class: RubynCode::Tools::Compact
- Defined in:
- lib/rubyn_code/tools/compact.rb
Constant Summary collapse
- TOOL_NAME =
'compact'- DESCRIPTION =
'Triggers manual context compaction to reduce conversation size while preserving key information.'- PARAMETERS =
{ focus: { type: :string, required: false, description: "What to focus the summary on (e.g. 'the auth refactor', 'test failures')" } }.freeze
- RISK_LEVEL =
:read- REQUIRES_CONFIRMATION =
false
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #execute(focus: nil) ⇒ Object
-
#initialize(project_root:, context_manager: nil) ⇒ Compact
constructor
A new instance of Compact.
Methods inherited from Base
description, parameters, requires_confirmation?, risk_level, #safe_path, summarize, to_schema, tool_name, #truncate
Constructor Details
#initialize(project_root:, context_manager: nil) ⇒ Compact
Returns a new instance of Compact.
18 19 20 21 |
# File 'lib/rubyn_code/tools/compact.rb', line 18 def initialize(project_root:, context_manager: nil) super(project_root: project_root) @context_manager = context_manager end |
Instance Method Details
#execute(focus: nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rubyn_code/tools/compact.rb', line 23 def execute(focus: nil) manager = @context_manager unless manager return 'Context compaction is not available in this session. ' \ 'No context manager was provided.' end if manager.respond_to?(:compact) result = manager.compact(focus: focus) format_result(result, focus) else 'Context manager does not support compaction.' end end |