Skip to content

v0.2.0 — LLM Live Extraction, Speaker Attribution & Compaction

Choose a tag to compare

@lil2good lil2good released this 25 Mar 03:28
· 1 commit to 7083905c51d76664d4ab8b983305eef6a34d1e59 since this release
82e4de5

What's New in v0.2.0

🧠 LLM-Based Live Memory Extraction

The entire live fact extraction pipeline has been rebuilt. The old regex-based afterTurn() extractor has been replaced with qwen3.5:9b running locally via Ollama. This means:

  • Facts are extracted with real language understanding, not pattern matching
  • Technical noise (timestamps, config values, debug output) is properly filtered
  • Durable facts (preferences, relationships, identity) are reliably captured

🗣️ Speaker Attribution

Previously, facts were stored as main prefers X (using the agent ID). Now:

  • extractSpeakerFromText() in the JS plugin parses Discord envelope metadata to identify the real human speaker
  • _resolve_speaker_name() in Python ensures facts are always stored with human names (e.g. TheDev prefers X)
  • The --speaker argument is passed from JS to Python on every extraction call

🔧 Context Engine Plugin Updates

  • engram_search tool — on-demand Neo4j graph memory search, registered directly in the plugin
  • engram_store tool — explicit fact storage with LLM extraction fallback
  • afterTurn() gate simplified — directly calls storeLiveLLM() for valid user turns, regex path fully disabled

🏥 Health Check System

New scripts/healthcheck.sh performs a 6-component automated system check:

  1. Ollama status + qwen3.5:9b model loaded
  2. Neo4j bolt connection
  3. Graph query path (test recall)
  4. LLM extraction pipeline (end-to-end smoke test)
  5. Pinned facts injection
  6. Graph stats (nodes, relationships, facts)

Includes opt-in ollama_auto_start config flag (default: false) — respects users who manage Ollama via systemd or Homebrew.

🧹 Cleanup

  • All hardcoded paths removed — healthcheck uses dynamic $BASH_SOURCE resolution
  • All personal info, agent names, and credentials removed from source
  • Duplicate config.example.json removed (only config.json.example remains)
  • Stale feature branch deleted

📁 Files Changed

File Change
context_query.py LLM extraction, speaker resolution, envelope stripping, noise filtering
session.py Generalized help text (removed internal agent names)
scripts/healthcheck.sh New: 6-component health check with opt-in auto-start
config.json.example Added ollama_auto_start field and documentation
extensions/engram-context-engine/index.js Speaker extraction, LLM-only afterTurn, engram_search/engram_store tools
extensions/engram-context-engine/manifest.json Synced
extensions/engram-context-engine/package.json Synced
extensions/engram-context-engine/openclaw.plugin.json Synced

✅ Test Results

  • 12/12 test suite passing (100%)
  • Cross-session recall verified
  • Speaker attribution verified
  • Envelope noise filtering verified
  • Short message gate verified
  • Car insurance policy recall cross-session verified

🗜️ Session Compaction System

Engram includes a full session compaction engine that replaces OpenClaw's default compaction when enabled:

  • Opt-in via ownsCompaction: true in plugin config (default: false, defers to OpenClaw runtime)
  • Smart transcript splitting — keeps the last 12 messages as recent tail, compacts everything older
  • Durable memory extraction — scans older messages for keywords like "remember", "favorite", "always", "never", "birthday", "policy" and extracts them before discarding
  • Envelope noise filtering — strips Discord metadata, JSON blobs, tool outputs, and messages >800 chars from compaction summaries
  • Structured summary generation — produces a 4-section summary: Objective, Established facts, Decisions made, Open loops
  • Memory flush to disk — writes compaction summaries to memory/YYYY-MM-DD-agent-hash.md so the ingest pipeline can index them into Neo4j
  • Deduplication — durable records are deduped before persisting to avoid redundant facts
  • Token tracking — reports tokensBefore/tokensAfter so you can monitor compression ratios