[FEATURE] Make /goal model-invocable (let the agent set its own Stop-condition)
Summary
/goal <condition> registers a session-scoped Stop hook that blocks the agent from ending its turn until the condition holds. Today it is user-only — typed into the prompt. The agent itself cannot set, update, or clear a goal.
Requesting a model-invocable path: a tool (or a model-invocable form of the command) that lets the agent register its own Stop-condition mid-task.
Precedent
This was in the original design and was cut:
- #56085 (closed/completed) — the request that shipped
/goal. Its proposal includedset_goal/update_goalas model tools so the agent could manage its own objective. Shipped user-only; the model-tool portion was dropped and never separately tracked. - #46524 (closed/stale) — broad "make every slash command agent-invocable" ask. Covers this by scope but stalled.
This issue re-files the narrower, higher-value slice: /goal specifically.
Motivation
A goal/Stop-condition is uniquely valuable to set from inside a task, where the agent — not the user — is the one who knows what "done" means:
- Self-enforced completion. Agent commits to an exit criterion before a long multi-step task, then can't prematurely declare victory — the same discipline
/goalgives users, applied where the agent has the context. - Decomposition. On entering a sub-task, the agent arms a condition for it and clears it on completion, without bouncing control back to the user.
- Loop/skill authoring. Skills that drive iterative work could install their own convergence condition rather than relying on prose instructions the model can rationalize past.
Proposed shape
A model-invocable tool, e.g. SetGoal { condition, action: set|update|clear }, subject to the same Stop-hook evaluator /goal already uses. Reuses existing machinery; only the invocation surface is new.
Guardrails worth considering:
- Cap concurrent self-set goals to avoid runaway/self-deadlock.
- Make self-set goals user-visible and user-clearable (so the human can always override).
- Gate behind the existing model-invocation flag system (cf.
disable-model-invocation, #29226/#50075).
Acceptance criteria
- Agent can register a Stop-condition without user typing
/goal. - Self-set goals are surfaced to the user and clearable by them.
- Same Stop-hook evaluation as the user-typed path.
---
Out of scope but adjacent: #46524's general slash-command-invocability ask — flagging in case maintainers prefer to solve the broad version.