← 返回 Skills 市场
theashbhat

goal-agent

作者 Ash Bhat · GitHub ↗ · v1.1.0
cross-platform ⚠ suspicious
447
总下载
0
收藏
2
当前安装
3
版本数
在 OpenClaw 中安装
/install goal-agent
功能描述
Scaffold a self-learning goal-oriented agent. Set a goal, define a metric, and the agent iterates toward it — measuring, learning, and adapting its strategy...
使用说明 (SKILL.md)

goal-agent

Overview

The goal-agent skill creates a workspace that turns an OpenClaw agent into a focused, autonomous optimizer. You give it a goal and a shell command that measures progress — the agent does the rest, iterating heartbeat by heartbeat, learning what works and what doesn't.


Usage

Step 1: Collect inputs

Input Flag Required Default
Goal description --goal
Metric command (returns a number) --metric
Target value --target
Direction (up/down) --direction up
Safety constraints --constraints None
Max iterations --max-iterations 50
Output directory --output-dir ./

Step 2: Run scaffold.sh

bash ~/clawd/skills/goal-agent/scripts/scaffold.sh \
  --goal "Increase daily active users to 100" \
  --metric "cat /tmp/my-metric.json | jq '.dau'" \
  --target 100 \
  --direction up \
  --constraints "Do not modify the database schema. Stay within $50/day budget." \
  --max-iterations 30 \
  --output-dir ~/clawd/goals/dau-growth

This generates the following files in --output-dir:

  • GOAL.md — goal definition, iteration counter, history table
  • STRATEGY.md — current approach, hypotheses, next action
  • LEARNINGS.md — rules extracted from experience
  • HEARTBEAT.md — the feedback loop instructions (replaces main HEARTBEAT.md)
  • evaluate.sh — runnable metric evaluator

Step 3: Activate the feedback loop

The generated HEARTBEAT.md is the goal-agent loop. Each heartbeat, the agent:

  1. Measures the metric
  2. Compares against target and history
  3. Reflects on what worked/didn't
  4. Decides the next action
  5. Acts
  6. Records results
  7. Adapts strategy

To activate: Copy HEARTBEAT.md to ~/clawd/HEARTBEAT.md (or symlink it):

cp ~/clawd/goals/dau-growth/HEARTBEAT.md ~/clawd/HEARTBEAT.md

Step 4: Deploy options

Option A — Current agent (fastest) Copy all generated files into your workspace and activate HEARTBEAT.md as above.

Option B — Dedicated VM (cleanest) Use the spawn-agent skill to create a fresh agent VM, then copy the goal workspace there:

# On the new agent
scp -r ~/clawd/goals/dau-growth/ ubuntu@new-agent:~/clawd/goals/
ssh ubuntu@new-agent "cp ~/clawd/goals/dau-growth/HEARTBEAT.md ~/clawd/HEARTBEAT.md"

Examples

Example 1: Optimize test coverage

bash ~/clawd/skills/goal-agent/scripts/scaffold.sh \
  --goal "Increase test coverage to 80%" \
  --metric "cd ~/myproject && npx jest --coverage --coverageReporters=text-summary 2>/dev/null | grep 'Statements' | grep -oP '\d+\.\d+(?=%)'" \
  --target 80 \
  --direction up \
  --max-iterations 20 \
  --output-dir ~/clawd/goals/test-coverage

Example 2: Reduce build time

bash ~/clawd/skills/goal-agent/scripts/scaffold.sh \
  --goal "Reduce build time to under 30 seconds" \
  --metric "cd ~/myproject && time npm run build 2>&1 | grep real | grep -oP '\d+\.\d+'" \
  --target 30 \
  --direction down \
  --constraints "Do not remove any build steps. Do not break production builds." \
  --output-dir ~/clawd/goals/build-speed

Example 3: Grow social followers

bash ~/clawd/skills/goal-agent/scripts/scaffold.sh \
  --goal "Reach 500 Twitter followers" \
  --metric "~/.openclaw/scripts/twitter-follower-count.sh" \
  --target 500 \
  --direction up \
  --constraints "Only post authentic content. No follow-for-follow schemes." \
  --output-dir ~/clawd/goals/twitter-growth

Safety & Sandboxing

Before activating a goal-agent loop, review these guidelines:

  • Review generated files before activating. Always read the generated HEARTBEAT.md and evaluate.sh before copying them into your workspace. Confirm the metric command and constraints are what you intended.
  • Use --constraints to limit scope. The agent will only take actions within the constraints you define. Be explicit: "Only modify files in ~/myproject/src", "Do not make network requests", "Do not delete files".
  • Set a low --max-iterations for first runs. Start with 5-10 to observe behavior before allowing longer runs.
  • Prefer dedicated VMs for autonomous goals. Use spawn-agent to isolate goal-agents from your main workspace. This limits blast radius if the agent takes unexpected actions.
  • Metric commands should be read-only. The --metric command should only measure — never modify state. Use simple commands like cat, wc, jq, grep.
  • The "Act" step is constrained by text, not code. The agent follows the constraints you set in --constraints, but there is no programmatic sandbox. For high-stakes goals, combine with filesystem permissions, network egress controls, or a restricted user account.
  • Monitor early iterations. Check GOAL.md history after the first few heartbeats to verify the agent is behaving as expected.

