Make read-only tool classification and fast-stage token budget configurable - #9
Open
alexander-potemkin wants to merge 1 commit into
Open
Conversation
…urable - Add autoMode.classifyReadOnlyTools (default false): when true, read-only tools (read/grep/find/ls) are routed through the classifier instead of the built-in read-only fast path, so reads outside the trusted working tree can be denied by policy. - Add autoMode.fastClassifierMaxTokens (default 512, integer >= 16): lets users raise the fast-stage completion budget for reasoning classifiers that truncate before emitting the required 0/1 digit. Both options are backward compatible and validated in validateSettingsFile.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two backward-compatible, opt-in config additions to
autoMode:classifyReadOnlyTools(defaultfalse): whentrue, read-only tools (read,grep,find,ls) are routed through the classifier instead of the built-in read-only fast path. This lets policy deny reads outside the trusted working tree (e.g.~/.ssh,/etc/shadow) rather than always auto-allowing them.fastClassifierMaxTokens(default512, integer ≥ 16): overrides the hardcoded fast-stage completion budget. Reasoning classifiers can consume the 512-token budget on hidden reasoning before emitting the required0/1digit, truncating and failing closed; this lets users raise it.Why
The read-only fast path is currently unconditional — reads never consult the classifier, so the only way to gate out-of-tree reads is
permissions.denypatterns, which are coarser than policy. Making it configurable enables a Codex/Claude Code-style auto-review pattern where every action (including reads) is subject to the safety classifier.fastClassifierMaxTokensaddresses the same class of failure: with a reasoning classifier the fixed512budget can truncate the fast stage. It is already a named constant; this just exposes it.Behavior
classifyReadOnlyTools: falsekeeps the read-only bypass;fastClassifierMaxTokens: 512is the prior value.validateSettingsFile(boolean / integer ≥ 16) and merged with the existing scalar precedence.Test plan
tool_callhook routing reads through the classifier whenclassifyReadOnlyToolsistrue(allow and deny paths).npm run checkandnpm testpass (104 tests).🤖 Generated with OpenCode