Skip to content

Commit 2ee2f7f

Browse files
ableincclaude
andcommitted
Stop restricting plan-run tools; drop the dontAsk default
Plan runs were limited to --tools Read,Grep,Glob under a dontAsk default, which left them without a shell. Remove the hardcoded plan tool list and the runner's --tools option so plan runs get the CLI's full tool set, and default claude.plan_permission_mode to empty (no --permission-mode flag) so the operator sets it in config. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 6908d86 commit 2ee2f7f

6 files changed

Lines changed: 25 additions & 42 deletions

File tree

‎README.md‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ with `pattern config.json: no matching files found` — every compiling `make` t
258258
`git worktree` is added under `workspace.root` on a fresh `agent/issue-<n>` branch off the
259259
default branch. Both the plan and implement phases get this same worktree; the plan phase just
260260
never writes to it.
261-
4. **Plan** (skipped once approved) — `claude -p --permission-mode dontAsk --tools Read,Grep,Glob
261+
4. **Plan** (skipped once approved) — `claude -p --permission-mode <claude.plan_permission_mode>
262262
--max-turns 40` (`claude.plan_permission_mode`, `claude.plan_max_turns`) is handed the issue and told to produce a plan, not a change. Its final message is saved to SQLite
263263
and posted as an issue comment naming the files and approach it would take. The issue gets the
264264
`agent-planned` label and the run ends there — no commit, no verify, no push, no PR. Any human
@@ -339,8 +339,7 @@ claude --print --output-format stream-json --verbose --no-session-persistence \
339339
--model <head of the role's models.json ladder> \
340340
--fallback-model <the rest of that ladder, comma-separated> \
341341
--effort <models.json "effort" for this model+role, if set> \
342-
--permission-mode <claude.plan_permission_mode | claude.permission_mode> \
343-
--tools <Read,Grep,Glob on plan runs; omitted otherwise> \
342+
--permission-mode <claude.plan_permission_mode | claude.permission_mode; omitted when empty> \
344343
--max-turns <claude.plan_max_turns | claude.max_turns, omitted when 0> \
345344
--append-system-prompt <one of the prompts above> \
346345
--add-dir <the worktree>
@@ -373,9 +372,8 @@ Plan runs are deliberately **not** run in the CLI's own plan mode (`--permission
373372
mode layers its own workflow on top of the harness's prompt — fan out into parallel Explore
374373
subagents, then a Plan subagent, then write a plan file and call `ExitPlanMode` — and every one of
375374
those subagents starts cold and re-reads the repository, so a single plan cost several full
376-
explorations. Instead a plan run gets `--tools Read,Grep,Glob` (hardcoded as `planTools` in
377-
`internal/orchestrator/loop.go`): no `Agent` tool, so no subagents, and no `Edit`/`Write`/`Bash`,
378-
so it is read-only whatever `claude.plan_permission_mode` says. `claude.plan_max_turns` (default
375+
explorations. A plan run gets the CLI's full tool set, the same as an implement run; what it may
376+
do without asking is governed by `claude.plan_permission_mode`. `claude.plan_max_turns` (default
379377
40) caps how long it may explore; `claude.max_turns` (default 0, uncapped) does the same for
380378
implement and PR-comment runs. A run that hits its cap fails like any other failed run — failure
381379
comment, back-off, one rung down the ladder — and the failure names the CLI's `error_max_turns`.
@@ -466,7 +464,7 @@ This repository's own `config.json` is also **compiled into the binary** at buil
466464
"claude": {
467465
"binary": "claude",
468466
"permission_mode": "bypassPermissions",
469-
"plan_permission_mode": "dontAsk",
467+
"plan_permission_mode": "",
470468
"max_turns": 0,
471469
"plan_max_turns": 40,
472470
"extra_args": [],
@@ -529,7 +527,7 @@ This repository's own `config.json` is also **compiled into the binary** at buil
529527
| `run.verify_timeout` | wall-clock limit for the test command |
530528
| `claude.binary` | executable name/path for the Claude Code CLI |
531529
| `claude.permission_mode` | passed through as `--permission-mode` for the implement run |
532-
| `claude.plan_permission_mode` | passed through as `--permission-mode` for the read-only planning run; default `dontAsk` — don't use `plan`, which spawns subagents (see [How Claude Code is invoked](#how-claude-code-is-invoked)) |
530+
| `claude.plan_permission_mode` | passed through as `--permission-mode` for the planning run; default empty (no flag, the CLI's own default) — don't use `plan`, which spawns subagents (see [How Claude Code is invoked](#how-claude-code-is-invoked)) |
533531
| `claude.max_turns` | `--max-turns` for implement and PR-comment runs; `0` (the default) means no cap |
534532
| `claude.plan_max_turns` | `--max-turns` for planning runs; default `40`, `0` means no cap |
535533
| `claude.usage_poll_interval` / `usage_backoff` | advisory OAuth usage poll cadence and 429 backoff; **must be ≥ 1m** |

‎config.example.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"claude": {
4747
"binary": "claude",
4848
"permission_mode": "bypassPermissions",
49-
"plan_permission_mode": "dontAsk",
49+
"plan_permission_mode": "",
5050
"max_turns": 0,
5151
"plan_max_turns": 40,
5252
"extra_args": [],

‎internal/claude/runner.go‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,6 @@ type Options struct {
167167
Effort string
168168
// PermissionMode maps to `--permission-mode`.
169169
PermissionMode string
170-
// Tools maps to `--tools`, restricting the run to these built-in tools.
171-
// Nil leaves the CLI's full default set.
172-
Tools []string
173170
// MaxTurns maps to `--max-turns`. 0 leaves the run uncapped.
174171
MaxTurns int
175172
// WorkDir is the process cwd, i.e. the worktree.
@@ -253,9 +250,6 @@ func (r *Runner) Run(ctx context.Context, opts Options) (*Result, error) {
253250
if opts.PermissionMode != "" {
254251
args = append(args, "--permission-mode", opts.PermissionMode)
255252
}
256-
if opts.Tools != nil {
257-
args = append(args, "--tools", strings.Join(opts.Tools, ","))
258-
}
259253
if opts.MaxTurns > 0 {
260254
args = append(args, "--max-turns", strconv.Itoa(opts.MaxTurns))
261255
}

‎internal/claude/runner_test.go‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -230,30 +230,30 @@ echo '`+successResult+`'
230230
}
231231
}
232232

233-
func TestRunPassesToolsAndMaxTurns(t *testing.T) {
233+
func TestRunPassesMaxTurns(t *testing.T) {
234234
bin := stubCLI(t, `cat > /dev/null
235235
for a in "$@"; do printf '%s\n' "$a" >> "$ARGS_FILE"; done
236236
echo '`+successResult+`'
237237
`)
238238
argsFile := filepath.Join(t.TempDir(), "args.txt")
239239
if _, err := (&Runner{}).Run(context.Background(), Options{
240240
Binary: bin, LogPath: filepath.Join(t.TempDir(), "run.jsonl"),
241-
Env: []string{"ARGS_FILE=" + argsFile},
242-
Tools: []string{"Read", "Grep", "Glob"}, MaxTurns: 40,
241+
Env: []string{"ARGS_FILE=" + argsFile},
242+
MaxTurns: 40,
243243
}); err != nil {
244244
t.Fatalf("run: %v", err)
245245
}
246246
got, err := os.ReadFile(argsFile)
247247
if err != nil {
248248
t.Fatalf("stub did not record args: %v", err)
249249
}
250-
if args := string(got); !strings.Contains(args, "--tools\nRead,Grep,Glob\n") || !strings.Contains(args, "--max-turns\n40\n") {
251-
t.Fatalf("want --tools Read,Grep,Glob and --max-turns 40, got: %s", args)
250+
if args := string(got); !strings.Contains(args, "--max-turns\n40\n") {
251+
t.Fatalf("want --max-turns 40, got: %s", args)
252252
}
253253
}
254254

255-
// Zero values leave the CLI's defaults alone: all tools, no turn cap.
256-
func TestRunOmitsToolsAndMaxTurnsWhenUnset(t *testing.T) {
255+
// Runs never restrict the tool set, and an unset MaxTurns leaves them uncapped.
256+
func TestRunNeverPassesToolsAndOmitsUnsetMaxTurns(t *testing.T) {
257257
bin := stubCLI(t, `cat > /dev/null
258258
for a in "$@"; do printf '%s\n' "$a" >> "$ARGS_FILE"; done
259259
echo '`+successResult+`'
@@ -270,7 +270,7 @@ echo '`+successResult+`'
270270
t.Fatalf("stub did not record args: %v", err)
271271
}
272272
if args := string(got); strings.Contains(args, "--tools") || strings.Contains(args, "--max-turns") {
273-
t.Fatalf("unset Tools/MaxTurns must not reach the CLI, got: %s", args)
273+
t.Fatalf("--tools and an unset --max-turns must not reach the CLI, got: %s", args)
274274
}
275275
}
276276

‎internal/config/config.go‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ type ClaudeConfig struct {
146146
Binary string `json:"binary"`
147147
PermissionMode string `json:"permission_mode"`
148148
ExtraArgs []string `json:"extra_args"`
149-
// PlanPermissionMode governs the read-only planning run, distinct from the
150-
// implement run's PermissionMode. Not "plan": the CLI's plan mode fans out
149+
// PlanPermissionMode governs the planning run, distinct from the implement
150+
// run's PermissionMode. Empty passes no --permission-mode, leaving the
151+
// CLI's own default. Not "plan": the CLI's plan mode fans out
151152
// into Explore/Plan subagents that each re-read the repository, which
152153
// multiplied the cost of a single plan several times over.
153154
PlanPermissionMode string `json:"plan_permission_mode"`
@@ -254,14 +255,13 @@ func Default() Config {
254255
RetryBackoffMax: Duration(24 * time.Hour),
255256
},
256257
Claude: ClaudeConfig{
257-
Binary: "claude",
258-
PermissionMode: "bypassPermissions",
259-
PlanPermissionMode: "dontAsk",
260-
PlanMaxTurns: 40,
261-
UsagePollInterval: Duration(15 * time.Minute),
262-
UsageBackoff: Duration(15 * time.Minute),
263-
CredentialsPath: "~/.claude/.credentials.json",
264-
UsageCachePath: "~/.agent-loop/usage-cache.json",
258+
Binary: "claude",
259+
PermissionMode: "bypassPermissions",
260+
PlanMaxTurns: 40,
261+
UsagePollInterval: Duration(15 * time.Minute),
262+
UsageBackoff: Duration(15 * time.Minute),
263+
CredentialsPath: "~/.claude/.credentials.json",
264+
UsageCachePath: "~/.agent-loop/usage-cache.json",
265265
},
266266
Verify: VerifyConfig{AutoDetect: true, Commands: map[string]string{}},
267267
Server: ServerConfig{Addr: "127.0.0.1:8787", UI: true},

‎internal/orchestrator/loop.go‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ import (
3535
// modelCooldown is how long a model is sidelined after it fails a run.
3636
const modelCooldown = 30 * time.Minute
3737

38-
// planTools is the only tool set a planning run gets: read and search. No
39-
// Agent tool, so it cannot fan out into subagents that each re-read the
40-
// repository from a cold start, and no Edit/Write/Bash, so it stays read-only
41-
// whatever claude.plan_permission_mode says.
42-
var planTools = []string{"Read", "Grep", "Glob"}
43-
4438
// Options are the orchestrator's dependencies.
4539
type Options struct {
4640
Config config.Config
@@ -685,14 +679,12 @@ func (o *Orchestrator) execute(ctx context.Context, log *slog.Logger, cand candi
685679
log.Info("starting claude", "phase", phase, "model", head.ID, "branch", branch, "attempt", attempt)
686680

687681
var prompt, sysPrompt, permissionMode string
688-
var tools []string
689682
maxTurns := cfg.Claude.MaxTurns
690683
plan := o.approvedPlan(ctx, log, cand, runID, issue)
691684
if phase == phasePlan {
692685
prompt = planTaskPrompt(cand.repo, issue, plan)
693686
sysPrompt = planSystemPrompt(cand.repo, worktree)
694687
permissionMode = cfg.Claude.PlanPermissionMode
695-
tools = planTools
696688
maxTurns = cfg.Claude.PlanMaxTurns
697689
} else {
698690
if strings.TrimSpace(plan) == "" {
@@ -717,7 +709,6 @@ func (o *Orchestrator) execute(ctx context.Context, log *slog.Logger, cand candi
717709
Fallbacks: fallbacks,
718710
Effort: head.EffortFor(phase),
719711
PermissionMode: permissionMode,
720-
Tools: tools,
721712
MaxTurns: maxTurns,
722713
WorkDir: worktree,
723714
Env: o.opts.Git.IdentityEnv(),

0 commit comments

Comments
 (0)