pub fn opencode_default_policy() -> TranslatedExpand description
opencode’s documented DEFAULT policy (oc§4 “Default policy”: {"*": allow} with carve-outs doom_loop: ask, external_directory: ask,
question: deny, plan_enter/plan_exit: deny, read {*.env: ask, *.env.*: ask, *.env.example: allow}), rendered into this engine’s
pattern syntax and run through translate_last_match_to_first_match —
the worked example design §4.4 specifies and this build reproduces.
Two of oc’s five carve-outs are deliberately EXCLUDED from the rule list itself (§4.4’s own text, reproduced here as the three named deviations):
doom_loop: askis not a rule-language pattern at all — it’s a repetition TRIGGER (same call repeated), not a tool/path match. Routed to its real mechanism instead:Config::doom_loop_threshold(the P4 doom-loop breaker). No rule entry; a warning names the routing decision explicitly (never silently dropped).external_directory: askis an oc PERMISSION CATEGORY (any tool touching paths outside the worktree), not a tool name. Routed to its real mechanism:Config::additional_dirs— paths outsidecwdand outsideadditional_dirsare simply unreachable, a stricter (not equivalent) reading. No rule entry; a warning names the routing decision..env.example→ ASK, not ALLOW — this one DOES fall out of the generic algorithm above (a genuine, detected, safe-direction fixed- point divergence): under first-match deny→ask→allow, a read of.env.examplematches the ask-ruleread(*.env.*)BEFORE the allow list ("*") is ever consulted, so it asks where stock opencode allows. Recorded bytranslate_last_match_to_first_match’s own warning, not hidden.