Function: correctSubjectMemory()
correctSubjectMemory(
options):Promise<{correctionTraceId:string;deleted:number;pagesDeleted:number; }>
Defined in: packages/agentos/src/cognition/memory/io/userMemoryExport.ts:139
Corrects one subject's memory: each page compiled from a named trace is deleted and built again by the subject's
next compile, from the traces of it that are left and the correction; the corrected statement is filed as a trace
tagged correction; the named traces are deleted for good; and the vector index and the store's write-ahead log
are written out (Memory.finishErasure). A deleted trace cannot come back in a later compile, which is why a
correction deletes instead of editing a page.
The named traces go last, so a correction that failed partway is finished by the same call made again: it still
finds them. An index rewrite or a log checkpoint that fails does not fail the call; one
memory.erasure_unfinished line says so, and the next deletion, sweep or re-application of the tombstones runs it.
Every named id must be one of the subject's own live traces (a page's chunk is not one): when any is another subject's, unknown or already deleted, the call rejects with a count and nothing is changed.
Parameters
options
agentId
string
correction
{ text: string; traceIds: readonly string[]; }
correction.text
string
correction.traceIds
readonly string[]
memory
onChain?
<T>(work) => Promise<T>
Runs the change in the subject's turn, after its writes and compiles. Unset: at once.
subject
wiki
{ storeFor: SubjectPages; }
wiki.storeFor
Returns
Promise<{ correctionTraceId: string; deleted: number; pagesDeleted: number; }>
How many traces and pages it deleted, and the id of the correction's trace.
Throws
TypeError when the subject, the trace ids or the text is missing.
Throws
Error when a named id is not one of the subject's live traces (one memory.write_refused line, reason
foreign_trace), or when the subject is forgotten (reason forgotten): nothing is written for them again.