pr_01m47d24b0e6n91zwymwxg0vpx/services/work/migrations/0019_memory_capture.sql
| 1 | -- Memory that fills itself: what agents report learning at the end of a |
| 2 | -- run, corrections people make in review, decisions summed up on merge and |
| 3 | -- what a project's own docs say arrive as candidates. A candidate is given |
| 4 | -- to no agent until it is kept: by a person in the Review queue, or by g1t |
| 5 | -- when two independent sources say the same thing, or a doc says it with |
| 6 | -- high confidence. Everything kept before this change stays kept. |
| 7 | |
| 8 | -- candidate, kept or dismissed. |
| 9 | ALTER TABLE memories ADD COLUMN status TEXT NOT NULL DEFAULT 'kept'; |
| 10 | -- 0 to 1: how sure the source was. Null for what people wrote. |
| 11 | ALTER TABLE memories ADD COLUMN confidence REAL; |
| 12 | -- What it came from, beside source_kind (person, agent, run, review, pr, |
| 13 | -- doc): "run:<id>", "comment:<id>", "pull:<repo id>#<n>", "doc:<path>". |
| 14 | ALTER TABLE memories ADD COLUMN source_ref TEXT; |
| 15 | -- What it was learned from, quoted: a line of a doc, a review comment. |
| 16 | ALTER TABLE memories ADD COLUMN evidence TEXT; |
| 17 | -- The text folded to compare candidates: lowercase words only. |
| 18 | ALTER TABLE memories ADD COLUMN fingerprint TEXT; |
| 19 | -- JSON array of the distinct source_refs that said it. |
| 20 | ALTER TABLE memories ADD COLUMN sources TEXT NOT NULL DEFAULT '[]'; |
| 21 | -- Who kept or dismissed it, and when. |
| 22 | ALTER TABLE memories ADD COLUMN reviewed_by TEXT; |
| 23 | ALTER TABLE memories ADD COLUMN reviewed_at TEXT; |
| 24 | |
| 25 | CREATE INDEX memories_by_status ON memories (workspace, status, updated_at); |
| 26 | CREATE INDEX memories_by_fingerprint ON memories (scope, scope_key, fingerprint); |