You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: optional runtime enforcement of edit tool's read-before-edit precondition #27901
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.
No issue template was used. This issue presents both a clarification/documentation fix and a feature request, but it doesn't use one of the required templates: Bug Report, Feature Request (title must start with [FEATURE]:), or Question.
If this is a feature request (e.g., adding runtime enforcement via a config flag), please reopen/edit with the Feature Request template and a title starting with [FEATURE]:.
If this is a documentation bug (the tool description says "will error" but doesn't), please use the Bug Report template and include reproduction steps.
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
If you believe this was flagged incorrectly, please let a maintainer know.
changed the title [-]Clarification or feature: edit tool's "must Read first" precondition is prompt-level only, not runtime-enforced[/-][+][FEATURE]: optional runtime enforcement of edit tool's read-before-edit precondition[/+]on May 16, 2026
Thanks for updating the issue! It now follows the contributing guidelines and feature request template. Your description clearly explains the problem (the gap between the documented precondition and actual runtime behavior) and the specific feature ask. Removing the needs:compliance label.
Happy to draft a PR if it'd help. The additive path that doesn't break existing behaviour: opt-in config flag (e.g. tools.edit.require_prior_read: false by default) that, when set, refuses edits without a prior read in the session. That shape is non-breaking and follows existing config patterns. A maintainer steer on whether that direction is acceptable would save a round-trip. Otherwise no rush — I have a Mycelium-side workaround (plugin guard at tool.execute.before).
Activity
github-actions commentedon May 16, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
[FEATURE]:), or Question.[FEATURE]:.Please edit this issue to address the above within 2 hours, or it will be automatically closed.
If you believe this was flagged incorrectly, please let a maintainer know.
[-]Clarification or feature: edit tool's "must Read first" precondition is prompt-level only, not runtime-enforced[/-][+][FEATURE]: optional runtime enforcement of edit tool's read-before-edit precondition[/+]github-actions commentedon May 16, 2026
Thanks for updating the issue! It now follows the contributing guidelines and feature request template. Your description clearly explains the problem (the gap between the documented precondition and actual runtime behavior) and the specific feature ask. Removing the
needs:compliancelabel.haabe commentedon May 19, 2026
Happy to draft a PR if it'd help. The additive path that doesn't break existing behaviour: opt-in config flag (e.g.
tools.edit.require_prior_read: falseby default) that, when set, refuses edits without a priorreadin the session. That shape is non-breaking and follows existing config patterns. A maintainer steer on whether that direction is acceptable would save a round-trip. Otherwise no rush — I have a Mycelium-side workaround (plugin guard attool.execute.before).github-actions commentedon Jul 22, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.