Dnote Notes
Manage a personal knowledge base using Dnote CLI.
Setup
Installation
CODEBLOCK0
Configuration
Dnote follows XDG directories:
- - Config: INLINECODE0
- Database: INLINECODE1
CODEBLOCK1
Sync Setup (Optional)
CODEBLOCK2
Quick Start
CODEBLOCK3
Commands
Adding Notes
| Command | Description |
|---|
| INLINECODE2 | Add note to book |
| INLINECODE3 |
Add from stdin (pipe-friendly) |
|
quick <content> | Quick add to 'inbox' book |
Retrieving Notes
| Command | Description |
|---|
| INLINECODE5 | List books or notes in book |
| INLINECODE6 |
Get specific note by index |
|
find <query> | Full-text search (use
-b <book> to filter) |
|
recent [n] | Show n most recent notes (default: 10) |
|
books | List all books |
|
export [book] | Export notes as JSON |
|
config | Show config and paths |
Managing Notes
| Command | Description |
|---|
| INLINECODE13 | Edit note by ID |
| INLINECODE14 |
Move note to different book |
|
remove <id> | Delete note |
|
remove-book <book> | Delete entire book |
Sync & Info
| Command | Description |
|---|
| INLINECODE17 | Sync with Dnote server |
| INLINECODE18 |
Show status and stats |
|
config | Show config file locations |
|
login | Authenticate with server (native CLI) |
|
logout | Remove credentials (native CLI) |
Collection IDs / Books
- - Use any book name (auto-created on first use)
- Common book names:
cli, docker, git, ideas, snippets, journal, INLINECODE28 - Books are created automatically when you add the first note
Examples
CODEBLOCK4
Using Notes in AI Context
Retrieve relevant notes for the current task:
CODEBLOCK5
Auto-capture useful information:
CODEBLOCK6
Patterns
Daily Journal
CODEBLOCK7
Code Snippets
CODEBLOCK8
Command Reference
CODEBLOCK9
Integration with Workflows
The skill provides helper functions for common patterns:
| Function | Use Case |
|---|
| INLINECODE29 | Find relevant context before answering |
| INLINECODE30 |
Save useful info discovered during task |
|
dnote:recent [n] | Review recently captured notes |
|
dnote:export-book <book> | Load entire book into context |
Config File
Create ~/.config/dnote/dnoterc:
CODEBLOCK10
Tips
- - Use specific book names:
python, bash, docker, kubernetes, INLINECODE38 - Search is full-text: Works across all note content
- Indexes are 1-based: First note is
1, not INLINECODE40 - Pipes work great: Capture command output directly
- Sync optional: Works fully offline, sync when ready
Direct Dnote CLI
For operations not covered:
CODEBLOCK11
Docs: https://www.getdnote.com/docs/cli/
Dnote 笔记
使用 Dnote CLI 管理个人知识库。
设置
安装
bash
macOS/Linux 自动安装
curl -s https://www.getdnote.com/install | sh
或使用 Homebrew
brew install dnote
或从以下地址下载:https://github.com/dnote/dnote/releases
配置
Dnote 遵循 XDG 目录规范:
- - 配置:~/.config/dnote/dnoterc
- 数据库:~/.local/share/dnote/dnote.db
bash
示例配置文件 (~/.config/dnote/dnoterc)
editor: vim
apiEndpoint: https://api.dnote.io
enableUpgradeCheck: true
或仅使用本地模式(无同步)
无需配置 - 默认离线工作
同步设置(可选)
bash
跨设备同步
dnote login
或仅本地模式(无需设置)
快速开始
bash
向笔记本添加笔记
{baseDir}/scripts/dnote.sh add cli git rebase -i HEAD~3
通过管道向笔记输入内容
echo docker system prune | {baseDir}/scripts/dnote.sh add docker
搜索所有笔记
{baseDir}/scripts/dnote.sh find docker compose
查看最近笔记
{baseDir}/scripts/dnote.sh recent
列出所有笔记本
{baseDir}/scripts/dnote.sh books
查看笔记本中的笔记
{baseDir}/scripts/dnote.sh view cli
获取特定笔记
{baseDir}/scripts/dnote.sh get cli 1
命令
添加笔记
| 命令 | 描述 |
|---|
| add <book> <content> | 向笔记本添加笔记 |
| add-stdin <book> |
从标准输入添加(支持管道) |
| quick
| 快速添加到收件箱笔记本 |
检索笔记
| 命令 | 描述 |
|---|
| view [book] | 列出笔记本或笔记本中的笔记 |
| get <book> <index> |
按索引获取特定笔记 |
| find | 全文搜索(使用 -b 过滤) |
| recent [n] | 显示最近 n 条笔记(默认:10) |
| books | 列出所有笔记本 |
| export [book] | 以 JSON 格式导出笔记 |
| config | 显示配置和路径 |
管理笔记
| 命令 | 描述 |
|---|
| edit <id> [content] | 按 ID 编辑笔记 |
| move <id> <book> |
将笔记移动到其他笔记本 |
| remove | 删除笔记 |
| remove-book | 删除整个笔记本 |
同步与信息
| 命令 | 描述 |
|---|
| sync | 与 Dnote 服务器同步 |
| status |
显示状态和统计信息 |
| config | 显示配置文件位置 |
| login | 通过服务器进行身份验证(原生 CLI) |
| logout | 移除凭据(原生 CLI) |
集合 ID / 笔记本
- - 使用任意笔记本名称(首次使用时自动创建)
- 常用笔记本名称:cli、docker、git、ideas、snippets、journal、inbox
- 添加第一条笔记时自动创建笔记本
示例
bash
捕获 Shell 单行命令
{baseDir}/scripts/dnote.sh add cli grep -r pattern . --include=*.py
从命令输出保存
git log --oneline -10 | {baseDir}/scripts/dnote.sh add git
快速捕获到收件箱
{baseDir}/scripts/dnote.sh quick 记得更新 README
搜索 Docker 命令
{baseDir}/scripts/dnote.sh find docker compose
在特定笔记本中搜索
{baseDir}/scripts/dnote.sh find config -b cli
获取格式化笔记供 AI 使用
{baseDir}/scripts/dnote.sh get cli 1 --format raw
导出笔记本进行处理
{baseDir}/scripts/dnote.sh export cli --json | jq .notes[].content
跨所有笔记本的最近笔记
{baseDir}/scripts/dnote.sh recent 20
搜索并导出结果
{baseDir}/scripts/dnote.sh find postgres --json
在 AI 上下文中使用笔记
检索当前任务的相关笔记:
bash
搜索相关知识
{baseDir}/scripts/dnote.sh find python argparse
获取特定笔记的完整内容
{baseDir}/scripts/dnote.sh get cli 5
导出整个笔记本供上下文使用
{baseDir}/scripts/dnote.sh export python
自动捕获有用信息:
bash
保存发现的解决方案
{baseDir}/scripts/dnote.sh add docker 多阶段构建可减小镜像体积
保存带时间戳的信息
{baseDir}/scripts/dnote.sh add journal $(date): 将 v2.3 部署到生产环境
模式
每日日志
bash
创建带日期的条目
{baseDir}/scripts/dnote.sh add journal $(date +%Y-%m-%d): 开始处理功能 X
查看最近条目
{baseDir}/scripts/dnote.sh view journal | head -20
代码片段
bash
保存带描述的代码
{baseDir}/scripts/dnote.sh add python 列表推导式:[x for x in items if x > 0]
需要时搜索
{baseDir}/scripts/dnote.sh find 列表推导式
命令参考
bash
构建 CLI 参考
curl -s https://api.example.com | {baseDir}/scripts/dnote.sh add api
快速查找
{baseDir}/scripts/dnote.sh view api
与工作流集成
该技能为常见模式提供辅助函数:
| 函数 | 使用场景 |
|---|
| dnote:search <query> | 在回答前查找相关上下文 |
| dnote:capture <book> <content> |
保存任务中发现的有用信息 |
| dnote:recent [n] | 查看最近捕获的笔记 |
| dnote:export-book | 将整个笔记本加载到上下文中 |
配置文件
创建 ~/.config/dnote/dnoterc:
yaml
editor: code --wait # 或 vim、nano、subl -w
apiEndpoint: https://api.dnote.io
enableUpgradeCheck: true
提示
- - 使用具体的笔记本名称:python、bash、docker、kubernetes、ideas
- 搜索为全文搜索:可搜索所有笔记内容
- 索引从 1 开始:第一条笔记为 1,而非 0
- 管道功能强大:直接捕获命令输出
- 同步可选:完全离线工作,需要时再同步
直接使用 Dnote CLI
对于未涵盖的操作:
bash
交互式编辑
dnote edit 5
重命名笔记本
dnote edit oldname -n newname
完全同步
dnote sync --full
自定义数据库路径
dnote --dbPath /path/to/custom.db view
文档:https://www.getdnote.com/docs/cli/