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:
- Non-role:
Provide context ID, creation/expiry timestamps, requester identity, lifecycle state, and metadata.
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}
3. Related Use Cases
UC-09Execution state persistence and restore:UC-20Deterministic replay and audit trail:
Uses ContextId as the unique key for suspend/resume targets.
Contributes actor/time/state evidence and fixed replay preconditions.
4. Governance & Determinism
- Immutable anchors:
- Time governance:
- Logical isolation:
ContextId and CreatedAt are expected to remain unchanged during lifecycle.
Execution should be denied after ExpiresAt in fail-closed operation.
RequesterId acts as a boundary key to prevent cross-context contamination.
5. Implementation Notes
- Replay fidelity:
- Serialization stability:
Keep replay-critical hints (seed, constraint hash, etc.) in Metadata where appropriate.
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
architecture/interfaces/contracts/IKernelContextContract.md