AIKernel.NET
version: 0.0.2 / status: Refactor / edition: Draft / published: 2026-05-16 / updated: 2026-05-16

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:
  • validate output shape, render into markdown/structured forms, and apply final tone/style adjustments.

  • Non-role:
  • 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.

  • UC-04 Generation and Output Polishing:
  • acts as the final processing stage before writing to ExpressionBuffer.

  • UC-17 Chat Diffing:
  • indirectly constrains canonical output formatting for diff-friendly comparison.

4. Governance & Determinism

  • Deterministic rendering:
  • identical RawLogic and ExpressionContext inputs must converge to identical output.

  • Fail-Closed:
  • 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:
  • a precise RequiredCapacity enables IModelVectorRouter to optimize where polishing should run.

  • Canonicalization recommendation:
  • 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
Source: architecture/interfaces/execution/IOutputPolisher.md