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

Japanese version: IExpressionContract (契約仕様)

IExpressionContract (Contract Specification)

1. Responsibility Boundary

IExpressionContract defines how finalized logic is expressed, while preserving strict separation between reasoning and expression layers.

  • Role:
  • Provide expression-time conventions such as style, examples, templates, and analogies.

  • Non-role:
  • It must not generate or alter reasoning logic. Expression metadata must not leak into reasoning inputs. Isolation checks and application gates belong to service interfaces such as IExpressionIsolationValidator and IExpressionApplicationGate.

2. Contract Signature

using AIKernel.Dtos.Context;\n\nnamespace AIKernel.Contracts;\n\n/// <summary>\n/// 表現(Expression)契約を定義します。\n/// 推論が完全に終了した後にのみ適用される、出力表現層の契約です。\n/// \n/// 参照: 2.CONTEXT_ISOLATION_SPEC.jp.md\n/// </summary>\npublic interface IExpressionContract\n{\n    /// <summary>\n    /// 表現層のコンテキストを取得します。\n    /// </summary>\n    ExpressionContextDto GetContext();\n\n    /// <summary>\n    /// 出力の文体を取得します。\n    /// </summary>\n    string? GetStyle();\n\n    /// <summary>\n    /// 説明用の例を取得します。\n    /// 注意: これらは推論には混入しません。\n    /// </summary>\n    IReadOnlyList<string> GetExamples();\n\n    /// <summary>\n    /// 説明テンプレートを取得します。\n    /// </summary>\n    string? GetDescriptionTemplate();\n\n    /// <summary>\n    /// 比喩・類推を取得します。\n    /// </summary>\n    IReadOnlyList<string> GetAnalogies();\n}
  • UC-04 Generation and output polishing:
  • Acts as the policy source used by IOutputPolisher during final rendering.

  • UC-06 Three-layer buffer boundary:
  • Enforces separation between reasoning context and expression context.

4. Governance & Determinism

  • Isolation enforcement:
  • IExpressionIsolationValidator.ValidateIsolation() is the gate for detecting expression-data leakage into reasoning context.

  • Post-inference application:
  • IExpressionApplicationGate.CanApplyAfterInference() should only allow application after Structure phase completion.

  • Deterministic rendering policy:
  • The same inputs should yield the same expression behavior under this contract.

5. Implementation Notes

  • Multilingual operation:
  • GetStyle(), GetExamples(), and GetAnalogies() should follow consistent locale-selection rules.

  • Auditability:
  • Keep template/example application traceable so output differences remain explainable.


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/contracts/IExpressionContract.md