用途:capture 是 gbrain 的单一录入入口,用于保存一条想法、笔记或转录片段。用户说“保存这个”“记到 brain 里”时使用它,而不是 gbrain put 或先 commit 再 sync。
主要能力:输入支持内联参数、--file PATH 或 --stdin;输出为 brain 数据库中的页面和 <sync.repo_path>/<slug>.md 磁盘文件,并在 stdout 打印回执。保存后页面可立即通过 gbrain query、gbrain search 或 MCP 智能体查询。相同内容生成相同 slug,守护进程有 24 小时内容哈希去重。默认 slug 为 inbox/YYYY-MM-DD-<hash8>,默认类型 note,frontmatter 会标记 captured_via: capture-cli 与 captured_at,标题取正文首个非空行并截断至 80 字符。
用法示例: gbrain capture "the thought I want to remember" gbrain capture --file ./notes/today.md echo "from a pipe" | gbrain capture --stdin gbrain capture "..." --slug daily/2026-05-21 gbrain capture "..." --type idea --source voice-whisper gbrain capture "..." --quiet gbrain capture "..." --json
限制与注意:不要用 capture 批量导入大量文件,应使用 gbrain sync 或 gbrain import;带作者与出版信息的文章链接、会议转录应走专门技能。不要内联传递密钥,以免进入 shell 历史。退出码 10 表示写入待定,应轮询 gbrain write-request <request_id>,不要重复 capture。密钥扫描或 slug 拒绝时不会保存,不要修改内容绕过扫描。MCP 下 source_binding_required 或 insufficient_scope 表示当前连接无写入权限,需由 brain 主机操作者授权。