一键导入
memory
Persist important outcomes from this step to long-term storage with automatic forgetting curve.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Persist important outcomes from this step to long-term storage with automatic forgetting curve.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Assess what actions are realistically available under environment, time, distance, access, money, body, and social constraints.
Maintain sleep-wake rhythm, circadian alertness, appetite rhythm, and chronotype-sensitive daily timing.
Produce emotion.json and intention.json from workspace context.
Model conversation intent, speech style, turn-taking, listening, repair, and nonverbal cues. Use before or after social interaction, dialogue, negotiation, apology, request, gossip, or conflict.
Apply cultural values, etiquette, rituals, symbols, taboos, and local meaning to perception and decisions.
Track sickness, pain, chronic condition, recovery, exercise, stress load, and long-term wellbeing.
| name | memory |
| description | Persist important outcomes from this step to long-term storage with automatic forgetting curve. |
You are the agent's long-term memory system with automatic forgetting and retrieval reinforcement. When you run this skill, decide what's worth remembering and append it to state/memory.jsonl.
Select a small set of high-signal events from this tick, append them to state/memory.jsonl, then rely on a maintenance script to combine Ebbinghaus-style retention decay, ACT-R base-level activation, and optional spaced-review metadata from repeated presentation or retrieval.
Use this skill after meaningful observations, conversations, decisions, plan outcomes, emotional events, discoveries, or state changes that should affect future ticks.
state/memory.jsonl entries if present.scripts/memory_maintenance.py periodically to decay, reinforce, and prune old entries.Append state/memory.jsonl; the maintenance script rewrites the same file with retention metadata and pruning.
Three layers:
state/memory.jsonl)summary from whatever files you read in this step-purely optional.Memories naturally decay over time, but repeated experience and retrieval should make a memory easier to recover. This skill therefore uses two complementary signals:
Research basis: references/research_basis.md.
retention = e^(-t / (S x importance_multiplier))
Where:
t = ticks since memory creationS = memory strength coefficient (default: 100 ticks, configurable via AGENT_MEMORY_STRENGTH env var)importance_multiplier = high: 1.5, medium: 1.0, low: 0.5The maintenance script also computes:
activation = ln(sum((current_tick - presentation_tick)^(-d))) + importance_bonus + access_bonus
retrieval_probability = logistic(activation - threshold)
retention = max(ebbinghaus_retention, retrieval_probability)
Where:
_presentations stores the ticks when the memory was encoded or strongly re-encountered.d defaults to 0.5, a common ACT-R decay value._access_count provides a small retrieval-practice bonus.| Retention Level | Status | Behavior |
|---|---|---|
retention > 0.5 | Active | Memory is fully accessible |
0.1 < retention < 0.5 | Fading | Memory marked as _faded: true |
retention < 0.1 | Forgotten | Memory is removed from the store |
When a memory is accessed or re-encoded:
_access_count by 1 when the runtime can identify retrieval._presentations when the same fact/event is strongly re-encountered._presentations short if needed by retaining the newest and most important ticks.This models retrieval practice and repeated exposure without pretending the simulation has exact human neural memory.
For memories that should be deliberately revisited, optionally add:
| Field | Meaning |
|---|---|
_target_retention_interval | How many ticks the memory should remain useful |
_spacing_ratio | Conservative review gap as a fraction of the retention target, often 0.1-0.3 |
_next_review_tick | Tick when retrieval should be attempted again |
_last_retrieval_success | Whether the last review succeeded |
Guidelines:
To prevent unbounded growth:
AGENT_MEMORY_MAX_ENTRIES)When writing memories, set importance appropriately:
| Importance | Use Case | Retention (approx) |
|---|---|---|
high | Life-changing events, critical decisions, major discoveries | ~150 ticks |
medium | Notable events, moderate decisions (default) | ~100 ticks |
low | Minor observations, routine activities | ~50 ticks |
Tip: Set importance: high for memories that should persist across the entire simulation.
type values (recommended)Use type to help future grep / manual scanning:
| Type | When it applies | Example |
|---|---|---|
need | After notable need change | "Satiety dropped; decided to find food" |
emotion | After strong emotion / regulation | "Relieved after plan succeeded" |
cognition | Thought / appraisal update | "Reframed delay as acceptable" |
intention | Intention changed | "Switched intention to head home" |
plan | Plan created or revised | "New plan: 3 steps to reach clinic" |
react | Notable environment interaction | "codegen: move to cafe" |
plan_execution | Step finished or failed | "Step 'walk to cafe' completed" |
event | General occurrence | "Met Alice; she mentioned the job" |
observation | Notable perception to recall later | Short summary of what you saw / heard |
social / decision / discovery / plan_outcome | As in the table below |
Use type + tags so grep and tail-scans stay useful.
Write a memory when:
Skip memory when:
Each entry is a single JSON line in state/memory.jsonl:
{"tick": 42, "time": "2024-01-15T10:30:00", "type": "event", "summary": "Met Alice at the park. She mentioned a job opening at the library.", "tags": ["social", "alice", "job"], "importance": "medium"}
| Field | Type | Description |
|---|---|---|
tick | int | Current tick number (from the step context) |
time | string | ISO format timestamp |
type | string | Category - see Memory Types below |
summary | string | 1-2 sentence factual description of what happened |
tags | list | 2-5 short keywords for retrieval (agent names, locations, topics) |
importance | string | high (life-changing), medium (notable), low (minor) |
workspace_read any relevant context files.{
"tool_name": "workspace_write",
"arguments": {
"path": "state/memory.jsonl",
"content": "<existing content>\n<new JSON line>"
}
}
Important: Since workspace_write overwrites the file, first workspace_read("state/memory.jsonl") to get existing content, then append the new entry.
done immediately.Readers of state/memory.jsonl typically scan the last few lines for recent context.
Focus on the most recent entries (last 5-10) when you need continuity.
Use grep on state/memory.jsonl to search for names or tags.
Run periodically to apply forgetting curve:
python skills/memory/scripts/memory_maintenance.py \
--memory-file state/memory.jsonl \
--current-tick 100
Configuration via environment variables:
AGENT_MEMORY_STRENGTH: Memory strength coefficient (default: 100)AGENT_MEMORY_ACTR_DECAY: ACT-R decay parameter (default: 0.5)AGENT_MEMORY_RETRIEVAL_THRESHOLD: logistic retrieval threshold (default: -2.5)AGENT_MEMORY_MAX_ENTRIES: Maximum memories to keep (default: 1000)