# `Reminisce.Persona`
[🔗](https://github.com/NoeticEcho/reminisce-elixir/blob/v0.6.0/lib/reminisce/persona.ex#L4)

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.

# `change`

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

# `kind`

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

# `strand`

```elixir
@type strand() :: %{:name =&gt; String.t(), :kind =&gt; kind(), optional(atom()) =&gt; term()}
```

# `change`

```elixir
@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}}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
