Skip to content

Open every goal loop with the backend's /goal directive - #283

Merged
scgopi merged 3 commits into
mainfrom
feat/goal-directive
Sep 5, 2026
Merged

Open every goal loop with the backend's /goal directive#283
scgopi merged 3 commits into
mainfrom
feat/goal-directive

Conversation

@scgopi

@scgopi scgopi commented Sep 5, 2026

Copy link
Copy Markdown
Owner

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 — /goal already says to keep working, and its argument is the condition an evaluator judges.

All four backends carry it. goalDirective stays a per-backend String? rather than a constant for the reason isSpiked was kept: nil is 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:

  • Subcommand collision. /goal clear clears the session's goal, so a goal phrased "clear the lint backlog" would arm nothing and look like it had. A summary opening with clear/edit/pause/resume is prefixed Done when: so the first word stays ordinary.
  • SessionPrompt needed no change. A /goal prompt is a leading directive like any other, so the briefing and wake-digest preambles already trail it. /goal takes 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

Check Result
xcodebuild test ✅ 1577 tests, 162 suites, 0 failures
swiftlint lint ✅ 0 errors
swift format lint --strict ✅ clean

Local CLI checks recorded in the capability comments: /goal was read off Claude Code 2.1.261 and Codex 0.153.2 directly. It did not appear in Copilot 1.0.82's help commands or OpenCode 1.18.29's strings — but Copilot's listing omits /loop and /every as 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

scgopi and others added 3 commits September 4, 2026 19:44
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
@scgopi scgopi changed the title Open a goal loop with the backend's own /goal directive Open every goal loop with the backend's /goal directive Sep 5, 2026
@scgopi
scgopi merged commit 7635023 into main Sep 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant