本頁只整理 Heptabase 的操作面,不含 vault 架構規劃。
0) Scope 與版本基線#
- 版本基線:2026-04 的 CLI 能力面(v0.1.0 指令介面)。
- 能力邊界:本頁只列可驗證的 CLI / 本機 DB 操作,不假設未公開 API。
- 判斷原則:若要確認能力是否仍可用,先跑 help dump(見文末版本巡檢)。
1) CLI 可直接執行的操作#
啟動與連線#
heptabase start — 啟動 desktop app,等待本機 CLI server ready- 常用參數:
--timeout-ms、--poll-interval-ms
卡片(card)#
heptabase card list — 支援分頁、排序、關鍵字過濾;輸出欄位:id、objectType、title、createdTime、lastEditedTimeheptabase card trash <cardId>heptabase card restore <cardId>
AI Tutor(goal / course / lesson)#
heptabase goal list — 列頂層目標與其下課程heptabase course listheptabase course read <courseId> — 拿 syllabus 與 topicheptabase lesson list <courseId>heptabase lesson read <lessonId> — 拿 lesson plan 與 artifact card idheptabase lesson list-messages <lessonId> — 拿對話紀錄 markdown
Journal#
heptabase journal createheptabase journal read <date> — 回傳 contentMd5,供後續 save 衝突檢查用heptabase journal append <date> — 追加 markdown,不需讀取現有內容heptabase journal save <date> — 需帶最新 contentMd5
Note#
heptabase note create — 輸入 markdownheptabase note read <cardId> — 回傳 ProseMirror JSON + contentMd5heptabase note append <cardId> — 輸入 markdownheptabase note save <cardId> — 輸入 ProseMirror JSON,需帶最新 contentMd5
Tag#
heptabase tag createheptabase tag listheptabase tag cards <tagId> — 反查同標籤卡片heptabase tag addheptabase tag remove
CLI 資料格式#
- 所有指令回傳 JSON。
create、append 吃 markdown;read、save 用 ProseMirror JSON。save 一律需帶最新 contentMd5,先 read 取得再送出。
1.5) Command Matrix(用途速查)#
| Command group | 常見用途 | 輸入型態 | 輸出型態 |
|---|
| start | 啟動 app + 等待 CLI ready | options | JSON / status |
| card | 列表、回收、還原卡片 | id / options | JSON |
| note | 建立、讀取、追加、覆寫卡片 | markdown / ProseMirror / id | JSON |
| journal | 依日期管理日誌內容 | date + markdown / ProseMirror | JSON |
| tag | 建立標籤、掛標、查標 | tag/card id / name | JSON |
| goal/course/lesson | 讀 AI Tutor 結構與內容 | course/lesson id | JSON |
2) MCP 操作面(以 CLI 能力為上限)#
目前可確認的是本機 CLI server 能力,沒有獨立的 whiteboard MCP 指令組。
- 實務上,MCP 若要整合 Heptabase,通常是包裝上面同一組 CLI 操作。
- 因此 MCP 可做的操作面,等價於 CLI 已公開的
start/card/course/goal/journal/lesson/note/tag。
MCP 實務建議#
- 以工具分層定義:
- read tools:
card list、note read、journal read、lesson read - write tools:
note create/append/save、journal create/append/save、tag add/remove - admin tools:
start
- 對 write tools 強制參數檢查:
- 先
read 拿到最新 contentMd5 - 再允許
save
- 對高風險操作加保護:
card trash 需二次確認save 預設先備份讀取內容
3) DB(SQLite)操作面:whiteboard 讀取#
CLI v0.1.0 沒有 whiteboard 指令;whiteboard 相關資訊需從本機 SQLite 查詢。
常見 DB 路徑#
- Windows:
%APPDATA%\\project-meta\\hepta.db - macOS:
~/Library/Application Support/project-meta/hepta.db
補充:
- 若路徑不一致,優先檢查 app 啟動參數中的
--user-data-dir。
Whiteboard 查詢流程#
- 啟動:
heptabase start - 從 whiteboard URL 取
<whiteboardId> - 查名稱:
SELECT id, name
FROM whiteboard
WHERE id = '<whiteboardId>';
- 查卡片與座標:
SELECT ci.card_id, c.title, ci.x, ci.y, ci.color
FROM card_instance ci
LEFT JOIN card c ON ci.card_id = c.id
WHERE ci.whiteboard_id = '<whiteboardId>'
ORDER BY ci.y, ci.x;
- 查文字元素:
SELECT content, x, y
FROM text_element
WHERE whiteboard_id = '<whiteboardId>'
ORDER BY y;
- 查子 whiteboard:
SELECT wi.container_id, w.name
FROM whiteboard_instance wi
JOIN whiteboard w ON wi.container_id = w.id
WHERE wi.whiteboard_id = '<whiteboardId>';
- 逐卡讀內容:
heptabase note read <card_id>
Schema 探索補充#
常用表(依現有可見線索):
whiteboardcard_instancecardtext_elementwhiteboard_instance
常見關聯:
card_instance.card_id -> card.idcard_instance.whiteboard_id -> whiteboard.id
4) 可直接複製的操作配方#
配方 A:列出最近更新卡片#
heptabase start
heptabase card list --sort lastUpdatedTime --direction descending -l 20
配方 B:建立卡片並持續追加#
heptabase note create -f draft.md
heptabase note append <card-id> -f patch.md
heptabase note read <card-id>
配方 C:tag-based 卡片批次盤點#
heptabase tag list --name-filter engineer
heptabase tag cards <tag-id>
配方 D:AI Tutor lesson artifact 轉讀#
heptabase course list
heptabase lesson list <course-id>
heptabase lesson read <lesson-id>
heptabase note read <artifact-card-id>
配方 E:whiteboard 座標抽取#
sqlite3 "$DB" "SELECT ci.card_id, c.title, ci.x, ci.y, ci.color FROM card_instance ci LEFT JOIN card c ON ci.card_id = c.id WHERE ci.whiteboard_id = '<whiteboardId>' ORDER BY ci.y, ci.x;"
5) 已知限制(2026-04)#
- 無法用 CLI 直接把卡片放進 whiteboard(UI-only)。
- markdown 內
card-id<!-- unpublished: card-id -->、@card-id 不會變成原生 mention。 - 可行替代:用一般 markdown link(
heptabase://card/<id> 或 app URL)。
能力矩陣(可行 / 不可行)#
| 任務 | 狀態 | 建議做法 |
|---|
| 建立與編輯 note/journal | 可行 | 用 create/append/read/save |
| 讀 AI Tutor 課程與課堂 | 可行 | 用 goal/course/lesson |
| 卡片標籤管理 | 可行 | 用 tag create/list/add/remove |
| 讀 whiteboard 內容結構 | 可行(DB) | 用 SQLite 查 card_instance 等表 |
| CLI 直接放卡進 whiteboard | 不可行 | 改用 UI 操作 |
| markdown 產生原生 mention node | 不可行 | 改用一般 link |
6) 故障排查(Troubleshooting)#
症狀:CLI 指令卡住或連不到#
- 可能原因:desktop app 未就緒。
- 處理:先跑
heptabase start,加大 --timeout-ms。
症狀:save 失敗或衝突#
- 可能原因:
contentMd5 過期。 - 處理:先重新
read 取得最新 contentMd5,再重送 save。
症狀:找不到 hepta.db#
- 可能原因:user data 目錄非預設路徑。
- 處理:檢查行程參數中的
--user-data-dir,再組合 DB 路徑。
症狀:whiteboard 查不到卡片#
- 可能原因:
whiteboardId 錯誤或 SQL 過濾條件不符。 - 處理:先驗證
whiteboard 表中 id/name,再查 card_instance。
7) 版本巡檢清單(每次升級後)#
- 跑
heptabase -h 看 command group 是否新增。 - 逐組跑
<group> -h 更新參數與回傳結構認知。 - 抽樣驗證:
- note create/read/append/save
- lesson read + artifact read
- tag add/remove
- 若新增 whiteboard/mention 相關指令,更新本頁能力矩陣。
8) 參數附錄(實測 -h,2026-04-25)#
本節只收錄已由終端機 -h 輸出驗證的參數與引數。
8.1 全域#
| Command | 參數 | 說明 |
|---|
| heptabase | -V, --version | 顯示版本 |
| heptabase | -h, --help | 顯示說明 |
8.2 start#
| Command | 參數 | 說明 |
|---|
| heptabase start | --timeout-ms <milliseconds> | 最長等待 CLI ready 時間(預設 30000) |
| heptabase start | --poll-interval-ms <milliseconds> | ready 輪詢間隔(預設 500) |
8.3 card#
| Command | 參數/引數 | 說明 |
|---|
| heptabase card list | -q, --query <keyword> | 關鍵字搜尋 |
| heptabase card list | --card-types <types> | 逗號分隔卡片型別(note,pdf,journal,highlightElement,source,image,video,audio,web) |
| heptabase card list | --sort <field> | 排序欄位:title / lastUpdatedTime / createdTime |
| heptabase card list | --direction <direction> | 排序方向:ascending / descending |
| heptabase card list | --offset <number> | 分頁 offset(預設 0) |
| heptabase card list | -l, --limit <number> | 每頁筆數(最大 100,預設 20) |
| heptabase card trash | <cardId> | 卡片 UUID |
| heptabase card restore | <cardId> | 卡片 UUID |
8.4 note#
| Command | 參數/引數 | 說明 |
|---|
| heptabase note create | -c, --content <markdown> | 直接傳 markdown 內容 |
| heptabase note create | -f, --content-file <path> | 由檔案讀 markdown |
| heptabase note read | <cardId> | note 卡片 UUID |
| heptabase note append | <cardId> | note 卡片 UUID |
| heptabase note append | -c, --content <markdown> | 追加 markdown |
| heptabase note append | -f, --content-file <path> | 由檔案追加 |
| heptabase note append | --content-md5 <md5> | 可選,衝突檢查 |
| heptabase note save | <cardId> | note 卡片 UUID |
| heptabase note save | --content-md5 <md5> | 建議必帶,衝突檢查 |
| heptabase note save | -c, --content <json> | ProseMirror JSON 字串 |
| heptabase note save | -f, --content-file <path> | 由檔案讀 ProseMirror JSON |
8.5 journal#
| Command | 參數/引數 | 說明 |
|---|
| heptabase journal create | -d, --date <YYYY-MM-DD> | 指定日期(預設 app 本地時區今天) |
| heptabase journal create | -c, --content <markdown> | 直接傳 markdown |
| heptabase journal create | -f, --content-file <path> | 由檔案讀 markdown |
| heptabase journal read | <date> | 日期(YYYY-MM-DD) |
| heptabase journal append | <date> | 日期(YYYY-MM-DD) |
| heptabase journal append | -c, --content <markdown> | 追加 markdown |
| heptabase journal append | -f, --content-file <path> | 由檔案追加 |
| heptabase journal append | --content-md5 <md5> | 可選,衝突檢查 |
| heptabase journal save | <date> | 日期(YYYY-MM-DD) |
| heptabase journal save | --content-md5 <md5> | 建議必帶,衝突檢查 |
| heptabase journal save | -c, --content <json> | ProseMirror JSON 字串 |
| heptabase journal save | -f, --content-file <path> | 由檔案讀 ProseMirror JSON |
8.6 tag#
| Command | 參數/引數 | 說明 |
|---|
| heptabase tag create | --name <name> | 建立 tag 名稱 |
| heptabase tag list | -n, --name-filter <filter> | 名稱過濾(不分大小寫) |
| heptabase tag cards | <tagId> | tag UUID |
| heptabase tag add | --card-id <cardId> | 卡片 UUID 或 journal 日期 |
| heptabase tag add | --tag-name <tagName> | 目標 tag 名稱 |
| heptabase tag remove | --card-id <cardId> | 卡片 UUID 或 journal 日期 |
| heptabase tag remove | --tag-id <tagId> | tag UUID |
8.7 course / lesson / goal#
| Command | 參數/引數 | 說明 |
|---|
| heptabase goal list | 無 | 列 root goals |
| heptabase course list | 無 | 列 courses |
| heptabase course read | <courseId> | course UUID |
| heptabase lesson list | <courseId> | course UUID |
| heptabase lesson read | <lessonId> | lesson UUID |
| heptabase lesson list-messages | <lessonId> | lesson UUID |
| heptabase lesson list-messages | --offset <number> | 分頁 offset(預設 0) |
| heptabase lesson list-messages | -l, --limit <number> | 每頁筆數(最大 100,預設 20) |
9) 來源#
- heptabase-cli-deep-dive-2026-04-25
- heptabase-whiteboard-sqlite-windows-2026-04-25
10) 延伸閱讀#
- heptabase-vault-integration-playbook-2026-04-25