调用本机 Claude Code 作为非交互 coding agent。Orchestrator 负责指挥和验收,Claude Code 负责写代码。
| 场景 | 命令模板 |
|---|---|
| ------ | --------- |
| 短任务 | cd |
| 长任务 | cd |
| 全权限 | cd |
| 只读分析 | cd |
| JSON 输出 | cd |
| Flag | Purpose |
|---|---|
| ------ | --------- |
--bare | Minimal mode, skip hooks/LSP/plugins, faster startup |
-p / --print | Non-interactive, output to stdout (do not use PTY) |
--max-turns N | Limit turns: 10 short, 30 long |
--output-format stream-json | Streaming output, prevents timeout |
--output-format json | Single JSON with result field |
--verbose | Detailed logging (with stream-json) |
--include-partial-messages | Incremental output (with stream-json) |
Default to the lowest level that accomplishes the task.
| Level | Mode | Flags | Use Case |
|---|---|---|---|
| ------- | ------ | ------- | ---------- |
| 1 Read | plan | --permission-mode plan --allowedTools "Read,Glob,Grep,LSP" | Code exploration, doc review |
| 2 Analyze | default | --allowedTools "Read,Bash,Glob,Grep,LSP" | Run diagnostic commands |
| 3 Edit | acceptEdits | --permission-mode acceptEdits --allowedTools "Read,Edit,Write,Bash,Glob,Grep,LSP" | Modify source files |
| 4 Full | bypass | --dangerously-skip-permissions | Trusted projects, batch ops |
| Complexity | Duration | max-turns |
|---|---|---|
| ----------- | ---------- | ----------- |
| Simple (回答问题) | 2-5 min | 5-10 |
| Medium (探索+单文件) | 5-15 min | 10-20 |
| Complex (多文件+测试) | 15-30 min | 20-40 |
> Never kill Claude Code when exec times out. Check ps aux | grep claude first.
git status --shortgit diff --statreferences/streaming.md — Stream-JSON event types and filteringreferences/troubleshooting.md — Common failures and fixes共 1 个版本