[KongchangAI]
· 3 min read· 1,552 words

Claude Code v2.1.329 Update Explained: Trust Dialog and Code Mode Enhancements

Claude Code v2.1.329 Update Explained: Trust Dialog and Code Mode Enhancements

Claude Code v2.1.329 strengthens hook trust visibility, Code Mode resource boundaries, and session task views.

Claude Code v2.1.329 is a multi-faceted iteration touching security, Code Mode, and session management. On the security side, a new trust dialog explains where a folder's hooks are declared at session start, and hooks that fail to load in managed settings now warn in the conversation; macOS login renewal now tests Keychain writes to avoid repeated logouts. Code Mode receives dense fixes: custom log/preview/sleep scripts can run, variable scoping no longer bleeds across scripts, memory growth from large files and background subagents is curbed, line-range reads over 256 MiB are rejected, and terminal freezes after thousands of tool calls are significantly shortened. On the session side, /tasks aggregates scheduled tasks, /loop wakeups, goals, and forks with stop support, while /mcp and /status add troubleshooting information. It also fixes ~/.claude.json being reset, /code-review reviewing the wrong branch, binary attachments being saved as .bin, and adjusts Windows startup performance and gateway startup warnings.

Claude Code has released version v2.1.329, which brings notable changes across security, Code Mode, and session management. Judging from the release notes, this is not a minor patch but an iteration that touches multiple underlying mechanisms. For developers who use Claude Code daily, several of these changes will directly affect their workflows.

Security and Trust Mechanisms: Surfacing Risks Earlier

The new version adds a trust dialog that, at the start of a session, explains where the hooks for a given folder are declared. Hooks are a mechanism in Claude Code that allows custom commands to be executed when specific events are triggered. If their origin is opaque, they can pose a security risk. The purpose of this dialog is to bring origin information to the forefront so users have a chance to confirm before execution.

At the same time, in non-interactive host environments such as Claude Desktop, if hooks in managed settings fail to load, a warning will appear in the conversation. Previously, such failures could be silent, leaving users unaware. Now, at least, the prompt is visible in the session.

Login renewal on macOS has also been adjusted: it now uses the Claude Code-write-check entry to test Keychain. This addresses a rather subtle problem—previously, Claude Code could sometimes read from Keychain but not write to it, causing repeated logouts. In the new version, when this situation occurs, it will stop at session expiry and explain the reason, while other sessions remain logged in.

On Hook Execution Timing and Trust Boundaries

Hooks in Claude Code are typically attached to lifecycle events such as session start, before and after tool calls, and session end, and they execute as shell commands, so they essentially amount to running arbitrary code on the user's machine. The trust dialog chooses to display the declaration source of hooks at session start (for example, whether they come from the project directory's .claude/settings.json, user-level configuration, or managed settings distributed by an organization) because the trust levels of different sources vary greatly: hooks declared within a project may be modified by others along with the repository. Only by bringing the source forward before execution do users have a chance to decide whether to proceed before the first command runs.

Managed Settings and Silent Failures

Managed settings generally refer to a settings layer distributed centrally by organization administrators, with higher priority than users' local configurations, and are commonly used in enterprise environments. Their loading may fail due to unreadable files, format errors, or permission issues. Previously, silent failures meant administrators assumed policies were in effect when they actually were not; outputting a warning in the conversation makes policy failures observable.

Code Mode Boundary Fixes and Performance Improvements

Code Mode is one of the most-changed modules in this version, with a dense set of fixes.

One key fix: scripts that declare their own log, preview, or sleep can now run; previously such scripts would be rejected. Another fix targets the let x; variable scoping issue—a variable declared in one script no longer incorrectly retains the value assigned by a previous script.

On the memory side, Code Mode previously kept every large text file read by code in memory, and memory would grow further with each background subagent awakened. The new version fixes this. At the same time, line-range reads of more than 256 MiB by scripts are now rejected, because such reads can consume several GB of memory; the timeout issue for reading extremely long lines has also been fixed.

One performance improvement is worth noting: after a script issues thousands of tool calls, the time the terminal freezes is greatly reduced. In addition, when an MCP tool requests to end the turn and that tool is called by a script that Claude is waiting on, Code Mode previously ignored the request; it now handles it correctly.

Code Mode's Execution Model and Resource Limits

Code Mode allows the model to write and execute scripts, and scripts can call tools internally, so a single script execution may trigger hundreds or thousands of tool calls and read/write large files. This determines its two typical risk points: first, memory—large texts that have been read are cached to speed up subsequent access, but without a cap they will keep accumulating over long sessions; second, execution context—if variable isolation between scripts is unreliable, variables from one script may leak into the next.

