Skip to main content

Class: ObsidianImporter

Defined in: packages/agentos/src/cognition/memory/io/ObsidianImporter.ts:80

Imports an Obsidian vault (directory of Markdown files) into a Brain.

Usage:

const importer = new ObsidianImporter(brain);
const result = await importer.import('/path/to/obsidian-vault');

Extends​

Constructors​

Constructor​

new ObsidianImporter(brain): ObsidianImporter

Defined in: packages/agentos/src/cognition/memory/io/ObsidianImporter.ts:84

Parameters​

brain​

Brain

The target Brain to import into.

Returns​

ObsidianImporter

Overrides​

MarkdownImporter.constructor

Properties​

brain​

protected readonly brain: Brain

Defined in: packages/agentos/src/cognition/memory/io/MarkdownImporter.ts:57

The target Brain to import into.

Inherited from​

MarkdownImporter.brain

Methods​

import()​

import(sourceDir, options?): Promise<ImportResult>

Defined in: packages/agentos/src/cognition/memory/io/MarkdownImporter.ts:72

Recursively walk sourceDir, parse every .md file, and insert traces.

Non-Markdown files are silently ignored. Files that fail to parse are recorded in result.errors and processing continues.

Parameters​

sourceDir​

string

Directory to recursively scan for .md files.

options?​

Pick<ImportOptions, "dedup">

Returns​

Promise<ImportResult>

ImportResult with counts of imported, skipped, and errored items.

Inherited from​

MarkdownImporter.import


postProcess()​

protected postProcess(_filePath, _frontmatter, body, result, traceId): Promise<void>

Defined in: packages/agentos/src/cognition/memory/io/ObsidianImporter.ts:105

Post-process a successfully imported Markdown file:

  1. Warn about any embedded images (![[...]]).
  2. Extract inline #hashtags and merge them into the trace's tag list.
  3. Parse [[wikilinks]] and create knowledge_edges entries.

Parameters​

_filePath​

string

Absolute path of the source file (unused here).

_frontmatter​

TraceFrontmatter

Parsed front-matter data.

body​

string

Markdown body (content after front-matter).

result​

ImportResult

Mutable ImportResult accumulator.

traceId​

string

The ID of the just-inserted trace.

Returns​

Promise<void>

Overrides​

MarkdownImporter.postProcess