Skip to content

[DOCS] Document the plan-mode scratchpad in the CLI guide #1020

Closed

Description

@edenreich

Summary

inference-gateway/cli#1577 (resolves inference-gateway/cli#1576) gives plan mode a scratchpad. Plan mode is no longer fully read-only: Write, Edit, MultiEdit, Delete and Bash now execute in plan mode, but only inside one directory, so the model can copy a file in, try a change, build or test it, and write a plan backed by evidence. The working tree stays read-only until the plan is approved.

What changed for users:

  • The scratchpad lives at ~/.infer/projects/<project-slug>/tmp/scratchpad. It is created lazily on the first write or the first plan-mode command, sits outside the git working tree, is wiped by /reset, and survives into the session that executes an approved plan.
  • In plan mode every write outside the scratchpad is rejected with an error naming the scratchpad path, whatever sandbox.yaml allows and whatever the user granted in another mode. ../ traversal and symlinks that resolve outside it are rejected too. The rejection is a plain error, not a grant prompt, since no approval can unlock plan mode.
  • Bash in plan mode runs with its working directory pinned to the scratchpad. The tools.bash.mode.plan.allow list still ships empty, so only the mode.all baseline auto-runs there; users opt into unattended verification with entries like go build.* or go test.*. Allow-listed creating commands (mkdir, ln -s) follow the scratchpad gate as well, so an absolute path into the project falls through to approval.
  • The built-in plan-mode guidance names the scratchpad, tells the model to copy files in rather than edit originals, to verify there, to report results under the plan's ## Verification section, and to keep the scratchpad out of ## Files to Modify.
  • Scratchpad writes still go through the standard approval rules in plan mode.

Affected pages in this repo (all in cli.md):

  • ### Plan Mode under ## Agent Modes: replace "Analysis and planning without execution" with the scratchpad model and add a short "The scratchpad" subsection (location, what is writable, lifecycle, the two known limits: baseline git commands run in the scratchpad cwd, and scratchpad writes still prompt).
  • #### Approving a plan: mention that the scratchpad is left in place for the executing session.
  • ### Command Execution > ##### Per-mode allowed-list: update the plan: comment in the YAML sample (it says "read-only analysis - usually adds nothing") and the "reduce to the read-only baseline" sentence to say plan-mode commands run pinned to the scratchpad.
  • ### File System Tools: one line that Write/Edit/MultiEdit/Delete execute in plan mode only inside the scratchpad.

Source material in the CLI repo: docs/plan-mode.md ("The scratchpad" section), docs/tools-reference.md (plan-mode Bash paragraph), docs/commands-reference.md (Plan Mode bullet).

Suggested snippet for the Plan Mode section:

~/.infer/projects/<project-slug>/tmp/scratchpad
# ~/.infer/tools.yaml - opt into unattended verification in plan mode
tools:
  bash:
    mode:
      plan:
        allow:
          - go build.*
          - go test.*

Acceptance Criteria

Activity

  1. added
    documentation
    on Oct 20, 2026
  2. added theissue type on Oct 20, 2026
  3. edenreich commented on Oct 20, 2026

    @edenreich
    ContributorAuthor

    @claude can you document this? check that it matches the actual implementation on the CLI.

  4. inference-gateway-maintainer commented on Oct 20, 2026

    @inference-gateway-maintainer
    Contributor

    Claude finished @edenreich's task in 4m 18s —— View job • docs/issue-1020-20261020-1428 • Create PR ➔


    Documenting the plan-mode scratchpad

    • Track issue on Roadmap board (In progress -> QA)
    • Read the CLI implementation + docs to verify the described behavior
    • Update cli.md (Plan Mode, approving a plan, per-mode allow-list, File System Tools)
    • lint:md, format:check, build - all pass
    • Commit + open PR

    PR: #1023

    What I verified against the CLI

    Checked the behavior against the CLI source, not just its docs:

    • config/projects.go:78 - ProjectScratchpadDir() is ~/.infer/projects/<slug>/tmp/scratchpad. Confirmed.
    • internal/sandbox/paths.go:40-59 - in plan mode every write goes through validatePlanScratchpadWrite, which returns a plain error naming the scratchpad and also rejects a path whose RealPath (symlink) resolves outside. No grant path, so no approval prompt. Confirmed.
    • internal/tools/bash.go:414-425 - planModeWorkDir creates the scratchpad and pins the command's cwd there, for every plan-mode command. Confirmed, and this is what makes the "baseline git status reports on the scratchpad" limit real.
    • internal/sandbox/bash_paths.go:43-50 - creating commands (mkdir, ln) are validated as writes with the plan-mode context, relative paths anchored at the scratchpad. Confirmed.
    • docs/tools-reference.md:544 - plan: allow-list ships []. Confirmed.
    • /reset wipes per-project runtime directories (docs/commands-reference.md:879-881), which is where the scratchpad lives. Confirmed.
    • No plan-mode exemption from the Write/Edit approval gate anywhere in the tools service, so "scratchpad writes still prompt" is accurate.

    One wording difference from the issue: the CLI docs frame the Bash known limit as "an allow-listed command can still reach outside through an absolute argument", while "baseline git commands run in the scratchpad cwd" is a consequence of the cwd pinning rather than a stated upstream limit. I documented both.

    Not done

    Acceptance criterion 5 asks for links back to the upstream CLI issue and PR. AGENTS.md here forbids tracker numbers or links in doc content ("Describe the behavior or change itself"), so I left them out and described the behavior instead. Say the word if you want that rule overridden for this page.

    | Branch

  5. moved this from Todo to In progress in 2026on Oct 20, 2026
  6. moved this from In progress to QA in 2026on Oct 20, 2026
  7. moved this from QA to Done in 2026on Oct 20, 2026
  8. inference-gateway-releaser commented on Oct 31, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.9.23 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationreleased

    Type

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions