()
| 31 | } |
| 32 | |
| 33 | function getSleepGuidance(): string | null { |
| 34 | if (isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_BACKGROUND_TASKS)) { |
| 35 | return null |
| 36 | } |
| 37 | return ` - Avoid unnecessary \`Start-Sleep\` commands: |
| 38 | - Do not sleep between commands that can run immediately — just run them. |
| 39 | - If your command is long running and you would like to be notified when it finishes — simply run your command using \`run_in_background\`. There is no need to sleep in this case. |
| 40 | - Do not retry failing commands in a sleep loop — diagnose the root cause or consider an alternative approach. |
| 41 | - If waiting for a background task you started with \`run_in_background\`, you will be notified when it completes — do not poll. |
| 42 | - If you must poll an external process, use a check command rather than sleeping first. |
| 43 | - If you must sleep, keep the duration short (1-5 seconds) to avoid blocking the user.` |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Version-specific syntax guidance. The model's training data covers both |
no test coverage detected