[FEATURE] Option to suppress context-limit dialog in automated/pipeline sessions
Problem
When running Claude Code as a scheduler or daemon (e.g. triggered by cron, a Python scheduler, or any non-interactive pipeline), filling up the context window causes an interactive dialog to appear asking what to do. This breaks the pipeline entirely — the process stalls waiting for human input that will never come.
Use case
Running claude in a background process / scheduler. The scheduler fires Claude with a prompt, Claude works, eventually hits the context limit, and the pipeline hangs indefinitely instead of failing gracefully or pausing.
Proposed solution
A flag or environment variable to suppress the context-limit prompt and instead:
- Option A: silently wait for the next user input (existing behavior in
--print/-pmode should just error out or exit) - Option B: automatically compact and continue (already partially possible with
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE, but doesn't cover the hard-limit dialog) - Option C: exit with a specific non-zero code so the caller can detect and retry
A simple --no-context-prompt flag or CLAUDE_NO_CONTEXT_PROMPT=1 env var would suffice.
Related
- #46086 Fine-grained compaction controls (different angle — about what to compact, not suppressing the dialog)
DISABLE_COMPACTenv var exists but disables compaction entirely rather than handling the UI prompt
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