Class: ClaudeMemory::Commands::RecallCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- ClaudeMemory::Commands::RecallCommand
- Defined in:
- lib/claude_memory/commands/recall_command.rb
Overview
Recalls facts matching a query
Instance Attribute Summary
Attributes inherited from BaseCommand
Instance Method Summary collapse
Methods inherited from BaseCommand
Constructor Details
This class inherits a constructor from ClaudeMemory::Commands::BaseCommand
Instance Method Details
#call(args) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/claude_memory/commands/recall_command.rb', line 7 def call(args) query = args.first unless query stderr.puts "Usage: claude-memory recall <query> [--limit N] [--scope project|global|all]" return 1 end opts = (args[1..] || [], {limit: 10, scope: "all"}) do |o| OptionParser.new do |parser| parser.on("--limit N", Integer, "Max results") { |v| o[:limit] = v } parser.on("--scope SCOPE", "Scope: project, global, or all") { |v| o[:scope] = v } end end return 1 if opts.nil? manager = ClaudeMemory::Store::StoreManager.new recall = ClaudeMemory::Recall.new(manager) results = recall.query(query, limit: opts[:limit], scope: opts[:scope]) if results.empty? stdout.puts "No facts found." else stdout.puts "Found #{results.size} fact(s):\n\n" results.each do |result| print_fact(result[:fact], source: result[:source]) print_receipts(result[:receipts]) stdout.puts end end manager.close 0 end |