WorkingMemory class

A fixed-size, time-limited short-term memory buffer.

Items are stored in a circular queue. The oldest item is displaced when capacity is exceeded. Items also expire after maxItemAge.

Constructors

WorkingMemory({int capacity = 4, Duration maxItemAge = const Duration(minutes: 5), ConsciousnessLogger? logger})

Properties

capacity → int
final
hashCode → int
The hash code for this object.
no setterinherited
isEmpty → bool
True when working memory is empty.
no setter
isFull → bool
True when working memory is full.
no setter
maxItemAge → Duration
final
oldestItemAge → Duration
Returns how long the oldest item has been in working memory.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
size → int
Number of items currently in working memory.
no setter

Methods

clear() → void
Clears all working memory items.
getAll() → List<Memory>
Returns all current items in recency order (most recent first).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
peek() → Memory?
Returns the most recently added Memory, or null if empty.
pop() → Memory?
Removes and returns the most recently added Memory (LIFO pop).
push(Memory memory) → void
Pushes a memory into the buffer.
rehearse(String memoryId) → void
"Rehearses" a memory, resetting its age timer (preventing decay).
remove(String memoryId) → void
Removes a specific item from working memory.
Searches working memory for items containing query tokens.
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited