English | 简体中文
Batch export all notes from Xiaomi Cloud Notes (i.mi.com) as Markdown files.
- Automatically fetch all notes and convert to Markdown
- Preserve headings, lists, checkboxes, blockquotes, horizontal rules, etc.
- Download attachments (images, audio, video)
- Incremental sync (only fetch new/modified notes)
- Automatically clean up notes deleted from the cloud
- Delete specific cloud notes (move to trash)
- Organize notes by folder
- Cookie caching + browser identity persistence to reduce repeated logins
This project provides an AI coding assistant Skill definition file that enables AI assistants to perform note export operations for you:
npx skills add ceynri/mi-note-exportYou can also manually copy skills/mi-note-export/SKILL.md to your project's Skill directory.
Global installation:
npm install -g mi-note-exportOr install as a project dev dependency:
npm install -D mi-note-exportPlaywright Chromium (~200+ MB) will be automatically downloaded during installation. If auto-installation fails, run
npx playwright install chromiummanually.
mi-note # Incremental sync
mi-note --force # Full re-sync
mi-note -o ./notes # Specify output directoryOr run directly via npx without installing:
npx mi-note-export| Option | Description |
|---|---|
-h, --help |
Show help |
-f, --force |
Full re-sync (ignore incremental state) |
-o, --output <dir> |
Specify output directory (default: reads from .mi-note-export.json, otherwise output) |
--login |
Force re-login (ignore cached Cookie) |
--delete-id <id> |
Delete a cloud note by ID (moves to trash, recoverable within 30 days) |
--clear-cache |
Clear system cache directory (Cookie and browser data) |
-y, --yes |
Skip confirmation prompts |
-v, --version |
Show version |
- First run: Opens a Chromium browser via Playwright → user manually logs in to Xiaomi account → Cookie is automatically extracted and cached
- Subsequent runs: Reads cached Cookie → validates it → uses it if valid, otherwise opens browser for re-login
Browser identity data is persisted in the system cache directory (see "Data Directory" below). Xiaomi will recognize it as the same device on subsequent logins, usually without requiring SMS verification.
output/
├── assets/ # Attachments (images, audio, etc.)
├── folder-name/ # Note folder (if any)
│ └── note-title.md
├── note-title.md # Notes with titles
└── 2025-01-01_12-00-00.md # Untitled notes, named by creation time
You can create a .mi-note-export.json file in the current working directory to avoid specifying -o every time:
{ "output": "./my-notes" }Output directory priority: -o CLI argument > .mi-note-export.json > default output.
Cookie and Playwright browser persistence data are stored in the system cache directory:
- macOS:
~/Library/Caches/mi-note-export/ - Linux:
$XDG_CACHE_HOME/mi-note-export/or~/.cache/mi-note-export/ - Windows:
%LOCALAPPDATA%/mi-note-export/cache/
Contents:
cookie— Cached login Cookiebrowser-data/— Playwright browser persistence data (device identity preserved to reduce re-verification)
The incremental sync state file is stored inside the output directory:
<output>/.sync-state.json— Tracks synced notes and their modification dates
- Private notes, todos, and mind maps are not supported
- Cookie has a limited lifespan (typically a few days); re-login is required after expiration
- Empty notes (no title and no content) are automatically skipped
pnpm install # Install dependencies
pnpm build # Compile TypeScript
pnpm dev # Watch mode compilation
pnpm start # Runmi-note-export/
├── src/
│ ├── cli.ts # CLI entry point
│ ├── auth.ts # Cookie retrieval, caching, validation
│ ├── api.ts # Xiaomi Cloud Notes API wrapper
│ ├── converter.ts # Note content parsing & Markdown conversion
│ ├── sync.ts # Incremental sync logic & state management
│ ├── types.ts # Type definitions
│ └── utils.ts # Utility functions
├── .agents/ # AI assistant configuration (rules/agents)
├── skills/ # AI Skill source (for npx skills add)
├── dist/ # Build output (git ignored)
├── tsconfig.json
└── package.json
MIT