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

Japanese version: IKernelContextContract (契約仕様)

IKernelContextContract (Contract Specification)

1. Responsibility Boundary

IKernelContextContract defines execution-unit identity, lifetime, and requester attributes used as governance and resource-control anchors at kernel level.

  • Role:
  • Provide context ID, creation/expiry timestamps, requester identity, lifecycle state, and metadata.

  • Non-role:
  • It does not manage fragment payloads; content handling belongs to IContextCollection.

2. Contract Signature

namespace AIKernel.Contracts;\n\n/// <summary>\n/// Kernel コンテキスト契約を定義します。\n/// カーネルレベルの実行コンテキスト管理を行います。\n/// </summary>\npublic interface IKernelContextContract\n{\n    /// <summary>\n    /// コンテキストの一意識別子を取得します。\n    /// </summary>\n    string ContextId { get; }\n\n    /// <summary>\n    /// コンテキスト作成時刻を取得します。\n    /// </summary>\n    DateTime CreatedAt { get; }\n\n    /// <summary>\n    /// コンテキストの有効期限を取得します。\n    /// </summary>\n    DateTime ExpiresAt { get; }\n\n    /// <summary>\n    /// リクエスト元の識別子を取得します。\n    /// </summary>\n    string RequesterId { get; }\n\n    /// <summary>\n    /// コンテキストの状態を取得します。\n    /// </summary>\n    string State { get; }\n\n    /// <summary>\n    /// コンテキストに関連するメタデータを取得します。\n    /// </summary>\n    IReadOnlyDictionary<string, object>? Metadata { get; }\n}
  • UC-09 Execution state persistence and restore:
  • Uses ContextId as the unique key for suspend/resume targets.

  • UC-20 Deterministic replay and audit trail:
  • Contributes actor/time/state evidence and fixed replay preconditions.

4. Governance & Determinism

  • Immutable anchors:
  • ContextId and CreatedAt are expected to remain unchanged during lifecycle.

  • Time governance:
  • Execution should be denied after ExpiresAt in fail-closed operation.

  • Logical isolation:
  • RequesterId acts as a boundary key to prevent cross-context contamination.

5. Implementation Notes

  • Replay fidelity:
  • Keep replay-critical hints (seed, constraint hash, etc.) in Metadata where appropriate.

  • Serialization stability:
  • Implementing DTOs should support stable JSON serialization for persistence and audit portability.


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/IKernelContextContract.md