Skip to content

[FEATURE]: LLM command-approval classifier ("auto mode") for permission gating #33585

Closed

Description

@thomaslwang

Feature hasn't been suggested before.

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

(Closest prior issues, and how this differs, are listed at the bottom — this proposal is distinct in mechanism.)

Describe the enhancement you want to request

Problem. opencode's permission model is per-rule binary: allow (auto-approve), ask (prompt every time), or deny. In agentic sessions there's no middle ground — nothing inspects an actual bash command / webfetch / MCP call and decides "this specific one is safe, don't prompt." Users end up approving constantly, or allow-listing broadly and losing the guardrail.

Proposal. An opt-in classifier (after Claude Code's "auto mode") that gates only the would-auto-approve path: when a rule resolves to allow, consult a model first.

  • allow → proceed silently (as today)
  • block → deny-and-continue: a tool error the agent reacts to (no halt)
  • classifier error / escalation → fail closed (human prompt)

It never overrides an explicit user deny/ask.

Design points (implemented in the reference branch):

  • Pluggable backend. Default uses the user's own configured model via the AI SDK (single-pass <block>yes/no</block>). Pluggable so a local/self-hosted or hosted guardrails model can be slotted in.
  • Reasoning-blind transcript — the classifier sees only user messages + the bare tool-call payload, never assistant prose or prior tool output (prompt-injection + anti-rationalization defense).
  • Full interception path via Permission.ask — covers edits, webfetch, MCP, task/subagent, external-dir; read-only tools short-circuit before any model call.
  • Escalation backstop — per-session denial counters (3 consecutive / 20 total), reset each user turn, so a false positive can't loop forever.
  • classifier config block (sibling of permission); off by default.

Reference implementation: openguardrails/opencode@feat/auto-mode-classifier (draft PR #33586). bun run typecheck clean; unit tests cover reasoning-blindness, fail-closed parsing, the allowlist, and the policy slots.

Closest prior issues (and how this differs):

Happy to align with any of these and to the team's preferred shape (naming, config location, experimental-flag gating).

Activity

  1. github-actions commented on Jun 24, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • The title should start with [FEATURE]: as required by the Feature Request template (e.g., [FEATURE]: LLM command-approval classifier ("auto mode") for permission gating)
    • The Feature Request template requires a verification checkbox confirming the feature hasn't been suggested before — this is missing

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


    This issue might be a duplicate of existing issues. Please check:

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. changed the title [-]Proposal: LLM command-approval classifier ("auto mode") for permission gating[/-] [+][FEATURE]: LLM command-approval classifier ("auto mode") for permission gating[/+] on Jun 24, 2026
  3. github-actions commented on Jun 24, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! It now follows our contributing guidelines and the needs:compliance label has been removed.

  4. thomaslwang commented on Jun 28, 2026

    @thomaslwang
    Author

    Closing — reworked as an external OGR plugin (no core changes) instead of an in-core classifier. See the closed PR #33586 for details and links. A focused follow-up issue for the permission-hook enhancement (to enable the interactive 'ask the human' path for plugins) will be opened separately.

  5. harvzor commented on Aug 25, 2026

    @harvzor

    @thomaslwang appears to be mostly an agent talking

    Proposal. An opt-in classifier (after Claude Code's "auto mode") that gates only the would-auto-approve path: when a rule resolves to allow, consult a model first.

    This is the original proposal which is a good idea

    Reference implementation: openguardrails/opencode@feat/auto-mode-classifier (draft PR #33586).

    But them the actual implementation is integrating it with openguardrails, which appears to be SaaS that does the guarding and logging of tool calls

    The very idea that this random third party would be integrated into OpenCode is crazy, at least the author changed it into a plugin instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions