- Update workspace state timestamp - Add weekly summary to MEMORY.md (removing duplicate entry)
47 lines
1.9 KiB
Markdown
47 lines
1.9 KiB
Markdown
# Memory Manager Workflow
|
|
|
|
This document describes the detailed workflow of the memory-manager skill.
|
|
|
|
## Weekly Consolidation Process
|
|
|
|
1. **Identify week range**: By default, the previous Sunday-Saturday week is selected. Can override with `--week-start`.
|
|
2. **Scan daily files**: All `memory/YYYY-MM-DD.md` files within the week are read.
|
|
3. **Extract insights**: Using pattern matching on bullet points and decision markers.
|
|
4. **Append to MEMORY.md**: A new section with bullet points is added. If MEMORY.md doesn't exist, it's created with a header.
|
|
5. **Log results**: Number of insights and files processed are logged.
|
|
|
|
## Archival Process
|
|
|
|
1. **Find old files**: Daily files older than `MAX_AGE_DAYS` (default 30) are identified.
|
|
2. **Compress**: Each file is gzip-compressed into `memory/archive/YYYY-MM-DD.md.gz`.
|
|
3. **Remove originals**: Original .md files are deleted after successful compression.
|
|
4. **Log count**: Total archived files are reported.
|
|
|
|
## Safety Features
|
|
|
|
- **Dry-run mode**: Uses `--dry-run` to preview changes without modifying anything.
|
|
- **Confirmation**: By default, prompts before large operations (can be skipped with `--force`).
|
|
- **Error handling**: Failed reads/writes are logged but don't stop the whole process.
|
|
- **Atomic writes**: Each file operation is independent; partial failures leave existing data intact.
|
|
|
|
## Logging
|
|
|
|
All actions are logged at INFO level. Use standard logging configuration to adjust verbosity or output destination.
|
|
|
|
## Scheduling
|
|
|
|
Recommended: Weekly at 3 AM Sunday via cron:
|
|
|
|
```bash
|
|
0 3 * * 0 /usr/local/bin/aitbc systemEvent "Run memory-manager weekly consolidation"
|
|
```
|
|
|
|
Or via OpenClaw cron API:
|
|
|
|
```bash
|
|
openclaw cron add \
|
|
--name "memory-manager-weekly" \
|
|
--schedule '{"kind":"cron","expr":"0 3 * * 0","tz":"UTC"}' \
|
|
--payload '{"kind":"systemEvent","text":"Run memory-manager weekly consolidation"}' \
|
|
--sessionTarget main
|
|
``` |