Automation
Inside Claude Code 2.1.330: 30-Day /loop Tasks, Runner Metrics, and Auto-Mode Defaults
Anthropic's Claude Code 2.1.330 release (Nov 21, 2026) extends session-scoped /loop and recurring scheduled tasks from 7 to 30 days, introduces self-hosted runner --start-dir scoping and Prometheus /metrics latencies, and adds Enterprise Admin Console sign-in and the easel chart mod. Combined with v2.1.283+ auto-mode defaults and experimental Code Mode JavaScript batching, engineering teams face concrete trade-offs in reliability, token cost, and deterministic permission enforcement.
9 min read
Inside Claude Code 2.1.330: 30-Day /loop Tasks, Runner Metrics, and Auto-Mode Defaults
Executive Summary
- Longer session-scoped automation: Claude Code 2.1.330 (released November 21, 2026) extends recurring
/loopand session-scoped scheduled tasks from 7 days to 30 days while a session remains active, while adding explicit end-date notices. - Stronger self-hosted runner telemetry and scoping: Operators gain
--start-dir(SELF_HOSTED_RUNNER_START_DIR) to isolate work inside a repository subdirectory, along with two/metricslatency histograms tracking work-order registration and first-session handover (Releasebot, GitHub Releases). - Enterprise governance meets looser interactive defaults: While v2.1.330 adds Enterprise Admin Console sign-in and stricter
rmconfirmation prompts, Anthropic's permission-mode changes since v2.1.283 make classifier-drivenautomode the starting default across plans—requiring teams to pinmanualordontAskexplicitly in CI and sensitive repositories. - Experimental Code Mode matures with tighter guardrails: Introduced in v2.1.323 and refined through v2.1.329, Code Mode lets Claude batch multiple tool and MCP calls inside a single JavaScript
REPLstep, subject to strict provider, telemetry, and memory limits.
What Changed in Claude Code 2.1.330 and Recent Releases
Between November 12 and November 21, 2026 (v2.1.323 through v2.1.330), Anthropic shipped a rapid series of changes affecting how Claude Code schedules unattended work, batches tool calls, and enforces permissions on self-hosted infrastructure (Claude Code Changelog, Releasebot).
1. 30-Day /loop and Session-Scoped Scheduling
Session-scoped /loop tasks and CronCreate schedules previously expired automatically after 7 days (Scheduled Tasks Docs). In v2.1.330, newly created recurring tasks and /loop jobs run for up to 30 days as long as their host session stays running, and Claude Code now prints when each task will end. Tasks created prior to v2.1.330 retain the legacy 7-day ceiling.
Under the hood, the scheduler polls every second and enqueues due prompts at low priority between user turns. Prompts can be fixed intervals (/loop 5m check the deploy), dynamic intervals where Claude selects a 1-minute to 1-hour backoff based on observed activity, or custom instructions loaded from .claude/loop.md (project-level) or ~/.claude/loop.md (user-level, truncated past 25,000 bytes).
2. Self-Hosted Runner Controls and /metrics Instrumentation
For engineering teams running Claude Code on private build fleets, v2.1.330 introduces concrete operational controls (GitHub Releases, Releasebot):
- Repository Subdirectory Scoping:
--start-dir(orSELF_HOSTED_RUNNER_START_DIR) starts Claude inside a specific folder of a repository while still loading top-level settings and hooks normally. - Orchestrator Latency Metrics: The runner
/metricsendpoint now exportsclaude_code_self_hosted_runner_order_to_registered_seconds(work order issued to registration accepted) andclaude_code_self_hosted_runner_order_to_first_session_seconds(work order to first session handover). - Hook Concurrency and Early Aborts:
spawn-runnerhooks now start concurrently up to--hook-concurrency(default4; set to1if hooks cannot overlap), and acheckouthook exiting with status108halts session startup immediately without retrying other runners. - Reduced Transcript Bloat: Self-hosted runners skip generating Bash file diffs when no downstream consumer needs them unless
bashEditDiffEnabledis set totruein managed settings. - Enterprise Admin Sign-In and Visuals:
claude auth loginnow applies organization settings and cloud gateways managed in Anthropic's Enterprise Admin Console,CLAUDE_CODE_FULL_SIGN_IN_LINK=1prints full auth URLs for script parsing, and the built-ineaselmod renders charts automatically under MCP metrics results on macOS and Linux (disableable via/config).
3. Auto-Mode Defaults and Code Mode Execution Layer
Two architectural shifts from the preceding November builds directly affect how v2.1.330 automation behaves in production:
- Auto Mode as Default (
v2.1.283+): Interactive terminal and VS Code sessions without an explicit permission mode now start inautomode across all plans, delegating file-edit, shell, and network approvals to a secondary classifier model rather than prompting a human on every call (Kunal Ganglani). - Code Mode (
v2.1.323+): Opting in viaCLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1enables a JavaScriptREPLtool where Claude writes a script that executes multiple file, shell, and MCP tool calls in one step, returning only filtered data to the model context (Omid Saffari).
flowchart LR
A["Trigger: /loop, Cron, GitHub, or API /fire"] --> B["Session / Self-Hosted Runner (--start-dir)"]
B --> C{"Permission Mode"}
C -->|defaultMode: dontAsk| D["Allowlist Only (Deny Unapproved)"]
C -->|defaultMode: auto| E["Classifier Model Gate"]
E --> F{"Code Mode Enabled?"}
F -->|No| G["Standard Sequential Tool Calls"]
F -->|Yes| H["JS REPL Tool Batch"]
H --> I["Per-Call Deny/Ask & PreToolUse Hooks"]
I --> J["PostToolUse Hook on REPL (Redaction)"]
J --> K["Filtered Output to Model Context"]To lock down unattended or CI-adjacent workstations against unintended auto approvals while preserving Code Mode redaction, teams can enforce deterministic rules in .claude/settings.json:
{
"permissions": {
"defaultMode": "dontAsk",
"ask": ["REPL"]
},
"hooks": {
"PostToolUse": [
{
"matcher": "REPL",
"hooks": [
{
"type": "command",
"command": "./scripts/redact-repl-output.sh",
"onFailure": "block"
}
]
}
]
}
}
In v2.1.328 and v2.1.329, Anthropic tightened hook semantics so UserPromptSubmit hooks no longer receive Code Mode script output at all, requiring teams to move output redaction to PostToolUse on REPL and set "onFailure": "block" on guarding command, HTTP, or mcp_tool hooks so hook timeouts or errors fail closed (Releasebot, Omid Saffari).
Reliability, Cost, and Performance Analysis
Prompt-Cache Alignment and Jitter Mechanics
Running a 30-day /loop introduces non-obvious timing and cost interactions. To prevent thundering-herd API spikes when thousands of sessions schedule tasks at :00 or :30, Claude Code applies deterministic jitter (Scheduled Tasks Docs):
| Schedule Cadence | Actual Execution Timing | Operational Implication |
|---|---|---|
Every 5 minutes (*/5 * * * * / /loop 5m) |
4 min 45 sec after prior run |
Fires 15s early so the 5-minute prompt cache stays warm |
| Every 10 minutes | 0 to 5 min late |
Bounded drift; cache likely cold between runs |
| Every 30 minutes | 0 to 15 min late |
Suitable for async PR/CI polling, not strict SLAs |
| Hourly or less frequent (e.g., daily) | 0 to 30 min late |
Shift critical cron jobs off :00 / :30 if timing matters |
One-shot tasks at :00 or :30 |
Up to 90 sec early |
Schedule at e.g. 3 9 * * * for exact-minute firing |
Because /loop tasks only fire when the session is running and idle—and do not catch up on missed intervals after sleep or downtime—long-running 30-day loops still require either a persistent background session or migration to Cloud Scheduled Tasks (Scheduled Tasks Docs).
Cloud Scheduled Task Rate Limits and Payload Safety
For truly headless automation that survives laptop sleep, Cloud Scheduled Tasks (formerly Routines, managed via claude.ai/code/routines or /schedule) run on Anthropic-managed containers or self-hosted environments (Automate Work with Scheduled Tasks). They enforce strict hourly quotas without overage:
- Account-wide scheduled runs: Capped at 100 per hour (excess runs wait until the window resets).
- Per-task manual/API triggers:
Run now, API/firecalls, and re-running one-off tasks share a 30 per hour limit per task (excess calls fail immediately). - Account-wide API fires: Capped at 100 per hour separately from
Run now. - GitHub connection grace window: If GitHub OAuth/app access expires, scheduled tasks skip runs for up to 72 hours before disabling automatically.
When triggering a cloud task via POST /v1/claude_code/routines/{id}/fire (under beta header experimental-cc-routine-2026-04-01), any text payload is wrapped in <routine-fire-payload> tags and marked as untrusted data, preventing a leaked bearer token from injecting direct instructions unless the saved prompt explicitly opts in to reading that block (Automate Work with Scheduled Tasks).
Code Mode Memory Caps and Compatibility Boundaries
While Code Mode can eliminate round-trip model calls by filtering large MCP or search outputs inside JavaScript variables, it carries hard runtime boundaries (Omid Saffari, Releasebot):
- Execution time limits: Foreground scripts wait up to 10 minutes (from
v2.1.328, time spent waiting at a manual permission prompt is excluded). Background scripts inautoorbypassPermissionsmode can run up to 2 hours. - Memory & read guardrails (
v2.1.329): Scripts are blocked from reading line ranges exceeding 256 MiB, and runaway loops hit an explicit memory cutoff. - Unsupported environments: Code Mode requires a direct Anthropic API or Claude subscription connection and is unavailable on Amazon Bedrock, Google Cloud Agent Platform, Microsoft Foundry, custom gateways, HIPAA/ZDR organizations, Remote Control, the VS Code panel, and Claude Desktop.
- Unverified Token Claims (Confidence Note): Several third-party videos circulating alongside the November 2026 release wave claimed "7 to 10 billion free tokens per month" on Claude Code. Confidence: Low / Unverified—neither Anthropic's changelog nor official pricing documentation confirms any free-tier token allowance at that scale (Kunal Ganglani).
Practical Implementation and Trade-Offs
Choosing the Right Automation Surface
| Dimension | Cloud Scheduled Tasks | Desktop Scheduled Tasks | Session /loop (v2.1.330) |
|---|---|---|---|
| Execution Host | Anthropic cloud or self-hosted runner | Local machine (Claude Desktop) | Active CLI session (or backgrounded) |
| Machine / Session Required | Neither | Machine on; no open session | Both machine and open session |
| Local File Access | No (fresh Git clone per run) | Yes | Yes |
| Minimum Interval | 1 hour | 1 minute (via Claude) / 1 hour (UI) | 1 minute |
| Maximum Lifespan | Persistent until paused/deleted | Persistent until paused/deleted | 30 days (up from 7 in v2.1.330) |
| Default Permissions | auto mode by default |
Configurable per task | Inherits session mode |
Engineering Audit Checklist for v2.1.330+
Before rolling out v2.1.330 across engineering workstations and CI runners, teams should run a focused configuration audit (Kunal Ganglani, Omid Saffari):
- Verify installed versions: Run
claude --version. Any host onv2.1.283or later defaults toautomode unless overridden. - Pin permission modes explicitly: Set
"defaultMode": "manual"in.claude/settings.jsonfor sensitive repositories, and"defaultMode": "dontAsk"on CI or self-hosted runners so only pre-approved tools execute. - Separate prose guidance from hard constraints: Move non-negotiable rules out of
CLAUDE.md(which is advisory) into deterministic.clauderules,PreToolUsehooks with"onFailure": "block", and protected write paths. - Scope self-hosted runners: Pass
--start-dirfor monorepo isolation, verifyspawn-runnerhooks handle--hook-concurrency 4safely (or pin to1), and monitor/metricsfororder_to_registeredandorder_to_first_sessionregressions. - Govern Code Mode centrally: If your organization requires Remote Control, OpenTelemetry tracing, or strict gateway routing—or wants to prohibit
REPLbatching—deploy"CLAUDE_CODE_EXPERIMENTAL_CODE_MODE": "0"in managed settings.
Frequently Asked Questions
1. Do existing /loop tasks automatically extend to 30 days after upgrading to v2.1.330?
No. Per the Claude Code 2.1.330 release notes, only recurring scheduled tasks and /loop jobs created after upgrading to v2.1.330 run for up to 30 days. Tasks created on earlier builds still expire after 7 days.
2. Does /loop keep running if I close my laptop or exit the terminal?
No. /loop tasks are session-scoped and only fire while Claude Code is running and idle (Scheduled Tasks Docs). You can detach from a backgrounded session with Ctrl+C twice without stopping a self-paced loop, but for automation that runs when your machine is off, use Cloud Scheduled Tasks.
3. Why does /loop 5m fire every 4 minutes and 45 seconds instead of every 5 minutes?
Claude Code intentionally schedules */5 * * * * tasks 15 seconds early (4m 45s) so each iteration starts before the 5-minute prompt cache expires, reducing token re-ingestion costs (Scheduled Tasks Docs).
4. Can we use Code Mode behind Amazon Bedrock, Vertex AI, or an enterprise LLM gateway?
No. Code Mode (CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1) currently requires a direct Anthropic API or Claude subscription connection and is unsupported on Amazon Bedrock, Google Cloud Agent Platform, Microsoft Foundry, custom gateways, and HIPAA/ZDR organizations (Omid Saffari).
5. How do we prevent auto mode from approving risky commands after updating?
The classifier in auto mode is non-deterministic. Pin "defaultMode": "manual" for interactive sensitive work or "defaultMode": "dontAsk" for CI/self-hosted runners in settings.json, and enforce hard boundaries with PreToolUse hooks ("onFailure": "block") and protected paths (Kunal Ganglani).
Sources
- Anthropic — Claude Code Changelog (v2.1.330) (November 21, 2026): https://code.claude.com/docs/en/changelog
- Anthropic — Run prompts on a schedule (
/loop& CronCreate) (November 20, 2026): https://code.claude.com/docs/en/scheduled-tasks - Anthropic — Automate work with scheduled tasks (Cloud Routines) (November 21, 2026): https://code.claude.com/docs/en/routines
- Anthropic — anthropics/claude-code GitHub Releases (November 21, 2026): https://github.com/anthropics/claude-code/releases
- Releasebot — Claude Code Updates by Anthropic (v2.1.323–v2.1.330) (November 21, 2026): https://releasebot.io/updates/anthropic/claude-code
- Omid Saffari — Claude Code's Code Mode: What Changes Between Tool Calls (November 22, 2026): https://omidsaffari.com/blog/claude-code-code-mode
- Kunal Ganglani — Claude Code 2.0 New Rules: What Actually Changed [2026] (November 23, 2026): https://www.kunalganglani.com/blog/claude-code-2-new-rules