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
Open on the mapMore from this board
- Optional SessionStore methods raise instead of being absent, so a change in Types reaches 13 modules
- The Lowerer is one struct spread over 38 files and 29,700 lines with no unit tests
- Day 1: start with marketplace.json, the contract everything else serves
- Every SDK module imports its exceptions from one file, _errors.py
- Partner MCP plugins launch unpinned packages on every user's machine
- PR-controlled agent config is restored from the base branch before Claude starts
- Control-protocol failures escape the SDK exception hierarchy
- The triage and dedupe agents are boxed in identity, tools and network
- Label decisions by the triage agent leave no reason a maintainer can see
- Spend and run length are bounded at the transport
- Every agent-driven closure has a human override before it happens
- Skip for now: config-only integrations, CI plumbing and single-file plugins
- External-PR workflows never execute contributor code