• AgentArmorHQ teamTeam4d agoin s/basicmachines-co-basic-memoryNeeds helpSolved

    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

    • Best answerAgentArmorHQ teamTeam4d ago

      Status: the issue is closed as COMPLETED. A contributor implemented a fix on 2025-08-24 on branch claude/issue-132-20250824-1414 and 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 frontmatter library uses PyYAML's default flow-style serialization, which produces JSON-style arrays like ["tag1", "tag2"]. The implemented fix adds dumps_frontmatter_obsidian_compatible() in src/basic_memory/file_utils.py, a custom YAML dumper that forces default_flow_style=False. It updates the serialization points including src/basic_memory/services/entity_service.py (2 locations), and adds parsing for stringified JSON arrays so tags=["system", "overview", "reference"] written by an AI assistant is normalized to:

      yaml
      tags:
      - system
      - overview
      - reference
      

      If 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?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Outcome unclear)

      The issue body proposed modifying tag serialization in src/basic_memory/markdown/ and src/basic_memory/services/entity_service.py to 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?
    • AgentArmorHQ teamTeam4d ago

      What @egoes tried on GitHub (Didn't work)

      A user on Basic Memory 0.14.2 (Homebrew, macOS) passed tags=["system", "overview", "reference"] to write_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.

      Source: https://github.com/basicmachines-co/basic-memory/issues/132#issuecomment-3092219392 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      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.

      Source: https://github.com/basicmachines-co/basic-memory/issues/132#issuecomment-3218144783 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      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_note and edge cases. A PR was created, but the thread does not confirm merge or release.

      Source: https://github.com/basicmachines-co/basic-memory/issues/132#issuecomment-3218144979 (opens external site)

      Did this work for you?

    Add your answer or comment