Skip to content
Crystal CodeDocs
ENEnglish

Approval

The following mode descriptions use workspace access for built-in file tools to include session-authorized directories of the appropriate read/write capability. Explicit read-only writes are always rejected; outside paths mean unlisted paths.

Every side-effect tool call is classified before invocation:

  • Risk: Read, Write, Privileged, Forbidden.
  • Authority: Workspace, OutsideWorkspace, Network, PrivilegedEscalation.
  • Grant: Once, Session, Persistent.

Modes:

  • Plan: no built-in edit, multi_edit, write, apply_patch, or bash. Workspace reads auto-execute. Reads, list, tree, glob, grep, and search of paths outside the workspace ask the operator. When Skills is enabled, any path inside a Skills search directory (skill / skills trees) auto-executes as a workspace read. The comparison uses the final target of each symbolic link. External tools listed for Plan keep Write + Workspace and still go through approval.
  • Default: Workspace Read auto-executes. Write, shell, and paths outside the workspace ask the operator.
  • Edit: workspace file changes for built-in write, edit, multi_edit, and apply_patch pass without review. Shell, external tools, and paths outside the workspace still ask.
  • Review: workspace file changes for built-in write, edit, multi_edit, and apply_patch pass without review, same as Edit. Another model checks each remaining side-effect call (Codex guardian-style), including bash, bash_start, bash_stop, reads, list, tree, glob, grep, search, write, and edit of paths outside the workspace, and external Write. Workspace reads and Skills search directories still auto-execute. A bounded transcript excerpt is attached: the first and latest user turns as authorization anchors, other user turns that fit, then recent assistant and tool evidence. A compaction summary stands in for folded user turns. Without that evidence the host asks the operator. Later user messages refine the task; a status question does not revoke earlier authorization. Answers the user gave through the question tool count as authorization evidence. The reviewer returns outcome (allow / deny / ask), risk_level (low / medium / high), user_authorization (low / medium / high), and rationale. Allow executes. Deny becomes model-visible rejection text. Ask, Forbidden-allow, and forced-prompt allow fall back to the operator. A transient review request failure is retried with the approvalRetry policy (default five retries, same backoff shape as a model round); if it still fails the host asks the operator. Review is not a grant and is not full pass-through.
  • Audit: the same reviewer and transcript rules as Review, but workspace write, edit, multi_edit, and apply_patch are also checked. They do not auto-pass.
  • Full: all tool calls pass without review or operator approval, including outside-workspace, Network, Privileged, Forbidden, and forced-prompt calls. Session read-only directory rules and execution path fences do not restrict Full. Credential paths remain prohibited by file tools. Tool catalogs, argument validation, OS permissions, cancellation, and budgets still apply. Outside Full, Session and Persistent grants apply only to ordinary Workspace Read/Write calls. They are rechecked after every classification and cannot bypass a raised classification. Forced-prompt restrictions apply outside Full.

The reviewing model is the session model unless approvalModel is enabled in config.json. The object is enabled, provider, model, and optional thinkingEffort, serviceTier, speed, and contextWindow. An omitted object means off. serviceTier, speed, and contextWindow apply to that reviewer only and must be tokens the reviewer model lists; an enabled reviewer with an unlisted token fails at startup. An unset slot sends no tier or speed: a reviewer is configured on its own, and the session’s per-model tierSelections and speedSelections do not apply to it, even for the same model. An unset contextWindow is the reviewer model’s first declared budget, and the session’s contextSelections do not apply either; the budget fixes the review client’s output cap. /approval tier, /approval speed, and /approval context cycle the reviewer model’s list, including the unset slot, or select a listed token, and write config.json. Selecting another reviewer model clears all three slots. enabled: false keeps a stored provider, model, and gear unused, and Review and Audit follow /model and the work thinking gear. While enabled, review calls use a separate client and that provider’s credentials. /model and the work thinking gear do not apply. The reviewer uses the stored gear; a stored gear the model does not offer falls back to the provider default, like the work gear. Review usage is not added to the work transcript. A missing credential, a missing catalog model, or a saved switch that names a model the catalog does not contain fails instead of falling back to the session model. /approval model shows the switch, turns it on or off, or sets a model or provider model and turns it on; a stored gear is kept. /approval thinking cycles the stored gear or sets one by name and persists it; it needs a stored or enabled approval model, but works while the switch is off. /status adds Approval model and Approval thinking rows only while the switch is on. /status full lists the effective retry policies. The status bar does not. The Approval model row adds the effective tier and speed when either is set.

