memory-engine
Cognitive control memory system based on "On Task" by David Badre. Handles input gating, output gating, hierarchical memory, and procedural runbooks.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Cognitive control memory system based on "On Task" by David Badre. Handles input gating, output gating, hierarchical memory, and procedural runbooks.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Multi-layered security system protecting against prompt injection, secret extraction, and malicious content. Based on defense-in-depth principles.
Manage Facebook Pages and Instagram Business via Meta Graph API. Post content (text, photos, videos, reels), list posts, manage comments. Use for social media publishing.
Microsoft Graph API email access for Microsoft 365 accounts via direct API calls.
Generate and post thought leadership videos using HeyGen and distribute to multiple platforms.
Publish and manage blog posts on WordPress sites via REST API. Supports creating posts, drafts, uploading media, and managing categories/tags.
| name | memory-engine |
| description | Cognitive control memory system based on "On Task" by David Badre. Handles input gating, output gating, hierarchical memory, and procedural runbooks. |
| homepage | https://mitpress.mit.edu/9780262545266/on-task/ |
| version | 2.0.0 |
| metadata | {"openclaw":{"emoji":"🧠"}} |
A cognitive control memory system inspired by David Badre's "On Task" — applying neuroscience principles of gating, hierarchical control, and working memory to agent memory management.
sync - Pulls current cron inventory into active-context.mdstub - Creates today's daily note from templaterefresh - Full refresh (stub + sync + state check)alert - P0/P1/P2 severity-based alerts with exit codes# Copy scripts to your workspace
mkdir -p ~/.openclaw/workspace/memory-engine/scripts
cp memory-engine/scripts/engine.js ~/.openclaw/workspace/memory-engine/scripts/
# Copy templates
cp -r memory-engine/templates/* ~/.openclaw/workspace/memory/
cd ~/.openclaw/workspace
# Full refresh (recommended daily)
node memory-engine/scripts/engine.js refresh
# Check for alerts
node memory-engine/scripts/engine.js alert
# Sync state to active-context.md
node memory-engine/scripts/engine.js sync
# Create today's daily note
node memory-engine/scripts/engine.js stub
# Full audit
node memory-engine/scripts/engine.js audit
# Archive old notes (30+ days)
node memory-engine/scripts/engine.js decay
~/.openclaw/workspace/
├── MEMORY.md # Strategic: Long-term lessons
├── memory/
│ ├── ARCHITECTURE.md # Framework documentation
│ ├── active-context.md # Working memory (ALWAYS READ)
│ ├── decay-policies.md # Content lifecycle rules
│ ├── state-detectors.md # Automated update triggers
│ ├── YYYY-MM-DD.md # Daily notes
│ ├── runbooks/
│ │ ├── README.md # Runbook index
│ │ └── *.md # Procedural runbooks
│ └── archive/ # Archived old notes
├── memory-engine/
│ └── scripts/
│ └── engine.js # Memory engine CLI
| Level | Meaning | Exit Code | Action Required |
|---|---|---|---|
| P0 | CRITICAL | 2 | Fix immediately |
| P1 | WARNING | 1 | Note for attention |
| P2 | INFO | 0 | Informational |
P0 Triggers:
active-context.md missingactive-context.md >48 hours staleP1 Triggers:
active-context.md >24 hours staleP2 Triggers:
MEMORY.md ← Strategic: Identity, relationships, long-term lessons
active-context.md ← Operational: Current projects, deadlines, commitments
YYYY-MM-DD.md ← Tactical: Daily events, raw notes, session logs
Information flows UP through consolidation (daily notes → active context → strategic memory). Information flows DOWN through decomposition (goals → tasks → actions).
□ Read active-context.md (working memory)
□ Check staleness (Last Updated timestamp)
□ If stale (>24h), run `node engine.js refresh`
□ Load relevant runbooks for current task
□ Run `node engine.js sync`
□ Update today's daily note if significant events
□ If new procedure discovered, create runbook
□ If lesson learned, consider promoting to MEMORY.md
When you're a different model than the previous turn:
memory/active-context.md FIRST| Priority | Type | Destination | Example |
|---|---|---|---|
| P0 | Critical | active-context.md | Deadlines, commitments, credentials |
| P1 | Operational | active-context.md | Project state, decisions, configs |
| P2 | Context | YYYY-MM-DD.md | Meeting notes, conversation summaries |
| P3 | Ephemeral | Session only | Debug steps, one-time lookups |
| Policy | Trigger | Action |
|---|---|---|
| GP-001 | After cron create | Verify with cron list, store IDs |
| GP-002 | Config change | Update TOOLS.md immediately |
| GP-004 | Session end | Run node engine.js sync |
| GP-005 | Before cron create | List existing, remove duplicates |
| GP-007 | Model switch | Read active-context.md + runbooks |
| GP-008 | New procedure | Create/update runbook |
| GP-009 | P0 event | Immediately update active-context.md |
| GP-010 | Weekly | Execute decay audit |
Add to your HEARTBEAT.md:
## 🧠 Memory Check (ALWAYS FIRST)
Run memory engine alert check before anything else:
node ~/.openclaw/workspace/memory-engine/scripts/engine.js alert
**If P0 alerts**: Fix immediately before proceeding
**If P1 alerts**: Note for attention, continue
**If no alerts**: Proceed with other checks
{
"name": "Memory Engine - Daily Alert Check",
"schedule": { "kind": "cron", "expr": "0 0 * * *", "tz": "America/New_York" },
"sessionTarget": "isolated",
"payload": {
"kind": "agentTurn",
"message": "Run: node ~/.openclaw/workspace/memory-engine/scripts/engine.js alert\n\nIf P0 alerts, run refresh and notify user.",
"model": "haiku"
}
}
{
"name": "Memory Engine - Weekly Maintenance",
"schedule": { "kind": "cron", "expr": "0 3 * * 6", "tz": "America/New_York" },
"sessionTarget": "isolated",
"payload": {
"kind": "agentTurn",
"message": "Run: node ~/.openclaw/workspace/memory-engine/scripts/engine.js audit\nThen: node engine.js decay\n\nReport results.",
"model": "haiku"
}
}
active-context.md (working memory)TOOLS.md (domain config)memory_searchMEMORY.md (long-term)Never guess when memory is available to check.
| File | Purpose |
|---|---|
templates/ARCHITECTURE.md | Full framework documentation |
templates/active-context.template.md | Working memory template |
templates/MEMORY.template.md | Long-term memory template |
templates/daily-note.template.md | Daily notes template |
templates/decay-policies.md | Content lifecycle rules |
templates/state-detectors.md | Automated update triggers |
scripts/engine.js | Memory engine CLI (v2.0) |
From Badre's "On Task": The brain doesn't just store information — it gates what enters memory, retrieves selectively based on context, and monitors for relevance.
This system applies those principles:
The goal: Never lose operational context, even across model switches or session resets.