Module: SwarmMemory::DSL::BuilderExtension

Defined in:
lib/swarm_memory/dsl/builder_extension.rb

Overview

Extension module that injects memory DSL into SwarmSDK::Agent::Builder

This module is included into Agent::Builder when swarm_memory is required, adding the memory configuration method.

Instance Method Summary collapse

Instance Method Details

#memory(&block) ⇒ Object

Configure persistent memory for this agent

Examples:

Read-write mode (default) - Learn and retrieve

memory do
  directory ".swarm/agent-memory"
end

Read-only mode - Q&A without learning

memory do
  directory "team-knowledge/"
  mode :read_only
end

Full access mode - Knowledge management with Delete and Defrag

memory do
  directory "team-knowledge/"
  mode :full_access
end


28
29
30
31
32
# File 'lib/swarm_memory/dsl/builder_extension.rb', line 28

def memory(&block)
  @memory_config = SwarmMemory::DSL::MemoryConfig.new
  @memory_config.instance_eval(&block) if block_given?
  @memory_config
end