solsuk-grago

TotalClaw 作者 totalclaw

将研究与数据抓取任务委托给本地 LLM(Ollama 等),节省 Token 并在本机处理数据。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~solsuk-grago
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~solsuk-grago/file -o solsuk-grago.md
## 概述(中文)

将研究与数据抓取任务委托给本地 LLM(Ollama 等),节省 Token 并在本机处理数据。

## 技能正文

# Grago

**将研究和数据抓取任务委托给免费的本地 LLM。节省 token。用你自己的机器。**

Grago 在你的 OpenClaw 代理与无法原生使用工具的本地 LLM(Ollama、llama.cpp 等)之间架起桥梁。它运行 shell 脚本,从网络、API 和本地文件抓取实时数据 —— 然后将结果连同一个聚焦的提示词一起管道传入你的本地模型。

你的云端模型保持敏锐。你的本地机器承担繁重工作。你的 token 账单随之下降。

## ⚠️ 安全模型

**Grago 会执行 shell 命令。** 这是有意为之的 —— 这是让无工具的本地 LLM 访问外部数据的唯一方式。

**适用于:** 受信任的单用户环境(你自己的 Mac Mini、VPS、工作站)  
**不适用于:** 多租户系统、公共 API、不受信任的代理

如果你的 OpenClaw 代理通过提示词注入被攻陷,Grago 可能会执行任意命令。这是换取免费本地算力所付出的代价。完整细节请阅读仓库中的 `SECURITY.md`。

## 何时使用此技能

在以下情况使用 Grago:
- 你需要抓取实时数据(网页、API、RSS 订阅源、日志)
- 任务偏研究性质,无需用到你的主模型
- 你希望将数据保留在自己的机器上(隐私)
- 你希望通过将分析任务卸载给本地 LLM 来节省 token

## 工作原理

1. **抓取(Fetch)** — Shell 脚本拉取实时数据(curl、jq、grep 等)
2. **分析(Analyze)** — 结果连同提示词一起管道传入你的本地 Ollama 模型
3. **返回(Return)** — 结构化的分析结果返回给你的 OpenClaw 代理

## 用法

```bash
# Fetch a URL and analyze locally
grago fetch "https://example.com" \
  --analyze "Summarize the key points" \
  --model gemma2

# Multi-source research from a YAML config
grago research \
  --sources sources.yaml \
  --prompt "What are the main themes across these sources?"

# Pipe any shell command into your local model
grago pipe \
  --fetch "curl -s https://api.example.com/data" \
  --transform "jq .results" \
  --analyze "Identify trends and flag outliers"
```

## 配置

配置文件:`~/.grago/config.yaml`

```yaml
default_model: gemma2        # Your preferred Ollama model
timeout: 30                  # Seconds per fetch
max_input_chars: 16000       # Input truncation limit
output_format: markdown      # markdown | json | text
```

## 要求

- 本地已安装并运行 Ollama(install.sh 会处理这一点)
- Ollama 中至少已拉取一个模型(gemma2、mistral、llama3 等)
- bash、curl、jq

## 安装

```bash
git clone https://github.com/solsuk/grago.git
cd grago && ./install.sh
```

## 给代理的说明

- 出于可靠性考虑,优先使用 `pipe` 模式而非 `fetch --analyze`(可避免 Ollama TTY 加载动画的问题)
- 默认模型为 `~/.grago/config.yaml` 中设置的模型;可在每次调用时用 `--model` 覆盖
- 输入在发送给本地模型之前会被截断至 `max_input_chars`
- 本地模型的响应可能较慢(视硬件和模型大小为 5–30 秒)—— 这是正常现象
- Grago 用于 **研究和抓取的委托** —— 而非用于需要你主模型推理能力的任务