Skip to main content

Interface: SessionSelfChange<T>

Defined in: packages/agentos/src/cognition/learning/types.ts:207

A memory write a learner session records (memory_write): the write itself, and how to take it back.

Type Parameters​

T​

T = unknown

Properties​

actor​

actor: string

Defined in: packages/agentos/src/cognition/learning/types.ts:210

tool:memory_add, memory:rolling_summary.


after​

after: Omit<MemoryWriteChange, "brainId">

Defined in: packages/agentos/src/cognition/learning/types.ts:216

What the write sets; the layer adds brainId.


before​

before: MemoryWriteBefore | null

Defined in: packages/agentos/src/cognition/learning/types.ts:214

What the write replaces: the snapshots of the traces it changes or deletes; null for a write that only adds.


brainId​

brainId: string

Defined in: packages/agentos/src/cognition/learning/types.ts:218

The brain the write goes to (Memory.brainId).


contributorIds?​

optional contributorIds: readonly string[]

Defined in: packages/agentos/src/cognition/learning/types.ts:242

The users whose words the write files besides the turn's own: a rolling summary's contributors. Before the write runs, the session notes each one's session row (the learner's for the session's learner, a visitor's for anyone else) with the write's brain and conversation, so forgetUser for any of them finds the session, whether or not they wrote there themselves. An anonymous id names no one; a contributor already forgotten gets no row, and the write goes ahead, since the conversation's own history, which forgetUser does not reach, still holds their words.


kind​

kind: "memory_write"

Defined in: packages/agentos/src/cognition/learning/types.ts:208


subject​

subject: string

Defined in: packages/agentos/src/cognition/learning/types.ts:212

The trace id the write touches, or the id of the set it writes.

Methods​

apply()​

apply(): Promise<T>

Defined in: packages/agentos/src/cognition/learning/types.ts:220

Makes the write; resolves once it has committed.

Returns​

Promise<T>


keptAfter()?​

optional keptAfter(result): Omit<MemoryWriteChange, "brainId">

Defined in: packages/agentos/src/cognition/learning/types.ts:234

What the write did once it committed, where that can differ from what it named before it ran: a write of several traces that resolved some of them to traces their scope already held, or forgot fewer than it meant to. Its kept verdict records this, and a revert takes back this, not the plan; without it the candidate's after stands for both.

Parameters​

result​

T

Returns​

Omit<MemoryWriteChange, "brainId">


undo()​

undo(result, reason): Promise<void>

Defined in: packages/agentos/src/cognition/learning/types.ts:227

Takes back what apply wrote. forgotten: the write's user was forgotten once it had committed, so every trace it created, changed or deleted is deleted for good and nothing is restored (a restore would bring back words the deletion removed). unrecorded: its verdict could not be written, or the tombstone could not be read again, so the traces it created are deleted and the ones it changed or deleted come back to their before-state.

Parameters​

result​

T

reason​

"forgotten" | "unrecorded"

Returns​

Promise<void>