How it works

The HEARTBEAT.md implements a tight cognitive loop:

Measure → Compare → Reflect → Decide → Act → Record → Adapt
    ↑___________________________________________________|

Each iteration, the agent reads its own history (GOAL.md), its current understanding (STRATEGY.md), and accumulated wisdom (LEARNINGS.md) before taking action. Over time it builds a library of what works for your specific goal.


Files reference

File Purpose Agent modifies?
GOAL.md Source of truth: goal, metric, target, history Status + History only
STRATEGY.md Current plan, hypotheses, next action Yes (every iteration)
LEARNINGS.md Extracted rules and patterns Yes (as it learns)
HEARTBEAT.md Loop instructions No
evaluate.sh Runnable metric command No

Skill location

~/clawd/skills/goal-agent/

安全使用建议
Do not activate this skill as-is. Key considerations: - The package is incomplete: scaffold.sh expects a templates/ directory that is not included; request the missing templates or a complete release from the author before running. - Always inspect the generated HEARTBEAT.md and evaluate.sh before copying them into ~/clawd/HEARTBEAT.md. These files will drive autonomous actions. - The metric you pass is an arbitrary shell command. Ensure it is read-only and cannot execute or write state. Prefer simple cat/jq/wc commands and validate evaluate.sh behavior. - Constraints are textual only — the agent will follow them in language, not via enforcement. For risky goals, run the agent in a dedicated VM or under restricted user permissions, set low --max-iterations, and monitor early iterations. - If you need to proceed, ask the publisher for the missing templates, or unpack and review the templates that will be used to generate evaluate.sh so you can verify there is no unintended command execution or injection (sed substitutions may inject user-provided text into files).
功能分析
Type: OpenClaw Skill Name: goal-agent Version: 1.1.0 The goal-agent skill scaffolds an autonomous feedback loop that executes user-defined shell commands and overwrites the agent's core HEARTBEAT.md file. While these high-risk capabilities are aligned with the stated purpose of goal-oriented optimization, they enable persistent, autonomous shell execution without a programmatic sandbox. Additionally, the scripts/scaffold.sh file contains a potential injection vulnerability due to the unsafe use of sed when processing user-provided inputs like --metric.
能力评估
Purpose & Capability
The name and description match the included behavior: generate a workspace (GOAL.md, STRATEGY.md, HEARTBEAT.md, evaluate.sh) for an autonomous optimization loop. However, the provided scaffold.sh expects a templates/ directory (TEMPLATES_DIR) which is not present in the file manifest — this makes the script nonfunctional as shipped and is an inconsistency between claimed capability and actual package contents.
Instruction Scope
SKILL.md instructs the agent to 'Act' each heartbeat and to run an arbitrary user-supplied metric command (any shell command that returns a number). While the skill warns to make metrics read-only and to set constraints, the enforcement is purely textual (no programmatic sandbox). That means a misconfigured metric or lax constraints could let the agent execute destructive or networked actions. Users must manually review generated HEARTBEAT.md and evaluate.sh before activating.
Install Mechanism
There is no install spec (instruction-only), which is low-risk, but scaffold.sh writes generated files into the user's output-dir. The higher concern is the missing templates directory referenced by scaffold.sh — either templates are omitted from the package or scaffold.sh assumes a different install layout. As provided, the script will fail to find its templates.
Credentials
The skill declares no required environment variables, credentials, or config paths. That is proportionate to the stated purpose. Note: examples reference user-local scripts and files (e.g., ~/.openclaw/scripts/twitter-follower-count.sh); those are user-specific and not requested by the skill but could be referenced by supplied metric commands.
Persistence & Privilege
The skill is not marked always:true and uses the platform's normal autonomous invocation model. Activating the generated HEARTBEAT.md (by copying it into ~/clawd/HEARTBEAT.md) gives the agent ongoing behavior — this is expected for a goal loop but does increase blast radius, so follow the guidance to isolate runs.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install goal-agent
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /goal-agent 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.0
- Added a new "Safety & Sandboxing" section with guidelines for safe use and isolation of goal-agents. - Removed README.md; all documentation is now consolidated in SKILL.md. - No changes to the overall usage or functionality of the skill. - Updated documentation to advise reviewing generated files and using agent constraints carefully.
v1.0.1
- Added a new README.md file with usage and overview information. - Updated SKILL.md with YAML frontmatter, and changed example metric usage for DAU in the sample command. - Improved documentation for better clarity and organization. - No changes to core functionality.
v1.0.0
Initial release: self-learning goal-oriented agent scaffold with feedback loop, strategy adaptation, and learnings log
元数据
Slug goal-agent
版本 1.1.0
许可证
累计安装 2
当前安装数 2
历史版本数 3
常见问题

goal-agent 是什么?

Scaffold a self-learning goal-oriented agent. Set a goal, define a metric, and the agent iterates toward it — measuring, learning, and adapting its strategy... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 447 次。

如何安装 goal-agent?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install goal-agent」即可一键安装,无需额外配置。

goal-agent 是免费的吗?

是的,goal-agent 完全免费(开源免费),可自由下载、安装和使用。

goal-agent 支持哪些平台?

goal-agent 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 goal-agent?

由 Ash Bhat(@theashbhat)开发并维护,当前版本 v1.1.0。

💬 留言讨论