Skip to main content

Class: MarkdownExporter

Defined in: packages/agentos/src/memory/io/MarkdownExporter.ts:63

Exports memory traces as Markdown files with YAML front-matter.

Usage:

const exporter = new MarkdownExporter(brain);
await exporter.export('/path/to/vault');

Extended by

Constructors

Constructor

new MarkdownExporter(brain): MarkdownExporter

Defined in: packages/agentos/src/memory/io/MarkdownExporter.ts:67

Parameters

brain

SqliteBrain

The SqliteBrain instance to read from.

Returns

MarkdownExporter

Properties

brain

protected readonly brain: SqliteBrain

Defined in: packages/agentos/src/memory/io/MarkdownExporter.ts:67

The SqliteBrain instance to read from.

Methods

buildFileContent()

protected buildFileContent(trace): string

Defined in: packages/agentos/src/memory/io/MarkdownExporter.ts:109

Build the Markdown content for a single trace.

Subclasses (e.g. ObsidianExporter) override this to inject wiki-links and #tag decorations into the body.

Parameters

trace

TraceRow

Parsed trace row from the database.

Returns

string

Full Markdown file content (front-matter + body).


export()

export(outputDir, _options?): Promise<void>

Defined in: packages/agentos/src/memory/io/MarkdownExporter.ts:82

Export all memory traces as .md files into outputDir.

Directories are created on demand (equivalent to mkdir -p).

Parameters

outputDir

string

Root directory to write the Markdown vault into.

_options?

ExportOptions

Returns

Promise<void>


traceRelativePath()

protected traceRelativePath(trace): string

Defined in: packages/agentos/src/memory/io/MarkdownExporter.ts:136

Determine the relative file path for a trace within the output directory.

Default: {scope}/{type}/{id}.md

Parameters

trace

TraceRow

The trace row.

Returns

string

Relative path string (no leading slash).