Fluxio
← ब्लॉग पर वापस जाएँ

Watching Claude Code Think in Your Terminal

कोडिंग एजेंट, लाइवEN

§1 What you can actually watch

Watching Claude Code “think” usually means watching its work become visible: generated text, tool requests, tool results, and progress updates. It does not mean accessing a complete transcript of the model’s private reasoning. That distinction matters when you build a terminal interface or debug an agent that appears to pause.

This walkthrough starts with Claude Code’s interactive display, then switches to structured streaming output. You will capture events, extract incremental text, and learn why a quiet terminal does not necessarily mean a stalled request.

§2 Step 1: Check your installed CLI

Run claude --version, followed by claude --help. Confirm that your installation supports print mode, the stream-json output format, and partial-message events. CLI behavior can change between releases, so your installed help is the best reference for supported flags.

Start in a small project directory without sensitive files. For this exercise, use a read-only prompt such as “Describe the project structure without modifying any files.” Keep normal tool permissions enabled rather than bypassing safeguards just to make the demonstration smoother.

§3 Step 2: Observe the interactive experience

Launch claude and submit your prompt. Watch how the interface distinguishes assistant text from tool activity and permission requests. Depending on your version and settings, some activity may be summarized or collapsed.

This display is useful for human supervision, but it is not a stable machine-readable protocol. Avoid scraping terminal animations or interpreting every status label as a separate model event. For logging, filtering, or building your own interface, use structured output instead.

§4 Step 3: Capture the structured event stream

Run this command in a shell with the tee utility available:

$ claude -p 'Describe the project structure without modifying any files.' --output-format stream-json --verbose --include-partial-messages | tee session.jsonl

The print flag runs a noninteractive request. The output-format flag selects newline-delimited JSON, verbose enables the detailed output required by this mode, and include-partial-messages requests incremental events. The tee command displays standard output while saving it to a file.

Expect several kinds of records rather than one uninterrupted answer. You may see initialization metadata, assistant messages, partial stream events, tool-related messages, and a final result. Diagnostics written to standard error are separate from the JSON stream.

§5 Step 4: Read only the arriving text

Install jq if necessary, then open a second terminal in the same directory. While the first command is running, use:

tail -n +1 -f session.jsonl | jq --unbuffered -j 'select(.type == "stream_event" and .event.type == "content_block_delta" and .event.delta.type == "text_delta") | .event.delta.text'

This filter selects text deltas from partial stream events. Unbuffered output helps updates appear promptly, while the join-output option avoids inserting a newline after every fragment. Press your terminal’s interrupt shortcut when you finish watching the file.

Fragments are not necessarily individual tokens. Transport buffering and event packaging can combine generated text into larger chunks. Also, do not concatenate completed assistant messages with their partial deltas: that can duplicate the answer.

§6 Step 5: Interpret pauses and finish states

  • – Text pauses: The agent may be waiting for a tool, a permission decision, or more server output.
  • – Missing text: Your filter deliberately hides non-text events, so inspect the original JSON log before diagnosing a failure.
  • – Completion: Check the final result record and process exit status instead of assuming silence means success.
  • – Privacy: Logs can contain project details and tool output. Review them before sharing.

§7 Step 6: Choose a streaming-friendly connection

If you want a shared API connection across development tools, Fluxio is a streaming-first, pay-per-token relay that works with Claude Code, Codex, Gemini CLI, and OpenAI SDK clients. One key supports multiple model providers, making it useful when comparing streamed behavior across tools.

Its API base is https://api.fluxioapi.com; OpenAI-style clients add /v1. For Claude Code, follow Fluxio’s current compatibility instructions rather than assuming an OpenAI-style endpoint is interchangeable with its native connection. Verify authentication, model availability, and partial-event support before relying on a production integration.

Sign up for Fluxio to try streaming-first AI access.

Fluxio खाता बनाएँ →

इस धारा से और