Claude Code Auto Mode Guide: Billing Change & Gateway Compatibility
Last verified 2026-11-04. Scope: Claude Code 2.1+ — the auto-mode behaviour below was observed on v2.1.309 (2026-10-23); the CodeGateway gateway path was re-tested end to end against v2.1.296 (2026-10-14, /v1/messages 3/3 probes HTTP 200). Claude Code ships fast, so treat the flags below as a 2.1+ baseline: run claude --version first, then compare against the official Claude Code documentation and the official changelog if a behaviour differs on your build.
Quick answer
Three questions dominate this topic, so here they are up front — the details follow below.
- Does auto mode cost more? Sometimes, and usually because of the gateway. When the API performs the classifier review itself, it rides along with your session's own requests and is not billed separately. Behind a gateway or proxy, Claude Code makes its own classifier requests instead, and those count toward your token usage — typically under 5% of total token consumption on a typical task. The task itself — many tool calls, large file reads — is the real cost driver, not the permission mode.
- Why does auto mode behave differently when I put a gateway in front? Because the classifier checks have to reach the API intact, and a gateway in the path can break them. Where the API performs the checks itself, they ride along inside your session's own model requests at no charge. A gateway that strips or rewrites headers, drops fields it does not recognize, or edits responses stops those checks from arriving, and Claude Code then issues its own classifier requests instead - those count toward your token usage, and Claude Code prints a notice naming the gateway when it can identify one. The fix is a path to the API that leaves those requests and responses unchanged.
- What endpoint should I use? For CodeGateway that is ANTHROPIC_BASE_URL=https://api.codegateway.dev with an ANTHROPIC_AUTH_TOKEN starting with sk-cg-. Not the OpenAI-compatible https://api.codegateway.dev/v1 path, and not a local proxy that only speaks /v1/chat/completions.
- Auto mode or --dangerously-skip-permissions? Auto mode if a human is in the loop. --dangerously-skip-permissions only inside a Docker sandbox when nothing can answer a prompt. The decision tree is in the section below.
- Lacking an official API key, or facing overseas card payment issues? Get a CodeGateway key instead — see Get a CodeGateway key and switch the endpoint further down.
What auto mode is, and what the classifier actually checks
Claude Code ships several permission modes, and three of them decide whether a run can go unattended. Manual mode — called default in the CLI — asks you about every action. Auto mode hands that decision to a separate AI classifier — a dedicated model, run outside your main conversation, that reviews each tool call before it executes. --dangerously-skip-permissions skips the review entirely. Auto mode is the middle ground: it is the only mode that keeps a safety net while letting unattended-ish work proceed.
The classifier evaluates each pending tool call against three risk criteria:
- Scope escalation — is Claude attempting more than you asked for?
- Untrusted infrastructure — is the action targeting a system the classifier does not recognise?
- Prompt injection — does the action look like it was triggered by hostile content Claude read somewhere?
Routine actions — editing a file in the current repo, running the test suite, a local command — are approved silently. Risky actions — mass deletion, writing to credential files, pushing to a protected branch — are blocked and Claude is asked to try a different approach instead of escalating to you.
Two details that matter in practice. First, a safety circuit breaker: if Claude is blocked three times in a row, or twenty times in a session, Claude Code falls back to prompting you directly, so a repeatedly-refused operation cannot loop forever. Second, the classifier is deliberately reasoning-blind: it sees your messages and Claude's tool calls, but not Claude's own reasoning or the tool output. A malicious file Claude reads therefore cannot talk the classifier into approving it.
What auto mode costs you
This is the part that changes week to week, and the part most write-ups get wrong. Where the API performs the classifier review itself, that review rides along with the session's own model requests and is not billed separately. Put a gateway or proxy in the path, and Claude Code has to make its own classifier requests instead — and those are billed to you as ordinary token usage.
That second case is the one to watch. Claude Code prints a notice when the session falls back to its own classifier requests, and it names the gateway when it can identify one. The extra model pass is small but not free: measured on typical multi-step tasks, the classifier overhead lands under 5% of total token consumption. The opposite framing is the important one: a 40-step agentic run costs several times what a single-turn chat costs, and switching permission modes changes the small term, not the large one.
As of 2026-11-04 · Claude Code 2.1+ — the overhead share above is a dated snapshot; upstream prices and task shape move it, so re-check before you budget a long session. The per-model rates below were verified against the official pricing pages on 2026-10-14.
The second cost is where auto mode runs actually get expensive — cache reads. Every turn re-sends the conversation so far. Without prompt caching that context is re-billed as fresh input on every single tool call. With caching it is billed at the cache-read rate, which CodeGateway prices separately from input and at a lower rate. Auto mode multiplies the number of tool calls, so it multiplies the number of cache reads — which is exactly why the cache-read column matters more for Claude Code than for ordinary chat traffic. The live cache write and cache read rates for every model are on the pricing page.
Current per-token rates on CodeGateway, in USD per million tokens:
Model | Input | Output | Cache write | Cache read |
|---|---|---|---|---|
claude-sonnet-5-5 | $2.00 | $10.00 | $2.50 | $0.10 |
claude-sonnet-5 | $2.00 | $10.00 | $2.50 | $0.20 |
claude-haiku-5-5 | $0.10 | $0.50 | $0.125 | $0.01 |
claude-opus-5-5 | $4.00 | $20.00 | $5.00 | $0.20 |
Two things to know about that table. First, cache reads are priced on their own line, below input: claude-sonnet-5-5 bills cache reads at $0.10 per million against a $2.00 input rate, so a cache-heavy session pays the cheaper rate for the context it keeps re-sending. Second, claude-haiku-5-5 crosses into a 5x band above 100K prompt tokens on input and output ($0.50 / $2.50 / $0.05 cache read); Sonnet 5.5 and Opus 5.5 have no long-context band in the current rate table, which matters if you run Haiku over a large repository.
On top of the official rates, CodeGateway applies a flat 1.07x markup to every request and a 2% service fee on top-ups. The markup is the same for every account — there are no tiers and no volume discounts, so the rate you see today is the rate you keep. The full explanation is in our flat markup walkthrough, and the live per-model rates are on the pay-as-you-go pricing page.
To see what a run actually cost, ask for the metadata rather than estimating it: --output-format json returns token usage per run, which is what you want for a CI budget check or a nightly cost report.
Run Claude Code through a gateway: the compatible-endpoint setup
The symptom: a gateway in the path changes who runs the classifier
Here is the failure that gets reported most often, usually as "Claude Code says this session isn't eligible for auto mode's no-charge classifier requests". Claude Code is pointed at a local or third-party gateway - a proxy on 127.0.0.1:15721 is the classic example - and there are two different problems hiding behind that setup. The first one is the endpoint: Claude Code speaks the Anthropic Messages protocol, so your base URL has to serve /v1/messages, and an OpenAI-compatible surface (/v1/chat/completions) is not a substitute for it. The second one is the gateway in the path: the endpoint works, your chat traffic works, and the classifier checks still stop arriving. Upstream names two causes for that: a gateway that rewrites requests or responses, and server-side checks that have not reached your platform, region, or credential yet. That second problem is the quiet one, and it is what this section is about.
Ordinary chat traffic survives a gateway that works, so everything looks fine: prompts work, tools fire, responses come back. What breaks is narrower and easier to miss. Auto mode's classifier checks ride inside your session's own model requests - wherever the API performs them, they happen as part of those requests, at no charge. A gateway can quietly break that. If it strips or rewrites the headers Claude Code sends, drops fields it does not recognize, or edits the responses on the way back, the API's checks never reach your session. Auto mode keeps working, but Claude Code issues its own classifier requests instead, and those are billed to your account. Claude Code also prints a notice at that point, and when it can identify the gateway in the path, the notice names it.
The result is a specific and confusing behaviour:
- The session starts and prompts are accepted, so the base URL looks correct.
- Auto mode still runs, but the first checked action is held for you to answer, and a notice explains why - the classifier is no longer being done server-side.
- Switching to default mode makes the notice disappear entirely, which pushes you towards blaming the classifier rather than the gateway.
The rule that explains all three symptoms: the classifier checks have to reach the API intact. A gateway that passes traffic through unchanged keeps the API's own checks in place. Where the upstream accepts the request format the gateway receives, Claude Code expects the gateway to forward requests and responses unchanged: it forwards the anthropic-beta header and the safeguards body field together, because the two travel as a pair, and it returns responses and streaming events without dropping fields or rewriting tool-use IDs, keeping the safeguard_results field. A gateway that rewrites either direction loses the server-side checks, and a gateway that cuts responses short gives you denials with no verdict. CodeGateway serves the Anthropic Messages protocol directly, so there is no local proxy for you to configure or debug.
The fix: point Claude Code at an Anthropic-compatible base URL
Set the base URL and the token in your Claude Code settings. This is the same configuration our setup script writes for you.
// ~/.claude/settings.json - Claude Code on CodeGateway
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.codegateway.dev",
"ANTHROPIC_AUTH_TOKEN": "sk-cg-YOUR_KEY"
}
}For a quick test without touching any file, export the same two variables in your shell:
export ANTHROPIC_BASE_URL="https://api.codegateway.dev"
export ANTHROPIC_AUTH_TOKEN="sk-cg-YOUR_KEY"
claude --version # confirm the Claude Code build first
claude # then start a session and switch to auto mode with Shift+TabThat is the whole fix. Auto mode has no extra setting of its own, and with CodeGateway there is no local proxy for you to configure or debug: the Anthropic Messages surface (/v1/messages) is served directly. If you do have to run your own gateway in front, it has to forward the anthropic-beta header and the safeguards body field unchanged, because the two travel as a pair, and hand responses back without dropping fields or rewriting tool-use IDs. Whether the server-side checks then run on your account is decided upstream, by your platform, region, and credential - it is not something the endpoint you point at can promise.
If your own gateway cannot pass those checks through, you can tell Claude Code not to ask the server for them: set CLAUDE_CODE_AUTO_MODE_SERVER to 0 before you start the session. Classifier requests are then always Claude Code's own, they are billed the same way, and the notice does not appear.
Which models work on which surface
This trips people up constantly, so it is worth being explicit. CodeGateway exposes an Anthropic-compatible surface and an OpenAI-compatible surface, and each one serves a different set of models. Claude Code speaks the Anthropic protocol, so it needs the Anthropic surface.
- Anthropic surface (/v1/messages) — serves Claude-family and Gemini-family models, and returns a correct Anthropic response shape. This is the surface Claude Code requires.
- OpenAI-compatible surface (/v1/chat/completions) — serves DeepSeek, Kimi, GLM and Qwen models. Claude and Gemini models are not available here, and non-Claude models returned on this surface come back in OpenAI shape, which Claude Code may fail to parse.
If you also run a Codex CLI workflow, that is a different surface and a different base URL — see the Codex CLI guide for the exact settings rather than reusing the ones above.
1M-context models on the gateway
Five Claude models are served with a 1M-token context window on CodeGateway: claude-sonnet-5-5, claude-opus-5-5, claude-sonnet-5, claude-opus-5, and claude-fable-5-1. The client cannot read that from the gateway, so Claude Code assumes 200K and auto-compacts long sessions. Three client-side steps unlock the real window — worth doing for any repository-sized auto mode run:
# 1. enable gateway model discovery (once)
export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1
# 2. restart Claude Code - discovery runs once and is cached in
# ~/.claude/cache/gateway-models.json
# 3. pick the "(1M context)" entry in /model, or pin it as the default
export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-5-5[1m]'
# likewise ANTHROPIC_DEFAULT_OPUS_MODEL / ANTHROPIC_DEFAULT_FABLE_MODELGet a key and switch the endpoint
Everything above needs one thing: a working Anthropic-compatible endpoint with a key behind it. If you are lacking an official Anthropic API key, or facing overseas card payment issues, CodeGateway gives you an sk-cg- key and a CodeGateway-compatible Anthropic endpoint instead:
- Sign up and create an API key in the CodeGateway dashboard — the key starts with sk-cg-.
- Put it in ANTHROPIC_AUTH_TOKEN and set ANTHROPIC_BASE_URL=https://api.codegateway.dev — the two lines above, nothing else to configure.
- Billed per token at the rates in the table above, plus the flat 1.07x markup - one flat rate for every account.
If you are pointing a desktop client at a local proxy instead of a hosted endpoint, the proxy side of that setup has its own quirks — read the Claude Desktop developer mode and API proxy guide before you copy the Claude Code values into it.
Auto Mode vs --dangerously-skip-permissions: a decision tree
Work through this in order and stop at the first answer that fits:
- Can a human answer a prompt within a minute? If yes, use Auto Mode — or default mode if you want to watch every single step. The classifier will handle the routine approvals and escalate only the risky ones.
- Is the run headless (CI runner, cron job, no terminal attached)? If yes, --dangerously-skip-permissions is the only option that will not hang — but you must have a sandbox around it. If you cannot give it a sandbox, the run has to stay interactive.
- Can the run be given an isolated working copy (a Docker container, a scratch clone, a disposable branch)? If yes, --dangerously-skip-permissions plus --print inside that sandbox is safe enough for CI. If no, do not use it.
- Does the task touch credentials, production data, or a protected branch? If yes, neither mode is the right tool. Split the task so the dangerous part is a separate, human-approved step.
The same decision, as a lookup table:
Scenario | Use | Why |
|---|---|---|
Daily coding, fewer interruptions | Auto Mode | Classifier clears the routine approvals; you stay in the loop for anything risky |
A local script that touches one repo | Auto Mode | No container setup needed, and the destructive operations still get blocked |
GitHub Actions / GitLab CI | --dangerously-skip-permissions + Docker | Headless runners cannot answer a classifier escalation |
Scheduled overnight batch | --dangerously-skip-permissions + Docker | The container is the safety boundary, exactly as it is in CI |
Exploring an unfamiliar codebase | Default mode | Maximum visibility into every action Claude takes |
Turn auto mode on
Session toggle
During an interactive session, press Shift+Tab to cycle through the permission modes. To start a session directly in auto mode:
# start a session, then Shift+Tab until the status bar shows auto mode
claude
# or launch directly in auto mode
claude --permission-mode autoDefault for every session on this machine
Write the mode and your gateway settings into your user-level settings file. This one file also carries the endpoint configuration, so a fresh machine only needs the key swapped in:
// ~/.claude/settings.json - personal default for every project on this machine
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.codegateway.dev",
"ANTHROPIC_AUTH_TOKEN": "sk-cg-YOUR_KEY"
},
"permissions": {
"defaultMode": "auto"
}
}What a committed project file can and cannot set
Commit a project-level file so everyone who clones the repo points at the same endpoint. Keep the key out of it — the base URL is fine to commit, the token is not:
// .claude/settings.json - committed with the repository, no secrets
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.codegateway.dev"
}
}One caveat, and it catches people out: Claude Code does not take "auto" from a project or local settings file. The auto and bypassPermissions values of permissions.defaultMode only take effect in your user-level or managed settings, so teammates who clone the repo still switch auto mode on themselves — in ~/.claude/settings.json as above, or per session with claude --permission-mode auto. What a committed project file can carry is the endpoint and the allowlist:
// .claude/settings.json - an allowlist for known-safe tools
{
"permissions": {
"allow": [
"Read",
"Glob",
"Grep",
"Bash(git status *)",
"Bash(npm test *)"
]
}
}The allowlist keeps the classifier out of the loop for the tools you have already decided are safe, which removes both the latency and the token cost of the review on those calls. One exception: tool-wide and wildcard rules such as "Bash(*)" or "Bash(python *)" are still sent to the classifier, because a rule that broad can run arbitrary code. Command-specific rules like the two above skip the review.
Headless runs: --print and --dangerously-skip-permissions
When you need true headless operation — no classifier, no prompts, output on stdout — combine the two flags. --print (or -p) writes the final response to stdout and exits; the exit code is 0 on success and non-zero on error, which is what CI conditional logic expects.
# one-shot, non-interactive run
claude --dangerously-skip-permissions --print "summarise the diff on this branch"
# feed context in on stdin instead of writing a temp file
git diff origin/main...HEAD | claude --dangerously-skip-permissions --print "review this diff and list only correctness bugs"Pick the output format you actually need:
# plain text (default) - human readable
claude --dangerously-skip-permissions --print "explain this module"
# JSON - machine readable, includes token usage metadata
claude --dangerously-skip-permissions --print --output-format json "explain this module"
# streaming JSON - tokens as they arrive
claude --dangerously-skip-permissions --print --output-format stream-json "explain this module"Note that --print waits for the complete response before writing anything, so it is not a token-by-token stream. Use --output-format stream-json if you need incremental output, and remember that the result is JSON events rather than plain text.
Four CI recipes
1. Review every pull request
The pattern is the same every time: set the Anthropic-compatible base URL and the token in the job environment, then call the CLI in print mode. Here it is as a GitHub Actions workflow:
name: claude-review
on:
pull_request:
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Review the diff
env:
ANTHROPIC_BASE_URL: https://api.codegateway.dev
ANTHROPIC_AUTH_TOKEN: ${{ secrets.CODEGATEWAY_API_KEY }}
run: |
git diff origin/${{ github.base_ref }}...HEAD > pr.diff
claude --dangerously-skip-permissions --print \
"Review pr.diff. Report only correctness bugs, one per line, no prose." \
< pr.diff2. Bulk refactor across a large codebase
# always inside the container, never against your working tree
docker run --rm \
-v "$PWD:/workspace" \
-w /workspace \
-e ANTHROPIC_BASE_URL=https://api.codegateway.dev \
-e ANTHROPIC_AUTH_TOKEN="$CODEGATEWAY_API_KEY" \
my-claude-image \
claude --dangerously-skip-permissions --print \
"Migrate every call to the old client helper to the new one. Do not change behaviour."3. A nightly quality check on a schedule
Write the job as a script so cron owns the schedule and the script owns the error handling:
#!/usr/bin/env bash
# scripts/nightly-quality-check.sh - run from cron, never by hand
set -euo pipefail
export ANTHROPIC_BASE_URL="https://api.codegateway.dev"
export ANTHROPIC_AUTH_TOKEN="${CODEGATEWAY_API_KEY:?CODEGATEWAY_API_KEY is not set}"
REPORT="$(mktemp -t nightly-review.XXXXXX.md)"
trap 'rm -f "$REPORT"' EXIT
cd "${1:?usage: nightly-quality-check.sh <repo-dir>}"
claude --dangerously-skip-permissions --print \
"List every TODO comment added in the last 30 commits, grouped by module. No prose." \
> "$REPORT"
if [ -s "$REPORT" ]; then
curl -sS -X POST "$SLACK_WEBHOOK_URL" \
-H 'Content-Type: application/json' \
-d "{\"text\": \"Nightly review found new TODOs\"}"
fiAnd the crontab entry that runs it at 03:17 every Monday — an odd minute on purpose, so it does not collide with every other scheduled job on the box:
# crontab -e
17 3 * * 1 /home/ci/scripts/nightly-quality-check.sh /srv/checkouts/main >> /var/log/nightly-review.log 2>&14. Generate API documentation
claude --dangerously-skip-permissions --print \
"Read src/ and write docs/api-reference.md. One section per exported module." \
> docs/api-reference.mdWhat must never run unattended
Auto mode is not a safety guarantee, and neither is the flag that skips it. These operations should never run unattended in any mode, because the classifier approves based on context it can see, and context is exactly what an unattended run does not have:
- Connecting to production databases — including read-only ones, because generated SQL can still be wrong in ways nothing catches.
- Reading or writing .env files, *.pem files, credential stores or SSH keys.
- Pushing to main or any protected branch.
- Deleting files outside an isolated scratch directory.
- Calling production API endpoints with real credentials.
Sandbox with Docker
If you are going to use --dangerously-skip-permissions, this is the minimum setup:
FROM node:22-slim
# the CLI has to be in the image, or the run below cannot find it
RUN npm install -g @anthropic-ai/claude-code
# run as a non-root user with a writable scratch dir
RUN useradd -m -u 1000 claude
USER claude
WORKDIR /workspace# build it once
docker build -f Dockerfile.claude-sandbox -t my-claude-image .
# run a task with only the directory it is allowed to touch
docker run --rm \
-v "$PWD:/workspace" \
-w /workspace \
-e ANTHROPIC_BASE_URL=https://api.codegateway.dev \
-e ANTHROPIC_AUTH_TOKEN="$CODEGATEWAY_API_KEY" \
my-claude-image \
claude --dangerously-skip-permissions --print "list the files in src/"For a task that has to write to your actual codebase, mount only the specific directory it needs rather than the whole repo.
Auto mode with sub-agents
Auto mode is the permission layer that makes sub-agents practical. When Claude orchestrates several sub-agents, each one runs its own tool calls. Without auto mode or --dangerously-skip-permissions, every sub-agent would pause on every file operation and the orchestration would never finish.
The setup that tends to work:
- Orchestrator — auto mode, so the classifier keeps a light watch over the plan.
- Sub-agents on isolated scopes — --dangerously-skip-permissions inside a sandboxed directory, because their blast radius is already contained.
The sub-agent side of the setup — how many to spawn, how to hand context between them, and how to keep their scopes from overlapping — is covered in the advanced techniques guide.
FAQ
Q: What is the difference between Auto Mode and --dangerously-skip-permissions?
Auto mode has an AI classifier review each action and block the risky ones; --dangerously-skip-permissions skips every check. Auto mode is the safe choice for interactive work. --dangerously-skip-permissions is for headless CI, where the sandbox is the safety boundary and there is nobody to answer a prompt.
Q: Does auto mode work through a gateway?
Yes - provided the gateway passes the classifier checks through unchanged. Auto mode's checks ride inside your session's own model requests, so a gateway that strips or rewrites headers, drops fields it does not recognize, or edits responses stops them from reaching the API. Auto mode keeps working, but Claude Code then issues its own classifier requests instead, they are billed to your account, and Claude Code prints a notice naming the gateway when it can identify one; a gateway that cuts responses short gives you denials with no verdict instead. Claude Code also speaks the Anthropic Messages protocol, so your base URL has to serve /v1/messages - an OpenAI-compatible surface (/v1/chat/completions) is not a substitute.
Q: Does auto mode cost more tokens?
Slightly. Each tool call adds a classifier pass on top, which is typically under 5% of total token consumption on a typical task. The larger driver is the task shape itself - multi-step agentic work costs several times a single-turn conversation regardless of permission mode. Cache reads usually matter more than the classifier pass, so compare the cache read column on the pricing page before you pick a model.
Q: Does --dangerously-skip-permissions share conversation history between runs?
No. Each --dangerously-skip-permissions --print invocation is stateless - no history carries over between runs. If a task needs context from a previous run, pass it explicitly in the prompt or through stdin.
Q: Can Claude delete my files in --dangerously-skip-permissions mode?
Yes. If the task description implies cleanup - "remove unused files", for example - Claude may delete files. Run it in a container or an isolated directory, never against your production repo root.
Q: Which API key should I use in CI?
A CodeGateway key, with ANTHROPIC_BASE_URL pointed at the Anthropic-compatible endpoint - https://api.codegateway.dev - and the key supplied as ANTHROPIC_AUTH_TOKEN. GitHub-hosted, self-hosted and cloud runners all reach it over the same global edge, so the runner location does not change the setup. Secrets belong in the CI secret store, never in the workflow file.
Q: Does --print support streaming output?
--print waits for the complete response before writing to stdout. For token-by-token streaming use --output-format stream-json, and remember the output is JSON events rather than plain text.
Q: What happens if a task fails halfway through?
--dangerously-skip-permissions has no built-in checkpointing. Put explicit error handling in the prompt - "if a file fails to process, log it to errors.log and continue with the next file" - and for critical pipelines break the task into smaller steps that each have their own verification.
Related reading
- Claude Code quickstart — the five-minute version, if you have not run Claude Code at all yet.
- Claude Code advanced techniques — the deeper dive behind the sub-agent setup above.
- Claude Code MCP server setup — connecting external tools to Claude Code once the permission mode is sorted out.
- Claude Desktop developer mode and API proxy — for the desktop client, where the local proxy sits between the app and the endpoint.
- OpenAI Codex CLI guide — the OpenAI-compatible side of the same gateway, if you run both CLIs.
- CodeGateway pay-as-you-go pricing — the live per-token rates behind the table in this article.
- Anthropic Claude Code documentation — the upstream reference for every flag and default mentioned here.
- Upstream: auto mode classifier request charges — the official note on when classifier requests are billed, and on the notice Claude Code shows when a gateway makes it issue them itself.
- Upstream: permission modes — the mode list, the Shift+Tab cycle, and how auto mode differs from the other modes.
