Skip to content

Memory server changes are not persisted to disk #7

@timothywarner

Description

@timothywarner

Problem

Currently, all CRUD operations (add_memory, update_memory, delete_memory) only modify the in-memory _memory_store but never write back to DATA_FILE. This means:

  • Memories created during runtime are lost on server restart
  • Updates and deletions are not preserved
  • The JSON file becomes stale

Solution

Implement a save_memory_data() function that:

  1. Writes memory items back to the JSON file after each modification
  2. Uses atomic writes (temp file + rename) to prevent corruption
  3. Preserves existing tags, types, and metadata from the original JSON structure
  4. Ensures the data directory exists before writing

Acceptance Criteria

  • add_memory persists new memories to disk
  • update_memory persists changes to disk
  • delete_memory persists deletions to disk
  • File writes are atomic (no partial writes on failure)
  • Original JSON structure (tags, types, metadata) is preserved

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions