Class: ClaudeMemory::Ingest::MetadataExtractor
- Inherits:
-
Object
- Object
- ClaudeMemory::Ingest::MetadataExtractor
- Defined in:
- lib/claude_memory/ingest/metadata_extractor.rb
Overview
Extracts session metadata from JSONL transcript messages Captures git branch, working directory, Claude version, thinking level
Instance Method Summary collapse
-
#extract(raw_text) ⇒ Hash
Extract metadata from raw transcript text.
Instance Method Details
#extract(raw_text) ⇒ Hash
Extract metadata from raw transcript text
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/claude_memory/ingest/metadata_extractor.rb', line 13 def extract(raw_text) return {} if raw_text.nil? || raw_text.empty? # Parse first JSONL message for metadata first_line = raw_text.lines.first return {} unless first_line&.strip&.start_with?("{") = JSON.parse(first_line) { git_branch: extract_git_branch(), cwd: extract_cwd(), claude_version: extract_claude_version(), thinking_level: extract_thinking_level() }.compact rescue JSON::ParserError {} end |