74 pages for cleanup.
Titles and paths first, then pages whose text carries it. Each row opens that page as this site last read it.
claude-api-skill
Claude Developer Platform · in the page
agents-and-tools/agent-skills/claude-api-skill
…uild-with-claude/structured-outputs) where applicable * **Beta header cleanup**, removing beta headers that the target model doesn't require (for example, `effort-2025-11-24`, `fine-grained-tool-strea…
mid-conversation-effort-example
Claude Developer Platform · in the page
build-with-claude/mid-conversation-effort-example
…lete(fixtureDir, recursive: true); } catch { /* Best-effort cleanup; the OS tmp sweeper handles leftovers. */ } }; } // Run a shell command and return its output plus an error fla…
prompting-claude-fable-5
Claude Developer Platform · in the page
build-with-claude/prompt-engineering/prompting-claude-fable-5
…ons beyond what the task requires. A bug fix doesn't need surrounding cleanup and a one-shot operation usually doesn't need a helper. Don't design for hypothetical future requirements: do the simplest…
Delivering work
Claude Developer Platform · in the page
build-with-claude/prompt-engineering/prompting-claude-fable-5-1
…es to what the request needs. Something else you notice worth doing — cleanup or documentation the task didn't call for, a change to a file the task didn't require — is a suggestion to make at the end…
compliance-org-data
Claude Developer Platform · in the page
manage-claude/compliance-org-data
…`read:compliance_org_settings` scope remain in the list for audit and cleanup visibility even though that scope no longer grants access. The top-level `organization_id` is the organization's bare UUI…
spawn.sh: called once per claimed work item
Claude Developer Platform · in the page
managed-agents/self-hosted-sandboxes
…one session and is discarded afterward, no leftover directories need cleanup, and the memory directories do not need to be bind-mounted to the host: the worker uploads their contents to the store bef…
self-hosted-sandboxes-operations
Claude Developer Platform · in the page
managed-agents/self-hosted-sandboxes-operations
…ore. A sandbox that serves one session and is then discarded needs no cleanup. ## Troubleshooting ### The worker doesn't connect If `workers_polling` (java, php: `workersPolling`; csharp, go: `Work…
self-hosted-sandboxes-security
Claude Developer Platform · in the page
managed-agents/self-hosted-sandboxes-security
…ut a worker that exits without running its teardown leaves it behind. Cleanup of leftover copies, the permissions on that path, and isolation between sessions that share a filesystem are your responsi…
Agent SDK reference - Python
Claude Code CLI · in the page
agent-sdk/python
…messages, avoid using `break` to exit early as this can cause asyncio cleanup issues. Instead, let the iteration complete naturally or use flags to track when you've found what you need. #### Example…
Persist sessions to external storage
Claude Code CLI · in the page
agent-sdk/session-storage
…y: use your backend's expiry or lifecycle mechanism, or run scheduled cleanup, according to your compliance requirements. Local transcripts under `CLAUDE_CONFIG_DIR` are swept independently by the `c…
Work with sessions
Claude Code CLI · in the page
agent-sdk/sessions
…ession_messages) in Python. Use them to build custom session pickers, cleanup logic, or transcript viewers. Both SDKs also expose functions for looking up and mutating individual sessions: [`get_sess…
Subagents in the SDK
Claude Code CLI · in the page
agent-sdk/subagents
…docs/en/sub-agents#resume-subagents) for compaction behavior and the `cleanupPeriodDays` cleanup period. ## Tool restrictions Use the `tools` field to limit what a subagent can do: * **Omit `tools`…
Agent SDK reference - TypeScript
Claude Code CLI · in the page
agent-sdk/typescript
…tings for a project directory and prints the source that controls the cleanup period. On a machine where no settings file sets `cleanupPeriodDays`, both printed lines show `undefined` for the value, w…
TypeScript SDK V2 session API (removed)
Claude Code CLI · in the page
agent-sdk/typescript-v2-preview
…nsole.log("Resumed response:", text); } } ``` </details> ### Cleanup Sessions can be closed manually or automatically using [`await using`](https://www.typescriptlang.org/docs/handbook/relea…
Orchestrate teams of Claude Code sessions
Claude Code CLI · in the page
agent-teams
…leaned up automatically when the session ends, so there's no separate cleanup step. See [Architecture](#architecture) for which directories are removed and which stay on disk. ### Enforce quality gat…
Manage multiple agents with agent view
Claude Code CLI · in the page
agent-view
…ttach <id>`, resumes it without that footer prompt. When [transcript cleanup](/docs/en/settings-reference#cleanupperioddays) has removed a stopped session's saved conversation, Claude Code refuses to…
Claude Code changelog
Claude Code CLI · in the page
changelog
…aged mod can make an organization's setting a ceiling, including the `cleanupPeriodDays` the retention sweep uses * Changed the `/artifacts` delete confirmation to show numbered choices: 1 or Enter ke…
Checkpointing
Claude Code CLI · in the page
checkpointing
…cs/en/errors#no-files-were-restored). To keep snapshots longer, set [`cleanupPeriodDays`](/docs/en/settings-reference#cleanupperioddays). ### Rewind and summarize Run `/rewind`, or press `Esc` twice…
Explore the .claude directory
Claude Code CLI · in the page
claude-directory
…e Code deletes the files in the paths below once they're older than [`cleanupPeriodDays`](/docs/en/settings-reference#cleanupperioddays), as long as it can safely determine the retention period. The d…
Code Review
Claude Code CLI · in the page
code-review
…t level, the review also covers reuse, simplification, and efficiency cleanups. `/review` is an alias of `/code-review`; before v2.1.223, it was a separate command that ran a single-pass, read-only r…
Review locally with /code-review
Claude Code CLI · in the page
code-review-local
…t level, the review also covers reuse, simplification, and efficiency cleanups. The command works on any plan. The review runs in your own session, so it counts toward your plan's usage or API billin…
Commands
Claude Code CLI · in the page
commands
…ugs. Depending on your model and effort level, the review also covers cleanup opportunities. Pass `--fix` to apply findings, `--comment` to post them on the GitHub PR or GitLab merge request, or `ultr…
Common workflows
Claude Code CLI · in the page
common-workflows
…HEAD": git rev-parse failed`. See [Worktrees](/docs/en/worktrees) for cleanup, `.worktreeinclude`, and non-git VCS support. To monitor parallel sessions from one screen instead of separate terminals,…
Run Claude Code behind a corporate launcher
Claude Code CLI · in the page
corporate-launcher
…tate: `/doctor` reports it, auto-update leaves the file in place, and cleanup of old versions stays disabled until the installer manages that path again. **2. Set CLAUDE\_CODE\_PROCESS\_WRAPPER in se…
Manage costs effectively
Claude Code CLI · in the page
costs
…rest of your session data: at startup, it removes files older than [`cleanupPeriodDays`](/docs/en/claude-directory#cleaned-up-automatically), 30 days by default. You can run `/insights` on any plan…
Data usage
Claude Code CLI · in the page
data-usage
…days by default to enable session resumption. Adjust the period with `cleanupPeriodDays`. See [application data](/docs/en/claude-directory#application-data) for what's stored and how to clear it. T…
Debug your configuration
Claude Code CLI · in the page
debug-your-config
…hat loads at startup](/docs/en/sub-agents#what-loads-at-startup). | | Cleanup logic never runs at session end | No `SessionEnd` hook configured | Add a `SessionEnd` hook in `settings.json`. See the [h…
Set up Claude Code (local mode) for a HIPAA-ready organization
Claude Code CLI · in the page
hipaa-setup
…xxxx-xxxx-xxxx-xxxxxxxxxxxx", "allowedProviders": ["anthropic"], "cleanupPeriodDays": 30 } ``` For a fuller `managed-settings.json` with sandboxing, a network allowlist, credential protections, a…
Hooks reference
Claude Code CLI · in the page
hooks
…d | None | No decision control. Used for side effects like logging or cleanup | A few events can also rewrite content rather than only allow or block it: * `PreToolUse`: `updatedInput` directly unde…
Interactive mode
Claude Code CLI · in the page
interactive-mode
…s ones not to repeat. Claude Code deletes the file once it has gone [`cleanupPeriodDays`](/docs/en/settings-reference#cleanupperioddays) without a session reading or writing it. To clear them sooner,…
Deploy managed settings
Claude Code CLI · in the page
managed-settings
…by these rules: * **Single values**, such as `"model": "opus"` or `"cleanupPeriodDays": 7`: the later file's value replaces the earlier one * **Lists**, such as `permissions.deny` or `sandbox.networ…
Connect to MCP servers
Claude Code CLI · in the page
mcp-quickstart
…eck the connection status, then use it in a session, with an optional cleanup step at the end. Some servers add a step, like a browser sign-in, shown in [Additional MCP server examples](#additional-mc…
How Claude remembers your project
Claude Code CLI · in the page
memory
…nvironments. Claude Code deletes old session transcripts after the [`cleanupPeriodDays`](/docs/en/settings-reference#cleanupperioddays) retention period, but excludes the memory files in the memory d…
Monitoring
Claude Code CLI · in the page
monitoring-usage
…eet #### Retention sweep event Logged once per run of the retention cleanup sweep, which deletes [session transcripts and other application data](/docs/en/claude-directory#cleaned-up-automatically)…
Plugin loading reference
Claude Code CLI · in the page
plugins/loading
…lugins-json-could-not-be-read-and-was-rebuilt). They age out on the [`cleanupPeriodDays`](/docs/en/settings-reference#cleanupperioddays) schedule | Because `${CLAUDE_PLUGIN_ROOT}` points at a version…
Create a mod
Claude Code CLI · in the page
plugins/mods/create
…Claude Code deletes that session's mods folder once it's older than [`cleanupPeriodDays`](/docs/en/settings-reference#cleanupperioddays). To keep the mod, copy its directory out of the mods folder to…
Draw in the interface with a mod
Claude Code CLI · in the page
plugins/mods/interface
…| Your mod deletes it, or no session reads or writes the store for [`cleanupPeriodDays`](/docs/en/settings-reference#cleanupperioddays). The store is a key-value store, saved as a JSON file of your p…
Plugin security and trust
Claude Code CLI · in the page
plugins/security
…ays before a [background sweep removes them](/docs/en/plugins/loading#cleanup-of-previous-versions). After you uninstall your last plugin, orphaned directories stay until you install another. To delet…
Troubleshoot plugins
Claude Code CLI · in the page
plugins/troubleshooting
…s inside the cache. A later install of that version or a plugin cache cleanup removes them, so you don't need to delete them. To fix the install: * Close other Claude Code sessions, editors, and ter…
Prompt library
Claude Code CLI · in the page
prompt-library
…and downstream effects tells you whether you're looking at a one-line cleanup or a change you need to coordinate.", prompt: "what would break if I deleted {target}?", slots: { target: "t…
Automate work with scheduled tasks
Claude Code CLI · in the page
routines
…For example, use it to: * Remind yourself later in the week * Open a cleanup PR after a rollout finishes * Start follow-up work after an upstream change ships After the task runs, it turns itself of…
Configure the sandboxed Bash tool
Claude Code CLI · in the page
sandboxing
…removes the placeholder afterward. If a session is killed before that cleanup runs, for example by SIGKILL, the placeholders stay behind. Later sessions bind the placeholders read-only again on every…
Run prompts on a schedule
Claude Code CLI · in the page
scheduled-tasks
…pull request: review comments, failed CI runs, merge conflicts * run cleanup passes such as bug hunts or simplification when nothing else is pending Claude does not start new initiatives outside tha…
Security
Claude Code CLI · in the page
security
…d sessions are logged for compliance and audit purposes * **Automatic cleanup**: Session VMs are reclaimed after a period of inactivity * **Deletion**: You can [delete a session](/docs/en/claude-code-…
Customize sessions in self-hosted environments
Claude Code CLI · in the page
self-hosted-environments-configuration
…IT` replaces the first, so merge the two into a single trap. Put your cleanup commands directly after `rc=$?;` and end each with `|| true;`. Cleanup then runs on failure as well as on success, and a f…
Deploy self-hosted environments to production
Claude Code CLI · in the page
self-hosted-environments-deploy
…est-effort: the directories stay when the runner is killed before its cleanup runs. The canonical clone and files a session wrote elsewhere on the host, such as the temporary directory, stay regardles…
Self-hosted environments reference
Claude Code CLI · in the page
self-hosted-environments-reference
…place when the runner is killed or reaches its drain deadline before cleanup runs. With the flag on, a failed or interrupted session's debug log isn't kept on disk. Requires Claude Code v2.1.268 or l…
Configure server-managed settings
Claude Code CLI · in the page
server-managed-settings
…gs#keys-that-fail-closed) keep their stricter values. * An invalid `cleanupPeriodDays` or `desktopSessionCleanupPeriodDays` value stays in the cached copy and is never applied. * Claude Code applies…
Manage sessions
Claude Code CLI · in the page
sessions
…/env-vars) | Environment variable | | Change the 30-day retention | [`cleanupPeriodDays`](/docs/en/settings-reference#cleanupperioddays) | `settings.json` | | Set an age limit for [Claude Desktop and…
Claude Code settings
Claude Code CLI · in the page
settings
…| | `cleanupPeriodDays` | **Default**: `30` days, minimum `1`. Claude Code deletes [session files and other application…