feat: add vault_update_properties + properties_only on read#48
Merged
Conversation
New tool: vault_update_properties — merge frontmatter properties on a single note without touching the body. Same shallow-merge semantics as vault_write_note (new keys added, matching keys overwritten, unmentioned keys preserved), but no body round-trip required. Extended: vault_read_note gains properties_only boolean param — returns parsed frontmatter as JSON instead of full note content. Saves tokens when agents only need property values. Standardized naming: renamed vault_write_note's `frontmatter` param to `properties` for consistency with vault_list_property_keys, vault_search_by_property, and the new tools. Breaking change acceptable pre-public. 22 → 23 tools. 480 tests (10 new). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- "merges new keys without changing body": parse result with gray-matter and assert body content exactly, not just toContain substring - "preserves unmentioned keys": verify tags array survives the merge, not just the title string Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ter" Agent-facing text now consistently uses "properties" when referring to the data. "Frontmatter" is retained only where it describes the physical file format (YAML fences, file position, stripping). Also fixes stale reference to vault_write_note's old `frontmatter` parameter name in vault_replace_in_note's description. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add min(1) to record key validators on vault_write_note and vault_update_properties to reject empty-string property keys. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…operties Shallow merge overwrites array keys entirely — agents should read current values with properties_only: true before updating tags, related, or other array properties to avoid data loss. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Agent can't know property types upfront. Guidance now says read first unconditionally, with a note that arrays are replaced not appended. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Matches vault_patch_note pattern where the read-first recipe appears directly after the Example block, before When to use. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Internal doc comments use "frontmatter" when describing the physical YAML block on disk, "properties" for the data passed as params. Params and function names stay as "properties" (agent-facing). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
serializeNote is an internal function that builds the YAML block — its param should use the format term (frontmatter), not the agent term (properties). writeNote maps at the boundary: receives params.properties, passes to serializeNote's frontmatter param. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
vault_update_properties— merge frontmatter properties on a single note without touching the body. Same shallow-merge semantics asvault_write_note(new keys added, matching keys overwritten, unmentioned keys preserved), but no body round-trip required. Closes the gap where frontmatter edits required reading + rewriting the entire note body.vault_read_notegainsproperties_only: booleanparam — returns parsed frontmatter as JSON instead of full note content. Saves tokens when agents only need property values.vault_write_note'sfrontmatterparam topropertiesfor consistency withvault_list_property_keys,vault_search_by_property, and the new tools. Breaking change acceptable pre-public.Closes
^frontmatter-toolstask.Test plan
npx tsc --noEmit— cleannpm test— 480 tests pass (468 existing + 10 new + 2 updated)npm run lint— cleanvault_read_note({ path: "...", properties_only: true })returns JSONvault_update_properties({ path: "...", properties: { status: "active" } })merges without body change🤖 Generated with Claude Code