P6: Composable and Predictable Command Structure

Definition

CLI tools MUST integrate cleanly with pipes, scripts, and other tools. That means handling SIGPIPE, detecting TTY for color and formatting decisions, supporting stdin for piped input, and maintaining a consistent, predictable subcommand structure.

Why Agents Need It

Agents compose CLI tools into pipelines:

tool list --output json | jaq '.[] | .id' | xargs tool get

Every link in that chain has to behave predictably. A tool that panics on SIGPIPE when piped to head breaks the pipeline. A tool that emits ANSI color codes into a pipe pollutes downstream JSON parsing. A tool with inconsistent subcommand naming forces the agent to memorize exceptions rather than apply patterns. Composability is what makes a CLI tool a building block rather than a dead end.

Requirements

MUST:

SHOULD:

MAY:

Evidence

Anti-Patterns

Measured by check IDs p6-sigpipe, p6-no-color, p6-completions, p6-timeout, p6-agents-md. Run agentnative check --principle 6 . against your CLI to see each.