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

Where memories live: a TypeDB connection, a database, and the hooks.

    store = Reminisce.Store.new(TypeDB, "memory", policy: MyApp.MemoryPolicy)

Options:

  * `:policy` — a `Reminisce.Policy` module, run after the built-in secret
    guard before every write. Default `Reminisce.Policy.Allow`.
  * `:analyser` — a `Reminisce.Analyser` module. Default
    `Reminisce.Analyser.Default` (English and Russian).
  * `:aspects` — the aspects a memory may carry: a non-empty list of atoms,
    each a lower-case name (a letter, then letters, digits or `_`). Default
    `[:episodic, :semantic, :procedural, :autobiographical, :prospective]`.
    Anything else raises `ArgumentError`.
  * `:review_aspects` — aspects that require `reviewed_by` on write.
    Default `[]`.
  * `:page_size` — how many memories each fetch reads as recall, `as_of`
    and `consolidate` walk every memory of an owner (in one read
    transaction). 1 to 2,000; default 2,000. It bounds how many whole
    memories are held at once, not what is seen. What else is held grows
    with the owner: every walk first reads the owner's keys; recall keeps a
    key and its matching terms for each memory that matches the query;
    `consolidate` keeps a key and a number per memory; `as_of` returns every
    memory it finds.
  * `:decay` — `[tau_days: %{aspect => days}, default_tau_days: n, floor: f,
    inactive_below: f, exempt_aspects: [aspect]]` for
    `Reminisce.consolidate/3`; see `Reminisce.Decay`. `:exempt_aspects` must
    be aspects the store knows.
  * `:clock` — a zero-arity function returning the current `DateTime`.
    Default `DateTime.utc_now/0`. Tests fix it.
  * `:withdraw_batch` — memories redacted per transaction by
    `Reminisce.withdraw/4`. Default 500.
  * `:withdraw_keep` — attribute types, by label, that a withdrawal leaves on
    a memory besides the library's bookkeeping: identifiers the host's
    schema gives `memory`, such as a tenant id, never words. Default `[]`:
    a withdrawal deletes every attribute the host defined on `memory`. An
    attribute the host made required (`@card(1..)`) must be named here, or
    no withdrawal of a memory that has it can complete: deleting it fails
    the batch's commit, and `withdraw/4` answers
    `{:error, {:withdrawal_incomplete, _}}` with the words still there.
    `content`, `facet`, `cue`, `valence`, `arousal`, `felt_by`,
    `unslowed_salience`, `strand_kind` and `strand_name` cannot be named.
  * `:intentions` — `[due_bases: [basis]]`: the bases an intention may be
    due with (docs/spec.md §A.2). Default
    `[due_bases: [:told, :inferred, :generated]]`: an intention
    written from data, `:observed`, is found by its words and never pushed
    in `due` until the host lists that basis.
  * `:affect` — how affects (docs/spec.md Appendix B) weigh, fade and are
    kept, `[recall_weight:, decay_slowing:, appraise_subjects:,
    observed_cap:, subject_retention_days:]`:
    * `:recall_weight` — 0 to 500, default 250: an affect at full weight
      multiplies a score by `(1000 + w) / 1000` at most;
    * `:decay_slowing` — 0 to 1, default 1: an owner's own unscoped affect
      at full weight lengthens its memory's time constant by that much;
    * `:appraise_subjects` — default `false`: a `:generated` affect held by
      a subject, a model's reading of a person, is refused unless it is
      `true`, and `true` needs a `:subject_retention_days`;
    * `:observed_cap` — 0 to 1,000, default 250: the most an affect that
      rests on outside text (an `:observed` object or ground, or sources)
      weighs;
    * `:subject_retention_days` — a positive integer, or `nil` (the
      default) to keep affects about a person until they are withdrawn:
      `Reminisce.consolidate/3` erases those recorded more days than that
      before its interval end.

    Anything else raises `ArgumentError`. `:affective` is the library's own
    aspect, for affects, and cannot be one of `:aspects`.
  * `:persona` — how the persona DNA (docs/spec.md Appendix C) weighs and
    is bounded, `[recall_weight:, max_changed:, drift_alert:, drift_min:]`:
    * `:recall_weight` — 0 to 250, default 100: a memory a strand of the
      current version rests on, scored by a term of the query, has its
      score multiplied by `(1000 + w) / 1000`;
    * `:max_changed` — 1 to 16, default 2: how many strands one proposal
      may add, change or drop;
    * `:drift_alert` — 0 to 1,000, default 300: the share of departing
      readings, in thousandths, at which `Reminisce.persona_drift/3` names a
      strand in `alerts`;
    * `:drift_min` — a positive integer, default 5: how many readings the
      latest window needs before it can alert.

    Anything else raises `ArgumentError`. `:persona` is the library's own
    aspect, for the DNA's strands, and cannot be one of `:aspects`.

# `t`

```elixir
@type t() :: %Reminisce.Store{
  affect: keyword(),
  analyser: module(),
  aspects: [atom()],
  clock: (-&gt; DateTime.t()) | nil,
  conn: GenServer.server(),
  database: String.t(),
  decay: keyword(),
  intentions: [{:due_bases, [atom()]}],
  page_size: pos_integer(),
  persona: keyword(),
  policy: module(),
  review_aspects: [atom()],
  withdraw_batch: pos_integer(),
  withdraw_keep: [String.t()]
}
```

# `new`

```elixir
@spec new(GenServer.server(), String.t(), keyword()) :: t()
```

Builds a store over a running `TypeDB` connection.

---

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