Skip to content

feat(personal): cross-turn relationship linking (#1, part 1 — offline)#65

Merged
mlcyclops merged 1 commit into
masterfrom
feat/kg-cross-turn-links
Jun 24, 2026
Merged

feat(personal): cross-turn relationship linking (#1, part 1 — offline)#65
mlcyclops merged 1 commit into
masterfrom
feat/kg-cross-turn-links

Conversation

@mlcyclops

Copy link
Copy Markdown
Owner

Part 1 of the chosen 'Both' approach for the KG relationship gap (custard <-> caramel).

Problem

Relations only formed between facts extracted in the same turn, so concepts from different turns never connected.

Fix (offline, always-on, no model cost)

distillTurn now links this turn's primary new fact to prior entities the user re-mentions, with a weak mentioned with edge. Conservative to avoid noise: whole-word match on a significant (>=4-char, non-stopword) token of the prior entity's name, deduped against existing edges, capped at 3 per turn.

Verified

I love premium custard then I love caramel on custard now links the two across turns; an unrelated I use Rust follow-up creates no edge. 84 personal tests pass (2 new incl. a negative test); tsc clean.

Part 2 (opt-in model extraction toggle for richer semantic linking) is next.

🤖 Generated with Claude Code

#1, part 1)

Relations only formed between facts in the SAME turn, so concepts learned in
different turns never connected (the custard <-> caramel gap). distillTurn now
links this turn's primary new fact to PRIOR entities the user re-mentions, with a
weak 'mentioned with' edge. Conservative + offline (no model cost, no noise): a
whole-word match on a significant (>=4-char, non-stopword) token of the prior
entity's name, deduped against existing edges and capped at 3 per turn.

Verified: 'I love premium custard' then 'I love caramel on custard' now links the
two across turns; an unrelated follow-up ('I use Rust') creates no edge. 84
personal tests pass (2 new); tsc clean. (Part 2: opt-in model extraction toggle.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mlcyclops mlcyclops merged commit fee467e into master Jun 24, 2026
@mlcyclops mlcyclops deleted the feat/kg-cross-turn-links branch June 24, 2026 03:37
mlcyclops added a commit that referenced this pull request Jun 24, 2026
…part 2) (#66)

Adds a Settings toggle 'Richer graph (uses the model)' (default OFF) under
Personalization. When on, live learning uses the MODEL extractor instead of the
offline heuristic, pulling semantic facts + relationships (so related ideas connect
across turns, e.g. custard~caramel) at the cost of one extra model call per turn.

Wiring: new personalAiExtract setting (+ setter); learnFromTurn takes an optional
model-call and uses modelExtractor when the flag is on; acp_backend passes its
existing complete() util (the same one the import path already uses); personalStatus
exposes aiExtract; bridge + /api/personal/ai-extract route + UI toggle (only shown
when the store is unlocked, since that's when learning runs). Off by default → zero
cost; the offline cross-turn linker (part 1, #65) still runs underneath either way.

Verified: API round-trips the flag false->true->false; tsc clean; 332 desktop +
personal tests pass.

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