5.11 The reinforce tool

Records feedback on which recalled memories were useful, so the store learns to rank genuinely helpful facts higher over time. This is the crux of OwnSona’s learning behaviour: it adjusts a per-memory salience weight that recall multiplies into its ranking. It never edits a memory’s text and never deletes anything, so it is exempt from the keep='Y' lock (like confirm).

There is no time-based decay: a memory is never demoted merely for being old. Salience moves only on an explicit reinforce (or a confirm, which counts as positive feedback).

5.11.1 Inputs

memory_ids

Required array of integers. The ids that helped (or hurt) — typically ids returned by recall / search_memory.

delta

Number, −1.0–1.0. Optional, default +1. Positive means the memory was helpful (rank it higher); negative means it was unhelpful or wrong (rank it lower).

query

Optional string. The question or topic these memories helped answer — ideally the same query you passed to recall. With positive feedback, OwnSona moves each memory’s learned context centroid toward this query’s embedding, so similar future queries surface these memories first — contextual ranking, beyond the single global salience weight. Ignored for negative feedback.

5.11.2 Output

{
  "ok": true,
  "reinforced": [
    { "id": 17, "salience": 0.775, "use_count": 3, "context_count": 1 }
  ],
  "skipped": [ 99 ],
  "message": "Ok"
}

reinforced lists the active rows that were updated; skipped (present only when non-empty) lists requested ids that were unknown or already soft-deleted. Duplicate ids are collapsed.

5.11.3 Errors

INVALID_INPUT (empty memory_ids, out-of-range delta), LIMIT_EXCEEDED, DATABASE_ERROR.