From f71a8c817838d986099d02788478373474d67c64 Mon Sep 17 00:00:00 2001 From: Bao Date: Wed, 17 Jun 2026 05:55:23 +0700 Subject: [PATCH] fix: include only reinforced preferences in digest --- packages/agentctx/src/consolidate/digest.ts | 2 +- packages/agentctx/test/consolidate/run.test.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/agentctx/src/consolidate/digest.ts b/packages/agentctx/src/consolidate/digest.ts index c536c48..53295c7 100644 --- a/packages/agentctx/src/consolidate/digest.ts +++ b/packages/agentctx/src/consolidate/digest.ts @@ -73,7 +73,7 @@ export function buildDigestSections( const prefs = currentRecords( db, GLOBAL_PROJECT_ID, - "type = 'preference' AND confidence != 'inferred'", + "type = 'preference' AND confidence = 'reinforced'", "score DESC, recorded_at DESC", ); if (prefs.length > 0) { diff --git a/packages/agentctx/test/consolidate/run.test.ts b/packages/agentctx/test/consolidate/run.test.ts index 32ee720..160f0f1 100644 --- a/packages/agentctx/test/consolidate/run.test.ts +++ b/packages/agentctx/test/consolidate/run.test.ts @@ -132,6 +132,14 @@ describe("agentctx consolidate", () => { body: "not yet reinforced", confidence: "inferred", }); + seed({ + projectId: GLOBAL_PROJECT_ID, + scope: "global", + type: "preference", + title: "Explicit but not reinforced preference", + body: "explicit only", + confidence: "explicit", + }); expect(await runConsolidate(t.env)).toBe(0); @@ -144,6 +152,7 @@ describe("agentctx consolidate", () => { expect(digest?.sections.handover).toContain("extraction pipeline"); expect(digest?.sections.globalPreferences).toContain("Prefers arrow functions"); expect(digest?.sections.globalPreferences).not.toContain("Unproven"); + expect(digest?.sections.globalPreferences).not.toContain("Explicit but not reinforced"); expect(digest?.sections.mcpHint).toContain("ctx_search"); const total = Object.values(digest?.sections ?? {}).reduce(