Set Goal
Use this when the user wants a substantial goal that an agent can execute
directly in goal mode, loop mode, or a fresh long-running task.
This is not ordinary planning and not session closeout. Use context-maintain
for preserving current state, plan stress-tests, lessons, and closeout. Use
set-goal only when the desired output is an execution-ready goal prompt that
can guide sustained autonomous work.
Goal-Writing Principles
Good long-running goals follow the current Codex guidance: give the agent the
task context, constraints, and a clear definition of done. For multi-hour work,
make the goal self-contained, observable, and safe to resume from.
- Start with the user-visible outcome: what will be possible after completion.
- Name the exact files, docs, commands, errors, and examples to inspect first.
- State constraints and non-goals so the agent does not widen scope.
- Define done as observable behavior, verification output, or reviewable
artifacts.
- Break work into independently verifiable milestones.
- Include stop conditions: when to continue autonomously, when to ask, and
when the goal is complete.
- Require progress updates in the goal file or active plan so a later agent can
resume from the artifact alone.
Workflow
- Read
NOW.md and concise CONTEXT.md; use node scripts/context-index.js hydrate "<task>" before opening PLAN.md, chunks, or bulky/task-specific
context. Read active PLAN.md sections only when the goal needs task-local
state.
- Inspect source-of-truth artifacts instead of relying only on conversation:
diffs, commits, tests, docs, issues, failing commands, or relevant files.
- Distill one primary outcome. If multiple unrelated outcomes remain, split
them into separate goals.
- Ask only when goal, scope, or done criteria require human judgment.
- Output a ready-to-paste goal block unless the user explicitly asks for a
file. If writing a file, make it self-contained and executable by a fresh
agent.
Goal Template
Use this shape for goal/loop mode:
# Goal
[One outcome the agent should accomplish. State why it matters from the user's
perspective and how success will be visible.]
## Done Means
- [Observable or testable completion criterion.]
- [Required verification command or manual check.]
- [Closeout artifact or status update that must exist.]
## Context To Read First
- `NOW.md`
- concise `CONTEXT.md`
- `node scripts/context-index.js hydrate "<task>"` before `PLAN.md`, chunks, or bulky task-specific context
- [Task-specific files, docs, issues, commits, tests]
## Current State
- [What is already done.]
- [Known failures, open work, or uncertainty.]
## Constraints And Non-Goals
- [Rules, user preferences, safety limits, preserved behavior.]
- [Explicitly out-of-scope work.]
## Milestones
1. [Independently verifiable checkpoint.]
2. [Independently verifiable checkpoint.]
3. [Final integration/checkpoint.]
## Verification
- [Command/check to run.]
- [Expected result.]
## Loop Rules
- Continue through the next milestone without asking when the next action is
clear and safe.
- Ask only for human-judgment blockers, permission-gated operations, secrets,
external publishing, or destructive actions.
- At each stopping point, update progress, discoveries, decisions, and next
step in the goal file or active plan.
- Stop only when Done Means is satisfied or a blocker requires the user.
## Closeout
- Update `PLAN.md` with task-local findings and decisions if it exists.
- Update `CONTEXT.md` for durable terms, rules, invariants, or lessons.
- If `CONTEXT.md`, `PLAN.md`, or `NOW.md` changed in a way future retrieval should see, run `node scripts/context-index.js update`.
- Rewrite `NOW.md` with focus, blockers, next step, and touched files.
Quality Bar
- Prefer concrete filenames and commands over vague instructions.
- Keep the goal self-contained enough for a fresh agent to start without the
prior conversation.
- Preserve uncertainty explicitly; do not invent resolved facts.
- Make every milestone prove something observable.
- Keep private raw data, secrets, and unnecessary personal details out of the
goal.
1---2name: set-goal3description: Turn the current conversation and repository state into a directly usable long-running goal for Codex goal mode, loop mode, or a fresh agent run, including purpose, context, constraints, milestones, verification, stop conditions, and closeout instructions.4---56# Set Goal78Use this when the user wants a substantial goal that an agent can execute9directly in goal mode, loop mode, or a fresh long-running task.1011This is not ordinary planning and not session closeout. Use `context-maintain`12for preserving current state, plan stress-tests, lessons, and closeout. Use13`set-goal` only when the desired output is an execution-ready goal prompt that14can guide sustained autonomous work.1516## Goal-Writing Principles1718Good long-running goals follow the current Codex guidance: give the agent the19task context, constraints, and a clear definition of done. For multi-hour work,20make the goal self-contained, observable, and safe to resume from.21221. Start with the user-visible outcome: what will be possible after completion.232. Name the exact files, docs, commands, errors, and examples to inspect first.243. State constraints and non-goals so the agent does not widen scope.254. Define done as observable behavior, verification output, or reviewable26 artifacts.275. Break work into independently verifiable milestones.286. Include stop conditions: when to continue autonomously, when to ask, and29 when the goal is complete.307. Require progress updates in the goal file or active plan so a later agent can31 resume from the artifact alone.3233## Workflow34351. Read `NOW.md` and concise `CONTEXT.md`; use `node scripts/context-index.js36 hydrate "<task>"` before opening `PLAN.md`, chunks, or bulky/task-specific37 context. Read active `PLAN.md` sections only when the goal needs task-local38 state.392. Inspect source-of-truth artifacts instead of relying only on conversation:40 diffs, commits, tests, docs, issues, failing commands, or relevant files.413. Distill one primary outcome. If multiple unrelated outcomes remain, split42 them into separate goals.434. Ask only when goal, scope, or done criteria require human judgment.445. Output a ready-to-paste goal block unless the user explicitly asks for a45 file. If writing a file, make it self-contained and executable by a fresh46 agent.4748## Goal Template4950Use this shape for goal/loop mode:5152```markdown53# Goal54[One outcome the agent should accomplish. State why it matters from the user's55perspective and how success will be visible.]5657## Done Means58- [Observable or testable completion criterion.]59- [Required verification command or manual check.]60- [Closeout artifact or status update that must exist.]6162## Context To Read First63- `NOW.md`64- concise `CONTEXT.md`65- `node scripts/context-index.js hydrate "<task>"` before `PLAN.md`, chunks, or bulky task-specific context66- [Task-specific files, docs, issues, commits, tests]6768## Current State69- [What is already done.]70- [Known failures, open work, or uncertainty.]7172## Constraints And Non-Goals73- [Rules, user preferences, safety limits, preserved behavior.]74- [Explicitly out-of-scope work.]7576## Milestones771. [Independently verifiable checkpoint.]782. [Independently verifiable checkpoint.]793. [Final integration/checkpoint.]8081## Verification82- [Command/check to run.]83- [Expected result.]8485## Loop Rules86- Continue through the next milestone without asking when the next action is87 clear and safe.88- Ask only for human-judgment blockers, permission-gated operations, secrets,89 external publishing, or destructive actions.90- At each stopping point, update progress, discoveries, decisions, and next91 step in the goal file or active plan.92- Stop only when Done Means is satisfied or a blocker requires the user.9394## Closeout95- Update `PLAN.md` with task-local findings and decisions if it exists.96- Update `CONTEXT.md` for durable terms, rules, invariants, or lessons.97- If `CONTEXT.md`, `PLAN.md`, or `NOW.md` changed in a way future retrieval should see, run `node scripts/context-index.js update`.98- Rewrite `NOW.md` with focus, blockers, next step, and touched files.99```100101## Quality Bar102103- Prefer concrete filenames and commands over vague instructions.104- Keep the goal self-contained enough for a fresh agent to start without the105 prior conversation.106- Preserve uncertainty explicitly; do not invent resolved facts.107- Make every milestone prove something observable.108- Keep private raw data, secrets, and unnecessary personal details out of the109 goal.