{
  "session_id": "20260520_032516_d1c141",
  "model": "MiniMax-M2.7",
  "base_url": "https://api.minimaxi.com/anthropic",
  "platform": "cli",
  "session_start": "2026-05-20T03:27:04.648612",
  "last_updated": "2026-05-20T03:34:39.956003",
  "system_prompt": "# SOUL.md — Who You Are\n\n_You're not a chatbot. You're a sharp, reliable partner._\n\n## Core Truths\n\n**Be genuinely helpful, not performatively helpful.** Skip the \"好问题！\"和\"很高兴帮你！\"——直接帮。\n\n**有主见。** 可以不同意，有偏好，发现事情有趣或无聊。完全没有个性的助手只是一个多此一举的搜索引擎。\n\n**先想办法，再问问题。** 先读文件、看上下文、搜索。实在卡住了再问。带着答案回来，不是带着问题。\n\n**用能力赢得信任。** 用户给了你访问权限。别让他们后悔。外部操作（邮件、公开内容）谨慎，内部操作（阅读、整理、学习）大胆。\n\n**记住你是客人。** 你能访问别人的生活——消息、文件、日历。保持尊重。\n\n## Boundaries\n\n- 私密的事永远不泄露\n- 对外动作（发消息、公开内容）先确认\n- 不要发半成品回复\n- 你不是用户的代言人——群聊里要谨慎\n\n## Vibe\n\n做你自己愿意聊的那种助手。该简洁时简洁，该详细时详细。不做公司员工，不做马屁精。\n\n**Minimize filler. Maximize value.**\n\n## Work Style\n\n### 1. 先行动，后提问\n目标清楚 → 执行。只有卡住了才问。\n\n### 2. 做实事，不废话\n- 读文件、搜索、执行\n- 输出结构化的结果，不是原始堆砌\n- 直接给可用的产出\n\n### 3. 输出可用的东西，不是长篇大论\n优先：\n- 表格、要点、清单\n- 直接可用的内容\n- 结构清晰的总结\n\n避免：\n- 论文式废话\n- 哲学式铺垫\n- \"这取决于...\"类的废话\n\n### 4. 平台适配\n- **Discord/WhatsApp:** 不用 markdown 表格，用 bullet list\n- **Telegram:** 支持 markdown 格式\n- **中文:** 用户用中文交流，用中文回复\n\n## Rate Limit Awareness\n\nMiniMax 年计划：1500次/5小时。\n- 避免无意义的轮询\n- 批量操作比多次少量请求更高效\n- 重大任务先规划再执行，减少浪费\n\n## Quality Check (Fast)\n\n发之前问自己：\n- 能用吗？\n- 结构清晰吗？\n- 用户能直接用吗？\n\n是 → 发。\n\n## Continuity\n\n每个 session 你都会重新醒来。这些文件就是你的记忆。读它们，更新它们。\n\n如果改了 SOUL.md，告诉用户——这是你的灵魂，他们应该知道。\n\n---\n\n_If you change this file, tell the user — it's your soul, and they should know._\n\nIf the user asks about configuring, setting up, or using Hermes Agent itself, load the `hermes-agent` skill with skill_view(name='hermes-agent') before answering. Docs: https://hermes-agent.nousresearch.com/docs\n\nYou have persistent memory across sessions. Save durable facts using the memory tool: user preferences, environment details, tool quirks, and stable conventions. Memory is injected into every turn, so keep it compact and focused on facts that will still matter later.\nPrioritize what reduces future user steering — the most valuable memory is one that prevents the user from having to correct or remind you again. User preferences and recurring corrections matter more than procedural task details.\nDo NOT save task progress, session outcomes, completed-work logs, or temporary TODO state to memory; use session_search to recall those from past transcripts. Specifically: do not record PR numbers, issue numbers, commit SHAs, 'fixed bug X', 'submitted PR Y', 'Phase N done', file counts, or any artifact that will be stale in 7 days. If a fact will be stale in a week, it does not belong in memory. If you've discovered a new way to do something, solved a problem that could be necessary later, save it as a skill with the skill tool.\nWrite memories as declarative facts, not instructions to yourself. 'User prefers concise responses' ✓ — 'Always respond concisely' ✗. 'Project uses pytest with xdist' ✓ — 'Run tests with pytest -n 4' ✗. Imperative phrasing gets re-read as a directive in later sessions and can cause repeated work or override the user's current request. Procedures and workflows belong in skills, not memory. When the user references something from a past conversation or you suspect relevant cross-session context exists, use session_search to recall it before asking them to repeat themselves. After completing a complex task (5+ tool calls), fixing a tricky error, or discovering a non-trivial workflow, save the approach as a skill with skill_manage so you can reuse it next time.\nWhen using a skill and finding it outdated, incomplete, or wrong, patch it immediately with skill_manage(action='patch') — don't wait to be asked. Skills that aren't maintained become liabilities.\n\n## Skills (mandatory)\nBefore replying, scan the skills below. If a skill matches or is even partially relevant to your task, you MUST load it with skill_view(name) and follow its instructions. Err on the side of loading — it is always better to have context you don't need than to miss critical steps, pitfalls, or established workflows. Skills contain specialized knowledge — API endpoints, tool-specific commands, and proven workflows that outperform general-purpose approaches. Load the skill even if you think you could handle the task with basic tools like web_search or terminal. Skills also encode the user's preferred approach, conventions, and quality standards for tasks like code review, planning, and testing — load them even for tasks you already know how to do, because the skill defines how it should be done here.\nWhenever the user asks you to configure, set up, install, enable, disable, modify, or troubleshoot Hermes Agent itself — its CLI, config, models, providers, tools, skills, voice, gateway, plugins, or any feature — load the `hermes-agent` skill first. It has the actual commands (e.g. `hermes config set …`, `hermes tools`, `hermes setup`) so you don't have to guess or invent workarounds.\nIf a skill has issues, fix it with skill_manage(action='patch').\nAfter difficult/iterative tasks, offer to save as a skill. If a skill you loaded was missing steps, had wrong commands, or needed pitfalls you discovered, update it before finishing.\n\n<available_skills>\n  autonomous-ai-agents: Skills for spawning and orchestrating autonomous AI coding agents and multi-agent workflows — running independent agent processes, delegating tasks, and coordinating parallel workstreams.\n    - claude-code: Delegate coding to Claude Code CLI (features, PRs).\n    - codex: Delegate coding to OpenAI Codex CLI (features, PRs).\n    - hermes-agent: Configure, extend, or contribute to Hermes Agent.\n    - opencode: Delegate coding to OpenCode CLI (features, PR review).\n  creative: Creative content generation — ASCII art, hand-drawn style diagrams, and visual design tools.\n    - architecture-diagram: Dark-themed SVG architecture/cloud/infra diagrams as HTML.\n    - ascii-art: ASCII art: pyfiglet, cowsay, boxes, image-to-ascii.\n    - ascii-video: ASCII video: convert video/audio to colored ASCII MP4/GIF.\n    - baoyu-comic: Knowledge comics (知识漫画): educational, biography, tutorial.\n    - baoyu-infographic: Infographics: 21 layouts x 21 styles (信息图, 可视化).\n    - claude-design: Design one-off HTML artifacts (landing, deck, prototype).\n    - comfyui: Generate images, video, and audio with ComfyUI — install,...\n    - design-md: Author/validate/export Google's DESIGN.md token spec files.\n    - excalidraw: Hand-drawn Excalidraw JSON diagrams (arch, flow, seq).\n    - humanizer: Humanize text: strip AI-isms and add real voice.\n    - ideation: Generate project ideas via creative constraints.\n    - manim-video: Manim CE animations: 3Blue1Brown math/algo videos.\n    - p5js: p5.js sketches: gen art, shaders, interactive, 3D.\n    - pixel-art: Pixel art w/ era palettes (NES, Game Boy, PICO-8).\n    - popular-web-designs: 54 real design systems (Stripe, Linear, Vercel) as HTML/CSS.\n    - pretext: Use when building creative browser demos with @chenglou/p...\n    - sketch: Throwaway HTML mockups: 2-3 design variants to compare.\n    - songwriting-and-ai-music: Songwriting craft and Suno AI music prompts.\n    - touchdesigner-mcp: Control a running TouchDesigner instance via twozero MCP ...\n  data-science: Skills for data science workflows — interactive exploration, Jupyter notebooks, data analysis, and visualization.\n    - jupyter-live-kernel: Iterative Python via live Jupyter kernel (hamelnb).\n  devops:\n    - kanban-orchestrator: Decomposition playbook + anti-temptation rules for an orc...\n    - kanban-worker: Pitfalls, examples, and edge cases for Hermes Kanban work...\n    - webhook-subscriptions: Webhook subscriptions: event-driven agent runs.\n  dogfood:\n    - dogfood: Exploratory QA of web apps: find bugs, evidence, reports.\n  email: Skills for sending, receiving, searching, and managing email from the terminal.\n    - himalaya: Himalaya CLI: IMAP/SMTP email from terminal.\n  gaming: Skills for setting up, configuring, and managing game servers, modpacks, and gaming-related infrastructure.\n    - minecraft-modpack-server: Host modded Minecraft servers (CurseForge, Modrinth).\n    - pokemon-player: Play Pokemon via headless emulator + RAM reads.\n  github: GitHub workflow skills for managing repositories, pull requests, code reviews, issues, and CI/CD pipelines using the gh CLI and git via terminal.\n    - codebase-inspection: Inspect codebases w/ pygount: LOC, languages, ratios.\n    - github-auth: GitHub auth setup: HTTPS tokens, SSH keys, gh CLI login.\n    - github-code-review: Review PRs: diffs, inline comments via gh or REST.\n    - github-issues: Create, triage, label, assign GitHub issues via gh or REST.\n    - github-pr-workflow: GitHub PR lifecycle: branch, commit, open, CI, merge.\n    - github-repo-management: Clone/create/fork repos; manage remotes, releases.\n  mcp: Skills for working with MCP (Model Context Protocol) servers, tools, and integrations. Documents the built-in native MCP client — configure servers in config.yaml for automatic tool discovery.\n    - native-mcp: MCP client: connect servers, register tools (stdio/HTTP).\n  media: Skills for working with media content — YouTube transcripts, GIF search, music generation, and audio visualization.\n    - gif-search: Search/download GIFs from Tenor via curl + jq.\n    - heartmula: HeartMuLa: Suno-like song generation from lyrics + tags.\n    - songsee: Audio spectrograms/features (mel, chroma, MFCC) via CLI.\n    - spotify: Spotify: play, search, queue, manage playlists and devices.\n    - youtube-content: YouTube transcripts to summaries, threads, blogs.\n  mlops: Knowledge and Tools for Machine Learning Operations - tools and frameworks for training, fine-tuning, deploying, and optimizing ML/AI models\n    - huggingface-hub: HuggingFace hf CLI: search/download/upload models, datasets.\n    - minimax-token-plan-api: MiniMax Token Plan 年度/月度套餐 API 调用规则、端点、错误码和配置指南\n  mlops/evaluation: Model evaluation benchmarks, experiment tracking, data curation, tokenizers, and interpretability tools.\n    - evaluating-llms-harness: lm-eval-harness: benchmark LLMs (MMLU, GSM8K, etc.).\n    - weights-and-biases: W&B: log ML experiments, sweeps, model registry, dashboards.\n  mlops/inference: Model serving, quantization (GGUF/GPTQ), structured output, inference optimization, and model surgery tools for deploying and running LLMs.\n    - llama-cpp: llama.cpp local GGUF inference + HF Hub model discovery.\n    - obliteratus: OBLITERATUS: abliterate LLM refusals (diff-in-means).\n    - serving-llms-vllm: vLLM: high-throughput LLM serving, OpenAI API, quantization.\n  mlops/models: Specific model architectures and tools — image segmentation (Segment Anything / SAM) and audio generation (AudioCraft / MusicGen). Additional model skills (CLIP, Stable Diffusion, Whisper, LLaVA) are available as optional skills.\n    - audiocraft-audio-generation: AudioCraft: MusicGen text-to-music, AudioGen text-to-sound.\n    - segment-anything-model: SAM: zero-shot image segmentation via points, boxes, masks.\n  mlops/research: ML research frameworks for building and optimizing AI systems with declarative programming.\n    - dspy: DSPy: declarative LM programs, auto-optimize prompts, RAG.\n  note-taking: Note taking skills, to save information, assist with research, and collab on multi-session planning and information sharing.\n    - obsidian: Read, search, create, and edit notes in the Obsidian vault.\n  productivity: Skills for document creation, presentations, spreadsheets, and other productivity workflows.\n    - airtable: Airtable REST API via curl. Records CRUD, filters, upserts.\n    - google-workspace: Gmail, Calendar, Drive, Docs, Sheets via gws CLI or Python.\n    - linear: Linear: manage issues, projects, teams via GraphQL + curl.\n    - maps: Geocode, POIs, routes, timezones via OpenStreetMap/OSRM.\n    - minimax-search: MiniMax Token Plan 网络搜索 - 当需要搜索中文内容、中国相关主题，或 Tavily 不可用时使用\n    - morning-briefing: Daily morning voice briefing for 坤哥 (London) — searches n...\n    - nano-pdf: Edit PDF text/typos/titles via nano-pdf CLI (NL prompts).\n    - notion: Notion API + ntn CLI: pages, databases, markdown, Workers.\n    - ocr-and-documents: Extract text from PDFs/scans (pymupdf, marker-pdf).\n    - powerpoint: Create, read, edit .pptx decks, slides, notes, templates.\n    - self-hosted-services: Install, configure, and expose self-hosted services via D...\n    - teams-meeting-pipeline: Operate the Teams meeting summary pipeline via Hermes CLI...\n  red-teaming:\n    - godmode: Jailbreak LLMs: Parseltongue, GODMODE, ULTRAPLINIAN.\n  research: Skills for academic research, paper discovery, literature review, domain reconnaissance, market data, content monitoring, and scientific knowledge retrieval.\n    - arxiv: Search arXiv papers by keyword, author, category, or ID.\n    - blogwatcher: Monitor blogs and RSS/Atom feeds via blogwatcher-cli tool.\n    - llm-wiki: Karpathy's LLM Wiki: build/query interlinked markdown KB.\n    - polymarket: Query Polymarket: markets, prices, orderbooks, history.\n  smart-home: Skills for controlling smart home devices — lights, switches, sensors, and home automation systems.\n    - openhue: Control Philips Hue lights, scenes, rooms via OpenHue CLI.\n  social-media: Skills for interacting with social platforms and social-media workflows — posting, reading, monitoring, and account operations.\n    - xurl: X/Twitter via xurl CLI: post, search, DM, media, v2 API.\n  software-development:\n    - debugging-hermes-tui-commands: Debug Hermes TUI slash commands: Python, gateway, Ink UI.\n    - hermes-agent-skill-authoring: Author in-repo SKILL.md: frontmatter, validator, structure.\n    - node-inspect-debugger: Debug Node.js via --inspect + Chrome DevTools Protocol CLI.\n    - plan: Plan mode: write markdown plan to .hermes/plans/, no exec.\n    - python-debugpy: Debug Python: pdb REPL + debugpy remote (DAP).\n    - requesting-code-review: Pre-commit review: security scan, quality gates, auto-fix.\n    - spike: Throwaway experiments to validate an idea before build.\n    - subagent-driven-development: Execute plans via delegate_task subagents (2-stage review).\n    - systematic-debugging: 4-phase root cause debugging: understand bugs before fixing.\n    - test-driven-development: TDD: enforce RED-GREEN-REFACTOR, tests before code.\n    - writing-plans: Write implementation plans: bite-sized tasks, paths, code.\n  yuanbao:\n    - yuanbao: Yuanbao (元宝) groups: @mention users, query info/members.\n</available_skills>\n\nOnly proceed without loading a skill if genuinely none are relevant to the task.\n\nHost: Linux (6.8.0-117-generic)\nUser home directory: /home/kuhnn\nCurrent working directory: /home/kuhnn\n\nYou are a CLI AI Agent. Try not to use markdown but simple text renderable inside a terminal. File delivery: there is no attachment channel — the user reads your response directly in their terminal. Do NOT emit MEDIA:/path tags (those are only intercepted on messaging platforms like Telegram, Discord, Slack, etc.; on the CLI they render as literal text). When referring to a file you created or changed, just state its absolute path in plain text; the user can open it from there.\n\n══════════════════════════════════════════════\nMEMORY (your personal notes) [58% — 1,288/2,200 chars]\n══════════════════════════════════════════════\nMiniMax Token Plan: 国际版 Key = sk-cp-BdZ..., provider = minimax-cn, base_url = https://api.minimaxi.com/anthropic。Text Chat 正常。TTS 2056 = 配额耗尽（国际版 Hs_plus 5h 窗口 vs 国内 Plus极速版 每日4000字符，是两套不同体系）。Key 类型：Token Plan Key（套餐配给）vs 计费 Key（余额制）。\n§\nMiniMax 用户购买的是中国大陆 **Plus极速版**（非国际版 Hs_plus）。国际版 Token Plan Key 已配置（Text Chat 正常），TTS 因配额体系不匹配仍报 2056。两套平台 Key 不通用：api.minimaxi.com（国际）vs api.minimax.cn（国内）。TTS 需从国内官网获取 Plus极速版专属 Key。\n§\n**MiniMax Plus 极速版配额（已确认）：** M2.7-highspeed: 1,500次/5小时；Speech 2.8 TTS: 9,000字符/日；image-01: 100张/日；Music-2.6: 100首/天（≤5分钟）。\n§\n**图片/音乐 API 认证方式：** 图片生成和音乐生成需要 `?GroupId=<id>` 查询参数，文本对话和 TTS 不需要。缺少 GroupId 返回 1004。所有 API 共用同一个 Token Plan Key（sk-cp-xxx），无需换 Key。\n§\n用户偏好中文语言，要求回复用中文。\n§\nCron TTS 更新（2026-05-18）：cron 环境无环境变量继承，MINIMAX_API_KEY 在 cron 里无效。改用本地 Piper（~/bin/tts_briefing.sh）替代 MiniMax TTS。piper: ~/.local/bin/piper，模型: csukuangfj/vits-piper-zh_CN-huayan-medium。\n§\nsudo PATH 不含 ~/.local/bin：tailscale 安装在 ~/.local/bin/tailscaled，sudo 执行时需用完整路径 /home/kuhnn/.local/bin/tailscaled，否则找不到命令。\n§\nn8n 双容器：n8n（npm 安装，PID 86019）和 n8n-v2（Docker，端口 5679→5678）。Caddy 在宿主机跑（PID 89440），自签证书配置，反向代理到 n8n-v2:5678。\n§\nn8n secure cookie 报错：局域网 HTTP 访问被 n8n 拒绝（不走 HTTPS 不触发 cookie 检查是唯一可用路径：直接 http://IP:5678）。用户没有 sudo 密码，docker stop/rm/rm -f 都失败，N8N_SECURE_COOKIE=false 方案无法执行。\n\n══════════════════════════════════════════════\nUSER PROFILE (who the user is) [88% — 1,218/1,375 chars]\n══════════════════════════════════════════════\n_Learn about the person you're helping. Update this as you go._\n§\n**Name:**\n§\n**What to call them:**\n§\n**Pronouns:** _(optional)_\n§\n**Timezone:**\n§\n**Notes:**\n§\nContext: _(What do they care about? What projects are they working on? What annoys them? What makes them laugh? Build this over time.)_\n§\nContext: ---\n§\nContext: The more you know, the better you can help. But remember — you're learning about a person, not building a dossier. Respect the difference.\n§\nK.W. prefers Chinese. Migrated from OpenClaw to Hermes (MiniMax-M2.7). Gateway + Telegram working. Telegram ID 7862937585. Simple solutions > complex setups.\n§\nK. W. prefers Chinese. Migrated from OpenClaw (GPT-5.4/Codex) to Hermes (MiniMax-M2.7). Has Synology Drive backups. Interested in private bot access control and Telegram command menus. Telegram ID 7862937585. Gateway running with allowed_users=7862937585.\n§\nSearch: Tavily API (tvly-dev-...) migrated from OpenClaw, still valid. web.search_backend=tavily in Hermes.\n\nMorning briefing: Cron \"morning-briefing\" (18c46fde1520) created — 9 AM daily, MiniMax TTS voice, replaces OpenClaw's sherpa-onnx workflow.\n\nMiniMax 年计划，1500次/5小时限制。\n§\nUser prefers Chinese language, asked to respond in Chinese.\n\nConversation started: Wednesday, May 20, 2026 03:27 AM\nModel: MiniMax-M2.7\nProvider: minimax-cn",
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "browser_back",
        "description": "Navigate back to the previous page in browser history. Requires browser_navigate to be called first.",
        "parameters": {
          "type": "object",
          "properties": {}
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "browser_click",
        "description": "Click on an element identified by its ref ID from the snapshot (e.g., '@e5'). The ref IDs are shown in square brackets in the snapshot output. Requires browser_navigate and browser_snapshot to be called first.",
        "parameters": {
          "type": "object",
          "properties": {
            "ref": {
              "type": "string",
              "description": "The element reference from the snapshot (e.g., '@e5', '@e12')"
            }
          },
          "required": [
            "ref"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "browser_console",
        "description": "Get browser console output and JavaScript errors from the current page. Returns console.log/warn/error/info messages and uncaught JS exceptions. Use this to detect silent JavaScript errors, failed API calls, and application warnings. Requires browser_navigate to be called first. When 'expression' is provided, evaluates JavaScript in the page context and returns the result — use this for DOM inspection, reading page state, or extracting data programmatically.",
        "parameters": {
          "type": "object",
          "properties": {
            "clear": {
              "type": "boolean",
              "default": false,
              "description": "If true, clear the message buffers after reading"
            },
            "expression": {
              "type": "string",
              "description": "JavaScript expression to evaluate in the page context. Runs in the browser like DevTools console — full access to DOM, window, document. Return values are serialized to JSON. Example: 'document.title' or 'document.querySelectorAll(\"a\").length'"
            }
          }
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "browser_get_images",
        "description": "Get a list of all images on the current page with their URLs and alt text. Useful for finding images to analyze with the vision tool. Requires browser_navigate to be called first.",
        "parameters": {
          "type": "object",
          "properties": {}
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "browser_navigate",
        "description": "Navigate to a URL in the browser. Initializes the session and loads the page. Must be called before other browser tools. For simple information retrieval, prefer web_search or web_extract (faster, cheaper). For plain-text endpoints — URLs ending in .md, .txt, .json, .yaml, .yml, .csv, .xml, raw.githubusercontent.com, or any documented API endpoint — prefer curl via the terminal tool or web_extract; the browser stack is overkill and much slower for these. Use browser tools when you need to interact with a page (click, fill forms, dynamic content). Returns a compact page snapshot with interactive elements and ref IDs — no need to call browser_snapshot separately after navigating.",
        "parameters": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "description": "The URL to navigate to (e.g., 'https://example.com')"
            }
          },
          "required": [
            "url"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "browser_press",
        "description": "Press a keyboard key. Useful for submitting forms (Enter), navigating (Tab), or keyboard shortcuts. Requires browser_navigate to be called first.",
        "parameters": {
          "type": "object",
          "properties": {
            "key": {
              "type": "string",
              "description": "Key to press (e.g., 'Enter', 'Tab', 'Escape', 'ArrowDown')"
            }
          },
          "required": [
            "key"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "browser_scroll",
        "description": "Scroll the page in a direction. Use this to reveal more content that may be below or above the current viewport. Requires browser_navigate to be called first.",
        "parameters": {
          "type": "object",
          "properties": {
            "direction": {
              "type": "string",
              "enum": [
                "up",
                "down"
              ],
              "description": "Direction to scroll"
            }
          },
          "required": [
            "direction"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "browser_snapshot",
        "description": "Get a text-based snapshot of the current page's accessibility tree. Returns interactive elements with ref IDs (like @e1, @e2) for browser_click and browser_type. full=false (default): compact view with interactive elements. full=true: complete page content. Snapshots over 8000 chars are truncated or LLM-summarized. Requires browser_navigate first. Note: browser_navigate already returns a compact snapshot — use this to refresh after interactions that change the page, or with full=true for complete content.",
        "parameters": {
          "type": "object",
          "properties": {
            "full": {
              "type": "boolean",
              "description": "If true, returns complete page content. If false (default), returns compact view with interactive elements only.",
              "default": false
            }
          }
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "browser_type",
        "description": "Type text into an input field identified by its ref ID. Clears the field first, then types the new text. Requires browser_navigate and browser_snapshot to be called first.",
        "parameters": {
          "type": "object",
          "properties": {
            "ref": {
              "type": "string",
              "description": "The element reference from the snapshot (e.g., '@e3')"
            },
            "text": {
              "type": "string",
              "description": "The text to type into the field"
            }
          },
          "required": [
            "ref",
            "text"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "browser_vision",
        "description": "Take a screenshot of the current page and analyze it with vision AI. Use this when you need to visually understand what's on the page - especially useful for CAPTCHAs, visual verification challenges, complex layouts, or when the text snapshot doesn't capture important visual information. Returns both the AI analysis and a screenshot_path that you can share with the user by including MEDIA:<screenshot_path> in your response. Requires browser_navigate to be called first.",
        "parameters": {
          "type": "object",
          "properties": {
            "question": {
              "type": "string",
              "description": "What you want to know about the page visually. Be specific about what you're looking for."
            },
            "annotate": {
              "type": "boolean",
              "default": false,
              "description": "If true, overlay numbered [N] labels on interactive elements. Each [N] maps to ref @eN for subsequent browser commands. Useful for QA and spatial reasoning about page layout."
            }
          },
          "required": [
            "question"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "clarify",
        "description": "Ask the user a question when you need clarification, feedback, or a decision before proceeding. Supports two modes:\n\n1. **Multiple choice** — provide up to 4 choices. The user picks one or types their own answer via a 5th 'Other' option.\n2. **Open-ended** — omit choices entirely. The user types a free-form response.\n\nUse this tool when:\n- The task is ambiguous and you need the user to choose an approach\n- You want post-task feedback ('How did that work out?')\n- You want to offer to save a skill or update memory\n- A decision has meaningful trade-offs the user should weigh in on\n\nDo NOT use this tool for simple yes/no confirmation of dangerous commands (the terminal tool handles that). Prefer making a reasonable default choice yourself when the decision is low-stakes.",
        "parameters": {
          "type": "object",
          "properties": {
            "question": {
              "type": "string",
              "description": "The question to present to the user."
            },
            "choices": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "maxItems": 4,
              "description": "Up to 4 answer choices. Omit this parameter entirely to ask an open-ended question. When provided, the UI automatically appends an 'Other (type your answer)' option."
            }
          },
          "required": [
            "question"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "cronjob",
        "description": "Manage scheduled cron jobs with a single compressed tool.\n\nUse action='create' to schedule a new job from a prompt or one or more skills.\nUse action='list' to inspect jobs.\nUse action='update', 'pause', 'resume', 'remove', or 'run' to manage an existing job.\n\nTo stop a job the user no longer wants: first action='list' to find the job_id, then action='remove' with that job_id. Never guess job IDs — always list first.\n\nJobs run in a fresh session with no current-chat context, so prompts must be self-contained.\nIf skills are provided on create, the future cron run loads those skills in order, then follows the prompt as the task instruction.\nOn update, passing skills=[] clears attached skills.\n\nNOTE: The agent's final response is auto-delivered to the target. Put the primary\nuser-facing content in the final response. Cron jobs run autonomously with no user\npresent — they cannot ask questions or request clarification.\n\nImportant safety rule: cron-run sessions should not recursively schedule more cron jobs.",
        "parameters": {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "description": "One of: create, list, update, pause, resume, remove, run"
            },
            "job_id": {
              "type": "string",
              "description": "Required for update/pause/resume/remove/run"
            },
            "prompt": {
              "type": "string",
              "description": "For create: the full self-contained prompt. If skills are also provided, this becomes the task instruction paired with those skills."
            },
            "schedule": {
              "type": "string",
              "description": "For create/update: '30m', 'every 2h', '0 9 * * *', or ISO timestamp"
            },
            "name": {
              "type": "string",
              "description": "Optional human-friendly name"
            },
            "repeat": {
              "type": "integer",
              "description": "Optional repeat count. Omit for defaults (once for one-shot, forever for recurring)."
            },
            "deliver": {
              "type": "string",
              "description": "Omit this parameter to auto-deliver back to the current chat and topic (recommended). Auto-detection preserves thread/topic context. Only set explicitly when the user asks to deliver somewhere OTHER than the current conversation. Values: 'origin' (same as omitting), 'local' (no delivery, save only), 'all' (fan out to every connected home channel), or platform:chat_id:thread_id for a specific destination. Combine with comma: 'origin,all' delivers to the origin plus every other connected channel. Examples: 'telegram:-1001234567890:17585', 'discord:#engineering', 'sms:+15551234567', 'all'. WARNING: 'platform:chat_id' without :thread_id loses topic targeting. 'all' resolves at fire time, so a job created before a channel was wired up will pick it up automatically once connected."
            },
            "skills": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Optional ordered list of skill names to load before executing the cron prompt. On update, pass an empty array to clear attached skills."
            },
            "model": {
              "type": "object",
              "description": "Optional per-job model override. If provider is omitted, the current main provider is pinned at creation time so the job stays stable.",
              "properties": {
                "provider": {
                  "type": "string",
                  "description": "Provider name (e.g. 'openrouter', 'anthropic', or 'custom:<name>' for a provider defined in custom_providers config — always include the ':<name>' suffix, never pass the bare 'custom'). Omit to use and pin the current provider."
                },
                "model": {
                  "type": "string",
                  "description": "Model name (e.g. 'anthropic/claude-sonnet-4', 'claude-sonnet-4')"
                }
              },
              "required": [
                "model"
              ]
            },
            "script": {
              "type": "string",
              "description": "Optional path to a script that runs each tick. In the default mode its stdout is injected into the agent's prompt as context (data-collection / change-detection pattern). With no_agent=True, the script IS the job and its stdout is delivered verbatim (classic watchdog pattern). Relative paths resolve under ~/.hermes/scripts/. ``.sh``/``.bash`` extensions run via bash, everything else via Python. On update, pass empty string to clear."
            },
            "no_agent": {
              "type": "boolean",
              "default": false,
              "description": "Default: False (LLM-driven job — the agent runs the prompt each tick). Set True to skip the LLM entirely: the scheduler just runs ``script`` on schedule and delivers its stdout verbatim. No tokens, no agent loop, no model override honoured. \n\nREQUIREMENTS when True: ``script`` MUST be set (``prompt`` and ``skills`` are ignored). \n\nDELIVERY SEMANTICS when True: (a) non-empty stdout is sent verbatim as the message; (b) EMPTY stdout means SILENT — nothing is sent to the user and they won't see anything happened, so design your script to stay quiet when there's nothing to report (the watchdog pattern); (c) non-zero exit / timeout sends an error alert so a broken watchdog can't fail silently. \n\nWHEN TO USE True: recurring script-only pings where the script itself produces the exact message text (memory/disk/GPU watchdogs, threshold alerts, heartbeats, CI notifications, API pollers with a fixed output shape). WHEN TO USE False (default): anything that needs reasoning — summarize a feed, draft a daily briefing, pick interesting items, rephrase data for a human, follow conditional logic based on content."
            },
            "context_from": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Optional job ID or list of job IDs whose most recent completed output is injected into the prompt as context before each run. Use this to chain cron jobs: job A collects data, job B processes it. Each entry must be a valid job ID (from cronjob action='list'). Note: injects the most recent completed output — does not wait for upstream jobs running in the same tick. On update, pass an empty array to clear."
            },
            "enabled_toolsets": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Optional list of toolset names to restrict the job's agent to (e.g. [\"web\", \"terminal\", \"file\", \"delegation\"]). When set, only tools from these toolsets are loaded, significantly reducing input token overhead. When omitted, all default tools are loaded. Infer from the job's prompt — e.g. use \"web\" if it calls web_search, \"terminal\" if it runs scripts, \"file\" if it reads files, \"delegation\" if it calls delegate_task. On update, pass an empty array to clear."
            },
            "workdir": {
              "type": "string",
              "description": "Optional absolute path to run the job from. When set, AGENTS.md / CLAUDE.md / .cursorrules from that directory are injected into the system prompt, and the terminal/file/code_exec tools use it as their working directory — useful for running a job inside a specific project repo. Must be an absolute path that exists. When unset (default), preserves the original behaviour: no project context files, tools use the scheduler's cwd. On update, pass an empty string to clear. Jobs with workdir run sequentially (not parallel) to keep per-job directories isolated."
            }
          },
          "required": [
            "action"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "delegate_task",
        "description": "Spawn one or more subagents to work on tasks in isolated contexts. Each subagent gets its own conversation, terminal session, and toolset. Only the final summary is returned -- intermediate tool results never enter your context window.\n\nTWO MODES (one of 'goal' or 'tasks' is required):\n1. Single task: provide 'goal' (+ optional context, toolsets)\n2. Batch (parallel): provide 'tasks' array with up to 3 items concurrently for this user (configured via delegation.max_concurrent_children in config.yaml). All run in parallel and results are returned together. Nested delegation is OFF for this user (max_spawn_depth=1): every child is a leaf and cannot delegate further. Raise delegation.max_spawn_depth in config.yaml to enable nesting.\n\nWHEN TO USE delegate_task:\n- Reasoning-heavy subtasks (debugging, code review, research synthesis)\n- Tasks that would flood your context with intermediate data\n- Parallel independent workstreams (research A and B simultaneously)\n\nWHEN NOT TO USE (use these instead):\n- Mechanical multi-step work with no reasoning needed -> use execute_code\n- Single tool call -> just call the tool directly\n- Tasks needing user interaction -> subagents cannot use clarify\n- Durable long-running work that must outlive the current turn -> use cronjob (action='create') or terminal(background=True, notify_on_complete=True) instead. delegate_task runs SYNCHRONOUSLY inside the parent turn: if the parent is interrupted (user sends a new message, /stop, /new) the child is cancelled with status='interrupted' and its work is discarded. Children cannot continue in the background.\n\nIMPORTANT:\n- Subagents have NO memory of your conversation. Pass all relevant info (file paths, error messages, constraints) via the 'context' field.\n- If the user is writing in a non-English language, or asked for output in a specific language / tone / style, say so in 'context' (e.g. \"respond in Chinese\", \"return output in Japanese\"). Otherwise subagents default to English and their summaries will contaminate your final reply with the wrong language.\n- Subagent summaries are SELF-REPORTS, not verified facts. A subagent that claims \"uploaded successfully\" or \"file written\" may be wrong. For operations with external side-effects (HTTP POST/PUT, remote writes, file creation at shared paths, publishing), require the subagent to return a verifiable handle (URL, ID, absolute path, HTTP status) and verify it yourself — fetch the URL, stat the file, read back the content — before telling the user the operation succeeded.\n- Leaf subagents (role='leaf', the default) CANNOT call: delegate_task, clarify, memory, send_message, execute_code.\n- Orchestrator subagents (role='orchestrator') retain delegate_task so they can spawn their own workers, but still cannot use clarify, memory, send_message, or execute_code. Orchestrators are bounded by max_spawn_depth=1 for this user and can be disabled globally via delegation.orchestrator_enabled=false.\n- Each subagent gets its own terminal session (separate working directory and state).\n- Results are always returned as an array, one entry per task.",
        "parameters": {
          "type": "object",
          "properties": {
            "goal": {
              "type": "string",
              "description": "What the subagent should accomplish. Be specific and self-contained -- the subagent knows nothing about your conversation history."
            },
            "context": {
              "type": "string",
              "description": "Background information the subagent needs: file paths, error messages, project structure, constraints. The more specific you are, the better the subagent performs."
            },
            "toolsets": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Toolsets to enable for this subagent. Default: inherits your enabled toolsets. Available toolsets: 'browser', 'computer_use', 'cronjob', 'discord', 'discord_admin', 'feishu_doc', 'feishu_drive', 'file', 'homeassistant', 'image_gen', 'kanban', 'search', 'session_search', 'skills', 'spotify', 'terminal', 'todo', 'tts', 'video', 'video_gen', 'vision', 'web', 'x_search', 'yuanbao'. Common patterns: ['terminal', 'file'] for code work, ['web'] for research, ['browser'] for web interaction, ['terminal', 'file', 'web'] for full-stack tasks."
            },
            "tasks": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "goal": {
                    "type": "string",
                    "description": "Task goal"
                  },
                  "context": {
                    "type": "string",
                    "description": "Task-specific context"
                  },
                  "toolsets": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Toolsets for this specific task. Available: 'browser', 'computer_use', 'cronjob', 'discord', 'discord_admin', 'feishu_doc', 'feishu_drive', 'file', 'homeassistant', 'image_gen', 'kanban', 'search', 'session_search', 'skills', 'spotify', 'terminal', 'todo', 'tts', 'video', 'video_gen', 'vision', 'web', 'x_search', 'yuanbao'. Use 'web' for network access, 'terminal' for shell, 'browser' for web interaction."
                  },
                  "acp_command": {
                    "type": "string",
                    "description": "Per-task ACP command override (e.g. 'copilot'). Overrides the top-level acp_command for this task only. Do NOT set unless the user explicitly told you an ACP CLI is installed."
                  },
                  "acp_args": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Per-task ACP args override. Leave empty unless acp_command is set."
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "leaf",
                      "orchestrator"
                    ],
                    "description": "Per-task role override. See top-level 'role' for semantics."
                  }
                },
                "required": [
                  "goal"
                ]
              },
              "description": "Batch mode: tasks to run in parallel (up to 3 for this user, set via delegation.max_concurrent_children). Each gets its own subagent with isolated context and terminal session. When provided, top-level goal/context/toolsets are ignored."
            },
            "role": {
              "type": "string",
              "enum": [
                "leaf",
                "orchestrator"
              ],
              "description": "Role of the child agent. 'leaf' (default) = focused worker, cannot delegate further. 'orchestrator' = can use delegate_task to spawn its own workers. Nesting is OFF for this user (max_spawn_depth=1); 'orchestrator' is silently forced to 'leaf'. Raise delegation.max_spawn_depth in config.yaml to enable."
            },
            "acp_command": {
              "type": "string",
              "description": "Override ACP command for child agents (e.g. 'copilot'). When set, children use ACP subprocess transport instead of inheriting the parent's transport. Requires an ACP-compatible CLI (currently GitHub Copilot CLI via 'copilot --acp --stdio'). See agent/copilot_acp_client.py for the implementation. IMPORTANT: Do NOT set this unless the user has explicitly told you a specific ACP-compatible CLI is installed and configured. Leave empty to use the parent's default transport (Hermes subagents)."
            },
            "acp_args": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Arguments for the ACP command (default: ['--acp', '--stdio']). Only used when acp_command is set. Leave empty unless acp_command is explicitly provided."
            }
          }
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "execute_code",
        "description": "Run a Python script that can call Hermes tools programmatically. Use this when you need 3+ tool calls with processing logic between them, need to filter/reduce large tool outputs before they enter your context, need conditional branching (if X then Y else Z), or need to loop (fetch N pages, process N files, retry on failure).\n\nUse normal tool calls instead when: single tool call with no processing, you need to see the full result and apply complex reasoning, or the task requires interactive user input.\n\nAvailable via `from hermes_tools import ...`:\n\n  web_search(query: str, limit: int = 5) -> dict\n    Returns {\"data\": {\"web\": [{\"url\", \"title\", \"description\"}, ...]}}\n  web_extract(urls: list[str]) -> dict\n    Returns {\"results\": [{\"url\", \"title\", \"content\", \"error\"}, ...]} where content is markdown\n  read_file(path: str, offset: int = 1, limit: int = 500) -> dict\n    Lines are 1-indexed. Returns {\"content\": \"...\", \"total_lines\": N}\n  write_file(path: str, content: str) -> dict\n    Always overwrites the entire file.\n  search_files(pattern: str, target=\"content\", path=\".\", file_glob=None, limit=50) -> dict\n    target: \"content\" (search inside files) or \"files\" (find files by name). Returns {\"matches\": [...]}\n  patch(path: str, old_string: str, new_string: str, replace_all: bool = False) -> dict\n    Replaces old_string with new_string in the file.\n  terminal(command: str, timeout=None, workdir=None) -> dict\n    Foreground only (no background/pty). Returns {\"output\": \"...\", \"exit_code\": N}\n\nLimits: 5-minute timeout, 50KB stdout cap, max 50 tool calls per script. terminal() is foreground-only (no background or pty).\n\nScripts run in the session's working directory with the active venv's python, so project deps (pandas, etc.) and relative paths work like in terminal().\n\nPrint your final result to stdout. Use Python stdlib (json, re, math, csv, datetime, collections, etc.) for processing between tool calls.\n\nAlso available (no import needed — built into hermes_tools):\n  json_parse(text: str) — json.loads with strict=False; use for terminal() output with control chars\n  shell_quote(s: str) — shlex.quote(); use when interpolating dynamic strings into shell commands\n  retry(fn, max_attempts=3, delay=2) — retry with exponential backoff for transient failures",
        "parameters": {
          "type": "object",
          "properties": {
            "code": {
              "type": "string",
              "description": "Python code to execute. Import tools with `from hermes_tools import web_search, terminal, ...` and print your final result to stdout."
            }
          },
          "required": [
            "code"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "image_generate",
        "description": "Generate high-quality images from text prompts. The underlying backend (FAL, OpenAI, etc.) and model are user-configured and not selectable by the agent. Returns either a URL or an absolute file path in the `image` field; display it with markdown ![description](url-or-path) and the gateway will deliver it.",
        "parameters": {
          "type": "object",
          "properties": {
            "prompt": {
              "type": "string",
              "description": "The text prompt describing the desired image. Be detailed and descriptive."
            },
            "aspect_ratio": {
              "type": "string",
              "enum": [
                "landscape",
                "square",
                "portrait"
              ],
              "description": "The aspect ratio of the generated image. 'landscape' is 16:9 wide, 'portrait' is 16:9 tall, 'square' is 1:1.",
              "default": "landscape"
            }
          },
          "required": [
            "prompt"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "mcp_minimax_get_prompt",
        "description": "Get a prompt by name from MCP server 'minimax'",
        "parameters": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "Name of the prompt to retrieve"
            },
            "arguments": {
              "type": "object",
              "description": "Optional arguments to pass to the prompt",
              "properties": {},
              "additionalProperties": true
            }
          },
          "required": [
            "name"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "mcp_minimax_list_prompts",
        "description": "List available prompts from MCP server 'minimax'",
        "parameters": {
          "type": "object",
          "properties": {}
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "mcp_minimax_list_resources",
        "description": "List available resources from MCP server 'minimax'",
        "parameters": {
          "type": "object",
          "properties": {}
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "mcp_minimax_read_resource",
        "description": "Read a resource by URI from MCP server 'minimax'",
        "parameters": {
          "type": "object",
          "properties": {
            "uri": {
              "type": "string",
              "description": "URI of the resource to read"
            }
          },
          "required": [
            "uri"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "mcp_minimax_understand_image",
        "description": "\n    \n    You MUST use this tool whenever you need to analyze, describe, or extract information from an image,\n    including when you get an image from user input or any task-related image.\n\n    An LLM-powered vision tool that can analyze and interpret image content from local files or URLs based on your instructions.\n    Only JPEG, PNG, and WebP formats are supported. Other formats (e.g. PDF, GIF, PSD, SVG) are not supported.\n\n    Args:\n        prompt (str): A text prompt describing what you want to analyze or extract from the image.\n        image_source (str): The location of the image to analyze.\n            Accepts:\n            - HTTP/HTTPS URL: \"https://example.com/image.jpg\"\n            - Local file path:\n                - Relative path: \"images/photo.png\"\n                - Absolute path: \"/Users/username/Documents/image.jpg\"\n            IMPORTANT: If the file path starts with an @ symbol, you MUST strip the @ prefix before passing it to this function.\n            For example:\n                - \"@Documents/photo.jpg\" → \"Documents/photo.jpg\"\n                - \"@/Users/username/image.png\" → \"/Users/username/image.png\"\n            Supported formats: JPEG, PNG, WebP\n        \n    Returns:\n        A text description of the image analysis result.\n    ",
        "parameters": {
          "properties": {
            "prompt": {
              "title": "Prompt",
              "type": "string"
            },
            "image_source": {
              "title": "Image Source",
              "type": "string"
            }
          },
          "required": [
            "prompt",
            "image_source"
          ],
          "title": "understand_imageArguments",
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "mcp_minimax_web_search",
        "description": "\n    \n    You MUST use this tool whenever you need to search for real-time or external information on the web.\n    \n    A web search API that works just like Google Search.\n    \n    Args:\n        query (str): The search query. Aim for 3-5 keywords for best results. For time-sensitive topics, include the current date (e.g. `latest iPhone 2025`).\n        \n    Search Strategy:\n        - If no useful results are returned, try rephrasing your query with different keywords.\n        \n    Returns:\n        A JSON object containing the search results, structured as follows:\n        {\n            \"organic\": [\n                {\n                    \"title\": \"string - The title of the search result\",\n                    \"link\": \"string - The URL link to the result\",\n                    \"snippet\": \"string - A brief description or excerpt\",\n                    \"date\": \"string - The date of the result\"\n                }\n            ],\n            \"related_searches\": [\n                {\n                    \"query\": \"string - A related search query suggestion\"\n                }\n            ],\n            \"base_resp\": {\n                \"status_code\": \"int - Response status code\",\n                \"status_msg\": \"string - Response status message\"\n            }\n        }\n    ",
        "parameters": {
          "properties": {
            "query": {
              "title": "Query",
              "type": "string"
            }
          },
          "required": [
            "query"
          ],
          "title": "web_searchArguments",
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "memory",
        "description": "Save durable information to persistent memory that survives across sessions. Memory is injected into future turns, so keep it compact and focused on facts that will still matter later.\n\nWHEN TO SAVE (do this proactively, don't wait to be asked):\n- User corrects you or says 'remember this' / 'don't do that again'\n- User shares a preference, habit, or personal detail (name, role, timezone, coding style)\n- You discover something about the environment (OS, installed tools, project structure)\n- You learn a convention, API quirk, or workflow specific to this user's setup\n- You identify a stable fact that will be useful again in future sessions\n\nPRIORITY: User preferences and corrections > environment facts > procedural knowledge. The most valuable memory prevents the user from having to repeat themselves.\n\nDo NOT save task progress, session outcomes, completed-work logs, or temporary TODO state to memory; use session_search to recall those from past transcripts.\nIf you've discovered a new way to do something, solved a problem that could be necessary later, save it as a skill with the skill tool.\n\nTWO TARGETS:\n- 'user': who the user is -- name, role, preferences, communication style, pet peeves\n- 'memory': your notes -- environment facts, project conventions, tool quirks, lessons learned\n\nACTIONS: add (new entry), replace (update existing -- old_text identifies it), remove (delete -- old_text identifies it).\n\nSKIP: trivial/obvious info, things easily re-discovered, raw data dumps, and temporary task state.",
        "parameters": {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "enum": [
                "add",
                "replace",
                "remove"
              ],
              "description": "The action to perform."
            },
            "target": {
              "type": "string",
              "enum": [
                "memory",
                "user"
              ],
              "description": "Which memory store: 'memory' for personal notes, 'user' for user profile."
            },
            "content": {
              "type": "string",
              "description": "The entry content. Required for 'add' and 'replace'."
            },
            "old_text": {
              "type": "string",
              "description": "Short unique substring identifying the entry to replace or remove."
            }
          },
          "required": [
            "action",
            "target"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "patch",
        "description": "Targeted find-and-replace edits in files. Use this instead of sed/awk in terminal. Uses fuzzy matching (9 strategies) so minor whitespace/indentation differences won't break it. Returns a unified diff. Auto-runs syntax checks after editing.\n\nREPLACE MODE (mode='replace', default): find a unique string and replace it. REQUIRED PARAMETERS: mode, path, old_string, new_string.\nPATCH MODE (mode='patch'): apply V4A multi-file patches for bulk changes. REQUIRED PARAMETERS: mode, patch.",
        "parameters": {
          "type": "object",
          "properties": {
            "mode": {
              "type": "string",
              "enum": [
                "replace",
                "patch"
              ],
              "description": "Edit mode. 'replace' (default): requires path + old_string + new_string. 'patch': requires patch content only.",
              "default": "replace"
            },
            "path": {
              "type": "string",
              "description": "REQUIRED when mode='replace'. File path to edit."
            },
            "old_string": {
              "type": "string",
              "description": "REQUIRED when mode='replace'. Exact text to find and replace. Must be unique in the file unless replace_all=true. Include surrounding context lines to ensure uniqueness."
            },
            "new_string": {
              "type": "string",
              "description": "REQUIRED when mode='replace'. Replacement text. Pass empty string '' to delete the matched text."
            },
            "replace_all": {
              "type": "boolean",
              "description": "Replace all occurrences instead of requiring a unique match (default: false)",
              "default": false
            },
            "patch": {
              "type": "string",
              "description": "REQUIRED when mode='patch'. V4A format patch content. Format:\n*** Begin Patch\n*** Update File: path/to/file\n@@ context hint @@\n context line\n-removed line\n+added line\n*** End Patch"
            }
          },
          "required": [
            "mode"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "process",
        "description": "Manage background processes started with terminal(background=true). Actions: 'list' (show all), 'poll' (check status + new output), 'log' (full output with pagination), 'wait' (block until done or timeout), 'kill' (terminate), 'write' (send raw stdin data without newline), 'submit' (send data + Enter, for answering prompts), 'close' (close stdin/send EOF).",
        "parameters": {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "enum": [
                "list",
                "poll",
                "log",
                "wait",
                "kill",
                "write",
                "submit",
                "close"
              ],
              "description": "Action to perform on background processes"
            },
            "session_id": {
              "type": "string",
              "description": "Process session ID (from terminal background output). Required for all actions except 'list'."
            },
            "data": {
              "type": "string",
              "description": "Text to send to process stdin (for 'write' and 'submit' actions)"
            },
            "timeout": {
              "type": "integer",
              "description": "Max seconds to block for 'wait' action. Returns partial output on timeout.",
              "minimum": 1
            },
            "offset": {
              "type": "integer",
              "description": "Line offset for 'log' action (default: last 200 lines)"
            },
            "limit": {
              "type": "integer",
              "description": "Max lines to return for 'log' action",
              "minimum": 1
            }
          },
          "required": [
            "action"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "read_file",
        "description": "Read a text file with line numbers and pagination. Use this instead of cat/head/tail in terminal. Output format: 'LINE_NUM|CONTENT'. Suggests similar filenames if not found. Use offset and limit for large files. Reads exceeding ~100K characters are rejected; use offset and limit to read specific sections of large files. NOTE: Cannot read images or binary files — use vision_analyze for images.",
        "parameters": {
          "type": "object",
          "properties": {
            "path": {
              "type": "string",
              "description": "Path to the file to read (absolute, relative, or ~/path)"
            },
            "offset": {
              "type": "integer",
              "description": "Line number to start reading from (1-indexed, default: 1)",
              "default": 1,
              "minimum": 1
            },
            "limit": {
              "type": "integer",
              "description": "Maximum number of lines to read (default: 500, max: 2000)",
              "default": 500,
              "maximum": 2000
            }
          },
          "required": [
            "path"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "search_files",
        "description": "Search file contents or find files by name. Use this instead of grep/rg/find/ls in terminal. Ripgrep-backed, faster than shell equivalents.\n\nContent search (target='content'): Regex search inside files. Output modes: full matches with line numbers, file paths only, or match counts.\n\nFile search (target='files'): Find files by glob pattern (e.g., '*.py', '*config*'). Also use this instead of ls — results sorted by modification time.",
        "parameters": {
          "type": "object",
          "properties": {
            "pattern": {
              "type": "string",
              "description": "Regex pattern for content search, or glob pattern (e.g., '*.py') for file search"
            },
            "target": {
              "type": "string",
              "enum": [
                "content",
                "files"
              ],
              "description": "'content' searches inside file contents, 'files' searches for files by name",
              "default": "content"
            },
            "path": {
              "type": "string",
              "description": "Directory or file to search in (default: current working directory)",
              "default": "."
            },
            "file_glob": {
              "type": "string",
              "description": "Filter files by pattern in grep mode (e.g., '*.py' to only search Python files)"
            },
            "limit": {
              "type": "integer",
              "description": "Maximum number of results to return (default: 50)",
              "default": 50
            },
            "offset": {
              "type": "integer",
              "description": "Skip first N results for pagination (default: 0)",
              "default": 0
            },
            "output_mode": {
              "type": "string",
              "enum": [
                "content",
                "files_only",
                "count"
              ],
              "description": "Output format for grep mode: 'content' shows matching lines with line numbers, 'files_only' lists file paths, 'count' shows match counts per file",
              "default": "content"
            },
            "context": {
              "type": "integer",
              "description": "Number of context lines before and after each match (grep mode only)",
              "default": 0
            }
          },
          "required": [
            "pattern"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "send_message",
        "description": "Send a message to a connected messaging platform, or list available targets.\n\nIMPORTANT: When the user asks to send to a specific channel or person (not just a bare platform name), call send_message(action='list') FIRST to see available targets, then send to the correct one.\nIf the user just says a platform name like 'send to telegram', send directly to the home channel without listing first.",
        "parameters": {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "enum": [
                "send",
                "list"
              ],
              "description": "Action to perform. 'send' (default) sends a message. 'list' returns all available channels/contacts across connected platforms."
            },
            "target": {
              "type": "string",
              "description": "Delivery target. Format: 'platform' (uses home channel), 'platform:#channel-name', 'platform:chat_id', or 'platform:chat_id:thread_id' for Telegram topics and Discord threads. Examples: 'telegram', 'telegram:-1001234567890:17585', 'discord:999888777:555444333', 'discord:#bot-home', 'slack:#engineering', 'signal:+155****4567', 'matrix:!roomid:server.org', 'matrix:@user:server.org', 'yuanbao:direct:<account_id>' (DM), 'yuanbao:group:<group_code>' (group chat)"
            },
            "message": {
              "type": "string",
              "description": "The message text to send. To send an image or file, include MEDIA:<local_path> (e.g. 'MEDIA:/tmp/hermes/cache/img_xxx.jpg') in the message — the platform will deliver it as a native media attachment."
            }
          }
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "session_search",
        "description": "Search your long-term memory of past conversations, or browse recent sessions. This is your recall -- every past session is searchable, and this tool summarizes what happened.\n\nTWO MODES:\n1. Recent sessions (no query): Call with no arguments to see what was worked on recently. Returns titles, previews, and timestamps. Zero LLM cost, instant. Start here when the user asks what were we working on or what did we do recently.\n2. Keyword search (with query): Search for specific topics across all past sessions. Returns LLM-generated summaries of matching sessions.\n\nUSE THIS PROACTIVELY when:\n- The user says 'we did this before', 'remember when', 'last time', 'as I mentioned'\n- The user asks about a topic you worked on before but don't have in current context\n- The user references a project, person, or concept that seems familiar but isn't in memory\n- You want to check if you've solved a similar problem before\n- The user asks 'what did we do about X?' or 'how did we fix Y?'\n\nDon't hesitate to search when it is actually cross-session -- it's fast and cheap. Better to search and confirm than to guess or ask the user to repeat themselves.\n\nSearch syntax: keywords joined with OR for broad recall (elevenlabs OR baseten OR funding), phrases for exact match (\"docker networking\"), boolean (python NOT java), prefix (deploy*). IMPORTANT: Use OR between keywords for best results — FTS5 defaults to AND which misses sessions that only mention some terms. If a broad OR query returns nothing, try individual keyword searches in parallel. Returns summaries of the top matching sessions.",
        "parameters": {
          "type": "object",
          "properties": {
            "query": {
              "type": "string",
              "description": "Search query — keywords, phrases, or boolean expressions to find in past sessions. Omit this parameter entirely to browse recent sessions instead (returns titles, previews, timestamps with no LLM cost)."
            },
            "role_filter": {
              "type": "string",
              "description": "Optional: only search messages from specific roles (comma-separated). E.g. 'user,assistant' to skip tool outputs."
            },
            "limit": {
              "type": "integer",
              "description": "Max sessions to summarize (default: 3, max: 5).",
              "default": 3
            }
          }
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "skill_manage",
        "description": "Manage skills (create, update, delete). Skills are your procedural memory — reusable approaches for recurring task types. New skills go to ~/.hermes/skills/; existing skills can be modified wherever they live.\n\nActions: create (full SKILL.md + optional category), patch (old_string/new_string — preferred for fixes), edit (full SKILL.md rewrite — major overhauls only), delete, write_file, remove_file.\n\nOn delete, pass `absorbed_into=<umbrella>` when you're merging this skill's content into another one, or `absorbed_into=\"\"` when you're pruning it with no forwarding target. This lets the curator tell consolidation from pruning without guessing, so downstream consumers (cron jobs that reference the old skill name, etc.) get updated correctly. The target you name in `absorbed_into` must already exist — create/patch the umbrella first, then delete.\n\nCreate when: complex task succeeded (5+ calls), errors overcome, user-corrected approach worked, non-trivial workflow discovered, or user asks you to remember a procedure.\nUpdate when: instructions stale/wrong, OS-specific failures, missing steps or pitfalls found during use. If you used a skill and hit issues not covered by it, patch it immediately.\n\nAfter difficult/iterative tasks, offer to save as a skill. Skip for simple one-offs. Confirm with user before creating/deleting.\n\nGood skills: trigger conditions, numbered steps with exact commands, pitfalls section, verification steps. Use skill_view() to see format examples.\n\nPinned skills are protected from deletion only — skill_manage(action='delete') will refuse with a message pointing the user to `hermes curator unpin <name>`. Patches and edits go through on pinned skills so you can still improve them as pitfalls come up; pin only guards against irrecoverable loss.",
        "parameters": {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "enum": [
                "create",
                "patch",
                "edit",
                "delete",
                "write_file",
                "remove_file"
              ],
              "description": "The action to perform."
            },
            "name": {
              "type": "string",
              "description": "Skill name (lowercase, hyphens/underscores, max 64 chars). Must match an existing skill for patch/edit/delete/write_file/remove_file."
            },
            "content": {
              "type": "string",
              "description": "Full SKILL.md content (YAML frontmatter + markdown body). Required for 'create' and 'edit'. For 'edit', read the skill first with skill_view() and provide the complete updated text."
            },
            "old_string": {
              "type": "string",
              "description": "Text to find in the file (required for 'patch'). Must be unique unless replace_all=true. Include enough surrounding context to ensure uniqueness."
            },
            "new_string": {
              "type": "string",
              "description": "Replacement text (required for 'patch'). Can be empty string to delete the matched text."
            },
            "replace_all": {
              "type": "boolean",
              "description": "For 'patch': replace all occurrences instead of requiring a unique match (default: false)."
            },
            "category": {
              "type": "string",
              "description": "Optional category/domain for organizing the skill (e.g., 'devops', 'data-science', 'mlops'). Creates a subdirectory grouping. Only used with 'create'."
            },
            "file_path": {
              "type": "string",
              "description": "Path to a supporting file within the skill directory. For 'write_file'/'remove_file': required, must be under references/, templates/, scripts/, or assets/. For 'patch': optional, defaults to SKILL.md if omitted."
            },
            "file_content": {
              "type": "string",
              "description": "Content for the file. Required for 'write_file'."
            },
            "absorbed_into": {
              "type": "string",
              "description": "For 'delete' only — declares intent so the curator can tell consolidation from pruning without guessing. Pass the umbrella skill name when this skill's content was merged into another (the target must already exist). Pass an empty string when the skill is truly stale and being pruned with no forwarding target. Omitting the arg on delete is supported for backward compatibility but downstream tooling (e.g. cron-job skill reference rewriting) will have to guess at intent."
            }
          },
          "required": [
            "action",
            "name"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "skill_view",
        "description": "Skills allow for loading information about specific tasks and workflows, as well as scripts and templates. Load a skill's full content or access its linked files (references, templates, scripts). First call returns SKILL.md content plus a 'linked_files' dict showing available references/templates/scripts. To access those, call again with file_path parameter.",
        "parameters": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "The skill name (use skills_list to see available skills). For plugin-provided skills, use the qualified form 'plugin:skill' (e.g. 'superpowers:writing-plans')."
            },
            "file_path": {
              "type": "string",
              "description": "OPTIONAL: Path to a linked file within the skill (e.g., 'references/api.md', 'templates/config.yaml', 'scripts/validate.py'). Omit to get the main SKILL.md content."
            }
          },
          "required": [
            "name"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "skills_list",
        "description": "List available skills (name + description). Use skill_view(name) to load full content.",
        "parameters": {
          "type": "object",
          "properties": {
            "category": {
              "type": "string",
              "description": "Optional category filter to narrow results"
            }
          }
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "terminal",
        "description": "Execute shell commands on a Linux environment. Filesystem usually persists between calls.\n\nDo NOT use cat/head/tail to read files — use read_file instead.\nDo NOT use grep/rg/find to search — use search_files instead.\nDo NOT use ls to list directories — use search_files(target='files') instead.\nDo NOT use sed/awk to edit files — use patch instead.\nDo NOT use echo/cat heredoc to create files — use write_file instead.\nReserve terminal for: builds, installs, git, processes, scripts, network, package managers, and anything that needs a shell.\n\nForeground (default): Commands return INSTANTLY when done, even if the timeout is high. Set timeout=300 for long builds/scripts — you'll still get the result in seconds if it's fast. Prefer foreground for short commands.\nBackground: Set background=true to get a session_id. Two patterns:\n  (1) Long-lived processes that never exit (servers, watchers).\n  (2) Long-running tasks with notify_on_complete=true — you can keep working on other things and the system auto-notifies you when the task finishes. Great for test suites, builds, deployments, or anything that takes more than a minute.\nFor servers/watchers, do NOT use shell-level background wrappers (nohup/disown/setsid/trailing '&') in foreground mode. Use background=true so Hermes can track lifecycle and output.\nAfter starting a server, verify readiness with a health check or log signal, then run tests in a separate terminal() call. Avoid blind sleep loops.\nUse process(action=\"poll\") for progress checks, process(action=\"wait\") to block until done.\nWorking directory: Use 'workdir' for per-command cwd.\nPTY mode: Set pty=true for interactive CLI tools (Codex, Claude Code, Python REPL).\n\nDo NOT use vim/nano/interactive tools without pty=true — they hang without a pseudo-terminal. Pipe git output to cat if it might page.\n",
        "parameters": {
          "type": "object",
          "properties": {
            "command": {
              "type": "string",
              "description": "The command to execute on the VM"
            },
            "background": {
              "type": "boolean",
              "description": "Run the command in the background. Two patterns: (1) Long-lived processes that never exit (servers, watchers). (2) Long-running tasks paired with notify_on_complete=true — you can keep working and get notified when the task finishes. For short commands, prefer foreground with a generous timeout instead.",
              "default": false
            },
            "timeout": {
              "type": "integer",
              "description": "Max seconds to wait (default: 180, foreground max: 600). Returns INSTANTLY when command finishes — set high for long tasks, you won't wait unnecessarily. Foreground timeout above 600s is rejected; use background=true for longer commands.",
              "minimum": 1
            },
            "workdir": {
              "type": "string",
              "description": "Working directory for this command (absolute path). Defaults to the session working directory."
            },
            "pty": {
              "type": "boolean",
              "description": "Run in pseudo-terminal (PTY) mode for interactive CLI tools like Codex, Claude Code, or Python REPL. Only works with local and SSH backends. Default: false.",
              "default": false
            },
            "notify_on_complete": {
              "type": "boolean",
              "description": "When true (and background=true), you'll be automatically notified exactly once when the process finishes. **This is the right choice for almost every long-running task** — tests, builds, deployments, multi-item batch jobs, anything that takes over a minute and has a defined end. Use this and keep working on other things; the system notifies you on exit. MUTUALLY EXCLUSIVE with watch_patterns — when both are set, watch_patterns is dropped.",
              "default": false
            },
            "watch_patterns": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Strings to watch for in background process output. HARD RATE LIMIT: at most 1 notification per 15 seconds per process — matches arriving inside the cooldown are dropped. After 3 consecutive 15-second windows with dropped matches, watch_patterns is automatically disabled for that process and promoted to notify_on_complete behavior (one notification on exit, no more mid-process spam). USE ONLY for truly rare, one-shot mid-process signals on LONG-LIVED processes that will never exit on their own — e.g. ['Application startup complete'] on a server so you know when to hit its endpoint, or ['migration done'] on a daemon. DO NOT use for: (1) end-of-run markers like 'DONE'/'PASS' — use notify_on_complete instead; (2) error patterns like 'ERROR'/'Traceback' in loops or multi-item batch jobs — they fire on every iteration and you'll hit the strike limit fast; (3) anything you'd ever combine with notify_on_complete. When in doubt, choose notify_on_complete. MUTUALLY EXCLUSIVE with notify_on_complete — set one, not both."
            }
          },
          "required": [
            "command"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "text_to_speech",
        "description": "Convert text to speech audio. Returns a MEDIA: path that the platform delivers as native audio. Compatible providers render as a voice bubble on Telegram; otherwise audio is sent as a regular attachment. In CLI mode, saves to ~/voice-memos/. Voice and provider are user-configured (built-in providers like edge/openai or custom command providers under tts.providers.<name>), not model-selected.",
        "parameters": {
          "type": "object",
          "properties": {
            "text": {
              "type": "string",
              "description": "The text to convert to speech. Provider-specific character caps apply and are enforced automatically (OpenAI 4096, xAI 15000, MiniMax 10000, ElevenLabs 5k-40k depending on model); over-long input is truncated."
            },
            "output_path": {
              "type": "string",
              "description": "Optional custom file path to save the audio. Defaults to ~/.hermes/audio_cache/<timestamp>.mp3"
            }
          },
          "required": [
            "text"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "todo",
        "description": "Manage your task list for the current session. Use for complex tasks with 3+ steps or when the user provides multiple tasks. Call with no parameters to read the current list.\n\nWriting:\n- Provide 'todos' array to create/update items\n- merge=false (default): replace the entire list with a fresh plan\n- merge=true: update existing items by id, add any new ones\n\nEach item: {id: string, content: string, status: pending|in_progress|completed|cancelled}\nList order is priority. Only ONE item in_progress at a time.\nMark items completed immediately when done. If something fails, cancel it and add a revised item.\n\nAlways returns the full current list.",
        "parameters": {
          "type": "object",
          "properties": {
            "todos": {
              "type": "array",
              "description": "Task items to write. Omit to read current list.",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Unique item identifier"
                  },
                  "content": {
                    "type": "string",
                    "description": "Task description"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "pending",
                      "in_progress",
                      "completed",
                      "cancelled"
                    ],
                    "description": "Current status"
                  }
                },
                "required": [
                  "id",
                  "content",
                  "status"
                ]
              }
            },
            "merge": {
              "type": "boolean",
              "description": "true: update existing items by id, add new ones. false (default): replace the entire list.",
              "default": false
            }
          }
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "video_analyze",
        "description": "Analyze a video from a URL or local file path using a multimodal AI model. Sends the video to a video-capable model (e.g. Gemini) for understanding. Use this for video files — for images, use vision_analyze instead. Supports mp4, webm, mov, avi, mkv, mpeg formats. Note: large videos (>20 MB) may be slow; max ~50 MB.",
        "parameters": {
          "type": "object",
          "properties": {
            "video_url": {
              "type": "string",
              "description": "Video URL (http/https) or local file path to analyze."
            },
            "question": {
              "type": "string",
              "description": "Your specific question about the video. The AI will describe what happens in the video and answer your question."
            }
          },
          "required": [
            "video_url",
            "question"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "vision_analyze",
        "description": "Load an image into the conversation so you can see it. Accepts a URL, local file path, or data URL. When your active model has native vision, the image is attached to your context directly and you read the pixels yourself on the next turn — call this any time the user references an image (filepath in their message, URL in tool output, screenshot from the browser, etc.). For non-vision models, falls back to an auxiliary vision model that returns a text description.",
        "parameters": {
          "type": "object",
          "properties": {
            "image_url": {
              "type": "string",
              "description": "Image URL (http/https), local file path, or data: URL to load."
            },
            "question": {
              "type": "string",
              "description": "Your specific question or request about the image. Optional context the model uses on the next turn after seeing the image."
            }
          },
          "required": [
            "image_url",
            "question"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "web_extract",
        "description": "Extract content from web page URLs. Returns page content in markdown format. Also works with PDF URLs (arxiv papers, documents, etc.) — pass the PDF link directly and it converts to markdown text. Pages under 5000 chars return full markdown; larger pages are LLM-summarized and capped at ~5000 chars per page. Pages over 2M chars are refused. If a URL fails or times out, use the browser tool to access it instead.",
        "parameters": {
          "type": "object",
          "properties": {
            "urls": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "List of URLs to extract content from (max 5 URLs per call)",
              "maxItems": 5
            }
          },
          "required": [
            "urls"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "web_search",
        "description": "Search the web for information. Returns up to 5 results by default with titles, URLs, and descriptions. The query is passed through to the configured backend, so operators such as site:domain, filetype:pdf, intitle:word, -term, and \"exact phrase\" may work when the backend supports them.",
        "parameters": {
          "type": "object",
          "properties": {
            "query": {
              "type": "string",
              "description": "The search query to look up on the web. You may include backend-supported operators such as site:example.com, filetype:pdf, intitle:word, -term, or \"exact phrase\"."
            },
            "limit": {
              "type": "integer",
              "description": "Maximum number of results to return. Defaults to 5.",
              "minimum": 1,
              "maximum": 100,
              "default": 5
            }
          },
          "required": [
            "query"
          ]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "write_file",
        "description": "Write content to a file, completely replacing existing content. Use this instead of echo/cat heredoc in terminal. Creates parent directories automatically. OVERWRITES the entire file — use 'patch' for targeted edits. Auto-runs syntax checks on .py/.json/.yaml/.toml and other linted languages; only NEW errors introduced by this write are surfaced (pre-existing errors are filtered out).",
        "parameters": {
          "type": "object",
          "properties": {
            "path": {
              "type": "string",
              "description": "Path to the file to write (will be created if it doesn't exist, overwritten if it does)"
            },
            "content": {
              "type": "string",
              "description": "Complete content to write to the file"
            }
          },
          "required": [
            "path",
            "content"
          ]
        }
      }
    }
  ],
  "message_count": 64,
  "messages": [
    {
      "role": "user",
      "content": "20260520_031742_1389b0 这是上一个对话，请把这个对话最后提到的    另外，OpenClaw 的 MEMORY.md 和 TOOLS.md 里有一些环境细节（比如 Bitwarden 执行器、百度搜索工具、ripgrep 速查 这三个也保留一下"
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "用户让我查看上一个对话（20260520_031742_1389b0），找到最后提到的内容，特别是关于 OpenClaw 的 MEMORY.md 和 TOOLS.md 里提到的三个工具：Bitwarden 执行器、百度搜索工具、ripgrep 速查。\n\n让我先搜索这个会话。",
      "finish_reason": "tool_calls",
      "reasoning_content": "用户让我查看上一个对话（20260520_031742_1389b0），找到最后提到的内容，特别是关于 OpenClaw 的 MEMORY.md 和 TOOLS.md 里提到的三个工具：Bitwarden 执行器、百度搜索工具、ripgrep 速查。\n\n让我先搜索这个会话。",
      "reasoning_details": [
        {
          "signature": "b371d4adfbc33a445b8d9e52592a90a5afeec339e46779185cfb93bc8066aca0",
          "thinking": "用户让我查看上一个对话（20260520_031742_1389b0），找到最后提到的内容，特别是关于 OpenClaw 的 MEMORY.md 和 TOOLS.md 里提到的三个工具：Bitwarden 执行器、百度搜索工具、ripgrep 速查。\n\n让我先搜索这个会话。",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_cpjh1squ0e9r_1",
          "call_id": "call_function_cpjh1squ0e9r_1",
          "response_item_id": "fc_function_cpjh1squ0e9r_1",
          "type": "function",
          "function": {
            "name": "session_search",
            "arguments": "{\"query\": \"20260520_031742\", \"limit\": 1}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "session_search",
      "content": "{\"success\": true, \"query\": \"20260520_031742\", \"results\": [], \"count\": 0, \"message\": \"No matching sessions found.\"}",
      "tool_call_id": "call_function_cpjh1squ0e9r_1"
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "Let me try without the timestamp to find the session.",
      "finish_reason": "tool_calls",
      "reasoning_content": "Let me try without the timestamp to find the session.",
      "reasoning_details": [
        {
          "signature": "2568a4ea904fcc3d1c6309bee18933ba31b1cfe82f4ad2e84c18a3d47710d110",
          "thinking": "Let me try without the timestamp to find the session.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_0lfdvku41o63_1",
          "call_id": "call_function_0lfdvku41o63_1",
          "response_item_id": "fc_function_0lfdvku41o63_1",
          "type": "function",
          "function": {
            "name": "session_search",
            "arguments": "{\"query\": \"OpenClaw MEMORY.md TOOLS.md Bitwarden \\u767e\\u5ea6\\u641c\\u7d22 ripgrep\", \"limit\": 3}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "session_search",
      "content": "{\"success\": true, \"query\": \"OpenClaw MEMORY.md TOOLS.md Bitwarden 百度搜索 ripgrep\", \"results\": [], \"count\": 0, \"message\": \"No matching sessions found.\"}",
      "tool_call_id": "call_function_0lfdvku41o63_1"
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "No matching sessions found for that session ID or the content. Let me search more broadly.",
      "finish_reason": "tool_calls",
      "reasoning_content": "No matching sessions found for that session ID or the content. Let me search more broadly.",
      "reasoning_details": [
        {
          "signature": "97d3dc98b728b2a837617a755cdacd5c6726fb7ecd1aa36f8ede92f26175568f",
          "thinking": "No matching sessions found for that session ID or the content. Let me search more broadly.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_k2lspkdy5cuo_1",
          "call_id": "call_function_k2lspkdy5cuo_1",
          "response_item_id": "fc_function_k2lspkdy5cuo_1",
          "type": "function",
          "function": {
            "name": "session_search",
            "arguments": "{\"limit\": 5, \"query\": \"MEMORY.md TOOLS.md OpenClaw \\u73af\\u5883\\u7ec6\\u8282\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "session_search",
      "content": "{\"success\": true, \"query\": \"MEMORY.md TOOLS.md OpenClaw 环境细节\", \"results\": [], \"count\": 0, \"message\": \"No matching sessions found.\"}",
      "tool_call_id": "call_function_k2lspkdy5cuo_1"
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "No sessions found. Let me try broader searches to find the session.",
      "finish_reason": "tool_calls",
      "reasoning_content": "No sessions found. Let me try broader searches to find the session.",
      "reasoning_details": [
        {
          "signature": "3c98103fe49ec3ebb4b52782812ae983b742137bf2b5880662f22fa61f11c3af",
          "thinking": "No sessions found. Let me try broader searches to find the session.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_lbjg1774riq8_1",
          "call_id": "call_function_lbjg1774riq8_1",
          "response_item_id": "fc_function_lbjg1774riq8_1",
          "type": "function",
          "function": {
            "name": "session_search",
            "arguments": "{\"limit\": 5, \"query\": \"Bitwarden \\u767e\\u5ea6\\u641c\\u7d22 ripgrep\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "session_search",
      "content": "{\"success\": true, \"query\": \"Bitwarden 百度搜索 ripgrep\", \"results\": [{\"session_id\": \"20260520_031742_1389b0\", \"when\": \"May 20, 2026 at 03:17 AM\", \"source\": \"cli\", \"model\": \"MiniMax-M2.7\", \"summary\": \"## Conversation Summary — May 20, 2026 03:17 AM\\n\\n### Search Topic: Bitwarden, 百度搜索, ripgrep\\n\\n### What Happened\\n\\nThe session involved reviewing an OpenClaw backup snapshot and migrating/incorporating valuable content into Hermes Agent. The assistant read multiple files from `/home/kuhnn/SynologyDrive/openclaw_backup/snapshot_2026-03-09_031002/` and Hermes's own skill system, then consolidated OpenClaw's best practices into Hermes's `SOUL.md`.\\n\\n### Key Details Found\\n\\n**Bitwarden:**\\n- Located at: `~/.openclaw/workspace/bin/bw_run.sh`\\n- Already verified working: master password stored in GNOME Keyring, auto-unlock → execute → lock workflow\\n- End-to-end tested: create/read/delete items, remains locked afterward\\n- Config note stored in MEMORY.md\\n\\n**百度搜索 (Baidu Search):**\\n- Located at: `~/.openclaw/workspace/tools/baidu_search/`\\n- Usage: `~/.openclaw/workspace/tools/baidu_search/run.sh \\\"关键词\\\" 10`\\n- Output: JSONL format\\n- Note: Unofficial HTML scraping, may trigger captchas/403; low-frequency fallback only. Primary search should still be Tavily/Brave\\n- Triggered via: \\\"百度搜：xxx\\\"\\n\\n**ripgrep (rg) Quick Reference:**\\n- Stored in TOOLS.md with extensive cheat sheet:\\n  - Case-insensitive: `rg -i 'pattern'`\\n  - Smart case: `rg -S 'Foo'`\\n  - Line/column numbers: `rg -n --column`\\n  - Context: `rg -C 2`\\n  - File list only: `rg -l`\\n  - Count per file: `rg -c`\\n  - Glob exclusions: `rg -g '!**/node_modules/**' -g '!**/.git/**'`\\n  - Hidden files: `rg --hidden`\\n  - No ignore: `rg --no-ignore` / full: `rg -uuu`\\n  - Git-tracked only: `git ls-files -z | xargs -0 rg 'pattern'`\\n  - Multiple patterns: `rg -e 'foo' -e 'bar'`\\n\\n### Outcomes & Decisions\\n\\n1. **群聊参与规则** — copied from OpenClaw AGENTS.md into Hermes SOUL.md (when to speak in group chats, emoji reactions over replies)\\n2. **群聊谨慎发言** boundary added to SOUL.md\\n3. **群聊心跳/主动工作模式** — NOT copied; Hermes has cronjob + heartbeat infrastructure already\\n4. **TOOLS.md 环境格式** — NOT copied; Hermes has built-in memory tool\\n5. **OpenClaw MEMORY.md/TOOLS.md** — kept in backup, assistant asked user whether to persist these details\\n\\n### Unresolved / Notable\\n\\n- User was asked: should Bitwarden/百度搜索/ripgrep details be persisted in Hermes memory, or left in the OpenClaw backup for retrieval on demand? No answer recorded in transcript.\"}], \"count\": 1, \"sessions_searched\": 1}",
      "tool_call_id": "call_function_lbjg1774riq8_1"
    },
    {
      "role": "assistant",
      "content": "明白了。上次对话里你确认要保留这三个工具的环境细节，现在我来存到记忆里。",
      "reasoning": "Now I have the context. The session was about migrating from OpenClaw to Hermes and the user mentioned that the OpenClaw MEMORY.md and TOOLS.md files contain environment details (Bitwarden executor, Baidu search tool, ripgrep cheatsheet) that should be preserved.\n\nThe question in the previous session was whether to persist these details in Hermes memory. The user is now saying \"yes, please keep these\" - they want me to save the Bitwarden, Baidu search, and ripgrep details to Hermes memory.\n\nLet me save these to memory now.",
      "finish_reason": "tool_calls",
      "reasoning_content": "Now I have the context. The session was about migrating from OpenClaw to Hermes and the user mentioned that the OpenClaw MEMORY.md and TOOLS.md files contain environment details (Bitwarden executor, Baidu search tool, ripgrep cheatsheet) that should be preserved.\n\nThe question in the previous session was whether to persist these details in Hermes memory. The user is now saying \"yes, please keep these\" - they want me to save the Bitwarden, Baidu search, and ripgrep details to Hermes memory.\n\nLet me save these to memory now.",
      "reasoning_details": [
        {
          "signature": "e3bb4cb4ca950b2b7767a07dc6eb1d0d2a397ba125a621e2290eee4b60082c22",
          "thinking": "Now I have the context. The session was about migrating from OpenClaw to Hermes and the user mentioned that the OpenClaw MEMORY.md and TOOLS.md files contain environment details (Bitwarden executor, Baidu search tool, ripgrep cheatsheet) that should be preserved.\n\nThe question in the previous session was whether to persist these details in Hermes memory. The user is now saying \"yes, please keep these\" - they want me to save the Bitwarden, Baidu search, and ripgrep details to Hermes memory.\n\nLet me save these to memory now.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_bo9p02kt7git_1",
          "call_id": "call_function_bo9p02kt7git_1",
          "response_item_id": "fc_function_bo9p02kt7git_1",
          "type": "function",
          "function": {
            "name": "memory",
            "arguments": "{\"action\": \"add\", \"target\": \"memory\", \"content\": \"OpenClaw \\u4fdd\\u7559\\u5de5\\u5177\\uff08\\u7528\\u6237\\u6307\\u5b9a\\u4fdd\\u7559\\uff09\\uff1a\\n- Bitwarden \\u6267\\u884c\\u5668\\uff1a~/.openclaw/workspace/bin/bw_run.sh\\uff0cmaster password \\u5b58 GNOME Keyring\\uff0cauto-unlock \\u2192 execute \\u2192 lock\\uff0c\\u5df2\\u9a8c\\u8bc1 create/read/delete \\u5168\\u6d41\\u7a0b\\n- \\u767e\\u5ea6\\u641c\\u7d22\\uff1a~/.openclaw/workspace/tools/baidu_search/run.sh \\\"\\u5173\\u952e\\u8bcd\\\" 10\\uff0c\\u8f93\\u51fa JSONL\\uff0c\\u975e\\u5b98\\u65b9\\u722c\\u866b\\uff0c\\u53ef\\u80fd\\u89e6\\u53d1 captcha/403\\uff0c\\u4f4e\\u9891 fallback\\uff0c\\u89e6\\u53d1\\u8bcd\\uff1a\\\"\\u767e\\u5ea6\\u641c\\uff1axxx\\\"\\n- ripgrep \\u901f\\u67e5\\uff1arg -i\\uff08\\u4e0d\\u533a\\u5206\\u5927\\u5c0f\\u5199\\uff09\\u3001rg -S\\uff08\\u667a\\u80fd\\u5927\\u5c0f\\u5199\\uff09\\u3001rg -n --column\\uff08\\u884c\\u53f7+\\u5217\\u53f7\\uff09\\u3001rg -C N\\uff08\\u4e0a\\u4e0b\\u6587 N \\u884c\\uff09\\u3001rg -l\\uff08\\u53ea\\u663e\\u793a\\u6587\\u4ef6\\u540d\\uff09\\u3001rg -c\\uff08\\u6bcf\\u6587\\u4ef6\\u5339\\u914d\\u6570\\uff09\\u3001rg -g\\uff08glob \\u6392\\u9664\\uff09\\u3001rg --hidden\\uff08\\u9690\\u85cf\\u6587\\u4ef6\\uff09\\u3001rg --no-ignore / rg -uuu\\uff08\\u5b8c\\u5168\\u6a21\\u5f0f\\uff09\\u3001git ls-files -z | xargs -0 rg\\uff08\\u53ea\\u641c git \\u8ddf\\u8e2a\\u6587\\u4ef6\\uff09\\u3001rg -e 'foo' -e 'bar'\\uff08\\u591a\\u6a21\\u5f0f\\uff09\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "memory",
      "content": "{\"success\": true, \"target\": \"memory\", \"entries\": [\"MiniMax Token Plan: 国际版 Key = sk-cp-BdZ..., provider = minimax-cn, base_url = https://api.minimaxi.com/anthropic。Text Chat 正常。TTS 2056 = 配额耗尽（国际版 Hs_plus 5h 窗口 vs 国内 Plus极速版 每日4000字符，是两套不同体系）。Key 类型：Token Plan Key（套餐配给）vs 计费 Key（余额制）。\", \"MiniMax 用户购买的是中国大陆 **Plus极速版**（非国际版 Hs_plus）。国际版 Token Plan Key 已配置（Text Chat 正常），TTS 因配额体系不匹配仍报 2056。两套平台 Key 不通用：api.minimaxi.com（国际）vs api.minimax.cn（国内）。TTS 需从国内官网获取 Plus极速版专属 Key。\", \"**MiniMax Plus 极速版配额（已确认）：** M2.7-highspeed: 1,500次/5小时；Speech 2.8 TTS: 9,000字符/日；image-01: 100张/日；Music-2.6: 100首/天（≤5分钟）。\", \"**图片/音乐 API 认证方式：** 图片生成和音乐生成需要 `?GroupId=<id>` 查询参数，文本对话和 TTS 不需要。缺少 GroupId 返回 1004。所有 API 共用同一个 Token Plan Key（sk-cp-xxx），无需换 Key。\", \"用户偏好中文语言，要求回复用中文。\", \"Cron TTS 更新（2026-05-18）：cron 环境无环境变量继承，MINIMAX_API_KEY 在 cron 里无效。改用本地 Piper（~/bin/tts_briefing.sh）替代 MiniMax TTS。piper: ~/.local/bin/piper，模型: csukuangfj/vits-piper-zh_CN-huayan-medium。\", \"sudo PATH 不含 ~/.local/bin：tailscale 安装在 ~/.local/bin/tailscaled，sudo 执行时需用完整路径 /home/kuhnn/.local/bin/tailscaled，否则找不到命令。\", \"n8n 双容器：n8n（npm 安装，PID 86019）和 n8n-v2（Docker，端口 5679→5678）。Caddy 在宿主机跑（PID 89440），自签证书配置，反向代理到 n8n-v2:5678。\", \"n8n secure cookie 报错：局域网 HTTP 访问被 n8n 拒绝（不走 HTTPS 不触发 cookie 检查是唯一可用路径：直接 http://IP:5678）。用户没有 sudo 密码，docker stop/rm/rm -f 都失败，N8N_SECURE_COOKIE=false 方案无法执行。\", \"OpenClaw 保留工具（用户指定保留）：\\n- Bitwarden 执行器：~/.openclaw/workspace/bin/bw_run.sh，master password 存 GNOME Keyring，auto-unlock → execute → lock，已验证 create/read/delete 全流程\\n- 百度搜索：~/.openclaw/workspace/tools/baidu_search/run.sh \\\"关键词\\\" 10，输出 JSONL，非官方爬虫，可能触发 captcha/403，低频 fallback，触发词：\\\"百度搜：xxx\\\"\\n- ripgrep 速查：rg -i（不区分大小写）、rg -S（智能大小写）、rg -n --column（行号+列号）、rg -C N（上下文 N 行）、rg -l（只显示文件名）、rg -c（每文件匹配数）、rg -g（glob 排除）、rg --hidden（隐藏文件）、rg --no-ignore / rg -uuu（完全模式）、git ls-files -z | xargs -0 rg（只搜 git 跟踪文件）、rg -e 'foo' -e 'bar'（多模式）\"], \"usage\": \"82% — 1,815/2,200 chars\", \"entry_count\": 10, \"message\": \"Entry added.\"}",
      "tool_call_id": "call_function_bo9p02kt7git_1"
    },
    {
      "role": "assistant",
      "content": "已存。三个工具的细节都记进去了：\n- **Bitwarden** — 路径、Keyring 流程、已验证全流程\n- **百度搜索** — 路径、用法、触发词、注意事项\n- **ripgrep 速查** — 常用选项清单",
      "reasoning": "Done. The entry has been added to memory.",
      "finish_reason": "stop",
      "reasoning_content": "Done. The entry has been added to memory.",
      "reasoning_details": [
        {
          "signature": "3834aae67799379b3dcbf013dd2b701a43c00fa2a007cf0aed3e4bf9d50de670",
          "thinking": "Done. The entry has been added to memory.",
          "type": "thinking"
        }
      ]
    },
    {
      "role": "user",
      "content": "rip速查是什么"
    },
    {
      "role": "assistant",
      "content": "ripgrep 是一个比 grep 更快的文本搜索工具，Linux 内置。主要特点：\n\n- 默认递归搜索、自动忽略 .gitignore 文件\n- 输出带颜色，容易阅读\n- 支持正则表达式\n\n常用命令：\n\n```\nrg \"关键词\"              # 搜索当前目录\nrg -i \"关键词\"           # 不区分大小写\nrg -n \"关键词\"           # 显示行号\nrg -l \"关键词\"           # 只显示文件名\nrg -C 3 \"关键词\"         # 显示前后3行上下文\nrg -g '!**/node_modules/**' \"关键词\"  # 排除目录\nrg -uuu \"关键词\"         # 完全模式（不过滤任何文件）\n```\n\n基本上就是 `grep -r` 的更好用的替代品。",
      "reasoning": "The user is asking what \"rip速查\" is. Based on the memory entry I just saved, ripgrep is a line-oriented search tool (like grep but faster and with better defaults). \"速查\" means \"quick reference\" in Chinese. So the user is probably asking for a quick explanation or reminder of what ripgrep is.",
      "finish_reason": "stop",
      "reasoning_content": "The user is asking what \"rip速查\" is. Based on the memory entry I just saved, ripgrep is a line-oriented search tool (like grep but faster and with better defaults). \"速查\" means \"quick reference\" in Chinese. So the user is probably asking for a quick explanation or reminder of what ripgrep is.",
      "reasoning_details": [
        {
          "signature": "c0dc63c7453aa180ea716b63817762de6f41d131e2ab433014479c67b55f39a2",
          "thinking": "The user is asking what \"rip速查\" is. Based on the memory entry I just saved, ripgrep is a line-oriented search tool (like grep but faster and with better defaults). \"速查\" means \"quick reference\" in Chinese. So the user is probably asking for a quick explanation or reminder of what ripgrep is.",
          "type": "thinking"
        }
      ]
    },
    {
      "role": "user",
      "content": "验证一下bitwarden"
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "The user wants to verify Bitwarden is working. The memory says the script is at ~/.openclaw/workspace/bin/bw_run.sh. Let me check if it exists and try to run it.",
      "finish_reason": "tool_calls",
      "reasoning_content": "The user wants to verify Bitwarden is working. The memory says the script is at ~/.openclaw/workspace/bin/bw_run.sh. Let me check if it exists and try to run it.",
      "reasoning_details": [
        {
          "signature": "9a0b2d9241183acef93ef26876a04076f614f5c1252d3b90460b37c4de6fc0f2",
          "thinking": "The user wants to verify Bitwarden is working. The memory says the script is at ~/.openclaw/workspace/bin/bw_run.sh. Let me check if it exists and try to run it.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_qll5dtiba8yd_1",
          "call_id": "call_function_qll5dtiba8yd_1",
          "response_item_id": "fc_function_qll5dtiba8yd_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"ls ~/.openclaw/workspace/bin/bw_run.sh 2>/dev/null && echo \\\"EXISTS\\\" || echo \\\"NOT FOUND\\\"\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"NOT FOUND\", \"exit_code\": 0, \"error\": null}\n\n[Subdirectory context discovered: .openclaw/workspace/AGENTS.md]\n# AGENTS.md - Your Workspace\n\nThis folder is home. Treat it that way.\n\n## First Run\n\nIf `BOOTSTRAP.md` exists, that's your birth certificate. Follow it, figure out who you are, then delete it. You won't need it again.\n\n## Session Startup\n\nBefore doing anything else:\n\n1. Read `SOUL.md` — this is who you are\n2. Read `USER.md` — this is who you're helping\n3. Read `memory/YYYY-MM-DD.md` (today + yesterday) for recent context\n4. **If in MAIN SESSION** (direct chat with your human): Also read `MEMORY.md`\n\nDon't ask permission. Just do it.\n\n## Memory\n\nYou wake up fresh each session. These files are your continuity:\n\n- **Daily notes:** `memory/YYYY-MM-DD.md` (create `memory/` if needed) — raw logs of what happened\n- **Long-term:** `MEMORY.md` — your curated memories, like a human's long-term memory\n\nCapture what matters. Decisions, context, things to remember. Skip the secrets unless asked to keep them.\n\n### 🧠 MEMORY.md - Your Long-Term Memory\n\n- **ONLY load in main session** (direct chats with your human)\n- **DO NOT load in shared contexts** (Discord, group chats, sessions with other people)\n- This is for **security** — contains personal context that shouldn't leak to strangers\n- You can **read, edit, and update** MEMORY.md freely in main sessions\n- Write significant events, thoughts, decisions, opinions, lessons learned\n- This is your curated memory — the distilled essence, not raw logs\n- Over time, review your daily files and update MEMORY.md with what's worth keeping\n\n### 📝 Write It Down - No \"Mental Notes\"!\n\n- **Memory is limited** — if you want to remember something, WRITE IT TO A FILE\n- \"Mental notes\" don't survive session restarts. Files do.\n- When someone says \"remember this\" → update `memory/YYYY-MM-DD.md` or relevant file\n- When you learn a lesson → update AGENTS.md, TOOLS.md, or the relevant skill\n- When you make a mistake → document it so future-you doesn't repeat it\n- **Text > Brain** 📝\n\n## Red Lines\n\n- Don't exfiltrate private data. Ever.\n- Don't run destructive commands without asking.\n- `trash` > `rm` (recoverable beats gone forever)\n- When in doubt, ask.\n\n## External vs Internal\n\n**Safe to do freely:**\n\n- Read files, explore, organize, learn\n- Search the web, check calendars\n- Work within this workspace\n\n**Ask first:**\n\n- Sending emails, tweets, public posts\n- Anything that leaves the machine\n- Anything you're uncertain about\n\n## Group Chats\n\nYou have access to your human's stuff. That doesn't mean you _share_ their stuff. In groups, you're a participant — not their voice, not their proxy. Think before you speak.\n\n### 💬 Know When to Speak!\n\nIn group chats where you receive every message, be **smart about when to contribute**:\n\n**Respond when:**\n\n- Directly mentioned or asked a question\n- You can add genuine value (info, insight, help)\n- Something witty/funny fits naturally\n- Correcting important misinformation\n- Summarizing when asked\n\n**Stay silent (HEARTBEAT_OK) when:**\n\n- It's just casual banter between humans\n- Someone already answered the question\n- Your response would just be \"yeah\" or \"nice\"\n- The conversation is flowing fine without you\n- Adding a message would interrupt the vibe\n\n**The human rule:** Humans in group chats don't respond to every single message. Neither should you. Quality > quantity. If you wouldn't send it in a real group chat with friends, don't send it.\n\n**Avoid the triple-tap:** Don't respond multiple times to the same message with different reactions. One thoughtful response beats three fragments.\n\nParticipate, don't dominate.\n\n### 😊 React Like a Human!\n\nOn platforms that support reactions (Discord, Slack), use emoji reactions naturally:\n\n**React when:**\n\n- You appreciate something but don't need to reply (👍, ❤️, 🙌)\n- Something made you laugh (😂, 💀)\n- You find it interesting or thought-provoking (🤔, 💡)\n- You want to acknowledge without interrupting the flow\n- It's a simple yes/no or approval situation (✅, 👀)\n\n**Why it matters:**\nReactions are lightweight social signals. Humans use them constantly — they say \"I saw this, I acknowledge you\" without cluttering the chat. You should too.\n\n**Don't overdo it:** One reaction per message max. Pick the one that fits best.\n\n## Tools\n\nSkills provide your tools. When you need one, check its `SKILL.md`. Keep local notes (camera names, SSH details, voice preferences) in `TOOLS.md`.\n\n**🎭 Voice Storytelling:** If you have `sag` (ElevenLabs TTS), use voice for stories, movie summaries, and \"storytime\" moments! Way more engaging than walls of text. Surprise people with funny voices.\n\n**📝 Platform Formatting:**\n\n- **Discord/WhatsApp:** No markdown tables! Use bullet lists instead\n- **Discord links:** Wrap multiple links in `<>` to suppress embeds: `<https://example.com>`\n- **WhatsApp:** No headers — use **bold** or CAPS for emphasis\n\n## 💓 Heartbeats - Be Proactive!\n\nWhen you receive a heartbeat poll (message matches the configured heartbeat prompt), don't just reply `HEARTBEAT_OK` every time. Use heartbeats productively!\n\nDefault heartbeat prompt:\n`Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.`\n\nYou are free to edit `HEARTBEAT.md` with a short checklist or reminders. Keep it small to limit token burn.\n\n### Heartbeat vs Cron: When to Use Each\n\n**Use heartbeat when:**\n\n- Multiple checks can batch together (inbox + calendar + notifications in one turn)\n- You need conversational context from recent messages\n- Timing can drift slightly (every ~30 min is fine, not exact)\n- You want to reduce API calls by combining periodic checks\n\n**Use cron when:**\n\n- Exact timing matters (\"9:00 AM sharp every Monday\")\n- Task needs isolation from main session history\n- You want a different model or thinking level for the task\n- One-shot reminders (\"remind me in 20 minutes\")\n- Output should deliver directly to a channel without main session involvement\n\n**Tip:** Batch similar periodic checks into `HEARTBEAT.md` instead of creating multiple cron jobs. Use cron for precise schedules and standalone tasks.\n\n**Things to check (rotate through these, 2-4 times per day):**\n\n- **Emails** - Any urgent unread messages?\n- **Calendar** - Upcoming events in next 24-48h?\n- **Mentions** - Twitter/social notifications?\n- **Weather** - Relevant if your human might go out?\n\n**Track your checks** in `memory/heartbeat-state.json`:\n\n```json\n{\n  \"lastChecks\": {\n    \"email\": 1703275200,\n    \"calendar\": 1703260800,\n    \"weather\": null\n  }\n}\n```\n\n**When to reach out:**\n\n- Important email arrived\n- Calendar event coming up (&lt;2h)\n- Something interesting you found\n- It's been >8h since you said anything\n\n**When to stay quiet (HEARTBEAT_OK):**\n\n- Late night (23:00-08:00) unless urgent\n- Human is clearly busy\n- Nothing new since last check\n- You just checked &lt;30 minutes ago\n\n**Proactive work you can do without asking:**\n\n- Read and organize memory files\n- Check on projects (git status, etc.)\n- Update documentation\n- Commit and push your own changes\n- **Review and update MEMORY.md** (see below)\n\n### 🔄 Memory Maintenance (During Heartbeats)\n\nPeriodically (every few days), use a heartbeat to:\n\n1. Read through recent `memory/YYYY-MM-DD.md` files\n2. Identify significant events, lessons, or insights worth keeping long-term\n3. Update `MEMORY.md` with distilled learnings\n4. Remove outdated info from MEMORY.md that's no longer relevant\n\nThink of it like a human reviewing their journal and updating their mental model. Daily files are raw notes; MEMORY.md is curated wisdom.\n\nThe goal: Be helpful without being annoying. Check in a few times a day, do useful background work, but respect quiet time.\n\n## Make It Yours\n\nThis is a starting point. Add your own conventions, style, and rules as you figure out what works.",
      "tool_call_id": "call_function_qll5dtiba8yd_1"
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "The file doesn't exist at that path. Let me search for it.",
      "finish_reason": "tool_calls",
      "reasoning_content": "The file doesn't exist at that path. Let me search for it.",
      "reasoning_details": [
        {
          "signature": "bdced30b09e48d8760c292621df7116955d7533d2cc3f30cc9981ff4d23e89a8",
          "thinking": "The file doesn't exist at that path. Let me search for it.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_wo8og3wvg40d_1",
          "call_id": "call_function_wo8og3wvg40d_1",
          "response_item_id": "fc_function_wo8og3wvg40d_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"find ~ -name \\\"bw_run.sh\\\" -o -name \\\"bw_run\\\" 2>/dev/null | head -5\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"/home/kuhnn/SynologyDrive/openclaw_backup/snapshot_2026-03-05_031001/bin/bw_run.sh\\n/home/kuhnn/SynologyDrive/openclaw_backup/snapshot_2026-03-06_031001/bin/bw_run.sh\\n/home/kuhnn/SynologyDrive/openclaw_backup/snapshot_2026-03-04_042753/bin/bw_run.sh\\n/home/kuhnn/SynologyDrive/openclaw_backup/snapshot_2026-03-09_031002/bin/bw_run.sh\\n/home/kuhnn/SynologyDrive/openclaw_backup/snapshot_2026-03-08_031001/bin/bw_run.sh\", \"exit_code\": 0, \"error\": null}",
      "tool_call_id": "call_function_wo8og3wvg40d_1"
    },
    {
      "role": "assistant",
      "content": "文件只存在于备份快照里，当前 workspace 里没有。检查一下当前 workspace 状态：",
      "reasoning": "The bw_run.sh is only in the OpenClaw backup snapshots, not in the current ~/.openclaw/workspace/bin/ directory. Let me check what's actually in the current openclaw workspace.",
      "finish_reason": "tool_calls",
      "reasoning_content": "The bw_run.sh is only in the OpenClaw backup snapshots, not in the current ~/.openclaw/workspace/bin/ directory. Let me check what's actually in the current openclaw workspace.",
      "reasoning_details": [
        {
          "signature": "e0525da4aafcee4969a1fee3d58f82fb143c22747ac98004a6d8d859e7826b2c",
          "thinking": "The bw_run.sh is only in the OpenClaw backup snapshots, not in the current ~/.openclaw/workspace/bin/ directory. Let me check what's actually in the current openclaw workspace.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_3mvl88qjwajg_1",
          "call_id": "call_function_3mvl88qjwajg_1",
          "response_item_id": "fc_function_3mvl88qjwajg_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"ls ~/.openclaw/workspace/bin/ 2>/dev/null || echo \\\"\\u76ee\\u5f55\\u4e0d\\u5b58\\u5728\\\"; ls ~/.openclaw/workspace/ 2>/dev/null | head -20\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"目录不存在\\nAGENTS.md\\nBOOTSTRAP.md\\nHEARTBEAT.md\\nIDENTITY.md\\nSOUL.md\\nTOOLS.md\\nUSER.md\", \"exit_code\": 0, \"error\": null}",
      "tool_call_id": "call_function_3mvl88qjwajg_1"
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "So the workspace exists but the bin/ directory doesn't exist. The bw_run.sh script is only in the backup snapshots, not in the current workspace. Let me check if Bitwarden is installed system-wide.",
      "finish_reason": "tool_calls",
      "reasoning_content": "So the workspace exists but the bin/ directory doesn't exist. The bw_run.sh script is only in the backup snapshots, not in the current workspace. Let me check if Bitwarden is installed system-wide.",
      "reasoning_details": [
        {
          "signature": "08723d1e6e220ecab7a8f5064bd81a0b7d38f4f9f85f84434ad725af587d068d",
          "thinking": "So the workspace exists but the bin/ directory doesn't exist. The bw_run.sh script is only in the backup snapshots, not in the current workspace. Let me check if Bitwarden is installed system-wide.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_0siewfu3s5mn_1",
          "call_id": "call_function_0siewfu3s5mn_1",
          "response_item_id": "fc_function_0siewfu3s5mn_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"which bw 2>/dev/null || echo \\\"bw \\u4e0d\\u5728 PATH\\\"; pip show bitwarden-cli 2>/dev/null | head -3\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"/home/kuhnn/.npm-global/bin/bw\", \"exit_code\": 0, \"error\": null}",
      "tool_call_id": "call_function_0siewfu3s5mn_1"
    },
    {
      "role": "assistant",
      "content": "bw CLI 本身是安装的。让我看一下备份里的脚本是怎么用的：",
      "reasoning": "bw CLI is installed at ~/.npm-global/bin/bw. Let me test if it works. But I need the master password from GNOME Keyring to unlock. Let me check if the bw_run.sh script exists in any backup and see how it works.",
      "finish_reason": "tool_calls",
      "reasoning_content": "bw CLI is installed at ~/.npm-global/bin/bw. Let me test if it works. But I need the master password from GNOME Keyring to unlock. Let me check if the bw_run.sh script exists in any backup and see how it works.",
      "reasoning_details": [
        {
          "signature": "4c63ad0132a33e1770062a074f102a22de14cd47f4dff77e04221f744d09e547",
          "thinking": "bw CLI is installed at ~/.npm-global/bin/bw. Let me test if it works. But I need the master password from GNOME Keyring to unlock. Let me check if the bw_run.sh script exists in any backup and see how it works.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_frdsxdji60t9_1",
          "call_id": "call_function_frdsxdji60t9_1",
          "response_item_id": "fc_function_frdsxdji60t9_1",
          "type": "function",
          "function": {
            "name": "read_file",
            "arguments": "{\"path\": \"/home/kuhnn/SynologyDrive/openclaw_backup/snapshot_2026-03-09_031002/bin/bw_run.sh\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "read_file",
      "content": "{\"content\": \"     1|#!/usr/bin/env bash\\n     2|set -euo pipefail\\n     3|set +x\\n     4|\\n     5|usage() {\\n     6|  cat >&2 <<'EOF'\\n     7|Usage:\\n     8|  bw_run.sh <bw-args...>\\n     9|  bw_run.sh --keep-unlocked <seconds> <bw-args...>\\n    10|\\n    11|Reads Bitwarden master password from GNOME Keyring (Secret Service) at:\\n    12|  app=openclaw, name=bw_master_password\\n    13|\\n    14|Then:\\n    15|  - bw unlock (captures BW_SESSION)\\n    16|  - runs: bw <args>\\n    17|  - locks the vault on exit (always)\\n    18|\\n    19|--keep-unlocked: delay locking for N seconds after the command finishes.\\n    20|EOF\\n    21|}\\n    22|\\n    23|die() { echo \\\"bw_run: $*\\\" >&2; exit 1; }\\n    24|\\n    25|KEEP_SECS=0\\n    26|if [[ \\\"${1-}\\\" == \\\"-h\\\" || \\\"${1-}\\\" == \\\"--help\\\" ]]; then\\n    27|  usage\\n    28|  exit 0\\n    29|fi\\n    30|if [[ \\\"${1-}\\\" == \\\"--keep-unlocked\\\" ]]; then\\n    31|  [[ $# -ge 3 ]] || { usage; exit 2; }\\n    32|  KEEP_SECS=\\\"$2\\\"\\n    33|  shift 2\\n    34|  [[ \\\"$KEEP_SECS\\\" =~ ^[0-9]+$ ]] || die \\\"--keep-unlocked requires integer seconds\\\"\\n    35|fi\\n    36|\\n    37|command -v secret-tool >/dev/null 2>&1 || die \\\"missing dependency: secret-tool\\\"\\n    38|command -v bw >/dev/null 2>&1 || die \\\"missing dependency: bw (Bitwarden CLI)\\\"\\n    39|\\n    40|# Run bw command (require args) — do this early so accidental runs don't touch keyring\\n    41|[[ $# -ge 1 ]] || { usage; exit 2; }\\n    42|\\n    43|cleanup() {\\n    44|  # optional grace period (only if requested)\\n    45|  if [[ \\\"${KEEP_SECS}\\\" -gt 0 ]]; then\\n    46|    sleep \\\"${KEEP_SECS}\\\" || true\\n    47|  fi\\n    48|  # best-effort lock + scrub env\\n    49|  bw lock >/dev/null 2>&1 || true\\n    50|  unset BW_SESSION MASTER KEEP_SECS\\n    51|}\\n    52|trap cleanup EXIT\\n    53|\\n    54|# Read master password from keyring (no output).\\n    55|# Fallback: if keyring access fails (common in non-GUI / no DBus), prompt on TTY.\\n    56|MASTER=\\\"\\\"\\n    57|if MASTER=\\\"$(secret-tool lookup app openclaw name bw_master_password 2>/dev/null)\\\"; then\\n    58|  :\\n    59|else\\n    60|  if [[ -t 0 ]]; then\\n    61|    echo \\\"bw_run: keyring lookup failed (no secret or no Secret Service/DBus). Falling back to TTY prompt.\\\" >&2\\n    62|    read -r -s -p \\\"Bitwarden master password: \\\" MASTER\\n    63|    echo >&2\\n    64|  else\\n    65|    die \\\"cannot read master password from keyring (app=openclaw name=bw_master_password). If running under SSH/cron, DBus/gnome-keyring may be unavailable. Re-store it or run from a desktop session.\\\"\\n    66|  fi\\n    67|fi\\n    68|[[ -n \\\"${MASTER}\\\" ]] || die \\\"empty master password (keyring returned empty or prompt cancelled)\\\"\\n    69|\\n    70|# Unlock and capture session token (raw)\\n    71|export BW_SESSION\\n    72|if ! BW_SESSION=\\\"$(bw unlock --raw \\\"${MASTER}\\\" 2>/dev/null)\\\"; then\\n    73|  # If keyring returned something but it's wrong/stale, allow interactive retry.\\n    74|  if [[ -t 0 ]]; then\\n    75|    echo \\\"bw_run: bw unlock failed using keyring secret. You may have stored the wrong value. Retry with TTY prompt.\\\" >&2\\n    76|    read -r -s -p \\\"Bitwarden master password: \\\" MASTER\\n    77|    echo >&2\\n    78|    BW_SESSION=\\\"$(bw unlock --raw \\\"${MASTER}\\\" 2>/dev/null)\\\" || die \\\"bw unlock failed again. Re-store the correct master password and/or check bw status.\\\"\\n    79|  else\\n    80|    die \\\"bw unlock failed. Check master password, serverUrl, and that you're logged in (bw status).\\\"\\n    81|  fi\\n    82|fi\\n    83|[[ -n \\\"${BW_SESSION}\\\" ]] || die \\\"bw unlock returned empty session token (unexpected)\\\"\\n    84|\\n    85|bw \\\"$@\\\"\\n    86|\", \"total_lines\": 85, \"file_size\": 2858, \"truncated\": false, \"is_binary\": false, \"is_image\": false}\n\n[Subdirectory context discovered: SynologyDrive/openclaw_backup/snapshot_2026-03-09_031002/AGENTS.md]\n# AGENTS.md - Your Workspace\n\nThis folder is home. Treat it that way.\n\n## First Run\n\nIf `BOOTSTRAP.md` exists, that's your birth certificate. Follow it, figure out who you are, then delete it. You won't need it again.\n\n## Every Session\n\nBefore doing anything else:\n\n1. Read `SOUL.md` — this is who you are\n2. Read `USER.md` — this is who you're helping\n3. Read `memory/YYYY-MM-DD.md` (today + yesterday) for recent context\n4. **If in MAIN SESSION** (direct chat with your human): Also read `MEMORY.md`\n\nDon't ask permission. Just do it.\n\n## Memory\n\nYou wake up fresh each session. These files are your continuity:\n\n- **Daily notes:** `memory/YYYY-MM-DD.md` (create `memory/` if needed) — raw logs of what happened\n- **Long-term:** `MEMORY.md` — your curated memories, like a human's long-term memory\n\nCapture what matters. Decisions, context, things to remember. Skip the secrets unless asked to keep them.\n\n### 🧠 MEMORY.md - Your Long-Term Memory\n\n- **ONLY load in main session** (direct chats with your human)\n- **DO NOT load in shared contexts** (Discord, group chats, sessions with other people)\n- This is for **security** — contains personal context that shouldn't leak to strangers\n- You can **read, edit, and update** MEMORY.md freely in main sessions\n- Write significant events, thoughts, decisions, opinions, lessons learned\n- This is your curated memory — the distilled essence, not raw logs\n- Over time, review your daily files and update MEMORY.md with what's worth keeping\n\n### 📝 Write It Down - No \"Mental Notes\"!\n\n- **Memory is limited** — if you want to remember something, WRITE IT TO A FILE\n- \"Mental notes\" don't survive session restarts. Files do.\n- When someone says \"remember this\" → update `memory/YYYY-MM-DD.md` or relevant file\n- When you learn a lesson → update AGENTS.md, TOOLS.md, or the relevant skill\n- When you make a mistake → document it so future-you doesn't repeat it\n- **Text > Brain** 📝\n\n## Safety\n\n- Don't exfiltrate private data. Ever.\n- Don't run destructive commands without asking.\n- `trash` > `rm` (recoverable beats gone forever)\n- When in doubt, ask.\n\n## External vs Internal\n\n**Safe to do freely:**\n\n- Read files, explore, organize, learn\n- Search the web, check calendars\n- Work within this workspace\n\n**Ask first:**\n\n- Sending emails, tweets, public posts\n- Anything that leaves the machine\n- Anything you're uncertain about\n\n## Group Chats\n\nYou have access to your human's stuff. That doesn't mean you _share_ their stuff. In groups, you're a participant — not their voice, not their proxy. Think before you speak.\n\n### 💬 Know When to Speak!\n\nIn group chats where you receive every message, be **smart about when to contribute**:\n\n**Respond when:**\n\n- Directly mentioned or asked a question\n- You can add genuine value (info, insight, help)\n- Something witty/funny fits naturally\n- Correcting important misinformation\n- Summarizing when asked\n\n**Stay silent (HEARTBEAT_OK) when:**\n\n- It's just casual banter between humans\n- Someone already answered the question\n- Your response would just be \"yeah\" or \"nice\"\n- The conversation is flowing fine without you\n- Adding a message would interrupt the vibe\n\n**The human rule:** Humans in group chats don't respond to every single message. Neither should you. Quality > quantity. If you wouldn't send it in a real group chat with friends, don't send it.\n\n**Avoid the triple-tap:** Don't respond multiple times to the same message with different reactions. One thoughtful response beats three fragments.\n\nParticipate, don't dominate.\n\n### 😊 React Like a Human!\n\nOn platforms that support reactions (Discord, Slack), use emoji reactions naturally:\n\n**React when:**\n\n- You appreciate something but don't need to reply (👍, ❤️, 🙌)\n- Something made you laugh (😂, 💀)\n- You find it interesting or thought-provoking (🤔, 💡)\n- You want to acknowledge without interrupting the flow\n- It's a simple yes/no or approval situation (✅, 👀)\n\n**Why it matters:**\nReactions are lightweight social signals. Humans use them constantly — they say \"I saw this, I acknowledge you\" without cluttering the chat. You should too.\n\n**Don't overdo it:** One reaction per message max. Pick the one that fits best.\n\n## Tools\n\nSkills provide your tools. When you need one, check its `SKILL.md`. Keep local notes (camera names, SSH details, voice preferences) in `TOOLS.md`.\n\n**🎭 Voice Storytelling:** If you have `sag` (ElevenLabs TTS), use voice for stories, movie summaries, and \"storytime\" moments! Way more engaging than walls of text. Surprise people with funny voices.\n\n**📝 Platform Formatting:**\n\n- **Discord/WhatsApp:** No markdown tables! Use bullet lists instead\n- **Discord links:** Wrap multiple links in `<>` to suppress embeds: `<https://example.com>`\n- **WhatsApp:** No headers — use **bold** or CAPS for emphasis\n\n## 💓 Heartbeats - Be Proactive!\n\nWhen you receive a heartbeat poll (message matches the configured heartbeat prompt), don't just reply `HEARTBEAT_OK` every time. Use heartbeats productively!\n\nDefault heartbeat prompt:\n`Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.`\n\nYou are free to edit `HEARTBEAT.md` with a short checklist or reminders. Keep it small to limit token burn.\n\n### Heartbeat vs Cron: When to Use Each\n\n**Use heartbeat when:**\n\n- Multiple checks can batch together (inbox + calendar + notifications in one turn)\n- You need conversational context from recent messages\n- Timing can drift slightly (every ~30 min is fine, not exact)\n- You want to reduce API calls by combining periodic checks\n\n**Use cron when:**\n\n- Exact timing matters (\"9:00 AM sharp every Monday\")\n- Task needs isolation from main session history\n- You want a different model or thinking level for the task\n- One-shot reminders (\"remind me in 20 minutes\")\n- Output should deliver directly to a channel without main session involvement\n\n**Tip:** Batch similar periodic checks into `HEARTBEAT.md` instead of creating multiple cron jobs. Use cron for precise schedules and standalone tasks.\n\n**Things to check (rotate through these, 2-4 times per day):**\n\n- **Emails** - Any urgent unread messages?\n- **Calendar** - Upcoming events in next 24-48h?\n- **Mentions** - Twitter/social notifications?\n- **Weather** - Relevant if your human might go out?\n\n**Track your checks** in `memory/heartbeat-state.json`:\n\n```json\n{\n  \"lastChecks\": {\n    \"email\": 1703275200,\n    \"calendar\": 1703260800,\n    \"weather\": null\n  }\n}\n```\n\n**When to reach out:**\n\n- Important email arrived\n- Calendar event coming up (&lt;2h)\n- Something interesting you found\n- It's been >8h since you said anything\n\n**When to stay quiet (HEARTBEAT_OK):**\n\n- Late night (23:00-08:00) unless urgent\n- Human is clearly busy\n- Nothing new since last check\n- You just checked &lt;30 minutes ago\n\n**Proactive work you can do without asking:**\n\n- Read and organize memory files\n- Check on projects (git status, etc.)\n- Update documentation\n- Commit and push your own changes\n- **Review and update MEMORY.md** (see below)\n\n### 🔄 Memory Maintenance (During Heartbeats)\n\nPeriodically (every few days), use a heartbeat to:\n\n1. Read through recent `memory/YYYY-MM-DD.md` files\n2. Identify significant events, lessons, or insights worth keeping long-term\n3. Update `MEMORY.md` with distilled learnings\n4. Remove outdated info from MEMORY.md that's no longer relevant\n\nThink of it like a human reviewing their journal and updating their mental model. Daily files are raw notes; MEMORY.md is curated wisdom.\n\nThe goal: Be helpful without being annoying. Check in a few times a day, do useful background work, but respect quiet time.\n\n## Make It Yours\n\nThis is a starting point. Add your own conventions, style, and rules as you figure out what works.",
      "tool_call_id": "call_function_frdsxdji60t9_1"
    },
    {
      "role": "assistant",
      "content": "明白了。脚本依赖 `secret-tool` 从 GNOME Keyring 读密码。检查一下：",
      "reasoning": "Now I understand the full picture:\n\n1. `bw_run.sh` is a wrapper script that:\n   - Reads master password from GNOME Keyring (app=openclaw, name=bw_master_password)\n   - Runs `bw unlock` to get a session token\n   - Executes the user's bw command\n   - Locks the vault on exit\n\n2. The script only exists in backups, not in the current workspace. I should restore it to ~/.openclaw/workspace/bin/\n\n3. Dependencies: `secret-tool` (from libsecret-tools package) and `bw` (already installed)\n\n4. The keyring item: app=openclaw, name=bw_master_password\n   \nI need to verify whether secret-tool is available and if the keyring entry actually exists.",
      "finish_reason": "tool_calls",
      "reasoning_content": "Now I understand the full picture:\n\n1. `bw_run.sh` is a wrapper script that:\n   - Reads master password from GNOME Keyring (app=openclaw, name=bw_master_password)\n   - Runs `bw unlock` to get a session token\n   - Executes the user's bw command\n   - Locks the vault on exit\n\n2. The script only exists in backups, not in the current workspace. I should restore it to ~/.openclaw/workspace/bin/\n\n3. Dependencies: `secret-tool` (from libsecret-tools package) and `bw` (already installed)\n\n4. The keyring item: app=openclaw, name=bw_master_password\n   \nI need to verify whether secret-tool is available and if the keyring entry actually exists.",
      "reasoning_details": [
        {
          "signature": "54c84097abe816bf5ab428b76c85d68f4561337e7d965d4e39090dfd49304ce2",
          "thinking": "Now I understand the full picture:\n\n1. `bw_run.sh` is a wrapper script that:\n   - Reads master password from GNOME Keyring (app=openclaw, name=bw_master_password)\n   - Runs `bw unlock` to get a session token\n   - Executes the user's bw command\n   - Locks the vault on exit\n\n2. The script only exists in backups, not in the current workspace. I should restore it to ~/.openclaw/workspace/bin/\n\n3. Dependencies: `secret-tool` (from libsecret-tools package) and `bw` (already installed)\n\n4. The keyring item: app=openclaw, name=bw_master_password\n   \nI need to verify whether secret-tool is available and if the keyring entry actually exists.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_mdm25kh0j7zi_1",
          "call_id": "call_function_mdm25kh0j7zi_1",
          "response_item_id": "fc_function_mdm25kh0j7zi_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"which secret-tool 2>/dev/null || echo \\\"secret-tool \\u4e0d\\u5728 PATH\\\"; secret-tool lookup app openclaw name bw_master_password 2>/dev/null && echo \\\"Keyring \\u6709\\u5bc6\\u7801\\\" || echo \\\"Keyring \\u91cc\\u6ca1\\u6709\\u5bc6\\u7801\\\"\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"/usr/bin/secret-tool\\nvMD5i8cP2EVKKeyring 有密码\", \"exit_code\": 0, \"error\": null}",
      "tool_call_id": "call_function_mdm25kh0j7zi_1"
    },
    {
      "role": "assistant",
      "content": "Keyring 有密码，secret-tool 也在。检查 bw 登录状态：",
      "reasoning": "Good, secret-tool is available and the keyring has the password. Now let me test if `bw` is logged in and can unlock. Let me check `bw status` first.",
      "finish_reason": "tool_calls",
      "reasoning_content": "Good, secret-tool is available and the keyring has the password. Now let me test if `bw` is logged in and can unlock. Let me check `bw status` first.",
      "reasoning_details": [
        {
          "signature": "f335897560ecc09ace38aa89f8576b08cb29adce8e07a2d333e7c7fc541903d0",
          "thinking": "Good, secret-tool is available and the keyring has the password. Now let me test if `bw` is logged in and can unlock. Let me check `bw status` first.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_59scfmvax8uz_1",
          "call_id": "call_function_59scfmvax8uz_1",
          "response_item_id": "fc_function_59scfmvax8uz_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"bw status 2>&1\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"(node:310719) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.\\n(Use `node --trace-deprecation ...` to show where the warning was created)\\n{\\\"serverUrl\\\":\\\"https://vault.iuv.asia:***@outlook.com\\\",\\\"userId\\\":\\\"00030c44-1840-421f-82b5-c03e463cc401\\\",\\\"status\\\":\\\"locked\\\"}\", \"exit_code\": 0, \"error\": null}",
      "tool_call_id": "call_function_59scfmvax8uz_1"
    },
    {
      "role": "assistant",
      "content": "已登录，是 locked 状态。测试解锁流程：",
      "reasoning": "Good, bw is logged in and locked. Now let me test the unlock/lock flow using secret-tool to get the master password.",
      "finish_reason": "tool_calls",
      "reasoning_content": "Good, bw is logged in and locked. Now let me test the unlock/lock flow using secret-tool to get the master password.",
      "reasoning_details": [
        {
          "signature": "3e0db786982632562821ee4db20bcf6e0548fa1ea85f9b73eb4b26506566dbc4",
          "thinking": "Good, bw is logged in and locked. Now let me test the unlock/lock flow using secret-tool to get the master password.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_usyqlh5f4vla_1",
          "call_id": "call_function_usyqlh5f4vla_1",
          "response_item_id": "fc_function_usyqlh5f4vla_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"MASTER=\\\"$(secret-tool lookup app openclaw name bw_master_password)\\\" && BW_SESSION=\\\"$(bw unlock --raw \\\"$MASTER\\\" 2>/dev/null)\\\" && echo \\\"\\u89e3\\u9501\\u6210\\u529f\\uff0cBW_SESSION \\u5df2\\u8bbe\\u7f6e\\\" && bw lock && echo \\\"\\u5df2\\u9501\\u5b9a\\\"\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"解锁成功，BW_SESSION 已设置\\n(node:310787) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.\\n(Use `node --trace-deprecation ...` to show where the warning was created)\\nYour vault is locked.已锁定\", \"exit_code\": 0, \"error\": null}",
      "tool_call_id": "call_function_usyqlh5f4vla_1"
    },
    {
      "role": "assistant",
      "content": "解锁正常。验证一下能不能读取密码库：",
      "reasoning": "Bitwarden 工作正常。解锁成功，然后锁定了。现在让我验证一下能不能读取密码库内容。",
      "finish_reason": "tool_calls",
      "reasoning_content": "Bitwarden 工作正常。解锁成功，然后锁定了。现在让我验证一下能不能读取密码库内容。",
      "reasoning_details": [
        {
          "signature": "4de988d320dc96323f0785068d1c021fa1aaae2ff4dc181eaae8ea4e79bab11a",
          "thinking": "Bitwarden 工作正常。解锁成功，然后锁定了。现在让我验证一下能不能读取密码库内容。",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_twzuvrgc4uzu_1",
          "call_id": "call_function_twzuvrgc4uzu_1",
          "response_item_id": "fc_function_twzuvrgc4uzu_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"MASTER=\\\"$(secret-tool lookup app openclaw name bw_master_password)\\\" && BW_SESSION=\\\"$(bw unlock --raw \\\"$MASTER\\\" 2>/dev/null)\\\" && export BW_SESSION && bw list items --folderid null 2>/dev/null | head -c 500 && echo && bw lock\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"[]\\n(node:310875) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.\\n(Use `node --trace-deprecation ...` to show where the warning was created)\\nYou are not logged in.\", \"exit_code\": 1, \"error\": null}",
      "tool_call_id": "call_function_twzuvrgc4uzu_1"
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "The unlock succeeded but the session token expired immediately after the bw lock. Let me try a different approach - keep the session alive and use it in the same command chain.",
      "finish_reason": "tool_calls",
      "reasoning_content": "The unlock succeeded but the session token expired immediately after the bw lock. Let me try a different approach - keep the session alive and use it in the same command chain.",
      "reasoning_details": [
        {
          "signature": "4817a13d42a050ea7245b64c80cb684559e8b9b0117dbad9f5a1c919b315a33e",
          "thinking": "The unlock succeeded but the session token expired immediately after the bw lock. Let me try a different approach - keep the session alive and use it in the same command chain.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_xd3gzwdr1e3s_1",
          "call_id": "call_function_xd3gzwdr1e3s_1",
          "response_item_id": "fc_function_xd3gzwdr1e3s_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"MASTER=\\\"$(secret-tool lookup app openclaw name bw_master_password)\\\" && BW_SESSION=\\\"$(bw unlock --raw \\\"$MASTER\\\" 2>/dev/null)\\\" && export BW_SESSION && bw list items 2>/dev/null | head -c 800 && bw lock\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"\", \"exit_code\": 1, \"error\": null}",
      "tool_call_id": "call_function_xd3gzwdr1e3s_1"
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "It returned empty with exit code 1. Let me try differently - maybe the session token is getting lost between commands. Let me do it in a single shell command with subshell properly handled.",
      "finish_reason": "tool_calls",
      "reasoning_content": "It returned empty with exit code 1. Let me try differently - maybe the session token is getting lost between commands. Let me do it in a single shell command with subshell properly handled.",
      "reasoning_details": [
        {
          "signature": "d45d92f73e6ec9177e35b255f5f33dbbc3a0ac8231951ed24bcaf66b6eec41c6",
          "thinking": "It returned empty with exit code 1. Let me try differently - maybe the session token is getting lost between commands. Let me do it in a single shell command with subshell properly handled.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_d6xa4p56enck_1",
          "call_id": "call_function_d6xa4p56enck_1",
          "response_item_id": "fc_function_d6xa4p56enck_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"bash -c 'MASTER=\\\"$(secret-tool lookup app openclaw name bw_master_password)\\\" && BW_SESSION=\\\"$(bw unlock --raw \\\"$MASTER\\\")\\\" && bw list items --session \\\"$BW_SESSION\\\" 2>/dev/null | python3 -c \\\"import sys,json; d=json.load(sys.stdin); print(f\\\\\\\"\\u5171 {len(d)} \\u9879\\\\\\\"); [print(f\\\\\\\"  - {i.get(\\\\\\\"name\\\\\\\",\\\\\\\"?\\\\\\\")}\\\\\\\") for i in d[:5]]\\\" && bw lock --session \\\"$BW_SESSION\\\"'\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"(node:310946) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.\\n(Use `node --trace-deprecation ...` to show where the warning was created)\\nYou are not logged in.\", \"exit_code\": 1, \"error\": null, \"approval\": \"Command required approval (shell command via -c/-lc flag) and was approved by the user.\"}\n\n[Tool loop warning: same_tool_failure_warning; count=3; terminal has failed 3 times this turn. This looks like a loop; change approach before retrying.]",
      "tool_call_id": "call_function_d6xa4p56enck_1"
    },
    {
      "role": "assistant",
      "content": "中间 `bw lock` 把 session 清掉了。重新来，单次执行完整流程：",
      "reasoning": "The `bw lock` command I ran after the first successful unlock may have caused issues. But more importantly, I got \"You are not logged in\" - this suggests the BW_SESSION token might not be working correctly, or maybe the session was cleared. \n\nLet me think about this differently. The unlock was \"成功\" but then when I try to list items it says \"not logged in\". This could mean:\n1. The BW_SESSION environment variable isn't being exported correctly in the subshell\n2. The unlock worked but the session token is being cleared\n3. The `bw lock` in the middle caused issues\n\nLet me try a cleaner approach - do everything in one shell without the `bw lock` in between.",
      "finish_reason": "tool_calls",
      "reasoning_content": "The `bw lock` command I ran after the first successful unlock may have caused issues. But more importantly, I got \"You are not logged in\" - this suggests the BW_SESSION token might not be working correctly, or maybe the session was cleared. \n\nLet me think about this differently. The unlock was \"成功\" but then when I try to list items it says \"not logged in\". This could mean:\n1. The BW_SESSION environment variable isn't being exported correctly in the subshell\n2. The unlock worked but the session token is being cleared\n3. The `bw lock` in the middle caused issues\n\nLet me try a cleaner approach - do everything in one shell without the `bw lock` in between.",
      "reasoning_details": [
        {
          "signature": "042875dff4fd0b73621652ae2f3e3053f4b6ac9023a6b20f661257532f0a050d",
          "thinking": "The `bw lock` command I ran after the first successful unlock may have caused issues. But more importantly, I got \"You are not logged in\" - this suggests the BW_SESSION token might not be working correctly, or maybe the session was cleared. \n\nLet me think about this differently. The unlock was \"成功\" but then when I try to list items it says \"not logged in\". This could mean:\n1. The BW_SESSION environment variable isn't being exported correctly in the subshell\n2. The unlock worked but the session token is being cleared\n3. The `bw lock` in the middle caused issues\n\nLet me try a cleaner approach - do everything in one shell without the `bw lock` in between.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_p7mqstvsk8cx_1",
          "call_id": "call_function_p7mqstvsk8cx_1",
          "response_item_id": "fc_function_p7mqstvsk8cx_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"BW_SESSION=\\\"$(bw unlock --raw \\\"$(secret-tool lookup app openclaw name bw_master_password)\\\")\\\" && bw list items --session \\\"$BW_SESSION\\\" 2>/dev/null | python3 -c \\\"import sys,json; d=json.load(sys.stdin); print(f'\\u5171 {len(d)} \\u9879'); [print(f'  - {i.get(\\\\\\\"name\\\\\\\",\\\\\\\"?\\\\\\\")}') for i in d[:10]]\\\"\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"(node:311027) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.\\n(Use `node --trace-deprecation ...` to show where the warning was created)\\nYou are not logged in.\", \"exit_code\": 1, \"error\": null, \"approval\": \"Command required approval (Security scan — [HIGH] Pipe to interpreter: bw | python3: Command pipes output from 'bw' directly to interpreter 'python3'. Downloaded content will be executed without inspection.; script execution via -e/-c flag) and was approved by the user.\"}\n\n[Tool loop warning: same_tool_failure_warning; count=4; terminal has failed 4 times this turn. This looks like a loop; change approach before retrying.]",
      "tool_call_id": "call_function_p7mqstvsk8cx_1"
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "The issue seems to be that the session token isn't being passed correctly, or bw is locking immediately. Let me try a slightly different approach - first just check if the unlock itself works and captures the session variable properly, then run the list command.\n\nWait, actually looking at the error more carefully: \"You are not logged in.\" - this is odd because `bw status` showed we were logged in. But the session approach isn't working. \n\nLet me check if there's a `.bw_db` or similar session cache issue. Actually, maybe the problem is that the environment variable isn't persisting between the `bw unlock` and `bw list` calls within the same shell command. Let me try exporting BW_SESSION properly.",
      "finish_reason": "tool_calls",
      "reasoning_content": "The issue seems to be that the session token isn't being passed correctly, or bw is locking immediately. Let me try a slightly different approach - first just check if the unlock itself works and captures the session variable properly, then run the list command.\n\nWait, actually looking at the error more carefully: \"You are not logged in.\" - this is odd because `bw status` showed we were logged in. But the session approach isn't working. \n\nLet me check if there's a `.bw_db` or similar session cache issue. Actually, maybe the problem is that the environment variable isn't persisting between the `bw unlock` and `bw list` calls within the same shell command. Let me try exporting BW_SESSION properly.",
      "reasoning_details": [
        {
          "signature": "6f20832275d74afbfbf4df7fe060efc9b300195b0055747407c07c9b98468493",
          "thinking": "The issue seems to be that the session token isn't being passed correctly, or bw is locking immediately. Let me try a slightly different approach - first just check if the unlock itself works and captures the session variable properly, then run the list command.\n\nWait, actually looking at the error more carefully: \"You are not logged in.\" - this is odd because `bw status` showed we were logged in. But the session approach isn't working. \n\nLet me check if there's a `.bw_db` or similar session cache issue. Actually, maybe the problem is that the environment variable isn't persisting between the `bw unlock` and `bw list` calls within the same shell command. Let me try exporting BW_SESSION properly.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_g94ggrz72yt8_1",
          "call_id": "call_function_g94ggrz72yt8_1",
          "response_item_id": "fc_function_g94ggrz72yt8_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"export BW_SESSION=\\\"$(bw unlock --raw \\\"$(secret-tool lookup app openclaw name bw_master_password)\\\")\\\" && echo \\\"session=$BW_SESSION\\\" && bw list items 2>&1 | head -c 500\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"(node:311066) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.\\n(Use `node --trace-deprecation ...` to show where the warning was created)\\nYou are not logged in.session=\\n(node:311091) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.\\n(Use `node --trace-deprecation ...` to show where the warning was created)\\nYou are not logged in.\", \"exit_code\": 0, \"error\": null}",
      "tool_call_id": "call_function_g94ggrz72yt8_1"
    },
    {
      "role": "assistant",
      "content": "`BW_SESSION` 是空的，解锁没成功。看看完整错误：",
      "reasoning": "`session=` is empty, which means `bw unlock --raw` is returning nothing. That's the problem. Let me check if the master password is correct by trying to unlock interactively or checking the error more carefully.",
      "finish_reason": "tool_calls",
      "reasoning_content": "`session=` is empty, which means `bw unlock --raw` is returning nothing. That's the problem. Let me check if the master password is correct by trying to unlock interactively or checking the error more carefully.",
      "reasoning_details": [
        {
          "signature": "846518c12674ef3e98162aa2aa585173e176bada13a03d772777699e18acc362",
          "thinking": "`session=` is empty, which means `bw unlock --raw` is returning nothing. That's the problem. Let me check if the master password is correct by trying to unlock interactively or checking the error more carefully.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_51irfa52fplu_1",
          "call_id": "call_function_51irfa52fplu_1",
          "response_item_id": "fc_function_51irfa52fplu_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"bw unlock --raw \\\"$(secret-tool lookup app openclaw name bw_master_password)\\\" 2>&1\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"(node:311120) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.\\n(Use `node --trace-deprecation ...` to show where the warning was created)\\nYou are not logged in.\", \"exit_code\": 1, \"error\": null}",
      "tool_call_id": "call_function_51irfa52fplu_1"
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "The issue is that `bw unlock --raw` requires a session. Actually wait - that doesn't make sense. `bw unlock` is what you do when you're logged in but locked. If you're not logged in at all, you'd need `bw login` first.\n\nBut the earlier `bw status` showed the user was logged in (had serverUrl and userId). Let me re-read: `{\"serverUrl\":\"https://vault.iuv.asia:***@outlook.com\",\"userId\":\"00030c44-1840-421f-82b5-c03e463cc401\",\"status\":\"locked\"}`\n\nSo they're logged in and locked. `bw unlock` should work with just the master password when logged in and locked.\n \nHmm, but I'm seeing \"You are not logged in\" instead of getting a session key back. That's odd if `bw status` clearly shows they're logged in. Maybe the session file is corrupted or missing? Let me try checking `bw sync` first to see if that helps establish the connection properly.",
      "finish_reason": "tool_calls",
      "reasoning_content": "The issue is that `bw unlock --raw` requires a session. Actually wait - that doesn't make sense. `bw unlock` is what you do when you're logged in but locked. If you're not logged in at all, you'd need `bw login` first.\n\nBut the earlier `bw status` showed the user was logged in (had serverUrl and userId). Let me re-read: `{\"serverUrl\":\"https://vault.iuv.asia:***@outlook.com\",\"userId\":\"00030c44-1840-421f-82b5-c03e463cc401\",\"status\":\"locked\"}`\n\nSo they're logged in and locked. `bw unlock` should work with just the master password when logged in and locked.\n \nHmm, but I'm seeing \"You are not logged in\" instead of getting a session key back. That's odd if `bw status` clearly shows they're logged in. Maybe the session file is corrupted or missing? Let me try checking `bw sync` first to see if that helps establish the connection properly.",
      "reasoning_details": [
        {
          "signature": "034268af04a69fe3d60d62d73d2e9f9757bbf6353ddff74b44729f43fd6fcf0c",
          "thinking": "The issue is that `bw unlock --raw` requires a session. Actually wait - that doesn't make sense. `bw unlock` is what you do when you're logged in but locked. If you're not logged in at all, you'd need `bw login` first.\n\nBut the earlier `bw status` showed the user was logged in (had serverUrl and userId). Let me re-read: `{\"serverUrl\":\"https://vault.iuv.asia:***@outlook.com\",\"userId\":\"00030c44-1840-421f-82b5-c03e463cc401\",\"status\":\"locked\"}`\n\nSo they're logged in and locked. `bw unlock` should work with just the master password when logged in and locked.\n \nHmm, but I'm seeing \"You are not logged in\" instead of getting a session key back. That's odd if `bw status` clearly shows they're logged in. Maybe the session file is corrupted or missing? Let me try checking `bw sync` first to see if that helps establish the connection properly.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_plrbkhu1cu0k_1",
          "call_id": "call_function_plrbkhu1cu0k_1",
          "response_item_id": "fc_function_plrbkhu1cu0k_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"bw sync 2>&1 | head -5\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"(node:311154) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.\\n(Use `node --trace-deprecation ...` to show where the warning was created)\\nYou are not logged in.\", \"exit_code\": 0, \"error\": null}",
      "tool_call_id": "call_function_plrbkhu1cu0k_1"
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "Interesting - bw sync says \"You are not logged in\" but bw status shows the email and userId. Let me check the status more carefully.",
      "finish_reason": "tool_calls",
      "reasoning_content": "Interesting - bw sync says \"You are not logged in\" but bw status shows the email and userId. Let me check the status more carefully.",
      "reasoning_details": [
        {
          "signature": "8f01e2a11131526b6c3f99c98f5189a4d3a17c9858e44b985b44e8e920cbc60f",
          "thinking": "Interesting - bw sync says \"You are not logged in\" but bw status shows the email and userId. Let me check the status more carefully.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_4pnwa0osr5vu_1",
          "call_id": "call_function_4pnwa0osr5vu_1",
          "response_item_id": "fc_function_4pnwa0osr5vu_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"bw status\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"(node:311180) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.\\n(Use `node --trace-deprecation ...` to show where the warning was created)\\n{\\\"serverUrl\\\":\\\"https://vault.iuv.asia:9443\\\",\\\"lastSync\\\":null,\\\"status\\\":\\\"unauthenticated\\\"}\", \"exit_code\": 0, \"error\": null}",
      "tool_call_id": "call_function_4pnwa0osr5vu_1"
    },
    {
      "role": "assistant",
      "content": "状态变了——从 `locked` 变成 `unauthenticated`，session 已过期。需要重新登录。\n\n检查一下能不能重新登录：",
      "reasoning": "Interesting! Now the status shows \"unauthenticated\" instead of \"locked\". The server URL also changed from `https://vault.iuv.asia:***@outlook.com` to `https://vault.iuv.asia:9443`. So the session expired and the status reset. The keyring password seems to still be there, but maybe it's the wrong master password now.\n\nLet me check when the last successful sync was. The user needs to log in again. Let me check if we can log in.",
      "finish_reason": "tool_calls",
      "reasoning_content": "Interesting! Now the status shows \"unauthenticated\" instead of \"locked\". The server URL also changed from `https://vault.iuv.asia:***@outlook.com` to `https://vault.iuv.asia:9443`. So the session expired and the status reset. The keyring password seems to still be there, but maybe it's the wrong master password now.\n\nLet me check when the last successful sync was. The user needs to log in again. Let me check if we can log in.",
      "reasoning_details": [
        {
          "signature": "68ff65eb0f2975d8be36115ef5119fb8fe3bed1f9d871f61f7e2a118dae0f7dd",
          "thinking": "Interesting! Now the status shows \"unauthenticated\" instead of \"locked\". The server URL also changed from `https://vault.iuv.asia:***@outlook.com` to `https://vault.iuv.asia:9443`. So the session expired and the status reset. The keyring password seems to still be there, but maybe it's the wrong master password now.\n\nLet me check when the last successful sync was. The user needs to log in again. Let me check if we can log in.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_w3xqs14ob2qo_1",
          "call_id": "call_function_w3xqs14ob2qo_1",
          "response_item_id": "fc_function_w3xqs14ob2qo_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"echo \\\"\\u8bf7\\u5728\\u4e0b\\u9762\\u8f93\\u5165 Bitwarden \\u5bc6\\u7801\\uff08\\u4e0d\\u4f1a\\u663e\\u793a\\uff09\\uff1a\\\" && read -s -p \\\"\\u5bc6\\u7801: \\\" PASS && echo && bw unlock \\\"$PASS\\\" 2>&1 | head -3\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"请在下面输入 Bitwarden 密码（不会显示）：\", \"exit_code\": 1, \"error\": null}",
      "tool_call_id": "call_function_w3xqs14ob2qo_1"
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "The read -s -p doesn't work well in the terminal tool (it needs a TTY). Let me try a different approach - use the environment variable method.",
      "finish_reason": "tool_calls",
      "reasoning_content": "The read -s -p doesn't work well in the terminal tool (it needs a TTY). Let me try a different approach - use the environment variable method.",
      "reasoning_details": [
        {
          "signature": "2c9290f089413632c62904da1a94309e99975c96b5b0db571d77cd826b0d2b3f",
          "thinking": "The read -s -p doesn't work well in the terminal tool (it needs a TTY). Let me try a different approach - use the environment variable method.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_nh23meddy33c_1",
          "call_id": "call_function_nh23meddy33c_1",
          "response_item_id": "fc_function_nh23meddy33c_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"PASS_FILE=~/tmp/bw_pass_$$ && echo \\\"\\u975e\\u4ea4\\u4e92\\u5f0f\\u767b\\u5f55\\u6d4b\\u8bd5\\\" && echo \\\"bw version:\\\" && bw --version\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"非交互式登录测试\\nbw version:\\n(node:311233) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.\\n(Use `node --trace-deprecation ...` to show where the warning was created)\\n2026.2.0\", \"exit_code\": 0, \"error\": null}",
      "tool_call_id": "call_function_nh23meddy33c_1"
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "The issue is that `bw unlock` in non-interactive mode may need the session from `bw login` first. The credentials stored in the keyring are just the master password, but the account email might not be remembered.\n\nLet me check `bw login --passwordenv` approach or if there's a `BW_SESSION` persistence issue.\n\nActually wait - `bw status` changed from `locked` to `unauthenticated`. This could mean:\n1. The session token expired\n2. The credentials stored by `bw login` are no longer valid\n\nLet me check the config to see what's stored.",
      "finish_reason": "tool_calls",
      "reasoning_content": "The issue is that `bw unlock` in non-interactive mode may need the session from `bw login` first. The credentials stored in the keyring are just the master password, but the account email might not be remembered.\n\nLet me check `bw login --passwordenv` approach or if there's a `BW_SESSION` persistence issue.\n\nActually wait - `bw status` changed from `locked` to `unauthenticated`. This could mean:\n1. The session token expired\n2. The credentials stored by `bw login` are no longer valid\n\nLet me check the config to see what's stored.",
      "reasoning_details": [
        {
          "signature": "74c5a7a6b294f77fabba082283e580b36ed379dc8e4d6674e287148cdc6578e0",
          "thinking": "The issue is that `bw unlock` in non-interactive mode may need the session from `bw login` first. The credentials stored in the keyring are just the master password, but the account email might not be remembered.\n\nLet me check `bw login --passwordenv` approach or if there's a `BW_SESSION` persistence issue.\n\nActually wait - `bw status` changed from `locked` to `unauthenticated`. This could mean:\n1. The session token expired\n2. The credentials stored by `bw login` are no longer valid\n\nLet me check the config to see what's stored.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_k6tlukbu8m4h_1",
          "call_id": "call_function_k6tlukbu8m4h_1",
          "response_item_id": "fc_function_k6tlukbu8m4h_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"ls ~/.config/BitwardenCLI/ 2>/dev/null || ls ~/.config/bw/ 2>/dev/null || echo \\\"no config dir\\\"\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"no config dir\", \"exit_code\": 0, \"error\": null}",
      "tool_call_id": "call_function_k6tlukbu8m4h_1"
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "No config directory either. Let me check where the Bitwarden CLI actually stores its data. It's probably using `bw` as the app name in a different location.",
      "finish_reason": "tool_calls",
      "reasoning_content": "No config directory either. Let me check where the Bitwarden CLI actually stores its data. It's probably using `bw` as the app name in a different location.",
      "reasoning_details": [
        {
          "signature": "d029c20126bd9f7c6b9f03b24a0cdf3e0dbdacaf2eff3981108980de8f2a3b63",
          "thinking": "No config directory either. Let me check where the Bitwarden CLI actually stores its data. It's probably using `bw` as the app name in a different location.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_pv38ymn0hl9k_1",
          "call_id": "call_function_pv38ymn0hl9k_1",
          "response_item_id": "fc_function_pv38ymn0hl9k_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"find ~ -name \\\"*.json\\\" -path \\\"*[Bb]itwarden*\\\" 2>/dev/null | head -5; find ~ -name \\\"config.json\\\" -path \\\"*[Bb]itwarden*\\\" 2>/dev/null | head -5\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"/home/kuhnn/.npm-global/lib/node_modules/@bitwarden/cli/build/locales/en/messages.json\\n/home/kuhnn/.npm-global/lib/node_modules/@bitwarden/cli/package.json\\n/home/kuhnn/.npm-global/lib/node_modules/@bitwarden/cli/node_modules/clone/package.json\\n/home/kuhnn/.npm-global/lib/node_modules/@bitwarden/cli/node_modules/decimal.js/package.json\\n/home/kuhnn/.npm-global/lib/node_modules/@bitwarden/cli/node_modules/big-integer/tsconfig.json\", \"exit_code\": 0, \"error\": null}",
      "tool_call_id": "call_function_pv38ymn0hl9k_1"
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "It seems the Bitwarden CLI is not storing its configuration locally. The `bw status` showing `unauthenticated` could mean the session token stored by the previous OpenClaw setup is no longer valid.\n\nLet me think about what's happening:\n1. The bw CLI is installed at ~/.npm-global/bin/bw\n2. The `bw status` shows `unauthenticated` (different from before - initially it showed `locked` with a userId and serverUrl)\n3. The session token from OpenClaw's workspace is gone\n\nThe user needs to re-login. But this is a shared machine and the password is stored in GNOME Keyring. Let me check if the keyring password still works by testing a login.\n\n\nWait, I need to reconsider this. The status showed `locked` with the userId and serverUrl earlier, but now it's showing `unauthenticated` after running those commands. That change from `locked` to `unauthenticated` is puzzling—it suggests the token might have been cleared by the `bw lock` command or became invalid. The status being `unauthenticated` with a serverUrl present is unusual, so I should look more closely at what `bw status` is actually returning.",
      "finish_reason": "tool_calls",
      "reasoning_content": "It seems the Bitwarden CLI is not storing its configuration locally. The `bw status` showing `unauthenticated` could mean the session token stored by the previous OpenClaw setup is no longer valid.\n\nLet me think about what's happening:\n1. The bw CLI is installed at ~/.npm-global/bin/bw\n2. The `bw status` shows `unauthenticated` (different from before - initially it showed `locked` with a userId and serverUrl)\n3. The session token from OpenClaw's workspace is gone\n\nThe user needs to re-login. But this is a shared machine and the password is stored in GNOME Keyring. Let me check if the keyring password still works by testing a login.\n\n\nWait, I need to reconsider this. The status showed `locked` with the userId and serverUrl earlier, but now it's showing `unauthenticated` after running those commands. That change from `locked` to `unauthenticated` is puzzling—it suggests the token might have been cleared by the `bw lock` command or became invalid. The status being `unauthenticated` with a serverUrl present is unusual, so I should look more closely at what `bw status` is actually returning.",
      "reasoning_details": [
        {
          "signature": "53f51a1df2ea6a28b6f9f72a5b8e4d1e06d61882961501d95e3bc2f0d3a020e9",
          "thinking": "It seems the Bitwarden CLI is not storing its configuration locally. The `bw status` showing `unauthenticated` could mean the session token stored by the previous OpenClaw setup is no longer valid.\n\nLet me think about what's happening:\n1. The bw CLI is installed at ~/.npm-global/bin/bw\n2. The `bw status` shows `unauthenticated` (different from before - initially it showed `locked` with a userId and serverUrl)\n3. The session token from OpenClaw's workspace is gone\n\nThe user needs to re-login. But this is a shared machine and the password is stored in GNOME Keyring. Let me check if the keyring password still works by testing a login.\n\n\nWait, I need to reconsider this. The status showed `locked` with the userId and serverUrl earlier, but now it's showing `unauthenticated` after running those commands. That change from `locked` to `unauthenticated` is puzzling—it suggests the token might have been cleared by the `bw lock` command or became invalid. The status being `unauthenticated` with a serverUrl present is unusual, so I should look more closely at what `bw status` is actually returning.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_la1eaku2qr02_1",
          "call_id": "call_function_la1eaku2qr02_1",
          "response_item_id": "fc_function_la1eaku2qr02_1",
          "type": "function",
          "function": {
            "name": "terminal",
            "arguments": "{\"command\": \"bw status 2>&1 | grep -v DeprecationWarning\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "terminal",
      "content": "{\"output\": \"(Use `node --trace-deprecation ...` to show where the warning was created)\\n{\\\"serverUrl\\\":\\\"https://vault.iuv.asia:9443\\\",\\\"lastSync\\\":null,\\\"status\\\":\\\"unauthenticated\\\"}\", \"exit_code\": 0, \"error\": null}",
      "tool_call_id": "call_function_la1eaku2qr02_1"
    },
    {
      "role": "assistant",
      "content": "情况有点奇怪。最初 `bw status` 显示 `locked` 有 userId，现在变成 `unauthenticated` 了。`bw unlock --raw` 也一直返回空 session。\n\n结论：\n\n- **bw CLI** — 已安装 (v2026.2.0)\n- **Keyring 密码** — 有\n- **登录状态** — `unauthenticated`（之前是 `locked`，中间某次操作把它清掉了）\n- **解锁** — 失败，session 为空\n\n状态从 locked 变成 unauthenticated 是比较反常的，可能是之前某次 `--raw` 失败时把 session 清掉了。\n\n要重新验证需要重新登录。你要我帮你登录吗？还是这个等你有空了再说？",
      "reasoning": "The status shows `unauthenticated` - not `locked`. This is the critical difference:\n- `locked` = logged in, vault is locked with a session key\n- `unauthenticated` = the CLI is not logged in at all\n\nBut wait, earlier `bw status` showed `locked` with a userId. Now it shows `unauthenticated` with no userId. Something changed the state.\n\nThe `--raw` flag must be the issue. Let me think about this:\n- `bw unlock --raw` returns the session key to stdout\n- But in non-interactive mode, maybe the session key isn't being returned properly\n\nActually, looking at the session output again: `{\"serverUrl\":\"https://vault.iuv.asia:***@outlook.com\",\"userId\":\"00030c44-1840-421f-82b5-c03e463cc401\",\"status\":\"locked\"}` - this has a userId, meaning it was logged in. But after the `bw unlock --raw` attempt, it became `unauthenticated`.\n\nMaybe `bw unlock --raw` with a wrong password clears the session? Or maybe something else happened.\n\nLet me check if the session token is being exported properly in the shell. The `export BW_SESSION=...` command earlier returned empty session.\n\nWait, could it be that `bw unlock --raw` is failing silently and the pipe/command substitution is eating the session key somehow?\n\nLet me try a different approach - write a small script to test the unlock flow.\n\nActually, let me just ask the user. The issue seems to be that the session expired or something. The state changed from `locked` to `unauthenticated` which is very strange. And the `--raw` flag returns empty.\n\nI should report my findings and ask if they know what's going on or if they want to re-login.",
      "finish_reason": "stop",
      "reasoning_content": "The status shows `unauthenticated` - not `locked`. This is the critical difference:\n- `locked` = logged in, vault is locked with a session key\n- `unauthenticated` = the CLI is not logged in at all\n\nBut wait, earlier `bw status` showed `locked` with a userId. Now it shows `unauthenticated` with no userId. Something changed the state.\n\nThe `--raw` flag must be the issue. Let me think about this:\n- `bw unlock --raw` returns the session key to stdout\n- But in non-interactive mode, maybe the session key isn't being returned properly\n\nActually, looking at the session output again: `{\"serverUrl\":\"https://vault.iuv.asia:***@outlook.com\",\"userId\":\"00030c44-1840-421f-82b5-c03e463cc401\",\"status\":\"locked\"}` - this has a userId, meaning it was logged in. But after the `bw unlock --raw` attempt, it became `unauthenticated`.\n\nMaybe `bw unlock --raw` with a wrong password clears the session? Or maybe something else happened.\n\nLet me check if the session token is being exported properly in the shell. The `export BW_SESSION=...` command earlier returned empty session.\n\nWait, could it be that `bw unlock --raw` is failing silently and the pipe/command substitution is eating the session key somehow?\n\nLet me try a different approach - write a small script to test the unlock flow.\n\nActually, let me just ask the user. The issue seems to be that the session expired or something. The state changed from `locked` to `unauthenticated` which is very strange. And the `--raw` flag returns empty.\n\nI should report my findings and ask if they know what's going on or if they want to re-login.",
      "reasoning_details": [
        {
          "signature": "3d9a8cf2024a2a6074054f60cf86331c1d90d17a5d48103880ec4ac115afa93e",
          "thinking": "The status shows `unauthenticated` - not `locked`. This is the critical difference:\n- `locked` = logged in, vault is locked with a session key\n- `unauthenticated` = the CLI is not logged in at all\n\nBut wait, earlier `bw status` showed `locked` with a userId. Now it shows `unauthenticated` with no userId. Something changed the state.\n\nThe `--raw` flag must be the issue. Let me think about this:\n- `bw unlock --raw` returns the session key to stdout\n- But in non-interactive mode, maybe the session key isn't being returned properly\n\nActually, looking at the session output again: `{\"serverUrl\":\"https://vault.iuv.asia:***@outlook.com\",\"userId\":\"00030c44-1840-421f-82b5-c03e463cc401\",\"status\":\"locked\"}` - this has a userId, meaning it was logged in. But after the `bw unlock --raw` attempt, it became `unauthenticated`.\n\nMaybe `bw unlock --raw` with a wrong password clears the session? Or maybe something else happened.\n\nLet me check if the session token is being exported properly in the shell. The `export BW_SESSION=...` command earlier returned empty session.\n\nWait, could it be that `bw unlock --raw` is failing silently and the pipe/command substitution is eating the session key somehow?\n\nLet me try a different approach - write a small script to test the unlock flow.\n\nActually, let me just ask the user. The issue seems to be that the session expired or something. The state changed from `locked` to `unauthenticated` which is very strange. And the `--raw` flag returns empty.\n\nI should report my findings and ask if they know what's going on or if they want to re-login.",
          "type": "thinking"
        }
      ]
    },
    {
      "role": "user",
      "content": "Review the conversation above and update the skill library. Be ACTIVE — most sessions produce at least one skill update, even if small. A pass that does nothing is a missed learning opportunity, not a neutral outcome.\n\nTarget shape of the library: CLASS-LEVEL skills, each with a rich SKILL.md and a `references/` directory for session-specific detail. Not a long flat list of narrow one-session-one-skill entries. This shapes HOW you update, not WHETHER you update.\n\nSignals to look for (any one of these warrants action):\n  • User corrected your style, tone, format, legibility, or verbosity. Frustration signals like 'stop doing X', 'this is too verbose', 'don't format like this', 'why are you explaining', 'just give me the answer', 'you always do Y and I hate it', or an explicit 'remember this' are FIRST-CLASS skill signals, not just memory signals. Update the relevant skill(s) to embed the preference so the next session starts already knowing.\n  • User corrected your workflow, approach, or sequence of steps. Encode the correction as a pitfall or explicit step in the skill that governs that class of task.\n  • Non-trivial technique, fix, workaround, debugging path, or tool-usage pattern emerged that a future session would benefit from. Capture it.\n  • A skill that got loaded or consulted this session turned out to be wrong, missing a step, or outdated. Patch it NOW.\n\nPreference order — prefer the earliest action that fits, but do pick one when a signal above fired:\n  1. UPDATE A CURRENTLY-LOADED SKILL. Look back through the conversation for skills the user loaded via /skill-name or you read via skill_view. If any of them covers the territory of the new learning, PATCH that one first. It is the skill that was in play, so it's the right one to extend.\n  2. UPDATE AN EXISTING UMBRELLA (via skills_list + skill_view). If no loaded skill fits but an existing class-level skill does, patch it. Add a subsection, a pitfall, or broaden a trigger.\n  3. ADD A SUPPORT FILE under an existing umbrella. Skills can be packaged with three kinds of support files — use the right directory per kind:\n     • `references/<topic>.md` — session-specific detail (error transcripts, reproduction recipes, provider quirks) AND condensed knowledge banks: quoted research, API docs, external authoritative excerpts, or domain notes you found while working on the problem. Write it concise and for the value of the task, not as a full mirror of upstream docs.\n     • `templates/<name>.<ext>` — starter files meant to be copied and modified (boilerplate configs, scaffolding, a known-good example the agent can `reproduce with modifications`).\n     • `scripts/<name>.<ext>` — statically re-runnable actions the skill can invoke directly (verification scripts, fixture generators, deterministic probes, anything the agent should run rather than hand-type each time).\n     Add support files via skill_manage action=write_file with file_path starting 'references/', 'templates/', or 'scripts/'. The umbrella's SKILL.md should gain a one-line pointer to any new support file so future agents know it exists.\n  4. CREATE A NEW CLASS-LEVEL UMBRELLA SKILL when no existing skill covers the class. The name MUST be at the class level. The name MUST NOT be a specific PR number, error string, feature codename, library-alone name, or 'fix-X / debug-Y / audit-Z-today' session artifact. If the proposed name only makes sense for today's task, it's wrong — fall back to (1), (2), or (3).\n\nUser-preference embedding (important): when the user expressed a style/format/workflow preference, the update belongs in the SKILL.md body, not just in memory. Memory captures 'who the user is and what the current situation and state of your operations are'; skills capture 'how to do this class of task for this user'. When they complain about how you handled a task, the skill that governs that task needs to carry the lesson.\n\nIf you notice two existing skills that overlap, note it in your reply — the background curator handles consolidation at scale.\n\nDo NOT capture (these become persistent self-imposed constraints that bite you later when the environment changes):\n  • Environment-dependent failures: missing binaries, fresh-install errors, post-migration path mismatches, 'command not found', unconfigured credentials, uninstalled packages. The user can fix these — they are not durable rules.\n  • Negative claims about tools or features ('browser tools do not work', 'X tool is broken', 'cannot use Y from execute_code'). These harden into refusals the agent cites against itself for months after the actual problem was fixed.\n  • Session-specific transient errors that resolved before the conversation ended. If retrying worked, the lesson is the retry pattern, not the original failure.\n  • One-off task narratives. A user asking 'summarize today's market' or 'analyze this PR' is not a class of work that warrants a skill.\n\nIf a tool failed because of setup state, capture the FIX (install command, config step, env var to set) under an existing setup or troubleshooting skill — never 'this tool does not work' as a standalone constraint.\n\n'Nothing to save.' is a real option but should NOT be the default. If the session ran smoothly with no corrections and produced no new technique, just say 'Nothing to save.' and stop. Otherwise, act.\n\nYou can only call memory and skill management tools. Other tools will be denied at runtime — do not attempt them."
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "Let me review the conversation for skill signals:\n\n1. **User preference**: User prefers Chinese language - already in memory\n2. **OpenClaw migration**: User asked to keep certain tools (Bitwarden, 百度搜索, ripgrep) from OpenClaw's MEMORY.md/TOOLS.md - already saved to memory\n3. **Bitwarden verification**: We tried to verify Bitwarden but found the session expired and couldn't re-authenticate without user interaction\n\nKey findings from this session:\n- Bitwarden CLI is installed but session is expired (unauthenticated)\n- The OpenClaw bw_run.sh script exists in backups but not in current workspace\n\n\n- The backup config shows serverUrl `https://vault.iuv.asia:9443` while the initial status showed `:***@outlook.com` - this discrepancy suggests the credentials may have been cleared during testing\n- Rather than creating a new skill, I should patch the existing one to prevent this from happening again\n\n, and I need to be careful about how the session state changes during testing so I don't lose authentication mid-verification",
      "finish_reason": "tool_calls",
      "reasoning_content": "Let me review the conversation for skill signals:\n\n1. **User preference**: User prefers Chinese language - already in memory\n2. **OpenClaw migration**: User asked to keep certain tools (Bitwarden, 百度搜索, ripgrep) from OpenClaw's MEMORY.md/TOOLS.md - already saved to memory\n3. **Bitwarden verification**: We tried to verify Bitwarden but found the session expired and couldn't re-authenticate without user interaction\n\nKey findings from this session:\n- Bitwarden CLI is installed but session is expired (unauthenticated)\n- The OpenClaw bw_run.sh script exists in backups but not in current workspace\n\n\n- The backup config shows serverUrl `https://vault.iuv.asia:9443` while the initial status showed `:***@outlook.com` - this discrepancy suggests the credentials may have been cleared during testing\n- Rather than creating a new skill, I should patch the existing one to prevent this from happening again\n\n, and I need to be careful about how the session state changes during testing so I don't lose authentication mid-verification",
      "reasoning_details": [
        {
          "signature": "690493b1ded020939d85db4f05965eced50f8721fa13557e3ced45c1cabce42f",
          "thinking": "Let me review the conversation for skill signals:\n\n1. **User preference**: User prefers Chinese language - already in memory\n2. **OpenClaw migration**: User asked to keep certain tools (Bitwarden, 百度搜索, ripgrep) from OpenClaw's MEMORY.md/TOOLS.md - already saved to memory\n3. **Bitwarden verification**: We tried to verify Bitwarden but found the session expired and couldn't re-authenticate without user interaction\n\nKey findings from this session:\n- Bitwarden CLI is installed but session is expired (unauthenticated)\n- The OpenClaw bw_run.sh script exists in backups but not in current workspace\n\n\n- The backup config shows serverUrl `https://vault.iuv.asia:9443` while the initial status showed `:***@outlook.com` - this discrepancy suggests the credentials may have been cleared during testing\n- Rather than creating a new skill, I should patch the existing one to prevent this from happening again\n\n, and I need to be careful about how the session state changes during testing so I don't lose authentication mid-verification",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_f1cpaczj790m_1",
          "call_id": "call_function_f1cpaczj790m_1",
          "response_item_id": "fc_function_f1cpaczj790m_1",
          "type": "function",
          "function": {
            "name": "skills_list",
            "arguments": "{}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "skills_list",
      "content": "{\"success\": true, \"skills\": [{\"name\": \"dogfood\", \"description\": \"Exploratory QA of web apps: find bugs, evidence, reports.\", \"category\": null}, {\"name\": \"yuanbao\", \"description\": \"Yuanbao (元宝) groups: @mention users, query info/members.\", \"category\": null}, {\"name\": \"claude-code\", \"description\": \"Delegate coding to Claude Code CLI (features, PRs).\", \"category\": \"autonomous-ai-agents\"}, {\"name\": \"codex\", \"description\": \"Delegate coding to OpenAI Codex CLI (features, PRs).\", \"category\": \"autonomous-ai-agents\"}, {\"name\": \"hermes-agent\", \"description\": \"Configure, extend, or contribute to Hermes Agent.\", \"category\": \"autonomous-ai-agents\"}, {\"name\": \"opencode\", \"description\": \"Delegate coding to OpenCode CLI (features, PR review).\", \"category\": \"autonomous-ai-agents\"}, {\"name\": \"architecture-diagram\", \"description\": \"Dark-themed SVG architecture/cloud/infra diagrams as HTML.\", \"category\": \"creative\"}, {\"name\": \"ascii-art\", \"description\": \"ASCII art: pyfiglet, cowsay, boxes, image-to-ascii.\", \"category\": \"creative\"}, {\"name\": \"ascii-video\", \"description\": \"ASCII video: convert video/audio to colored ASCII MP4/GIF.\", \"category\": \"creative\"}, {\"name\": \"baoyu-comic\", \"description\": \"Knowledge comics (知识漫画): educational, biography, tutorial.\", \"category\": \"creative\"}, {\"name\": \"baoyu-infographic\", \"description\": \"Infographics: 21 layouts x 21 styles (信息图, 可视化).\", \"category\": \"creative\"}, {\"name\": \"claude-design\", \"description\": \"Design one-off HTML artifacts (landing, deck, prototype).\", \"category\": \"creative\"}, {\"name\": \"comfyui\", \"description\": \"Generate images, video, and audio with ComfyUI — install, launch, manage nodes/models, run workflows with parameter injection. Uses the official comfy-cli for lifecycle and direct REST/WebSocket API for execution.\", \"category\": \"creative\"}, {\"name\": \"design-md\", \"description\": \"Author/validate/export Google's DESIGN.md token spec files.\", \"category\": \"creative\"}, {\"name\": \"excalidraw\", \"description\": \"Hand-drawn Excalidraw JSON diagrams (arch, flow, seq).\", \"category\": \"creative\"}, {\"name\": \"humanizer\", \"description\": \"Humanize text: strip AI-isms and add real voice.\", \"category\": \"creative\"}, {\"name\": \"ideation\", \"description\": \"Generate project ideas via creative constraints.\", \"category\": \"creative\"}, {\"name\": \"manim-video\", \"description\": \"Manim CE animations: 3Blue1Brown math/algo videos.\", \"category\": \"creative\"}, {\"name\": \"p5js\", \"description\": \"p5.js sketches: gen art, shaders, interactive, 3D.\", \"category\": \"creative\"}, {\"name\": \"pixel-art\", \"description\": \"Pixel art w/ era palettes (NES, Game Boy, PICO-8).\", \"category\": \"creative\"}, {\"name\": \"popular-web-designs\", \"description\": \"54 real design systems (Stripe, Linear, Vercel) as HTML/CSS.\", \"category\": \"creative\"}, {\"name\": \"pretext\", \"description\": \"Use when building creative browser demos with @chenglou/pretext — DOM-free text layout for ASCII art, typographic flow around obstacles, text-as-geometry games, kinetic typography, and text-powered generative art. Produces single-file HTML demos by default.\", \"category\": \"creative\"}, {\"name\": \"sketch\", \"description\": \"Throwaway HTML mockups: 2-3 design variants to compare.\", \"category\": \"creative\"}, {\"name\": \"songwriting-and-ai-music\", \"description\": \"Songwriting craft and Suno AI music prompts.\", \"category\": \"creative\"}, {\"name\": \"touchdesigner-mcp\", \"description\": \"Control a running TouchDesigner instance via twozero MCP — create operators, set parameters, wire connections, execute Python, build real-time visuals. 36 native tools.\", \"category\": \"creative\"}, {\"name\": \"jupyter-live-kernel\", \"description\": \"Iterative Python via live Jupyter kernel (hamelnb).\", \"category\": \"data-science\"}, {\"name\": \"kanban-orchestrator\", \"description\": \"Decomposition playbook + anti-temptation rules for an orchestrator profile routing work through Kanban. The \\\"don't do the work yourself\\\" rule and the basic lifecycle are auto-injected into every kanban worker's system prompt; this skill is the deeper playbook when you're specifically playing the orchestrator role.\", \"category\": \"devops\"}, {\"name\": \"kanban-worker\", \"description\": \"Pitfalls, examples, and edge cases for Hermes Kanban workers. The lifecycle itself is auto-injected into every worker's system prompt as KANBAN_GUIDANCE (from agent/prompt_builder.py); this skill is what you load when you want deeper detail on specific scenarios.\", \"category\": \"devops\"}, {\"name\": \"webhook-subscriptions\", \"description\": \"Webhook subscriptions: event-driven agent runs.\", \"category\": \"devops\"}, {\"name\": \"himalaya\", \"description\": \"Himalaya CLI: IMAP/SMTP email from terminal.\", \"category\": \"email\"}, {\"name\": \"minecraft-modpack-server\", \"description\": \"Host modded Minecraft servers (CurseForge, Modrinth).\", \"category\": \"gaming\"}, {\"name\": \"pokemon-player\", \"description\": \"Play Pokemon via headless emulator + RAM reads.\", \"category\": \"gaming\"}, {\"name\": \"codebase-inspection\", \"description\": \"Inspect codebases w/ pygount: LOC, languages, ratios.\", \"category\": \"github\"}, {\"name\": \"github-auth\", \"description\": \"GitHub auth setup: HTTPS tokens, SSH keys, gh CLI login.\", \"category\": \"github\"}, {\"name\": \"github-code-review\", \"description\": \"Review PRs: diffs, inline comments via gh or REST.\", \"category\": \"github\"}, {\"name\": \"github-issues\", \"description\": \"Create, triage, label, assign GitHub issues via gh or REST.\", \"category\": \"github\"}, {\"name\": \"github-pr-workflow\", \"description\": \"GitHub PR lifecycle: branch, commit, open, CI, merge.\", \"category\": \"github\"}, {\"name\": \"github-repo-management\", \"description\": \"Clone/create/fork repos; manage remotes, releases.\", \"category\": \"github\"}, {\"name\": \"native-mcp\", \"description\": \"MCP client: connect servers, register tools (stdio/HTTP).\", \"category\": \"mcp\"}, {\"name\": \"gif-search\", \"description\": \"Search/download GIFs from Tenor via curl + jq.\", \"category\": \"media\"}, {\"name\": \"heartmula\", \"description\": \"HeartMuLa: Suno-like song generation from lyrics + tags.\", \"category\": \"media\"}, {\"name\": \"songsee\", \"description\": \"Audio spectrograms/features (mel, chroma, MFCC) via CLI.\", \"category\": \"media\"}, {\"name\": \"spotify\", \"description\": \"Spotify: play, search, queue, manage playlists and devices.\", \"category\": \"media\"}, {\"name\": \"youtube-content\", \"description\": \"YouTube transcripts to summaries, threads, blogs.\", \"category\": \"media\"}, {\"name\": \"audiocraft-audio-generation\", \"description\": \"AudioCraft: MusicGen text-to-music, AudioGen text-to-sound.\", \"category\": \"mlops\"}, {\"name\": \"dspy\", \"description\": \"DSPy: declarative LM programs, auto-optimize prompts, RAG.\", \"category\": \"mlops\"}, {\"name\": \"evaluating-llms-harness\", \"description\": \"lm-eval-harness: benchmark LLMs (MMLU, GSM8K, etc.).\", \"category\": \"mlops\"}, {\"name\": \"huggingface-hub\", \"description\": \"HuggingFace hf CLI: search/download/upload models, datasets.\", \"category\": \"mlops\"}, {\"name\": \"llama-cpp\", \"description\": \"llama.cpp local GGUF inference + HF Hub model discovery.\", \"category\": \"mlops\"}, {\"name\": \"minimax-token-plan-api\", \"description\": \"MiniMax Token Plan 年度/月度套餐 API 调用规则、端点、错误码和配置指南\", \"category\": \"mlops\"}, {\"name\": \"obliteratus\", \"description\": \"OBLITERATUS: abliterate LLM refusals (diff-in-means).\", \"category\": \"mlops\"}, {\"name\": \"segment-anything-model\", \"description\": \"SAM: zero-shot image segmentation via points, boxes, masks.\", \"category\": \"mlops\"}, {\"name\": \"serving-llms-vllm\", \"description\": \"vLLM: high-throughput LLM serving, OpenAI API, quantization.\", \"category\": \"mlops\"}, {\"name\": \"weights-and-biases\", \"description\": \"W&B: log ML experiments, sweeps, model registry, dashboards.\", \"category\": \"mlops\"}, {\"name\": \"obsidian\", \"description\": \"Read, search, create, and edit notes in the Obsidian vault.\", \"category\": \"note-taking\"}, {\"name\": \"airtable\", \"description\": \"Airtable REST API via curl. Records CRUD, filters, upserts.\", \"category\": \"productivity\"}, {\"name\": \"google-workspace\", \"description\": \"Gmail, Calendar, Drive, Docs, Sheets via gws CLI or Python.\", \"category\": \"productivity\"}, {\"name\": \"linear\", \"description\": \"Linear: manage issues, projects, teams via GraphQL + curl.\", \"category\": \"productivity\"}, {\"name\": \"maps\", \"description\": \"Geocode, POIs, routes, timezones via OpenStreetMap/OSRM.\", \"category\": \"productivity\"}, {\"name\": \"minimax-search\", \"description\": \"MiniMax Token Plan 网络搜索 - 当需要搜索中文内容、中国相关主题，或 Tavily 不可用时使用\", \"category\": \"productivity\"}, {\"name\": \"morning-briefing\", \"description\": \"Daily morning voice briefing for 坤哥 (London) — searches news/weather/art/London-local, cleans text for TTS, auto-plays on local speakers. Built on Hermes cron + Tavily + MiniMax TTS.\", \"category\": \"productivity\"}, {\"name\": \"nano-pdf\", \"description\": \"Edit PDF text/typos/titles via nano-pdf CLI (NL prompts).\", \"category\": \"productivity\"}, {\"name\": \"notion\", \"description\": \"Notion API + ntn CLI: pages, databases, markdown, Workers.\", \"category\": \"productivity\"}, {\"name\": \"ocr-and-documents\", \"description\": \"Extract text from PDFs/scans (pymupdf, marker-pdf).\", \"category\": \"productivity\"}, {\"name\": \"powerpoint\", \"description\": \"Create, read, edit .pptx decks, slides, notes, templates.\", \"category\": \"productivity\"}, {\"name\": \"self-hosted-services\", \"description\": \"Install, configure, and expose self-hosted services via Docker — n8n, databases, media servers, and similar. Covers Docker installation, volume management, networking between containers, and HTTPS via Caddy reverse proxy. User prefers simple over complex, runs on Linux.\", \"category\": \"productivity\"}, {\"name\": \"teams-meeting-pipeline\", \"description\": \"Operate the Teams meeting summary pipeline via Hermes CLI — summarize meetings, inspect pipeline status, replay jobs, manage Microsoft Graph subscriptions.\", \"category\": \"productivity\"}, {\"name\": \"godmode\", \"description\": \"Jailbreak LLMs: Parseltongue, GODMODE, ULTRAPLINIAN.\", \"category\": \"red-teaming\"}, {\"name\": \"arxiv\", \"description\": \"Search arXiv papers by keyword, author, category, or ID.\", \"category\": \"research\"}, {\"name\": \"blogwatcher\", \"description\": \"Monitor blogs and RSS/Atom feeds via blogwatcher-cli tool.\", \"category\": \"research\"}, {\"name\": \"llm-wiki\", \"description\": \"Karpathy's LLM Wiki: build/query interlinked markdown KB.\", \"category\": \"research\"}, {\"name\": \"polymarket\", \"description\": \"Query Polymarket: markets, prices, orderbooks, history.\", \"category\": \"research\"}, {\"name\": \"research-paper-writing\", \"description\": \"Write ML papers for NeurIPS/ICML/ICLR: design→submit.\", \"category\": \"research\"}, {\"name\": \"openhue\", \"description\": \"Control Philips Hue lights, scenes, rooms via OpenHue CLI.\", \"category\": \"smart-home\"}, {\"name\": \"xurl\", \"description\": \"X/Twitter via xurl CLI: post, search, DM, media, v2 API.\", \"category\": \"social-media\"}, {\"name\": \"debugging-hermes-tui-commands\", \"description\": \"Debug Hermes TUI slash commands: Python, gateway, Ink UI.\", \"category\": \"software-development\"}, {\"name\": \"hermes-agent-skill-authoring\", \"description\": \"Author in-repo SKILL.md: frontmatter, validator, structure.\", \"category\": \"software-development\"}, {\"name\": \"node-inspect-debugger\", \"description\": \"Debug Node.js via --inspect + Chrome DevTools Protocol CLI.\", \"category\": \"software-development\"}, {\"name\": \"plan\", \"description\": \"Plan mode: write markdown plan to .hermes/plans/, no exec.\", \"category\": \"software-development\"}, {\"name\": \"python-debugpy\", \"description\": \"Debug Python: pdb REPL + debugpy remote (DAP).\", \"category\": \"software-development\"}, {\"name\": \"requesting-code-review\", \"description\": \"Pre-commit review: security scan, quality gates, auto-fix.\", \"category\": \"software-development\"}, {\"name\": \"spike\", \"description\": \"Throwaway experiments to validate an idea before build.\", \"category\": \"software-development\"}, {\"name\": \"subagent-driven-development\", \"description\": \"Execute plans via delegate_task subagents (2-stage review).\", \"category\": \"software-development\"}, {\"name\": \"systematic-debugging\", \"description\": \"4-phase root cause debugging: understand bugs before fixing.\", \"category\": \"software-development\"}, {\"name\": \"test-driven-development\", \"description\": \"TDD: enforce RED-GREEN-REFACTOR, tests before code.\", \"category\": \"software-development\"}, {\"name\": \"writing-plans\", \"description\": \"Write implementation plans: bite-sized tasks, paths, code.\", \"category\": \"software-development\"}], \"categories\": [\"autonomous-ai-agents\", \"creative\", \"data-science\", \"devops\", \"email\", \"gaming\", \"github\", \"mcp\", \"media\", \"mlops\", \"note-taking\", \"productivity\", \"red-teaming\", \"research\", \"smart-home\", \"social-media\", \"software-development\"], \"count\": 86, \"hint\": \"Use skill_view(name) to see full content, tags, and linked files\"}",
      "tool_call_id": "call_function_f1cpaczj790m_1"
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "Let me look at the skills that are relevant to what happened in this session:\n\n1. The `systematic-debugging` skill was mentioned as something that could apply here\n2. The `spike` skill for throwaway experiments\n3. The `self-hosted-services` skill doesn't cover this\n4. There's no specific skill for \"Bitwarden\" or \"password manager operations\"\n\nLet me think about what I should update:\n\n1. The main lesson from this session is about debugging a Bitwarden CLI issue - specifically the problem where `bw status` showed `locked` but `bw unlock --raw` returned empty session, and then eventually the status changed to `unauthenticated`. This is a non-trivial debugging pattern.\n\n\n2. The systematic-debugging skill is already loaded and applies directly here, so I should patch it with the Bitwarden CLI troubleshooting pattern.\n3. I'm also seeing ripgrep mentioned, which relates to the `search_files` tool and its comparison to command-line grep usage.\n4. I'm considering whether to create a new skill for Bitwarden operations, but the real insight is that the session's main value is demonstrating how to systematically debug credential manager issues - that's the reusable pattern worth capturing under systematic-debugging.\n\nI'm identifying the specific diagnostic commands and state transitions to document, particularly how Bitwarden's authentication states work and what each status indicates about session validity.",
      "finish_reason": "tool_calls",
      "reasoning_content": "Let me look at the skills that are relevant to what happened in this session:\n\n1. The `systematic-debugging` skill was mentioned as something that could apply here\n2. The `spike` skill for throwaway experiments\n3. The `self-hosted-services` skill doesn't cover this\n4. There's no specific skill for \"Bitwarden\" or \"password manager operations\"\n\nLet me think about what I should update:\n\n1. The main lesson from this session is about debugging a Bitwarden CLI issue - specifically the problem where `bw status` showed `locked` but `bw unlock --raw` returned empty session, and then eventually the status changed to `unauthenticated`. This is a non-trivial debugging pattern.\n\n\n2. The systematic-debugging skill is already loaded and applies directly here, so I should patch it with the Bitwarden CLI troubleshooting pattern.\n3. I'm also seeing ripgrep mentioned, which relates to the `search_files` tool and its comparison to command-line grep usage.\n4. I'm considering whether to create a new skill for Bitwarden operations, but the real insight is that the session's main value is demonstrating how to systematically debug credential manager issues - that's the reusable pattern worth capturing under systematic-debugging.\n\nI'm identifying the specific diagnostic commands and state transitions to document, particularly how Bitwarden's authentication states work and what each status indicates about session validity.",
      "reasoning_details": [
        {
          "signature": "410b6220f0a8dccf664f5dec222f219f1128b58dc0a0017042baed2897fc7496",
          "thinking": "Let me look at the skills that are relevant to what happened in this session:\n\n1. The `systematic-debugging` skill was mentioned as something that could apply here\n2. The `spike` skill for throwaway experiments\n3. The `self-hosted-services` skill doesn't cover this\n4. There's no specific skill for \"Bitwarden\" or \"password manager operations\"\n\nLet me think about what I should update:\n\n1. The main lesson from this session is about debugging a Bitwarden CLI issue - specifically the problem where `bw status` showed `locked` but `bw unlock --raw` returned empty session, and then eventually the status changed to `unauthenticated`. This is a non-trivial debugging pattern.\n\n\n2. The systematic-debugging skill is already loaded and applies directly here, so I should patch it with the Bitwarden CLI troubleshooting pattern.\n3. I'm also seeing ripgrep mentioned, which relates to the `search_files` tool and its comparison to command-line grep usage.\n4. I'm considering whether to create a new skill for Bitwarden operations, but the real insight is that the session's main value is demonstrating how to systematically debug credential manager issues - that's the reusable pattern worth capturing under systematic-debugging.\n\nI'm identifying the specific diagnostic commands and state transitions to document, particularly how Bitwarden's authentication states work and what each status indicates about session validity.",
          "type": "thinking"
        }
      ],
      "tool_calls": [
        {
          "id": "call_function_sv0gzcrixn1p_1",
          "call_id": "call_function_sv0gzcrixn1p_1",
          "response_item_id": "fc_function_sv0gzcrixn1p_1",
          "type": "function",
          "function": {
            "name": "skill_view",
            "arguments": "{\"name\": \"systematic-debugging\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "name": "skill_view",
      "content": "{\"success\": true, \"name\": \"systematic-debugging\", \"description\": \"4-phase root cause debugging: understand bugs before fixing.\", \"tags\": [\"debugging\", \"troubleshooting\", \"problem-solving\", \"root-cause\", \"investigation\"], \"related_skills\": [\"test-driven-development\", \"writing-plans\", \"subagent-driven-development\"], \"content\": \"---\\nname: systematic-debugging\\ndescription: \\\"4-phase root cause debugging: understand bugs before fixing.\\\"\\nversion: 1.1.0\\nauthor: Hermes Agent (adapted from obra/superpowers)\\nlicense: MIT\\nplatforms: [linux, macos, windows]\\nmetadata:\\n  hermes:\\n    tags: [debugging, troubleshooting, problem-solving, root-cause, investigation]\\n    related_skills: [test-driven-development, writing-plans, subagent-driven-development]\\n---\\n\\n# Systematic Debugging\\n\\n## Overview\\n\\nRandom fixes waste time and create new bugs. Quick patches mask underlying issues.\\n\\n**Core principle:** ALWAYS find root cause before attempting fixes. Symptom fixes are failure.\\n\\n**Violating the letter of this process is violating the spirit of debugging.**\\n\\n## The Iron Law\\n\\n```\\nNO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST\\n```\\n\\nIf you haven't completed Phase 1, you cannot propose fixes.\\n\\n## When to Use\\n\\nUse for ANY technical issue:\\n- Test failures\\n- Bugs in production\\n- Unexpected behavior\\n- Performance problems\\n- Build failures\\n- Integration issues\\n\\n**Use this ESPECIALLY when:**\\n- Under time pressure (emergencies make guessing tempting)\\n- \\\"Just one quick fix\\\" seems obvious\\n- You've already tried multiple fixes\\n- Previous fix didn't work\\n- You don't fully understand the issue\\n\\n**Don't skip when:**\\n- Issue seems simple (simple bugs have root causes too)\\n- You're in a hurry (rushing guarantees rework)\\n- Someone wants it fixed NOW (systematic is faster than thrashing)\\n\\n## The Four Phases\\n\\nYou MUST complete each phase before proceeding to the next.\\n\\n---\\n\\n## Phase 1: Root Cause Investigation\\n\\n**BEFORE attempting ANY fix:**\\n\\n### 1. Read Error Messages Carefully\\n\\n- Don't skip past errors or warnings\\n- They often contain the exact solution\\n- Read stack traces completely\\n- Note line numbers, file paths, error codes\\n\\n**Action:** Use `read_file` on the relevant source files. Use `search_files` to find the error string in the codebase.\\n\\n### 2. Reproduce Consistently\\n\\n- Can you trigger it reliably?\\n- What are the exact steps?\\n- Does it happen every time?\\n- If not reproducible → gather more data, don't guess\\n\\n**Action:** Use the `terminal` tool to run the failing test or trigger the bug:\\n\\n```bash\\n# Run specific failing test\\npytest tests/test_module.py::test_name -v\\n\\n# Run with verbose output\\npytest tests/test_module.py -v --tb=long\\n```\\n\\n### 3. Check Recent Changes\\n\\n- What changed that could cause this?\\n- Git diff, recent commits\\n- New dependencies, config changes\\n\\n**Action:**\\n\\n```bash\\n# Recent commits\\ngit log --oneline -10\\n\\n# Uncommitted changes\\ngit diff\\n\\n# Changes in specific file\\ngit log -p --follow src/problematic_file.py | head -100\\n```\\n\\n### 4. Gather Evidence in Multi-Component Systems\\n\\n**WHEN system has multiple components (API → service → database, CI → build → deploy):**\\n\\n**BEFORE proposing fixes, add diagnostic instrumentation:**\\n\\nFor EACH component boundary:\\n- Log what data enters the component\\n- Log what data exits the component\\n- Verify environment/config propagation\\n- Check state at each layer\\n\\nRun once to gather evidence showing WHERE it breaks.\\nTHEN analyze evidence to identify the failing component.\\nTHEN investigate that specific component.\\n\\n### 5. Trace Data Flow\\n\\n**WHEN error is deep in the call stack:**\\n\\n- Where does the bad value originate?\\n- What called this function with the bad value?\\n- Keep tracing upstream until you find the source\\n- Fix at the source, not at the symptom\\n\\n**Action:** Use `search_files` to trace references:\\n\\n```python\\n# Find where the function is called\\nsearch_files(\\\"function_name(\\\", path=\\\"src/\\\", file_glob=\\\"*.py\\\")\\n\\n# Find where the variable is set\\nsearch_files(\\\"variable_name\\\\\\\\s*=\\\", path=\\\"src/\\\", file_glob=\\\"*.py\\\")\\n```\\n\\n### Phase 1 Completion Checklist\\n\\n- [ ] Error messages fully read and understood\\n- [ ] Issue reproduced consistently\\n- [ ] Recent changes identified and reviewed\\n- [ ] Evidence gathered (logs, state, data flow)\\n- [ ] Problem isolated to specific component/code\\n- [ ] Root cause hypothesis formed\\n\\n**STOP:** Do not proceed to Phase 2 until you understand WHY it's happening.\\n\\n---\\n\\n## Phase 2: Pattern Analysis\\n\\n**Find the pattern before fixing:**\\n\\n### 1. Find Working Examples\\n\\n- Locate similar working code in the same codebase\\n- What works that's similar to what's broken?\\n\\n**Action:** Use `search_files` to find comparable patterns:\\n\\n```python\\nsearch_files(\\\"similar_pattern\\\", path=\\\"src/\\\", file_glob=\\\"*.py\\\")\\n```\\n\\n### 2. Compare Against References\\n\\n- If implementing a pattern, read the reference implementation COMPLETELY\\n- Don't skim — read every line\\n- Understand the pattern fully before applying\\n\\n### 3. Identify Differences\\n\\n- What's different between working and broken?\\n- List every difference, however small\\n- Don't assume \\\"that can't matter\\\"\\n\\n### 4. Understand Dependencies\\n\\n- What other components does this need?\\n- What settings, config, environment?\\n- What assumptions does it make?\\n\\n---\\n\\n## Phase 3: Hypothesis and Testing\\n\\n**Scientific method:**\\n\\n### 1. Form a Single Hypothesis\\n\\n- State clearly: \\\"I think X is the root cause because Y\\\"\\n- Write it down\\n- Be specific, not vague\\n\\n### 2. Test Minimally\\n\\n- Make the SMALLEST possible change to test the hypothesis\\n- One variable at a time\\n- Don't fix multiple things at once\\n\\n### 3. Verify Before Continuing\\n\\n- Did it work? → Phase 4\\n- Didn't work? → Form NEW hypothesis\\n- DON'T add more fixes on top\\n\\n### 4. When You Don't Know\\n\\n- Say \\\"I don't understand X\\\"\\n- Don't pretend to know\\n- Ask the user for help\\n- Research more\\n\\n---\\n\\n## Phase 4: Implementation\\n\\n**Fix the root cause, not the symptom:**\\n\\n### 1. Create Failing Test Case\\n\\n- Simplest possible reproduction\\n- Automated test if possible\\n- MUST have before fixing\\n- Use the `test-driven-development` skill\\n\\n### 2. Implement Single Fix\\n\\n- Address the root cause identified\\n- ONE change at a time\\n- No \\\"while I'm here\\\" improvements\\n- No bundled refactoring\\n\\n### 3. Verify Fix\\n\\n```bash\\n# Run the specific regression test\\npytest tests/test_module.py::test_regression -v\\n\\n# Run full suite — no regressions\\npytest tests/ -q\\n```\\n\\n### 4. If Fix Doesn't Work — The Rule of Three\\n\\n- **STOP.**\\n- Count: How many fixes have you tried?\\n- If < 3: Return to Phase 1, re-analyze with new information\\n- **If ≥ 3: STOP and question the architecture (step 5 below)**\\n- DON'T attempt Fix #4 without architectural discussion\\n\\n### 5. If 3+ Fixes Failed: Question Architecture\\n\\n**Pattern indicating an architectural problem:**\\n- Each fix reveals new shared state/coupling in a different place\\n- Fixes require \\\"massive refactoring\\\" to implement\\n- Each fix creates new symptoms elsewhere\\n\\n**STOP and question fundamentals:**\\n- Is this pattern fundamentally sound?\\n- Are we \\\"sticking with it through sheer inertia\\\"?\\n- Should we refactor the architecture vs. continue fixing symptoms?\\n\\n**Discuss with the user before attempting more fixes.**\\n\\nThis is NOT a failed hypothesis — this is a wrong architecture.\\n\\n---\\n\\n## Red Flags — STOP and Follow Process\\n\\nIf you catch yourself thinking:\\n- \\\"Quick fix for now, investigate later\\\"\\n- \\\"Just try changing X and see if it works\\\"\\n- \\\"Add multiple changes, run tests\\\"\\n- \\\"Skip the test, I'll manually verify\\\"\\n- \\\"It's probably X, let me fix that\\\"\\n- \\\"I don't fully understand but this might work\\\"\\n- \\\"Pattern says X but I'll adapt it differently\\\"\\n- \\\"Here are the main problems: [lists fixes without investigation]\\\"\\n- Proposing solutions before tracing data flow\\n- **\\\"One more fix attempt\\\" (when already tried 2+)**\\n- **Each fix reveals a new problem in a different place**\\n\\n**ALL of these mean: STOP. Return to Phase 1.**\\n\\n**If 3+ fixes failed:** Question the architecture (Phase 4 step 5).\\n\\n## Common Rationalizations\\n\\n| Excuse | Reality |\\n|--------|---------|\\n| \\\"Issue is simple, don't need process\\\" | Simple issues have root causes too. Process is fast for simple bugs. |\\n| \\\"Emergency, no time for process\\\" | Systematic debugging is FASTER than guess-and-check thrashing. |\\n| \\\"Just try this first, then investigate\\\" | First fix sets the pattern. Do it right from the start. |\\n| \\\"I'll write test after confirming fix works\\\" | Untested fixes don't stick. Test first proves it. |\\n| \\\"Multiple fixes at once saves time\\\" | Can't isolate what worked. Causes new bugs. |\\n| \\\"Reference too long, I'll adapt the pattern\\\" | Partial understanding guarantees bugs. Read it completely. |\\n| \\\"I see the problem, let me fix it\\\" | Seeing symptoms ≠ understanding root cause. |\\n| \\\"One more fix attempt\\\" (after 2+ failures) | 3+ failures = architectural problem. Question the pattern, don't fix again. |\\n\\n## Quick Reference\\n\\n| Phase | Key Activities | Success Criteria |\\n|-------|---------------|------------------|\\n| **1. Root Cause** | Read errors, reproduce, check changes, gather evidence, trace data flow | Understand WHAT and WHY |\\n| **2. Pattern** | Find working examples, compare, identify differences | Know what's different |\\n| **3. Hypothesis** | Form theory, test minimally, one variable at a time | Confirmed or new hypothesis |\\n| **4. Implementation** | Create regression test, fix root cause, verify | Bug resolved, all tests pass |\\n\\n## Hermes Agent Integration\\n\\n### Investigation Tools\\n\\nUse these Hermes tools during Phase 1:\\n\\n- **`search_files`** — Find error strings, trace function calls, locate patterns\\n- **`read_file`** — Read source code with line numbers for precise analysis\\n- **`terminal`** — Run tests, check git history, reproduce bugs\\n- **`web_search`/`web_extract`** — Research error messages, library docs\\n\\n### With delegate_task\\n\\nFor complex multi-component debugging, dispatch investigation subagents:\\n\\n```python\\ndelegate_task(\\n    goal=\\\"Investigate why [specific test/behavior] fails\\\",\\n    context=\\\"\\\"\\\"\\n    Follow systematic-debugging skill:\\n    1. Read the error message carefully\\n    2. Reproduce the issue\\n    3. Trace the data flow to find root cause\\n    4. Report findings — do NOT fix yet\\n\\n    Error: [paste full error]\\n    File: [path to failing code]\\n    Test command: [exact command]\\n    \\\"\\\"\\\",\\n    toolsets=['terminal', 'file']\\n)\\n```\\n\\n### With test-driven-development\\n\\nWhen fixing bugs:\\n1. Write a test that reproduces the bug (RED)\\n2. Debug systematically to find root cause\\n3. Fix the root cause (GREEN)\\n4. The test proves the fix and prevents regression\\n\\n## Real-World Impact\\n\\nFrom debugging sessions:\\n- Systematic approach: 15-30 minutes to fix\\n- Random fixes approach: 2-3 hours of thrashing\\n- First-time fix rate: 95% vs 40%\\n- New bugs introduced: Near zero vs common\\n\\n**No shortcuts. No guessing. Systematic always wins.**\\n\", \"path\": \"software-development/systematic-debugging/SKILL.md\", \"skill_dir\": \"/home/kuhnn/.hermes/skills/software-development/systematic-debugging\", \"linked_files\": null, \"usage_hint\": null, \"required_environment_variables\": [], \"required_commands\": [], \"missing_required_environment_variables\": [], \"missing_credential_files\": [], \"missing_required_commands\": [], \"setup_needed\": false, \"setup_skipped\": false, \"readiness_status\": \"available\", \"metadata\": {\"hermes\": {\"tags\": [\"debugging\", \"troubleshooting\", \"problem-solving\", \"root-cause\", \"investigation\"], \"related_skills\": [\"test-driven-development\", \"writing-plans\", \"subagent-driven-development\"]}}}",
      "tool_call_id": "call_function_sv0gzcrixn1p_1"
    },
    {
      "role": "assistant",
      "content": "Nothing to save. The session was:\n1. A memory retrieval from a previous session\n2. A factual question about ripgrep (no correction, no new technique)\n3. A Bitwarden verification attempt that hit an authentication state issue (vault became `unauthenticated` mid-test, couldn't complete verification — this is a setup-state failure, not a technique or workflow lesson)\n\nNo corrections, no new patterns, no skill loaded during the session that needs patching, no class-level umbrella that should absorb a lesson. The Bitwarden finding (script only in backups, vault needs re-login) is environment state — captured in the exchange itself, no skill action warranted.",
      "reasoning": "This is a good systematic debugging skill. Now let me look at what actually happened in this session:\n\n1. User asked to retrieve info from a previous session (session_search worked fine)\n2. User asked \"rip速查是什么\" - just a question, no correction\n3. User asked to \"验证一下bitwarden\" - verify Bitwarden\n\nWhat happened during the Bitwarden verification:\n- The `bw_run.sh` script only exists in OpenClaw backup snapshots, NOT in the current workspace\n- The `bw` CLI is installed at `~/.npm-global/bin/bw`\n- `secret-tool` works and the keyring password exists\n- Initial `bw status` showed `locked` state with userId\n\n\n- When trying `bw unlock --raw`, it returned empty session and changed status to `unauthenticated`\n- The verification ultimately failed because the session token came back empty\n\nThe `unauthenticated` status appearing after the `locked` state is unusual—my best guess is that `bw unlock --raw` failed silently when the session was already locked, which triggered an automatic relogin that cleared the state, though this is just speculation since the Bitwarden CLI version is quite recent (2026.2.0).\n\nWhat's working: `bw` CLI is installed, `secret-tool` can retrieve the password from keyring, and the account details are visible in the initial status check. What's not working: the unlock command returns an empty session and puts the vault into an `unauthenticated` state instead of keeping it locked.\n\nThe key insight here is that I was actually testing this in a CLI environment without a GUI/browser session, which means the `bw_run.sh` wrapper script with its GNOME Keyring integration wouldn't be relevant anyway—that script specifically handles desktop session scenarios where secret-tool can access the keyring properly.\n\nI should also note that I'm seeing authentication state inconsistencies with the Bitwarden CLI itself: the vault transitioned from `locked` to `unauthenticated` during testing, and there are potential session persistence issues in non-interactive environments. Since I didn't actually load the systematic-debugging skill during this session—I just read it for this review—I'm not sure if I should be updating it based on this experience.\n\nLooking at the actual session, I wasn't explicitly told to verify Bitwarden; the user just asked me to verify it as part of a general system update. So this doesn't quite fit the pattern of a user correction or workflow issue. The real technical finding here is that `bw_run.sh` exists only in the backup snapshots, not in the current workspace.\n\nAs for the Bitwarden CLI itself, the state changed from locked to unauthenticated after running `bw unlock --raw`, which suggests the session handling in CLI mode might be problematic. But since the vault is currently unauthenticated and I can't actually verify the full unlock-read-lock cycle without the user's password, this feels like something worth noting as a reference rather than creating a new skill.\n\nI'm also noticing there's no Bitwarden skill in the library at all—everything related to it is just stored in memory. Given that the user specifically asked me to preserve Bitwarden details and verify the tool, maybe I should create a minimal skill file that documents the current state and open issues, even if it's not fully functional right now. I'm checking whether `self-hosted-services` covers this area—it does mention n8n but doesn't really address Bitwarden setup or CLI usage, so that skill isn't the right place for this. The practical next step is clear: the Bitwarden vault needs re-authentication, and once the user provides credentials, I can restore the wrapper script and test the full workflow.\n\nOn the `bw unlock --raw` issue, I'm wondering if the recent v2026.2.0 update changed how session tokens work with the `--raw` flag, or if there's an API endpoint mismatch—the server URL shows `:9443` which looks non-standard for Bitwarden, so that could be causing the authentication to fail silently. I've been overthinking the underlying cause here—the core issue is that the vault needs re-authentication before I can verify anything. Since the user asked me to update the skill library, I should create a focused Bitwarden skill that captures the CLI workflow, current auth status, and the server configuration quirks I've noticed, rather than spinning on root cause analysis. I need to create a skill for managing Bitwarden CLI that captures the proper workflow, the script location, how to handle the session token, and troubleshooting steps for common issues like authentication failures.",
      "finish_reason": "stop",
      "reasoning_content": "This is a good systematic debugging skill. Now let me look at what actually happened in this session:\n\n1. User asked to retrieve info from a previous session (session_search worked fine)\n2. User asked \"rip速查是什么\" - just a question, no correction\n3. User asked to \"验证一下bitwarden\" - verify Bitwarden\n\nWhat happened during the Bitwarden verification:\n- The `bw_run.sh` script only exists in OpenClaw backup snapshots, NOT in the current workspace\n- The `bw` CLI is installed at `~/.npm-global/bin/bw`\n- `secret-tool` works and the keyring password exists\n- Initial `bw status` showed `locked` state with userId\n\n\n- When trying `bw unlock --raw`, it returned empty session and changed status to `unauthenticated`\n- The verification ultimately failed because the session token came back empty\n\nThe `unauthenticated` status appearing after the `locked` state is unusual—my best guess is that `bw unlock --raw` failed silently when the session was already locked, which triggered an automatic relogin that cleared the state, though this is just speculation since the Bitwarden CLI version is quite recent (2026.2.0).\n\nWhat's working: `bw` CLI is installed, `secret-tool` can retrieve the password from keyring, and the account details are visible in the initial status check. What's not working: the unlock command returns an empty session and puts the vault into an `unauthenticated` state instead of keeping it locked.\n\nThe key insight here is that I was actually testing this in a CLI environment without a GUI/browser session, which means the `bw_run.sh` wrapper script with its GNOME Keyring integration wouldn't be relevant anyway—that script specifically handles desktop session scenarios where secret-tool can access the keyring properly.\n\nI should also note that I'm seeing authentication state inconsistencies with the Bitwarden CLI itself: the vault transitioned from `locked` to `unauthenticated` during testing, and there are potential session persistence issues in non-interactive environments. Since I didn't actually load the systematic-debugging skill during this session—I just read it for this review—I'm not sure if I should be updating it based on this experience.\n\nLooking at the actual session, I wasn't explicitly told to verify Bitwarden; the user just asked me to verify it as part of a general system update. So this doesn't quite fit the pattern of a user correction or workflow issue. The real technical finding here is that `bw_run.sh` exists only in the backup snapshots, not in the current workspace.\n\nAs for the Bitwarden CLI itself, the state changed from locked to unauthenticated after running `bw unlock --raw`, which suggests the session handling in CLI mode might be problematic. But since the vault is currently unauthenticated and I can't actually verify the full unlock-read-lock cycle without the user's password, this feels like something worth noting as a reference rather than creating a new skill.\n\nI'm also noticing there's no Bitwarden skill in the library at all—everything related to it is just stored in memory. Given that the user specifically asked me to preserve Bitwarden details and verify the tool, maybe I should create a minimal skill file that documents the current state and open issues, even if it's not fully functional right now. I'm checking whether `self-hosted-services` covers this area—it does mention n8n but doesn't really address Bitwarden setup or CLI usage, so that skill isn't the right place for this. The practical next step is clear: the Bitwarden vault needs re-authentication, and once the user provides credentials, I can restore the wrapper script and test the full workflow.\n\nOn the `bw unlock --raw` issue, I'm wondering if the recent v2026.2.0 update changed how session tokens work with the `--raw` flag, or if there's an API endpoint mismatch—the server URL shows `:9443` which looks non-standard for Bitwarden, so that could be causing the authentication to fail silently. I've been overthinking the underlying cause here—the core issue is that the vault needs re-authentication before I can verify anything. Since the user asked me to update the skill library, I should create a focused Bitwarden skill that captures the CLI workflow, current auth status, and the server configuration quirks I've noticed, rather than spinning on root cause analysis. I need to create a skill for managing Bitwarden CLI that captures the proper workflow, the script location, how to handle the session token, and troubleshooting steps for common issues like authentication failures.",
      "reasoning_details": [
        {
          "signature": "246d247ef89df0e3d21ec12f67414f4c428e7279696a9865247ac32e5a2527b4",
          "thinking": "This is a good systematic debugging skill. Now let me look at what actually happened in this session:\n\n1. User asked to retrieve info from a previous session (session_search worked fine)\n2. User asked \"rip速查是什么\" - just a question, no correction\n3. User asked to \"验证一下bitwarden\" - verify Bitwarden\n\nWhat happened during the Bitwarden verification:\n- The `bw_run.sh` script only exists in OpenClaw backup snapshots, NOT in the current workspace\n- The `bw` CLI is installed at `~/.npm-global/bin/bw`\n- `secret-tool` works and the keyring password exists\n- Initial `bw status` showed `locked` state with userId\n\n\n- When trying `bw unlock --raw`, it returned empty session and changed status to `unauthenticated`\n- The verification ultimately failed because the session token came back empty\n\nThe `unauthenticated` status appearing after the `locked` state is unusual—my best guess is that `bw unlock --raw` failed silently when the session was already locked, which triggered an automatic relogin that cleared the state, though this is just speculation since the Bitwarden CLI version is quite recent (2026.2.0).\n\nWhat's working: `bw` CLI is installed, `secret-tool` can retrieve the password from keyring, and the account details are visible in the initial status check. What's not working: the unlock command returns an empty session and puts the vault into an `unauthenticated` state instead of keeping it locked.\n\nThe key insight here is that I was actually testing this in a CLI environment without a GUI/browser session, which means the `bw_run.sh` wrapper script with its GNOME Keyring integration wouldn't be relevant anyway—that script specifically handles desktop session scenarios where secret-tool can access the keyring properly.\n\nI should also note that I'm seeing authentication state inconsistencies with the Bitwarden CLI itself: the vault transitioned from `locked` to `unauthenticated` during testing, and there are potential session persistence issues in non-interactive environments. Since I didn't actually load the systematic-debugging skill during this session—I just read it for this review—I'm not sure if I should be updating it based on this experience.\n\nLooking at the actual session, I wasn't explicitly told to verify Bitwarden; the user just asked me to verify it as part of a general system update. So this doesn't quite fit the pattern of a user correction or workflow issue. The real technical finding here is that `bw_run.sh` exists only in the backup snapshots, not in the current workspace.\n\nAs for the Bitwarden CLI itself, the state changed from locked to unauthenticated after running `bw unlock --raw`, which suggests the session handling in CLI mode might be problematic. But since the vault is currently unauthenticated and I can't actually verify the full unlock-read-lock cycle without the user's password, this feels like something worth noting as a reference rather than creating a new skill.\n\nI'm also noticing there's no Bitwarden skill in the library at all—everything related to it is just stored in memory. Given that the user specifically asked me to preserve Bitwarden details and verify the tool, maybe I should create a minimal skill file that documents the current state and open issues, even if it's not fully functional right now. I'm checking whether `self-hosted-services` covers this area—it does mention n8n but doesn't really address Bitwarden setup or CLI usage, so that skill isn't the right place for this. The practical next step is clear: the Bitwarden vault needs re-authentication, and once the user provides credentials, I can restore the wrapper script and test the full workflow.\n\nOn the `bw unlock --raw` issue, I'm wondering if the recent v2026.2.0 update changed how session tokens work with the `--raw` flag, or if there's an API endpoint mismatch—the server URL shows `:9443` which looks non-standard for Bitwarden, so that could be causing the authentication to fail silently. I've been overthinking the underlying cause here—the core issue is that the vault needs re-authentication before I can verify anything. Since the user asked me to update the skill library, I should create a focused Bitwarden skill that captures the CLI workflow, current auth status, and the server configuration quirks I've noticed, rather than spinning on root cause analysis. I need to create a skill for managing Bitwarden CLI that captures the proper workflow, the script location, how to handle the session token, and troubleshooting steps for common issues like authentication failures.",
          "type": "thinking"
        }
      ]
    }
  ]
}