R389 · Harness tips › Harness tips

Planning as a permission rule, and the two doors the plan agent leaves open

Read the original

agent-harnesscoding-agentsharness-tipspermissionshuman-verificationspecifications

Source: a 3-minute screencast walkthrough (24 Nov 2026) and its paid long-form companion, "OpenCode, Day-to-Day III", Day 3 of a 17-day guide. The companion's body is paywalled, so this summary covers its free preamble, the walkthrough's narration and the vendor documentation. Every structural claim below was checked against OpenCode's own V2 documentation (Agents, Permissions, TUI, CLI), not against the walkthrough's description of it.

The claim worth taking seriously

The walkthrough's thesis is one sentence: telling a coding agent to "just plan" is a request the model may ignore, whereas a planning agent is a deny rule the server enforces — and that difference is what turns a plan into an artifact you can review, commit and hand to a build step.

This is a real architectural distinction, and the vendor documentation supports it. In this harness an agent is not a prompt preset: it is a named profile combining a system prompt, a model preference, permissions, and display details. Permissions are evaluated outside the model's control. A planner that cannot edit is therefore a different kind of object from a planner that has been asked not to edit.

How the enforcement actually works

Four properties matter when you design around it.

Rules are ordered, last match wins. A permission rule is three strings — action, resource, effect (allow / deny / ask). Broad rules come first and specific exceptions follow, because the last matching rule decides. The documented example is instructive: ask before any shell command, allow git status * and git diff *, deny git push *.

The default is ask, not allow. If no rule matches, the operation waits for a client decision. That makes an incomplete ruleset noisy rather than silently permissive — the right failure direction.

Multi-resource operations resolve pessimistically. A patch touching several files checks several resources: any deny denies the whole operation; otherwise any ask asks; otherwise it proceeds. A single protected path is enough to stop a sweeping edit.

Actions are strings, and the resource is not always what you'd guess. Built-in tools use read, edit, glob, grep, shell, subagent, skill, question, webfetch, websearch, generate_image, external_directory, and <server>_<tool> for MCP tools. Two mappings catch people out: grep's resource is the requested regular expression, not the path being searched; and shell's resource is a scanner-produced command string, where a compound command may produce several strings. Patterns are whole-value wildcards (* spans /), matched against the entire normalized path, case-insensitive on Windows.

The built-in planning agent is described by the vendor in terms that are precise and, read carefully, narrower than the slogan: it "explores and plans without editing normal project files", it "may write ... plan files when asked", and "shell commands remain permission-controlled".

The two doors that stay open

Those two qualifications are the whole design risk, and they are documented rather than hidden.

Plan files are writable. The planner is fenced away from normal project files, not from the filesystem. If your plans directory lives inside the repository — which is exactly what the committable-spec workflow wants — then a "read-only" planner can still create tracked content. That is usually the intent; it stops being the intent the moment anything in that directory is executable, is a config file, or is consumed by CI.

Shell is not fenced by the agent, only by your rules. "Permission-controlled" means the default policy applies, and the default is ask. An operator who has broadly allowed shell commands for convenience has a planning agent that can still run them. The walkthrough's own remedy is the correct one: define a custom planner whose frontmatter denies both edit on * and shell on *, rather than relying on the built-in. Custom agents are plain Markdown with permission frontmatter, discoverable per-project or globally, and a built-in can be overridden by reusing its id.

A third door is worth adding, which the walkthrough does not mention: a path outside the active location and its worktree is checked against external_directory, and the default policy allows it. External paths are not prompted unless you add a rule. A planner constrained inside the project is not thereby constrained outside it.

The workflow the enforcement buys

The demonstrated loop is short and worth stating as a pattern, because the permission boundary is what makes each step meaningful:

  1. Resume the prior session by its id, not by "most recent".

  2. Switch to the planning agent and confirm the footer label before submitting anything.

  3. Get a numbered plan that names the rule order it intends and the paths it will touch, with the working tree still clean.

  4. Check that the tree really is clean (a short status that prints nothing) before copying anything in.

  5. Copy the plan into the repository as a file — this is the artifact the build step receives.

  6. Have the build agent write the failing test first, then the minimal fix.

  7. Re-run the suite yourself at the prompt, and diff the result against the plan in a second terminal.

  8. Commit source, tests and plan together.

Step 5 is the point of the whole exercise: the plan stops being conversation state and becomes a reviewable, diffable, committed spec. Steps 4 and 7 are the independent checks that keep the claim honest — the agent's report and the tree's state are two different sources.

Review checklist

Where the walkthrough is weaker than its premise

The three-minute format carries the architecture well but leaves two things unverifiable. The mechanics of resuming by id are shown as tool output rather than documented flags — the CLI overview page does not list the session flag, so the resume invocation rests on what the tool itself prints, which is reasonable evidence but not specification. And the "one gap they leave open" framing presents the shell exposure as a discovery, when the vendor states it plainly in the agent's own description. The finding is real; its novelty is not.

The keyboard affordance deserves the same care the walkthrough gives it: the shortcut cycles agents rather than toggling a planning mode, so the only reliable confirmation is the label, not the keypress count. That is the same hazard a parallel harness exhibits, and reading the label is the general answer.

Connections

See R389 on the knowledge map

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.