memory_import
Import memories from local markdown files (CLAUDE.md, AGENTS.md, or a directory of .md files) into the memory store, preserving provenance and marking them as external.
Instructions
Import memories from ONE closed native source: "user-claude-md" (/.claude3/CLAUDE.md, else .claude2, else .claude), "project-claude-md" (/CLAUDE.md), "project-agents-md" (/AGENTS.md), or "memory-dir" (every .md DIRECTLY inside dir — non-recursive, symlinks skipped; dir required for this source only). base overrides the resolved base directory. Split rule (derivable, not vague): fenced code is opaque (never split inside, headings within a fence do not count). If the file has ATX headings at column 0, the split level is the SMALLEST heading level that occurs at least TWICE (a lone "# Title" over "##" sections splits per "##"), else the smallest level present — so a file with ONE top-level heading is ONE candidate carrying the whole body; candidates are the preamble before the first split-level heading (if non-blank) then one per split-level section (deeper headings ride along inside). With NO headings, candidates are blank-line-separated paragraph blocks. Each candidate is trimmed of surrounding blank lines; whitespace-only candidates are dropped. Each candidate is taint-scanned and ingested with authority_class=externally-imported and instruction_taint=true (imports are BORN tainted — no waiver) under provenance anchor : — the path is ROOT-RELATIVE when the source sits under the repo anchor root (so anchor_live can resolve it), absolute otherwise (anchor_live stays "unknown" — the fence resolves only root-relative paths, never over-claiming liveness). Batch outcome shape of memory_ingest (captured/deduplicated/rejected per candidate; idempotent re-import dedupes). Outcome split (q103): PARAM faults stay hard -32602 (a memory-dir source without a dir; a dir passed to another source; a memory-dir path that is not a directory); SOURCE-STATE results are SOFT typed rows sharing one family — outcome "imported" (candidates ingested), "absent" (no file at any probed path, with the tried list), or "rejected" (a whitelisted leaf blocked by a security fence — today a leaf that is itself a symlink, never followed — carrying the fence's VERBATIM reason plus the leaf path; the security signal stays fully visible, never a protocol error). STALE-IMPORT SUPERSESSION (u-r8): re-import repairs what it derived — a capsule derived from a source block that CHANGED is auto-superseded by the fresh capture (lineage-bound by per-block content hash, NEVER similarity; equal-count guard defers unbalanced edits to the caller), and content that REAPPEARED (a revert) is revived by climbing the chain of the mechanism's OWN origin='import' supersedes edges to a head anchored in this source. THE FENCE: a hand-ingested capsule is never auto-superseded or auto-revived, a caller-recorded (manual) edge is never machine-reversed — ANY manual edge on the chain makes the machine defer with zero mutation. Every machine edge and revive is audited and marked origin='import' (visible on memory_get).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dir | No | The directory for `memory-dir` or `notion-export-dir` (relative resolves against the base); required for those two sources, rejected for the others. | |
| base | No | Base directory override. Omitted → the boot-injected home dir (`user-claude-md`) or project root (everything else). | |
| source | Yes | Which closed source to read. |