Skip to content

Default to claude and stream its answers live - #79

Merged
lacymorrow merged 1 commit into
mainfrom
feat/claude-default-streaming
Sep 30, 2026
Merged

lacymorrow merged 1 commit into
mainfrom
feat/claude-default-streaming

Conversation

@lacymorrow

Copy link
Copy Markdown
Owner

Claude is now Lacy's default tool, and its answers stream as they're written.

Streaming

Lacy runs claude -p with --output-format stream-json --include-partial-messages. A small filter (lib/core/claude_stream.py) prints each text chunk as it arrives, stops the spinner at the first chunk, and hands claude's final result event back to the existing code. So --resume, the resume retry, error framing and Ctrl+C handling are unchanged. Without python3, Lacy falls back to today's wait-for-JSON behavior.

Measured in a pty with "count from 1 to 300":

number shown before after
50 at the end 5.2s
100 at the end 6.1s
200 at the end 7.2s
300 8.5s 8.5s

Trade-off: streamed text is printed raw, not through glow or the basic markdown renderer.

Default tool

  • claude comes first in the auto-detect order and is marked "recommended".
  • With no tool installed, install.sh and lacy setup offer to install Claude Code instead of lash. lash's free tier refuses lash run, so it can't answer out of the box.
  • lacy doctor points to claude or lacy setup.

Tests

  • test_runtime gets a streaming section with a fake claude emitting stream-json. It checks that text is shown exactly once, the session is captured, the flags are passed, an error result with no text is still reported, and Ctrl+C isn't retried. 10 new assertions, run in bash and zsh.
  • Full script/test.sh passes locally, 21/21, including the live suite (claude and codex PASS in both shells).

- claude is first in LACY_TOOL_LIST (auto-detect order) and marked
  recommended. With no tool installed, install.sh and `lacy setup` offer
  Claude Code instead of lash; lash's free tier refuses `lash run`, so it
  cannot answer out of the box. `lacy doctor` points to claude / lacy setup.
- claude answers stream: with python3, Lacy runs claude with
  --output-format stream-json --include-partial-messages and
  lib/core/claude_stream.py prints text chunks as they arrive, stops the
  spinner at the first one, and hands the final result event back, so
  --resume, the resume retry, error framing, and Ctrl+C handling are
  unchanged. Without python3 it waits for --output-format json as before.
  Streamed text is printed raw (no markdown renderer), like other CLIs.

Measured in a pty with "count from 1 to 300": 50 at 5.2s, 100 at 6.1s,
200 at 7.2s, 300 at 8.5s (before: everything at the end).
@lacymorrow
lacymorrow merged commit 0a35630 into main Sep 30, 2026
13 checks passed
@lacymorrow
lacymorrow deleted the feat/claude-default-streaming branch September 30, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant