From the Inside Claude Code - The Claude Code Ecosystem architecture map

The subprocess transport carries five responsibilities in one file

opportunity · low · verified

subprocess_cli.py is 1,228 lines combining CLI discovery across platforms, Windows path and batch-script security, options-to-argv building, process lifecycle with shielded terminate and kill escalation, and NDJSON line framing. The framing and lifecycle parts are carefully tested (test_subprocess_buffering.py, test_close_cancellation.py), but every change goes through the same module.

Recommendation (medium effort): Split it into cli_discovery, command_builder and process modules behind the existing SubprocessCLITransport class; the framer and command builder are pure and easy to test on their own.

The trail

  1. Subprocess CLI Transport
Open on the map

More from this board