Create a runnable contract for agent loops: a copy-ready command plus a durable Markdown file when useful. For /goal work, default to a real Markdown contract file plus a short one-line /goal command that references that file. Default to Chinese-first output with an English-compatible mirror unless the user asks otherwise.
Workflow
-
Classify the request.
- Use a normal prompt for one-turn answers, small rewrites, or trivial shell output.
- Use Codex
/goalor Claude/goalwhen the task has one finish line and should keep advancing until evidence proves completion. - Use Claude
/loopwhen the task should run on a timer, poll external state, babysit a PR/deploy, or produce recurring reports. - Use
.claude/loop.mdwhen the user wants a default prompt for bare/loop; it defines one default prompt, not a task list. - Use
goal.mdor<task-slug>.goal.mdfor/goalcontracts; the Markdown file is the source of truth, and the/goalcommand only points to it.
-
Ask only for high-impact missing details.
- Ask if runtime choice, target outcome, verification surface, write boundary, production access, credentials, or destructive authority is unclear.
- Otherwise choose conservative defaults and state them briefly.
-
Build the contract.
- Outcome: one concrete result, not an activity.
- Verification: commands, logs, screenshots, API responses, generated files, PR state, or other evidence.
- Constraints: behavior, public API, data, style, security, and branch rules that must not change.
- Boundaries: allowed write paths, forbidden paths, tools, environments, and external systems.
- Iteration policy: small steps, rerun checks, inspect logs before retrying, change evidence source after repeated failure.
- Stop/Pause: evidence that proves completion; blockers that require a human decision.
- For
/goal, write the full contract to a real Markdown file before final output. Usegoal.mdwhen safe; if it already exists, use<task-slug>.goal.md. In projectless workspaces, write to the available output directory or current workspace. - Keep the
/goalcommand one line and under 350 characters. It should reference the Markdown file with@/absolute/path/to/file.md; never paste the full contract into the command.
-
Output in this order.
推荐运行方式已生成 Markdown 文件for/goalcontracts可复制 /goal promptor可复制命令文件内容摘要for/goalcontracts默认选择理由可选调整only when choices remain usefulEnglish-compatible mirror
Reference Routing
- Read
references/runtime-playbook.mdwhen choosing between Codex/goal, Claude/goal, Claude/loop,.claude/loop.md, andgoal.md. - Read
references/output-templates.mdwhen drafting final commands or Markdown artifacts. - Run
python3 scripts/lint_goal_loop.py <file>for saved goal or loop artifacts before saying they are ready.
Quality Bar
Reject or revise output that:
- Leaves placeholders such as
[goal],<path>,TODO, or待补充. - Uses vague verification such as "make sure it works" or "looks good enough".
- Allows broad writes like "edit anything" or "change whatever".
- Lacks a stop condition, pause condition, write boundary, or verification evidence.
- Puts a full
/goalcontract directly in the command instead of a referenced Markdown file. - Produces a
/goalcommand longer than 350 characters. - Treats
/loopas a completion-driven command./loopis timer-driven;/goalis completion-driven. - Treats
.claude/loop.mdas multiple scheduled tasks. It is one default prompt for bare/loop.
Examples
User: "Help me make an App"
Output: Recommend Codex or Claude /goal, create goal.md or app-mvp.goal.md, and return a short /goal Read @/absolute/path/to/file.md ... prompt.
User: "Have it check every 5 minutes whether the deployment is complete"
Output: Recommend Claude /loop 5m ..., include observation signals, reporting format, stop/escalation conditions, and optional .claude/loop.md.
User: "Fix the flaky test in the existing repository"
Output: Recommend /goal, create a file-backed goal contract, require discovery of test commands, isolated fix boundaries, regression evidence, and pause on missing repro or environment blockers.