AIToday
Large Language ModelsAI Coding AssistantsZenn AI/MLPublished: Oct 18, 2026, 10:00 JST

stream-json lets apps drive Claude Code, tanacode 2.0.0 shows

stream-json lets apps drive Claude Code, tanacode 2.0.0 shows

3 Key Points

  1. What happened

    The developer of tanacode, an unofficial macOS app, documented driving Claude Code via stream-json: sending user lines, answering can_use_tool permission requests, replying to AskUserQuestion prompts, and interrupting turns with control_request.

  2. Why it matters

    Unlike one-shot claude -p, which ends after one answer and needs --resume, stream-json keeps one process alive for many turns, making it usable for in-house chatbots, editor extensions, and CI scripts.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, in your inbox every morning.

Context & Analysis

Stream-json is framed as a middle path between two other ways of running Claude Code: the interactive terminal screen and the one-shot claude -p command. In one-shot mode, the process ends after a single answer, so continuing a conversation requires restarting with --resume and gives no way to answer permission checks mid-turn. Stream-json instead keeps the CLI process open until standard input is closed, so a program can send successive user lines and receive assistant, result, and control_request lines as the turn progresses.

The developer's own app, tanacode, illustrates why this matters in practice. Version 1.x ran the interactive screen in the background and read its text to build chat and permission cards, a design that broke whenever Claude Code's screen changed slightly. Version 2.0.0 rebuilt the chat on stream-json and removed the screen-reading code, so permission prompts and questions become cards built from can_use_tool requests and answers flow back as control_response lines.

Operational caveats are also flagged: programs should reply to every CLI request even if unused, interrupted messages remain in the conversation, and stream-json sessions do not show up in the claude --resume list, requiring the session_id from the init line to resume. The developer notes that stream-json line formats may change with Claude Code updates, and says tanacode runs the latest Claude Code against a mock API daily to detect new line types.

FAQ
What is stream-json in Claude Code?
It is a mode where the app and the Claude Code CLI exchange one JSON object per line over standard input and output, allowing many turns in a single process and JSON-based answers to permission prompts.
How do you answer Claude's permission prompts from a program?
The CLI sends a control_request with subtype can_use_tool; the app replies with a control_response carrying the same request_id and behavior 'allow' or 'deny'.
How do you answer an AskUserQuestion prompt?
The question arrives in the same can_use_tool request with questions in input; the app returns the original input plus an answers map from question to selected option label.

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleMeta pulls scraping clause from business terms after Nieman Lab scrutiny