mirror of
https://github.com/luongnv89/claude-howto.git
synced 2026-12-03 02:03:31 +01:00
docs: fix second-round review nits on the v2.1.310 sync
- 04-subagents: split the background-subagent sentence (table row and Background Subagents paragraph) into three sentences; meaning unchanged. - 05-mcp: MCP Tasks now says both the Agent SDK and `claude -p --input-format stream-json` need CLAUDE_AUTO_BACKGROUND_TASKS=1, and breaks up the semicolon chain (mcp.md, "What a call needs to become an MCP task"). - QUICK_REFERENCE (en/ja/uk/vi/zh): the headless remedy now points to `--permission-mode auto`, not "a mode below" (the first one, dontAsk, denies anything that would prompt; permission-modes.md). - zh/09-advanced-features: add `--permission-mode auto` to the print-mode example, matching the other languages. Checks: pre-commit on the changed files passes, run from a python3.12 copy of the config with SKIP=mermaid,vietnamese-mermaid,japanese-mermaid. The mermaid hooks can't install under pre-commit 4.7 (#210, #211).
This commit is contained in:
1 parent
8b5a5e386e
commit
d0daa29c2f
8 files changed
+9
-9
No files matched your search
@@ -139,7 +139,7 @@ to solving problems.
|
||||
| `mcpServers` | No | MCP servers to make available to the subagent |
|
||||
| `hooks` | No | Hooks that run only while this subagent is active. All hook events are supported; most common are `PreToolUse`, `PostToolUse`, `Stop` (runs as `SubagentStop`) |
|
||||
| `memory` | No | Persistent memory directory scope: `user`, `project`, or `local` |
|
||||
| `background` | No | Subagents already run in the background by default (v2.1.198). Since v2.1.302 the main conversation's subagents in the desktop app and VS Code also start in the background; while fork mode is on (the default), Claude can't wait for them; a subagent's own Agent calls in `claude -p`, the Agent SDK, the desktop app and VS Code run in the foreground by default. Set to `true` to *force* background always and prevent inline execution |
|
||||
| `background` | No | Subagents already run in the background by default (v2.1.198). Since v2.1.302 the main conversation's subagents in the desktop app and VS Code also start in the background. While fork mode is on (the default), Claude can't wait for them. A subagent's own Agent calls in `claude -p`, the Agent SDK, the desktop app and VS Code run in the foreground by default. Set to `true` to *force* background always and prevent inline execution |
|
||||
| `effort` | No | Reasoning effort level: `low`, `medium`, `high`, `xhigh`, or `max`. Overrides the session effort level; available levels depend on the model. Claude can also pass an `effort` value when it calls the Agent tool (v2.1.292). |
|
||||
| `isolation` | No | Set to `worktree` to give the subagent its own git worktree |
|
||||
| `initialPrompt` | No | Auto-submitted first turn when the subagent runs as the main agent |
|
||||
@@ -530,7 +530,7 @@ graph LR
|
||||
|
||||
## Background Subagents
|
||||
|
||||
Subagents run in the background by default (v2.1.198). Since v2.1.302 the main conversation's subagents in the desktop app and VS Code also start in the background; while fork mode is on (the default), Claude can't wait for them; a subagent's own Agent calls in `claude -p`, the Agent SDK, the desktop app and VS Code run in the foreground by default. Claude keeps working on the main conversation while a subagent runs and is notified when it finishes, so you no longer wait on a subagent to return before continuing. In VS Code (v2.1.304+), a background subagent shows as one status line under its Agent card instead of streaming every step into the chat; open `/tasks` and click it to see its tool calls and transcript.
|
||||
Subagents run in the background by default (v2.1.198). Since v2.1.302 the main conversation's subagents in the desktop app and VS Code also start in the background. While fork mode is on (the default), Claude can't wait for them. A subagent's own Agent calls in `claude -p`, the Agent SDK, the desktop app and VS Code run in the foreground by default. Claude keeps working on the main conversation while a subagent runs and is notified when it finishes, so you no longer wait on a subagent to return before continuing. In VS Code (v2.1.304+), a background subagent shows as one status line under its Agent card instead of streaming every step into the chat; open `/tasks` and click it to see its tool calls and transcript.
|
||||
|
||||
### Configuration
|
||||
|
||||
|
||||
+1
-1
@@ -936,7 +936,7 @@ Set it to `0` to turn automatic backgrounding off; `CLAUDE_CODE_DISABLE_BACKGROU
|
||||
|
||||
### MCP Tasks (public beta, v2.1.304+)
|
||||
|
||||
A server that supports the MCP tasks extension can run a long job itself: Claude's tool call returns as soon as the server accepts the job, the footer shows a count such as `1 MCP task`, and Claude gets the result when the job ends. Stop one in `/tasks` with `x`. A task on a remote server keeps running after you exit; resume the same session to follow it again. Tasks need protocol revision 2026-07-28, feature-flag fetching (so not Bedrock, Vertex, Foundry or telemetry off) and a terminal CLI, Agent SDK or GitHub Actions session; a non-interactive run gets them only from the Agent SDK or `claude -p --input-format stream-json` with `CLAUDE_AUTO_BACKGROUND_TASKS=1` (a plain `claude -p "<prompt>"` doesn't); VS Code and the desktop app don't get them, and calls from subagents never become tasks. To make Claude wait for a task's result, set `CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND=1` (or `CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS=0` to wait for every MCP call).
|
||||
A server that supports the MCP tasks extension can run a long job itself: Claude's tool call returns as soon as the server accepts the job, the footer shows a count such as `1 MCP task`, and Claude gets the result when the job ends. Stop one in `/tasks` with `x`. A task on a remote server keeps running after you exit; resume the same session to follow it again. Tasks need protocol revision 2026-07-28, feature-flag fetching (so not Bedrock, Vertex, Foundry or telemetry off) and a terminal CLI, Agent SDK or GitHub Actions session. A non-interactive run gets them only from the Agent SDK or `claude -p --input-format stream-json`, and either needs `CLAUDE_AUTO_BACKGROUND_TASKS=1` (a plain `claude -p "<prompt>"` doesn't get them). VS Code and the desktop app don't get them, and calls from subagents never become tasks. To make Claude wait for a task's result, set `CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND=1` (or `CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS=0` to wait for every MCP call).
|
||||
|
||||
## Solving Context Bloat with Code Execution
|
||||
|
||||
|
||||
+1
-1
@@ -228,7 +228,7 @@ claude --permission-mode auto -p "Refactor and test the auth module"
|
||||
```bash
|
||||
# Run in headless mode (non-interactive). With no permission mode, -p starts in Manual mode
|
||||
# (config value "default", v2.1.302+): tool calls that need approval are denied, so add
|
||||
# --allowedTools "Bash(npm test *)" or a --permission-mode such as the ones below
|
||||
# --allowedTools "Bash(npm test *)" or --permission-mode auto
|
||||
claude -p "Run all tests and generate report"
|
||||
|
||||
# With permission mode for CI
|
||||
|
||||
@@ -230,7 +230,7 @@ claude --enable-auto-mode -p "Refactor and test the auth module"
|
||||
```bash
|
||||
# ヘッドレスモードで実行 (非対話)。権限モードを指定しないと -p は Manual モード
|
||||
# (設定値 "default"、v2.1.302+) で開始し、承認が必要なツール呼び出しは拒否されるため、
|
||||
# --allowedTools "Bash(npm test *)" または以下のような --permission-mode を追加する
|
||||
# --allowedTools "Bash(npm test *)" または --permission-mode auto を追加する
|
||||
claude -p "Run all tests and generate report"
|
||||
|
||||
# CI 用権限モードつき
|
||||
|
||||
@@ -247,7 +247,7 @@ claude --enable-auto-mode -p "Refactor and test the auth module"
|
||||
```bash
|
||||
# Запуск у headless-режимі (неінтерактивно). Без режиму дозволів -p стартує в режимі Manual
|
||||
# (значення конфігурації "default", v2.1.302+): виклики інструментів, що потребують схвалення, відхиляються,
|
||||
# тож додайте --allowedTools "Bash(npm test *)" або --permission-mode, як у прикладах нижче
|
||||
# тож додайте --allowedTools "Bash(npm test *)" або --permission-mode auto
|
||||
claude -p "Run all tests and generate report"
|
||||
|
||||
# З режимом дозволів для CI
|
||||
|
||||
@@ -226,7 +226,7 @@ claude --enable-auto-mode -p "Refactor và test module auth"
|
||||
```bash
|
||||
# Chạy ở chế độ headless (không tương tác). Khi không đặt chế độ quyền, -p khởi động ở chế độ Manual
|
||||
# (giá trị cấu hình "default", v2.1.302+): các lệnh gọi tool cần phê duyệt sẽ bị từ chối, vì vậy hãy thêm
|
||||
# --allowedTools "Bash(npm test *)" hoặc một --permission-mode như các ví dụ bên dưới
|
||||
# --allowedTools "Bash(npm test *)" hoặc --permission-mode auto
|
||||
claude -p "Chạy tất cả tests và tạo báo cáo"
|
||||
|
||||
# Với chế độ quyền cho CI
|
||||
|
||||
@@ -427,7 +427,7 @@ Print mode 就是 `claude -p`:给一个任务,输出结果,然后退出。
|
||||
|
||||
```bash
|
||||
# 运行指定任务
|
||||
claude -p "run tests and summarize failures"
|
||||
claude -p "run tests and summarize failures" --permission-mode auto
|
||||
|
||||
# 处理管道内容
|
||||
cat logs.txt | claude -p "find the root cause"
|
||||
|
||||
@@ -226,7 +226,7 @@ claude --enable-auto-mode -p "重构并测试 auth 模块"
|
||||
```bash
|
||||
# 以 headless 模式运行(非交互)。未指定权限模式时,-p 以 Manual 模式启动
|
||||
# (配置值 "default",v2.1.302+):需要审批的工具调用会被拒绝,因此请添加
|
||||
# --allowedTools "Bash(npm test *)" 或下方示例中的 --permission-mode
|
||||
# --allowedTools "Bash(npm test *)" 或 --permission-mode auto
|
||||
claude -p "运行所有测试并生成报告"
|
||||
|
||||
# 在 CI 中搭配权限模式
|
||||
|
||||
Reference in new issue
Block a user