The 256 MiB line-range limit is a preventive rejection: when reading extremely large files by line range, large chunks of content often need to be kept in memory to enable random access, and a single read can balloon to several GB. Placing the limit at the read entry point is more controllable than dealing with it after memory is exhausted.

A New Entry Point for Session and Task Management

The /tasks command now displays the current session's scheduled tasks, /loop wakeups, goals, and fork records from this conversation. Pressing x can stop one of them, and it will ask for confirmation first. This effectively provides a unified view of background activity within the session.

The server page in /mcp now includes a "Server message" line that shows the JSON-RPC error message when a remote HTTP MCP server rejects a connection, making connection troubleshooting more evidence-based. /status now includes a "Marketplace auto-update" line listing which managed marketplaces will not auto-update and why.

On behavioral changes: in a newly logged-in session, most scheduled tasks saved by older versions need to be rescheduled, though when resuming their own sessions with --resume they still run as usual. Additionally, "Exit and stop tasks" now ends the current session's scheduled tasks to avoid them running again on resume, unless Claude is responding at the time of exit.

What Scheduled Tasks, /loop, and Forks Mean

Scheduled tasks here refer to background work registered by Claude within a session that will execute later or periodically; /loop wakeups cause Claude to be re-awakened on a loop cadence to continue processing, which suits polling-style tasks. Fork records refer to sub-sessions or subagents branched off from the current conversation; they share context but advance independently. These activities were previously scattered across different entry points, and /tasks consolidates them into a unified, stoppable view—essentially turning "in-session background state" into an observable, intervenable object.

The reason rescheduling is needed is that scheduled task registration information is bound to the older version's session storage format and cannot be directly reused when a new session loads it; when --resume restores the original session, the full context is still held, so it can continue running.

Other Notable Fixes

On data safety: when ~/.claude.json became unreadable due to network stalls or file locks and was emptied on save, it was sometimes reset to default values. This bug has been fixed.

On code review: /code-review <pr number> sometimes reviewed the currently checked-out branch instead of the specified pull request, without any indication. It now reads the PR using gh pr diff and clearly states when it cannot read it. /code-review without a target now reviews the entire branch against the default branch.

On file handling: PDFs, images, and .docx, .xlsx, and .pptx files sent via MCP servers or websites as application/octet-stream were previously saved as .bin, making them unreadable by Claude. This has been fixed.

On the terminal side: a status bar script that printed infinitely once caused the prompt to freeze and consume several GB of memory; this hazard has also been addressed.

Platform and Deployment Adjustments

On Windows, startup speed and first-search speed have improved. The self-hosted runner fixed an issue where --push-outcome-on-release sometimes deleted session branches on the git host, and adjusted clone paths for the same owner/name under different hostnames.

Gateway startup warnings now display a boxed notice on every startup: when access_control.allow_cidrs is empty, never expose the gateway to the public internet.

On macOS, computer use has updated security rules: some operations will be rejected, accessibility permissions for some apps have been narrowed, and app launches that do not complete within 30 seconds are abandoned.

Summary

The core theme of v2.1.329 is "controllability": hook sources are visible, MCP errors are visible, session tasks are visible, and Code Mode's resource boundaries have been tightened. For heavy users, the main benefits of upgrading are fewer memory anomalies and more reliable multi-session login state.

One-line Summary

Claude Code v2.1.329 strengthens hook trust visibility, Code Mode resource boundaries, and session task views.

Paragraph Summary

Claude Code v2.1.329 is a multi-faceted iteration touching security, Code Mode, and session management. On the security side, a new trust dialog explains where a folder's hooks are declared at session start, and hooks that fail to load in managed settings now warn in the conversation; macOS login renewal now tests Keychain writes to avoid repeated logouts. Code Mode receives dense fixes: custom log/preview/sleep scripts can run, variable scoping no longer bleeds across scripts, memory growth from large files and background subagents is curbed, line-range reads over 256 MiB are rejected, and terminal freezes after thousands of tool calls are significantly shortened. On the session side, /tasks aggregates scheduled tasks, /loop wakeups, goals, and forks with stop support, while /mcp and /status add troubleshooting information. It also fixes ~/.claude.json being reset, /code-review reviewing the wrong branch, binary attachments being saved as .bin, and adjusts Windows startup performance and gateway startup warnings.

#Claude Code#v2.1.329#Code Mode#hook trust dialog#MCP server error#session management#memory leak fix
Share:

Related articles