Interface ImportOptions

Options for importing memory data via Memory.importFrom(). Memory.importFromString() takes dedup alone, with the format as its own argument.

interface ImportOptions {
    format?: "auto" | "json" | "markdown" | "sqlite" | "csv" | "obsidian" | "chatgpt";
    dedup?: boolean;
}

Properties

Properties

format?: "auto" | "json" | "markdown" | "sqlite" | "csv" | "obsidian" | "chatgpt"

Source format of the import file.

  • 'auto' – read from the source: a .json file is a ChatGPT export when its text holds "mapping" and "conversation_id", and JSON otherwise; a .sqlite or .db file is SQLite, a .csv file CSV, a folder Markdown (name 'obsidian' for an Obsidian vault), and any other path JSON.
  • 'sqlite' – one brain's SQLite file, as a 'sqlite' export writes it.
  • 'json' – one JSON document, as a 'json' export writes it.
  • 'markdown' – a folder of Markdown files: each file whose body is not blank is one trace, its front matter read into the trace's fields.
  • 'obsidian' – an Obsidian vault: the Markdown import, with each note's #tags and [[wikilinks]] read as the trace's tags and knowledge-graph edges.
  • 'chatgpt' – ChatGPT's conversations.json export: each user message, with the assistant reply that follows it, is one trace.
  • 'csv' – a CSV file with a header row and a content column.

Default

'auto'
dedup?: boolean

Whether a record is skipped as a duplicate when a trace of the same scope, scope id and user holds its text, or names that text's SHA-256 as import_hash or content_hash; a Markdown or Obsidian note is also skipped when it is the own note of the trace its front-matter id names. A trace of another scope id is not a duplicate, nor is one another user filed: a record's user is its metadata's turnUserId (a note's front-matter turnUserId), or the session owner's when it names none. A trace the brain forgot counts as any other. A JSON, SQLite or CSV import reads a file's live records before its forgotten ones, so a text the file holds both forgotten and live arrives live. A SQLite import merges a skipped record's tags, and the later creation time, into the trace it matches, and an Obsidian note adds the tags and links that trace lacks. With false, no trace record is skipped as a duplicate and nothing is merged into a trace the brain holds.

Default

true