> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memanto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Open Knowledge Format (OKF)

> Move memories in and out of Memanto as portable OKF bundles — a vendor-neutral, human- and agent-readable markdown format.

# Open Knowledge Format (OKF)

<img src="https://unpkg.com/@lobehub/icons-static-svg@latest/icons/googlecloud-color.svg" alt="Google Cloud" width="120" style={{marginBottom: "1.5rem"}} />

[Open Knowledge Format (OKF)](https://github.com/GoogleCloudPlatform/knowledge-catalog/tree/main/okf)
is an open, vendor-neutral specification from **Google Cloud** (v0.1) that
formalizes the "LLM-wiki" pattern: knowledge stored as a directory of markdown
files with YAML frontmatter, one concept per file, linked with plain markdown
links.

Memanto uses OKF as its **portable, at-rest interchange format**. Moorcheh stays
the retrieval engine — OKF is only how memories are represented on disk so they
can be exported, browsed, versioned in git, and imported elsewhere without lock-in.

<CardGroup cols={2}>
  <Card title="Export" icon="folder-tree">
    Write an agent's memories to an OKF bundle — one folder per memory type, plus daily summaries, session logs, and metrics.
  </Card>

  <Card title="Import" icon="download">
    Load any OKF bundle into an agent with `memanto migrate okf`. Unmapped fields are preserved, nothing is lost.
  </Card>

  <Card title="Sync" icon="rotate">
    Drop a browsable OKF bundle into a project directory for an agent (or human) to read.
  </Card>

  <Card title="Lossless" icon="shield-check">
    Memanto-only fields ride along in an `x_memanto` frontmatter block, so Memanto → OKF → Memanto round-trips keep confidence, provenance, and source.
  </Card>
</CardGroup>

## What an OKF document looks like

Only `type` is required; every other field is optional.

```markdown theme={null}
---
type: fact
title: Postgres is the primary database
description: The project uses PostgreSQL 16.
tags: [infra, db]
timestamp: 2026-05-28T14:30:00Z
resource: https://example.com/db
x_memanto:
  confidence: 0.9
  provenance: explicit_statement
  source: user
  type: fact
---

The project uses PostgreSQL 16 as its primary database. Runs on port 5432.
```

## Export

```bash theme={null}
memanto memory export --okf
```

Writes an OKF bundle to `~/.memanto/exports/<agent>_okf/`. The bundle nests
memories under `memories/` alongside export-only context sections (only the
sections that have data are written):

```
<agent>_okf/
├── index.md              # navigation for the whole bundle
├── memories/             # the 13 memory types (from Moorcheh)
│   ├── index.md
│   ├── fact/
│   │   ├── index.md
│   │   └── postgres-is-the-primary-database.md
│   └── decision/ …
├── daily-summaries/      # generated daily-summary files (if any)
├── sessions/             # per-session logs: what was added/removed, and from where
└── metrics/              # aggregate stats & ASCII visualizations
    └── overview.md
```

**Layout — `--split`:** controls how each memory type folder is written.

| Value            | Behavior                                                                                                                   |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `auto` (default) | One file per memory, but a type with more than 50 memories collapses to a single stacked file to avoid thousands of files. |
| `file`           | Always one file per memory.                                                                                                |
| `type`           | Always a single stacked file per type.                                                                                     |

See [`memanto memory export`](/cli/data/export) for all options.

## Import

```bash theme={null}
memanto migrate okf ./okf-bundle
```

`migrate okf` accepts a bundle directory (or a single `.md` file), maps each
node onto Memanto's schema, and bulk-writes the memories into the target agent.
It runs as a subcommand of [`memanto migrate`](/cli/migrate/migrate) but, unlike
the provider migrations, needs no API key and produces no savings report — OKF
is a local file format, not a competing provider.

* Fields that don't map onto a Memanto column are preserved in a bounded
  `[Supporting data]` footer appended to the memory content, so **nothing is lost**.
* OKF's `type` is free-form domain vocabulary (`BigQuery Table`, `Runbook`, …).
  When it isn't one of Memanto's 13 types, it is **auto-classified** and the
  original type is kept in the footer.
* Import is **scoped to `memories/`** when a bundle has that folder, so
  daily-summaries, sessions, and metrics are never re-ingested as memories.

Preview without writing:

```bash theme={null}
memanto migrate okf ./okf-bundle --dry-run
```

## Sync

```bash theme={null}
memanto memory sync --okf --project-dir ./my-project
```

Runs a fresh export and copies the OKF bundle into `./my-project/okf/`, giving
an agent (or a teammate) a browsable, git-friendly memory wiki. See
[`memanto memory sync`](/cli/data/sync).

## Field mapping

| OKF field     | Export (Memanto → OKF)                     | Import (OKF → Memanto)                                                                                             |
| ------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
| `type`        | Memanto type verbatim                      | Auto-classify; used directly only when it equals a Memanto type or an `x_memanto.type` round-trip value is present |
| `title`       | `title`                                    | `title`                                                                                                            |
| `description` | first line of content                      | prepended to content                                                                                               |
| body          | `content`                                  | `content`                                                                                                          |
| `resource`    | `source_ref`                               | `source_ref`                                                                                                       |
| `tags`        | `tags`                                     | `tags`                                                                                                             |
| `timestamp`   | `created_at`                               | `created_at`                                                                                                       |
| `x_memanto`   | confidence, provenance, source, id, status | read back when present                                                                                             |

## Notes & limitations

* **Round-trip:** Memanto → OKF → Memanto preserves the extra fields via
  `x_memanto`. Importing a *foreign* bundle auto-classifies `type` (the OKF and
  Memanto vocabularies differ), so it is not byte-identical — this is inherent
  to the format, not a bug.
* **Links:** exported bundles are flat — Memanto does not store inter-memory
  edges, so no cross-links are generated. Links found in imported bodies are
  preserved verbatim and listed in the footer.
* **Context sections** (`daily-summaries/`, `sessions/`, `metrics/`) are read
  from local files under `~/.memanto/`; a machine that has never generated a
  daily summary exports memories only.
