Class: Zephira::Tools::MemoryWrite
Instance Attribute Summary
Attributes inherited from BaseTool
#agent, #args
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from BaseTool
announces_intent?, #arg, #error_result, #initialize, read_only?, run, #success_result, #validate
Class Method Details
.description ⇒ Object
11
12
13
|
# File 'lib/zephira/tools/memory_write.rb', line 11
def description
"Write a named value to persistent memory."
end
|
.name ⇒ Object
7
8
9
|
# File 'lib/zephira/tools/memory_write.rb', line 7
def name
"memory_write"
end
|
.parameters ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/zephira/tools/memory_write.rb', line 15
def parameters
{
type: "object",
properties: {
key: {type: "string", description: "Memory key"},
value: {type: "string", description: "Value to store"},
intent: {type: "string", description: "Brief summary of intent of the operation, meant to be used for context compaction and presentation to the user. Use active voice (e.g., 'Reading X to do Y')."}
},
required: ["key", "value", "intent"]
}
end
|
Instance Method Details
#run ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/zephira/tools/memory_write.rb', line 28
def run
key = validate(arg(:key), arg_path: "key", type: String)
value = validate(arg(:value), arg_path: "value", type: String, allow_empty: true)
MemoryStore.write(key, value)
agent.status.verbose(" • Memory written: '#{key}'")
success_result("Memory written: '#{key}'")
end
|