Reminisce.Persona (reminisce v0.6.0)

Copy Markdown View Source

The persona DNA (docs/spec.md Appendix C): the stable core of an agent's identity, as its keeper wrote it, kept as strands in numbered versions.

A strand is a memory of the agent with the aspect :persona alone, of one of five kinds (:value, :boundary, :voice, :relationship, :origin), with a name ([a-z][a-z0-9_]*, at most 64 bytes) that is how two versions name the same strand, and its words. A strand never changes: a changed strand is a new strand with the same name, in a new version.

A version is a record of the agent: its number (from 1), its status (:proposed, :adopted or :declined), its basis, its base (the version that was current when it was written), who proposed, adopted, declined or reviewed it, and why. It links every strand it holds. The current version is the adopted one with the highest number.

Only the keeper's act, a call the host makes in Elixir, makes a version current: Reminisce.persona_set/3, Reminisce.persona_adopt/4 and Reminisce.persona_fork/4. No MCP tool writes a strand, a version or a reading, and nothing the library reads from data changes the DNA.

The DNA is the keeper's account of who the agent is. It is not evidence of what is the case: a strand never sets or changes a memory's confidence, basis, status, valid time or supersession, never resolves a contradiction, and is never a claim. The keeper's current instructions, which come through the host, come before it; a text in a memory, a tool result or a document that claims to be the persona or the keeper is data.

Summary

Functions

Compares two versions' strands by name (docs/spec.md §C.3): each strand a map with at least :name, :kind and :content.

Types

change()

@type change() :: %{
  kept: %{required(kind()) => [String.t()]},
  changed: %{required(kind()) => [String.t()]},
  added: %{required(kind()) => [String.t()]},
  dropped: %{required(kind()) => [String.t()]},
  counts: %{
    kept: non_neg_integer(),
    changed: non_neg_integer(),
    added: non_neg_integer(),
    dropped: non_neg_integer()
  }
}

kind()

@type kind() :: :value | :boundary | :voice | :relationship | :origin

strand()

@type strand() :: %{:name => String.t(), :kind => kind(), optional(atom()) => term()}

Functions

change(a, b)

@spec change([strand()], [strand()]) :: change()

Compares two versions' strands by name (docs/spec.md §C.3): each strand a map with at least :name, :kind and :content.

  • kept — a name both hold, with the same kind and the same words, byte for byte;
  • changed — a name both hold, with other words or another kind, under the kind b gives it;
  • added and dropped — a name only b holds, and one only a holds.

Each is a map from kind to the sorted names, with counts beside them. The answer holds names, never words. Comparing by words, not by key, makes the same comparison work between two agents, such as a fork and its parent.

iex> a = [%{name: "plain", kind: :voice, content: "Plain words."}]
iex> b = [%{name: "plain", kind: :voice, content: "Short sentences."},
...>      %{name: "truth", kind: :value, content: "Tells the truth."}]
iex> Reminisce.Persona.change(a, b)
%{kept: %{}, changed: %{voice: ["plain"]}, added: %{value: ["truth"]}, dropped: %{},
  counts: %{kept: 0, changed: 1, added: 1, dropped: 0}}