Skip to content

fix: mark entityContext few-shots so extractors do not store them as facts - #113

Open
Divyansh151005 wants to merge 1 commit into
supermemoryai:mainfrom
Divyansh151005:fix/entity-context-few-shot-markers
Open

fix: mark entityContext few-shots so extractors do not store them as facts#113
Divyansh151005 wants to merge 1 commit into
supermemoryai:mainfrom
Divyansh151005:fix/entity-context-few-shot-markers

Conversation

@Divyansh151005

@Divyansh151005 Divyansh151005 commented Aug 30, 2026

Copy link
Copy Markdown

What

AGENT_ENTITY_CONTEXT is sent as entityContext on every capture. Against self-hosted servers with a local extractor, the few-shot Architecture/Conventions/… quotes were periodically stored as atomic facts about the user's own repo (similarity 0.90–1.00), outranking real content — e.g. inventing "uses monorepo with turborepo" for a Bash/Python toolkit.

The server splices entityContext into space context: with no delimiter while the document is wrapped in <chunk position="N">, so bare quoted examples look like facts to extract.

Fix

Text-only change in plugin/hooks/lib/api.js:

  • Wrap the EXTRACT examples in <examples note="another project, never extract">…</examples> (same XML idiom the server already uses for chunks)
  • Close with </guidance> The document follows. Extract only from it.
  • Stay under the server's 1500-char entityContext limit (marked string is 1315)

No logic or dependency changes. Matches the approach validated in #111 (9 consecutive clean runs after marking).

Testing

$ npm test
# tests 25
# pass 25
# fail 0

Includes a new unit assertion that the markers are present, the turborepo/Drizzle quotes sit inside the examples block, and length stays ≤1500.

Fixes #111

…facts

Local extractors were lifting the turborepo/Drizzle examples out of
AGENT_ENTITY_CONTEXT because the server splices that field into space
context with no delimiter. Wrap the examples in XML tags matching the
server's chunk idiom and close with a short guidance delimiter, staying
under the 1500-char entityContext limit.

Fixes supermemoryai#111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

entityContext few-shot examples are extracted as facts about the user's repository

1 participant