Skip to content

[FEATURE]: optional runtime enforcement of edit tool's read-before-edit precondition #27901

@haabe

Description

@haabe

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

The edit tool's description text says:

"You must use your Read tool at least once in the conversation
before editing. This tool will error if you attempt an edit
without reading the file."

Runtime test on opencode 1.15.1 shows the string lives in the
LLM-facing tool schema only. The executable code path does not
enforce the precondition. A clean edit succeeded on a fresh session
with no prior read of the target file (Version: 0.23.23 → 0.23.24 applied; no error, no warning).

Fine as a design choice. The description text behaves as a
behavioural nudge to capable models. But the wording "This tool
will error if you attempt an edit without reading the file" is
descriptive-as-asserted-fact, not "the model should read first." A
4B or 8B local model that ignores the instruction will edit
happily, and frameworks relying on the precondition for safety
properties (preventing stale-state edits, say) will silently
no-op.

The feature request: ship the precondition as a configurable
runtime check — e.g. a config flag tools.edit.require_prior_read
— that refuses edits without a recent read on the same path in
the current session. This brings parity with Claude Code, where
the precondition is structurally enforced. Default-off is
acceptable; frameworks that depend on it can opt in.

A cheaper alternative the maintainers might prefer: just soften
the docs from "will error" to "should read first" so framework
authors don't misread the schema string as a runtime guarantee.
That's not a feature, that's a docs fix; happy to file separately
as a Bug Report if preferred. The feature ask is the configurable
runtime check.

Verified 2026-05-16. Full reproduction context:
https://github.com/haabe/mycelium/blob/main/docs/receipts/cases/2026-05-16-opencode-phase1-runtime.md

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions