Open every goal loop with the backend's /goal directive - #283
Merged
Conversation
A goal-based loop stated its goal as prose: "Work toward this goal until it is met: …". Claude Code and Codex both grew a `/goal <condition>` command since — it installs a session-scoped check the agent cannot finish past until the condition holds, which is exactly the contract the loop type names. Prose asks for that; the directive binds it. So a goal prompt now leads with `/goal` wherever the backend has it, the way a time-based prompt leads with `/loop`. The directive replaces the prose framing rather than joining it — `/goal` already says to keep working, and its argument is the condition an evaluator judges. Capability-gated rather than assumed: `copilot help commands` (1.0.80) and OpenCode 1.18.29 list no `/goal`, so those two keep the prose prompt they always had. `SessionPrompt` needed no change — a `/goal` prompt is a leading directive like any other, so the briefing and wake preambles already trail it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016Na4EdpaATRmgmuK9o7nVH
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016Na4EdpaATRmgmuK9o7nVH
Copilot and OpenCode were left on the prose prompt because neither CLI's command listing mentioned `/goal`. That listing is not the authority it looks like: Copilot's omits `/loop` and `/every` too, which this file has claimed and shipped on for releases. Both have the command, so both get the directive, and a goal loop now opens the same way on all four backends. `goalDirective` stays a per-backend `String?` rather than collapsing into a constant. `nil` is what the next backend needs on the day it arrives without the command — a session handed a directive its CLI does not have types the arming step as prose and starts no work, which is a goal loop that looks armed and is not. The prose prompt keeps its own test for the same reason. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016Na4EdpaATRmgmuK9o7nVH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A goal-based loop stated its goal as prose —
Work toward this goal until it is met: …. The CLIs have grown a/goal <condition>command since, which installs a session-scoped check the agent cannot finish past until the condition holds. That is exactly the contract the loop type names: prose asks for it, the directive binds it.So a goal prompt now leads with
/goal, the way a time-based prompt leads with/loop. The directive replaces the prose framing rather than joining it —/goalalready says to keep working, and its argument is the condition an evaluator judges.All four backends carry it.
goalDirectivestays a per-backendString?rather than a constant for the reasonisSpikedwas kept:nilis what the next backend needs on the day it arrives without the command, since a session handed a directive its CLI lacks types the arming step as prose and starts no work — a goal loop that looks armed and is not. The prose prompt keeps its own test.Two details worth the review:
/goal clearclears the session's goal, so a goal phrased "clear the lint backlog" would arm nothing and look like it had. A summary opening withclear/edit/pause/resumeis prefixedDone when:so the first word stays ordinary.SessionPromptneeded no change. A/goalprompt is a leading directive like any other, so the briefing and wake-digest preambles already trail it./goaltakes the rest of the line, so a trailing pointer lands inside the condition — still the right side: a condition carrying one instruction the session discharges immediately beats a directive that never ran.Verification
xcodebuild testswiftlint lintswift format lint --strictLocal CLI checks recorded in the capability comments:
/goalwas read off Claude Code 2.1.261 and Codex 0.153.2 directly. It did not appear in Copilot 1.0.82'shelp commandsor OpenCode 1.18.29's strings — but Copilot's listing omits/loopand/everyas well, which this file has shipped on for releases, so that listing is not evidence of absence. Both are enabled on the maintainer's word, and the OpenCode comment names the symptom to look for if it ever turns out otherwise.🤖 Generated with Claude Code
https://claude.ai/code/session_016Na4EdpaATRmgmuK9o7nVH