Why does Basic Memory write Obsidian tags as JSON arrays instead of YAML lists?
Using Basic Memory 0.14.2 (Homebrew, macOS), write_note with tags produces frontmatter like
tags: ["tag1", "tag2"], or `tags:- '["system"'
- '"overview"'
- '"reference"]'
when the AI assistant passes tags as a stringified array. Obsidian expects a YAML list such astags: - tag`. How do I get Obsidian-compatible tag formatting?
Originally asked on GitHub: https://github.com/basicmachines-co/basic-memory/issues/132
5 answers
Status: the issue is closed as COMPLETED. A contributor implemented a fix on 2025-08-24 on branch
claude/issue-132-20250824-1414and opened a PR, but the thread does not name the release version that contains it. An earlier PR #194 did not fully address it: maintainer @phernandez said tags were still not in the desired unquoted list format and asked for a code update plus a regression test.The root cause, from the final comment, is that the
frontmatterlibrary uses PyYAML's default flow-style serialization, which produces JSON-style arrays like["tag1", "tag2"]. The implemented fix addsdumps_frontmatter_obsidian_compatible()insrc/basic_memory/file_utils.py, a custom YAML dumper that forcesdefault_flow_style=False. It updates the serialization points includingsrc/basic_memory/services/entity_service.py(2 locations), and adds parsing for stringified JSON arrays sotags=["system", "overview", "reference"]written by an AI assistant is normalized to:yamltags: - system - overview - referenceIf you are still on 0.14.2, you are seeing the old behavior until a build with this fix is released. As general advice, make sure the caller passes tags as a real list, not as a stringified array; the mangled entries shown in the issue happened because the array was converted to a string before being passed to
write_note. Review the PR or upgrade once a release containing the fix is available.Did this work for you?What a GitHub user tried on GitHub (Outcome unclear)
The issue body proposed modifying tag serialization in
src/basic_memory/markdown/andsrc/basic_memory/services/entity_service.pyto emit YAML list syntax with unquoted values while keeping backward compatibility when reading old files.Source: https://github.com/basicmachines-co/basic-memory/issues/132 (opens external site)
Did this work for you?What @egoes tried on GitHub (Didn't work)
A user on Basic Memory 0.14.2 (Homebrew, macOS) passed
tags=["system", "overview", "reference"]towrite_note. Because the AI assistant stringified the array, the frontmatter became `tags:- '["system"'
- '"overview"'
- '"reference"]'`, so the earlier fix had not resolved it for them.
Did this work for you?What @phernandez tried on GitHub (Didn't work)
The maintainer reviewed PR #194, found tags were still not formatted as the expected unquoted YAML list, and asked for the code to be updated and a test added to verify proper formatting.
Did this work for you?What @claude tried on GitHub (Outcome unclear)
A contributor completed an implementation on 2025-08-24: a custom Obsidian-compatible YAML serializer, handling of both array and stringified-array inputs, updated serialization call sites, and a test suite covering
write_noteand edge cases. A PR was created, but the thread does not confirm merge or release.Did this work for you?
Related questions
- basic-memory MCP: ai_assistant_guide resource not found (No such file or directory)
- basic-memory write_note drops custom frontmatter from content
- Basic Memory 0.12.0: write_note fails with sqlite3.OperationalError no such table: entity
- Does basic-memory MCP support Docker with an Obsidian vault mounted via volume?
- Why doesn't basic-memory offer discovery meta-tools like list_categories and list_tags?