Class: ClaudeMemory::Distill::NullDistiller
- Defined in:
- lib/claude_memory/distill/null_distiller.rb
Constant Summary collapse
- DECISION_PATTERNS =
[ /\b(?:we\s+)?decided\s+to\s+(.+)/i, /\b(?:we\s+)?agreed\s+(?:to\s+|on\s+)(.+)/i, /\blet'?s\s+(?:go\s+with|use)\s+(.+)/i, /\bgoing\s+(?:forward|ahead)\s+with\s+(.+)/i ].freeze
- CONVENTION_PATTERNS =
[ /\balways\s+(.+)/i, /\bnever\s+(.+)/i, /\bconvention[:\s]+(.+)/i, /\bstandard[:\s]+(.+)/i, /\bwe\s+use\s+(.+)/i ].freeze
- ENTITY_PATTERNS =
{ "database" => /\b(postgresql|postgres|mysql|sqlite|mongodb|redis)\b/i, "framework" => /\b(rails|sinatra|django|express|next\.?js|react|vue)\b/i, # `Go` is matched case-sensitively (via the inline (?-i:) flag) so the # English verb "go" / "go-to" doesn't masquerade as the language; the # other languages stay case-insensitive. `golang` normalizes to `go`. "language" => /\b(ruby|python|javascript|typescript|rust|(?-i:Go)|golang)\b/i, "platform" => /\b(aws|gcp|azure|heroku|vercel|netlify|docker|kubernetes)\b/i }.freeze
- GLOBAL_SCOPE_PATTERNS =
[ /\bi\s+always\b/i, /\bin\s+all\s+(?:my\s+)?projects\b/i, /\beverywhere\b/i, /\bacross\s+all\s+(?:my\s+)?(?:projects|repos|codebases)\b/i, /\bmy\s+(?:personal\s+)?(?:preference|convention|standard)\b/i, /\bglobally\b/i, /\buniversally\b/i ].freeze
- OBSERVATION_CONVENTION_PATTERNS =
Observation-specific convention patterns: stricter than the shared CONVENTION_PATTERNS. Bare ‘always (.+)` / `never (.+)` / `we use (.+)` match code, prose, and instruction text (“never answer from memory”, “never nil. def …”), so observations require explicit convention framing or a first-person “we always/never”.
[ /\bconvention[:\s]+(.+)/i, /\bstandard[:\s]+(.+)/i, /\bwe\s+(?:should\s+)?(?:always|never)\s+(.+)/i ].freeze
- NOISE_BODY_SIGNATURE =
Bodies that look like code / JSON / shell / markup / transcript rather than a prose statement. High-precision gate: the Layer-1 observer scrapes raw transcript spans, which on a code-heavy project are dominated by source, specs, docs, and tool output — none of which are observations. (2026-06-23 audit, improvements #74: the prior signature let 38/117 obvious-noise rows through — spec fixtures like ‘kind: “decision”`, CHANGELOG table rows, benchmark tree output, the distiller’s own source comments — and they were being injected into SessionStart.)
Regexp.union( /\bdef\s|\bclass\s|\bmodule\s/, # Ruby definitions /=>|::|","|":\s*"|[{}]|\$\(|&&|\|\|/, # code / JSON / shell punctuation /\w+:\s*["\[{\d]/, # code/JSON key: "value" / key: 1 / key: [ /\w\(/, # method/function call: expect(, insert_observation( /\s\|\s/, # spaced table pipe (doc / CHANGELOG rows) /[\u{2500}-\u{257f}]/, # box-drawing glyphs (tree / benchmark output) /\(vector\)|\(text\)/, # benchmark mode labels /parentUuid|isSidechain|toolUseID|hookName|"type":/ # raw JSONL transcript fields )
Instance Method Summary collapse
Instance Method Details
#distill(text, content_item_id: nil) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/claude_memory/distill/null_distiller.rb', line 71 def distill(text, content_item_id: nil) entities = extract_entities(text) facts = extract_facts(text, entities) decisions = extract_decisions(text) signals = extract_signals(text) observations = extract_observations(text) Extraction.new( entities: entities, facts: facts, decisions: decisions, signals: signals, observations: observations ) end |