Skip to content

feat(plugins): optional yantrik_memory — semantic memory + supersession (opt-in)#465

Open
spranab wants to merge 2 commits into
mpfaffenberger:mainfrom
spranab:feat/yantrik-memory-plugin
Open

feat(plugins): optional yantrik_memory — semantic memory + supersession (opt-in)#465
spranab wants to merge 2 commits into
mpfaffenberger:mainfrom
spranab:feat/yantrik-memory-plugin

Conversation

@spranab

@spranab spranab commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

What this adds

An optional, off-by-default plugin (code_puppy/plugins/yantrik_memory/) that
adds a YantrikDB-backed semantic/learning memory layer alongside puppy_kennel
— not a replacement. Heads-up discussion: #464.

It mirrors the kennel's plugin contract (load_prompt, user_prompt_submit,
agent_run_end, register_tools, /yantrik command), and:

  • distills durable facts/preferences from natural conversation (ignores chatter),
  • supersedes outdated facts via correct() instead of accumulating them,
  • surfaces query-relevant memories passively each turn,
  • reinforces options that keep getting accepted.

Why (honest framing)

The kennel's P0 prefs band already handles basic fact recall well — so on "is the
fact recalled," a prefs-band baseline ties this; I'm not claiming better
recall. What an append-only prefs store can't do, and this adds:

  • Supersession — after "we rebranded blue→green", the kennel's P0 keeps both
    (it's append-only), so the agent gets contradictory context; this drops the stale
    value. Verified stable from 1k→10k memories (the append-only band still carries
    both at 10k; this carries only green).
  • Passive semantic recall — the kennel's passive layer is "all prefs + recent";
    finding the right past artifact otherwise relies on recency or the agent calling
    the BM25 search tool.

Safety / footprint

  • Opt-in: default OFF; enable with /yantrik enable.
  • Fail-soft: if yantrikdb isn't installed (or it's disabled), the plugin is
    inert — registers no callbacks, never crashes boot or a turn.
  • Zero changes to existing code — a new plugin directory only.
  • One optional dependency (yantrikdb); embedder is configurable down to a bundled
    no-ONNX option.

Testing

  • Integration test (test_integration.py): distills facts, supersession works
    (recall's current band = green, stale blue gone), chatter adds nothing.
  • Live load test: loads cleanly alongside all 35 builtin plugins (incl. the
    kennel); via the real callback bus, on_user_prompt_submit distills and
    on_load_prompt injects the correct (superseded) recall block.

Known limitations (full disclosure)

  • The distiller runs a local-LLM call + a short flush per user turn — correct but
    not free; worth making async. Optional and model-configurable.
  • Not yet run in a full interactive TUI session (validated via the real loader +
    callback dispatchers).
  • YantrikDB's automatic conflict detection doesn't currently fire on free-text
    attribute-value updates, so supersession uses an explicit correct() at the app
    layer (the distiller detects the update). The engine side is being addressed
    separately.

Happy to adjust to your plugin/dependency conventions — flagging this as a starting
point for discussion as much as a merge candidate.

spranab added 2 commits June 10, 2026 16:36
A new opt-in, off-by-default plugin that adds a YantrikDB-backed memory
layer alongside puppy_kennel:
- distills durable facts/preferences from natural conversation
- supersedes outdated facts (correct()) instead of accumulating them
- surfaces query-relevant memories passively each turn

Mirrors the puppy_kennel plugin contract (load_prompt / user_prompt_submit
/ agent_run_end / register_tools / custom_command). Fail-soft: inert if
yantrikdb is not installed or when disabled. Zero changes to existing code.
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