For Japanese version, see IOutputPolisher-jp.md.
IOutputPolisher (Interface Specification)
1. Responsibility Boundary
IOutputPolisher defines the boundary that converts intermediate reasoning output (RawLogic) into final user/system-facing expression output.
- Role:
- Non-role:
validate output shape, render into markdown/structured forms, and apply final tone/style adjustments.
core reasoning generation belongs to IThoughtProcess; this interface focuses on finalization.
2. Contract Signature
namespace AIKernel.Abstractions.Execution;\n\n/// <summary>\n/// Renders intermediate reasoning output into final expression output.\n/// </summary>\npublic interface IOutputPolisher\n{\n /// <summary>\n /// Minimum model capability required by this polisher.\n /// </summary>\n ModelCapacityVector RequiredCapacity { get; }\n\n /// <summary>\n /// Renders final output from intermediate logic and expression context.\n /// </summary>\n /// <param name="logic">Intermediate logic generated by a model</param>\n /// <param name="expressionContext">Formatting and expression constraints</param>\n /// <param name="ct">Cancellation token</param>\n /// <returns>Final polished output string</returns>\n Task<string> RenderAsync(RawLogic logic, ExpressionContext expressionContext, CancellationToken ct = default);\n}
Note: OutputValidationException is a representative implementation-layer exception name. The current abstraction contract does not hard-code exception type names.
3. Related Use Cases
UC-04Generation and Output Polishing:UC-17Chat Diffing:
acts as the final processing stage before writing to ExpressionBuffer.
indirectly constrains canonical output formatting for diff-friendly comparison.
4. Governance & Determinism
- Deterministic rendering:
- Fail-Closed:
identical RawLogic and ExpressionContext inputs must converge to identical output.
if expressionContext constraints cannot be satisfied (for example, valid JSON requirement), terminate on the reject side instead of returning partial output.
5. Implementation Notes
- Capability-based routing:
- Canonicalization recommendation:
a precise RequiredCapacity enables IModelVectorRouter to optimize where polishing should run.
remove non-semantic variance such as markdown spacing drift and JSON property-order drift.
Changelog
- v0.0.0 / v0.0.0.0: Initial draft
- v0.0.1 (2026-05-06): Version upgrade aligned with documentation guidelines
architecture/interfaces/execution/IOutputPolisher.md