claude-code - 💡(How to fix) Fix [FEATURE] Complete Message Output in Interactive Mode for Long-Running Automation Sessions

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

The text "Let me" is cut off because claude immediately called a tool, leaving the reasoning incomplete.

Fix Action

Fix / Workaround

[10:30:40] Claude: "The pod restart count is increasing. I need to check the logs to"
[10:30:40] Tool: kubectl_logs(pod="api-server-xyz")
[10:30:43] Claude: "Found OOM errors. The memory limit needs to be increased. Let me upd"
[10:30:48] Tool: kubectl_patch(resource="deployment/api-server", patch=...)

Code Example

{"message": {"content": [{"type": "text", "text": "Now I need to check the current status of the deployment. Let me"}]}}
{"message": {"content": [{"type": "tool_use", "id": "...", "name": "mcp__kubernetes__get_pods"}]}}

---

claude --complete-messages-before-tools

---

{
  "streaming": {
    "completeMessagesBeforeTools": true,
    "minCompletionDelay": 100
  }
}

---

[10:30:40] Claude: "The pod restart count is increasing. I need to check the logs to"
[10:30:40] Tool: kubectl_logs(pod="api-server-xyz")
[10:30:43] Claude: "Found OOM errors. The memory limit needs to be increased. Let me upd"
[10:30:48] Tool: kubectl_patch(resource="deployment/api-server", patch=...)
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

In interactive mode, claude's text output is often truncated when it decides to call a tool mid-sentence. The session .jsonl file records incomplete text fragments like:

{"message": {"content": [{"type": "text", "text": "Now I need to check the current status of the deployment. Let me"}]}}
{"message": {"content": [{"type": "tool_use", "id": "...", "name": "mcp__kubernetes__get_pods"}]}}

The text "Let me" is cut off because claude immediately called a tool, leaving the reasoning incomplete.

Proposed Solution

Add a session-level setting or CLI flag to control streaming behavior:

Option A: New CLI flag

claude --complete-messages-before-tools

When enabled, Claude would buffer text output until reaching a natural stopping point (sentence boundary, paragraph break) before calling tools.

Option B: Settings file option

{
  "streaming": {
    "completeMessagesBeforeTools": true,
    "minCompletionDelay": 100
  }
}

Option C: Extend --include-partial-messages to interactive mode

Allow --include-partial-messages to work without -p, and ensure the final complete message is always written to the session .jsonl file.

Option D: Message completion callback

Provide a hook that fires when Claude completes a thought before tool execution, allowing external logging systems to capture the complete reasoning chain.

Alternative Solutions

  1. Accept incomplete output: Not viable for production automation systems that require audit trails
  2. Use -p mode repeatedly: Loses session state, can't use --resume, defeats the purpose of interactive mode
  3. Post-process with LLM: Expensive and unreliable to "guess" what Claude meant to say
  4. Increase polling interval: Doesn't solve the fundamental issue of mid-sentence truncation
  5. Custom logging wrapper: Cannot intercept internal streaming behavior

Priority

High - Significant impact on productivity

Feature Category

CLI commands and flags

Use Case Example

I'm building an infrastructure automation system using Claude Code + MCP servers for multi-hour autonomous sessions. The workflow is:

  1. Start Claude Code with logging: claude --resume <session_id> --debug-file debug.log
  2. Claude monitors and manages infrastructure for hours, making hundreds of decisions
  3. Generate audit reports linking:
    • Claude's reasoning (text output)
    • Tool calls (MCP operations)
    • System state changes (logs, metrics)

Current issue: Claude's reasoning is fragmented and incomplete, making it hard to understand decision chains like:

[10:30:40] Claude: "The pod restart count is increasing. I need to check the logs to"
[10:30:40] Tool: kubectl_logs(pod="api-server-xyz")
[10:30:43] Claude: "Found OOM errors. The memory limit needs to be increased. Let me upd"
[10:30:48] Tool: kubectl_patch(resource="deployment/api-server", patch=...)

Every sentence is cut off mid-thought, making audit logs nearly unreadable.

Additional Context

  • This affects any long-running automation workflow using claude + mcp
  • The issue is more visible when claude makes rapid tool calls (common in automation scenarios)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING