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
Edits to exported Obsidian memory notes can now be imported with agentmemory obsidian-import --vault-dir <path> [--dry-run] [--prefer vault|store], or authenticated POST /agentmemory/obsidian/import.
Body, H1 title and type corrections use the registered mem::evolve path, retaining prior versions and current store metadata. Notes without an ID use the scrubbed mem::remember path. Import reports conflicts, defaults to vault content, preserves store-only corrections, and repeats without another write. The actual writer checks the planned head under its lock.
Only memory notes inside the existing export root are read. Duplicate/unknown IDs, ambiguous parent lineages, edited generated tails and unsupported metadata are reported; missing notes never delete memory. Existing Markdown bytes and literal user headings are preserved. Older exports without a saved snapshot report unverifiable mutable metadata instead of applying it. Confirmed IDs/applied counts and uncertain responses make partial failures explicit. See the vault guide for the boundaries.
Validation:
Required build, skills generation/check, docs sync/check, full tests and eval typecheck all completed successfully on the same 1,143 source inputs.
Full suite: 4,990 passed, seven skipped. This uses a finite eight-domain positive DNS fixture in the child process and normal npm metadata; the host network is unchanged.
149 focused checks cover registered memory writes, real temporary notes, authenticated loopback HTTP, the compiled CLI, lock contention, privacy, repeats, legacy notes and partial writes. SDK/KV/index transports are mocked; these checks do not exercise an installed iii-engine.
Two legacy regressions were reproduced against the preserved original export before their fixes; the same tests now pass. The original export assertions and 512-byte golden note remain intact.
The three new production modules pass a dedicated strict typecheck. Whole-project TypeScript retains its 28 baseline diagnostics; the broader test dependency graph retains 17 inherited diagnostics with none in the new modules or fixtures.
Summary by CodeRabbit
New Features
Import Obsidian vault notes into memory through the CLI or authenticated REST API, with dry-run previews and options for resolving conflicts.
Edit imported notes while preserving memory history and metadata; imports validate vault paths and note changes before applying updates.
Set an explicit title when creating a memory.
Check for changes since a memory was read before evolving it.
Documentation
Added an Obsidian import guide and updated API documentation to reflect 148 REST endpoints.
Updated reported passing-test counts to 5,000+ across documentation.
No actionable comments were generated in the recent review.
Walkthrough
The PR adds an Obsidian vault import flow that reads edited Markdown notes into memory. It exposes the flow through an authenticated REST endpoint and a CLI command. It also records export context and updates tests and documentation.
Changes: Obsidian Vault Import
Layer / File(s)
Summary
Export context and memory state src/functions/obsidian-vault.ts, src/functions/obsidian-export.ts, src/state/memory-utils.ts, src/state/schema.ts, src/types.ts, src/functions/relations.ts, src/functions/remember.ts
Export records note context using shared vault helpers. Memory operations add state-token checks and optional explicit titles. The state schema and audit types include Obsidian note metadata.
Import planning and writes src/functions/obsidian-import.ts, test/obsidian-import*.test.ts, test/obsidian-import-boundaries.test.ts, test/fixtures/obsidian-memory-cf9.md
The importer discovers and validates notes, checks lineage and provenance, plans create, update, unchanged, and conflict outcomes, and applies writes after rechecks. Tests cover legacy notes, dry runs, privacy scrubbing, conflicts, and boundary cases.
The authenticated REST endpoint and CLI command invoke the import function. Worker startup registers it, and route and CLI tests include the new entry points.
Documentation and reported counts docs/obsidian-vault.md, plugin/skills/agentmemory-rest-api/REFERENCE.md, README.md, READMEs/*, AGENTS.md, scripts/docs-sync.state.json
The docs describe import behavior and update reported endpoint and test counts. The root README also adds /obsidian/import to the export-root path guidance.
sequenceDiagram
participant CLI as obsidian-import CLI
participant REST as Import REST endpoint
participant ImportFunction as mem::obsidian-import
participant StateKV
CLI->>REST: send vaultDir, dryRun, prefer
REST->>ImportFunction: dispatch validated import request
ImportFunction->>StateKV: read memory, lineage, and provenance
ImportFunction->>StateKV: save provenance and audit results
Loading
Merge Risk: Minimal · up to 3d82f
The Obsidian import flow handles repeated edits to a moved note correctly, and the previously raised concern no longer applies. No merge-blocking risk remains from this review.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "feat: import edited Obsidian memory notes" matches the main change in the changeset. The PR adds an Obsidian vault import path through a new CLI command (obsidian-import), an authenticate…
Linked Issues check
Only #1743 is an active direct link. Its coding requirements were checked against the whole-PR summary (merge base cf9a738 to head 3d82f8b). No source hunks were read directly.
The title "feat: import edited Obsidian memory notes" matches the main change in the changeset. The PR adds an Obsidian vault import path through a new CLI command (obsidian-import), an authenticated REST endpoint (POST /agentmemory/obsidian/import), and an import function that reads edited vault notes and writes changes back to memory. The title is short, uses the conventional prefix, and names the primary feature.
Full details: Linked Issues check
Explanation
Only #1743 is an active direct link. Its coding requirements were checked against the whole-PR summary (merge base cf9a738 to head 3d82f8b). No source hunks were read directly.
Identity [#1743]: Export writes the memory ID into frontmatter (memoryToMd in src/functions/obsidian-export.ts). Import matches notes by that ID. Notes without an ID go to mem::remember (src/functions/obsidian-import.ts).
Merge policy [#1743]: Default prefer is "vault". Body, H1 title and type edits go through mem::evolve, which keeps prior versions. --prefer vault|store is accepted by the CLI (src/cli/obsidian-import.ts) and REST (src/triggers/api.ts). Conflicts are reported. The expectedState check in src/functions/relations.ts guards the planned head under the writer lock.
Deletes [#1743]: Missing notes never delete memory. The summary shows no delete path. Tests cover missing notes and support files.
Paths [#1743]: Import is confined to obsidianExportRoot() (src/functions/obsidian-vault.ts). Symlinks are rejected, which is stricter than the issue's "symlinks resolved" wording and still satisfies confinement. Traversal and size limits apply.
Scrubbing [#1743]: Imported text strips private data before writes. Writes use the registered remember and evolve paths.
Deliverable [#1743]: mem::obsidian-import supports dryRun and reports creates, updates, conflicts and unchanged notes. The REST route POST /agentmemory/obsidian/import and CLI command obsidian-import exist. Fixture-vault tests exist in test/obsidian-import*.test.ts.
Limits: The verdict rests on the PR summary and test descriptions. SDK, KV and index transports are mocked in the tests, so behavior against an installed iii-engine is not established. This limit does not change the listed requirements.
src/functions/obsidian-vault.ts, src/functions/obsidian-export.ts: export root confinement, identity and digest helpers, and the KV.obsidianNotes baseline used by import.
src/functions/relations.ts (expectedState) and src/state/memory-utils.ts (memoryWriteToken): head checks needed for safe import writes.
src/functions/remember.ts (optional title): lets imported H1 titles persist for notes without IDs.
src/state/schema.ts, src/types.ts: the new KV key and the obsidian_import audit operation.
docs/obsidian-vault.md, plugin/skills/.../REFERENCE.md, scripts/docs-sync.state.json, AGENTS.md, README translations, and endpoint-count tests: documentation and docs-sync updates for the new endpoint and command. These count changes follow the repository docs-sync convention.
Tests and the fixture test/fixtures/obsidian-memory-cf9.md: coverage for this feature.
No change in the summary lacks a connection to #1743.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 9faf5be3-120e-49d7-b429-6b24c0d08c4a
Commits
Reviewing files that changed from the base of the PR and between 149dd0f and 3d82f8b.
Files selected for processing: 1
test/obsidian-import-boundaries.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
The import keys note contexts by the realpath of the vault. On macOS the
temp directory is a symlink, so the ambiguity tests read null contexts.
Signed-off-by: Rohit Ghumare <ghumare64@gmail.com>
This branch has not been deployed
No deployments
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
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.
Fixes #1743.
Edits to exported Obsidian memory notes can now be imported with
agentmemory obsidian-import --vault-dir <path> [--dry-run] [--prefer vault|store], or authenticatedPOST /agentmemory/obsidian/import.Body, H1 title and type corrections use the registered
mem::evolvepath, retaining prior versions and current store metadata. Notes without an ID use the scrubbedmem::rememberpath. Import reports conflicts, defaults to vault content, preserves store-only corrections, and repeats without another write. The actual writer checks the planned head under its lock.Only memory notes inside the existing export root are read. Duplicate/unknown IDs, ambiguous parent lineages, edited generated tails and unsupported metadata are reported; missing notes never delete memory. Existing Markdown bytes and literal user headings are preserved. Older exports without a saved snapshot report unverifiable mutable metadata instead of applying it. Confirmed IDs/applied counts and uncertain responses make partial failures explicit. See the vault guide for the boundaries.
Validation:
Summary by CodeRabbit
New Features
Documentation