Class: ClaudeMemory::Ingest::Ingester
- Inherits:
-
Object
- Object
- ClaudeMemory::Ingest::Ingester
- Defined in:
- lib/claude_memory/ingest/ingester.rb
Overview
Delta-based transcript ingestion with cursor tracking. Reads new content from transcripts, extracts metadata and tool calls, sanitizes private tags, and persists to the content_items table with FTS indexing.
Instance Method Summary collapse
-
#ingest(source:, session_id:, transcript_path:, project_path: nil) ⇒ Hash
Ingest new content from a transcript file.
-
#initialize(store, fts: nil, env: ENV, metadata_extractor: nil, tool_extractor: nil, tool_filter: nil, observation_compressor: nil) ⇒ Ingester
constructor
A new instance of Ingester.
Constructor Details
#initialize(store, fts: nil, env: ENV, metadata_extractor: nil, tool_extractor: nil, tool_filter: nil, observation_compressor: nil) ⇒ Ingester
Returns a new instance of Ingester.
18 19 20 21 22 23 24 25 26 |
# File 'lib/claude_memory/ingest/ingester.rb', line 18 def initialize(store, fts: nil, env: ENV, metadata_extractor: nil, tool_extractor: nil, tool_filter: nil, observation_compressor: nil) @store = store @fts = fts || Index::LexicalFTS.new(store) @config = Configuration.new(env) @metadata_extractor = || MetadataExtractor.new @tool_extractor = tool_extractor || ToolExtractor.new @tool_filter = tool_filter || ToolFilter.new @observation_compressor = observation_compressor || ObservationCompressor.new end |
Instance Method Details
#ingest(source:, session_id:, transcript_path:, project_path: nil) ⇒ Hash
Ingest new content from a transcript file
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/claude_memory/ingest/ingester.rb', line 35 def ingest(source:, session_id:, transcript_path:, project_path: nil) unless should_ingest?(transcript_path) ClaudeMemory.logger.debug("ingest", message: "Skipped unchanged file", transcript_path: transcript_path) return {status: :skipped, bytes_read: 0, reason: "unchanged"} end prepared = prepare_delta(session_id, transcript_path, project_path) return {status: :no_change, bytes_read: 0} if prepared.nil? return {status: :skipped, bytes_read: 0, reason: "session_excluded"} if prepared == :excluded content_id = persist_content(source, session_id, transcript_path, prepared) log_ingestion(content_id, prepared, session_id) {status: :ingested, content_id: content_id, bytes_read: prepared[:delta].bytesize, project_path: prepared[:project_path]} end |