Problem
A-MEM assumes the agent actively calls memory APIs during a session. In practice, many agent deployments -- particularly those using non-Claude CLIs (Gemini CLI, Codex, shell-based agents) -- complete work without issuing any memory write calls. The session ends, and nothing is captured.
This is not a compliance problem; it is an architecture gap. The agent may have done significant work (wrote code, ran tests, made decisions) but A-MEM has no record of any of it.
Proposed: git-diff harvest at session end
At session termination, capture what the agent actually did using git diff against a pre-session snapshot:
# Pseudocode for session-end harvest
pre_sha = capture_at_spawn() # git rev-parse HEAD at session start
post_sha = "HEAD" # at session end
diff = git_diff(pre_sha, post_sha)
if diff:
summary = llm_summarise(diff) # one-shot LLM call
amem.add(summary, tags=["session-harvest", agent_id, session_id])
This gives reliable ground truth regardless of whether the agent wrote memories voluntarily. The git diff is the artefact of record -- it does not depend on the agent's seam awareness or compliance.
Integration point
A session_end_hook(agent_id, pre_sha, post_sha) function in the A-MEM API would allow orchestration layers to trigger this without requiring A-MEM to manage the session lifecycle itself. The orchestrator calls it; A-MEM does the summarise-and-store.
Why this matters for A-MEM specifically
A-MEM's zettelkasten-inspired linking is most valuable when memories are rich and complete. Sessions where nothing is captured create gaps in the knowledge graph. The harvest approach fills those gaps with minimal overhead.
Problem
A-MEM assumes the agent actively calls memory APIs during a session. In practice, many agent deployments -- particularly those using non-Claude CLIs (Gemini CLI, Codex, shell-based agents) -- complete work without issuing any memory write calls. The session ends, and nothing is captured.
This is not a compliance problem; it is an architecture gap. The agent may have done significant work (wrote code, ran tests, made decisions) but A-MEM has no record of any of it.
Proposed: git-diff harvest at session end
At session termination, capture what the agent actually did using
git diffagainst a pre-session snapshot:This gives reliable ground truth regardless of whether the agent wrote memories voluntarily. The git diff is the artefact of record -- it does not depend on the agent's seam awareness or compliance.
Integration point
A
session_end_hook(agent_id, pre_sha, post_sha)function in the A-MEM API would allow orchestration layers to trigger this without requiring A-MEM to manage the session lifecycle itself. The orchestrator calls it; A-MEM does the summarise-and-store.Why this matters for A-MEM specifically
A-MEM's zettelkasten-inspired linking is most valuable when memories are rich and complete. Sessions where nothing is captured create gaps in the knowledge graph. The harvest approach fills those gaps with minimal overhead.