You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Auto-write created / modified frontmatter on BM-owned writes #684
Currently, Basic Memory tracks created_at and updated_at timestamps at the entity level (visible in JSON output via API/MCP), but these timestamps don't appear in the markdown files themselves.
Current behavior:
Entity timestamps exist in the database
They're accessible via JSON output
Frontmatter doesn't include them unless manually written/maintained
Desired behavior:
BM automatically writes created_at and updated_at into YAML frontmatter when creating/updating notes
These fields would be managed by BM itself (not AI/user-maintained)
Timestamps would be visible in the plain-text files, not just the database
Use cases:
Consistent timestamp metadata across all notes without manual maintenance
Temporal queries/filters based on frontmatter (e.g., "notes created this week")
Better compatibility with tools that read frontmatter but not BM's database
Fits BM's transparency philosophy: important metadata should be in the file itself
Suggested implementation:
Auto-inject created_at on note creation
Auto-update updated_at on note modification
Make these "reserved" frontmatter fields (schema validation aware, but not user-editable)
Respect existing timestamps if already present (don't overwrite manual entries)
Related:
Picoschema metadata: section could declare these as system-managed fields
Would complement existing frontmatter features (status, tags, priority)
Type: Enhancement (improvement to existing feature)
Priority: Medium — improves transparency and compatibility with external tools, aligns with BM's "files as source of truth" philosophy, but not blocking any core functionality.
Complexity: Medium — requires changes across the markdown writing pipeline, sync layer, and potentially frontmatter parsing.
Duplicate Check
No exact duplicate found. Related issue: #616 (Temporal query optimization) touches created_at/updated_at as search dimensions, but focuses on querying — not on writing timestamps into frontmatter. These are complementary, not duplicates. Implementing this issue would actually help #616 by making dates visible in frontmatter for temporal filtering.
Implementation Notes
Key areas to touch:
src/basic_memory/markdown/ — frontmatter serialization when writing notes
src/basic_memory/services/ — entity write/update logic to inject timestamps
src/basic_memory/sync/ — ensure timestamps are preserved across sync
Need to handle the "reserved fields" concept (don't overwrite user-set values on first write, but manage on subsequent updates)
Edge cases to consider:
What happens when a file is imported with existing created_at in frontmatter? (Respect it.)
What format for timestamps? ISO 8601 is likely the right choice.
updated_at should reflect file modification time, not DB update time — these should stay in sync.
Being implemented together with #238 in a single PR (they share the frontmatter/timestamp code path). Canonical fields will be created / modified — the fields BM's markdown parser already reads (markdown/utils.py:59-60) — with BM auto-writing them on create/update and never overwriting a value the frontmatter already carries. Tracking the work from #238.
This issue stays separate and follows #238. #238 establishes timestamp parsing and file/DB consistency; this issue adds automatic frontmatter mutation only for Basic Memory-owned writes.
Write policy
Canonical written fields are created and modified.
Create: explicit canonical values supplied on creation are honored. Missing values are initialized to the same current timestamp.
Update/edit: preserve created and always set modified to the current write time.
Do not infer that an unchanged incoming modified was an intentional override merely because a full-document request carried the old frontmatter forward.
Move: preserve both semantic timestamps. A path change is not a content timestamp change.
Legacy frontmatterless notes: partial edits remain frontmatterless. We will not add a YAML block solely to stamp timestamps; a separate explicit migration/backfill can cover that use case if wanted.
Active writes normalize timestamp values to timezone-aware ISO 8601 strings so the persisted representation is stable across YAML readers and machines.
Aliases such as date, created_at, and updated_at are not part of the first managed-write implementation.
Implementation constraints
Resolve the timestamp policy once in the service-owned note preparation stage.
Carry typed timestamps forward; do not reparse serialized metadata in local/cloud persistence layers.
Frontmatter updates used by partial edits must preserve the body bytes exactly, including leading indentation, trailing whitespace, newline style, and BOM handling.
Tests must cover create, full replace, every partial edit family, frontmatterless legacy notes, moves, and local/cloud parity.
Implementation should begin only after the clean #238 foundation lands.
changed the title [-]Auto-sync entity created_at / updated_at timestamps into frontmatter[/-][+]Auto-write `created` / `modified` frontmatter on BM-owned writes[/+]on Aug 29, 2026
Narrowing this to what's left. The read side landed in #1100: created / modified in frontmatter are parsed into created_at / updated_at (markdown/entity_parser.py, services/note_preparation.py) and documented in docs/NOTE-FORMAT.md. What is not implemented is the write side — no BM-owned write (write_note, edit_note, move) injects the fields; only the importers do, and passive indexing deliberately never adds them.
The policy is already settled in my comment above (create initializes both; edit bumps modified; move preserves; passive sync never touches; tz-aware ISO strings; byte-exact body preservation on partial edits), so this no longer needs investigation. Retitled accordingly and dropping the created_at/updated_at naming and the schema-validation ask (separate picoschema concern). Implementation is medium: the create/update/edit/move paths in note_preparation.py, frontmatter serialization via dump_frontmatter, and local + cloud parity tests including frontmatterless legacy notes.
Activity
claude commentedon Mar 20, 2026
Claude finished @bm-clawd's task in 58s —— View job
Triage Analysis
Summary
Type: Enhancement (improvement to existing feature)
Priority: Medium — improves transparency and compatibility with external tools, aligns with BM's "files as source of truth" philosophy, but not blocking any core functionality.
Component: Database/sync + MCP tools (
write_note,edit_note)Complexity: Medium — requires changes across the markdown writing pipeline, sync layer, and potentially frontmatter parsing.
Duplicate Check
No exact duplicate found. Related issue: #616 (Temporal query optimization) touches
created_at/updated_atas search dimensions, but focuses on querying — not on writing timestamps into frontmatter. These are complementary, not duplicates. Implementing this issue would actually help #616 by making dates visible in frontmatter for temporal filtering.Implementation Notes
Key areas to touch:
src/basic_memory/markdown/— frontmatter serialization when writing notessrc/basic_memory/services/— entity write/update logic to inject timestampssrc/basic_memory/sync/— ensure timestamps are preserved across syncEdge cases to consider:
created_atin frontmatter? (Respect it.)updated_atshould reflect file modification time, not DB update time — these should stay in sync.Labels added:
enhancement,medium,database,mcpbm-clawd commentedon Mar 20, 2026
Additional context from Discord
#helpExpected behavior (per Drew Nellins):
created_at/updated_atexist in frontmatter → those should be authoritative (override DB)Current observed behavior (per @titan):
When trying to validate these fields via schema:
Result: validation treats
metadata:itself as a required observation, not as a frontmatter section.Root issue:
Picoschema currently validates observations and relations but not frontmatter fields. This means:
Test needed:
created_at: 2024-01-01T10:00:00Zin frontmatterentity['created_at']match frontmatter value or DB auto-generated value?cc @titan for original use case
phernandez commentedon Jul 16, 2026
Being implemented together with #238 in a single PR (they share the frontmatter/timestamp code path). Canonical fields will be
created/modified— the fields BM's markdown parser already reads (markdown/utils.py:59-60) — with BM auto-writing them on create/update and never overwriting a value the frontmatter already carries. Tracking the work from #238.test: account for auto-managed created/modified in write-path assertions
fix(core): stop onupdate=now from clobbering the note's semantic modi…
phernandez commentedon Jul 17, 2026
Managed timestamp policy after reviewing #1089
This issue stays separate and follows #238. #238 establishes timestamp parsing and file/DB consistency; this issue adds automatic frontmatter mutation only for Basic Memory-owned writes.
Write policy
createdandmodified.createdand always setmodifiedto the current write time.modifiedwas an intentional override merely because a full-document request carried the old frontmatter forward.date,created_at, andupdated_atare not part of the first managed-write implementation.Implementation constraints
Implementation should begin only after the clean #238 foundation lands.
[-]Auto-sync entity created_at / updated_at timestamps into frontmatter[/-][+]Auto-write `created` / `modified` frontmatter on BM-owned writes[/+]phernandez commentedon Aug 29, 2026
Narrowing this to what's left. The read side landed in #1100:
created/modifiedin frontmatter are parsed intocreated_at/updated_at(markdown/entity_parser.py,services/note_preparation.py) and documented indocs/NOTE-FORMAT.md. What is not implemented is the write side — no BM-owned write (write_note,edit_note, move) injects the fields; only the importers do, and passive indexing deliberately never adds them.The policy is already settled in my comment above (create initializes both; edit bumps
modified; move preserves; passive sync never touches; tz-aware ISO strings; byte-exact body preservation on partial edits), so this no longer needs investigation. Retitled accordingly and dropping thecreated_at/updated_atnaming and the schema-validation ask (separate picoschema concern). Implementation is medium: the create/update/edit/move paths innote_preparation.py, frontmatter serialization viadump_frontmatter, and local + cloud parity tests including frontmatterless legacy notes.