Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

Retire /loop; /goal is the autonomous run

justrach27fb75d5633a
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 59bc6a31..ddd09ed5 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -217,8 +217,8 @@ jobs:
- name: PTY /goal autonomous collapse wiring test
run: python3 scripts/test-pty-goal-loop.py zig-out/bin/graff
- - name: PTY /loop holds for its own background work (#1278)
- run: python3 scripts/test-pty-loop-hold.py zig-out/bin/graff
+ - name: PTY /goal run holds for its own background work (#1278)
+ run: python3 scripts/test-pty-goal-hold.py zig-out/bin/graff
- name: PTY peer-channel delivery smoke test (#469)
run: python3 scripts/test-pty-peer-channel.py zig-out/bin/graff
diff --git a/README.md b/README.md
index 5c633a53..20d461c2 100644
--- a/README.md
+++ b/README.md
@@ -178,7 +178,7 @@ or pass `--yolo`. Full flag list: `graff --help`. Learning:
[docs/skills.md](docs/skills.md).
```
-/model /models /clear /new /goal /loop /review /never
+/model /models /clear /new /goal /review /never
/plan /yolo /strict /effort /compact /rewind /btw
/skills /plugins /mcp /save /resume /sessions /help
```
diff --git a/docs/adr/0216-loop-is-retired.md b/docs/adr/0216-loop-is-retired.md
new file mode 100644
index 00000000..7a6d02bc
--- /dev/null
+++ b/docs/adr/0216-loop-is-retired.md
@@ -0,0 +1,41 @@
+# 0216. /loop is retired; /goal is the autonomous run
+
+Status: accepted 2026-09-29
+
+## Context
+
+`/loop [30m] <prompt>` ran the same plan-act-verify controller as `/goal`
+without adopting a standing objective. After a working turn the controller
+queued a continuation turn with a steering note and a pacing line, up to 25
+times. It existed only in the line REPL: the TUI chat, ACP clients, the SDKs
+and `-p` never had it.
+
+The two things it offered are covered elsewhere now. Waiting for background
+work is how runs work: interactive surfaces wake when a job exits, and
+headless runs wait until idle (ADR 0215). Working autonomously toward an
+objective is `/goal`, which runs on the same controller with a completion
+gate. What `/loop` added on top was continuation nudges for a prompt with no
+objective to check them against. Such a run ends as `idle` on its first
+zero-tool turn, or after 25 nudges.
+
+## Decision
+
+- Remove `/loop` from the line parser, the command catalog, help and the TUI
+ chat. Typing `/loop` prints a one-line notice that points at `/goal`, and
+ makes no model call.
+- `/goal [30m] <objective>` keeps the controller, the continuation steering,
+ the pacing line and the #1278 hold for its own background work.
+- The controller marks its continuation turns itself
+ (`goal_pacing.autonomousFromLine(..., continuation)`). The synthesized line
+ no longer carries a `/loop ` prefix for the parser to recognize, so no typed
+ line can pass for a continuation.
+- The armed budget line reads `run budget: 30m`.
+
+## Consequences
+
+- One autonomous entry point to document and test. The tier-1 invariant that
+ kept `/goal` and `/loop` in step now pins that `/loop` does not come back as
+ a second entry point.
+- Someone who wants continuation without a standing objective phrases the
+ prompt as a `/goal`; the objective then scopes the completion gate.
+- Release notes and the changelog keep their historical `/loop` entries.
diff --git a/docs/adr/README.md b/docs/adr/README.md
index 217c34bc..874f7708 100644
--- a/docs/adr/README.md
+++ b/docs/adr/README.md
@@ -242,6 +242,7 @@ record only when you need the evidence or the edge cases.
| [0213](0213-line-repl-paste-is-framed-and-typed.md) | Keep line-REPL paste framed through active turns; submit one draft on Enter, and stage or reject bounded image data URIs before text expansion. |
| [0214](0214-evals-are-mined-and-hillclimbed-on-a-held-out-split.md) | Mine live eval tasks from merged PRs, with graders validated red on the parent and green and stable on the merge, and a person approving each. Hill-climb on a fixed held-out split with measured noise: keep a change only when train beats the noise band and test improves. Model-guide advice enters as candidates, not edits. |
| [0215](0215-headless-runs-wait-until-idle.md) | Headless roots (`-p`, `--json`, `graff serve`, piped stdin) wait for their own background work to report before a plain final ends the run. Servers do not count, a 10-minute heartbeat wakes the model, and interactive surfaces keep their idle wake. |
+| [0216](0216-loop-is-retired.md) | `/loop` is retired: `/goal` is the one autonomous run, and waiting for background work is how every run works (ADR 0215). Typing `/loop` prints a pointer to `/goal` and makes no model call. |
## When to write one
diff --git a/scripts/eval/tier1-manifest.json b/scripts/eval/tier1-manifest.json
index 0e1ef9e8..217b95bc 100644
--- a/scripts/eval/tier1-manifest.json
+++ b/scripts/eval/tier1-manifest.json
@@ -35,18 +35,18 @@
},
{
"id": "loop-expired",
- "test": "/loop: a passed wall-clock deadline stops as expired and flips nothing",
+ "test": "goal run: a passed wall-clock deadline stops as expired and flips nothing",
"why": "6300514: a timed run past its deadline must stop as expired, not as accepted."
},
{
"id": "loop-idle",
- "test": "/loop: a restored all-[x] list is idle, not accepted (#318)",
- "why": "#318: a leftover finished checklist ended a fresh /loop at iteration 1."
+ "test": "goal run: a restored all-[x] list is idle, not accepted (#318)",
+ "why": "#318: a leftover finished checklist ended a fresh run at iteration 1."
},
{
"id": "goal-loop-one-run",
- "test": "/goal and /loop produce the same run; only /goal adopts the objective",
- "why": "010b9ad: /goal and /loop are one autonomous run; they must not drift apart."
+ "test": "/goal is the one autonomous run; /loop no longer starts one",
+ "why": "010b9ad, ADR 0216: /goal is the autonomous run; the retired /loop must not come back as a second entry point."
},
{
"id": "compaction-keeps-goal",
@@ -61,7 +61,7 @@
{
"id": "child-deadline",
"test": "childTaskPrompt: the same absolute deadline reaches every child, minus a margin",
- "why": "d33c4a4: a timed /loop must hand its deadline down, or children outlive the run."
+ "why": "d33c4a4: a timed /goal run must hand its deadline down, or children outlive the run."
},
{
"id": "cache-affinity-scratch",
diff --git a/scripts/test-pty-loop-hold.py b/scripts/test-pty-goal-hold.py
similarity index 82%
rename from scripts/test-pty-loop-hold.py
rename to scripts/test-pty-goal-hold.py
index c8276076..488e0b60 100755
--- a/scripts/test-pty-loop-hold.py
+++ b/scripts/test-pty-goal-hold.py
@@ -1,17 +1,17 @@
#!/usr/bin/env python3
-"""Real-PTY regression for #1278: /loop holds for its own background work.
+"""Real-PTY regression for #1278: a /goal run holds for its own background work.
-A /loop turn that starts a background shell job yields the prompt at once
+A run turn that starts a background shell job yields the prompt at once
(subagent_interactive), so the turn makes no further model call and the
controller used to read it as `idle` and end the run. The job's completion
-wake then ran as an ordinary turn, outside the loop's credits and steering.
+wake then ran as an ordinary turn, outside the run's credits and steering.
Mock script (by request ordinal):
- 1 "/loop wait for the build" -> one shell call with run_in_background.
+ 1 "/goal wait for the build" -> one shell call with run_in_background.
The turn yields; the job (a short sleep) is still running, so the run
must HOLD instead of stopping.
2 the job's completion wake -> a final message with no tool call. It must
- arrive as a /loop continuation: the wake text plus the continuation
+ arrive as a run continuation: the wake text plus the continuation
steering and pacing note. With the job gone, the run then stops idle.
"""
@@ -55,11 +55,11 @@ def main() -> None:
mock = CodexMock(events_for_request=events)
port = mock.start()
try:
- with tempfile.TemporaryDirectory(prefix="graff-loop-hold-") as tmp:
+ with tempfile.TemporaryDirectory(prefix="graff-goal-hold-") as tmp:
codex_home = os.path.join(tmp, "codex-home")
os.makedirs(codex_home)
with open(os.path.join(codex_home, "auth.json"), "w", encoding="utf-8") as fh:
- json.dump({"tokens": {"access_token": "loop-hold-mock", "account_id": "acct-loop-hold"}}, fh)
+ json.dump({"tokens": {"access_token": "goal-hold-mock", "account_id": "acct-goal-hold"}}, fh)
harness_dir = os.path.join(tmp, ".harness")
os.makedirs(harness_dir)
with open(os.path.join(harness_dir, "settings.json"), "w", encoding="utf-8") as fh:
@@ -89,7 +89,7 @@ def main() -> None:
) as session:
session.wait_for_prompt()
cursor = len(session.raw)
- session.send_line("/loop wait for the build")
+ session.send_line("/goal wait for the build")
session.wait_for_literal("run waiting", start=cursor, timeout=15.0)
# The job's wake continues the run; with the job gone it stops idle.
session.wait_for_literal("run stopped — idle", start=cursor, timeout=20.0)
@@ -105,10 +105,10 @@ def main() -> None:
if len(requests) != 2:
raise AssertionError(f"expected exactly 2 model requests, got {len(requests)}")
wake_turn = json.dumps(requests[1].body)
- for needle in ("HOLD_BUILD_DONE", "continuing autonomously (/loop)", "[pace: continuation"):
+ for needle in ("HOLD_BUILD_DONE", "continuing autonomously", "[pace: continuation"):
if needle not in wake_turn:
- raise AssertionError(f"the wake turn did not continue the /loop run ({needle!r} missing): {wake_turn[-600:]!r}")
- print("ok /loop holds for its background job, and the job's wake continues the run with its steering")
+ raise AssertionError(f"the wake turn did not continue the /goal run ({needle!r} missing): {wake_turn[-600:]!r}")
+ print("ok a /goal run holds for its background job, and the job's wake continues the run with its steering")
if __name__ == "__main__":
diff --git a/scripts/test-pty-goal-loop.py b/scripts/test-pty-goal-loop.py
index 048e73ef..de80a57e 100644
--- a/scripts/test-pty-goal-loop.py
+++ b/scripts/test-pty-goal-loop.py
@@ -7,7 +7,7 @@ or --json path before src/mainloop.zig even exists, so nothing headless can
reach the WIRING: whether typing `/goal <objective>` in the interactive REPL
actually adopts a standing goal AND fires a turn, whether a duration prefix
is stripped before the objective is recorded, and whether the continuation
-turn the /loop controller queues really carries the pacing note. This drives
+turn the run controller queues really carries the pacing note. This drives
a real PTY against a scripted codex mock and inspects what was SENT, the
only way to prove the seam in mainloop.zig (`goal_pacing.autonomousFromLine`
-> `goal_flow.loopTurnDecision` -> the synthesized continuation line) is
@@ -20,7 +20,7 @@ fixed input sequence below):
2 second exchange of that same turn, after the tool result -> a final
message with no further tool call. tool_calls_this_turn ends at 1, so
goal_flow.loopTurnDecision authorizes one continuation.
- 3 the synthesized continuation turn ("/loop [continuing...]\\n[pace: ...]")
+ 3 the synthesized continuation turn ("[continuing...]\\n[pace: ...]")
-> a final message with no tool call, so tool_calls_this_turn is 0 and
the loop stops `idle` (clean, no 25-iteration runaway).
4 the "/goal 30m ship the thing" turn -> a final message with no tool
@@ -139,7 +139,7 @@ def main() -> None:
# the /goal command line.
cursor = len(session.raw)
session.send_line("/goal 30m ship the thing")
- session.wait_for_literal("/loop budget: 30m", start=cursor)
+ session.wait_for_literal("run budget: 30m", start=cursor)
session.wait_for_literal("Goal set: ship the thing", start=cursor)
session.wait_for_literal("run stopped — idle", start=cursor, timeout=10.0)
session.wait_for_prompt(start=cursor)
@@ -177,7 +177,7 @@ def main() -> None:
raise AssertionError("the standing-goal steering note was not sent on the /goal turn")
# 3. The continuation turn (request 3: turn 1's tool call authorized exactly
- # one continuation) carries the pacing line — proof the /loop controller,
+ # one continuation) carries the pacing line — proof the run controller,
# not just the parser, actually ran.
continuation = json.dumps(requests[2].body)
if "continuation" not in continuation or "elapsed" not in continuation:
diff --git a/src/agent.zig b/src/agent.zig
index 3e417582..0a947dcb 100644
--- a/src/agent.zig
+++ b/src/agent.zig
@@ -37,7 +37,7 @@ pub const TodoItem = struct {
retired: bool = false, // a LATER user ask retired this finished item (#394): kept as the session's archive, invisible to every epoch-scoped query
};
/// Governed-run status for a standing /goal (#223). Only `.active` steers turns;
-/// pause/resume and the /loop continuation gate (#226) key off the others.
+/// pause/resume and the run continuation gate (#226) key off the others.
pub const GoalStatus = enum { active, paused, blocked, complete };
/// A structured standing objective: the /goal text plus its lifecycle status and
/// created/updated timestamps. Replaces the bare `?[]const u8` so /goal can
@@ -165,11 +165,11 @@ pub const Agent = struct {
pending_goal_note: ?[]const u8 = null, // one-shot supersession note for the next turn (/goal replace|clear)
startup_effort_notice: ?[]const u8 = null, // ACP presents a corrected stale effort setting after session/new
completion_gate_armed: bool = false, // attempt_completion was refused; the promised second call closes the goal. Persists ACROSS turns (a model emits one per turn) until the checklist or goal changes (#318)
- completion_refused: bool = false, // a refused attempt_completion this turn: work the model must react to, so /loop must not read the turn as zero-tool (#318)
+ completion_refused: bool = false, // a refused attempt_completion this turn: work the model must react to, so the run must not read the turn as zero-tool (#318)
todos_dirty: bool = false, // todo_write ran in THIS process: a checklist restored from disk is persisted state, never evidence that the current prompt is done (#318)
goal_flag: ?[]const u8 = null, // --goal objective verbatim: re-applied over EVERY loadSession, including /resume, so the flag's contract survives restores (#318)
- loop_deadline_ms: ?i64 = null, // the running /loop's wall-clock deadline (goal_pacing.LoopClock); read by the subagent spawn path so a child inherits it. Run-local: never saved, cleared on stop/steer
- history_rewrites: u32 = 0, // bumped by compact()/emergencyTrim; state pasted into the dead history (e.g. the /loop checklist copy) must be re-carried (#318)
+ loop_deadline_ms: ?i64 = null, // the running /goal run's wall-clock deadline (goal_pacing.LoopClock); read by the subagent spawn path so a child inherits it. Run-local: never saved, cleared on stop/steer
+ history_rewrites: u32 = 0, // bumped by compact()/emergencyTrim; state pasted into the dead history (e.g. the run's checklist copy) must be re-carried (#318)
worker_family: ?[]const u8 = null,
worker_id: ?[]const u8 = null,
session_name: []const u8 = "last", // autosave/resume target (<name>.session.json)
diff --git a/src/agent_compact.zig b/src/agent_compact.zig
index da4590ce..bf855efb 100644
--- a/src/agent_compact.zig
+++ b/src/agent_compact.zig
@@ -236,7 +236,7 @@ pub fn compact(self: *Agent) anyerror!usize {
self.last_context_tokens = 0;
self.context_local_tokens = 0;
self.goal_note_fp = 0; // the injected goal note died with the old history - re-state in full (#318)
- self.history_rewrites +%= 1; // readers of pasted state (the /loop checklist gate) re-carry it (#318)
+ self.history_rewrites +%= 1; // readers of pasted state (the run's checklist gate) re-carry it (#318)
installed_summary = true;
acp_run.finish(.completed, summary, null);
// #445: the history the model was reading is gone and the durable file is
@@ -479,7 +479,7 @@ pub fn emergencyTrim(self: *Agent) usize {
for (self.messages.items[cut..]) |m| fresh.append(m) catch return 0;
self.messages = fresh;
self.goal_note_fp = 0; // trimmed history may have carried the goal note (#318)
- self.history_rewrites +%= 1; // and the /loop checklist gate's pasted copies (#318)
+ self.history_rewrites +%= 1; // and the run's checklist gate's pasted copies (#318)
// No synthetic message exists here to hang the standing state on (unlike
// compact()'s handoff), so it rides the next turn's one-shot slot. Only
// when that slot is free: a queued /goal replace|clear note is the USER's
@@ -494,7 +494,7 @@ pub fn emergencyTrim(self: *Agent) usize {
// session — reclaim context by truncating the oldest tool outputs in place,
// keeping every call/output pair valid. Nonzero = recovered. This too is a
// rewrite: the stubbed outputs may include the last todo_write render the
- // suppressed /loop note points the model at (#318).
+ // suppressed run note points the model at (#318).
if (trimOldestToolOutputs(self) > 0) {
self.history_rewrites +%= 1;
if (self.pending_goal_note == null)
diff --git a/src/agent_tools.zig b/src/agent_tools.zig
index 6d67d32c..367be9c5 100644
--- a/src/agent_tools.zig
+++ b/src/agent_tools.zig
@@ -310,7 +310,7 @@ pub fn handleMeta(self: *Agent, call: ToolCall) !ExecResult {
"completion blocked: the latest verifier contradicted the plan; repair the failure and run eval until it meets the target"
else
"completion blocked: workspace state is not verified; run eval and meet the target after the final change";
- self.completion_refused = true; // blocked, not silence: attempt_completion skips the tool counter, and /loop must give the model a turn to run eval (#318)
+ self.completion_refused = true; // blocked, not silence: attempt_completion skips the tool counter, and the run must give the model a turn to run eval (#318)
return .{ .text = message, .is_error = true };
}
if (try goal_verify.completionGate(self.arena, self)) |refusal| {
diff --git a/src/command_catalog.zig b/src/command_catalog.zig
index ed0bdbf8..08b2e49d 100644
--- a/src/command_catalog.zig
+++ b/src/command_catalog.zig
@@ -66,9 +66,8 @@ pub const commands = [_]Item{
.{ .name = "/new", .desc = "start a fresh autosaved session" },
.{ .name = "/rename", .usage = "/rename <title>", .desc = "set the current session title" },
.{ .name = "/goal", .usage = "/goal [30m] [text|pause|resume|status|clear]", .desc = "set a standing objective and work it autonomously; an optional 30s/30m/2h budget paces the run; pause/resume steering, status shows state, clear removes it" },
- .{ .name = "/loop", .usage = "/loop [30m] <prompt>", .desc = "the same autonomous run as /goal, without adopting a standing objective" },
.{ .name = "/goals", .desc = "show the current goal without changing it (alias for /goal status)" },
- .{ .name = "/schedule", .usage = "/schedule <30s|5m|2h> <prompt>", .desc = "fire a prompt later; delay tokens match /loop (not a standing goal)" },
+ .{ .name = "/schedule", .usage = "/schedule <30s|5m|2h> <prompt>", .desc = "fire a prompt later after a 30s/5m/2h delay (not a standing goal)" },
.{ .name = "/adapter", .usage = "/adapter send <text>|inbox", .desc = "channel-worker outbox / inbox (JSONL protocol; Discord/Slack fronts later)" },
.{ .name = "/review", .usage = "/review <target or instructions>", .desc = "run one isolated read-only review pass; no edits, delegation, or workflows" },
.{ .name = "/never", .usage = "/never [<text>|rm <id-or-text>]", .desc = "standing constraints that ride every brief; bare opens a searchable picker (TTY) or lists them, rm <id-or-text> retires one (alias /constraint)" },
diff --git a/src/commands_session.zig b/src/commands_session.zig
index 170b4302..a2487177 100644
--- a/src/commands_session.zig
+++ b/src/commands_session.zig
@@ -1,5 +1,5 @@
//! Session/environment slash commands, split out of main.zig's handleCommand
-//! (600-line goal, issue #123): /clear /new /rename /goal /loop /bash /agents
+//! (600-line goal, issue #123): /clear /new /rename /goal /bash /agents
//! /animation /theme /hooks /skills /plan (/trajectory lives in commands_trajectory.zig), plus #554's /snapshot
//! and the snapshot half of /rewind (dispatched to commands_sandbox.zig).
@@ -68,7 +68,7 @@ const setTerminalTitle = title_mod.setTerminalTitle;
pub fn resetConversationSteering(root: *Agent) void {
root.goal = null;
root.completion_gate_armed = false; // a dropped goal re-arms the completion double-check (#318)
- root.todos_dirty = false; // the conversation's checklist dies with it; nothing survives as /loop evidence (#318)
+ root.todos_dirty = false; // the conversation's checklist dies with it; nothing survives as run evidence (#318)
root.ultracode_mode = false;
root.pending_goal_note = null; // a queued supersession note dies with the conversation (#318)
root.goal_note_fp = 0;
@@ -235,10 +235,10 @@ pub fn tryHandle(root: *Agent, keys: *Keys, arena: Allocator, line: []const u8,
try out.flush();
return true;
}
- if (std.mem.eql(u8, line, "/loop")) {
- // "stops it when the time is up" overpromised: the deadline is checked
- // between turns, so a long turn runs to completion past it.
- try out.writeAll("usage: /loop [30m] <prompt> — run an autonomous plan→act→verify pass. A leading 30s/30m/2h paces the run and stops it at the first turn boundary after the time is up.\n");
+ if (std.mem.eql(u8, line, "/loop") or std.mem.startsWith(u8, line, "/loop ")) {
+ // Retired (ADR 0216): a run continues when its background work
+ // reports, and /goal is the autonomous run.
+ try out.writeAll("/loop was removed. Ask directly: a run continues when its background work reports. For autonomous work toward an objective, use /goal [30m] <objective>.\n");
try out.flush();
return true;
}
diff --git a/src/goal_flow.zig b/src/goal_flow.zig
index dec95915..895909cf 100644
--- a/src/goal_flow.zig
+++ b/src/goal_flow.zig
@@ -166,15 +166,15 @@ pub fn applyGoalSet(root: *Agent, objective: []const u8, now_ms: i64) GoalSetRes
return .{ .superseded = superseded, .parked_open = parked_open };
}
-/// The /loop controller's per-turn decision, assembled from root state. Split
+/// The autonomous run controller's per-turn decision, assembled from root state. Split
/// out of mainloop (#318) so the composition itself is testable: which turns
/// count as work, which count as silence, and which goal status is read.
/// work_done is the only evidence that may complete the goal and the only
/// thing that earns `accepted` - a checklist restored from disk is not it
/// (checklistFinished gates on this-process freshness). A zero-tool turn ends
-/// the LOOP as `idle` (codex RegularTask semantics: no /loop burns 25
+/// the LOOP as `idle` (codex RegularTask semantics: no run burns 25
/// continuations on a one-turn prompt), but a REFUSED attempt_completion is
-/// work, not silence. A session with no goal reads as .active, so a bare /loop
+/// work, not silence. A session with no goal reads as .active, so a goal-less run
/// is governed by its work and its iteration bound alone.
pub fn loopTurnDecision(root: *Agent, iters_left: u32, now_ms: i64) repl_glue.ContinuationDecision {
if (@import("subagent_interactive.zig").enabled.load(.acquire) and @import("subagent_interactive.zig").yielded) return .{ .stop = .idle };
@@ -195,12 +195,12 @@ pub fn loopTurnDecision(root: *Agent, iters_left: u32, now_ms: i64) repl_glue.Co
return d;
}
-/// The steering appended to each autonomous /loop continuation turn (the
+/// The steering appended to each autonomous run's continuation turn (the
/// continuation_steering_item analog): keep working the checklist, verify, and
/// stop only when done or blocked - not a per-turn user note. Moved here from
/// repl_glue.zig, which is at the 600-line cap.
/// `paste_list` is the diff-gate's verdict (goal_state.steeringGate over the
-/// render). It used to be unconditional, so a 25-iteration /loop wrote up to 25
+/// render). It used to be unconditional, so a 25-iteration run wrote up to 25
/// near-identical checklist copies into root.messages - autosaved, and fed
/// verbatim into the next compaction's summary input. That is the exact
/// re-pasting this branch removed from the goal note, left behind in its one
@@ -210,13 +210,13 @@ pub fn loopTurnDecision(root: *Agent, iters_left: u32, now_ms: i64) repl_glue.Co
/// copies died with the old history.
pub fn continuationSteeringNote(arena: Allocator, todos_render: []const u8, paste_list: bool) ![]const u8 {
if (todos_render.len == 0)
- return "[continuing autonomously (/loop): make the next concrete step toward the goal, then verify it. Do not ask for confirmation between routine steps. Stop only when the work is complete or you hit a blocker that needs the user.]";
+ return "[continuing autonomously: make the next concrete step toward the goal, then verify it. Do not ask for confirmation between routine steps. Stop only when the work is complete or you hit a blocker that needs the user.]";
if (!paste_list)
- return "[continuing autonomously (/loop): keep working the current checklist (unchanged, see your latest todo_write result, or call todo_read) - do the next incomplete item, mark it in_progress then completed, and verify. Do not ask for confirmation between routine steps. Stop only when every item is done or you are blocked.]";
- return std.fmt.allocPrint(arena, "[continuing autonomously (/loop): keep working the checklist below — do the next incomplete item, mark it in_progress then completed, and verify. Do not ask for confirmation between routine steps. Stop only when every item is done or you are blocked.\n\nChecklist so far:\n{s}]", .{todos_render});
+ return "[continuing autonomously: keep working the current checklist (unchanged, see your latest todo_write result, or call todo_read) - do the next incomplete item, mark it in_progress then completed, and verify. Do not ask for confirmation between routine steps. Stop only when every item is done or you are blocked.]";
+ return std.fmt.allocPrint(arena, "[continuing autonomously: keep working the checklist below — do the next incomplete item, mark it in_progress then completed, and verify. Do not ask for confirmation between routine steps. Stop only when every item is done or you are blocked.\n\nChecklist so far:\n{s}]", .{todos_render});
}
-/// Loop-LOCAL diff-gate state for the checklist copy in the /loop continuation
+/// Run-LOCAL diff-gate state for the checklist copy in the run's continuation
/// prompt (#318). Deliberately not an Agent field and never persisted: it
/// describes what THIS run has already handed the model, so a fresh run, a
/// user steer, a stop and a compaction all reset it.
@@ -248,7 +248,7 @@ pub const LoopListGate = struct {
}
};
-/// The goal-side effect of a /loop run that stopped as `accepted`: the loop
+/// The goal-side effect of a run that stopped as `accepted`: the run
/// drove the objective to done, so it retires. Returns true when it flipped.
/// A standing --goal is the user's policy for the whole session and outlives
/// any single completion (#318); a paused or already-complete goal is not the
@@ -294,7 +294,7 @@ test "a --goal standing objective outlives the model's own completion (#318)" {
// The completion CLAIM is double-checked exactly like a /goal objective:
// an unearned "done" is worst in the flag's own headless sessions, where it
- // ended a /loop as accepted with open work. Only RETIREMENT is exempt.
+ // ended a run as accepted with open work. Only RETIREMENT is exempt.
const r1 = try goal_state.completionGate(ar, &root);
try std.testing.expect(r1 != null and std.mem.indexOf(u8, r1.?, "no checklist") != null);
try std.testing.expect(std.mem.indexOf(u8, r1.?, "keeps steering") != null); // the refusal never promises a close
@@ -365,9 +365,9 @@ test "--goal seeded onto a resumed session lands above every restored epoch (#31
try std.testing.expectEqual(@as(usize, 2), root.todos.items.len); // and nothing was deleted
}
-test "a leftover complete goal cannot end a fresh /loop at iteration 1 (#318)" {
+test "a leftover complete goal cannot end a fresh run at iteration 1 (#318)" {
// After a resume reconciliation - or any earlier run that retired the goal -
- // root.goal is .complete while a NEW /loop starts. The controller read the
+ // root.goal is .complete while a NEW run starts. The controller read the
// status before the work and stopped at its first decision as `accepted`, so
// a run that had done nothing reported success.
const zero_tools = repl_glue.turnStopped(0, false);
@@ -402,7 +402,7 @@ test "a cleared goal's finished checklist cannot be reborn as the next goal's li
// /goal B. nextEpoch used to read the live goal only, so this was epoch 1
// again and B inherited A's finished list: born done, the first
- // attempt_completion accepted with zero work, and a /loop under B stopped
+ // attempt_completion accepted with zero work, and a run under B stopped
// at iteration 1 as `accepted` while flipping B to complete.
const epoch_b = goal_state.nextEpoch(root.goal, root.todos.items);
try std.testing.expectEqual(@as(u64, 2), epoch_b);
@@ -411,7 +411,7 @@ test "a cleared goal's finished checklist cannot be reborn as the next goal's li
try std.testing.expect(!goal_state.hasCurrent(root.todos.items, epoch_b)); // B starts with no plan
const refusal = try goal_state.completionGate(ar, &root);
try std.testing.expect(refusal != null and std.mem.indexOf(u8, refusal.?, "no checklist") != null);
- try std.testing.expect(!goal_state.checklistFinished(&root)); // and no all-done list for /loop to read
+ try std.testing.expect(!goal_state.checklistFinished(&root)); // and no all-done list for the run to read
// A's work is retained and parked, exactly where it was left.
try std.testing.expectEqual(@as(usize, 1), root.todos.items.len);
try std.testing.expectEqual(@as(u64, 1), root.todos.items[0].epoch);
@@ -500,7 +500,7 @@ test "LoopListGate pastes the checklist once per change, not once per turn (#318
var gate: LoopListGate = .{};
// Turn 1 of a run carries the list; the next turns do not, so a 25-turn
- // /loop no longer writes 25 near-identical copies into root.messages (all
+ // run no longer writes 25 near-identical copies into root.messages (all
// autosaved, and all fed verbatim into the next compaction's summary).
try std.testing.expect(std.mem.indexOf(u8, try gate.note(ar, &root), "[ ] a") != null);
var i: usize = 0;
diff --git a/src/goal_pacing.zig b/src/goal_pacing.zig
index db4dfcc9..a17509cf 100644
--- a/src/goal_pacing.zig
+++ b/src/goal_pacing.zig
@@ -1,9 +1,10 @@
-//! Time-aware /loop pacing: the optional duration prefix on `/loop`, the run
-//! clock it arms, and the pacing line every continuation turn carries.
+//! Time-aware pacing for an autonomous /goal run: the optional duration prefix
+//! on `/goal`, the run clock it arms, and the pacing line every continuation
+//! turn carries.
//!
//! Everything the model reads here is INFORMATION, never enforcement. This
//! repo dropped goal budget enforcement on purpose (#224), and that stands: a
-//! deadline's only hard effect is that the /loop controller stops the run with
+//! deadline's only hard effect is that the run's controller stops it with
//! the `expired` outcome. The rest is guidance, on the prior art's reasoning -
//! codex renders tokens_used/token_budget/remaining_tokens into its
//! continuation prompt on every turn, and LemonHarness feeds wall-clock phases
@@ -21,7 +22,7 @@ const Io = std.Io;
const repl_glue = @import("repl_glue.zig");
const Agent = @import("agent.zig").Agent;
-/// A parsed `/loop` argument: an optional wall-clock budget and the prompt.
+/// A parsed duration prefix: an optional wall-clock budget and the prompt.
pub const LoopBudget = struct {
/// Milliseconds from now until the run's deadline, or null for no deadline.
deadline_ms_delta: ?i64 = null,
@@ -29,11 +30,11 @@ pub const LoopBudget = struct {
prompt: []const u8,
};
-/// Parse the text after `/loop`. A leading `<integer><s|m|h>` followed by
-/// whitespace and a nonempty prompt is a budget; ANYTHING else is not, and the
-/// whole text is the prompt. That fallback is the important half: `/loop 30m`
-/// on its own is someone asking the model about thirty minutes, not an empty
-/// run, and `/loop 30mins of cleanup` is a sentence. Rejecting silently costs
+/// Parse an objective's optional duration prefix. A leading `<integer><s|m|h>`
+/// followed by whitespace and a nonempty prompt is a budget; ANYTHING else is
+/// not, and the whole text is the prompt. That fallback is the important half:
+/// `/goal 30m` on its own is an objective about thirty minutes, not an empty
+/// run, and `/goal 30mins of cleanup` is a sentence. Rejecting silently costs
/// nothing (the run just has no deadline); guessing wrong would either eat the
/// user's prompt or start a run they never asked to be timed.
pub fn parseLoopBudget(text: []const u8) LoopBudget {
@@ -56,7 +57,7 @@ pub fn parseLoopBudget(text: []const u8) LoopBudget {
const n = std.fmt.parseInt(i64, trimmed[0..digits], 10) catch return none;
if (n <= 0) return none; // "0m" is not a deadline that already passed, it is a typo
const delta = std.math.mul(i64, n, unit) catch return none;
- // Clamped, not rejected: "/loop 9999h soak" is a real (if odd) instruction,
+ // Clamped, not rejected: "/goal 9999h soak" is a real (if odd) instruction,
// and an unclamped delta overflowed pacingNote's percent math (round-4
// verifier: a typed line panicked Debug builds and mis-phased ReleaseFast).
return .{ .deadline_ms_delta = @min(delta, max_budget_ms), .prompt = prompt };
@@ -65,13 +66,6 @@ pub fn parseLoopBudget(text: []const u8) LoopBudget {
/// A week: past it nothing about a run is meaningful, and the percent math stays in i64.
pub const max_budget_ms: i64 = 7 * 24 * std.time.ms_per_hour;
-/// The same parse straight off an input line, so the caller stays one line.
-/// Returns null when the line is not a `/loop` invocation at all.
-pub fn loopBudgetFromLine(line: []const u8) ?LoopBudget {
- if (!std.mem.startsWith(u8, line, "/loop ")) return null;
- return parseLoopBudget(line["/loop".len..]);
-}
-
/// A slash command typed into `-p` reaches the MODEL as prose: that path runs
/// one turn and never sees mainloop's command parse, so `graff -p "/goal 30m
/// ..."` adopted no goal, armed no clock, and then accepted an
@@ -83,14 +77,12 @@ pub fn oneshotSlashRefusal(prompt_text: []const u8) ?[]const u8 {
if (!repl_glue.isSlashCommandLine(line)) return null;
if (std.mem.startsWith(u8, line, "/goal"))
return "slash commands are interactive only: -p runs a single turn and never reaches the command parser, so this would have been sent to the model as text. Use `graff --goal \"<objective>\" -p \"<prompt>\"` to steer a headless run.";
- if (std.mem.startsWith(u8, line, "/loop"))
- return "slash commands are interactive only: -p runs a single turn, so there is no loop to continue. Run /loop in an interactive session, or give -p the work directly as a prompt.";
return "slash commands are interactive only: -p runs a single turn and never reaches the command parser, so this would have been sent to the model as text.";
}
test "oneshotSlashRefusal: commands are refused, prompts and paths are not" {
try std.testing.expect(oneshotSlashRefusal("/goal 30m ship it") != null);
- try std.testing.expect(oneshotSlashRefusal("/loop keep going") != null);
+ try std.testing.expect(oneshotSlashRefusal("/review the diff") != null);
try std.testing.expect(oneshotSlashRefusal(" /model ") != null);
// Real prompts, including one opening with an absolute path.
try std.testing.expect(oneshotSlashRefusal("fix the retry path") == null);
@@ -99,19 +91,17 @@ test "oneshotSlashRefusal: commands are refused, prompts and paths are not" {
try std.testing.expect(std.mem.indexOf(u8, oneshotSlashRefusal("/goal ship").?, "--goal") != null);
}
-/// One autonomous run, however it was asked for. `/goal <objective>` and
-/// `/loop <prompt>` are the same machine: plan, act, verify, and let the
-/// controller decide whether another turn is authorized. They differ in one
-/// bit - whether the objective becomes STANDING - so they stopped being two
-/// commands and became one with a flag. Both take the same optional duration
-/// prefix (`/goal 30m ship it`).
+/// One autonomous run. `/goal <objective>` adopts the objective and runs it on
+/// the plan-act-verify machine, where the controller decides whether another
+/// turn is authorized. It takes an optional duration prefix
+/// (`/goal 30m ship it`).
pub const Autonomous = struct {
/// The text the turn actually runs on, duration prefix removed.
prompt: []const u8,
deadline_ms_delta: ?i64 = null,
/// The `/goal ...` command to apply before the first turn (duration
- /// stripped, so the objective never records "30m"). Null for `/loop`,
- /// which runs autonomously without adopting a standing objective.
+ /// stripped, so the objective never records "30m"). Null for a
+ /// continuation turn, which stays in the run it continues.
goal_line: ?[]const u8 = null,
/// The wall-clock half, for arming the run.
@@ -123,26 +113,25 @@ pub const Autonomous = struct {
/// Parse an autonomous invocation off an input line. `/goal` with a lifecycle
/// word (pause/resume/status/clear) or bare is NOT one - those stay commands,
/// which is why the objective parse still lives in repl_glue.goalPromptFromLine
-/// and is passed in here as `goal_objective`.
-pub fn autonomousFromLine(arena: Allocator, line: []const u8, goal_objective: ?[]const u8) !?Autonomous {
- if (goal_objective) |obj| {
- const b = parseLoopBudget(obj);
- return .{
- .prompt = b.prompt,
- .deadline_ms_delta = b.deadline_ms_delta,
- // Rebuild the command only when a duration was stripped, so the
- // common path stays allocation-free and byte-identical.
- .goal_line = if (b.deadline_ms_delta == null)
- line
- else
- try std.fmt.allocPrint(arena, "/goal {s}", .{b.prompt}),
- };
- }
- const b = loopBudgetFromLine(line) orelse return null;
- return .{ .prompt = b.prompt, .deadline_ms_delta = b.deadline_ms_delta };
+/// and is passed in here as `goal_objective`. A queued continuation turn stays
+/// in the run it continues: no new objective, and no new clock.
+pub fn autonomousFromLine(arena: Allocator, line: []const u8, goal_objective: ?[]const u8, continuation: bool) !?Autonomous {
+ if (continuation) return .{ .prompt = line };
+ const obj = goal_objective orelse return null;
+ const b = parseLoopBudget(obj);
+ return .{
+ .prompt = b.prompt,
+ .deadline_ms_delta = b.deadline_ms_delta,
+ // Rebuild the command only when a duration was stripped, so the
+ // common path stays allocation-free and byte-identical.
+ .goal_line = if (b.deadline_ms_delta == null)
+ line
+ else
+ try std.fmt.allocPrint(arena, "/goal {s}", .{b.prompt}),
+ };
}
-/// The wall clock of ONE /loop run: when it started and when it must stop.
+/// The wall clock of ONE autonomous run: when it started and when it must stop.
/// Run-local like LoopListGate and never persisted - a fresh run, a user steer
/// and a stop all reset it. The deadline is mirrored onto the Agent so a
/// subagent spawned mid-run can inherit it (goal_pacing.childTaskPrompt).
@@ -168,7 +157,7 @@ pub const LoopClock = struct {
}
};
-/// What every freshly-typed input line does to the run clock. A `/loop ...`
+/// What every freshly-typed input line does to the run clock. A `/goal ...`
/// line starts a run: its clock begins now (not after the first turn, so a
/// "30m" the user typed really is 30 minutes of theirs) and the previous run's
/// completion evidence is dropped - a checklist finished BEFORE this prompt is
@@ -183,12 +172,12 @@ pub fn armFreshRun(clock: *LoopClock, root: *Agent, now_ms: i64, budget: ?LoopBu
}
/// armFreshRun plus one line of feedback the instant a wall clock arms. Silent
-/// arming hid misparses: `/loop 5m ...` quietly took the "5m" out of the prompt
+/// arming hid misparses: `/goal 5m ...` quietly took the "5m" out of the prompt
/// AND started a deadline whose only trace was an `expired` stop minutes later.
pub fn armAndAnnounce(clock: *LoopClock, root: *Agent, out: *Io.Writer, arena: Allocator, now_ms: i64, budget: ?LoopBudget) !void {
armFreshRun(clock, root, now_ms, budget);
const d = (budget orelse return).deadline_ms_delta orelse return;
- try out.print("\xe2\x8f\xb1 /loop budget: {s}\n", .{try fmtDur(arena, d)});
+ try out.print("\xe2\x8f\xb1 run budget: {s}\n", .{try fmtDur(arena, d)});
try out.flush();
}
@@ -211,7 +200,7 @@ fn phaseHint(pct_left: i64) []const u8 {
return "Wrap up now: preserve what works, start nothing new, and report the exact state.";
}
-/// The pacing line appended to each /loop continuation turn. The iteration
+/// The pacing line appended to each continuation turn. The iteration
/// count is unconditional - a model that cannot see how many continuations it
/// has left cannot decide whether to open a new thread of work - and a run with
/// a wall-clock budget also gets the remaining time and one phase hint.
@@ -244,7 +233,7 @@ pub fn childBudgetMs(deadline_ms: i64, now_ms: i64) i64 {
return left - @max(integration_margin_floor_ms, @divTrunc(left, 10));
}
-/// A child's task prompt, prefixed with the parent's time budget when a /loop
+/// A child's task prompt, prefixed with the parent's time budget when a run
/// deadline is live. Returns `prompt` untouched when there is none, so an
/// ordinary session's subagents are byte-identical to before. Guidance only:
/// subagents get no watchdog in this round, because a killed child returns
@@ -288,9 +277,6 @@ test "parseLoopBudget: every ambiguous shape stays a prompt, verbatim" {
// An absurd-but-parseable duration clamps to the week cap instead of
// feeding pacingNote a deadline whose percent math overflows i64.
try std.testing.expectEqual(@as(?i64, max_budget_ms), parseLoopBudget("30000000000h go").deadline_ms_delta);
- // And the whole thing only fires on a real /loop line.
- try std.testing.expect(loopBudgetFromLine("/goal 30m ship") == null);
- try std.testing.expectEqual(@as(?i64, 5 * std.time.ms_per_min), loopBudgetFromLine("/loop 5m ship").?.deadline_ms_delta);
}
/// The two Agent fields this file's helpers touch, initialized; everything
@@ -324,7 +310,7 @@ test "childTaskPrompt: the same absolute deadline reaches every child, minus a m
const ar = arena_state.allocator();
const prompt = "audit the retry path";
- // No /loop deadline: the child's prompt is untouched, byte for byte.
+ // No run deadline: the child's prompt is untouched, byte for byte.
try std.testing.expectEqualStrings(prompt, try childTaskPrompt(ar, prompt, null, 0));
// 60 minutes left -> 6 minutes of margin -> 54 for the child. Three
@@ -352,25 +338,25 @@ test "childTaskPrompt: the same absolute deadline reaches every child, minus a m
}
}
-test "armFreshRun: a /loop line starts the clock, any other line ends it" {
+test "armFreshRun: a /goal line starts the clock, any other line ends it" {
var root = pacingRoot();
root.todos_dirty = true; // left over from the previous run
var clock: LoopClock = .{};
- armFreshRun(&clock, &root, 5_000, loopBudgetFromLine("/loop 30m fix the flaky test"));
+ armFreshRun(&clock, &root, 5_000, parseLoopBudget("30m fix the flaky test"));
try std.testing.expectEqual(@as(i64, 5_000), clock.started_ms); // the user's 30m starts when they typed it
try std.testing.expectEqual(@as(?i64, 5_000 + 30 * std.time.ms_per_min), root.loop_deadline_ms);
try std.testing.expect(!root.todos_dirty);
- // A /loop with no duration still starts a run, just an untimed one.
- armFreshRun(&clock, &root, 9_000, loopBudgetFromLine("/loop keep going"));
+ // A /goal with no duration still starts a run, just an untimed one.
+ armFreshRun(&clock, &root, 9_000, parseLoopBudget("keep going"));
try std.testing.expectEqual(@as(i64, 9_000), clock.started_ms);
try std.testing.expect(root.loop_deadline_ms == null);
// Any other typed line means no run is in flight. Without this a turn that
// errored out mid-run left a deadline armed, and every later subagent - of
// any turn, forever - was told to hurry for a run that ended long ago.
- armFreshRun(&clock, &root, 12_000, loopBudgetFromLine("/loop 5m ship"));
+ armFreshRun(&clock, &root, 12_000, parseLoopBudget("5m ship"));
try std.testing.expect(root.loop_deadline_ms != null);
armFreshRun(&clock, &root, 13_000, null);
try std.testing.expect(root.loop_deadline_ms == null and clock.deadline_ms == null and clock.started_ms == 0);
diff --git a/src/goal_pacing_autonomous_test.zig b/src/goal_pacing_autonomous_test.zig
index 3b168d14..615293c0 100644
--- a/src/goal_pacing_autonomous_test.zig
+++ b/src/goal_pacing_autonomous_test.zig
@@ -1,7 +1,8 @@
-//! `/goal` and `/loop` are one autonomous run (goal_pacing.autonomousFromLine).
+//! `/goal` is the one autonomous run (goal_pacing.autonomousFromLine).
//! These pin the seam mainloop depends on: which lines start a run, which stay
-//! commands, where the duration goes, and what the /goal command line becomes
-//! once a duration has been stripped out of it.
+//! commands, where the duration goes, what the /goal command line becomes
+//! once a duration has been stripped out of it, and how a continuation turn
+//! stays in its run.
//!
//! Kept out of goal_pacing.zig (line cap) and reached through the `test { _ =
//! ... }` hook in main.zig - without that line these silently never run.
@@ -10,13 +11,13 @@ const std = @import("std");
const goal_pacing = @import("goal_pacing.zig");
const repl_glue = @import("repl_glue.zig");
-/// mainloop's exact call shape: the objective parse decides command-vs-run,
-/// then autonomousFromLine turns whichever it was into one run descriptor.
+/// mainloop's exact call shape for a typed line: the objective parse decides
+/// command-vs-run, then autonomousFromLine turns a run into one descriptor.
fn parse(arena: std.mem.Allocator, line: []const u8) !?goal_pacing.Autonomous {
- return goal_pacing.autonomousFromLine(arena, line, repl_glue.goalPromptFromLine(line));
+ return goal_pacing.autonomousFromLine(arena, line, repl_glue.goalPromptFromLine(line), false);
}
-test "/goal and /loop produce the same run; only /goal adopts the objective" {
+test "/goal is the one autonomous run; /loop no longer starts one" {
var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena_state.deinit();
const ar = arena_state.allocator();
@@ -26,12 +27,12 @@ test "/goal and /loop produce the same run; only /goal adopts the objective" {
try std.testing.expect(g.deadline_ms_delta == null);
try std.testing.expectEqualStrings("/goal ship phase 2", g.goal_line.?); // the command runs first
- const l = (try parse(ar, "/loop ship phase 2")).?;
- try std.testing.expectEqualStrings("ship phase 2", l.prompt); // same prompt, same machine
- try std.testing.expect(l.goal_line == null); // but no standing objective is adopted
+ // /loop was removed (ADR 0216): its line is a retired command, not a run.
+ try std.testing.expect((try parse(ar, "/loop ship phase 2")) == null);
+ try std.testing.expect((try parse(ar, "/loop 45s ship it")) == null);
}
-test "a duration prefix works on both, and never lands in the objective" {
+test "a duration prefix never lands in the objective" {
var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena_state.deinit();
const ar = arena_state.allocator();
@@ -43,10 +44,6 @@ test "a duration prefix works on both, and never lands in the objective" {
// part of what the user is trying to achieve.
try std.testing.expectEqualStrings("/goal fix the flaky test", g.goal_line.?);
try std.testing.expectEqualStrings("fix the flaky test", repl_glue.goalPromptFromLine(g.goal_line.?).?);
-
- const l = (try parse(ar, "/loop 45s ship it")).?;
- try std.testing.expectEqual(@as(?i64, 45 * std.time.ms_per_s), l.deadline_ms_delta);
- try std.testing.expectEqualStrings("ship it", l.prompt);
}
test "lifecycle words and bare invocations stay commands, not runs" {
@@ -64,16 +61,19 @@ test "lifecycle words and bare invocations stay commands, not runs" {
try std.testing.expect((try parse(ar, line)) == null);
}
-test "a /loop continuation line re-parses as a plain run, never as a budget" {
+test "a continuation turn stays in its run: no objective and no new clock" {
var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena_state.deinit();
const ar = arena_state.allocator();
// What mainloop synthesizes for continuation turns: the steering note, then
// the pacing line. It must stay one run with no NEW deadline (the clock was
// armed by the original line and is not re-armed on continuations).
- const line = "/loop [continuing autonomously (/loop): keep working the checklist]\n[pace: continuation 2 of 25, 1m elapsed.]";
- const a = (try parse(ar, line)).?;
+ const line = "[continuing autonomously: keep working the checklist]\n[pace: continuation 2 of 25, 1m elapsed.]";
+ const a = (try goal_pacing.autonomousFromLine(ar, line, null, true)).?;
try std.testing.expect(a.deadline_ms_delta == null);
try std.testing.expect(a.goal_line == null);
- try std.testing.expect(std.mem.startsWith(u8, a.prompt, "[continuing autonomously"));
+ try std.testing.expectEqualStrings(line, a.prompt);
+ // A wake that happens to open like a duration is still not a budget.
+ const wake = (try goal_pacing.autonomousFromLine(ar, "5m build finished\n\n[continuing autonomously: next step]", null, true)).?;
+ try std.testing.expect(wake.deadline_ms_delta == null);
}
diff --git a/src/goal_persist_tests.zig b/src/goal_persist_tests.zig
index 42afcaae..0b3aba5d 100644
--- a/src/goal_persist_tests.zig
+++ b/src/goal_persist_tests.zig
@@ -66,7 +66,7 @@ fn resumeSession(arena: Allocator, root: *Agent, json: []const u8) !void {
/// A root agent in the state loadSession hands back: no live turn behind it.
/// The turn-scoped fields matter too - goal_flow.loopTurnDecision reads them
-/// to decide whether a /loop continues, and "restored, no work yet" is exactly
+/// to decide whether a run continues, and "restored, no work yet" is exactly
/// the state #318's never-completing loop started from.
fn blankRoot(arena: Allocator) Agent {
var root: Agent = undefined;
@@ -108,7 +108,7 @@ test "resume: an active goal whose checklist is already finished retires (#318)"
// finished epoch-2 list both survive the round trip (#318 D-PARK).
try std.testing.expectEqual(@as(usize, 3), root.todos.items.len);
try std.testing.expectEqual(@as(usize, 1), goal_state.parkedOpenCount(root.todos.items, 2));
- // The retired goal is not fresh completion evidence either: the first /loop
+ // The retired goal is not fresh completion evidence either: the first run
// turn of the resumed session must still do real work to stop as accepted.
try std.testing.expect(!goal_state.checklistFinished(&root));
}
@@ -129,7 +129,7 @@ test "resume: open items keep the goal active and the checklist current (#318)"
try std.testing.expectEqualStrings("[x] fix the tests\n[ ] verify in the browser", goal_state.renderCurrent(&root));
try std.testing.expect(!goal_state.checklistFinished(&root));
// Finishing the restored list only counts once todo_write has run in THIS
- // process - the /loop allDone arm stays inert until then.
+ // process - the run's allDone arm stays inert until then.
root.todos.items[1].status = "completed";
try std.testing.expect(goal_state.allDone(root.todos.items, 2));
try std.testing.expect(!goal_state.checklistFinished(&root));
@@ -137,13 +137,13 @@ test "resume: open items keep the goal active and the checklist current (#318)"
try std.testing.expect(goal_state.checklistFinished(&root));
}
-test "resume: a finished epoch-0 leftover cannot end a bare /loop (#318)" {
+test "resume: a finished epoch-0 leftover cannot end a goal-less run (#318)" {
var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena_state.deinit();
const ar = arena_state.allocator();
var root = blankRoot(ar);
// No goal at all, and a checklist the previous session finished. Before the
- // freshness flag this made /loop stop at iteration 1 as `accepted` without
+ // freshness flag this made a run stop at iteration 1 as `accepted` without
// the model doing anything.
try resumeSession(ar, &root,
\\{"goal":null,
@@ -338,14 +338,14 @@ test "the first /goal adopts the in-flight unscoped plan, minus finished work (#
try std.testing.expect(refusal != null and std.mem.indexOf(u8, refusal.?, "1 open") != null);
}
-test "/loop: a restored all-[x] list is idle, not accepted (#318)" {
+test "goal run: a restored all-[x] list is idle, not accepted (#318)" {
var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena_state.deinit();
const ar = arena_state.allocator();
var root = blankRoot(ar);
// A standing --goal survives the resume with its finished checklist intact
// (reconcileRestored leaves it alone), so this is the exact state a fresh
- // /loop starts from: goal active, every item [x], zero tools run yet. It
+ // run starts from: goal active, every item [x], zero tools run yet. It
// used to stop at iteration 1 as `accepted` with nothing done.
try resumeSession(ar, &root,
\\{"goal":{"objective":"keep the tree green","status":"active","epoch":2,"standing":true,"created_ms":1,"updated_ms":2},
@@ -357,7 +357,7 @@ test "/loop: a restored all-[x] list is idle, not accepted (#318)" {
try std.testing.expectEqual(agent_mod.GoalStatus.active, root.goal.?.status); // and nothing was retired
}
-test "/loop: a finished list accepts and retires only a retirable goal (#318)" {
+test "goal run: a finished list accepts and retires only a retirable goal (#318)" {
var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena_state.deinit();
const ar = arena_state.allocator();
@@ -382,7 +382,7 @@ test "/loop: a finished list accepts and retires only a retirable goal (#318)" {
try std.testing.expectEqual(agent_mod.GoalStatus.active, root.goal.?.status);
}
-test "/loop: a refused completion is work, and a leftover complete goal decides nothing (#318)" {
+test "goal run: a refused completion is work, and a leftover complete goal decides nothing (#318)" {
var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena_state.deinit();
const ar = arena_state.allocator();
@@ -391,7 +391,7 @@ test "/loop: a refused completion is work, and a leftover complete goal decides
try root.todos.append(ar, .{ .content = "verify in the browser", .status = "pending", .epoch = 1 });
// The completion gate refused: the model called attempt_completion (which
// is exempt from the tool counter) and got an is_error back to react to.
- // Reading that as silence killed the /loop on the very turn the gate meant
+ // Reading that as silence killed the run on the very turn the gate meant
// to keep alive, so the promised second call could never happen (#318).
goal_state.noteCompletionRefused(&root);
try std.testing.expectEqual(@as(u64, 0), root.tool_calls_this_turn);
@@ -401,7 +401,7 @@ test "/loop: a refused completion is work, and a leftover complete goal decides
try std.testing.expectEqual(repl_glue.ContinuationOutcome.idle, goal_flow.loopTurnDecision(&root, 25, 0).stop);
// A goal left .complete by an earlier run or a resume reconciliation must
- // not label a fresh /loop `accepted` at iteration 1 before anything has
+ // not label a fresh run `accepted` at iteration 1 before anything has
// happened: it decides nothing, exactly like .active.
root.goal.?.status = .complete;
root.tool_calls_this_turn = 3;
@@ -411,7 +411,7 @@ test "/loop: a refused completion is work, and a leftover complete goal decides
try std.testing.expectEqual(repl_glue.ContinuationOutcome.idle, goal_flow.loopTurnDecision(&root, 25, 0).stop);
}
-test "a fresh /loop cannot stop accepted off a checklist finished before it (#318)" {
+test "a fresh run cannot stop accepted off a checklist finished before it (#318)" {
var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena_state.deinit();
const ar = arena_state.allocator();
@@ -425,7 +425,7 @@ test "a fresh /loop cannot stop accepted off a checklist finished before it (#31
root.tool_calls_this_turn = 1;
// Stale evidence reads as work_done -> accepted on B's very first decision...
try std.testing.expectEqual(repl_glue.ContinuationOutcome.accepted, goal_flow.loopTurnDecision(&root, 25, 0).stop);
- // ...which is why mainloop clears todos_dirty when a FRESH /loop arms: the
+ // ...which is why mainloop clears todos_dirty when a FRESH run arms: the
// new prompt starts with no completion evidence of its own, and only a
// todo_write (or attempt_completion) made DURING the run can stop it.
root.todos_dirty = false;
@@ -434,7 +434,7 @@ test "a fresh /loop cannot stop accepted off a checklist finished before it (#31
try std.testing.expectEqual(repl_glue.ContinuationOutcome.accepted, goal_flow.loopTurnDecision(&root, 25, 0).stop);
}
-test "/loop: a passed wall-clock deadline stops as expired and flips nothing" {
+test "goal run: a passed wall-clock deadline stops as expired and flips nothing" {
var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena_state.deinit();
const ar = arena_state.allocator();
@@ -442,7 +442,7 @@ test "/loop: a passed wall-clock deadline stops as expired and flips nothing" {
root.goal = .{ .objective = "ship phase 2", .epoch = 1, .status = .active };
try root.todos.append(ar, .{ .content = "still open", .status = "pending", .epoch = 1 });
root.tool_calls_this_turn = 3; // the turn worked; it simply ran out of clock
- root.loop_deadline_ms = 10_000; // `/loop 30m ...` armed this
+ root.loop_deadline_ms = 10_000; // `/goal 30m ...` armed this
// One second short of it the run continues exactly as before.
try std.testing.expect(std.meta.activeTag(goal_flow.loopTurnDecision(&root, 25, 9_999)) == .continue_turn);
diff --git a/src/goal_state.zig b/src/goal_state.zig
index 670d388f..e83b9ecd 100644
--- a/src/goal_state.zig
+++ b/src/goal_state.zig
@@ -107,7 +107,7 @@ pub fn adoptTodos(todos: []TodoItem, from_epoch: u64, to_epoch: u64) void {
/// attempt_completion per turn, so clearing the arm at the turn boundary made
/// every refusal unresolvable - refuse, turn ends, flag clears, refuse again,
/// forever, with nothing the user could type to break out.
-/// `new_ask` marks a turn the USER started (false for a /loop continuation,
+/// `new_ask` marks a turn the USER started (false for a run's continuation,
/// which is the same ask still running): that is the boundary where a finished
/// checklist retires instead of following the session forever (#394).
pub fn beginTurn(root: *Agent, new_ask: bool) void {
@@ -118,7 +118,7 @@ pub fn beginTurn(root: *Agent, new_ask: bool) void {
/// The caller's half of a refusal: arm the double-check so the model's promised
/// second attempt_completion closes the goal (this turn or any later one), and
/// record that the turn did work - a refused call is exempt from the tool
-/// counter, so without this the /loop reads the turn as silence (#318).
+/// counter, so without this the run reads the turn as silence (#318).
pub fn noteCompletionRefused(root: *Agent) void {
root.completion_gate_armed = true;
root.completion_refused = true;
@@ -126,10 +126,10 @@ pub fn noteCompletionRefused(root: *Agent) void {
/// Did the checklist finish in THIS process? `allDone` alone is not evidence:
/// todos persist, so a checklist completed in a PREVIOUS session made the next
-/// /loop stop at iteration 1 as `accepted` and flipped the restored goal to
+/// run stop at iteration 1 as `accepted` and flipped the restored goal to
/// complete with zero work done (#318). The freshness flag also covers the
/// goal == null case, where an all-completed epoch-0 leftover satisfies allDone
-/// on a bare /loop. Only todo_write sets it; loadSession, /clear and /new clear it.
+/// on a goal-less run. Only todo_write sets it; loadSession, /clear and /new clear it.
pub fn checklistFinished(root: *const Agent) bool {
if (!root.todos_dirty) return false;
return allDone(root.todos.items, currentEpoch(root.goal));
@@ -137,7 +137,7 @@ pub fn checklistFinished(root: *const Agent) bool {
/// todo_write just rewrote the current epoch's checklist: the completion
/// double-check gets fresh evidence to check against, and the list becomes
-/// this-process evidence for /loop termination (#318).
+/// this-process evidence for run termination (#318).
pub fn noteTodoWrite(root: *Agent) void {
resetCompletionGate(root);
root.todos_dirty = true;
@@ -187,7 +187,7 @@ pub fn resetCompletionGate(root: *Agent) void {
}
/// Re-state an unchanged active note after this many suppressed turns, in case
-/// LoopListGate: re-paste an unchanged /loop checklist after this many quiet turns.
+/// LoopListGate: re-paste an unchanged run checklist after this many quiet turns.
pub const refresh_turns: u32 = 8;
/// Standing-goal essay. 0 = never; the objective lives in the prefix (ADR 0005).
pub const essay_refresh_turns: u32 = 0;
@@ -248,7 +248,7 @@ pub fn hasCurrent(todos: []const TodoItem, epoch: u64) bool {
/// ever can, since one attempt_completion per turn is all a model emits.
/// A standing --goal is gated like any other goal (#318: an unearned "done" is
/// exactly what the flag's headless sessions need double-checked - exempting
-/// them here let one premature claim end a /loop as accepted with open work);
+/// them here let one premature claim end a run as accepted with open work);
/// standing only exempts RETIREMENT (retireOnCompletion), so a confirmed claim
/// is recorded and the objective keeps steering.
pub fn completionGate(arena: Allocator, agent: *Agent) !?[]const u8 {
@@ -418,7 +418,7 @@ test "checklistFinished demands THIS process's todo_write; a restored all-[x] li
root.goal = null;
root.todos_dirty = false; // exactly what loadSession leaves behind
try root.todos.append(ar, .{ .content = "old work", .status = "completed", .epoch = 0 });
- // The goal == null variant: a bare /loop must not stop at iteration 1 just
+ // The goal == null variant: a goal-less run must not stop at iteration 1 just
// because a previous session left a finished epoch-0 list on disk.
try std.testing.expect(allDone(root.todos.items, 0));
try std.testing.expect(!checklistFinished(&root));
diff --git a/src/goal_todo.zig b/src/goal_todo.zig
index f0307f8c..f64603db 100644
--- a/src/goal_todo.zig
+++ b/src/goal_todo.zig
@@ -71,7 +71,7 @@ fn mentions(contents: []const []const u8, content: []const u8) bool {
/// back with thirteen [x] entries spanning goals that had nothing to do with the
/// prompt in front of the model, and every new prompt inherited the pile.
/// The boundary is the cheapest honest one available in the loop: a user turn
-/// (goal_state.beginTurn's `new_ask` - never a /loop continuation, which is the
+/// (goal_state.beginTurn's `new_ask` - never a run's continuation, which is the
/// same ask still running) whose current epoch is FULLY completed. An unfinished
/// checklist is live work and crosses the turn untouched, which is what the
/// compaction handoff and every cross-turn resume depend on.
@@ -104,7 +104,7 @@ pub const WriteResult = struct { text: []const u8, rejected: bool = false, dropp
/// items without a content string) is REJECTED without touching anything:
/// under the preserve rule it would have left the epoch holding only
/// completed survivors - allDone true, todos_dirty true - so one malformed
-/// call ended a /loop as accepted and retired the goal (#318, proven by the
+/// call ended a run as accepted and retired the goal (#318, proven by the
/// round-4 verifier). It must also never count as completion evidence, so
/// noteTodoWrite runs only on the accepted path.
pub fn applyTodoWrite(root: *Agent, list: ?Value) !WriteResult {
@@ -269,7 +269,7 @@ test "a write with zero usable items is rejected untouched, never completion evi
// The round-4 verifier's exact trace: under the preserve rule, an empty or
// malformed write used to strip the open items and leave only completed
// survivors - allDone true, todos_dirty true - so one typo'd call ended a
- // /loop as accepted and retired the goal. It is rejected outright instead.
+ // run as accepted and retired the goal. It is rejected outright instead.
for ([_]?Value{ try todosArg(ar, "{\"todos\":[]}"), null, try todosArg(ar, "{\"todos\":[{\"status\":\"pending\"}]}") }) |bad| {
const r = try applyTodoWrite(&root, bad);
try std.testing.expect(r.rejected);
diff --git a/src/help.zig b/src/help.zig
index 53024031..abcf23f9 100644
--- a/src/help.zig
+++ b/src/help.zig
@@ -30,7 +30,7 @@ const peers_blurb =
pub const sections = [_]Section{
.{ .title = "getting around", .names = &.{ "/new", "/clear", "/resume", "/save", "/sessions", "/workspace", "/experiment", "/rename", "/rewind", "/edit", "/snapshot", "/teleport" } },
.{ .title = "the model", .names = &.{ "/model", "/models", "/effort", "/reasoning", "/fast", "/thinking", "/keepcontext", "/fallback", "/routes" } },
- .{ .title = "working autonomously", .names = &.{ "/goal", "/goals", "/loop", "/schedule", "/review", "/issue", "/plan", "/todo", "/jobs", "/ultracode", "/strict", "/yolo", "/never" } },
+ .{ .title = "working autonomously", .names = &.{ "/goal", "/goals", "/schedule", "/review", "/issue", "/plan", "/todo", "/jobs", "/ultracode", "/strict", "/yolo", "/never" } },
.{ .title = "talking to other graffs", .names = &.{ "/tell", "/daddy", "/peek", "/adapter" }, .blurb = peers_blurb },
.{ .title = "your setup", .names = &.{ "/login", "/key", "/cost", "/usage", "/version", "/update", "/privacy", "/mcp", "/import-claude", "/skills", "/plugins", "/agents", "/hooks", "/tools", "/fleet" } },
.{ .title = "context & history", .names = &.{ "/compact", "/btw", "/doctor", "/debug", "/cache", "/trace", "/trajectory" } },
diff --git a/src/loop_run.zig b/src/loop_run.zig
index d5e2b7ee..8d4b7119 100644
--- a/src/loop_run.zig
+++ b/src/loop_run.zig
@@ -1,13 +1,13 @@
-//! One line-REPL /loop run (#226): its iteration credits, the queued
+//! One line-REPL autonomous /goal run (#226): its iteration credits, the queued
//! continuation, the checklist gate and the wall clock. Moved out of
//! mainloop.zig (600-line cap) when #1278 added the hold.
//!
-//! #1278: a loop turn that only started or waited on background work makes no
+//! #1278: a run turn that only started or waited on background work makes no
//! tool calls, so the controller read it as `idle` and ended the run. The
-//! work's completion wake then ran as an ordinary turn, outside the loop's
+//! work's completion wake then ran as an ordinary turn, outside the run's
//! credits and steering. Now, while the root still owns a running shell job or
//! background subagent that will report, the run holds instead: the next idle
-//! wake continues it as a loop turn. A typed line ends the hold like a steer.
+//! wake continues it as a run turn. A typed line ends the hold like a steer.
const std = @import("std");
const Io = std.Io;
@@ -28,7 +28,7 @@ pub const LoopRun = struct {
armed: bool = false, // a continuation turn is queued for the next read
holding: bool = false, // #1278: waiting for the root's background work to report
list: goal_flow.LoopListGate = .{}, // diff-gate for the checklist copy (#318)
- clock: goal_pacing.LoopClock = .{}, // `/loop 30m <prompt>` deadline + pacing
+ clock: goal_pacing.LoopClock = .{}, // `/goal 30m <objective>` deadline + pacing
/// A user steer or typed line, or the run's end: nothing continues.
pub fn cancel(self: *LoopRun, root: *Agent) void {
@@ -49,8 +49,8 @@ pub const LoopRun = struct {
// it changed or a history rewrite destroyed the pasted copies (#318).
const note = try self.list.note(arena, root);
const pace = try goal_pacing.pacingNote(arena, now_ms, self.clock, iter_cap - self.iters_left, iter_cap);
- if (wake.len == 0) return std.fmt.allocPrint(arena, "/loop {s}\n{s}", .{ note, pace });
- return std.fmt.allocPrint(arena, "/loop {s}\n\n{s}\n{s}", .{ wake, note, pace });
+ if (wake.len == 0) return std.fmt.allocPrint(arena, "{s}\n{s}", .{ note, pace });
+ return std.fmt.allocPrint(arena, "{s}\n\n{s}\n{s}", .{ wake, note, pace });
}
/// A line read while holding. An idle wake (the work reporting) continues
@@ -68,7 +68,7 @@ pub const LoopRun = struct {
return try self.continuation(arena, root, now_ms, line);
}
- /// After a clean /loop turn the CONTROLLER decides whether another runs,
+ /// After a clean run turn the CONTROLLER decides whether another runs,
/// not the model merely stopping (goal_flow.loopTurnDecision).
pub fn afterTurn(self: *LoopRun, root: *Agent, io: Io, out: *Io.Writer, is_continuation: bool) !void {
if (!is_continuation) {
@@ -144,7 +144,7 @@ test "#1278: a wake during a hold continues the run; a typed line or a spent run
var run: LoopRun = .{ .iters_left = 3, .holding = true };
const line = (try run.afterRead(arena, &root, 1_000, wake, true)).?;
- try std.testing.expect(std.mem.startsWith(u8, line, "/loop " ++ wake ++ "\n\n[continuing autonomously (/loop)"));
+ try std.testing.expect(std.mem.startsWith(u8, line, wake ++ "\n\n[continuing autonomously:"));
try std.testing.expect(!run.holding and run.iters_left == 2);
var typed: LoopRun = .{ .iters_left = 3, .holding = true };
diff --git a/src/mainloop.zig b/src/mainloop.zig
index c08366fb..a2790ca4 100644
--- a/src/mainloop.zig
+++ b/src/mainloop.zig
@@ -77,7 +77,7 @@ pub fn run(ctx: *Ctx) !void {
defer @import("line_repl_terminal.zig").release(ctx.out); // #396: registered LAST so LIFO runs it FIRST — the tty goes back before the save/telemetry/learning phases that can take seconds
var prev_turn_id: u64 = 0;
var prev_prompt_fp: [16]u8 = scoring.promptFingerprint(ctx.root.systemPrompt());
- // Armed only after a clean /loop turn and consumed by the next read (#226).
+ // Armed only after a clean /goal run turn and consumed by the next read (#226).
var loop_run: @import("loop_run.zig").LoopRun = .{};
while (true) {
@@ -88,9 +88,9 @@ pub fn run(ctx: *Ctx) !void {
repl_glue.resetSteerPartial();
const steer_entry: ?repl_glue.SteerEntry = repl_glue.popSteer();
defer if (steer_entry) |e| std.heap.page_allocator.free(e.text);
- var is_loop_continuation = false; // #226: this iteration is an autonomous /loop continuation turn
+ var is_loop_continuation = false; // #226: this iteration is an autonomous run's continuation turn
const raw_line: []const u8 = if (steer_entry) |e| blk: {
- loop_run.cancel(ctx.root); // #226: a user steer/force cancels the autonomous /loop run
+ loop_run.cancel(ctx.root); // #226: a user steer/force cancels the autonomous run
if (e.force) {
try ctx.out.print("{s}↳ force ›{s} {s}\n", .{ style.yellow, style.reset, e.text });
} else {
@@ -99,7 +99,7 @@ pub fn run(ctx: *Ctx) !void {
try ctx.out.flush();
break :blk e.text;
} else if (loop_run.armed) blk: {
- // #226: autonomous /loop continuation — synthesize the next turn from the
+ // #226: autonomous run continuation — synthesize the next turn from the
// continuation steering note instead of reading a new user line.
is_loop_continuation = true;
break :blk try loop_run.continuation(ctx.arena, ctx.root, util.unixMs(ctx.io), "");
@@ -117,11 +117,11 @@ pub fn run(ctx: *Ctx) !void {
recap_jobs.poll(ctx);
const line = std.mem.trim(u8, raw_line, " \t\r");
if (line_repl_disclosure.handleInput(ctx.root.io, ctx.out, line)) continue;
- // `/goal [30m] <objective>` and `/loop [30m] <prompt>` are ONE autonomous run: same
- // plan-act-verify machine, same controller, same optional wall clock. Only /goal also
- // adopts a standing objective (goal_pacing.autonomousFromLine).
+ // `/goal [30m] <objective>` adopts the objective and starts ONE autonomous run: the
+ // plan-act-verify machine, its controller and an optional wall clock. A continuation
+ // turn stays in its run (goal_pacing.autonomousFromLine).
const goal_objective: ?[]const u8 = if (main_mod.json_mode) null else repl_glue.goalPromptFromLine(line);
- const auto: ?goal_pacing.Autonomous = if (main_mod.json_mode) null else try goal_pacing.autonomousFromLine(ctx.arena, line, goal_objective);
+ const auto: ?goal_pacing.Autonomous = if (main_mod.json_mode) null else try goal_pacing.autonomousFromLine(ctx.arena, line, goal_objective, is_loop_continuation);
const loop_prompt: ?[]const u8 = if (auto) |a| a.prompt else null;
// A fresh line starts (or ends) a run: wall clock begins here; stale todos_dirty is
// dropped, and an armed budget is echoed — a silently-eaten "5m" reads like a truncated prompt.
@@ -321,7 +321,7 @@ pub fn run(ctx: *Ctx) !void {
);
if (eval_note.len > 0) goal_msg = try std.fmt.allocPrint(ctx.arena, "{s}\n\n{s}", .{ goal_msg, eval_note });
- // /goal and /loop both ask the model to work autonomously (plan→act→verify).
+ // A /goal run asks the model to work autonomously (plan→act→verify).
const loop_msg: []const u8 = if (loop_prompt != null) try std.fmt.allocPrint(ctx.arena,
\\{s}
\\
@@ -555,8 +555,8 @@ pub fn run(ctx: *Ctx) !void {
ctx.root.autocompact(session_context_tokens); // loop_run.list re-carries via root.history_rewrites, incl. MID-turn rewrites this block never sees (#318)
}
- // #226: /loop controller-authorized continuation. After a cleanly-
- // completed autonomous /loop turn the CONTROLLER decides whether to run
+ // #226: controller-authorized continuation. After a cleanly-
+ // completed autonomous run turn the CONTROLLER decides whether to run
// another turn — not the model merely stopping (loop_run.zig). The armed
// continuation is consumed at the next read, so an interrupted/errored
// turn (which `continue`s past here) never resumes the loop; a run with
diff --git a/src/repl_glue.zig b/src/repl_glue.zig
index 7d189a92..299d90c5 100644
--- a/src/repl_glue.zig
+++ b/src/repl_glue.zig
@@ -196,7 +196,7 @@ test "goalSteeringNote: active-only gate, completion contract, and no embedded c
try std.testing.expectEqualStrings("", try goalSteeringNote(ar, .{ .objective = "x", .standing = true, .status = .paused }));
}
-/// #226 continuation gate — the outcome when a /loop turn finishes: the loop
+/// #226 continuation gate — the outcome when an autonomous run's turn finishes: the run
/// either runs another turn or stops with a NAMED terminal state (surfaced in
/// the transcript so #219's ledger can later record it verbatim). Budget-free.
/// One sentence per outcome, because the tag alone misleads: a user reading a
@@ -218,18 +218,18 @@ pub fn outcomeText(outcome: ContinuationOutcome, iter_cap: u32) []const u8 {
pub const ContinuationOutcome = enum {
accepted, // the goal's checklist is complete (or the goal itself is complete)
idle, // the turn did no tool work and asserted nothing - the loop stops, but nothing is done (#318)
- exhausted, // hit the hard per-/loop iteration bound with work still open
- expired, // the run's wall-clock budget (`/loop 30m ...`) ran out with work still open
+ exhausted, // hit the hard per-run iteration bound with work still open
+ expired, // the run's wall-clock budget (`/goal 30m ...`) ran out with work still open
blocked, // the goal is blocked and needs the user
cancelled, // the goal was paused — the user stepped in
};
pub const ContinuationDecision = union(enum) {
- continue_turn, // run another /loop turn without reading a new user line
+ continue_turn, // run another turn of the run without reading a new user line
stop: ContinuationOutcome, // return control to the prompt with this named outcome
};
-/// Pure controller decision for /loop continuation (#226): continuation is
+/// Pure controller decision for a run's continuation (#226): continuation is
/// authorized by CONTROLLER STATE, never by the model merely stopping. An active
/// goal with the checklist still open and iterations left keeps going; a
/// paused or blocked goal, or a spent iteration bound, yields the matching
@@ -250,7 +250,7 @@ pub fn continuationDecision(
// (attempt_completion sets root.completed) or through mainloop's
// flip-then-stop, so .complete here is a LEFTOVER objective from an
// earlier run or a resume reconciliation. It must not label a fresh
- // /loop `accepted` at iteration 1 before anything happened (#318).
+ // run `accepted` at iteration 1 before anything happened (#318).
.complete, .active => {},
}
if (model_stopped) return .{ .stop = .idle };
@@ -261,7 +261,7 @@ pub fn continuationDecision(
/// Did this turn genuinely stop working? Zero tool calls is the model declining
/// to act - but a REFUSED attempt_completion is exempt from the tool counter,
/// and that is exactly a turn where the model acted and got an is_error back to
-/// react to. Reading it as silence killed the /loop on the very turn the
+/// react to. Reading it as silence killed the run on the very turn the
/// completion gate meant to keep alive (#318).
pub fn turnStopped(tool_calls: u64, completion_refused: bool) bool {
return tool_calls == 0 and !completion_refused;
diff --git a/src/repl_model_commands.zig b/src/repl_model_commands.zig
index 85f0888d..26bfe1ad 100644
--- a/src/repl_model_commands.zig
+++ b/src/repl_model_commands.zig
@@ -117,8 +117,6 @@ pub fn runCommand(self: *Model, line: []const u8) void {
self.push(.info, "named agents are used by the agent loop, not single-shot chat") catch {};
} else if (std.mem.eql(u8, cmd, "/hooks")) {
self.push(.info, "hooks run around the agent loop, not the chat repl") catch {};
- } else if (std.mem.eql(u8, cmd, "/loop")) {
- self.push(.info, "`/loop` schedules repeated runs in the main session, not the chat repl") catch {};
} else if (eqlAny(cmd, &.{ "/trace", "/trajectory", "/cache" })) {
self.push(.info, "trace/trajectory/cache logging is a main-session feature") catch {};
} else if (eqlAny(cmd, &.{ "/save", "/resume", "/sessions", "/workspace", "/ws", "/plugins" })) {
diff --git a/src/repl_util.zig b/src/repl_util.zig
index 3cfbad8b..689bad32 100644
--- a/src/repl_util.zig
+++ b/src/repl_util.zig
@@ -20,7 +20,7 @@ pub const HELP_CHAT =
\\ /plan /strict /yolo /keepcontext /title modes
\\ /rename <name> /animation enso|braille|dragon
\\ /bash /save /resume /sessions /workspace /trace /trajectory
- \\ /agents /skills /plugins /hooks /mcp /loop /review /image /paste /key
+ \\ /agents /skills /plugins /hooks /mcp /review /image /paste /key
\\
\\Type a message and press enter to send it to the model. Toggles accept
\\[on|off] or flip when bare. Commands needing the agent loop explain so.
diff --git a/src/schedule.zig b/src/schedule.zig
index f6cb7dcc..5bf75e32 100644
--- a/src/schedule.zig
+++ b/src/schedule.zig
@@ -1,6 +1,6 @@
//! Time-triggered tasks that wake a session (#556). Store is
//! `.graff/schedule/<id>.json`. Due-claim runs at the same step boundary as
-//! job_notify. `/loop` stays the standing-goal controller; this is cron.
+//! job_notify. `/goal` is the standing-goal controller; this is cron.
const std = @import("std");
const builtin = @import("builtin");
@@ -22,7 +22,7 @@ const ExecResult = tools_mod.ExecResult;
const ToolSpec = schema.ToolSpec;
pub const tool_name = "schedule_task";
-pub const tool_desc = "Schedule a prompt to wake this session later. delay is 30s/5m/2h (same tokens as /loop). At the due time the prompt is injected as a user turn.";
+pub const tool_desc = "Schedule a prompt to wake this session later. delay is 30s/5m/2h. At the due time the prompt is injected as a user turn.";
pub const tool_schema =
\\{"type": "object", "properties": {"delay": {"type": "string", "description": "30s, 5m, or 2h"}, "prompt": {"type": "string", "description": "what to do when it fires"}}, "required": ["delay", "prompt"]}
;
diff --git a/src/schema.zig b/src/schema.zig
index 7afdfb80..22fae4b4 100644
--- a/src/schema.zig
+++ b/src/schema.zig
@@ -145,7 +145,7 @@ const meta_specs = [_]ToolSpec{
.{ .name = mcp_select.select_name, .desc = mcp_select.select_desc, .schema = mcp_select.select_schema },
.{
.name = "clock_sleep",
- .desc = "Pause the current turn for up to 12 hours of wall-clock time; interruptible by user input, and reported as a normal (non-error) result either way. For autonomous /loop runs that need to wait before re-checking something (e.g. a long external job). Root-only; off unless --clock-sleep/GRAFF_CLOCK_SLEEP=1 is set.",
+ .desc = "Pause the current turn for up to 12 hours of wall-clock time; interruptible by user input, and reported as a normal (non-error) result either way. For autonomous /goal runs that need to wait before re-checking something (e.g. a long external job). Root-only; off unless --clock-sleep/GRAFF_CLOCK_SLEEP=1 is set.",
.schema =
\\{"type": "object", "properties": {"ms": {"type": "integer", "description": "Milliseconds to sleep (0 returns immediately; clamped to the 12h/43200000ms cap)"}, "reason": {"type": "string", "description": "Optional: why you're sleeping, for the trace/UX"}}, "required": ["ms"]}
,
diff --git a/src/subagent_retry.zig b/src/subagent_retry.zig
index 4786a244..d1f3cf98 100644
--- a/src/subagent_retry.zig
+++ b/src/subagent_retry.zig
@@ -38,7 +38,7 @@
//! The cost of that layering, stated rather than hidden: a worker whose stream
//! stalls hopelessly now spends up to 3 asks x (1 + 2 reconnects) instead of
//! 1 x 3 before giving up. That ceiling is fixed, it is the price of not
-//! discarding a nearly-finished worker over one bad socket, and a /loop
+//! discarding a nearly-finished worker over one bad socket, and a run
//! deadline (pastDeadline) cuts it short whenever the run has one.
const std = @import("std");
@@ -153,7 +153,7 @@ pub fn backoffMs(kind: FailKind, attempts_done: u8) u64 {
};
}
-/// A /loop deadline the run has already passed buys nothing by being waited
+/// A run deadline that has already passed buys nothing by being waited
/// out — the parent will discard the late answer anyway. Pure so the call site
/// stays testable without a clock.
pub fn pastDeadline(now_ms: i64, deadline_ms: ?i64) bool {
@@ -292,7 +292,7 @@ test "backoffMs: bounded waits; a named limit waits longer than a flake" {
}
}
-test "pastDeadline: no /loop deadline never blocks a retry; a passed one always does" {
+test "pastDeadline: no run deadline never blocks a retry; a passed one always does" {
try std.testing.expect(!pastDeadline(1_000, null));
try std.testing.expect(!pastDeadline(999, 1_000));
try std.testing.expect(pastDeadline(1_000, 1_000));
diff --git a/src/subagent_run.zig b/src/subagent_run.zig
index f0927f34..506d4ba0 100644
--- a/src/subagent_run.zig
+++ b/src/subagent_run.zig
@@ -402,7 +402,7 @@ pub fn runSub(ctx: ToolCtx, kind: []const u8, label: []const u8, prompt: []const
const err = if (r) |_| break :ask r else |e| e;
const fail_kind = classifyFailure(err, agent.last_api_error);
if (!subagent_retry.shouldRetry(err, fail_kind, agent.last_api_error, attempts)) break :ask r;
- // A /loop deadline the run is already past makes waiting pointless.
+ // A run deadline already past makes waiting pointless.
if (subagent_retry.pastDeadline(util.unixMs(ctx.io), ctx.loop_deadline_ms)) break :ask r;
subagent_retry.traceAttempt(ctx.tracer, sub_id, attempts, fail_kind, agent.last_api_error);
agent.sleepInterruptible(@import("retry_jitter.zig").ms(agent.io, subagent_retry.backoffMs(fail_kind, attempts))) catch break :ask r; // #1274
diff --git a/src/tools.zig b/src/tools.zig
index 3429f3c1..adc580b8 100644
--- a/src/tools.zig
+++ b/src/tools.zig
@@ -136,7 +136,7 @@ pub const ToolCtx = struct {
depth: u8 = 0,
snapshots: ?*Snapshots = null,
tools_used: ?*ToolSink = null, // the calling agent's tool log (trajectory/process mining)
- loop_deadline_ms: ?i64 = null, // the running /loop's wall-clock deadline, copied from the spawning Agent: a child inherits the parent's ABSOLUTE deadline (minus an integration margin), never a slice of it
+ loop_deadline_ms: ?i64 = null, // the running /goal run's wall-clock deadline, copied from the spawning Agent: a child inherits the parent's ABSOLUTE deadline (minus an integration margin), never a slice of it
agent_cwd: ?[]const u8 = null, // #276 P0-1: per-agent isolated worktree (absolute path); null = shared cwd. Set from Agent.agent_cwd, never a process-wide chdir — safe across parallel sibling subagents on the same pool.
read_miss: ?*@import("read_miss.zig").Tracker = null, // #1116: turn-scoped consecutive read_file miss latch
};
diff --git a/src/verify_fingerprint.zig b/src/verify_fingerprint.zig
index 1d66241d..61503ece 100644
--- a/src/verify_fingerprint.zig
+++ b/src/verify_fingerprint.zig
@@ -1,6 +1,6 @@
//! #412: the no-progress guard in front of a repeated verification.
//!
-//! A /goal (or /loop) run is plan-act-VERIFY, and the verifier is the `eval`
+//! A /goal run is plan-act-VERIFY, and the verifier is the `eval`
//! tool: it runs the --eval command, optionally spawns an LLM judge subagent,
//! and a RED verdict blocks attempt_completion until a fresh green one
//! (agent_tools.handleMeta). So a continuation turn's obvious move is to call