跳到正文
Skillpedia
智能体48k · #4765

goal-loop

它能做什么

`/goal` 命令可以把一项任务变成一个持续运行的流程,由 Agent 自己完成。它会按照“规划、执行、测试、复盘”的循环推进,直到任务完成、用户暂停,或者时间和资源用完为止。

适用场景

  • ✓当一项任务预计需要超过 30 分钟才能完成时。
  • ✓当有明确的方法可以验证任务是否完成时(例如测试是否全部通过)。
  • ✓当项目已经做好自动化准备(有测试和文档)时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/goal-loop/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/goal-loop/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请制定一个计划,把我们的项目从 Python 2 迁移到 Python 3,确保所有测试都通过,并且公共 API 保持不变。”

每周 5 个新技能,1 分钟读完。

工作原理

Agent 会收到清晰的指令,包括目标是什么、哪些内容不能改动、如何检查进度,以及什么时候停止。它会分阶段工作并汇报自己的操作,直到目标达成或需要人工介入。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Agent /goal Loop

What /goal is

/goal is a slash command that turns an agent prompt into a persistent agent looping plan → act → test → review → iterate until a stop condition is met, the user pauses, or the token budget runs out. Internally called the "Ralph loop."

Agents with the /goal feature right now: Codex, Claude Code, and Hermes Agent.

Key difference from a normal prompt: when a turn ends but the goal isn't met, the agent auto-continues instead of waiting for input.

Lifecycle states: pursuing, paused, achieved, unmet, budget-limited.

When monitoring a running /goal, every check should include a one-line update to the user: what the agent is doing and whether it is on track. Keep it extremely concise.

Not: a budget command, a safety boundary, "run forever", or a replacement for /plan. It's a contract enforcer with a verification loop.

Requirements

  • An agent with the /goal feature — right now: Codex, Claude Code, or Hermes Agent
  • The goals feature enabled in the agent's config
  • Subscription auth — API-key auth does not work. A pro-tier plan is the realistic minimum for long runs.

When to Use it

Use only when all three are true:

  1. Task is >30 min of mechanical work.
  2. There's a verifiable stop condition (tests pass, coverage hit, eval ≥ X, build green).
  3. Repo is agent-ready (working build, decent tests, AGENTS.md present).

Fits: migrations, coverage lifts, TDD feature builds, refactors with contract tests, prompt/eval optimization, deploy retry loops, bug-repro-then-fix.

Bad fits: exploratory work, vague "improve this", anything without a "done" definition, prod credentials, destructive shared-infra ops.

The 5-part contract (every goal needs this)

  1. Objective — one sentence, one concrete outcome.
  2. Constraints — what must NOT change (public API, files, libs, conventions).
  3. Validation command — the exact shell command that proves progress (pytest -q, pnpm test, etc.).
  4. Stop condition — verifiable: "Stop when X passes" OR "when further changes need human/product input."
  5. Documentation — one sentence instructing the agent to write concise, targeted docs for every change, either creating new .md files or updating existing ones.

Plus: tell the agent what to read first, ask it to work in checkpoints with a short progress log.

Writing a goal (the core deliverable)

When the user wants a quick /goal instruction, produce a structured markdown block with one line per contract item (proper newlines, not flowing prose). Do not prefix the output with /goal — the user adds the slash command themselves in the composer. Emit only the contract body. Template:

**Objective:** <one-sentence objective>
**Read first:** <files/PLAN.md/issue>
**Constraints:** <what not to change, libs, conventions>
**Validate:** `<exact command>` after each change
**Document:** Write concise, targeted documentation for all changes — create new `.md` files or update existing docs as needed.
**Checkpoints:** work in checkpoints and log progress briefly
**Stop when:** <verifiable condition>, OR when further changes require human/product input

Example (migration)

**Objective:** Migrate this project from Pydantic v1 to v2.
**Read first:** pyproject.toml, src/, tests/
**Constraints:** no public API changes; keep imports backwards-compatible via shims if needed; no new dependencies
**Validate:** `pytest -q` after each change
**Checkpoints:** work in checkpoints; log progress briefly
**Stop when:** full suite passes with zero deprecation warnings, OR when a change requires architecture decisions

Example (coverage lift)

**Objective:** Raise coverage in src/auth/ from ~38% to ≥75%.
**Read first:** src/auth/, tests/auth/, AGENTS.md
**Constraints:** no new deps; mirror existing test style; do not modify production code unless strictly required for testability
**Validate:** `pytest --cov=src/auth --cov-report=term-missing`
**Checkpoints:** work in checkpoints; log coverage delta each one
**Stop when:** coverage ≥75% AND all tests pass, OR when uncovered code needs design changes

Writing rules

  • One objective, one stop condition. Not a backlog.
  • Documentation is mandatory. Every /goal prompt must include a single sentence committing the agent to concise, targeted docs — new .md files or focused updates to existing docs.

…

常见问题

什么是“Ralph 循环”?

这是 `/goal` 所用流程的内部名称:规划、执行、测试、复盘,然后不断重复,直到目标达成。

我可以把 `/goal` 用在任何任务上吗?

不可以。它最适合篇幅长、定义清晰、有明确“完成”标准的任务。对于探索性工作,或者没有明确终点的任务,它并不适用。

什么是“可验证的停止条件”?

它是一条清晰、客观的规则,用来标记任务的结束,例如“所有测试都已通过”或“代码覆盖率已达到 X%”。它是可以衡量的。

详情

作者的原始描述

Draft and explain persistent goal-loop prompts for long-running agent work with clear stop conditions.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#4765
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能