Skip to content

Entity created_at resets on every edit or move #1716

Closed

Description

@phernandez

Found during the v0.24.0 acceptance test.

An entity's created_at is reset to the time of the latest edit or move. markdown/utils.py sets model.created_at = markdown.created, and entity_parser.py takes created from the file's st_ctime. Every atomic write or rename changes the ctime, so after any edit created_at equals updated_at.

Repro: write a note, edit it a minute later, then compare entity.created_at with the original write time, or look at tail / recent_activity output.

Expected: created_at stays the time the note was first created. It should keep the existing row's value on update, and use frontmatter created when the note has one.

Activity

  1. added this to the v0.24.x milestone on Oct 10, 2026
  2. claude commented on Oct 10, 2026

    @claude
    Contributor

    Claude finished @phernandez's task in 17s —— View job


    Triage

    • Type: Bug (label applied: bug)
    • Component: Database/sync (markdown parsing and entity persistence). It is not Cloud-specific.
    • Priority: Medium. No note content is lost, but created_at is wrong. That skews recent_activity, tail, and any consumer that reads creation time.
    • Complexity: Simple to medium. The fix is small, but it needs regression tests and a check of the sync/move paths.

    Findings

    The code matches the report:

    • src/basic_memory/markdown/utils.py:70 sets model.created_at = markdown.created unconditionally.
    • src/basic_memory/markdown/entity_parser.py:391-415 uses the frontmatter created value if there is one. Otherwise it falls back to a filesystem timestamp (the issue says st_ctime). Atomic writes and renames change that timestamp.

    I only read these lines. I did not reproduce the bug.

    Suggested direction (for whoever picks this up)

    • When updating an existing entity row, keep its created_at.
    • Use the filesystem timestamp only when creating a new row and the note has no frontmatter created.
    • Keep a frontmatter created value as authoritative when it is present.
    • Add regression tests for edit, move, and frontmatter-created cases.

    Duplicates

    I found no duplicate. These issues are related and already closed:

    Whether #684 already writes created into frontmatter is worth checking, because that would partly mitigate this bug for BM-written notes.

    No further reproduction details are needed.

  3. added
    bug
    on Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions