← Back to PRs

#21855: feat: add memory-bank skill — persistent file-based context

by winstonkoh87 open 2026-02-20 13:21 View on GitHub →
size: S
## Summary Adds a new skill (`skills/memory-bank/`) that provides **persistent, file-based agent context** that survives compaction, restarts, and OOM-kills. ## Problem Agent context is ephemeral. Compaction, restarts, and OOM-kills discard accumulated knowledge. Users are forced to repeat preferences and decisions every new session. Several open issues describe this root cause: - #21850 — Session continuity breaks after restart - #21821 — Compaction destroys needed context - #21818 — Post-compaction hook needed - #21802 — No shared bootstrap workspace ## Solution A `memory_bank/` directory convention with structured markdown files: ``` ~/.openclaw/agents/<agentId>/memory_bank/ ├── activeContext.md # Current focus — updated every session ├── userContext.md # Persistent user profile ├── productContext.md # Agent purpose & config └── systemPatterns.md # Learned decisions ``` - **Read on boot**: Agent loads memory bank into system context (<2K tokens) - **Write on close**: Agent appends key insights to `activeContext.md` - **Never compacted**: Files exist outside message history - **Zero dependencies**: Plain markdown, no database required ## Prior Art This pattern has been running in production for 3+ months in [Project Athena](https://github.com/winstonkoh87/Athena-Public). Docs: [MEMORY_BANK.md](https://github.com/winstonkoh87/Athena-Public/blob/main/docs/MEMORY_BANK.md). ## Changes - `skills/memory-bank/SKILL.md` — Full skill doc with setup, commands, and design rationale Closes #21853 <!-- greptile_comment --> <h3>Greptile Summary</h3> Adds documentation-only skill for persistent file-based context using a `memory_bank/` directory pattern. The skill conflicts with OpenClaw's existing memory system in multiple ways: - Proposes `~/.openclaw/agents/<agentId>/memory_bank/` with files like `activeContext.md` and `systemPatterns.md`, while OpenClaw already uses `~/.openclaw/workspace/memory/YYYY-MM-DD.md` and `MEMORY.md` - Suggests manual system prompt instructions for read-on-boot/write-on-close, but OpenClaw already has automatic pre-compaction memory flush (`agents.defaults.compaction.memoryFlush`) - Creates parallel memory storage locations and potentially confusing user experience about which system to use - Uses bash `cat`/heredoc patterns instead of OpenClaw's dedicated file tools This appears to be porting a pattern from another project (Athena) without adapting it to OpenClaw's existing architecture. Would need significant revision to either replace the current memory system or integrate with it rather than run parallel to it. <h3>Confidence Score: 1/5</h3> - This PR creates architectural conflicts with the existing memory system and should not be merged as-is - Multiple logical conflicts with existing OpenClaw memory infrastructure. The proposed `memory_bank/` pattern duplicates functionality already provided by the workspace memory system (`memory/YYYY-MM-DD.md`, `MEMORY.md`) and pre-compaction memory flush. Merging would create confusion about which memory system to use and potentially break existing workflows. - skills/memory-bank/SKILL.md requires fundamental redesign to either integrate with or replace (not duplicate) the existing memory system <sub>Last reviewed commit: ddde71c</sub> <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs