Skip to content

feat(desktop): live-refresh the Knowledge graph after a turn (no close/reopen)#63

Merged
mlcyclops merged 1 commit into
masterfrom
feat/kg-live-refresh
Jun 24, 2026
Merged

feat(desktop): live-refresh the Knowledge graph after a turn (no close/reopen)#63
mlcyclops merged 1 commit into
masterfrom
feat/kg-live-refresh

Conversation

@mlcyclops

Copy link
Copy Markdown
Owner

Closes the KG-refresh half of the #54 discussion.

Problem

The Knowledge graph only re-rendered when you opened it (or after import/unlock). Facts learned during a chat (learnFromTurn, background) never showed until you closed and reopened the panel.

Fix

  • New position-preserving GraphHandle.update(data) that merges fresh data into the live force simulation: existing nodes keep their x/y (no jump), new nodes animate in, removed nodes drop, edges rebuild, sim reheats so new nodes settle.
  • After each turn, if the KG is open, poll twice (1.5s + 4.5s — covers the fast heuristic and slower model extractor) and update() only when a cheap change-signature differs (unchanged graph = no-op, no flicker).

Verified live (preview)

Sent I prefer working in dark mode with the KG open → graph went 4 → 5 nodes (working in dark mode appeared) without reopening, all original nodes preserved, no console errors (screenshot in the session). 277 desktop tests green; tsc clean.

🤖 Generated with Claude Code

…e/reopen)

The KG only re-rendered on open/import/unlock, so facts learned during a chat
(learnFromTurn, background) never appeared until you closed and reopened the panel.

Add a position-preserving GraphHandle.update(data) that MERGES fresh data into the
running force simulation: existing nodes keep their x/y (no layout jump), new nodes
animate in near the centre, removed nodes drop, edges rebuild, and the sim reheats
so new nodes settle. After each turn, if the KG is open, poll twice (1.5s + 4.5s,
covering the fast heuristic and slower model extractor) and update() only when a
cheap change-signature differs — so an unchanged graph is a no-op.

Verified live: sent 'I prefer working in dark mode' with the KG open; the graph went
4 -> 5 nodes ('working in dark mode' appeared) without reopening, all original nodes
preserved, no console errors. 277 desktop tests green; tsc clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mlcyclops mlcyclops merged commit c433050 into master Jun 24, 2026
@mlcyclops mlcyclops deleted the feat/kg-live-refresh branch June 24, 2026 03:24
mlcyclops added a commit that referenced this pull request Jun 24, 2026
…f it was its last) (#64)

The forget handler dropped the fact from the side panel but never refreshed the
graph, so a node lingered until close/reopen. Call refreshKnowledgeLive() after
forgetting — same position-preserving merge path added in #63 — so the node
disappears immediately when its last fact is forgotten. tsc clean.

Co-authored-by: mlcyclops <mlcyclops@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant