You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(memory): close verification findings on async-merge PR (D-02/D-03/D-06/D-08/D-09)
D-06 (critical): consolidate_on_end was gated behind the LLMExtract early-return
in OnSessionEndWithProvenance, silently disabling consolidation whenever a user
set llm_extract=false (to disable episode extraction). These features are
conceptually independent. Fix: move the consolidation goroutine launch before the
LLMExtract guard, with its own independent gate (llm != nil, turns >= min,
ConsolidateOnEnd=true, LLMConsolidate=true). Verified: consolidation fires with
llm_extract=false; added regression test.
D-03: Consolidate had no upper-bound guard on LLM-returned entries; a
hallucinating LLM could expand the entry count. Fix: cap newEntries to
len(entries) before writeEntries.
D-02: writeEntries doc comment said "Caller must hold f.mu" but Consolidate
calls it holding factsDirLock instead of f.mu (safely, but undocumented). Fix:
clarify the locking contract — either f.mu (normal paths) or factsDirLock
(Consolidate) is sufficient; the two are never acquired together.
D-08: CHEATSHEET.md still documented the old judge behavior ("LLM judges →
merge or add"). Updated to reflect the new behavior (auto-add, deferred to
session-end consolidation).
D-09: CONFIG.md noted consolidate_on_end as the complement to merge-on-write,
but did not warn that disabling it causes near-duplicates to accumulate
permanently. Added an explicit note.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/CONFIG.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -216,7 +216,7 @@ The `memory` section controls the persistent memory system (see [docs/MEMORY.md]
216
216
|`buffer_lines`| 20 | Max turn summaries in session buffer |
217
217
|`buffer_enabled`| true | Enable the turn-level buffer |
218
218
|`merge_on_write`| true | Use go-vector RP similarity to auto-merge related entries (fast, no LLM — uses simple string merge) |
219
-
|`consolidate_on_end`| true | At session end, run an LLM consolidation pass over `user.md` and `env.md` in a background goroutine. This is the quality complement to `merge_on_write`: merge-on-write handles obvious duplicates immediately (no LLM), while consolidation handles near-duplicates and paraphrases at session end with full LLM quality. Requires `llm_consolidate: true`. |
219
+
|`consolidate_on_end`| true | At session end, run an LLM consolidation pass over `user.md` and `env.md` in a background goroutine. This is the quality complement to `merge_on_write`: merge-on-write handles obvious duplicates immediately (no LLM), while consolidation handles near-duplicates and paraphrases at session end with full LLM quality. Requires `llm_consolidate: true`. **Note:** facts in the borderline similarity band (0.3–0.7 cosine) are now always added immediately and only merged by this consolidation pass — if you set `consolidate_on_end: false`, near-duplicate facts will accumulate rather than being merged. |
220
220
|`extract_on_end`| true | At session end (≥3 turns), extract a narrative episode summary via LLM for later recall |
221
221
|`extract_facts`|**false**|**Opt-in.** At session end (≥3 turns), auto-extract a few **durable** facts (stable user preferences, project invariants) into `user.md`/`env.md`. Off by default — see the security note below. Independent of `extract_on_end`; to disable *all* end-of-session LLM extraction set `llm_extract: false`. |
222
222
|`llm_search`| true | Use LLM to rerank candidates for **explicit**`memory search` calls (the `memory` tool). Per-turn recall (`FormatEpisodeContext`) always uses the cached go-vector index — no LLM call on the hot path regardless of this setting. |
0 commit comments