Repository navigation
Commit d21f9b1
committed
fix: plan-agent tool-use — mandate exploration + reword misleading warning
When the plan agent runs on a tool-capable but compliant model (e.g.
GPT-5.5 via `altimate-default`), it often emits a plan from prompt
context alone without ever reading the repo. The existing safety net in
`processor.ts` catches this and surfaces a warning suggesting the user
"switch to a model with stronger tool-use via /model". That diagnosis
is misleading — the model IS tool-capable; it's a prompt-engineering
issue, not a capability issue.
This patch addresses both halves of the problem:
- **`plan.txt`**: adds a `## Investigate before drafting (REQUIRED)`
section that explicitly mandates at least one read-only tool call
(`read`/`grep`/`glob`/`list`/`explore`/read-only `bash`) before any
plan content. Stronger Claude models already infer this; weaker
compliant models need it spelled out. Includes an explicit escape
hatch for the trivial-task case so the rule doesn't fire spuriously.
- **`processor.ts`**: rewords the synthetic warning to describe the
observed behavior (`produced a plan without first reading any files`)
and offer two concrete remedies — reply asking it to explore first,
or `/model` to a more eager-to-investigate tier (Claude Sonnet/Opus).
No longer blames "tool-use capability."
- **`plan-reminder-anthropic.txt`**: deleted. The file was never
imported anywhere in the codebase — it was an upstream OpenCode
artifact that survived the rename in commit `a4eba2e6e` ("tweak: plan
prompt"). Removing dead config.
- Regression test in `plan-layer-e2e.test.ts` locks the explore-first
contract into the prompt so a future cleanup can't silently delete
it.
All 160 affected tests pass; typecheck clean.1 parent cdf89a6 commit d21f9b1
4 files changed
Lines changed: 36 additions & 70 deletions
File tree
- packages/opencode
- src/session
- prompt
- test/session
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
384 | | - | |
385 | | - | |
386 | | - | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
387 | 390 | | |
388 | 391 | | |
389 | 392 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
23 | 39 | | |
24 | 40 | | |
25 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
437 | 451 | | |
438 | 452 | | |
439 | 453 | | |
| |||
0 commit comments