princezuda/safeclaw

GitHub: princezuda/safeclaw

SafeClaw 是 OpenClaw 的零成本本地替代方案,通过规则引擎与传统 ML 技术实现 90% 功能而无需 LLM,默认离线运行、确定性输出且无提示注入风险。

Stars: 105 | Forks: 10

# SafeClaw 🐾 **OpenClaw 的零成本替代方案。无需 LLM(可选),无强制 API 费用,最小攻击面,可在任何机器上运行。** 当 OpenClaw 用户在 API token 上每天燃烧 [$200](https://www.notebookcheck.net/Free-to-use-AI-tool-can-burn-through-hundreds-of-Dollars-per-day-OpenClaw-has-absurdly-high-token-use.1219925.0.html)、每月燃烧 [$3,600](https://dev.to/thegdsks/i-tried-the-free-ai-agent-with-124k-github-stars-heres-my-500-reality-check-2885) 时,SafeClaw 利用传统编程——基于规则的解析、ML 流水线和本地优先工具——提供 90% 的功能。**您的 API 账单:$0。永久免费。** 如果您选择使用语言模型进行博客、编程和研究,那么是的,您会有账单,但在 SafeClaw 上,您也可以在没有任何语言模型的情况下完成所有这些工作。我们只是同时提供了两种选择。 SafeClaw 使用 VADER、spaCy、sumy、YOLO、Whisper、Piper 和其他久经考验的 ML 技术,而非生成式 AI。结果是:确定性、可预测、私密且完全免费运行。 ## 为什么选择 SafeClaw? | | SafeClaw | OpenClaw | |---|---|---| | **默认月度成本** | **$0** | $100–$3,600+ | | **需要 LLM** | 否(AI 博客、编程和研究均提供无 LLM 选项,此为可选) | 是 | | **提示注入风险** | **极低**(仅当您访问的 URL 具有恶意时) | 是(无处不在) | | **离线工作** | **是**,所有默认功能,除天气外 | 否 | | **在任何机器上运行** | **是**(Linux、macOS、Windows) | 需要强大的硬件或云 API | | **确定性输出** | **是** | 否(LLM 响应会变化) | | **隐私** | **默认本地**(仅当您请求或设置 llm 时才外部连接,例如天气) | 数据总是发送给 API 提供商 | ## 完整对比:SafeClaw vs OpenClaw | 功能 | SafeClaw | OpenClaw | |---|---|---| | 自托管 | ✅ | ✅ | | 跨平台(Linux、macOS、Windows) | ✅ | ✅ | | 无需 AI/LLM | ✅ | ❌ | | 离线可用 | ✅ | ❌ | | 零 API 成本 | ✅ | ❌ | | 提示注入风险 | **极低**(仅 LLM 研究) | 无处不在 | | 隐私优先 | ✅(默认本地) | ✅ | | 语音(STT/TTS) | ✅(Whisper + Piper,本地) | ✅(ElevenLabs,付费 API) | | 智能家居控制 | ✅ | ✅(通过 skills) | | 蓝牙控制 | ✅ | ❌ | | 网络扫描 | ✅ | ❌ | | 社交媒体摘要 | ✅(Twitter、Mastodon、Bluesky) | ❌(需要单独的 skills) | | 多渠道 | ✅(CLI、Telegram、Webhooks) | ✅(13+ 平台) | | 网页爬取 | ✅ | ✅ | | 摘要生成 | ✅(抽取式) | ✅(AI 生成) | | RSS/新闻源 | ✅(50+ 源) | ✅(通过 skills) | | 情感分析 | ✅(VADER) | ✅(AI) | | 邮件集成 | ✅ | ✅ | | 日历支持 | ✅ | ✅ | | 文档阅读 | ✅ | ✅ | | 桌面通知 | ✅ | ✅ | | 物体检测 | ✅(YOLO) | ❌ | | OCR | ✅(Tesseract) | ❌ | | Cron 作业 | ✅ | ✅ | | Webhooks | ✅ | ✅ | | 插件系统 | ✅ | ✅(5,700+ skills) | | 自由形式聊天 | ❌ | ✅ | | 使用或不使用 LLM 进行博客 | ✅ 无 llm(抽取式标题),有 LLM 时为 AI 博客 | ❌(总是需要 AI) | | 博客发布(WordPress、Joomla、SFTP) | ✅ | ❌(需要插件) | | 写作风格学习 | ✅(统计特征分析) | ❌ | | 学术研究(arXiv、Scholar) | ✅(免费,无 API key) | ❌ | | Wolfram Alpha | ✅(计算知识) | ❌ | | 简单设置(输入 key 或本地)简单的 telegram 和博客设置 | ✅(一条命令) | ❌ | | 从错误中自动学习 | ✅(单词转数字、拼写纠正) | ❌ | | 研究流水线 | ✅(两阶段,LLM 可选) | ✅(仅 AI) | | 代码模板与工具 | ✅(7 个模板,离线工具) | ❌(需要 AI) | | 自动博客调度 | ✅(基于 cron) | ❌ | | 任务感知提示 | ✅(按任务路由 LLM) | ✅ | | 命令链 | ✅(“阅读邮件并在下午 3 点提醒我”) | ✅ | | 自主多步任务 | ❌ | ✅ | | 自编写 skills | ❌ | ✅ | | 浏览器自动化 | ❌ | ✅ | ## 功能 ### 🗣️ 语音控制 * **语音转文字** — Whisper STT 本地运行,无需云转录 * **文字转语音** — Piper TTS 提供自然语音输出,完全离线 * **语音优先工作流** — 像与任何助手交谈一样与 SafeClaw 对话 ### 🏠 智能家居与设备控制 * **智能家居集成** — 控制您的联网设备 * **蓝牙设备控制** — 发现和管理蓝牙设备 * **网络扫描** — 在本地网络上发现设备 ### 📱 社交媒体情报 * **Twitter/X 摘要** — 添加账户,获取其活动摘要 * **Mastodon 摘要** — 关注并摘要联邦宇宙账户 * **Bluesky 摘要** — 跟踪并摘要 Bluesky 信息流 * 公开内容无需 API token ### 📰 RSS 新闻聚合 * **50+ 预设源** — Hacker News、Ars Technica、BBC、Reuters、Nature 等 * **8 个类别** — 科技、世界、科学、商业、编程、安全、Linux、AI * **自定义源** — 导入任何 RSS/Atom 源 * **自动摘要** — 使用 sumy 进行抽取式摘要(无 AI) * **按用户偏好** — 自定义您的新闻来源 ### 🔒 隐私与安全 * **默认自托管** — 您的数据保留在本地,除非您明确请求外部信息(如天气) * **无需 API keys** — 核心功能完全离线工作 * **无云 AI 依赖** — 不向 OpenAI、Anthropic 或 Google 发送 token * **极小的提示注入面** — 核心功能(博客、编程、命令)使用基于规则的解析,完全不涉及 LLM,因此对提示注入免疫。研究和深度分析*可以*选择性地使用 LLM 来综合来源——启用时,来自外部来源的内容(arXiv 摘要、网页)会被输入到 LLM,这带有极小的提示注入风险。第一阶段研究(收集/摘要)从不使用 LLM,是安全的。我们对这一权衡保持透明。 ### 📡 多渠道 * **CLI** — 带有 Rich 格式化的交互式命令行 * **Telegram** — 完整的机器人集成 * **Discord** — 即将推出 * **Slack** — 即将推出 * **Webhooks** — 入站和出站支持 ### ⚡ 自动化 * **命令链** — 自然组合动作:“阅读我的邮件并在下午 3 点提醒我” * **网页爬取** — 带有深度限制和域名过滤的异步爬取 * **摘要生成** — LexRank、TextRank、LSA、Luhn 算法 * **提醒** — 使用 dateparser 进行自然语言时间解析 * **Shell 命令** — 沙盒化的命令执行 * **文件操作** — 搜索、列出、读取文件 * **Cron 作业** — 计划任务自动化 * **每日简报** — 天气、提醒、来自您订阅源的资讯 ### 📊 文本分析 * **VADER 情感** — 基于词典的情感分析 * **关键词提取** — TF-IDF 风格提取 * **可读性评分** — Flesch-Kincaid 指标 ### 📧 邮件集成 * **IMAP 支持** — 从 Gmail、Outlook、Yahoo 读取邮件 * **SMTP 支持** — 发送邮件 * **标准协议** — 无需 API keys ### 📅 日历支持 * **ICS 文件** — 导入和解析 .ics 日历文件 * **CalDAV** — 连接 Google Calendar、iCloud(可选) * **事件过滤** — 今天、即将到来、按日期范围 ### 📄 文档阅读 * **PDF** — 使用 PyMuPDF 提取文本 * **DOCX** — Microsoft Word 文档 * **HTML/Markdown/TXT** — 纯文本格式 ### 🔔 通知 * **桌面通知** — 跨平台(macOS、Windows、Linux) * **优先级** — 低、普通、高、紧急 * **速率限制** — 防止通知轰炸 ### 👁️ 可选 ML 功能 * **NLP** — spaCy 命名实体识别(~50MB) * **视觉** — YOLO 物体检测 + OCR(~2GB) * **OCR** — Tesseract 图像文本提取(轻量级) ### 🔬 真实研究来源 * **arXiv** — 搜索 CS、数学、物理、生物学等领域的学术论文(免费,无 API key) * **Semantic Scholar** — 带有引用计数和作者信息的学术论文(免费,无 API key) * **Wolfram Alpha** — 用于事实性答案和计算的计算知识引擎 * **智能路由** — `research <主题>` 一次性搜索所有来源,或单独使用 `research arxiv`、`research scholar`、`research wolfram` * **两阶段流水线** — 第一阶段从真实研究来源收集($0),第二阶段进行可选的 LLM 深度分析 ### 🤖 超简单的 AI 设置 * **只需输入您的 key** — `setup ai sk-ant-your-key` 即可完成。自动检测 Anthropic、OpenAI、Google、Groq * **或者走本地路线** — `setup ai local` 自动安装 Ollama、下载模型、配置 SafeClaw * **模型预设** — `setup ai local small`(1.3GB)、`setup ai local coding`、`setup ai local writing` * **状态检查** — `setup ai status` 显示当前配置 * **零配置文件** — 无需编辑 YAML,命令会为您完成 ### 🧠 智能输入学习 * **单词转数字** — 输入“research select one two three”,SafeClaw 理解为“1 2 3” * **拼写自动纠正** — “remaind me” → “remind me”,“summerize” → “summarize” * **缩写** — “tmrw” → “tomorrow”,“hrs” → “hours”,“mins” → “minutes” * **从错误中自动学习** — 如果命令失败且您重新输入正确,SafeClaw 会记住映射以备下次使用 * **无需 AI** — 所有纠正都是基于规则且确定性的 ### 💬 可选 LLM 命令理解 (NLU) 不想死记命令语法?启用 NLU 桥接,直接自然交谈: ``` # 无 NLU —— 您必须知道确切的短语: remind me tomorrow at 9am to call the dentist # 启用 NLU —— 任意措辞均有效: hey, can you remind me to call the dentist tomorrow morning at 9? I need a reminder for tomorrow at 9 to call the dentist put a 9am reminder tomorrow: dentist call ``` NLU 桥接使用您配置的 LLM(任意提供商)作为**纯翻译器**: 它将您输入的内容转换为最匹配的 SafeClaw 命令字符串, 然后像往常一样通过相同的基于规则的解析器。 LLM 永远不会直接执行任何操作——它只是重述您的输入。 在 `config/config.yaml` 中启用: ``` safeclaw: nlu: enabled: true provider: my-claude # optional — uses active provider if omitted temperature: 0.0 # deterministic output show_translation: true # shows "_(understood as: remind me ...)_" prefix ``` **隐私提示:** 当启用 NLU 时,无法识别的命令会发送到您配置的 LLM 提供商。 已识别的命令(绝大多数)仍然完全在本地处理,零 token 消耗。 ### ✍️ 写作风格分析器 * **学习您的语调** — 向 SafeClaw 投喂您的作品,它会构建一个包含 35 个指标的特征画像(句子长度、词汇、正式度、缩写、结构、常用词等) * **持久记忆** — 您的画像存储在 SQLite 中,并随着每个样本不断改进 * **LLM 提示生成** — 画像可转换为适用于任何 LLM 提供商的写作风格指令 * **无需 AI** — 所有分析均在本地使用 NLTK、VADER 和统计方法 ### 🔬 研究流水线 * **两阶段工作流** — 第一阶段并摘要来源(无 LLM,$0)。第二阶段进行可选的 LLM 深度分析 * **来源收集** — 搜索 RSS 源并爬取 URL,使用 Sumy 自动摘要 * **来源选择** — 在花费任何 token 之前,您挑选重要的来源 * **深度分析** — 可选的 LLM 分析选定的来源并提供结构化输出 ### 💻 编程工具箱 * **7 个模板** — python-script、python-class、python-test、fastapi-endpoint、html-page、dockerfile、github-action * **代码统计** — 任意目录下按语言统计的代码行数 * **正则测试器** — 测试并解释正则表达式,带有匹配高亮 * **代码搜索** — 跨代码文件进行正则搜索 * **文件差异** — 并排比较两个文件 * **LLM 驱动(可选)** — 生成、解释、审查、重构、编写文档代码 ### 📅 自动博客调度器 * **Cron 调度** — 使用 cron 表达式安排周期性博客生成 * **源类别** — 自动从特定 RSS 类别拉取内容 * **异步安全** — 检测调度器类型不匹配并清晰警告,而非静默失败 ### 🧠 智能提示构建器 * **任务感知提示** — 为博客、研究和编程任务生成优化的提示 * **写作画像集成** — 自动将您的写作风格注入博客提示 * **提供商路由** — 每种任务类型可以使用不同的 LLM 提供商 * **流程图** — `show me the flow` 以 ASCII 艺术显示完整架构 ### 🥚 彩蛋 * 内置个性和隐藏惊喜——因为工具应该有趣 ### 📝 博客——两种模式 **确定性博客(无 AI,无成本):** * **撰写博客新闻** — 使用自然语言添加条目:“write blog news We shipped faster crawling today.” * **爬取网站获取内容** — “crawl https://example.com for title content”,“crawl example.com for body content” * **自动生成标题** — 抽取式摘要挑选最具代表性的内容作为您的标题。没有 LLM,只有数学。 * **纯 .txt 输出** — 您的博客是一个简单的文本文件,可以在任何地方分享 **AI 博客(可选,多提供商):** * **从主题生成完整文章** — “ai blog generate about sustainable technology” * **重写、扩展、润色** — “ai rewrite blog”,“ai expand blog” * **AI 标题和 SEO** — “ai headlines”,“ai blog seo” * **11 个提供商** — 5 个本地(Ollama、LM Studio、llama.cpp、LocalAI、Jan)+ 6 个云端(OpenAI、Anthropic、Google、Mistral、Groq、自定义) * **本地 AI = 免费 + 私密** — 运行 Ollama 或 LM Studio 无需付费 **多平台发布:** * **WordPress** — REST API v2,支持 Application Passwords、JWT 或 Basic Auth * **Joomla** — Web Services API(Joomla 4+) * **SFTP** — 将 HTML 上传到任意服务器 * **通用 API** — POST JSON 到任意端点 * **首页管理** — 在任意目标上设置哪篇文章是主页 ## 安装 ### 使用 pipx(推荐) ``` # 如需安装 pipx # Linux: sudo apt install pipx # macOS: brew install pipx pipx ensurepath # 安装 SafeClaw pipx install safeclaw ``` ### 使用 pip 和虚拟环境 ``` # 创建并激活 venv python3 -m venv ~/.safeclaw-venv source ~/.safeclaw-venv/bin/activate # 安装 SafeClaw pip install safeclaw ``` ### 从源码安装 ``` git clone https://github.com/princezuda/safeclaw.git cd safeclaw pip install -e . ``` ### 可选 ML 功能 ``` # NLP - spaCy named entity recognition (~50MB) pip install safeclaw[nlp] # Vision - YOLO object detection + OCR (~2GB, requires PyTorch) pip install safeclaw[vision] # OCR only - 图像文本提取 (轻量级, requires Tesseract) pip install safeclaw[ocr] # 所有 ML 功能 pip install safeclaw[ml] ``` **系统要求:** Python 3.11+,约 50MB 磁盘空间(基础版),视觉功能额外需约 2GB。支持 Linux、macOS 和 Windows。 ## 快速开始 ``` # 启动交互模式 safeclaw # 或启用 verbose 日志 safeclaw --verbose ``` ### 示例命令 ``` > news # Get headlines from enabled feeds > news tech # Get tech news only > news categories # See all available categories > news enable science # Enable science feeds > add feed https://blog.example.com/rss # Add custom feed > summarize https://news.ycombinator.com > crawl https://example.com > remind me to call mom tomorrow at 3pm > morning briefing # Includes news from your feeds! > check my email # View inbox (requires setup) > read my email and remind me at 3pm # Chain commands naturally > calendar today # Today's events from .ics > analyze sentiment of this text # VADER sentiment analysis > read document.pdf # Extract text from documents > write blog news We shipped a new feature today. # Blog entry (no AI) > crawl https://example.com for title content # Crawl for blog > blog title # Generate title from entries > publish blog # Save blog as .txt > blog # Interactive blog menu (AI or manual) > ai blog generate about home automation # AI writes a full post > ai rewrite blog # AI polishes your draft > publish blog to wp://mysite.com admin pass # Publish inline — no config needed > publish blog to my-wordpress # Or use a saved target from config > style learn I write concise, punchy posts. # Teach SafeClaw your style > style profile # View your writing profile > research WebAssembly performance # Search arXiv + Scholar + Wolfram > research arxiv quantum computing # Search arXiv papers directly > research scholar machine learning # Search Semantic Scholar > research wolfram integrate x^2 # Ask Wolfram Alpha > research select 1,2,3 # Pick sources to analyze > setup ai sk-ant-your-key-here # Enter your Anthropic key, done > setup ai local # Or auto-install Ollama (free!) > setup ai status # Check what's configured > code template python-class UserAuth Auth handler # Generate boilerplate > code templates # List all 7 templates > code stats src/ # Lines of code by language > code regex \d{3}-\d{4} test 555-1234 # Test regex > auto blog list # View scheduled auto-blogs > show me the flow # Architecture diagram > help ``` ### CLI 命令 ``` # 新闻 safeclaw news # Headlines from enabled categories safeclaw news tech # Tech news only safeclaw news --categories # List all categories safeclaw news world -n 20 # 20 world news headlines safeclaw news --add https://blog.example.com/rss --name "My Blog" safeclaw news -s # With auto-summarization # 摘要 safeclaw summarize https://example.com/article -n 5 # 爬取 safeclaw crawl https://example.com --depth 2 # 文本分析 safeclaw analyze "This product is amazing! I love it." safeclaw analyze document.txt --no-readability # 文档 safeclaw document report.pdf safeclaw document paper.docx --summarize -n 5 safeclaw document notes.md --output extracted.txt # 日历 safeclaw calendar import --file calendar.ics safeclaw calendar today safeclaw calendar upcoming --days 14 # 博客 —— 确定性 (无 AI) safeclaw blog help # Blog feature guide safeclaw blog write "New crawling features shipped today." safeclaw blog show # View draft and published posts safeclaw blog title # Generate title from entries safeclaw blog publish # Save blog as .txt safeclaw blog publish "My Custom Title" # Publish with custom title # 博客 —— AI 驱动 (config 中需要 ai_providers) safeclaw blog # Interactive menu (AI or manual) # ai blog generate about # AI 撰写完整博文 # ai rewrite blog # AI 润色草稿 # ai expand blog # AI 扩充篇幅 # ai headlines # AI 生成标题选项 # ai blog seo # AI 生成 SEO 元数据 # 发布 (config 中需要 publish_targets) # publish blog to my-wordpress # 发布到特定目标 # publish blog to all # 发布到所有目标 # set front page 123 on my-wp # 设置目标主页 # 写作风格 safeclaw style learn "I write short, punchy sentences. No fluff." safeclaw style profile # View your writing profile # 研究 (arXiv, Semantic Scholar, Wolfram Alpha) safeclaw research "quantum computing" # Search all sources safeclaw research arxiv "transformer models" # arXiv papers safeclaw research scholar "deep learning" # Semantic Scholar safeclaw research wolfram "integrate x^2" # Wolfram Alpha safeclaw research sources # View gathered sources safeclaw research select 1,2,3 # Pick sources for deep analysis safeclaw research analyze # LLM deep dive (optional) # AI 设置 (非常简单) safeclaw setup ai sk-ant-your-key # Enter Anthropic key, done safeclaw setup ai sk-your-key # Or OpenAI key safeclaw setup ai local # Or auto-install Ollama (free) safeclaw setup ai local coding # Install coding-optimized model safeclaw setup ai status # Check your setup # 编程工具箱 safeclaw code templates # List available templates safeclaw code template python-class UserAuth "Auth handler" safeclaw code stats src/ # Lines of code by language safeclaw code search "TODO" src/ # Regex search code files safeclaw code regex "\d{3}-\d{4}" test "555-1234" safeclaw code diff file1.py file2.py # 自动博客 safeclaw auto blog setup # Interactive setup wizard safeclaw auto blog list # View scheduled auto-blogs safeclaw auto blog remove my-blog # Remove a schedule # Flow safeclaw flow # Architecture diagram # Webhooks safeclaw webhook --port 8765 # 初始化 config safeclaw init ``` ## 配置 SafeClaw 在 `config/config.yaml` 中查找配置: ``` safeclaw: name: "SafeClaw" language: "en" timezone: "UTC" channels: cli: enabled: true webhook: enabled: true port: 8765 telegram: enabled: false token: "YOUR_BOT_TOKEN" actions: shell: enabled: true sandboxed: true timeout: 30 files: enabled: true allowed_paths: - "~" ``` ## 写作风格与研究指南 ### 写作风格分析器 SafeClaw 通过分析文本来学习您的写作方式。它构建一个统计画像——无需 AI。 ``` > style learn I've been thinking about this for a while. The tech industry loves to overcomplicate things. Simple solutions work better. Profile updated (1 sample analyzed). > style learn Here's what I learned from shipping 50 side projects: most of them failed. And that's completely fine! Profile updated (2 samples analyzed). > style profile Writing Style Profile (2 samples analyzed) Tone: casual, neutral Avg sentence: 7 words Vocabulary: advanced (richness: 72%) Structure: conversational Uses contractions, first person, em-dashes Favorite words: easier, simple, something, learn ``` 您的画像在会话间持久保存,并自动塑造 AI 博客提示,使生成的帖子听起来像您写的。 **命令:** | 命令 | 描述 | |---|---|---| | `style learn <文本>` | 向 SafeClaw 投喂写作样本 | | `style profile` | 查看您当前的写作画像 | ### 研究流水线 两阶段研究:先收集(免费),然后可选地用 AI 分析。 ``` > research WebAssembly performance Found 8 sources. Use 'research sources' to view. > research sources 1. [HN] WebAssembly 2.0 Performance Benchmarks (4 sentences) 2. [RSS] Wasm vs Native: A Deep Dive (3 sentences) ... > research select 1,2,5 Selected 3 sources for deep analysis. > research analyze [LLM analyzes your selected sources with structured output] ``` **命令:** | 命令 | 描述 | |---|---|---| | `research <主题>` | 搜索源并爬取来源(无 LLM) | | `research url ` | 添加特定 URL 作为来源 | | `research sources` | 查看收集到的来源及摘要 | | `research select 1,2,3` | 挑选来源进行深度分析 | | `research analyze` | LLM 对选定来源的深度挖掘 | | `research results` | 查看分析结果 | | `research help` | 显示所有研究命令 | ### 编程工具箱 离线编程实用工具以及可选的 LLM 驱动功能。 ``` > code templates python-script, python-class, python-test, fastapi-endpoint, html-page, dockerfile, github-action > code template python-class UserAuth Authentication handler @dataclass class UserAuth: """Authentication handler""" ... > code stats src/ python ████████████████████ 19,348 lines (55 files) 100% > code regex \d{3}-\d{4} test 555-1234 \d — digit (0-9) Match: 555-1234 ``` **命令:** | 命令 | 描述 | |---|---|---| | `code templates` | 列出所有 7 个可用模板 | | `code template <类型> [名称] [描述]` | 生成样板代码 | | `code stats <路径>` | 按语言统计代码行数 | | `code search <模式>` | 跨代码文件进行正则搜索 | | `code read <文件>` | 显示文件及语法信息 | | `code diff <文件1> <文件2>` | 比较两个文件 | | `code regex <模式> [测试]` | 测试并解释正则表达式 | | `code generate <描述>` | LLM 生成代码(可选) | | `code explain <文件>` | LLM 解释代码(可选) | | `code review <文件>` | LLM 查找 bug(可选) | | `code help` | 显示所有编程命令 | ### 自动博客调度器 使用 cron 表达式安排周期性博客生成。 ``` > auto blog setup [Interactive wizard] > auto blog add weekly-tech "0 9 * * 1" tech,ai Auto-blog 'weekly-tech' scheduled: 0 9 * * 1 > auto blog list weekly-tech: 0 9 * * 1 (tech, ai) > auto blog remove weekly-tech Removed. ``` ### 任务感知提示构建器 每种任务类型(博客、研究、编程)都有优化的提示。配置按任务的 LLM 提供商: ``` task_providers: blog: "local-ollama" # Blog posts use local Ollama research: "openai" # Research uses OpenAI for quality coding: "local-lmstudio" # Code tasks use LM Studio ``` 运行 `show me the flow` 查看完整架构图。 ## 博客指南 SafeClaw 有两种博客模式。您可以使用其中一种或同时使用。 ### 模式 1:确定性博客(无 AI) 手动撰写条目,爬取网站内容,并让 SafeClaw 使用抽取式摘要(LexRank、TextRank、LSA、Luhn)生成标题。无需 API keys,无成本,完全离线。 **设置:** 无——开箱即用。 ``` > write blog news We shipped faster crawling today. Added entry (1 total). > crawl https://example.com for title content Extracted 3 titles, added to draft. > blog title Generated: "Faster Crawling Ships Today" > publish blog Saved: 2026-02-24-faster-crawling-ships-today.txt ``` **命令:** | 命令 | 描述 | |---|---|---| | `write blog news <内容>` | 向草稿添加手动条目 | | `crawl for title content` | 将页面标题提取到草稿中 | | `crawl for body content` | 将正文文本提取到草稿中 | | `crawl for non-title content` | 将非标题文本提取到草稿中 | | `blog title` | 使用抽取式摘要生成标题 | | `show blog` | 查看您的草稿和已发布帖子 | | `edit blog <新内容>` | 替换草稿内容 | | `publish blog` | 本地保存为 `.txt` | | `publish blog My Custom Title` | 使用自定义标题保存 | ### 模式 2:AI 博客(可选) AI 从主题生成完整的博客文章。您可以重写、扩展、生成标题和生成 SEO 元数据。支持 11 个提供商——5 个本地(免费)和 6 个云端(需要 API key)。 **设置:** 1. **选择提供商。** 如需免费/私密,使用本地提供商。如需质量/速度,使用云端提供商。 2. **在 `config/config.yaml` 的 `ai_providers` 下配置。** 取消注释并填写一个或多个: **本地 AI(免费、私密、无 API key):** ``` ai_providers: # Ollama — easiest local option - label: "local-ollama" provider: "ollama" model: "llama3.1" endpoint: "http://localhost:11434/api/chat" # LM Studio — GUI app with model browser # - label: "local-lmstudio" # provider: "lm_studio" # model: "local-model" # endpoint: "http://localhost:1234/v1/chat/completions" # llama.cpp — high-performance C++ inference # - label: "local-llamacpp" # provider: "llamacpp" # model: "local-model" # endpoint: "http://localhost:8080/v1/chat/completions" # Jan — user-friendly desktop app # - label: "local-jan" # provider: "jan" # model: "llama3.1-8b" # endpoint: "http://localhost:1337/v1/chat/completions" ``` **云端 AI(需要 API key):** ``` ai_providers: # OpenAI - label: "openai" provider: "openai" api_key: "sk-..." # https://platform.openai.com/api-keys model: "gpt-4o" # Anthropic (Claude) # - label: "anthropic" # provider: "anthropic" # api_key: "sk-ant-..." # https://console.anthropic.com/settings/keys # model: "claude-sonnet-4-20250514" # Google Gemini # - label: "google" # provider: "google" # api_key: "AI..." # https://aistudio.google.com/apikey # model: "gemini-1.5-flash" # Mistral # - label: "mistral" # provider: "mistral" # api_key: "..." # https://console.mistral.ai/api-keys # model: "mistral-large-latest" # Groq (fast inference) # - label: "groq" # provider: "groq" # api_key: "gsk_..." # https://console.groq.com/keys # model: "llama-3.1-70b-versatile" ``` 3. **安装本地 AI 服务器**(如果使用本地): ``` # Ollama (推荐 —— 一条命令) curl -fsSL https://ollama.com/install.sh | sh ollama pull llama3.1 # LM Studio —— 从 https://lmstudio.ai 下载 # Jan —— 从 https://jan.ai 下载 # llama.cpp —— git clone https://github.com/ggerganov/llama.cpp && make ``` 4. **使用它:** ``` > blog 1. AI Blog for You (Recommended) [ollama/llama3.1] 2. Manual Blogging (No AI) > 1 What should the blog post be about? > sustainable technology trends in 2026 AI-Generated Blog Post Provider: ollama/llama3.1 (847 tokens) --- [full article here] --- What would you like to do? edit blog - Replace with your edits ai rewrite blog - Have AI polish/rewrite it ai expand blog - Have AI make it longer publish blog - Save as .txt locally publish blog to wp://mysite.com u pass - Publish (shows preview first) publish blog to - Publish to configured target > publish blog to wp://mysite.com admin mypassword Ready to Publish Title: Sustainable Technology Trends in 2026 Words: 847 Target: wp-mysite.com Preview: The clean energy revolution is accelerating... ... [truncated] --- confirm - Publish now change title - Rename before publishing edit blog - Edit content first cancel - Abort > change title The Green Tech Surge: What's Coming in 2026 Title updated. Title: The Green Tech Surge: What's Coming in 2026 Target: wp-mysite.com Type confirm to publish or cancel to abort. > confirm Blog Published wp-mysite.com (wordpress): Post published successfully URL: https://mysite.com/the-green-tech-surge ``` **AI 命令:** | 命令 | 描述 | |---|---|---| | `blog` | 交互式菜单——选择 AI 或手动 | | `ai blog generate about <主题>` | 从主题生成完整博客文章 | | `ai rewrite blog` | 重写/润色您当前的草稿 | | `ai expand blog` | 将短内容扩展为长文 | | `ai headlines` | 为您的草稿生成 5 个标题选项 | | `ai blog seo` | 生成 SEO 元数据(标题、描述、关键词、slug) | | `ai options` | 显示本地 AI 提供商及安装说明 | | `ai providers` | 显示云端 AI 提供商及 API key 链接 | | `switch ai provider <标签>` | 在运行时切换已配置的提供商 | **多提供商:** 您可以同时配置多个提供商。第一个启用的成为默认值。可在运行时使用 `switch ai provider
标签:AI风险缓解, DNS 反向解析, OpenClaw替代, SafeClaw, spaCy, VADER, Whisper, YOLO, 云计算, 人工智能替代方案, 意图识别, 提示词注入防御, 文字转语音, 无API费用, 本地优先, 本地部署, 机器学习管道, 极小攻击面, 确定性输出, 离线运行, 网络安全, 自动化代理, 规则引擎, 语音交互, 语音转文字, 运行时操纵, 逆向工具, 隐私保护, 零成本, 非LLM AI