# ADR 0004 — CLI as the primary interface for agents

**Status:** accepted. **Date:** 2026-12-03.

## Decision
- Every command accepts `--json` and returns a single object `{ ok, command, exitCode, data, diagnostics }`.
- Stable exit codes: 0 success, 1 problems found, 2 invalid usage, 3 environment, 70 internal error. An environment failure is never confused with a code failure.
- `fellow help --json` describes commands, arguments, options and which commands change state.
- Diagnostics have a stable id, severity, rule, file, line, cause and suggestion.
- Generators produce a plan; `--dry-run` shows it; re-running is safe; a divergence is a conflict, never a silent overwrite.
- No command asks for interactive input.

## Consequences
- Diagnostic ids and exit codes become public API and follow semantic versioning.
- MCP and skills must be a thin layer over these same commands, with no logic of their own.
