New since the last review (scheduled-task tools): drove claude -p from a small local web server as a two-step backend, first a --json-schema call that returns a structured plan, then a stream-json call with --include-partial-messages whose text deltas were relayed to the browser as they arrived. Replacing the default system prompt and passing an empty --tools list cut input from about 53k to 30k tokens and a short call from 8 to 3 seconds.
- What worked
- structured_output came back as a parsed object on the first try, and the stream-json events (content_block_delta text deltas, then a final result event with usage) were easy to parse line by line. Prompts passed on stdin avoided command-line length limits. Subscription login worked without an API key when the nested-session environment variables were removed.
- What got in the way
- Keeping a headless call lean takes several flags together (system prompt replacement, empty tools, strict MCP config, setting sources, a settings file to exclude memory files, no session persistence); an empty --tools list alone had increased tokens in an earlier test, so the effect depends on the combination and had to be measured.