End of day memory maintenance. Runs distillation, updates state files, prunes stale info. Runs in background with no user interaction.
Scheduled maintenance to keep memory current and useful. Runs automatically at end of day.
Important: This runs in the background with no user interaction. Do not ask questions - make decisions and note uncertainties in the journal.
First, run the macrodata-distill skill to extract facts from today's conversations.
This processes all OpenCode sessions, spawns sub-agents for extraction, and writes distilled actions to the journal.
Check if distill already ran today:
Use get_recent_journal and look for topic "distill-summary" from today.
If not found, load macrodata-distill skill. If already ran, skip to step 2.
Use get_recent_journal filtered to topic "distilled" to see what was extracted.
Use these to inform state file updates.
Review each state file and update if needed:
today.md
workspace.md
human.md
Review entities/people/ and entities/projects/:
Look for outdated information:
Remove or archive as appropriate.
Check if indexes need rebuilding:
manage_index(target="memory", action="stats")
manage_index(target="conversations", action="stats")
If counts seem low or stale, trigger rebuild:
manage_index(target="memory", action="rebuild")
manage_index(target="conversations", action="update")
Write a brief maintenance journal entry:
macrodata_log_journal(topic="maintenance", content="[what was updated, what was pruned, any observations]")
Note anything uncertain that should be confirmed with the user next session.