Skip to content

feat(core): honor note timestamps from frontmatter - #1100

Merged
phernandez merged 1 commit into
mainfrom
codex/issue-238-frontmatter-timestamps
Jul 18, 2026
Merged

feat(core): honor note timestamps from frontmatter#1100
phernandez merged 1 commit into
mainfrom
codex/issue-238-frontmatter-timestamps

Conversation

@phernandez

Copy link
Copy Markdown
Member

Why

Markdown notes can already declare created and modified, but Basic Memory previously ignored those semantic timestamps and exposed filesystem mtime instead. That made imported and hand-authored note history unstable across indexing, moves, and materialization.

This is a clean replacement for the timestamp foundation attempted in closed PR #1089.

What Changed

  • Parse canonical created and modified ISO 8601 values once, after YAML normalization.
  • Carry typed semantic timestamps through prepared writes, local and DB-first persistence, indexing, search, directory results, and materialization.
  • Keep checksum, path, size, and mtime as physical file bookkeeping without overwriting note semantics.
  • Remove ORM updated_at auto-update behavior and preserve semantic timestamps on moves and incidental writes.
  • Document canonical timestamp behavior and filesystem fallbacks.

Implementation Details

  • Date-only and naive values use the machine's local timezone; explicit offsets retain their represented instant.
  • Missing or null fields fall back independently to file ctime/mtime, or one operation-local timestamp when stats are unavailable.
  • Invalid canonical values fail with field-specific errors instead of silently falling back.
  • Non-Markdown resources continue to use stat-derived timestamps.
  • No database migration or request-schema change is required.

Testing

  • Parser coverage for date-only, naive, offset-aware, missing/null, invalid, epoch-zero, and unavailable-stat cases.
  • Prepared and accepted-write coverage for typed timestamp propagation and move preservation.
  • Local indexing, batch reindexing, materialization, search filtering, and directory result coverage.
  • just fast-check
  • just doctor
  • Full SQLite unit/integration suites.
  • Full PostgreSQL unit suite plus complete sharded PostgreSQL integration suite (the monolithic integration recipe's 600-second guard was exceeded after 73% passed, so all tests were rerun in MCP and non-MCP shards).

Risks / Follow-ups

This PR intentionally excludes managed timestamp injection, aliases, and frontmatter rewriting. Those write-policy changes remain scoped to #684 after this foundation lands.

Closes #238

@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 54a37ad303

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/indexing/accepted_note_write_runner.py
@phernandez
phernandez force-pushed the codex/issue-238-frontmatter-timestamps branch from 54a37ad to aa1984b Compare July 18, 2026 04:43
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aa1984b462

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/markdown/entity_parser.py
@phernandez
phernandez force-pushed the codex/issue-238-frontmatter-timestamps branch from aa1984b to 1eadb57 Compare July 18, 2026 04:52
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1eadb57dc3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/repository/search_index_row.py
@phernandez
phernandez force-pushed the codex/issue-238-frontmatter-timestamps branch from 1eadb57 to 086019d Compare July 18, 2026 04:59
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 086019da7f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/services/entity_service.py Outdated
@phernandez
phernandez force-pushed the codex/issue-238-frontmatter-timestamps branch from 086019d to 7d4ba2f Compare July 18, 2026 05:08
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 7d4ba2f1a6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez
phernandez force-pushed the codex/issue-238-frontmatter-timestamps branch from 7d4ba2f to 73fa520 Compare July 18, 2026 14:24
@phernandez

Copy link
Copy Markdown
Member Author

Fixed the Windows-only epoch fallback failure in 73fa520. Stat timestamps are now constructed as UTC-aware datetimes before conversion to local time, avoiding the Windows CRT rejection when epoch zero plus a negative local offset crosses into 1969. The existing epoch-zero regression now uses a portable UTC instant. Verified uv run pytest tests/markdown/test_entity_parser.py -q (13 passed), just fast-check, and just doctor. Latest-head CI and BM Bossbot approval are pending.

@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 73fa52059a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@phernandez
phernandez merged commit 35a7f5a into main Jul 18, 2026
22 checks passed
@phernandez
phernandez deleted the codex/issue-238-frontmatter-timestamps branch July 18, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Support custom timestamps in note frontmatter

1 participant