Class: RubynCode::Tools::MemoryWrite
- Defined in:
- lib/rubyn_code/tools/memory_write.rb
Constant Summary collapse
- TOOL_NAME =
'memory_write'- DESCRIPTION =
'Writes a new memory to the project memory store. ' \ 'Use this to persist code patterns, user preferences, project conventions, ' \ 'error resolutions, or architectural decisions for future reference.'
- PARAMETERS =
{ content: { type: :string, required: true, description: 'The memory content to store' }, tier: { type: :string, required: false, description: 'Memory retention tier: short, medium (default), or long' }, category: { type: :string, required: false, description: 'Category: code_pattern, user_preference, ' \ 'project_convention, error_resolution, or decision' } }.freeze
- RISK_LEVEL =
Memory is internal — no user approval needed
:read
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#execute(content:, tier: 'medium', category: nil) ⇒ String
Confirmation message.
-
#initialize(project_root:, memory_store: nil) ⇒ MemoryWrite
constructor
A new instance of MemoryWrite.
Methods inherited from Base
description, parameters, requires_confirmation?, risk_level, #safe_path, summarize, to_schema, tool_name, #truncate
Constructor Details
#initialize(project_root:, memory_store: nil) ⇒ MemoryWrite
Returns a new instance of MemoryWrite.
25 26 27 28 |
# File 'lib/rubyn_code/tools/memory_write.rb', line 25 def initialize(project_root:, memory_store: nil) super(project_root: project_root) @memory_store = memory_store end |
Instance Method Details
#execute(content:, tier: 'medium', category: nil) ⇒ String
Returns confirmation message.
34 35 36 37 38 39 40 |
# File 'lib/rubyn_code/tools/memory_write.rb', line 34 def execute(content:, tier: 'medium', category: nil) store = @memory_store || resolve_memory_store record = store.write(content: content, tier: tier, category: category) "Memory saved (ID: #{record.id}, tier: #{record.tier}" \ "#{", category: #{record.category}" if record.category})." end |