For Japanese version, see IRomDocument-jp.md.
IRomDocument (ROM Document Specification)
1. Responsibility Boundary
IRomDocument is the core contract for treating Relation-Oriented Markdown (ROM) as human-readable yet machine-verifiable invariant intelligence assets.
- Role:
- Non-role:
Expose identity/type/body/metadata/references and provide canonicalization/hash entry points.
Physical storage I/O is out of scope; this interface models logical document properties.
2. Contract Signature
namespace AIKernel.Abstractions.Rom;\n\n/// <summary>\n/// Relation-Oriented Markdown (ROM) ドキュメントの抽象化。\n/// RCS-001: ROM 文書は entity.id と entity.type を持たなければならない(MUST)。\n/// RCS-002: [[id]] は解決可能な参照でなければならない(MUST)。\n/// </summary>\npublic interface IRomDocument\n{\n /// <summary>\n /// エンティティの ID。\n /// RCS-001: entity.id 必須。\n /// </summary>\n string EntityId { get; }\n\n /// <summary>\n /// エンティティの型。\n /// RCS-001: entity.type 必須。\n /// </summary>\n string EntityType { get; }\n\n /// <summary>\n /// ROM ドキュメントのバージョン。\n /// SGS-006 の署名対象に含まれる。\n /// </summary>\n string Version { get; }\n\n /// <summary>\n /// 本文(Markdown)。\n /// RCS-003: 事実は bullet 形式で宣言的に記述される。\n /// </summary>\n string Body { get; }\n\n /// <summary>\n /// YAML front matter のメタデータ。\n /// </summary>\n IReadOnlyDictionary<string, string> Metadata { get; }\n\n /// <summary>\n /// ドキュメント内に含まれるすべての関係参照([[id]])。\n /// RCS-002: 参照可能性の検証に用いる。\n /// </summary>\n IReadOnlyList<string> RelationReferences { get; }\n\n /// <summary>\n /// セマンティックハッシュを取得します。\n /// RCS-004: 正規化後の Semantic Hash を算出できなければならない(MUST)。\n /// </summary>\n /// <returns>ハッシュ値(例: "sha256:a1b2c3d4...")</returns>\n Task<string> GetSemanticHashAsync();\n\n /// <summary>\n /// ドキュメントを正規化された形式に変換します。\n /// RCS-004 の正規化処理(Linguistic, Structural, Reference Anchoring)。\n /// </summary>\n /// <returns>正規化されたドキュメント表現</returns>\n Task<CanonicalizedRomDto> CanonicalizeAsync();\n}
3. Related Use Cases
UC-01ROM loading and parsing:UC-13Runtime signature verification and governance:UC-15Context hydration:
Supplies structurally valid ROM assets to kernel pipelines.
GetSemanticHashAsync() underpins tamper detection and trust checks.
Uses RelationReferences to recursively compose contextual assets.
4. Governance Rules
RCS-001Identity:RCS-002Integrity:RCS-004Invariance:
Missing EntityId/EntityType should fail closed.
Unresolvable relation references indicate integrity failure.
CanonicalizeAsync() must return stable canonical output for semantically identical input.
5. Exception Contract
This interface does not hard-code exception types. Implementations should clearly surface:
- Missing required attributes:
- Hash/canonicalization failures:
Identity/type/version structural violations.
Malformed or unsupported ROM representations.
6. Implementation Notes
- Bilingual asset discipline:
- Reference extraction:
Keep shared EntityId consistency between -jp.md and .md counterparts.
Ensure [[id]] references are fully materialized in RelationReferences for resolver checks.
Changelog
- v0.0.0 / v0.0.0.0: Initial draft
- v0.0.1 (2026-05-06): Version upgrade aligned with documentation guidelines
architecture/interfaces/rom/IRomDocument.md