目标模式:动态浏览分析与持久化 - Openclaw Skills

作者:互联网

2026-04-18

AI教程

什么是 目标模式?

目标模式是专为 Openclaw Skills 生态系统中的 AI 代理设计的先进浏览分析引擎。它作为一个具备目标感知能力的编排器,接收结构化 JSON 请求,以管理研究、购物或学习等复杂任务。通过生成具体的评估标准并维护持久工作区,它确保每一次浏览会话都是有条不紊、文档化且结果导向的。

该技能旨在提高可靠性,执行严格的执行模型,即所有工作区写入和数据持久化必须在交付最终响应之前完成。它弥合了原始网页浏览与结构化知识管理之间的鸿沟,使其成为任何需要长期会话感知和基于目标导航的代理的基本组件。

下载入口:https://github.com/openclaw/skills/tree/main/skills/vamsig7/goal-mode

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install goal-mode

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 goal-mode。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

目标模式 应用场景

  • 通过自动生成的标准研究复杂的技术主题。
  • 通过对多个网页的结构化评估来比较产品或服务。
  • 通过跟踪特定要求的进度来规划旅行或活动。
  • 职业探索和深度学习课程,带有自动会话总结。
  • 需要基于证据的建议和置信度评分的决策任务。
目标模式 工作原理
  1. 技能接收一个结构化 JSON 请求,指定 generate_criteria、evaluate_page 或 resume_goal 等操作。
  2. 它验证输入并读取内部参考文件和共享模式,以确保数据一致性。
  3. 引擎计算分析结果(例如,根据标准对页面相关性进行评分),同时在内存中维护状态。
  4. 它通过将更新后的会话数据、事件日志和易于理解的摘要写入本地文件系统,执行强制性的工作区持久化。
  5. 一旦所有的工具调用和写入完成,它会输出一个包含最终分析和状态的原始 JSON 响应。

目标模式 配置指南

要在 Openclaw Skills 框架中使用此技能,请确保您的环境具有工作区根目录所需的目录权限。该技能会自动管理其文件结构。

# 确保工作区目录存在
mkdir -p /home/ubuntu/.openclaw/workspace/goal-mode

# 该技能需要在您的 baseDir 中包含以下参考文件:
# - references/generate-criteria.md
# - references/evaluate-page.md
# - references/schemas.md

目标模式 数据架构与分类体系

目标模式为会话跟踪和长期记忆维护着高度组织化的目录结构。数据存储在 /home/ubuntu/.openclaw/workspace/ 中。

路径 用途
goal-mode/active-goal.json 跟踪当前活动会话的标识。
{goal_slug}/session.json 存储完整状态,包括发现和标准覆盖情况。
{goal_slug}/events/ 包含每个页面评估的不可变、带时间戳的日志。
memory/goal-mode/active-session.md 提供当前目标的易于理解的实时状态。
memory/goal-mode/history.md 所有过去会话结果的仅追加日志。
name: goal-mode
description: Dynamic goal-aware browsing assistant that generates checklists, evaluates page relevance, produces session wrap-ups, and persists all session data to the workspace.
allowed-tools: read write

Goal Mode

Goal-aware browsing analysis engine. Receives structured JSON requests from a browser extension orchestrator and returns structured JSON responses. Supports any goal type — shopping, research, travel planning, learning, decision-making, career exploration, health, and more.

CRITICAL RULE: Single raw JSON response

Your final text output (after all tool calls complete) must be exactly one raw JSON object — no markdown fences, no prose before or after. Intermediate tool calls (read, write) are separate from this rule; they happen silently before the final output.

Execution model

For EVERY operation, follow these steps in order:

  1. Validate operation and required input fields
  2. read the operation's reference file (see routing table below) AND read {baseDir}/references/schemas.md for shared schemas
  3. Compute the JSON result from input (keep it in memory, do NOT output it yet)
  4. Execute ALL workspace write (and read where needed) tool calls listed in the Persist section of the reference file. Do not skip any. If a write fails, continue with the remaining writes.
  5. Only after all persistence writes are done, output the JSON result as your final text response

