claude-stream-json

claude-stream-json is a skill for Claude Code from littlebearapps/untether. It costs 65 tokens per session (2,216 once invoked), scanned C, original, MIT.

A reference for reading the JSONL messages produced by the Claude Code command-line tool. JSONL is a text format where each line contains one JSON message, and Untether is the program that starts Claude Code and reads those messages.

In plain words
What is it for?
Use it when building or maintaining Untether's Claude Code runner, subprocess handling, input and control messages, permission modes, or event mappings.
Why use it?
It explains how to interpret Claude Code output, send input, handle permissions, and translate events without guessing the protocol.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: names the ExitPlanMode tool; mentions Claude Code.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/littlebearapps/untether/claude-stream-json
Any agent
npx skills add littlebearapps/untether --skill claude-stream-json
Clone the repo
git clone --depth 1 https://github.com/littlebearapps/untether

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for claude-stream-json

README.md
[![agentmods](https://agentmods.dev/badge/skills/littlebearapps/untether/claude-stream-json.svg)](https://agentmods.dev/skills/littlebearapps/untether/claude-stream-json)
Your own site
<a href="https://agentmods.dev/skills/littlebearapps/untether/claude-stream-json"><img src="https://agentmods.dev/badge/skills/littlebearapps/untether/claude-stream-json.svg" alt="Measured on agentmods" height="20"></a>
Per session 65 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,216 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00065 $0.02216
Opus 5 $0.00032 $0.01108
Sonnet 5 $0.00013 $0.00443
Haiku 4.5 $0.00006 $0.00222

Measured 6d ago against content hash 1bdef80013d8, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade C, and why

claude-stream-json scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

"tool_name":"Bash","tool_input":{"command":"rm -rf /"}}}

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

ClaudeRunner uses `pty.openpty()` instead of `subprocess.PIPE` for stdin:
.claude/skills/claude-stream-json/SKILL.md · 241 lines

How it starts

The opening of the file, as written. The whole thing — 241 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Claude Code stream-json Protocol (Consumer)

Untether spawns Claude Code CLI as a subprocess and consumes its JSONL output. This skill covers the protocol from Untether's perspective.

Key files

File Purpose
src/untether/runners/claude.py ClaudeRunner — subprocess management, PTY, control channel, event translation
src/untether/schemas/claude.py msgspec structs for Claude JSONL events
src/untether/runners/tool_actions.py tool_kind_and_title() — tool name to ActionKind mapping
docs/reference/runners/claude/runner.md Full runner specification
docs/reference/runners/claude/stream-json-cheatsheet.md JSONL event shapes with examples
docs/reference/runners/claude/untether-events.md Claude JSONL to Untether event mapping

CLI invocation

Non-interactive mode (-p)

claude -p --output-format stream-json --input-format stream-json --verbose -- <prompt>
  • -p / --print: non-interactive, prompt as positional arg after --
  • --verbose: required for full stream-json output
  • --input-format stream-json: enables JSON input on stdin
  • Prompt passed after -- to protect prompts starting with -

Interactive permission mode

claude --output-format stream-json --input-format stream-json --verbose \
  --permission-mode plan --permission-prompt-tool stdio
  • No -p flag — prompt sent via stdin as JSON user message
  • --permission-prompt-tool stdio: enables bidirectional control channel
  • --permission-mode plan|tool: determines what needs approval

Common flags

  • --resume <session_id>: resume a previous session
  • --model <name>: model override (sonnet, opus, haiku)
  • --allowedTools "<rules>": auto-approve specific tools

JSONL event types

One JSON object per line on stdout. Required field: type.

system (init)

{"type":"system","subtype":"init","session_id":"...","cwd":"/repo","model":"sonnet",
 "permissionMode":"auto","tools":["Bash","Read","Write"],"mcp_servers":[...]}

Read the full file on GitHub · 241 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 241 lines · 65 tokens per session scan C 1bdef80013d8

Subscribe to this mod's changes

claude-stream-json is a skill published in the GitHub repository littlebearapps/untether (66 stars, last pushed 5d ago), licensed MIT. It adds 65 tokens to every session and 2,216 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it C with 2 findings (recursive force delete, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.