Class: ClaudeMemory::Ingest::ObservationCompressor
- Inherits:
-
Object
- Object
- ClaudeMemory::Ingest::ObservationCompressor
- Defined in:
- lib/claude_memory/ingest/observation_compressor.rb
Overview
Compresses tool call observations into human-readable summaries. Reduces ~70% token usage vs raw tool I/O in provenance descriptions.
Constant Summary collapse
- MAX_SUMMARY_LENGTH =
200
Instance Method Summary collapse
Instance Method Details
#compress(tool_name, tool_input_json) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/claude_memory/ingest/observation_compressor.rb', line 17 def compress(tool_name, tool_input_json) return nil if tool_input_json.nil? || tool_input_json.empty? input = parse_input(tool_input_json) return nil unless input summary = case tool_name when "Edit" compress_edit(input) when "Write" compress_write(input) when "Bash" compress_bash(input) when "Read" compress_read(input) when "Glob" compress_glob(input) when "Grep" compress_grep(input) when "Task" compress_task(input) when "WebFetch" compress_web_fetch(input) when "WebSearch" compress_web_search(input) when "NotebookEdit" compress_notebook_edit(input) else compress_generic(tool_name, input) end truncate(summary) end |