Skip to content

[Bug]: session-memory hook writes files the boot sequence never reads #3

@kamikariat

Description

@kamikariat

Upstream: openclaw#45607

Summary

The session-memory hook writes to memory/YYYY-MM-DD-slug.md, but the boot sequence reads memory/YYYY-MM-DD.md. The hook's output is invisible to the agent on startup unless memory_search is working.

Root cause

Two systems built independently with no naming contract:

System Writes to Reads from
Pre-compaction flush memory/YYYY-MM-DD.md (canonical)
session-memory hook memory/YYYY-MM-DD-slug.md (slugged)
Boot sequence (AGENTS.md) memory/YYYY-MM-DD.md (canonical)
memory_search All memory/*.md (indexed)

The pre-compaction flush gets this right — it explicitly bans slugged filenames (src/auto-reply/reply/memory-flush.ts:21).

Impact

  • Every /new, /reset, and daily reset (at least once per day per user)
  • Silent data loss — no error, users believe memory is preserved
  • Only discoverable if memory_search is unavailable and you check the filesystem

Fix options

  1. Change hook to append to memory/YYYY-MM-DD.md (canonical). Simplest, aligns with pre-compaction flush.
  2. Change boot sequence to glob memory/YYYY-MM-DD*.md. More permissive.
  3. Both: canonical for boot visibility, slugged as audit artifact.

Code references

  • Hook writes slug: src/hooks/bundled/session-memory/handler.ts:315
  • Boot reads canonical: workspace AGENTS.md:15
  • Pre-compaction bans slugs: src/auto-reply/reply/memory-flush.ts:21

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions