Mnemosyne.Pipeline.Decay (mnemosyne v0.1.5)

Copy Markdown View Source

Maintenance module that prunes low-utility nodes from the knowledge graph.

Scores all nodes of specified types using a relevance-free decay formula (recency frequency reward) and deletes those scoring below a threshold. After deletion, cleans up orphaned Tags and Intents that have no remaining children.

Summary

Functions

Scores all nodes of the given types and deletes those below the threshold.

Functions

decay(opts)

@spec decay(keyword()) ::
  {:ok,
   %{
     deleted: non_neg_integer(),
     checked: non_neg_integer(),
     deleted_ids: [String.t()]
   }, {module(), term()}}
  | {:error, term()}

Scores all nodes of the given types and deletes those below the threshold.

Options

  • :backend - {module, state} tuple (required)
  • :config - %Mnemosyne.Config{} (required)
  • :threshold - minimum score to survive (default 0.1)
  • :node_types - list of node type atoms (default [:semantic, :procedural])

Returns {:ok, %{deleted: n, checked: n, deleted_ids: [id]}, {backend_mod, new_state}}.