Skip to content

Commit 65e1493

Browse files
committed
fix: always replace concept body on update, not only when source is new
1 parent 55f6dea commit 65e1493

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

openkb/agent/compiler.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -338,21 +338,21 @@ def _write_concept(wiki_dir: Path, name: str, content: str, source_file: str, is
338338
existing = fm + body
339339
else:
340340
existing = f"---\nsources: [{source_file}]\n---\n\n" + existing
341-
# Strip frontmatter from LLM content to avoid duplicate blocks
342-
clean = content
343-
if clean.startswith("---"):
344-
end = clean.find("---", 3)
345-
if end != -1:
346-
clean = clean[end + 3:].lstrip("\n")
347-
# Replace body with LLM rewrite (prompt asks for full rewrite, not delta)
348-
if existing.startswith("---"):
349-
end = existing.find("---", 3)
350-
if end != -1:
351-
existing = existing[:end + 3] + "\n\n" + clean
352-
else:
353-
existing = clean
341+
# Strip frontmatter from LLM content to avoid duplicate blocks
342+
clean = content
343+
if clean.startswith("---"):
344+
end = clean.find("---", 3)
345+
if end != -1:
346+
clean = clean[end + 3:].lstrip("\n")
347+
# Replace body with LLM rewrite (prompt asks for full rewrite, not delta)
348+
if existing.startswith("---"):
349+
end = existing.find("---", 3)
350+
if end != -1:
351+
existing = existing[:end + 3] + "\n\n" + clean
354352
else:
355353
existing = clean
354+
else:
355+
existing = clean
356356
if brief and existing.startswith("---"):
357357
end = existing.find("---", 3)
358358
if end != -1:

0 commit comments

Comments
 (0)