Bridges file-based memory into OpenClaw agent context. Install and go, with conservative defaults to avoid prompt bloat.
User sends message
│
▼
┌───────────────────┐ ┌──────────────────────────┐
│ before_prompt_build│────▶│ Read SESSION-STATE.md │
│ │ │ Read LESSONS.md (high/crit) │
│ │ │ Truncate to safe limits │
│ │ │ Inject into agent context │
└───────────────────┘ └──────────────────────────┘
│
▼
Agent runs...
│
▼
┌───────────────────┐ ┌──────────────────────────┐
│ agent_end │────▶│ Append run summary to │
│ │ │ memory/YYYY-MM-DD.md │
└───────────────────┘ └──────────────────────────┘
User runs /new
│
▼
┌───────────────────┐ ┌──────────────────────────┐
│ command:new │────▶│ Ensure today's daily log │
│ │ │ memory/YYYY-MM-DD.md │
└───────────────────┘ └──────────────────────────┘
Gateway starts / every day 00:15 UTC
│
▼
┌───────────────────┐ ┌──────────────────────────┐
│ Auto Janitor │────▶│ Archive expired P1/P2 │
│ │ │ from MEMORY.md │
│ │ │ Ensure daily log exists │
└───────────────────┘ └──────────────────────────┘
~/.openclaw/workspace/
├── MEMORY.md ◀── Curated long-term memory
│ P0 = permanent
│ P1 = 90-day TTL
│ P2 = 30-day TTL
│
├── SESSION-STATE.md ◀── Injected every turn
│ Current Focus / Next Step / Blockers
│
├── LESSONS.md ◀── high/critical injected to system prompt
│ - [date][severity][category] text
│
└── memory/
├── YYYY-MM-DD.md ◀── Auto-created & appended by plugin
└── archive/ ◀── Expired entries moved here by janitor
openclaw plugins install @darinrowe/openclaw-memory-bridge
openclaw gateway restartOr link locally:
git clone https://github.com/DarinRowe/openclaw-memory-bridge
openclaw plugins install -l ./openclaw-memory-bridge
openclaw gateway restartAll features are on by default. Turn off what you don't need:
{
"plugins": {
"entries": {
"memory-bridge": {
"config": {
"workspace": "~/.openclaw/workspace",
"injectSessionState": true,
"injectHighRiskLessons": true,
"autoDailyLog": true,
"maxSessionStateChars": 4000,
"maxHighRiskLessons": 5,
"maxLessonChars": 1200
}
}
}
}
}Notes:
workspaceoverrides the OpenClaw workspace path for this plugin only.maxSessionStateCharscaps the injectedSESSION-STATE.mdblock per turn.maxHighRiskLessonslimits how manyhigh/criticallessons are injected.maxLessonCharscaps the total injected lessons block per turn.- If a block exceeds its limit, the plugin truncates it and appends
[truncated].
Use standalone or let the plugin call them automatically.
# Add a lesson
python3 scripts/add_lesson.py --category devops --severity high "always backup before upgrade"
# Search lessons
python3 scripts/search_lessons.py "backup"
# Sort/dedupe lessons
# Date desc, severity critical first
python3 scripts/render_lessons_md.py
# Update session state
python3 scripts/update_session_state.py --focus "deploy v2" --next "run tests"
# Create today's log
bash scripts/daily_log.sh
# Run cleanup manually
python3 scripts/memory_janitor.py --dry-run
# Run the plugin smoke test
npm run smokeScripts use $OPENCLAW_WORKSPACE when set. Otherwise they fall back to the plugin's local workspace root, which is useful for local development and smoke tests.
MIT