openclaw/docs/concepts
Nickolai Yegorov d91522d4a6 feat: hierarchical memory structure (YYYY/MM/) with automatic migration
Implement hierarchical memory structure to improve filesystem performance
when dealing with large numbers of memory files.

## Changes

### Core Implementation (src/memory/internal.ts)
- Add isOldMemoryFormat() - detect old flat format files
- Add migrateMemoryFile() - migrate to YYYY/MM/ structure with:
  * Date validation (rejects invalid dates like 2025-99-99)
  * Atomic file creation (wx flag) to prevent race conditions
  * Optional logger parameter for production use
- Add migrateAllMemoryFiles() - bulk migration with:
  * Full recursive scan via findOldFormatFiles()
  * Dry-run mode for preview
  * Detailed metrics (totalBytes, durationMs, file lists)
- Update walkDir() - auto-migrate on file access
- Update listMemoryFiles() - add logger parameter

### Tests (src/memory/internal.test.ts)
- 20 comprehensive unit tests
- Test old-format detection, date validation, race conditions
- Test dry-run mode and detailed metrics
- 100% coverage of key functionality

### Documentation
- docs/concepts/memory-migration.md (NEW) - migration guide
- docs/concepts/memory.md - backward compatibility section
- docs/help/faq.md - migration FAQ entries

## Backward Compatibility
- Automatic migration on file access
- Old files preserved as backup
- Zero breaking changes
- Both formats supported
2026-01-27 23:20:08 +03:00
..
agent-loop.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
agent-workspace.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
agent.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
architecture.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
channel-routing.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
compaction.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
context.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
group-messages.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
groups.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
markdown-formatting.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
memory-migration.md feat: hierarchical memory structure (YYYY/MM/) with automatic migration 2026-01-27 23:20:08 +03:00
memory.md feat: hierarchical memory structure (YYYY/MM/) with automatic migration 2026-01-27 23:20:08 +03:00
messages.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
model-failover.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
model-providers.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
models.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
multi-agent.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
oauth.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
presence.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
queue.md chore: raise default agent concurrency 2026-01-20 10:08:26 +00:00
retry.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
session-pruning.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
session-tool.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
session.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
sessions.md Docs: fix internal links 2026-01-10 14:51:33 -06:00
streaming.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
system-prompt.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
timezone.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
typebox.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
typing-indicators.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
usage-tracking.md refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00