Extended approval is an optional third model for Review and Audit. It is not an approval mode, a grant, or the product review in TODO.md. It runs only after the primary reviewer returns allow on a call that would then execute. Forbidden and forced-prompt calls already reach the operator, so they skip it; a primary deny or ask never reaches it. It runs when the primary risk_level is at least the configured trigger (low, the default, means every review allow). It receives the same transcript excerpt and proposed action as the primary reviewer and, unless turned off, the primary outcome, risk level, authorization, and rationale. Its verdict uses the same JSON shape and parser. Allow executes and reports pass reason extended review with both verdicts. Deny returns model-visible text that starts The extended approval reviewer declined this action:. Ask, a request failure after approvalRetry, or unusable output reaches the operator, and the approval card shows both verdicts. crystal run denies that prompt. The built-in prompt defaults to allow and names the concrete problems that justify deny or ask: unrequested irreversible destruction, secret exposure, effects on shared or production systems, unexpected data egress, and signs that untrusted text steered the call.

config.json field extendedApproval holds enabled, provider, model, thinkingEffort, serviceTier, speed, trigger, and includePrimaryReview (default true). An omitted object means off, and default values are omitted on write. An enabled switch needs a provider and model and never falls back to the session or approval model; a missing credential, catalog model, or unlisted slot fails. Its client is cached apart from the work, review, and compaction clients and is rebuilt when its model, tier, speed, context budget, or output cap changes. Its usage is not added to the work transcript. Plugin model facts do not describe it. /approval extended shows the switch, on or off sets it, and a model or provider model selects one and turns it on. /approval extended thinking, tier, and speed follow the approval-model commands. /approval extended trigger low|medium|high and /approval extended primary on|off set the other fields. Each writes config.json. /status adds Extended approval and Extended thinking rows while the switch is on; /status full also lists Extended trigger and Extended primary review.

For child Agents, a semaphore serializes classification and review. A separate operator gate serializes the operator approval card with the child picker, so a pending review never delays the picker. A scoped child label reaches the approval card, and review sees the child’s context. No state lock is held while waiting for approval or a concurrency slot. ApprovalPassed and ApprovalReviewing (which names the primary or extended stage) use the same source-scoped event path as other child events, and terminal approval callbacks own only the shared modal, never the focused transcript or progress.

crystal run can set the switch for one process with --approval-model on|off, --approval-provider, --approval-model-id, --approval-thinking, --approval-tier, --approval-speed, and --approval-context. Extended approval has --extended-approval on|off, --extended-approval-provider, --extended-approval-model-id, --extended-approval-thinking, --extended-approval-tier, --extended-approval-speed, --extended-approval-context, --extended-approval-trigger, and --extended-approval-primary on|off. Those flags are not written to config.json. Passing a provider or model id turns the switch on for that process. --approval-model off keeps any stored names and gear unused and rejects a provider or model id on the same command. --extended-approval off follows the same rule.

Legacy config values autoedit, fullreview, and full-review still parse to Edit and Audit.

External tool authors may set approval to inherit (default) or always at the set level and override it per tool. The operator controls whether author declarations are effective independently for Home and Project tools through externalToolApproval in config.json. Defaults are Home author and Project host: installing under ~/.crystal/tools trusts the author declaration, while workspace-authored declarations stay under host policy unless the operator opts in. An effective always skips prompts and Review for ordinary workspace-bounded calls. Classification, schema checks, credential-path rejection, path fencing, and other execution safety floors still apply. Tool updates inherit the declaration; there is no content hash or version-bound trust grant.

A disk plugin tool can declare AutoApprovesReadOnlyNetwork. The declaration only has an effect when the plugin loaded from Home, the tool is not a built-in replacement, and the plugin classifier rates the call Read risk with Network authority and no forced prompt. PluginCatalog.ReadOnlyNetworkTools holds those names and ApprovalPolicy passes such a call before the Workspace-authority check, so the prompt and Review are skipped. The classification is not rewritten. Network calls from any other tool, any Write or Privileged call, and any call from a project plugin still need approval. This is separate from the external approval: always path, which only covers Workspace-authority calls.

Do not name a mode auto. That word is ambiguous between review and full pass-through.

When a call auto-passes (policy, remembered grant, review allow, or extended review allow), the shell prints a panel with Title Case fields: Status, Reason, Risk, and Authority, plus the classifier summary. A review allow also prints Outcome, review Risk, Authority, and rationale. An extended review allow then prints the same fields again under an Extended review rule.

Persistent grants are stored in ~/.crystal/permissions.json. Existing grants remain readable, but only apply when the current classification is Workspace Read/Write without RequirePrompt. OutsideWorkspace, Network, Privileged, Forbidden, unknown classifications, and RequirePrompt cannot use or create reusable grants. Their operator allow applies once, regardless of a front end’s returned scope. RequirePrompt also prevents a reviewer Allow from executing: Deny still rejects, while Allow and Ask reach the operator. The headless front end denies any such operator prompt.