本頁只整理 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 — 支援分頁、排序、關鍵字過濾;輸出欄位:idobjectTypetitlecreatedTimelastEditedTime
  • heptabase card trash <cardId>
  • heptabase card restore <cardId>

AI Tutor(goal / course / lesson)

  • heptabase goal list — 列頂層目標與其下課程
  • heptabase course list
  • heptabase course read <courseId> — 拿 syllabus 與 topic
  • heptabase lesson list <courseId>
  • heptabase lesson read <lessonId> — 拿 lesson plan 與 artifact card id
  • heptabase lesson list-messages <lessonId> — 拿對話紀錄 markdown

Journal

  • heptabase journal create
  • heptabase journal read <date> — 回傳 contentMd5,供後續 save 衝突檢查用
  • heptabase journal append <date> — 追加 markdown,不需讀取現有內容
  • heptabase journal save <date> — 需帶最新 contentMd5

Note

  • heptabase note create — 輸入 markdown
  • heptabase note read <cardId> — 回傳 ProseMirror JSON + contentMd5
  • heptabase note append <cardId> — 輸入 markdown
  • heptabase note save <cardId> — 輸入 ProseMirror JSON,需帶最新 contentMd5

Tag

  • heptabase tag create
  • heptabase tag list
  • heptabase tag cards <tagId> — 反查同標籤卡片
  • heptabase tag add
  • heptabase tag remove

CLI 資料格式

  • 所有指令回傳 JSON。
  • createappend 吃 markdown;readsave 用 ProseMirror JSON。
  • save 一律需帶最新 contentMd5,先 read 取得再送出。

1.5) Command Matrix(用途速查)

Command group常見用途輸入型態輸出型態
start啟動 app + 等待 CLI readyoptionsJSON / status
card列表、回收、還原卡片id / optionsJSON
note建立、讀取、追加、覆寫卡片markdown / ProseMirror / idJSON
journal依日期管理日誌內容date + markdown / ProseMirrorJSON
tag建立標籤、掛標、查標tag/card id / nameJSON
goal/course/lesson讀 AI Tutor 結構與內容course/lesson idJSON

2) MCP 操作面(以 CLI 能力為上限)

目前可確認的是本機 CLI server 能力,沒有獨立的 whiteboard MCP 指令組。

  • 實務上,MCP 若要整合 Heptabase,通常是包裝上面同一組 CLI 操作。
  • 因此 MCP 可做的操作面,等價於 CLI 已公開的 start/card/course/goal/journal/lesson/note/tag

MCP 實務建議

  • 以工具分層定義:
    • read tools:card listnote readjournal readlesson read
    • write tools:note create/append/savejournal create/append/savetag 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 查詢流程

  1. 啟動:heptabase start
  2. 從 whiteboard URL 取 <whiteboardId>
  3. 查名稱:
SELECT id, name
FROM whiteboard
WHERE id = '<whiteboardId>';
  1. 查卡片與座標:
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;
  1. 查文字元素:
SELECT content, x, y
FROM text_element
WHERE whiteboard_id = '<whiteboardId>'
ORDER BY y;
  1. 查子 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>';
  1. 逐卡讀內容:heptabase note read <card_id>

Schema 探索補充

  • 列所有資料表:
.tables
  • 常用表(依現有可見線索):

    • whiteboard
    • card_instance
    • card
    • text_element
    • whiteboard_instance
  • 常見關聯:

    • card_instance.card_id -> card.id
    • card_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) 版本巡檢清單(每次升級後)

  1. heptabase -h 看 command group 是否新增。
  2. 逐組跑 <group> -h 更新參數與回傳結構認知。
  3. 抽樣驗證:
  • note create/read/append/save
  • lesson read + artifact read
  • tag add/remove
  1. 若新增 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