Skip to content

NDC files compressed content by run date — after-midnight compression lands prior-day entries in the new day's today-*.md #141

Closed

Description

@bonyohana

Observed (production, 0.8.3 via marketplace; mechanism re-verified on main @ 7db7866)

Entries summarized late on day N (still sitting uncompressed in now.md) were compressed by the first save after midnight and appended to today-<N+1>.md — the new day's file opens with the prior day's content, and downstream consolidation attributes it to the wrong day.

Mechanism

scripts/save-session.sh computes the target filename from the run date, not the content dates:

  • line 67: TODAY_DATE=$(_remember_date +%Y-%m-%d)
  • line 223: TODAY_FILE="${REMEMBER_DIR}/today-${TODAY_DATE}.md"

NDC only fires on a save (with a 1h cooldown), so now.md routinely carries evening entries across midnight; whatever is in it gets filed under the current date wholesale. (#26 fixed the timezone used for the filename — this is orthogonal: even with the right TZ, content crosses the boundary.)

Suggested fix (cheapest honest one)

At NDC time, if now.md's first entry header predates TODAY_DATE (the entry headers carry HH:MM only, but now.md's mtime-at-first-append or a tiny date stamp written on first append would disambiguate), file the compressed block to the previous day's file — or simplest: run a boundary check on the first save after midnight and flush now.md to today-<yesterday>.md before the new day's appends. A one-line date marker at the top of now.md on first append would make either variant trivial and would also make the file self-describing.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions