agentmemory icon indicating copy to clipboard operation
agentmemory copied to clipboard

Graph extraction drops self-closing entity tags

Open Rex57 opened this issue 6 months ago • 0 comments

Bug

Graph extraction can drop valid entities when the LLM returns self-closing <entity .../> tags.

Environment

  • OS: Windows
  • Node: v24.14.1
  • agentmemory: 0.9.18
  • Area: mem::graph-extract

Repro

Use a graph extraction provider response shaped like this:

<entities>
  <entity type="file" name="src/index.ts" />
  <entity type="function" name="main"><property key="lang">typescript</property></entity>
</entities>
<relationships>
  <relationship type="uses" source="src/index.ts" target="main" weight="0.9" />
</relationships>

Expected

Both entities should become graph nodes, and the relationship should be created.

Actual

The self-closing entity is ignored by parseGraphXml, so the relationship cannot connect because its source node is missing.

Notes

The current parser accepts explicit closing tags like <entity ...></entity> but not self-closing XML tags. This can make graph stats look empty or incomplete even when the LLM provider and extraction flag are working.

Rex57 avatar May 18 '26 08:05 Rex57