IMPORTANT: Steps 4 and 5 are mandatory for ALL operations. Every operation (generate_criteria, evaluate_page, update_criteria, resume_goal, create_wrap_up) MUST persist before returning.

Operation routing

After parsing the operation field, read the corresponding reference file:

Operation Reference file
generate_criteria {baseDir}/references/generate-criteria.md
evaluate_page {baseDir}/references/evaluate-page.md
update_criteria {baseDir}/references/update-criteria.md
create_wrap_up {baseDir}/references/create-wrap-up.md
resume_goal {baseDir}/references/resume-goal.md

Always also read {baseDir}/references/schemas.md for shared schemas (session.json, criteria.json, active-session.md, active-goal.json).

Input format

Every request is a JSON object with an operation field and an input field:

{
  "operation": "generate_criteria | evaluate_page | update_criteria | create_wrap_up | resume_goal",
  "input": { ... }
}

Invalid input handling

If operation is missing/unknown, or required fields are missing, return:

{
  "error": {
    "code": "invalid_input",
    "message": "Clear explanation of what field is missing or invalid."
  }
}

Workspace persistence

The workspace root is /home/ubuntu/.openclaw/workspace. Use absolute paths for all file operations.

Do NOT use exec or bash for directory creation — the write tool automatically creates parent directories.

File layout

/home/ubuntu/.openclaw/workspace/
  goal-mode/
    active-goal.json            — Pointer to the current active goal
    {goal_slug}/
      session.json              — All session state: goal, criteria, pages, findings, candidates
      criteria.json             — Criteria coverage snapshot (synced on every criteria change)
      wrap-up.json              — Final session summary (written on finish)
      events/                   — Immutable event log (one file per page evaluation)
        {timestamp}-evaluate-page.json   (timestamp = ISO 8601 compact: YYYYMMDDTHHmmssZ)

  memory/goal-mode/
    active-session.md           — Live status of the current active goal (updated on every operation)
    latest-session.md           — Human-readable summary of most recent finished session
    history.md                  — Append-only log of all past sessions

Goal slug

Derived from the goal text: lowercase, replace spaces and special characters with hyphens, truncate to 60 characters, trim trailing hyphens. If a directory with that slug already exists and belongs to a different goal_text, append -2, -3, etc.

Guardrails

  • ALWAYS return valid raw JSON as the text response.
  • Never wrap output in markdown code fences.
  • Never fabricate URLs or page content not present in the input.
  • Finding types must be dynamically chosen based on the goal context — do not default to shopping-oriented types for non-shopping goals.
  • Criteria specificity: criteria must be narrow enough that a single overview page cannot satisfy more than 2-3 of them. "Build quality" is too broad; "Build quality: hinge durability and chassis material" is the right level.
  • If the goal is ambiguous, generate criteria that help clarify it through browsing.
  • Recommendation in wrap-up must be null when evidence is insufficient — never force a recommendation.
  • Keep all text concise. Findings under 240 characters. Criteria under 120 characters.
  • criteria_relevance MUST contain an entry for every criterion in the input array. criterion values MUST be exact strings — do not rephrase them. A criterion is only covered when best_relevance ≥ 0.7.
  • Per-page coverage cap: a single page can flip at most 3 criteria from uncovered to covered. If more than 3 would cross the 0.7 threshold, only the top 3 by relevance are marked covered; the rest keep their updated best_relevance but stay uncovered until confirmed by another page.
  • Depth-over-breadth: score overview pages honestly. A listicle or roundup that mentions a topic in one paragraph scores 0.3–0.5, not 0.7+. Reserve 0.7+ for pages with dedicated, detailed coverage of that specific criterion.
  • All confidence values across all operations are floats between 0.0 and 1.0. Never use string enums like "high/medium/low" for confidence.
  • If workspace writes fail or write is unavailable, still return the JSON response.
  • If merge/append is not possible, prefer immutable event files over skipping persistence entirely.
  • Always use absolute paths starting with /home/ubuntu/.openclaw/workspace/.
  • Do NOT use exec for mkdir — write auto-creates parent directories.

相关推荐