noteTb: 248
This data as json
| id | user_id | content | tags | created_at | updated_at | enable | pinned | folder_id | comment | position | visibility |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 248 | 1 1 | # Goose CLI 安装配置经验 作者:Manus 版本:1.0 --- ## 一、什么是 Goose Goose 是 Block 公司(Square 母公司)开源的 AI Agent CLI 工具。 不只是聊天,能自主执行 shell 命令、读写文件、调 API,类似于命令行版的 Manus。 GitHub:https://github.com/block/goose --- ## 二、安装 ```bash # 下载最新版(Linux x86_64) curl -fsSL https://github.com/block/goose/releases/latest/download/goose-x86_64-unknown-linux-gnu.tar.gz -o /tmp/goose.tar.gz # 解压并安装 cd /tmp && tar -xzf goose.tar.gz cp /tmp/goose /usr/local/bin/goose chmod +x /usr/local/bin/goose # 验证版本 goose --version # 输出:1.33.1 ``` --- ## 三、配置(使用 DeepSeek V4 Flash) Goose 配置文件位置:`~/.config/goose/` 有两个关键文件: - `config.yaml`:provider、model、extensions 配置 - `secrets.yaml`:API Key(单独存放,权限 600) ### config.yaml ```yaml GOOSE_PROVIDER: "openai" GOOSE_MODEL: "deepseek-chat" OPENAI_HOST: "https://api.deepseek.com" extensions: developer: enabled: true type: platform name: developer description: Write and edit files, and execute shell commands display_name: Developer bundled: true available_tools: [] todo: enabled: true type: platform name: todo description: Enable a todo list for goose so it can keep track of what it is doing display_name: Todo bundled: true available_tools: [] ``` ### secrets.yaml(权限必须设为 600) ```yaml OPENAI_API_KEY: sk-1685481edf7f4d6e89d49a25973e6e94 ``` ```bash chmod 600 ~/.config/goose/secrets.yaml ``` 注意:DeepSeek 的模型名 `deepseek-chat` 对应的就是 V4 Flash(API 返回 model 字段为 `deepseek-v4-flash`)。 --- ## 四、使用方法 ```bash # 交互式对话(推荐,SSH 进服务器后直接用) goose session # 单次执行任务(非交互) goose run -t "帮我检查 nginx 配置是否有问题" # 执行指令文件 goose run -i instructions.txt # 恢复上次会话 goose session --resume # 查看所有会话 goose session list ``` --- ## 五、踩坑记录 ### 坑1:API Key 放在 config.yaml 里不生效 现象:config.yaml 里写了 `OPENAI_API_KEY`,运行时报 401 Authentication error 原因:Goose 把 API Key 单独存在 `secrets.yaml`,不从 config.yaml 读取密钥 解决:创建 `~/.config/goose/secrets.yaml`,把 key 写进去,并 `chmod 600` ### 坑2:OPENAI_BASE_URL 不是正确的变量名 现象:设置 `OPENAI_BASE_URL=https://api.deepseek.com/v1` 不生效 原因:Goose 用的是 `OPENAI_HOST`,不是 `OPENAI_BASE_URL` 解决:改为 `OPENAI_HOST: "https://api.deepseek.com"`(不需要加 /v1) ### 坑3:goose doctor 会启动交互式会话,SSH 非交互模式下卡住 现象:`goose doctor` 命令在 SSH 中执行后没有返回 原因:doctor 命令会启动一个完整的 goose session(交互式) 解决:用 `goose run -t "问题"` 替代,或者直接 SSH 进去交互使用 --- ## 六、服务器信息 | 项目 | 值 | |---|---| | 服务器 IP | 8.219.6.216 | | Goose 版本 | 1.33.1 | | 安装路径 | /usr/local/bin/goose | | 配置目录 | /root/.config/goose/ | | 使用模型 | deepseek-chat (DeepSeek V4 Flash) | | API Provider | DeepSeek (https://api.deepseek.com) | | [] | 2026-05-12 13:59:54 | 2026-05-12 13:59:54 | T | F | source=simplenote; source_id=24e99c71-4cab-4557-9dce-a7bf240bd3d4 | 26 | public |