[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-alexknowshtml--smaug":3,"tool-alexknowshtml--smaug":62},[4,19,28,37,45,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":18},9989,"n8n","n8n-io\u002Fn8n","n8n 是一款面向技术团队的公平代码（fair-code）工作流自动化平台，旨在让用户在享受低代码快速构建便利的同时，保留编写自定义代码的灵活性。它主要解决了传统自动化工具要么过于封闭难以扩展、要么完全依赖手写代码效率低下的痛点，帮助用户轻松连接 400 多种应用与服务，实现复杂业务流程的自动化。\n\nn8n 特别适合开发者、工程师以及具备一定技术背景的业务人员使用。其核心亮点在于“按需编码”：既可以通过直观的可视化界面拖拽节点搭建流程，也能随时插入 JavaScript 或 Python 代码、调用 npm 包来处理复杂逻辑。此外，n8n 原生集成了基于 LangChain 的 AI 能力，支持用户利用自有数据和模型构建智能体工作流。在部署方面，n8n 提供极高的自由度，支持完全自托管以保障数据隐私和控制权，也提供云端服务选项。凭借活跃的社区生态和数百个现成模板，n8n 让构建强大且可控的自动化系统变得简单高效。",184740,2,"2026-04-19T23:22:26",[13,14,15,16,17],"数据工具","开发框架","Agent","图像","插件","ready",{"id":20,"name":21,"github_repo":22,"description_zh":23,"stars":24,"difficulty_score":10,"last_commit_at":25,"category_tags":26,"status":18},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",161147,"2026-04-19T23:31:47",[14,15,27],"语言模型",{"id":29,"name":30,"github_repo":31,"description_zh":32,"stars":33,"difficulty_score":34,"last_commit_at":35,"category_tags":36,"status":18},8272,"opencode","anomalyco\u002Fopencode","OpenCode 是一款开源的 AI 编程助手（Coding Agent），旨在像一位智能搭档一样融入您的开发流程。它不仅仅是一个代码补全插件，而是一个能够理解项目上下文、自主规划任务并执行复杂编码操作的智能体。无论是生成全新功能、重构现有代码，还是排查难以定位的 Bug，OpenCode 都能通过自然语言交互高效完成，显著减少开发者在重复性劳动和上下文切换上的时间消耗。\n\n这款工具专为软件开发者、工程师及技术研究人员设计，特别适合希望利用大模型能力来提升编码效率、加速原型开发或处理遗留代码维护的专业人群。其核心亮点在于完全开源的架构，这意味着用户可以审查代码逻辑、自定义行为策略，甚至私有化部署以保障数据安全，彻底打破了传统闭源 AI 助手的“黑盒”限制。\n\n在技术体验上，OpenCode 提供了灵活的终端界面（Terminal UI）和正在测试中的桌面应用程序，支持 macOS、Windows 及 Linux 全平台。它兼容多种包管理工具，安装便捷，并能无缝集成到现有的开发环境中。无论您是追求极致控制权的资深极客，还是渴望提升产出的独立开发者，OpenCode 都提供了一个透明、可信",144296,1,"2026-04-16T14:50:03",[15,17],{"id":38,"name":39,"github_repo":40,"description_zh":41,"stars":42,"difficulty_score":10,"last_commit_at":43,"category_tags":44,"status":18},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[17,15,16,14],{"id":46,"name":47,"github_repo":48,"description_zh":49,"stars":50,"difficulty_score":10,"last_commit_at":51,"category_tags":52,"status":18},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[17,14],{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":59,"last_commit_at":60,"category_tags":61,"status":18},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,3,"2026-04-06T11:19:32",[27,16,15,14],{"id":63,"github_repo":64,"name":65,"description_en":66,"description_zh":67,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":77,"owner_location":78,"owner_email":77,"owner_twitter":79,"owner_website":80,"owner_url":81,"languages":82,"stars":87,"forks":88,"last_commit_at":89,"license":90,"difficulty_score":91,"env_os":92,"env_gpu":93,"env_ram":94,"env_deps":95,"category_tags":102,"github_topics":77,"view_count":10,"oss_zip_url":77,"oss_zip_packed_at":77,"status":18,"created_at":103,"updated_at":104,"faqs":105,"releases":146},9924,"alexknowshtml\u002Fsmaug","smaug","Archive your Twitter\u002FX bookmarks to markdown with AI-powered analysis. Supports Claude Code and OpenCode for multi-model flexibility. Like a dragon hoarding treasure, Smaug collects the valuable things you bookmark.","Smaug 是一款专为知识管理打造的自动化工具，它能像巨龙守护宝藏一样，将你在 Twitter\u002FX 上收藏的书签和点赞内容自动归档为结构清晰的 Markdown 文件。许多用户常面临“只存不看”的困境，导致有价值的技术文章、代码库或深度讨论随时间流逝而难以检索，Smaug 正是为了解决这一痛点而生。\n\n它不仅简单保存链接，还能智能展开短链接，提取 GitHub 仓库详情、文章全文甚至推文线程的完整上下文。其核心亮点在于集成了 AI 分析能力，支持调用 Claude Code 和 OpenCode 等多种大模型，自动对内容进行分类、总结并整理到本地知识库中。通过简单的命令行操作，用户即可实现从数据抓取到智能处理的全流程自动化。\n\nSmaug 特别适合开发者、研究人员及技术爱好者使用，尤其是那些习惯在社交媒体上追踪前沿技术动态，并希望将其转化为个人持久知识资产的人群。只需几分钟配置，你就能拥有一位不知疲倦的\"AI 图书管理员”，帮你把零散的社交媒体的碎片信息，系统性地转化为可搜索、可复用的宝贵资料库。","# Smaug 🐉\n\nArchive your Twitter\u002FX bookmarks (and\u002For optionally, likes) to markdown. Automatically.\n\n*Like a dragon hoarding treasure, Smaug collects the valuable things you bookmark and like.*\n\n> **Multi-model support:** Smaug works with [Claude Code](https:\u002F\u002Fdocs.anthropic.com\u002Fen\u002Fdocs\u002Fclaude-code) (default) and [OpenCode](https:\u002F\u002Fgithub.com\u002Fanomalyco\u002Fopencode), giving you access to a wide range of AI models. Results may vary depending on the model you choose — test carefully and find what works best for your workflow. See [AI CLI Integration](#ai-cli-integration) for setup details.\n\n## Contents\n\n- [Quick Start](#quick-start-5-minutes)\n- [Getting Twitter Credentials](#getting-twitter-credentials)\n- [What It Does](#what-it-does)\n- [Running](#running)\n- [Categories](#categories)\n- [Automation](#automation)\n- [Output](#output)\n- [Configuration](#configuration)\n- [AI CLI Integration](#ai-cli-integration)\n- [Troubleshooting](#troubleshooting)\n- [Credits](#credits)\n\n```\n  🔥  🔥  🔥  🔥  🔥  🔥  🔥  🔥  🔥  🔥  🔥  🔥\n       _____ __  __   _   _   _  ____\n      \u002F ____|  \\\u002F  | \u002F \\ | | | |\u002F ___|\n      \\___ \\| |\\\u002F| |\u002F _ \\| | | | |  _\n       ___) | |  | \u002F ___ \\ |_| | |_| |\n      |____\u002F|_|  |_\u002F_\u002F  \\_\\___\u002F \\____|\n\n   🐉 The dragon stirs... treasures to hoard!\n```\n\n## Quick Start (5 minutes)\n\n```bash\n# 1. Install bird CLI (Twitter API wrapper)\n# See https:\u002F\u002Fgithub.com\u002Fsteipete\u002Fbird for installation\n\n# 2. Clone and install Smaug\ngit clone https:\u002F\u002Fgithub.com\u002Falexknowshtml\u002Fsmaug\ncd smaug\nnpm install\n\n# 3. Run the setup wizard\nnpx smaug setup\n\n# 4. Run the full job (fetch + process with Claude)\nnpx smaug run\n```\n\nThe setup wizard will:\n- Create required directories\n- Guide you through getting Twitter credentials\n- Create your config file\n\n## Manually Getting Twitter Credentials\n\nSmaug uses the bird CLI which needs your Twitter session cookies.\n\nIf you don't want to use the wizard to make it easy, you can manually put your session info into the config.\n\n1. Copy the example config:\n   ```bash\n   cp smaug.config.example.json smaug.config.json\n   ```\n2. Open Twitter\u002FX in your browser\n3. Open Developer Tools → Application → Cookies\n4. Find and copy these values:\n   - `auth_token`\n   - `ct0`\n5. Add them to your `smaug.config.json`:\n\n```json\n{\n  \"twitter\": {\n    \"authToken\": \"your_auth_token_here\",\n    \"ct0\": \"your_ct0_here\"\n  }\n}\n```\n\n> **Note:** `smaug.config.json` is gitignored to prevent accidentally committing credentials. The example file is tracked instead.\n\n## What Smaug Actually Does\n\n1. **Fetches bookmarks** from Twitter\u002FX using the bird CLI (can also fetch likes, or both)\n2. **Expands t.co links** to reveal actual URLs\n3. **Extracts content** from linked pages:\n   - GitHub repos (via API: stars, description, README)\n   - External articles (title, author, content)\n   - X\u002FTwitter long-form articles (full content via bird CLI)\n   - Quote tweets and reply threads (full context)\n4. **Invokes Claude Code** to analyze and categorize each tweet\n5. **Saves to markdown** organized by date with rich context\n6. **Files to knowledge library** - GitHub repos to `knowledge\u002Ftools\u002F`, articles to `knowledge\u002Farticles\u002F`\n\n## Running Manually\n\n```bash\n# Full job (fetch + process with Claude)\nnpx smaug run\n\n# Fetch from bookmarks (default)\nnpx smaug fetch 20\n\n# Fetch ALL bookmarks (paginated - requires bird CLI from git)\nnpx smaug fetch --all\nnpx smaug fetch --all --max-pages 5  # Limit to 5 pages\n\n# Fetch from likes instead\nnpx smaug fetch --source likes\n\n# Fetch from both bookmarks AND likes\nnpx smaug fetch --source both\n\n# Process already-fetched tweets\nnpx smaug process\n\n# Force re-process (ignore duplicates)\nnpx smaug process --force\n\n# Check what's pending\nnode -e \"console.log(require('.\u002F.state\u002Fpending-bookmarks.json').count)\"\n```\n\n### Fetching All Bookmarks\n\nBy default, Twitter's API returns ~50-70 bookmarks per request. To fetch more, use the `--all` flag which enables pagination:\n\n```bash\nnpx smaug fetch --all              # Fetch all (up to 10 pages)\nnpx smaug fetch --all --max-pages 20  # Fetch up to 20 pages\n```\n\n**Note:** This requires bird CLI built from git (not the npm release). See [Troubleshooting](#troubleshooting) for installation instructions.\n\n**Cost warning:** Processing large bookmark backlogs can consume significant Claude tokens. Each bookmark with content-heavy links (long articles, GitHub READMEs, etc.) adds to the context. Process in batches to control costs:\n\n```bash\nnpx smaug run --limit 50 -t    # Process 50 at a time with token tracking\n```\n\nUse the `-t` flag to monitor usage. See [Token Usage Tracking](#token-usage-tracking) for cost estimates by model.\n\n## Categories\n\nCategories define how different bookmark types are handled. Smaug comes with sensible defaults, but you can customize them in `smaug.config.json`.\n\n### Default Categories\n\n| Category | Matches | Action | Destination |\n|----------|---------|--------|-------------|\n| **github** | github.com | file | `.\u002Fknowledge\u002Ftools\u002F` |\n| **article** | medium.com, substack.com, dev.to, blogs | file | `.\u002Fknowledge\u002Farticles\u002F` |\n| **x-article** | x.com\u002Fi\u002Farticle\u002F* | file | `.\u002Fknowledge\u002Farticles\u002F` |\n| **tweet** | (fallback) | capture | bookmarks.md only |\n\n🔜 _Note: Transcription is flagged but not yet automated. PRs welcome!_\n\n### X\u002FTwitter Long-Form Articles\n\nX articles (`x.com\u002Fi\u002Farticle\u002F*`) are Twitter's native long-form content format. Smaug extracts the full article text using bird CLI:\n\n1. **Direct extraction**: If the bookmarked tweet is the article author's original post, content is extracted directly\n2. **Search fallback**: If you bookmark someone sharing\u002Fquoting an article, Smaug searches for the original author's tweet and extracts the full content from there\n3. **Metadata fallback**: If search fails, basic metadata (title, description) is captured\n\nExample X article bookmark:\n```markdown\n## @joaomdmoura - Lessons From 2 Billion Agentic Workflows\n> [Full article content extracted]\n\n- **Tweet:** https:\u002F\u002Fx.com\u002Fjoaomdmoura\u002Fstatus\u002F123456789\n- **Link:** https:\u002F\u002Fx.com\u002Fi\u002Farticle\u002F987654321\n- **Filed:** [lessons-from-2-billion-agentic-workflows.md](.\u002Fknowledge\u002Farticles\u002Flessons-from-2-billion-agentic-workflows.md)\n- **What:** Deep dive into patterns from scaling CrewAI to billions of agent executions.\n```\n\n### Actions\n\n- **file**: Create a separate markdown file with rich metadata\n- **capture**: Add to bookmarks.md only (no separate file)\n- **transcribe**: Flag for future transcription *(auto-transcription coming soon! PRs welcome)*\n\n### Custom Categories\n\nAdd your own categories in `smaug.config.json`:\n\n```json\n{\n  \"categories\": {\n    \"research\": {\n      \"match\": [\"arxiv.org\", \"papers.\", \"scholar.google\"],\n      \"action\": \"file\",\n      \"folder\": \".\u002Fknowledge\u002Fresearch\",\n      \"template\": \"article\",\n      \"description\": \"Academic papers\"\n    },\n    \"newsletter\": {\n      \"match\": [\"buttondown.email\", \"beehiiv.com\"],\n      \"action\": \"file\",\n      \"folder\": \".\u002Fknowledge\u002Fnewsletters\",\n      \"template\": \"article\",\n      \"description\": \"Newsletter issues\"\n    }\n  }\n}\n```\n\nYour custom categories merge with the defaults. To override a default, use the same key (e.g., `github`, `article`).\n\n## Bookmark Folders\n\nIf you've organized your Twitter bookmarks into folders, Smaug can preserve that organization as tags. Configure folder IDs mapped to tag names:\n\n```json\n{\n  \"folders\": {\n    \"1234567890\": \"ai-tools\",\n    \"0987654321\": \"articles-to-read\",\n    \"1122334455\": \"research\"\n  }\n}\n```\n\n**How to find folder IDs:**\n1. Open Twitter\u002FX and go to your bookmarks\n2. Click on a folder\n3. The URL will be `https:\u002F\u002Fx.com\u002Fi\u002Fbookmarks\u002F1234567890` - the number is the folder ID\n\nWhen folders are configured:\n- Smaug fetches from each folder separately\n- Each bookmark gets tagged with its folder name\n- Tags appear in `bookmarks.md` entries and knowledge file frontmatter\n\n**Note:** Twitter's API doesn't return folder membership when fetching all bookmarks at once, so Smaug must fetch each folder individually.\n\n## Automation\n\nRun Smaug automatically every 30 minutes:\n\n### Option A: PM2 (recommended)\n\n```bash\nnpm install -g pm2\npm2 start \"npx smaug run\" --cron \"*\u002F30 * * * *\" --name smaug\npm2 save\npm2 startup    # Start on boot\n```\n\n### Option B: Cron\n\n```bash\ncrontab -e\n# Add:\n*\u002F30 * * * * cd \u002Fpath\u002Fto\u002Fsmaug && npx smaug run >> smaug.log 2>&1\n```\n\n### Option C: systemd\n\n```bash\n# Create \u002Fetc\u002Fsystemd\u002Fsystem\u002Fsmaug.service\n# See docs\u002Fsystemd-setup.md for details\n```\n\n## Output\n\n### bookmarks.md\n\nYour bookmarks organized by date:\n\n```markdown\n# Thursday, January 2, 2026\n\n## @simonw - Gist Host Fork for Rendering GitHub Gists\n> I forked the wonderful gistpreview.github.io to create gisthost.github.io\n\n- **Tweet:** https:\u002F\u002Fx.com\u002Fsimonw\u002Fstatus\u002F123456789\n- **Link:** https:\u002F\u002Fgisthost.github.io\u002F\n- **Filed:** [gisthost-gist-rendering.md](.\u002Fknowledge\u002Farticles\u002Fgisthost-gist-rendering.md)\n- **What:** Free GitHub Pages-hosted tool that renders HTML files from Gists.\n\n---\n\n## @tom_doerr - Whisper-Flow Real-time Transcription\n> This is amazing - real-time transcription with Whisper\n\n- **Tweet:** https:\u002F\u002Fx.com\u002Ftom_doerr\u002Fstatus\u002F987654321\n- **Link:** https:\u002F\u002Fgithub.com\u002Fdimastatz\u002Fwhisper-flow\n- **Filed:** [whisper-flow.md](.\u002Fknowledge\u002Ftools\u002Fwhisper-flow.md)\n- **What:** Real-time speech-to-text using OpenAI Whisper with streaming support.\n```\n\n### knowledge\u002Ftools\u002F*.md\n\nGitHub repos get their own files:\n\n```markdown\n---\ntitle: \"whisper-flow\"\ntype: tool\ndate_added: 2026-01-02\nsource: \"https:\u002F\u002Fgithub.com\u002Fdimastatz\u002Fwhisper-flow\"\ntags: [ai, transcription, whisper, streaming]\nvia: \"Twitter bookmark from @tom_doerr\"\n---\n\nReal-time speech-to-text transcription using OpenAI Whisper...\n\n## Key Features\n- Streaming audio input\n- Multiple language support\n- Low latency output\n\n## Links\n- [GitHub](https:\u002F\u002Fgithub.com\u002Fdimastatz\u002Fwhisper-flow)\n- [Original Tweet](https:\u002F\u002Fx.com\u002Ftom_doerr\u002Fstatus\u002F987654321)\n```\n\n## Configuration\n\nCopy the example config and customize:\n\n```bash\ncp smaug.config.example.json smaug.config.json\n```\n\nExample `smaug.config.json`:\n\n```json\n{\n  \"source\": \"bookmarks\",\n  \"archiveFile\": \".\u002Fbookmarks.md\",\n  \"pendingFile\": \".\u002F.state\u002Fpending-bookmarks.json\",\n  \"stateFile\": \".\u002F.state\u002Fbookmarks-state.json\",\n  \"timezone\": \"America\u002FNew_York\",\n  \"twitter\": {\n    \"authToken\": \"your_auth_token\",\n    \"ct0\": \"your_ct0\"\n  },\n  \"autoInvokeClaude\": true,\n  \"claudeModel\": \"sonnet\",\n  \"claudeTimeout\": 900000,\n  \"allowedTools\": \"Read,Write,Edit,Glob,Grep,Bash,Task,TodoWrite\",\n  \"webhookUrl\": null,\n  \"webhookType\": \"discord\"\n}\n```\n\n| Option | Default | Description |\n|--------|---------|-------------|\n| `source` | `bookmarks` | What to fetch: `bookmarks` (default), `likes`, or `both` |\n| `includeMedia` | `false` | **EXPERIMENTAL**: Include media attachments (photos, videos, GIFs) |\n| `archiveFile` | `.\u002Fbookmarks.md` | Main archive file |\n| `timezone` | `America\u002FNew_York` | For date formatting |\n| `cliTool` | `claude` | AI CLI to use: `claude` or `opencode` |\n| `autoInvokeClaude` | `true` | Auto-run Claude Code for analysis |\n| `claudeModel` | `sonnet` | Model to use (`sonnet`, `haiku`, or `opus`) |\n| `autoInvokeOpencode` | `true` | Auto-run OpenCode for analysis |\n| `opencodeModel` | `opencode\u002Fglm-4.7-free` | OpenCode model (see OpenCode docs) |\n| `claudeTimeout` | `900000` | Max processing time (15 min) |\n| `parallelThreshold` | `8` | Min bookmarks before parallel processing kicks in |\n| `webhookUrl` | `null` | Discord\u002FSlack webhook for notifications |\n\nEnvironment variables also work: `AUTH_TOKEN`, `CT0`, `SOURCE`, `INCLUDE_MEDIA`, `ARCHIVE_FILE`, `TIMEZONE`, `CLI_TOOL`, `CLAUDE_MODEL`, `OPENCODE_MODEL`, etc.\n\n### Experimental: Media Attachments\n\nMedia extraction (photos, videos, GIFs) is available but disabled by default. To enable:\n\n```bash\n# One-time with flag\nnpx smaug fetch --media\n\n# Or in config\n{\n  \"includeMedia\": true\n}\n```\n\nWhen enabled, the `media[]` array is included in the pending JSON with:\n- `type`: \"photo\", \"video\", or \"animated_gif\"\n- `url`: Full-size media URL\n- `previewUrl`: Thumbnail (smaller, faster)\n- `width`, `height`: Dimensions\n- `videoUrl`, `durationMs`: For videos only\n\n⚠️ **Why experimental?**\n1. **Requires bird with media support** - PR [#14](https:\u002F\u002Fgithub.com\u002Fsteipete\u002Fbird\u002Fpull\u002F14) adds media extraction. Until merged, you'll need a fork with this PR or wait for an upstream release. Without it, `--media` is a no-op (empty array).\n2. **Workflow still being refined** - Short screengrabs (\u003C 30s) don't need transcripts, but longer videos might. We're still figuring out the best handling.\n\n## AI CLI Integration\n\nSmaug supports multiple AI CLI tools for intelligent bookmark processing:\n\n- **Claude Code** (default) - Anthropic's Claude CLI\n- **OpenCode** - Alternative AI CLI with support for multiple models\n\n### Using OpenCode (Alternative to Claude)\n\nTo use OpenCode instead of Claude Code:\n\n```json\n{\n  \"cliTool\": \"opencode\",\n  \"opencodeModel\": \"opencode\u002Fglm-4.7-free\",\n  \"autoInvokeOpencode\": true\n}\n```\n\nAvailable OpenCode models include:\n- `opencode\u002Fglm-4.7-free` (free tier)\n- `opencode\u002Fkimi-k2.5-free` (free tier)\n- `opencode\u002Fclaude-sonnet-4-5` (Claude via OpenCode)\n- `opencode\u002Fgpt-5.2` (GPT via OpenCode)\n\nSet via environment variable:\n```bash\nexport CLI_TOOL=opencode\nexport OPENCODE_MODEL=opencode\u002Fkimi-k2.5-free\n```\n\n### Claude Code Integration\n\nSmaug uses Claude Code by default for intelligent bookmark processing. The `.claude\u002Fcommands\u002Fprocess-bookmarks.md` file contains instructions for:\n\n- Generating descriptive titles (not generic \"Article\" or \"Tweet\")\n- Filing GitHub repos to `knowledge\u002Ftools\u002F`\n- Filing articles to `knowledge\u002Farticles\u002F`\n- Handling quote tweets with full context\n- Processing reply threads with parent context\n- Parallel processing for large batches (configurable threshold, default 8 bookmarks)\n\nYou can also run processing manually:\n\n```bash\nclaude\n> Run \u002Fprocess-bookmarks\n```\n\n### Token Usage Tracking\n\nTrack your API costs with the `-t` flag:\n\n```bash\nnpx smaug run -t\n# or\nnpx smaug run --track-tokens\n```\n\nThis displays a breakdown at the end of each run:\n\n```\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n📊 TOKEN USAGE\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\nMain (sonnet):\n  Input:               85 tokens  \u003C$0.01\n  Output:           5,327 tokens  $0.08\n  Cache Read:     724,991 tokens  $0.22\n  Cache Write:     62,233 tokens  $0.23\n\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n💰 TOTAL COST: $0.53\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n```\n\n### Cost Optimization: Haiku Subagents\n\nFor large batches (8+ bookmarks by default), Smaug spawns parallel subagents. By default, these use Haiku instead of Sonnet, which cuts costs nearly in half:\n\n| Configuration | 20 Bookmarks | Time |\n|---------------|--------------|------|\n| Sonnet subagents | $1.00 | 4m 12s |\n| **Haiku subagents** | **$0.53** | 4m 18s |\n\nSame speed, ~50% cheaper. The categorization and filing tasks don't require Sonnet-level reasoning, so Haiku handles them well.\n\nThis is configured in `.claude\u002Fcommands\u002Fprocess-bookmarks.md` with `model=\"haiku\"` in the Task calls.\n\n## Troubleshooting\n\n### \"No new bookmarks to process\"\n\nThis means either:\n1. No bookmarks were fetched (check bird CLI credentials)\n2. All fetched bookmarks already exist in `bookmarks.md`\n\nTo start fresh:\n```bash\nrm -rf .state\u002F bookmarks.md knowledge\u002F\nmkdir -p .state knowledge\u002Ftools knowledge\u002Farticles\nnpx smaug run\n```\n\n### Bird CLI 403 errors\n\nYour Twitter cookies may have expired. Get fresh ones from your browser.\n\n### Processing is slow\n\n- Try `haiku` model instead of `sonnet` in config for faster (but less thorough) processing\n- Make sure you're not re-processing with `--force` (causes edits instead of appends)\n\n### Only ~50-70 bookmarks fetched\n\nThe npm release of bird CLI (v0.5.1) doesn't support pagination. To fetch all bookmarks, install bird from git:\n\n```bash\n# Clone and build bird from source\ncd \u002Ftmp\ngit clone https:\u002F\u002Fgithub.com\u002Fsteipete\u002Fbird.git\ncd bird\npnpm install    # or: npm install -g pnpm && pnpm install\npnpm run build:dist\n\n# Link globally (may need sudo or --force)\nnpm link --force\n\n# Verify\nbird --version  # Should show a newer commit hash\nbird bookmarks --help  # Should show --all flag\n```\n\nThen use `npx smaug fetch --all` to fetch all bookmarks with pagination.\n\n## Credits\n\n- [bird CLI](https:\u002F\u002Fgithub.com\u002Fsteipete\u002Fbird) by Peter Steinberger\n- Built with Claude Code\n\n## License\n\nMIT\n","# 史矛革 🐉\n\n将你的 Twitter\u002FX 书签（和\u002F或可选的点赞）自动归档为 Markdown 格式。\n\n*就像龙守护着宝藏一样，史矛革会收集你收藏的珍贵内容和点赞。*\n\n> **多模型支持：** 史矛革支持 [Claude Code](https:\u002F\u002Fdocs.anthropic.com\u002Fen\u002Fdocs\u002Fclaude-code)（默认）和 [OpenCode](https:\u002F\u002Fgithub.com\u002Fanomalyco\u002Fopencode)，让你可以使用多种 AI 模型。不同模型的结果可能会有所差异——请仔细测试并找到最适合你工作流程的模型。设置详情请参阅 [AI CLI 集成](#ai-cli-integration)。\n\n## 目录\n\n- [快速入门](#quick-start-5-minutes)\n- [获取 Twitter 凭证](#getting-twitter-credentials)\n- [它能做什么](#what-it-does)\n- [运行](#running)\n- [分类](#categories)\n- [自动化](#automation)\n- [输出](#output)\n- [配置](#configuration)\n- [AI CLI 集成](#ai-cli-integration)\n- [故障排除](#troubleshooting)\n- [致谢](#credits)\n\n```\n  🔥  🔥  🔥  🔥  🔥  🔥  🔥  🔥  🔥  🔥  🔥  🔥\n       _____ __  __   _   _   _  ____\n      \u002F ____|  \\\u002F  | \u002F \\ | | | |\u002F ___|\n      \\___ \\| |\\\u002F| |\u002F _ \\| | | | |  _\n       ___) | |  | \u002F ___ \\ |_| | |_| |\n      |____\u002F|_|  |_\u002F_\u002F  \\_\\___\u002F \\____|\n\n   🐉 龙苏醒了……又有宝藏等着被收藏！\n```\n\n## 快速入门（5 分钟）\n\n```bash\n# 1. 安装 bird CLI（Twitter API 封装工具）\n# 安装说明见 https:\u002F\u002Fgithub.com\u002Fsteipete\u002Fbird\n\n# 2. 克隆并安装史矛革\ngit clone https:\u002F\u002Fgithub.com\u002Falexknowshtml\u002Fsmaug\ncd smaug\nnpm install\n\n# 3. 运行设置向导\nnpx smaug setup\n\n# 4. 运行完整任务（抓取 + 使用 Claude 处理）\nnpx smaug run\n```\n\n设置向导将完成以下操作：\n- 创建必要的目录\n- 引导你获取 Twitter 凭证\n- 创建你的配置文件\n\n## 手动获取 Twitter 凭证\n\n史矛革使用 bird CLI，而 bird CLI 需要你的 Twitter 会话 Cookie。\n\n如果你不想使用向导来简化流程，也可以手动将会话信息填入配置文件。\n\n1. 复制示例配置文件：\n   ```bash\n   cp smaug.config.example.json smaug.config.json\n   ```\n2. 在浏览器中打开 Twitter\u002FX\n3. 打开开发者工具 → 应用程序 → Cookies\n4. 找到并复制以下值：\n   - `auth_token`\n   - `ct0`\n5. 将它们添加到你的 `smaug.config.json` 中：\n\n```json\n{\n  \"twitter\": {\n    \"authToken\": \"your_auth_token_here\",\n    \"ct0\": \"your_ct0_here\"\n  }\n}\n```\n\n> **注意：** `smaug.config.json` 已被 .gitignore 忽略，以防止意外提交凭证。取而代之的是跟踪示例文件。\n\n## 史矛革的实际功能\n\n1. **从 Twitter\u002FX 抓取书签**，使用 bird CLI（也可同时抓取点赞，或两者兼抓）\n2. **展开 t.co 链接**，揭示真实 URL\n3. **提取链接页面的内容**：\n   - GitHub 仓库（通过 API 获取星标数、描述、README）\n   - 外部文章（标题、作者、内容）\n   - X\u002FTwitter 长文（通过 bird CLI 提取全文）\n   - 引用推文和回复线程（完整上下文）\n4. **调用 Claude Code** 来分析并分类每条推文\n5. **保存为 Markdown 文件**，按日期整理，并附带丰富上下文\n6. **归档到知识库**：GitHub 仓库存入 `knowledge\u002Ftools\u002F`，文章存入 `knowledge\u002Farticles\u002F`\n\n## 手动运行\n\n```bash\n# 完整任务（抓取 + 使用 Claude 处理）\nnpx smaug run\n\n# 默认抓取书签\nnpx smaug fetch 20\n\n# 抓取所有书签（分页加载，需使用 git 版本的 bird CLI）\nnpx smaug fetch --all\nnpx smaug fetch --all --max-pages 5  # 限制为 5 页\n\n# 改为抓取点赞\nnpx smaug fetch --source likes\n\n# 同时抓取书签和点赞\nnpx smaug fetch --source both\n\n# 处理已抓取的推文\nnpx smaug process\n\n# 强制重新处理（忽略重复项）\nnpx smaug process --force\n\n# 检查待处理的任务\nnode -e \"console.log(require('.\u002F.state\u002Fpending-bookmarks.json').count)\"\n```\n\n### 抓取所有书签\n\n默认情况下，Twitter 的 API 每次请求会返回约 50–70 条书签。若需抓取更多，可使用 `--all` 标志启用分页功能：\n\n```bash\nnpx smaug fetch --all              # 抓取全部（最多 10 页）\nnpx smaug fetch --all --max-pages 20  # 抓取最多 20 页\n```\n\n**注意：** 这需要使用从 git 构建的 bird CLI（而非 npm 发布版本）。安装说明请参阅 [故障排除](#troubleshooting)。\n\n**费用提示：** 处理大量书签可能会消耗大量 Claude Token。每个包含复杂内容的书签（如长篇文章、GitHub README 等）都会增加上下文长度。建议分批处理以控制成本：\n\n```bash\nnpx smaug run --limit 50 -t    # 每次处理 50 条，并跟踪 Token 使用情况\n```\n\n使用 `-t` 标志可监控用量。不同模型的成本估算请参阅 [Token 使用追踪](#token-usage-tracking)。\n\n## 分类\n\n分类定义了不同类型书签的处理方式。史矛革提供了合理的默认分类，但你可以在 `smaug.config.json` 中自定义它们。\n\n### 默认分类\n\n| 分类     | 匹配条件           | 动作         | 归档位置             |\n|----------|--------------------|--------------|----------------------|\n| **github** | github.com         | 存档         | `.\u002Fknowledge\u002Ftools\u002F` |\n| **article** | medium.com, substack.com, dev.to, 博客等 | 存档 | `.\u002Fknowledge\u002Farticles\u002F` |\n| **x-article** | x.com\u002Fi\u002Farticle\u002F*  | 存档         | `.\u002Fknowledge\u002Farticles\u002F` |\n| **tweet** | （备用）           | 记录         | 仅保存到 bookmarks.md |\n\n🔜 _注意：转录功能已标记，但尚未自动化。欢迎提交 PR！_\n\n### X\u002FTwitter 长文\n\nX 文章（`x.com\u002Fi\u002Farticle\u002F*`）是 Twitter 原生的长文格式。史矛革会使用 bird CLI 提取完整的文章内容：\n\n1. **直接提取**：如果书签中的推文是文章作者的原创帖子，则直接提取内容。\n2. **搜索回退**：如果你书签的是他人分享或引用的文章，史矛革会搜索原始作者的推文，并从中提取完整内容。\n3. **元数据回退**：如果搜索失败，则记录基本元数据（标题、描述）。\n\n示例 X 文章书签：\n```markdown\n## @joaomdmoura - 从 20 亿个智能体工作流中学到的经验\n> [完整文章内容已提取]\n\n- **推文：** https:\u002F\u002Fx.com\u002Fjoaomdmoura\u002Fstatus\u002F123456789\n- **链接：** https:\u002F\u002Fx.com\u002Fi\u002Farticle\u002F987654321\n- **归档：** [lessons-from-2-billion-agentic-workflows.md](.\u002Fknowledge\u002Farticles\u002Flessons-from-2-billion-agentic-workflows.md)\n- **内容：** 深入探讨将 CrewAI 扩展到数十亿次智能体执行过程中所发现的模式。\n```\n\n### 动作\n\n- **存档**：创建带有丰富元数据的独立 Markdown 文件\n- **记录**：仅添加到 bookmarks.md，不另建文件\n- **转录**：标记以供未来转录 *(自动转录功能即将推出！欢迎提交 PR)*\n\n### 自定义分类\n\n在 `smaug.config.json` 中添加您自己的分类：\n\n```json\n{\n  \"categories\": {\n    \"research\": {\n      \"match\": [\"arxiv.org\", \"papers.\", \"scholar.google\"],\n      \"action\": \"file\",\n      \"folder\": \".\u002Fknowledge\u002Fresearch\",\n      \"template\": \"article\",\n      \"description\": \"学术论文\"\n    },\n    \"newsletter\": {\n      \"match\": [\"buttondown.email\", \"beehiiv.com\"],\n      \"action\": \"file\",\n      \"folder\": \".\u002Fknowledge\u002Fnewsletters\",\n      \"template\": \"article\",\n      \"description\": \"新闻通讯期刊\"\n    }\n  }\n}\n```\n\n您的自定义分类会与默认分类合并。要覆盖某个默认分类，只需使用相同的键（例如 `github`、`article`）。\n\n## 书签文件夹\n\n如果您已将 Twitter 书签组织到文件夹中，Smaug 可以将这种组织方式保留为标签。通过配置文件夹 ID 到标签名称的映射来实现：\n\n```json\n{\n  \"folders\": {\n    \"1234567890\": \"ai-tools\",\n    \"0987654321\": \"articles-to-read\",\n    \"1122334455\": \"research\"\n  }\n}\n```\n\n**如何找到文件夹 ID：**\n1. 打开 Twitter\u002FX 并进入您的书签。\n2. 点击一个文件夹。\n3. URL 将显示为 `https:\u002F\u002Fx.com\u002Fi\u002Fbookmarks\u002F1234567890`，其中的数字即为文件夹 ID。\n\n当文件夹配置完成后：\n- Smaug 会分别从每个文件夹中抓取数据。\n- 每个书签都会被标记为其所属的文件夹名称。\n- 标签会出现在 `bookmarks.md` 条目和知识文件的 frontmatter 中。\n\n**注意：** Twitter 的 API 在一次性获取所有书签时不会返回文件夹归属信息，因此 Smaug 必须单独逐个文件夹进行抓取。\n\n## 自动化\n\n每 30 分钟自动运行一次 Smaug：\n\n### 选项 A：PM2（推荐）\n\n```bash\nnpm install -g pm2\npm2 start \"npx smaug run\" --cron \"*\u002F30 * * * *\" --name smaug\npm2 save\npm2 startup    # 开机启动\n```\n\n### 选项 B：Cron\n\n```bash\ncrontab -e\n# 添加：\n*\u002F30 * * * * cd \u002Fpath\u002Fto\u002Fsmaug && npx smaug run >> smaug.log 2>&1\n```\n\n### 选项 C：systemd\n\n```bash\n# 创建 \u002Fetc\u002Fsystemd\u002Fsystem\u002Fsmaug.service\n# 详情请参阅 docs\u002Fsystemd-setup.md\n```\n\n## 输出\n\n### bookmarks.md\n\n您的书签按日期整理：\n\n```markdown\n# 2026年1月2日 星期四\n\n## @simonw - Gist Host Fork for Rendering GitHub Gists\n> 我分叉了优秀的 gistpreview.github.io，创建了 gisthost.github.io\n\n- **推文:** https:\u002F\u002Fx.com\u002Fsimonw\u002Fstatus\u002F123456789\n- **链接:** https:\u002F\u002Fgisthost.github.io\u002F\n- **归档:** [gisthost-gist-rendering.md](.\u002Fknowledge\u002Farticles\u002Fgisthost-gist-rendering.md)\n- **内容:** 一款免费的 GitHub Pages 托管工具，用于渲染来自 Gist 的 HTML 文件。\n\n---\n\n## @tom_doerr - Whisper-Flow 实时转录\n> 这太棒了——使用 Whisper 实现实时转录\n\n- **推文:** https:\u002F\u002Fx.com\u002Ftom_doerr\u002Fstatus\u002F987654321\n- **链接:** https:\u002F\u002Fgithub.com\u002Fdimastatz\u002Fwhisper-flow\n- **归档:** [whisper-flow.md](.\u002Fknowledge\u002Ftools\u002Fwhisper-flow.md)\n- **内容:** 使用 OpenAI Whisper 并支持流式传输的实时语音转文字工具。\n```\n\n### knowledge\u002Ftools\u002F*.md\n\nGitHub 仓库会生成各自的文件：\n\n```markdown\n---\ntitle: \"whisper-flow\"\ntype: tool\ndate_added: 2026-01-02\nsource: \"https:\u002F\u002Fgithub.com\u002Fdimastatz\u002Fwhisper-flow\"\ntags: [ai, transcription, whisper, streaming]\nvia: \"Twitter bookmark from @tom_doerr\"\n---\n\n使用 OpenAI Whisper 进行实时语音转文字转录……\n\n## 主要特性\n- 流式音频输入\n- 多语言支持\n- 低延迟输出\n\n## 链接\n- [GitHub](https:\u002F\u002Fgithub.com\u002Fdimastatz\u002Fwhisper-flow)\n- [原始推文](https:\u002F\u002Fx.com\u002Ftom_doerr\u002Fstatus\u002F987654321)\n```\n\n## 配置\n\n复制示例配置并进行自定义：\n\n```bash\ncp smaug.config.example.json smaug.config.json\n```\n\n示例 `smaug.config.json`：\n\n```json\n{\n  \"source\": \"bookmarks\",\n  \"archiveFile\": \".\u002Fbookmarks.md\",\n  \"pendingFile\": \".\u002F.state\u002Fpending-bookmarks.json\",\n  \"stateFile\": \".\u002F.state\u002Fbookmarks-state.json\",\n  \"timezone\": \"America\u002FNew_York\",\n  \"twitter\": {\n    \"authToken\": \"your_auth_token\",\n    \"ct0\": \"your_ct0\"\n  },\n  \"autoInvokeClaude\": true,\n  \"claudeModel\": \"sonnet\",\n  \"claudeTimeout\": 900000,\n  \"allowedTools\": \"Read,Write,Edit,Glob,Grep,Bash,Task,TodoWrite\",\n  \"webhookUrl\": null,\n  \"webhookType\": \"discord\"\n}\n```\n\n| 选项 | 默认值 | 描述 |\n|--------|---------|-------------|\n| `source` | `bookmarks` | 要抓取的内容：`bookmarks`（默认）、`likes` 或 `both` |\n| `includeMedia` | `false` | **实验性**：包含媒体附件（照片、视频、GIF）|\n| `archiveFile` | `.\u002Fbookmarks.md` | 主归档文件 |\n| `timezone` | `America\u002FNew_York` | 用于日期格式化 |\n| `cliTool` | `claude` | 要使用的 AI CLI：`claude` 或 `opencode` |\n| `autoInvokeClaude` | `true` | 自动运行 Claude Code 进行分析 |\n| `claudeModel` | `sonnet` | 要使用的模型（`sonnet`、`haiku` 或 `opus`）|\n| `autoInvokeOpencode` | `true` | 自动运行 OpenCode 进行分析 |\n| `opencodeModel` | `opencode\u002Fglm-4.7-free` | OpenCode 模型（详见 OpenCode 文档）|\n| `claudeTimeout` | `900000` | 最大处理时间（15 分钟）|\n| `parallelThreshold` | `8` | 同时处理的最小书签数量 |\n| `webhookUrl` | `null` | 用于通知的 Discord\u002FSlack webhook |\n\n环境变量同样适用：`AUTH_TOKEN`、`CT0`、`SOURCE`、`INCLUDE_MEDIA`、`ARCHIVE_FILE`、`TIMEZONE`、`CLI_TOOL`、`CLAUDE_MODEL`、`OPENCODE_MODEL` 等。\n\n### 实验性：媒体附件\n\n媒体提取功能（照片、视频、GIF）目前可用，但默认关闭。要启用：\n\n```bash\n# 一次性使用标志\nnpx smaug fetch --media\n\n# 或在配置中\n{\n  \"includeMedia\": true\n}\n```\n\n启用后，`media[]` 数组会包含在待处理的 JSON 中，内容包括：\n- `type`: “photo”、“video” 或 “animated_gif”\n- `url`: 媒体全尺寸链接\n- `previewUrl`: 缩略图（更小、加载更快）\n- `width`、`height`: 尺寸\n- `videoUrl`、`durationMs`: 仅适用于视频\n\n⚠️ **为什么是实验性？**\n1. **需要支持媒体的 bird 版本** —— PR [#14](https:\u002F\u002Fgithub.com\u002Fsteipete\u002Fbird\u002Fpull\u002F14) 添加了媒体提取功能。在合并之前，您需要使用包含此 PR 的分支，或等待上游发布。否则，`--media` 将不起作用（数组为空）。\n2. **工作流程仍在完善中** —— 短截屏（\u003C 30 秒）不需要转录，但较长的视频可能需要。我们仍在探索最佳处理方式。\n\n## AI CLI 集成\n\nSmaug 支持多种 AI CLI 工具，用于智能处理书签：\n\n- **Claude Code**（默认）— Anthropic 的 Claude CLI\n- **OpenCode** — 另一种支持多种模型的 AI CLI\n\n### 使用 OpenCode（替代 Claude）\n\n要使用 OpenCode 替代 Claude Code：\n\n```json\n{\n  \"cliTool\": \"opencode\",\n  \"opencodeModel\": \"opencode\u002Fglm-4.7-free\",\n  \"autoInvokeOpencode\": true\n}\n```\n\n可用的 OpenCode 模型包括：\n- `opencode\u002Fglm-4.7-free`（免费版）\n- `opencode\u002Fkimi-k2.5-free`（免费版）\n- `opencode\u002Fclaude-sonnet-4.5`（通过 OpenCode 使用 Claude）\n- `opencode\u002Fgpt-5.2`（通过 OpenCode 使用 GPT）\n\n可通过环境变量设置：\n```bash\nexport CLI_TOOL=opencode\nexport OPENCODE_MODEL=opencode\u002Fkimi-k2.5-free\n```\n\n### Claude Code 集成\n\nSmaug 默认使用 Claude Code 进行智能书签处理。`.claude\u002Fcommands\u002Fprocess-bookmarks.md` 文件包含以下说明：\n\n- 生成描述性标题（而非通用的“文章”或“推文”）\n- 将 GitHub 仓库归档到 `knowledge\u002Ftools\u002F`\n- 将文章归档到 `knowledge\u002Farticles\u002F`\n- 处理带有完整上下文的引用推文\n- 处理带有父级上下文的回复线程\n- 对大批量书签进行并行处理（可配置阈值，默认为 8 个书签）\n\n你也可以手动运行处理命令：\n\n```bash\nclaude\n> Run \u002Fprocess-bookmarks\n```\n\n### Token 使用跟踪\n\n使用 `-t` 标志跟踪 API 费用：\n\n```bash\nnpx smaug run -t\n# 或\nnpx smaug run --track-tokens\n```\n\n每次运行结束时，都会显示如下细分信息：\n\n```\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n📊 TOKEN 使用情况\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n主模型 (sonnet):\n  输入：               85 tokens  \u003C$0.01\n  输出：           5,327 tokens  $0.08\n  缓存读取：     724,991 tokens  $0.22\n  缓存写入：     62,233 tokens  $0.23\n\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n💰 总费用：$0.53\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n```\n\n### 成本优化：Haiku 子代理\n\n对于大批量书签（默认 8 个及以上），Smaug 会启动并行子代理。默认情况下，这些子代理使用 Haiku 模型而非 Sonnet 模型，从而将成本几乎降低一半：\n\n| 配置             | 20 个书签 | 时间   |\n|------------------|-----------|--------|\n| Sonnet 子代理    | $1.00     | 4 分 12 秒 |\n| **Haiku 子代理** | **$0.53** | 4 分 18 秒 |\n\n速度相同，但成本降低了约 50%。由于分类和归档任务并不需要 Sonnet 级别的推理能力，因此 Haiku 模型完全可以胜任。\n\n这一设置在 `.claude\u002Fcommands\u002Fprocess-bookmarks.md` 中通过在 Task 调用中添加 `model=\"haiku\"` 来配置。\n\n## 故障排除\n\n### “没有新的书签需要处理”\n\n这意味着以下两种情况之一：\n1. 未成功获取任何书签（请检查 bird CLI 的凭据）\n2. 所有已获取的书签已存在于 `bookmarks.md` 中\n\n若要从头开始，请执行以下操作：\n\n```bash\nrm -rf .state\u002F bookmarks.md knowledge\u002F\nmkdir -p .state knowledge\u002Ftools knowledge\u002Farticles\nnpx smaug run\n```\n\n### bird CLI 出现 403 错误\n\n你的 Twitter Cookie 可能已过期。请从浏览器中获取新的 Cookie。\n\n### 处理速度较慢\n\n- 在配置中尝试使用 `haiku` 模型代替 `sonnet`，以获得更快但略显粗糙的处理效果\n- 确保未使用 `--force` 参数重复处理（这会导致编辑而非追加内容）\n\n### 仅获取了约 50–70 个书签\n\nnpm 发布的 bird CLI（v0.5.1）不支持分页功能。要获取所有书签，请从 Git 安装 bird：\n\n```bash\n# 克隆并构建 bird 源代码\ncd \u002Ftmp\ngit clone https:\u002F\u002Fgithub.com\u002Fsteipete\u002Fbird.git\ncd bird\npnpm install    # 或：npm install -g pnpm && pnpm install\npnpm run build:dist\n\n# 全局链接（可能需要 sudo 或 --force）\nnpm link --force\n\n# 验证\nbird --version  # 应显示更新的提交哈希\nbird bookmarks --help  # 应显示 --all 标志\n```\n\n然后使用 `npx smaug fetch --all` 来启用分页功能，获取所有书签。\n\n## 致谢\n\n- [bird CLI](https:\u002F\u002Fgithub.com\u002Fsteipete\u002Fbird) 由 Peter Steinberger 开发\n- 基于 Claude Code 构建\n\n## 许可证\n\nMIT","# Smaug 快速上手指南\n\nSmaug 是一个自动化工具，能将你的 Twitter\u002FX 书签（及点赞）归档为结构化的 Markdown 文件。它利用 AI（默认 Claude Code 或 OpenCode）分析链接内容，提取关键信息并分类存储到本地知识库。\n\n## 环境准备\n\n在开始之前，请确保满足以下系统要求和前置依赖：\n\n*   **Node.js**: 需安装 Node.js (推荐 v18+) 以运行 npm 包。\n*   **Git**: 用于克隆仓库。\n*   **Bird CLI**: Smaug 依赖 [bird](https:\u002F\u002Fgithub.com\u002Fsteipete\u002Fbird) 作为 Twitter API 的封装层。\n    *   *注意*：若要获取全部书签（分页拉取），建议从源码构建 `bird`，而非仅使用 npm 发布版。\n*   **AI CLI**:\n    *   **Claude Code** (默认): 需安装并配置好 Anthropic API Key。\n    *   **OpenCode** (可选): 如需使用其他模型，可安装 [OpenCode](https:\u002F\u002Fgithub.com\u002Fanomalyco\u002Fopencode)。\n*   **Twitter\u002FX 账号**: 需要有效的账号以获取会话凭证。\n\n## 安装步骤\n\n### 1. 安装 Bird CLI\n首先安装核心依赖 `bird`。请参考其官方仓库进行安装：\n```bash\n# 访问 https:\u002F\u002Fgithub.com\u002Fsteipete\u002Fbird 获取安装指令\n# 通常涉及克隆仓库并构建二进制文件\n```\n\n### 2. 克隆并安装 Smaug\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Falexknowshtml\u002Fsmaug\ncd smaug\nnpm install\n```\n\n### 3. 初始化配置\n运行设置向导，它将自动创建所需目录并引导你完成配置：\n```bash\nnpx smaug setup\n```\n*向导会提示你输入 Twitter 凭证。若选择手动配置，请参阅下文“获取 Twitter 凭证”部分。*\n\n### 4. 获取 Twitter 凭证 (手动方式)\n如果未使用向导，需手动将 Twitter 会话 Cookie 填入配置文件：\n\n1.  复制示例配置：\n    ```bash\n    cp smaug.config.example.json smaug.config.json\n    ```\n2.  在浏览器打开 Twitter\u002FX，按 `F12` 打开开发者工具。\n3.  进入 **Application** (应用) -> **Cookies** -> `https:\u002F\u002Fx.com`。\n4.  找到并复制以下两个值：\n    *   `auth_token`\n    *   `ct0`\n5.  编辑 `smaug.config.json`，填入凭证：\n    ```json\n    {\n      \"twitter\": {\n        \"authToken\": \"your_auth_token_here\",\n        \"ct0\": \"your_ct0_here\"\n      }\n    }\n    ```\n    > **安全提示**: `smaug.config.json` 已被列入 `.gitignore`，请勿将其提交到公共仓库。\n\n## 基本使用\n\n### 运行完整流程\n这是最常用的命令，它将执行“抓取书签 -> AI 分析内容 -> 生成 Markdown 归档”的全过程：\n\n```bash\nnpx smaug run\n```\n\n### 常用操作命令\n\n*   **仅抓取书签** (默认抓取最近约 50-70 条):\n    ```bash\n    npx smaug fetch 20       # 抓取 20 条\n    npx smaug fetch --all    # 抓取所有书签 (需分页支持)\n    ```\n\n*   **仅处理已抓取的数据** (不重新联网抓取):\n    ```bash\n    npx smaug process\n    ```\n\n*   **从点赞中抓取** (默认为书签):\n    ```bash\n    npx smaug fetch --source likes\n    ```\n\n*   **批量处理以控制成本** (限制每次处理数量并监控 Token 消耗):\n    ```bash\n    npx smaug run --limit 50 -t\n    ```\n\n### 输出结果\n运行成功后，你将得到：\n1.  **`bookmarks.md`**: 按日期排序的书签摘要列表。\n2.  **`knowledge\u002F` 目录**:\n    *   `knowledge\u002Ftools\u002F`: GitHub 仓库等工具类链接的详细分析文件。\n    *   `knowledge\u002Farticles\u002F`: 文章、长推文等内容的详细归档。\n\n### 自动化运行 (可选)\n若需每 30 分钟自动同步一次，推荐使用 PM2：\n\n```bash\nnpm install -g pm2\npm2 start \"npx smaug run\" --cron \"*\u002F30 * * * *\" --name smaug\npm2 save\npm2 startup\n```","资深全栈开发者李明习惯在 Twitter\u002FX 上收藏大量技术推文，包括最新的 GitHub 开源项目、架构设计文章和代码片段，旨在构建个人知识库以备后续查阅。\n\n### 没有 smaug 时\n- **链接失效与内容丢失**：收藏的短链接（t.co）随时间推移可能失效，且无法直接查看原文完整内容，导致“收藏即遗忘”。\n- **人工整理耗时巨大**：手动点击每个书签，复制标题、作者和正文到笔记软件，并人工判断分类，处理几百条记录需耗费数小时。\n- **缺乏上下文关联**：仅保存了推文快照，缺少对引用的 GitHub 仓库星级、描述或长文核心观点的结构化提取，复习时难以快速抓住重点。\n- **知识分散难检索**：有价值的信息散落在浏览器书签和不同标签页中，未形成统一的 Markdown 文档库，无法通过本地搜索高效复用。\n\n### 使用 smaug 后\n- **自动归档与链接还原**：smaug 自动抓取所有书签，将 t.co 短链还原为真实 URL，并提取文章全文或 GitHub 仓库元数据，永久保存至本地 Markdown。\n- **AI 智能分析与分类**：内置 Claude Code 自动分析每条内容，提取核心摘要并按“工具”、“文章”等类别自动归入 `knowledge` 目录，无需人工干预。\n- **结构化知识沉淀**：生成的 Markdown 文件包含丰富的上下文（如仓库星级、作者信息），并按日期组织，直接形成可版本控制的知识库。\n- **工作流无缝集成**：配置一次后，只需运行简单命令即可批量处理新增书签，将原本数小时的手工劳动缩短为几分钟的自动化流程。\n\nsmaug 将碎片化的社交媒体收藏转化为结构化、可检索的本地知识资产，让开发者真正拥有自己的“数字宝藏库”。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Falexknowshtml_smaug_9d1bdad0.png","alexknowshtml","Alex Hillman","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Falexknowshtml_d944d134.jpg","Building jfdi.bot for busy business execs and sharing tools and lessons along the way. ",null,"Philadelphia","alexhillman","http:\u002F\u002Fjfdi.bot","https:\u002F\u002Fgithub.com\u002Falexknowshtml",[83],{"name":84,"color":85,"percentage":86},"JavaScript","#f1e05a",100,805,81,"2026-04-19T20:07:13","MIT",4,"Linux, macOS, Windows","不需要 GPU","未说明",{"notes":96,"python":97,"dependencies":98},"该工具是基于 Node.js 的命令行工具，非深度学习模型，因此无需 GPU。核心依赖是鸟鸟 CLI (bird CLI) 用于获取 Twitter 数据，以及 Claude Code 或 OpenCode 用于 AI 分析。需要配置 Twitter 的 auth_token 和 ct0 Cookie。处理大量书签时会产生显著的 AI Token 消耗成本。","不需要 Python (基于 Node.js)",[99,100,101],"Node.js (需支持 npm)","bird CLI (Twitter API 封装)","@anthropic\u002Fclaude-code (或 OpenCode)",[27,17],"2026-03-27T02:49:30.150509","2026-04-20T10:23:56.402352",[106,111,116,121,126,131,136,141],{"id":107,"question_zh":108,"answer_zh":109,"source_url":110},44552,"在 Windows 上运行时出现 'curl' 或 'head' 命令未找到的错误，如何解决？","该问题是由于项目依赖 Unix 特定工具导致的。维护者已发布修复：将剩余的 `curl` 调用替换为原生的 `fetch()` API（位于 processor.js 中的 expandTcoLink, fetchGitHubContent, fetchArticleContent 函数）。请升级到最新版本以确保完全兼容 Windows。","https:\u002F\u002Fgithub.com\u002Falexknowshtml\u002Fsmaug\u002Fissues\u002F8",{"id":112,"question_zh":113,"answer_zh":114,"source_url":115},44553,"运行 `npx smaug run` 时提示 'spawn claude ENOENT' 错误怎么办？","这通常是因为代码试图查找名为 `claude` 的可执行文件，但 Claude Code 的实际安装名称通常是 `claude-code`。此外，Windows 上使用 `where` 而非 `which` 命令。维护者已在最新版本中修复了此逻辑，使其能正确识别 `claude-code` 并处理 Windows 环境。请更新到最新版本。","https:\u002F\u002Fgithub.com\u002Falexknowshtml\u002Fsmaug\u002Fissues\u002F15",{"id":117,"question_zh":118,"answer_zh":119,"source_url":120},44554,"运行 `npx smaug run` 时 Claude Code 无限挂起（Hang）不响应，如何解决？","这是因为在启动 Claude Code 时，stdin 被设置为 'inherit' 但没有连接输入，导致其在 -p (print) 模式下等待输入。解决方案是修改 `src\u002Fjob.js` 第 161 行附近的 spawn 配置，将 `stdio: ['inherit', 'pipe', 'pipe']` 改为 `stdio: ['pipe', 'pipe', 'pipe']`，确保 stdin 是一个正常的管道。此修复已合并到最新版本中。","https:\u002F\u002Fgithub.com\u002Falexknowshtml\u002Fsmaug\u002Fissues\u002F10",{"id":122,"question_zh":123,"answer_zh":124,"source_url":125},44555,"使用 `npx smaug fetch [数量]` 时，获取的书签数量远超预期（例如请求 100 却得到 161），原因是什么？","这是一个参数解释错误。底层工具 `bird` 将该数值误解为“页数”而非“书签数量”（例如请求 100 被当作 100 页或按页计算逻辑处理）。维护者已在最新版本中修复了该参数传递逻辑，现在可以正确按指定数量获取书签。请升级软件。","https:\u002F\u002Fgithub.com\u002Falexknowshtml\u002Fsmaug\u002Fissues\u002F16",{"id":127,"question_zh":128,"answer_zh":129,"source_url":130},44556,"遇到 'Failed to fetch bookmarks: Unexpected end of JSON input' 错误该如何处理？","这通常发生在获取部分书签后解析 JSON 失败时。社区用户已提供补丁修复了此问题，维护者已将修补程序合并到最新版本中。如果您仍在使用旧版本，请尝试升级到最新版；或者检查您的网络连接及 Twitter\u002FX API 返回的数据完整性。","https:\u002F\u002Fgithub.com\u002Falexknowshtml\u002Fsmaug\u002Fissues\u002F2",{"id":132,"question_zh":133,"answer_zh":134,"source_url":135},44557,"不小心将包含 Token 的 `smaug.config.json` 提交到了仓库，应该如何补救和预防？","首先，必须立即轮换（撤销并重新生成）泄露的 X (Twitter) Token。其次，应将 `smaug.config.json` 添加到 `.gitignore` 文件中以防止再次提交。建议创建一个 `smaug.config.json.example` 文件作为模板供用户参考，并在 README 中更新相关设置向导提示。这些措施已在项目中实施。","https:\u002F\u002Fgithub.com\u002Falexknowshtml\u002Fsmaug\u002Fissues\u002F13",{"id":137,"question_zh":138,"answer_zh":139,"source_url":140},44558,"如何支持更多的模型后端（如 Opencode）？","社区贡献者已经提供了对 Opencode 的支持原型，并经过优化合并到了主分支中。这使得 Smaug 能够访问更广泛的模型集合。请确保您使用的是包含此更新的最新版本。","https:\u002F\u002Fgithub.com\u002Falexknowshtml\u002Fsmaug\u002Fissues\u002F9",{"id":142,"question_zh":143,"answer_zh":144,"source_url":145},44559,"提交的 PR 中包含个人敏感数据（如配置文件、Claude 上下文）该怎么办？","维护者提醒：在提交 PR 时务必小心，避免提交个人数据（如 `smaug.config.json` 或 `claude.md`），这不仅会泄露隐私还会增加维护者的工作负担。如果发生这种情况，维护者通常会只挑选（cherry-pick）有用的代码部分而忽略包含敏感数据的提交。建议在本地清理历史或使用 `.gitignore` 排除敏感文件后再提交。","https:\u002F\u002Fgithub.com\u002Falexknowshtml\u002Fsmaug\u002Fissues\u002F4",[147,152,157],{"id":148,"version":149,"summary_zh":150,"released_at":151},351975,"v0.3.1","- 将 package.json 中的版本号与 GitHub 发布版本同步\n- 修复 bird CLI v0.6.0 的分页 JSON 输出格式\n- 使用原生 fetch 替代 curl，以提高 Windows 兼容性\n- 在设置向导中添加凭据安全警告\n- 通过 .gitignore 忽略配置文件，防止凭据泄露","2026-01-06T02:14:24",{"id":153,"version":154,"summary_zh":155,"released_at":156},351976,"v0.3.0","## 新功能\n\n### 💰 令牌使用跟踪\n\n使用新的 `-t` 标志跟踪 Claude API 费用：\n\n```bash\nnpx smaug run -t\n```\n\n每次运行结束时会显示详细的细分信息，包括输入\u002F输出令牌数、缓存使用情况以及按模型估算的费用。\n\n### 📁 支持书签文件夹\n\n保留你的 Twitter 书签文件夹结构！通过配置文件夹 ID 与标签名称的映射来实现：\n\n```json\n{\n  \"folders\": {\n    \"1234567890\": \"ai-tools\",\n    \"0987654321\": \"articles-to-read\"\n  }\n}\n```\n\n现在，书签会在 `bookmarks.md` 条目和知识文件的 frontmatter 中包含文件夹标签。\n\n### ⚡ 可配置的并行处理\n\n新增 `parallelThreshold` 配置选项（默认值为 8），用于控制何时启用并行子代理处理。小批量任务现在将按顺序处理，以提高速度：\n\n```json\n{\n  \"parallelThreshold\": 8\n}\n```\n\n### 🎯 批量限制\n\n使用新的 `--limit` 标志以受控批次处理书签：\n\n```bash\nnpx smaug run --limit 50 -t    # 每次处理 50 个，并跟踪费用\n```\n\n### 🐛 错误修复\n\n- **修复了嵌套的 Claude 调用**：解决了 Claude 启动子进程时出现卡顿的问题。\n- **修复了标准输入处理**：将 `inherit` 改为 `pipe`，以防止阻塞。\n- **修复了 bird CLI 的管道缓冲问题**：现在所有系统上都能正确捕获 JSON 输出。\n- **修复了波浪号展开问题**：主目录路径在各平台上都能可靠工作。\n\n### 🌍 跨平台改进\n\n- 将 `jq` 和 `sed` 的 Shell 命令替换为 Node.js 等效实现。\n- 除 Node.js 外，不再需要其他系统依赖。\n- 在 Windows（需安装 Node.js）、macOS 和 Linux 上均可运行。\n\n### 🧪 开发者体验\n\n- 添加了全面的测试套件。\n- 引入了 CI 工作流进行自动化测试。\n- 改进了错误信息和日志记录。\n\n## 升级步骤\n\n```bash\ngit pull\nnpm install\n```\n\n从 v0.2.x 版本升级不会破坏现有功能。\n\n## 完整变更日志\n\nhttps:\u002F\u002Fgithub.com\u002Falexknowshtml\u002Fsmaug\u002Fcompare\u002Fv0.2...v0.3.0","2026-01-05T21:06:44",{"id":158,"version":159,"summary_zh":160,"released_at":161},351977,"v0.2","## 变更内容\n* 由 @dctmfoo 在 https:\u002F\u002Fgithub.com\u002Falexknowshtml\u002Fsmaug\u002Fpull\u002F1 中修复了 ESM 路径和临时目录的 Windows 兼容性问题。\n* 新增点赞支持，需使用最新版本的 Bird 依赖。\n* 添加了实验性的媒体支持，目前正在等待 Bird 中媒体支持的合并。目前会优雅地回退。\n* 通过多步骤协议提升了长时间运行命令的可靠性。\n* 小幅优化用户体验。\n\n## 新贡献者\n* @dctmfoo 在 https:\u002F\u002Fgithub.com\u002Falexknowshtml\u002Fsmaug\u002Fpull\u002F1 中完成了首次贡献。\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Falexknowshtml\u002Fsmaug\u002Fcommits\u002Fv0.2","2026-01-02T20:25:16"]