Expand description
Verb response presentation modes and transformation (ADR-045).
Handlers always return a canonical (verbose) shape. This module transforms that shape into a caller-appropriate form AFTER dispatch, BEFORE wire serialization.
§Transformation rules
| Field type | Verbose form | Agent form |
|---|---|---|
| UUID (36-char) | "a1b2c3d4-e5f6-..." | "a1b2c3d4" (8 chars) |
| ISO-8601 timestamp | "2026-05-23T16:18:15.234Z" | "2026-05-23T16:18" (< 24h: "3m ago") |
Empty string "" | included | dropped |
Empty array [] | included | dropped |
Empty object {} | included | dropped |
null (non-lifecycle) | included | dropped |
null (lifecycle *_at, relationship markers) | included | preserved |
| Score fields | 0.1234567890 | 0.123 (3 sig figs) |
§Human mode design decision (ADR-045 C3)
Human mode (presentation=human) is intentionally a no-op at the MCP
runtime layer — it returns the same canonical JSON as Verbose. The full
terminal formatting described in ADR-045 §3 (relative timestamps, glyph
substitution, table layout, UUID dimming) is the responsibility of the
CLI layer (khive-cli::format::pretty), not the MCP response pipeline.
Rationale: MCP responses are consumed by callers over a JSON transport.
Injecting ANSI escape codes or table-layout whitespace into JSON would corrupt
the response for non-terminal consumers. The CLI receives verbose JSON and
applies the terminal transform before printing. Implementing terminal
formatting inside present() would couple the runtime to a display concern
that belongs at the output layer.
Consequence: agents that call presentation=human receive verbose JSON. This
is documented behavior, not a bug. If the CLI is the caller it applies its own
second-pass formatting — it should not use presentation=human over MCP
precisely because the MCP boundary is not a terminal.
Verbose mode passes through canonically. Human mode is identical to
Verbose at this layer by design.
Chain invariant: present_response MUST NOT be called on intermediate
chain results — only on the final response envelope after all $prev
substitutions complete.
Enums§
- Presentation
Mode - How the response envelope is presented to the caller (ADR-045).
Functions§
- micros_
to_ iso - Convert a microsecond epoch
i64to an RFC 3339 / ISO-8601 string. - present
- Transform a successful verb result value according to the given
PresentationMode.