Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions agentdescent/integrations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,12 @@ def mcp_manifest(launcher: Optional[List[str]] = None) -> Dict[str, object]:
---

Use the agentdescent skill. The target is `$ARGUMENTS` (a path, optionally
followed by a cases file). Run `doctor`, build the spec, `plan` it, show me the
spec and the estimate, and wait for my yes before `start`.
followed by a cases file). Run `doctor`, build the spec, then `plan` it with
`--probe` / `probe=true`. If the probe refuses, give me its `next` and do not
`start`. Show me the spec and the estimate, and wait for my yes before
`start` / `evolve` with `max_calls` (and `max_usd` beside `usd_per_call` when
a price is known), starting at the plan's `agent_calls_upper_bound` (or
smaller for a trial).

If I named a method that is in `agentdescent algorithms list` (for example RRSI
or archive_selection), set `algorithm` in the spec (or pass `--algorithm` to
Expand Down Expand Up @@ -439,12 +443,16 @@ def mcp_manifest(launcher: Optional[List[str]] = None) -> Dict[str, object]:
call `algorithm_spec` with the name, the absolute path, the absolute cases
file and only the params they gave (validate with `describe_algorithm` /
`show` first); it writes and plans the spec and returns `spec`. Run `doctor`
first, show the resolved algorithm card (including fidelity / surface) and
estimate, and wait for my yes before `start` with that `spec`. Same
first, then `plan` that `spec` with `--probe` / `probe=true`. If the probe
refuses, give me its `next` and do not `start`. Show the resolved algorithm
card (including fidelity / surface) and estimate, and wait for my yes
before `start` with that `spec` and `max_calls` (and `max_usd` beside
`usd_per_call` when a price is known), starting at the plan's
`agent_calls_upper_bound` (or smaller for a trial). Same
apply/cancel/resume rules as `/evolve`. Without MCP: `agentdescent algorithms
run <name> <path> [cases.jsonl] [--param k=v...] [--rounds N] [--workers N]`
(init + plan; then `evolve` after yes). For a quick trial pass
`--rounds 1 --workers 1`.
(init + plan), then `plan <spec> --probe` and `evolve --max-calls N` after
yes. For a quick trial pass `--rounds 1 --workers 1`.

If they only named a method with no path, `show` it and ask whether to `run`.
"""
Expand Down
9 changes: 7 additions & 2 deletions agentdescent/mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,13 @@ def advanced_from_env(environ: Optional[Dict[str, str]] = None) -> bool:
"allowed root; `agentdescent.<name>.spec.json`) unless `out` names "
"another path under one of those roots -- never inside "
"a directory target -- and returns the plan estimate plus `spec`, the dict "
"to pass to start. It "
"starts nothing: show the user the estimate and get a yes before start. "
"to pass to start after a probed plan and a yes. It starts nothing and "
"does not probe or set a per-call cap: after it returns, call "
"`plan(spec, probe=true)` (or `plan --probe`); if the probe refuses, "
"give the user `next` and do not start (`ok: false`, `ready: false`). "
"Show the estimate, get a yes, then `start` with `max_calls` (and "
"`max_usd` beside `usd_per_call` when a price is known), starting at "
"the plan's `agent_calls_upper_bound` (or smaller for a trial). "
"`model`/`base_url` come from the user, never guess them."),
"plan": (
"Validate an EvolveSpec and estimate its cost WITHOUT running anything. Resolves "
Expand Down
7 changes: 7 additions & 0 deletions changelog.d/1228-slash-command-probe-cap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Fixed
Installed `/evolve` and `/algorithms run` slash commands (and the MCP
`algorithm_spec` description) now name the same first-run `plan --probe` /
`probe=true` preflight and `max_calls` / `--max-calls` cap as `SKILL.md`
and the CLI `next:` line, so a host following the command no longer starts
a first real run without them. Claude / Codex / OpenCode command files stay
byte-identical (#1228).
12 changes: 8 additions & 4 deletions integrations/claude-code/commands/algorithms.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ Parse `$ARGUMENTS` (trim; empty means `list`):
call `algorithm_spec` with the name, the absolute path, the absolute cases
file and only the params they gave (validate with `describe_algorithm` /
`show` first); it writes and plans the spec and returns `spec`. Run `doctor`
first, show the resolved algorithm card (including fidelity / surface) and
estimate, and wait for my yes before `start` with that `spec`. Same
first, then `plan` that `spec` with `--probe` / `probe=true`. If the probe
refuses, give me its `next` and do not `start`. Show the resolved algorithm
card (including fidelity / surface) and estimate, and wait for my yes
before `start` with that `spec` and `max_calls` (and `max_usd` beside
`usd_per_call` when a price is known), starting at the plan's
`agent_calls_upper_bound` (or smaller for a trial). Same
apply/cancel/resume rules as `/evolve`. Without MCP: `agentdescent algorithms
run <name> <path> [cases.jsonl] [--param k=v...] [--rounds N] [--workers N]`
(init + plan; then `evolve` after yes). For a quick trial pass
`--rounds 1 --workers 1`.
(init + plan), then `plan <spec> --probe` and `evolve --max-calls N` after
yes. For a quick trial pass `--rounds 1 --workers 1`.

If they only named a method with no path, `show` it and ask whether to `run`.
8 changes: 6 additions & 2 deletions integrations/claude-code/commands/evolve.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ argument-hint: <path> [cases.jsonl]
---

Use the agentdescent skill. The target is `$ARGUMENTS` (a path, optionally
followed by a cases file). Run `doctor`, build the spec, `plan` it, show me the
spec and the estimate, and wait for my yes before `start`.
followed by a cases file). Run `doctor`, build the spec, then `plan` it with
`--probe` / `probe=true`. If the probe refuses, give me its `next` and do not
`start`. Show me the spec and the estimate, and wait for my yes before
`start` / `evolve` with `max_calls` (and `max_usd` beside `usd_per_call` when
a price is known), starting at the plan's `agent_calls_upper_bound` (or
smaller for a trial).

If I named a method that is in `agentdescent algorithms list` (for example RRSI
or archive_selection), set `algorithm` in the spec (or pass `--algorithm` to
Expand Down
17 changes: 16 additions & 1 deletion tests/test_first_run_caps.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import pytest

from agentdescent import cli
from agentdescent.integrations import skill_text
from agentdescent.integrations import ALGORITHMS_COMMAND, EVOLVE_COMMAND, skill_text

ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
ALGORITHMS = ("gepa", "archive_selection")
Expand Down Expand Up @@ -57,6 +57,21 @@ def test_shared_host_skill_names_the_per_call_cap():
assert "--probe" in text # the preflight stays the first step


def test_slash_commands_name_the_probe_and_the_cap():
"""#1228: /evolve and /algorithms run must name the same first-run
preflight and per-call cap as SKILL.md / the CLI next: line."""
for text in (EVOLVE_COMMAND, ALGORITHMS_COMMAND):
assert "probe" in text
assert "max_calls" in text or "--max-calls" in text
run_branch = ALGORITHMS_COMMAND.split("**`run", 1)[1]
assert "probe" in run_branch
assert "--max-calls" in run_branch
assert "max_calls" in run_branch
# The run branch must not still tell the host to start from
# algorithm_spec / a bare algorithms run with no cap.
assert "then `evolve` after yes" not in run_branch


def test_plugin_quickstart_habits_name_the_per_call_cap():
text = _read("docs", "plugin-quickstart.md")
assert "--max-calls" in text
Expand Down
3 changes: 3 additions & 0 deletions tests/test_mcp_algorithm_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ def test_same_object_as_algorithms_run_json(tmp_path, capsys):
def test_description_is_written_for_the_model():
text = TOOL_DESCRIPTIONS["algorithm_spec"]
assert "algorithms run" in text and "start" in text and "never guess" in text
# #1228: the tool itself still only builds + plans; the description must
# require a follow-up probe and a capped start, not a bare start.
assert "probe=true" in text and "max_calls" in text


def test_params_object_is_passed_through_not_re_split(tmp_path):
Expand Down
Loading