🧠 Claude Code agents start every session with amnesia. This post solves that without adding a dedicated service, using the Elasticsearch you already run.
TL;DR: A CLI called bridge and three hooks automatically store an agent's decisions, context, and tasks in Elasticsearch, then recall them across sessions and devices via hybrid search plus temporal decay.
Title: Persistent memory for agents: Claude Code on Elasticsearch
URL:
Points
・🗂 Seven indices: memory/messages/tasks/sessions/status/entities/entity-history store memory by dimension
・🪝 Three hooks automate it: SessionStart syncs, markdown writes get indexed, Stop logs the session end (no explicit calls)
・🔎 Hybrid recall: BM25 fused with semantic_text dense vectors via RRF, catching both exact task IDs and conceptual matches
・⏳ Temporal decay: a default 45-day DECAY ranks recent memories higher (needs ES 9.3+ or Serverless)
・🕸 Knowledge graph: extracts blocked_by and friends from markdown frontmatter, surfacing blockers at depth-2 traversal
・📡 Offline resilience: writes queue locally as JSON and flush via bulk API once connectivity returns
・💻 Cross-device: gen-handoff produces a handoff JSON so another machine restores context with no git pull
If you already run Elasticsearch, the pragmatic appeal is no new service and reusing your existing monitoring and backups. Setup is three commands: git clone and
#
Elasticsearch# #
ClaudeCode#