fix(mnemopi): stripped retention markers from embeddings
Added an embedText projection for remember() so stored transcripts can remain readable while embeddings, FTS indexing, and embedding-model rebuilds use marker-free text. Updated coding-agent retention to pass the marker-free projection and strip retained protocol markers from recall display. Fixes #4395
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
formatMemories,
|
||||
type HindsightMessage,
|
||||
hasSubstantiveContent,
|
||||
prepareEmbeddableRetentionTranscript,
|
||||
prepareRetentionTranscript,
|
||||
prepareUserRetentionTranscript,
|
||||
sliceLastTurnsByUserBoundary,
|
||||
@@ -216,6 +217,22 @@ describe("prepareRetentionTranscript", () => {
|
||||
expect(transcript).not.toContain("panel never initializes");
|
||||
expect(transcript).not.toContain("<memories>");
|
||||
});
|
||||
|
||||
it("formats marker-free transcripts for embedding and FTS", () => {
|
||||
const messages: HindsightMessage[] = [
|
||||
{ role: "user", content: "I always prefer tabs" },
|
||||
{ role: "assistant", content: "the parser never initializes" },
|
||||
{ role: "user", content: "<memories>old</memories>\nI never use semicolons" },
|
||||
];
|
||||
const { transcript, messageCount } = prepareEmbeddableRetentionTranscript(messages);
|
||||
expect(messageCount).toBe(3);
|
||||
expect(transcript).toContain("I always prefer tabs");
|
||||
expect(transcript).toContain("the parser never initializes");
|
||||
expect(transcript).toContain("I never use semicolons");
|
||||
expect(transcript).not.toContain("[role:");
|
||||
expect(transcript).not.toContain(":end]");
|
||||
expect(transcript).not.toContain("<memories>");
|
||||
});
|
||||
});
|
||||
|
||||
describe("hasSubstantiveContent", () => {
|
||||
|
||||
Reference in New Issue
Block a user