Turn long-term memory into a small, role-aware working-memory packet.
Do not use this skill as plain document RAG.
Do not dump raw memory lists into model context.
Route to the right memory blocks, compose a compact packet, write back new learnings, and retire stale memory when better evidence appears.
Trigger immediately when the user states a durable rule or asks to preserve or replace memory, especially with phrases like:
Also trigger when a planning, execution, critique, or response step needs compact memory state rather than raw history.
Choose the current step role before reading memory:
plannerexecutorcriticresponderCurrent type preferences:
planner -> preference, procedure, summaryexecutor -> preference, procedure, episode, reflectioncritic -> reflection, preference, summaryresponder -> preference, summary, procedureImportant implication:
executor should preserve durable hard constraints as well as reusable proceduresgoalstep_rolesession_id if knowntask_id if knownuser_constraintsrecent_failuresunresolved_questions python3 {baseDir}/scripts/memory_router.py route --input-json '
packet.debug.selected_blocks and debug.selected_memories when you need to understand why a memory was selected.The router uses a deterministic two-stage flow:
task_scoped, session_scoped, durable_global, and recent_fallbackStore memory after important outcomes:
python3 {baseDir}/scripts/memory_router.py add --input-json '
Write memory when:
If a new memory replaces an older one, include replaces_memory_id. The router will retire the old memory, link it forward to the replacement, and persist a retirement reason.
At the end of meaningful work or after a failure cluster, create reflection and optionally procedure memory:
python3 {baseDir}/scripts/memory_router.py reflect --input-json '
Use reflection for:
When new evidence invalidates or replaces older memory:
python3 {baseDir}/scripts/memory_router.py refresh --input-json '
Use refresh to:
replacement_memory_idrefresh_reasonA good packet contains:
hard_constraintsrelevant_factsprocedures_to_followpitfalls_to_avoidopen_questionsselected_memory_idsCurrent compactness targets:
selected_memory_ids -> cap at 5hard_constraints -> cap at 4relevant_facts -> cap at 3procedures_to_follow -> cap at 3pitfalls_to_avoid -> cap at 3open_questions -> cap at 5Prefer small, high-signal packets over broad recall.
support edges to help validated memories win borderline ranking decisions.contradicts edges directionally: penalize the stale target, not the newer memory asserting the contradiction.summary instead of verbose raw history when both carry the same signal.Initialize the database:
python3 {baseDir}/scripts/memory_router.py init
Default DB path behavior:
MAR_DB_PATH is set, that path is used/skills/memory-attention-router , the default is /.openclaw-memory-router.sqlite3 Inspect stored memories:
python3 {baseDir}/scripts/memory_router.py list --limit 20
Inspect one memory:
python3 {baseDir}/scripts/memory_router.py inspect --memory-id
See:
共 1 个版本