Structured Output Protocol
Scope#
Implement the named follow-up slice from
2026-05-07-agent-first-cli-surface.md: add a shared CommandOutcome protocol
with the four shapes success, noop, needs-action, and error, then use it
for the agent lifecycle commands where fixable failures matter most.
Decisions#
- Keep the existing
{ stdout, stderr, exitCode }command return contract.CommandOutcomeis rendered into that contract so existing commands do not need a repo-wide rewrite. - Add
--jsontobootstrapandcapturefor structuredCommandOutcomeoutput. - Suppress streaming output when
--jsonis active so stdout remains parseable. - Keep human behavior compatible: fixable failures still go to stderr with the
almanac:prefix and a one-line fix hint.
Implemented#
src/cli/outcome.tsbootstrap --jsoncapture --jsonneeds-actionoutcomes for auth, populated wiki, and missing wiki casesnoopoutcome for capture runs where no pages changed- focused tests for outcome rendering and lifecycle command JSON
Out Of Scope#
- Migrating every query command to
CommandOutcome - Changing exit-code policy globally
- Removing compatibility aliases or reshaping command groups