Skip to content

CLI and MCP ignore primaryNotesLocation: root when creating notes #745

Closed

Description

@diazkev314

Summary

With the vault set to "Vault root" mode, zn create and the MCP create_note tool still write new notes to inbox/. vault_info also reports primaryNotesLocation: inbox. Reading and searching root-level notes works fine, so only creation and mode detection are affected.

Environment

  • ZenNotes 2.45.0 (zn v2.45.0), macOS 26.6.2
  • Local vault, .zennotes/vault.json contains "primaryNotesLocation": "root"

Steps to reproduce

  1. Settings → Vault → Notes → Primary notes location → "Vault root".
  2. Confirm .zennotes/vault.json has "primaryNotesLocation": "root".
  3. Run zn create --title Test --body test --json.

Expected

path is Test.md at the vault root, and vault_info (MCP) reports primaryNotesLocation: root.

Actual

path is inbox/Test.md, and vault_info reports primaryNotesLocation: inbox.

Notes

  • Reproduces after restarting the app, the MCP process, and a full reboot.
  • zn list and zn search do return a note placed manually at the vault root, so reads honor the layout.
  • The tool descriptions in server-*.js document root-mode behavior, but I couldn't find any code path in the CLI bundle that reads primaryNotesLocation from vault.json.

Activity

  1. adibhanna commented on Sep 8, 2026

    @adibhanna
    Contributor

    Fixed on the v2.46.0 branch in 5e09fab (release PR #749).

    You found the right place to look. The CLI and the MCP server share one function to decide the mode, and it did read primaryNotesLocation from vault.json, but only after the vault's layout had its say: loose content at the root meant root, notes inside inbox/ meant inbox, and the file was consulted only when the layout was ambiguous. That rule was written when root mode shipped so a vault switched in Settings but not yet migrated kept filing next to its old notes. The app does the opposite (an explicit setting wins, the layout is inferred only when the file leaves it unstated), so with old notes still in inbox/ the two disagreed on the same vault.

    Now the file wins on every side: zn create and create_note land at the vault root, and vault_info reports primaryNotesLocation: root. Only a vault without a stated setting is inferred from its layout, the way the app does it. Reads were already right and are unchanged.

    Verified through the running app: the vault switched to Vault root in Settings, then zn create with no --vault and the MCP tools over stdio, with both new notes showing up in the app at the root while the old ones stayed in inbox/. Three tests pin the order. It ships with 2.46.0; thanks for the precise report.

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